Typescript error
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- build-system
Research direction
Reproduce the TypeScript 5.6.2 compilation failure and inspect the reported declarations in node_modules/lru-cache/dist/commonjs/index.d.ts, especially entries, keys, values, Symbol.iterator, and forEach. The issue is resolved when the project compiles without these TS2416 errors.
Written by the indexing model from the issue text.
Description
When compiling with Typescript 5.6.2 I get the following error:
output
node_modules/lru-cache/dist/commonjs/index.d.ts:973:5 - error TS2416: Property 'entries' in type 'LRUCache<K, V, FC>' is not assignable to the same property in base type 'Map<K, V>'.
Type '() => Generator<[K, V], void, unknown>' is not assignable to type '() => MapIterator<[K, V]>'.
Call signature return types 'Generator<[K, V], void, unknown>' and 'MapIterator<[K, V]>' are incompatible.
The types returned by 'next(...)' are incompatible between these types.
Type 'IteratorResult<[K, V], void>' is not assignable to type 'IteratorResult<[K, V], undefined>'.
Type 'IteratorReturnResult<void>' is not assignable to type 'IteratorResult<[K, V], undefined>'.
Type 'IteratorReturnResult<void>' is not assignable to type 'IteratorReturnResult<undefined>'.
Type 'void' is not assignable to type 'undefined'.
973 entries(): Generator<[K, V], void, unknown>;
~~~~~~~
node_modules/lru-cache/dist/commonjs/index.d.ts:985:5 - error TS2416: Property 'keys' in type 'LRUCache<K, V, FC>' is not assignable to the same property in base type 'Map<K, V>'.
Type '() => Generator<K, void, unknown>' is not assignable to type '() => MapIterator<K>'.
Call signature return types 'Generator<K, void, unknown>' and 'MapIterator<K>' are incompatible.
The types returned by 'next(...)' are incompatible between these types.
Type 'IteratorResult<K, void>' is not assignable to type 'IteratorResult<K, undefined>'.
Type 'IteratorReturnResult<void>' is not assignable to type 'IteratorResult<K, undefined>'.
Type 'IteratorReturnResult<void>' is not assignable to type 'IteratorReturnResult<undefined>'.
Type 'void' is not assignable to type 'undefined'.
985 keys(): Generator<K, void, unknown>;
~~~~
node_modules/lru-cache/dist/commonjs/index.d.ts:997:5 - error TS2416: Property 'values' in type 'LRUCache<K, V, FC>' is not assignable to the same property in base type 'Map<K, V>'.
Type '() => Generator<V, void, unknown>' is not assignable to type '() => MapIterator<V>'.
Call signature return types 'Generator<V, void, unknown>' and 'MapIterator<V>' are incompatible.
The types returned by 'next(...)' are incompatible between these types.
Type 'IteratorResult<V, void>' is not assignable to type 'IteratorResult<V, undefined>'.
Type 'IteratorReturnResult<void>' is not assignable to type 'IteratorResult<V, undefined>'.
Type 'IteratorReturnResult<void>' is not assignable to type 'IteratorReturnResult<undefined>'.
Type 'void' is not assignable to type 'undefined'.
997 values(): Generator<V, void, unknown>;
~~~~~~
node_modules/lru-cache/dist/commonjs/index.d.ts:1009:5 - error TS2416: Property '[Symbol.iterator]' in type 'LRUCache<K, V, FC>' is not assignable to the same property in base type 'Map<K, V>'.
Type '() => Generator<[K, V], void, unknown>' is not assignable to type '() => MapIterator<[K, V]>'.
Call signature return types 'Generator<[K, V], void, unknown>' and 'MapIterator<[K, V]>' are incompatible.
The types returned by 'next(...)' are incompatible between these types.
Type 'IteratorResult<[K, V], void>' is not assignable to type 'IteratorResult<[K, V], undefined>'.
Type 'IteratorReturnResult<void>' is not assignable to type 'IteratorResult<[K, V], undefined>'.
Type 'IteratorReturnResult<void>' is not assignable to type 'IteratorReturnResult<undefined>'.
Type 'void' is not assignable to type 'undefined'.
1009 [Symbol.iterator](): Generator<[K, V], void, unknown>;
~~~~~~~~~~~~~~~~~
node_modules/lru-cache/dist/commonjs/index.d.ts:1032:5 - error TS2416: Property 'forEach' in type 'LRUCache<K, V, FC>' is not assignable to the same property in base type 'Map<K, V>'.
Type '(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => any, thisp?: any) => void' is not assignable to type '(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any) => void'.
Types of parameters 'fn' and 'callbackfn' are incompatible.
Types of parameters 'map' and 'self' are incompatible.
Type 'LRUCache<K, V, FC>' is not assignable to type 'Map<K, V>'.
The types returned by 'entries().next(...)' are incompatible between these types.
Type 'IteratorResult<[K, V], void>' is not assignable to type 'IteratorResult<[K, V], undefined>'.
Type 'IteratorReturnResult<void>' is not assignable to type 'IteratorResult<[K, V], undefined>'.
Type 'IteratorReturnResult<void>' is not assignable to type 'IteratorReturnResult<undefined>'.
Type 'void' is not assignable to type 'undefined'.
1032 forEach(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => any, thisp?: any): void;
~~~~~~~
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug v2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/inspector#2458 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
carbon-design-system/ibm-products#9907 ·