Microsoft/TypeScript
Ver no GitHubImportType attributes can include JS expressions
Open
#62.179 aberto em 3 de ago. de 2025
BugDomain: ES ModulesHelp Wanted
Métricas do repositório
- Stars
- (48.455 stars)
- Métricas de merge de PR
- (Mesclagem média 6d 17h) (9 fundiu PRs em 30d)
Description
🔎 Search Terms
importtype, import type parsing
🕗 Version & Regression Information
- This changed between versions 4.6.4 and 4.7.4 (with the old
assertkeyword)
⏯ Playground Link
💻 Code
declare module "wat";
type _ = typeof import("wat", {
assert: {
a: (() => {
console.log("why can you write js here????");
})(),
}
});
🙁 Actual behavior
parser accepts arbitrary JS expressions inside a type expression
🙂 Expected behavior
parser only allows string literal values or arbitrary type values
Additional information about the issue
No response