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...

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:

typescript
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:

typescript
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:

typescript
{
  type: "TSModuleDeclaration",
  id: {
    type: "Literal",
    value: "*.css"
  },
  attributes: {
    type: "TSTypeLiteral",
    members: [
      {
        type: "TSPropertySignature",
        // type: "css"
      }
    ]
  },
  body: {
    type: "TSModuleBlock"
  },
  kind: "module",
  declare: true
}

Additional Info

Source: typescript-eslint/typescript-eslint