Allow as precompiled type cast for type inference #39385
Labels
Declined
The issue was declined as something which matches the TypeScript vision
Suggestion
An idea for TypeScript
Search Terms
runtime const infer inference compile pre dynamic type as
Suggestion
Let known variable types be precompiled to infer types using special cast
as precompiled
It would be very helpful in type inference of dynamic code that is generated in runtime but has all types known statically
Example
Now type may be inferred for some variables that have very basic types
But what if we do not want to write types for something that is generated from everything known before compilation
Also same feature can be used inside function so proper type inference may be used
That would allow route params type infer
It only should work when all variables for pre-compilation are known and do not emit any runtime code, only static type checking but with some dynamic features.
Overall feature sound like, run the code if everything is statically known and than cast the result with as const
The text was updated successfully, but these errors were encountered: