ajv-validator / ajv-validator/ajv-formats

How to use it with typescript for type safety?

未關閉
#89 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
TypeScript
星號
228
分支
42
PR 合併指標
30 天內沒有已合併 PR

描述

How can I use this package with type safety? Is there any way to extend JsonScehamType to includes the types for ajv-format? I couldn't find a way to do that.

```
import { JSONSchemaType } from 'ajv';

type Example = {
age: number;
name: string;
};
const sample: JSONSchemaType = {
type: 'object',
properties: {
age: { type: ['integer'] },
name: {type: ['string'], format: ['']}
},
};

```
In the above example I want to apply some formats to `name` but it's type is `string`.

thanks.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。