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
enumE{A='a',B='b'}classC{readonlytype=E.A;}letx: E.A=newC().type;// no error, type is inferred to E.A, not E.
Expected behavior:
I expect similarly the .d.ts emitted to have a narrowed declaration for 'type'
declareclassC{readonlytype: E.A;}
Actual behavior:
Emitted .d.ts contains:
declareclassC{readonlytype: E;}
Note this is critical for creating tagged unions for type narrowing, and this behavior makes type narrowing only work when one is not crossing a '.d.ts' boundary. Bazel compliations usually look like 2-3 .ts files and hundreds to thousands .d.ts files from downstream compilations.
Related Issues:
The text was updated successfully, but these errors were encountered:
TypeScript Version: 3.1.0-dev.20180726
Search Terms:
enum literals declarations
Code
Expected behavior:
I expect similarly the .d.ts emitted to have a narrowed declaration for 'type'
Actual behavior:
Emitted .d.ts contains:
Note this is critical for creating tagged unions for type narrowing, and this behavior makes type narrowing only work when one is not crossing a '.d.ts' boundary. Bazel compliations usually look like 2-3 .ts files and hundreds to thousands .d.ts files from downstream compilations.
Related Issues:
The text was updated successfully, but these errors were encountered: