-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
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
Add option to remove [k: string]: unknown | undefined;
from generated types
#572
Comments
I think you can use |
I have it like that and it still generates them @sudhanshug16 |
Maybe you have If that's the case and you really don't want to have that generic signature in your types, you can set additionalProperties to false on all the nodes, I am using this: export function setNoAdditionalProps(schema: SchemaObject) {
if (schema.type === "object") {
schema.additionalProperties = false;
for (const [, value] of Object.entries(schema.properties ?? {})) {
setNoAdditionalProps(value as SchemaObject);
}
}
if (schema.type === "array") {
setNoAdditionalProps(schema.items as SchemaObject);
}
} |
@sudhanshug16 oh that's right, I was trying to use the schema from https://github.com/jsonresume/resume-schema/blob/master/schema.json and it does have I will try this function later and let you know. Thank you so much! |
@sudhanshug16 sorry it took me so long to get back to this, but I wanted to let you know your |
Hi
I would like to make the generated types a bit more strict by removing the types:
[k: string]: unknown | undefined;
Is that possible? Otherwise, would you mind implementing such feature?
Thanks in advance!
The text was updated successfully, but these errors were encountered: