Error from within `node_modules/`
tylerlaprade opened this issue · comments
After setting up ts-reset
, I get the following error when running TypeScript:
node_modules/@reduxjs/toolkit/src/query/core/buildMiddleware/batchActions.ts:109:7 - error TS2322: Type 'unknown' is not assignable to type 'SubscriptionState'.
109 previousSubscriptions = JSON.parse(
~~~~~~~~~~~~~~~~~~~~~
node_modules/@reduxjs/toolkit/src/query/core/buildMiddleware/batchActions.ts:145:17 - error TS2322: Type 'unknown' is not assignable to type 'SubscriptionState'.
145 const newSubscriptions: SubscriptionState = JSON.parse(
This is nested deep in one of my dependencies. It's hard for me to even determine why it's being called.
Interestingly, when I imported ts-reset
like this, there was no problem locally, but TSC failed in GitHub Actions:
/// <reference types="@total-typescript/ts-reset" />
Once I swapped to this format, I got the same error locally that I was seeing in GitHub Actions:
import '@total-typescript/ts-reset';
There is a TypeScript compiler option called skipLibCheck
(see TypeScript Docs) which is generally recommended since there is no need to type check libraries in node_modules
.
Rather than doing a full check of all d.ts files, TypeScript will type check the code you specifically refer to in your app’s source code.
I just saw your reply, so I'm assuming skipLibCheck
does not help?
That's right - skipLibCheck
only applies to .d.ts
files, not actual .ts
files.