Skip to content
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

feat(jex): replace any by unknown #431

Merged
merged 2 commits into from
Oct 16, 2024
Merged

Conversation

franklevasseur
Copy link
Member

In typescript,any is equivalent to a // @ts-ignore indicator. It tells typescript not to check the type.

In JSON Schema, any does not exist. An empty schema means a schema with no constraints or in other words, any kind of data. An empty schema should thus be treated like unknown; i.e. the most global type.

This way, unknown ⊈ string, but string ⊆ unknown

@franklevasseur franklevasseur requested a review from a team as a code owner October 16, 2024 20:25
test('jex-extends should be true if child or parent is any', () => {
expectJex($.any()).toExtend($.any())
expectJex($.string()).toExtend($.any())
expectJex($.any()).toExtend($.string())
Copy link
Member Author

Choose a reason for hiding this comment

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

note: This last test is no longer valid, making this PR a breaking change

@franklevasseur franklevasseur merged commit a60a924 into master Oct 16, 2024
1 check passed
@franklevasseur franklevasseur deleted the fl_replace_any_by_unknown branch October 16, 2024 20:37
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.

2 participants