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

Add Type-safe strings for Number, Integer, Float #163

Merged
merged 1 commit into from
Jul 31, 2021
Merged

Conversation

Eyas
Copy link
Collaborator

@Eyas Eyas commented Jul 31, 2021

Schema.org Numbers, Integers, and Floats support being assigned to
strings with the appropriate fromat (e.g. "4394" for Integer). With
TypeScript 4.1.0 and beyond, this can be expressed with the
`${number}` type. This pushes the minimum required version for
schema-dts from 3.4.0 to 4.1.0, and is thus a breaking change.

Note there's a future situation where we would RESTRICT the Integer
type further; so that only valid integral numbers are assignable to it.
This will be another breaking change for another time, when TypeScript
can finally represent this.

Fixes #130.

Schema.org Numbers, Integers, and Floats support being assigned to
strings with the appropriate fromat (e.g. "4394" for Integer). With
TypeScript 4.1.0 and beyond, this can be expressed with the
`` `${number}` `` type. This pushes the minimum required version for
schema-dts from 3.4.0 to 4.1.0, and is thus a breaking change.

Note there's a future situation where we would RESTRICT the `Integer`
type further; so that only valid integral numbers are assignable to it.
This will be another breaking change for another time, when TypeScript
can finally represent this.

Fixes google#130.
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.

Type errors against Google's recommended Schema JSON-LD's
1 participant