mapbox / mapbox/locking

Typescript error

Open
#17 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
10
Forks
3
PR merge metrics
No merged PRs in 30d

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' is not assignable to the same property in base type 'Map'.
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' is not assignable to type 'IteratorResult<[K, V], undefined>'.
Type 'IteratorReturnResult' is not assignable to type 'IteratorReturnResult'.
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' is not assignable to the same property in base type 'Map'.
Type '() => Generator' is not assignable to type '() => MapIterator'.
Call signature return types 'Generator' and 'MapIterator' are incompatible.
The types returned by 'next(...)' are incompatible between these types.
Type 'IteratorResult' is not assignable to type 'IteratorResult'.
Type 'IteratorReturnResult' is not assignable to type 'IteratorResult'.
Type 'IteratorReturnResult' is not assignable to type 'IteratorReturnResult'.
Type 'void' is not assignable to type 'undefined'.

985 keys(): Generator;
~~~~

node_modules/lru-cache/dist/commonjs/index.d.ts:997:5 - error TS2416: Property 'values' in type 'LRUCache' is not assignable to the same property in base type 'Map'.
Type '() => Generator' is not assignable to type '() => MapIterator'.
Call signature return types 'Generator' and 'MapIterator' are incompatible.
The types returned by 'next(...)' are incompatible between these types.
Type 'IteratorResult' is not assignable to type 'IteratorResult'.
Type 'IteratorReturnResult' is not assignable to type 'IteratorResult'.
Type 'IteratorReturnResult' is not assignable to type 'IteratorReturnResult'.
Type 'void' is not assignable to type 'undefined'.

997 values(): Generator;
~~~~~~

node_modules/lru-cache/dist/commonjs/index.d.ts:1009:5 - error TS2416: Property '[Symbol.iterator]' in type 'LRUCache' is not assignable to the same property in base type 'Map'.
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' is not assignable to type 'IteratorResult<[K, V], undefined>'.
Type 'IteratorReturnResult' is not assignable to type 'IteratorReturnResult'.
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' is not assignable to the same property in base type 'Map'.
Type '(fn: (v: V, k: K, self: LRUCache) => any, thisp?: any) => void' is not assignable to type '(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any) => void'.
Types of parameters 'fn' and 'callbackfn' are incompatible.
Types of parameters 'map' and 'self' are incompatible.
Type 'LRUCache' is not assignable to type 'Map'.
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' is not assignable to type 'IteratorResult<[K, V], undefined>'.
Type 'IteratorReturnResult' is not assignable to type 'IteratorReturnResult'.
Type 'void' is not assignable to type 'undefined'.

1032 forEach(fn: (v: V, k: K, self: LRUCache) => any, thisp?: any): void;
~~~~~~~
```

Contributor guide

Open the contributing guide

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.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.