Skip to content

How to use it with typescript for type safety? #89

Open
@shahinghasemi

Description

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<Example> = {
  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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions