[TypeScript] nuxi typecheck throws errors from node_modules/@agorastore/shared-ui despite skipLibChe
Hi everyone π
When running
nuxi typecheck
, I'm getting a bunch of TypeScript errors specifically from a Nuxt module in my node_modules (@agorastore/shared-ui).
For example:
I tried adding both of these to my tsconfig.json but the errors persist:
Is there a way to make nuxi typecheck ignore modules in node_modules? I want to run type-checking on the CI before PRs can be merged, but this prevents me from doing so5 Replies
Hi @ChronicStone. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the knowledge sources provided, I can offer some insights into your issue with
nuxi typecheck
and TypeScript errors from node_modules.
The nuxi typecheck
command is designed to run vue-tsc
to check types throughout your app as mentioned in the Nuxt documentation (https://nuxt.com/docs/api/commands/typecheck). However, it seems that in your case, it's also checking types in the node_modules directory, which is not the intended behavior.
Unfortunately, the knowledge sources don't provide a direct solution to ignore modules in node_modules during type checking. However, there are a few things you can try:
1. Ensure you're using the latest version of Nuxt and vue-tsc
. There have been issues with TypeScript compatibility in the past, and newer versions might have resolved this.
2. You can try adding a server/tsconfig.json
file as mentioned in the Nuxt documentation (https://nuxt.com/docs/guide/directory-structure/server#server-types):
While this is primarily for improving IDE type hints, it might help with type checking as well.
3. If the issue persists, you might need to create a custom TypeScript configuration for the type checking process. You could create a separate tsconfig.typecheck.json
file that extends your main tsconfig.json
but explicitly excludes the problematic modules:
Then, you could modify your typecheck script to use this configuration:
However, please note that this is a workaround and not an official solution provided in the Nuxt documentation.
4. As a last resort, you might consider using a different type checking method in your CI pipeline, such as running tsc
directly on your source files, excluding node_modules.
If these suggestions don't resolve your issue, you might want to consider reporting this as a potential bug to the Nuxt team, as it seems to be unexpected behavior for nuxi typecheck
to check types in node_modules, especially when skipLibCheck
is set to true.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@372104941348585473> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Already tried these solutions, none worked
Up, still hasn't figured out a solution to this issue ...