-
-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Encountering a bug in json-schema-to-ts version 3.1.0 where the handling of additionalProperties does not work as expected when properties is also provided. Instead of assigning the designated type to additional properties, they are treated as unknown.
Example to reproduce:
import type { FromSchema } from 'json-schema-to-ts';
type Output = FromSchema<{
type: 'object';
additionalProperties: { type: 'string' };
properties: {
something: { type: 'string' };
};
}>;Expected behavior:
type Output = {
[x: string]: string | undefined;
something?: string | undefined;
}Actual behavior:
type Output = {
[x: string]: unknown;
something?: string | undefined;
}The expected behavior would be to treat all additional properties as string or string | undefined (which makes more sense when it comes to dealing with the unknown and type compliant to the non required additional properties), aligning with the specified additionalProperties type.
JakobJingleheimer
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request