Adding keyword-named properties to functions generates invalid declarations #38750
Labels
Bug
A bug in TypeScript
Domain: Declaration Emit
The issue relates to the emission of d.ts files
Effort: Moderate
Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".
Help Wanted
You can do this
Milestone
TypeScript Version: 4.0.0-dev.20200522
Search Terms:
Code
Expected behavior:
Any syntactically valid output. Since namespaces can't hold keyword names one option is generating an object type with call signature:
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:
Playground Link: https://www.typescriptlang.org/play?ts=4.0.0-dev.20200522#code/GYVwdgxgLglg9mABMOcAUBKRBvAvgKBTgDowQAbcxAXkSgCcQBTAbiA
Related Issues:
The text was updated successfully, but these errors were encountered: