Microsoft/TypeScript
GitHub ã§èŠãImportType attributes can include JS expressions
Open
#62,179 opened on 2025幎8æ3æ¥
BugDomain: ES ModulesHelp Wanted
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
ð 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