We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let's admit a simple base schema like this one:
const SnakeSchema = { type: 'object', properties: { name: { type: 'string' }, foo_bar: { type: 'string' }, }, } as const;
I want the type inference to work within my application, so I use the JTDDataType utility.
JTDDataType
import { JTDDataType } from 'ajv/dist/jtd'; const SnakeSchema = { /* ... */ } as const; type Snake = JTDDataType<typeof SnakeSchema>;
Now, let's write a simple patch:
const KebabSchema = { $patch: { source: SnakeSchema, with: [ { op: 'move', from: '/properties/foo_bar', to: '/properties/fooBar' }, ], }, } as const;
The only way I found to get the infered type is by doing this:
type Kebab = Omit<Snake, 'foo_bar'> & { fooBar: SnakeSchema['foo_bar'];
As it is not really DRY, I was wondering if there is something I miss in the docs... If not, maybe is there something that can be done in the project?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Let's admit a simple base schema like this one:
I want the type inference to work within my application, so I use the
JTDDataType
utility.Now, let's write a simple patch:
The only way I found to get the infered type is by doing this:
As it is not really DRY, I was wondering if there is something I miss in the docs... If not, maybe is there something that can be done in the project?
The text was updated successfully, but these errors were encountered: