fix: disallow empty template literals in module import attribute types - #64243
fix: disallow empty template literals in module import attribute types#64243Cameron (camc314) wants to merge 2 commits into
Conversation
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
|
Hm, I'm not totally sure if the symmetry is necessary here - but the test coverage is at the least appreciated. Do you know if we also have tests for template string types with interpolations? If not, can you add those here? |
You're right that the symmetry isn't technically necessary: However, I think requiring quoted string literals here is the better design. ECMAScript explicitly distinguishes this exception also impacts downstream tools. For example, we can no longer use It's also worth noting, that since this is unreleased, we can change it without any breaking changes. If a usecase appears where it makes sense to use a TemplateLiterals here, it can easily be added.
I couldn't find any existing coverage. I've added this as a test case in 77dbf49. |
Module declarations currently accept template literals without substitutions in import attribute types.
This behaviour is incorrect as every other case rejects these empty template literals.
This PR now rejects the remaining case with TS1555, consistently requiring a quoted string literal.