Closed samhh closed 2 years ago
In the future we might be able to use satisfies
operator instead of a type assertion: https://github.com/microsoft/TypeScript/issues/47920#:~:text=hopefully%20become%20obvious.-,Safe%20Upcast,-Frequently%20in%20places
Fixes #111 by annotating plain switch conditions with
as typeof
. Supercedes #133 which solved the same problem with IIFEs. A test which is fixed by the final commit is included as suggested.Includes some refactoring to try and make the JS compiler a bit more extensible. Not entirely sold on this approach but it works without sacrificing the JS compiler's independence.