Opaque type for singular SemVer version.
Use assertIsSemVerVersion and isValidSemVerVersion to cast to proper type.
const unsafeVersion: string = dataFromUser();assertIsSemVerVersion(unsafeRange);unsafeVersion// ^? SemVerVersion
If you know what you're doing and want to side-step type safety, casting from a string works correctly.
const unsafeVersion: string = dataFromUser();unsafeRange as SemVerVersion;// ^? SemVerVersion
Opaque type for singular SemVer version.
Example
Use assertIsSemVerVersion and isValidSemVerVersion to cast to proper type.
Example
If you know what you're doing and want to side-step type safety, casting from a string works correctly.
See