Skip to content

typescript.d.ts uses ES2015+ globals (Map, ReadonlyMap) without /// <reference lib> directive #63311

@baraknaveh

Description

@baraknaveh

TypeScript's own typescript.d.ts uses Map and ReadonlyMap without a /// <reference lib="es2015" /> directive. This causes type errors when the file is checked outside of a tsconfig scope that includes ES2015+ lib types.

Examples in typescript@5.9.3 (lib/typescript.d.ts):

// line 2589
abstract readonly typesRegistry: Map<string, MapLike<string>>;

// line 6592-6596
type ReadonlyUnderscoreEscapedMap<T> = ReadonlyMap<__String, T>;
type UnderscoreEscapedMap<T> = Map<__String, T>;
type SymbolTable = Map<__String, Symbol>;

Suggested fix: Add /// <reference lib="es2015" /> at the top of lib/typescript.d.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions