You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First time to use this library and I like it :)
However I have an issue with optional strings:
The inferred string type is not marked as optional when schema is nested:
constPhoneSchema=createSchema({req: Type.number({required: true}),opt: Type.string(),// => I am setting 'opt' as optional},{_id: false,versionKey: false},);constUserSchema=createSchema({req: Type.string({required: true}),opt: Type.string(),// => I am setting 'opt' as optionalphones: Type.array({required: true}).of(PhoneSchema),},{_id: false,versionKey: false},);exporttypeUserProps=ExtractProps<typeofUserSchema>;
Hover over UserProps I see this:
typeUserProps={req: string;phones: {req: number;opt: string;// 'opt' is not optional!}[];opt?: string;// 'opt' here is optional which is correct}
I can only fix this by using of function on the object not in the schema as follows:
First time to use this library and I like it :)
However I have an issue with optional strings:
The inferred string type is not marked as optional when schema is nested:
Hover over
UserProps
I see this:I can only fix this by using of function on the object not in the schema as follows:
Now I see correct optional fields as follows:
Am I using this library correctly?
Is this a bug?
The text was updated successfully, but these errors were encountered: