You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Generate literal types for initialized constants #784
I'm not sure this is a good idea though. Closure Compiler has no concept of literal types, there is no type 'baz' for Closure Compiler. If we'd try to be clever and invent them, we're prone to break other guarantees in the system, e.g. subtyping when such fields are involved. Generally speaking I think we should only produce .d.ts that map Closure's type system into TS, without trying to add precision/fanciness that doesn't exist in Closure.
I looked briefly at changing this behavior, it requires using Node rather than JsType, but the function that emits the type is used in several places which will need to be updated, as well as their callers, there are many cascading things 😕
Activity
[-]Strictly type @const[/-][+]Generate literal types for initialized constants[/+]mprobst commentedon Oct 2, 2018
I think the term is literal types.
I'm not sure this is a good idea though. Closure Compiler has no concept of literal types, there is no type
'baz'for Closure Compiler. If we'd try to be clever and invent them, we're prone to break other guarantees in the system, e.g. subtyping when such fields are involved. Generally speaking I think we should only produce.d.tsthat map Closure's type system into TS, without trying to add precision/fanciness that doesn't exist in Closure./CC @rkirov might have an opinion.
Goodwine commentedon Oct 2, 2018
I looked briefly at changing this behavior, it requires using
Noderather thanJsType, but the function that emits the type is used in several places which will need to be updated, as well as their callers, there are many cascading things 😕