|
|
|
|
|
by mhermher
1362 days ago
|
|
I really wanted this in my earlier usage of typescript as well. But the solution really is to assume `: unknown` at API boundaries and run the values through assertion functions: `isSomeType(x: unknown): asserts x is SomeType`. After using this sort of pattern, I don't think I would want automatic runtime checks anymore, because creating your own explicitly and calling it explicitly works out not so bad. |
|
Well, until this is released! https://github.com/microsoft/TypeScript/pull/50666