Relative Content

Tag Archive for typescriptnarrowingtype-narrowing

How to narrow arguments with a union type?

I have an argument that is number | string, and try to derive a variable that is a number.
The following code shows what I expected to work. (That kind of thing would work in Python.)