Closed alphaone closed 1 year ago
When I define the schema without the required
properties:
const dogSchema = {
type: "object",
properties: {
name: { type: "string" },
age: { type: "integer" },
hobbies: { type: "array", items: { type: "string" } },
favoriteFood: { enum: ["pizza", "taco", "fries"] },
},
// required: ["name", "age"],
} as const;
then I will get a type with all undefined
types:
type Dog = {
[x: string]: unknown;
name?: undefined;
age?: undefined;
hobbies?: [] | undefined;
favoriteFood?: undefined;
}
I found the problem.
I had
"noStrictGenericChecks": true,
for some reason in my tsconfig.json
.
After removing this, everything works like expected.
Thanks @alphaone ! Will add it to the README !
Hey,
I am trying the example for the README and I get
never
as the resulting type :\I am using Typescript
4.8
on MacOS12.6
and this is mypackage.json
:Any idea, what I am doing wrong?