Skip to content

Conversation

@toomuchdesign
Copy link
Contributor

Add support for a new omitAdditionalProperties FromSchema option.

When the option is true, FromSchema will ignore JSON schema additionalProperties values and always infer closed objects (omitting { [x: string]: unknown; } index signature type).

The option is disabled by default and no breaking changes are expected.

Implements: #219

{ omitAdditionalProperties: true }
>;

expectTypeOf<Set2>().toEqualTypeOf<{}>();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ended up using expect-type to assert against {} type.
Happy to find an alternative solution if we prefer not to introduce expect-type.

If we find expect-type valuable, we could refactor tests to use it extensively.

{ omitAdditionalProperties: true }
>;

expectTypeOf<Set>().toEqualTypeOf<{}>();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here: ended up using expect-type to assert against {} type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant