Branded types don't surface as typescript errors
Steps:
- Have code like this:
import type { E164Number } from 'libphonenumber-js'
const foo: E164Number = "some random text"
Expected:
When running a typecheck with tsc --noEmit
typescript should output an error since "some random text" is not an E164Number.
Actual:
Typescript is very happy with that type.
The problem is that the __tag
on the type is optional: !8 (comment 837866181)
But it should be required: https://github.com/piotrwitek/utility-types/blob/2491e464b9adfa88ff9f799e4fd151aa25b71249/src/mapped-types.ts#L549