Skip to content

Type errors for map.d.ts when importing typedoc with TypeScript 5.6.3 #2747

Closed
@romaricpascal

Description

@romaricpascal

Search terms

TypeScript, Map, 5.6

Expected Behavior

import * as typedoc from 'typedoc' (or const typedoc = require('typedoc')) for accessing Typedoc's default options in order to add to them should not cause compilation errors with TypeScript 5.6.x

Actual Behavior

TypeScript raises the following errors:

node_modules/typedoc/dist/lib/utils/map.d.ts:19:5 - error TS2416: Property 'entries' in type 'StableKeyMap<K, V>' is not assignable to the same property in base type 'Map<K, V>'.
  Type '() => IterableIterator<[K, V]>' is not assignable to type '() => MapIterator<[K, V]>'.
    Type 'IterableIterator<[K, V]>' is missing the following properties from type 'MapIterator<[K, V]>': map, filter, take, drop, and 9 more.

19     entries(): IterableIterator<[K, V]>;
       ~~~~~~~

node_modules/typedoc/dist/lib/utils/map.d.ts:20:5 - error TS2416: Property 'keys' in type 'StableKeyMap<K, V>' is not assignable to the same property in base type 'Map<K, V>'.
  Type '() => IterableIterator<K>' is not assignable to type '() => MapIterator<K>'.
    Type 'IterableIterator<K>' is missing the following properties from type 'MapIterator<K>': map, filter, take, drop, and 9 more.

20     keys(): IterableIterator<K>;
       ~~~~

node_modules/typedoc/dist/lib/utils/map.d.ts:21:5 - error TS2416: Property 'values' in type 'StableKeyMap<K, V>' is not assignable to the same property in base type 'Map<K, V>'.
  Type '() => IterableIterator<V>' is not assignable to type '() => MapIterator<V>'.
    Type 'IterableIterator<V>' is missing the following properties from type 'MapIterator<V>': map, filter, take, drop, and 9 more.

21     values(): IterableIterator<V>;
       ~~~~~~

node_modules/typedoc/dist/lib/utils/map.d.ts:22:5 - error TS2416: Property '[Symbol.iterator]' in type 'StableKeyMap<K, V>' is not assignable to the same property in base type 'Map<K, V>'.
  Type '() => IterableIterator<[K, V]>' is not assignable to type '() => MapIterator<[K, V]>'.
    Type 'IterableIterator<[K, V]>' is missing the following properties from type 'MapIterator<[K, V]>': map, filter, take, drop, and 9 more.

22     [Symbol.iterator](): IterableIterator<[K, V]>;
       ~~~~~~~~~~~~~~~~~

Found 4 errors in the same file, starting at: node_modules/typedoc/dist/lib/utils/map.d.ts:19

This could be linked to this change from TypeScript ?

Steps to reproduce the bug

  1. In a new folder, run npm install -D typescript typedoc
  2. Create an index.ts file with import * as typedoc from 'typedoc';
  3. Run npx tsc index.ts -target esnext --moduleResolution node --allowSyntheticDefaultImports (these are the minimal options to get only the errors in map.d.ts)

Environment

  • Typedoc version: ^0.26.9
  • TypeScript version: 5.6
  • Node.js version: v20.18.0
  • OS: macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions