Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error from within node_modules/ #187

Open
tylerlaprade opened this issue Feb 14, 2024 · 3 comments
Open

Error from within node_modules/ #187

tylerlaprade opened this issue Feb 14, 2024 · 3 comments

Comments

@tylerlaprade
Copy link

tylerlaprade commented Feb 14, 2024

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';
@Rathalin
Copy link

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.

@Rathalin
Copy link

I just saw your reply, so I'm assuming skipLibCheck does not help?

@tylerlaprade
Copy link
Author

That's right - skipLibCheck only applies to .d.ts files, not actual .ts files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants