You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use TS 4.1 or above with this option, micro-memoize fails to compile.
To reproduce bug, create a project with TS 4.1 or above, turn on noUncheckedIndexedAccess, import and use micro-memoize and run a TS build. I see:
tsc --noEmit
node_modules/micro-memoize/src/Cache.ts:82:23 - error TS2345: Argument of type 'Key | undefined' is not assignable to parameter of type 'Key'.
Type 'undefined' is not assignable to type 'any[]'.
82 if (isMatchingKey(keys[0], keyToMatch)) {
~~~~~~~
node_modules/micro-memoize/src/Cache.ts:88:27 - error TS2345: Argument of type 'Key | undefined' is not assignable to parameter of type 'Key'.
Type 'undefined' is not assignable to type 'any[]'.
88 if (isMatchingKey(keys[index], keyToMatch)) {
~~~~~~~~~~~
node_modules/micro-memoize/src/Cache.ts:176:13 - error TS2339: Property 'length' does not exist on type 'Key | undefined'.
176 const { length } = existingKey;
~~~~~~
node_modules/micro-memoize/src/Cache.ts:186:22 - error TS2532: Object is possibly 'undefined'.
186 if (!isEqual(existingKey[index], keyToMatch[index])) {
~~~~~~~~~~~
node_modules/micro-memoize/src/Cache.ts:194:20 - error TS2532: Object is possibly 'undefined'.
194 return isEqual(existingKey[0], keyToMatch[0]) ? 0 : -1;
~~~~~~~~~~~
node_modules/micro-memoize/src/Cache.ts:220:7 - error TS2322: Type 'Key | undefined' is not assignable to type 'Key'.
Type 'undefined' is not assignable to type 'any[]'.
220 keys[index + 1] = keys[index];
~~~~~~~~~~~~~~~
node_modules/micro-memoize/src/Cache.ts:269:43 - error TS2345: Argument of type 'Key | undefined' is not assignable to parameter of type 'RawKey'.
Type 'undefined' is not assignable to type 'RawKey'.
269 const keyIndex = this.getKeyIndex(firstKey);
~~~~~~~~
Found 7 errors in the same file, starting at: node_modules/micro-memoize/src/Cache.ts:82
The text was updated successfully, but these errors were encountered:
Hi there,
I have similar problem as #37
TS 4.1 introduced new compilerOption noUncheckedIndexedAccess. see:
https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess
When I use TS 4.1 or above with this option, micro-memoize fails to compile.
To reproduce bug, create a project with TS 4.1 or above, turn on noUncheckedIndexedAccess, import and use micro-memoize and run a TS build. I see:
The text was updated successfully, but these errors were encountered: