Enhancement: expose ambient module import attributes in the ESTree AST
Author: camc314Created Sep 2, 2026Updated Sep 14, 2026
Labelsenhancementpackage: typescript-estreeASTaccepting prspackage: ast-spec
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
- If I used AI assistance to prepare this issue, I have reviewed and followed the AI Contribution Policy.
Relevant Package
ast-spec
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Description
TypeScript PR #63931 adds import attribute types to ambient module declarations:
declare module "*.css" with { type: "css" } {
const stylesheet: CSSStyleSheet;
export default stylesheet;
}The TypeScript compiler AST now exposes this clause as an optional attributes?: TypeLiteralNode property on ModuleDeclaration.
I propose representing it in typescript-eslint’s ESTree AST as an optional attributes?: TSTypeLiteral property on the applicable string-named TSModuleDeclaration variants:
interface TSModuleDeclaration {
// existing fields...
attributes?: TSTypeLiteral;
}This is a type literal rather than the ImportAttributes node used by import and export declarations.
Expected AST shape:
{
type: "TSModuleDeclaration",
id: {
type: "Literal",
value: "*.css"
},
attributes: {
type: "TSTypeLiteral",
members: [
{
type: "TSPropertySignature",
// type: "css"
}
]
},
body: {
type: "TSModuleBlock"
},
kind: "module",
declare: true
}Additional Info
- Upstream implementation: microsoft/TypeScript#63931
- Upstream issue: microsoft/TypeScript#46135
Source: typescript-eslint/typescript-eslint