I guess you've already recognized the natural number issue with TS. You can only enforce natural numbers or integers at runtime. I work on a type validator where you can write Nat(18) or Int(-18) instead of the number literal. Nat/Int are just subclasses of Number. In order to avoid the performance penalty I intend to erase the Nat(...)/Int(...) pattern during build process. However, frequently writing the constructor calls remains a bit tedious.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I guess you've already recognized the natural number issue with TS. You can only enforce natural numbers or integers at runtime. I work on a type validator where you can write
Nat(18)
orInt(-18)
instead of the number literal.Nat
/Int
are just subclasses ofNumber
. In order to avoid the performance penalty I intend to erase theNat(...)
/Int(...)
pattern during build process. However, frequently writing the constructor calls remains a bit tedious.