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 }}
Repository navigation
Adding keyword-named properties to functions generates invalid declarations #38750
BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".
Any syntactically valid output. Since namespaces can't hold keyword names one option is generating an object type with call signature:
declarevarfoo: {(): void;null: boolean;}
This change would also allow to generate declarations for statically-analyzable dynamic property access expressions (i.e. foo["foo bar"] = true), which are currently omitted from declarations, resulting different behavior between in-project and out-of-project values.
Actual behavior:
declarefunctionfoo(): void;declarenamespacefoo{varnull: boolean;// ^^^^^^^ TS2693: 'boolean' only refers to a type, but is being used as a value here.// ^^^^^ TS1134: Variable declaration expected.}
BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".
Activity
DanielRosenwasser commentedon May 26, 2020
We can generate a temp name and re-export with the right name.
Just make sure that everything else is still exported (i.e.
yaddais accessible in the generated.d.tsfile for the following).