-
Notifications
You must be signed in to change notification settings - Fork 12.8k
skipLibCheck and exclude do not work under monorepos project #38538
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
Comments
I get these errors
in a yarn workspace monorepo. The project root has a base configuration and the workspace folders have extended this configuration. As a workaround, I had to set
in the root config file |
Im running tsc in a monorepo with the --skipLibCheck and --listFiles flags, my output still contains node_module
Is this related? |
Same issue here. It takes ages to load all the node_modules d.ts files. |
1 similar comment
Same issue here. It takes ages to load all the node_modules d.ts files. |
Any update on this? This sadly is completely blocking any sort of builds for my projects. |
I have same error. I doubt |
we are running into same issue after updating our aws-javascript-library to v3. Any pointers to how can we keep using new library and still be able to compile things? |
Having the same issue. Blocking me on a bunch of projects. |
Using explicit |
I think that the example in the issue description is, at its core, #41883 – TypeScript does not apply
BTW we're not seeing issues like above that |
Same here, Any ideas how to solve it? |
Same issue |
@ahtokca @alisalim17 According to explanatory blogposts for this skip option the .d.ts are not completely ignored. Checks that lead there from your source files still take place. It's just that any internal issues in the .d.ts files are ignored. Example blog post: https://dd.engineering/blog/typescript-the-skiplibcheck-option-explained
For me, that's actually almost exactly what I would like to see. Completely disregarding any type info is too extreme. I want my code checked, I just don't care about those internal issues that many such files have. Pretty much exactly what this option filters out. EDIT: Looking at the "types" section of tsconfig, that could also help? https://www.typescriptlang.org/tsconfig#types
|
Has anyone solved it? |
@dengnan123 There is some magic workaround package.json {
"scripts": {
"prebuild": "node add-ts-nocheck",
"build": "tsc"
}
} add-ts-nocheck.js const fs = require('fs')
const ADDED_STR = '// @ts-nocheck\n\n'
const FILES = [
'node_modules/some-package/some-file.ts',
...
]
Promise.allSettled(FILES.map(addTsNoCheck)).then(results => {
let hasErrors = false
for (const result of results) {
if (result.status === 'rejected') {
hasErrors = true
console.error(result.reason)
}
}
if (hasErrors) {
process.exit(1)
}
})
async function addTsNoCheck(file) {
const content = fs.readFileSync(file).toString()
if (content.includes(ADDED_STR)) {
console.log(JSON.stringify(ADDED_STR), 'is already in', file)
} else {
fs.writeFileSync(file, ADDED_STR + content)
console.log(JSON.stringify(ADDED_STR), 'added into', file)
}
} |
@Vict0rd Wow, what a workaround 😄. |
same error when i use typescript with lerna,how can i fix it on development mode |
Any update on this? |
TypeScript |
good job bro |
It looks like a lot of people have landed in this thread thinking that |
|
Sorry, misremembered the name - it's |
So this still occurs. For some reason when |
In case someone ended up landing here for a workaround, the point is just to include my ts/tsx files specifically when working with Next.js v13. Btw, skipLibCheck can either be tsconfig.json (required parts){
"compilerOptions": {
"strict": true,
"skipLibCheck": false,
"include": [
"next-env.d.ts",
"app/**/*.ts",
"app/**/*.tsx",
"src/**/*.ts",
"src/**/*.tsx",
"components/**/*.ts",
"components/**/*.tsx",
"icons/**/*.ts",
"icons/**/*.tsx"
],
"exclude": [
"node_modules"
]
} |
On my side my storybook package was looking for types specific to another workspace package. I tried tons of "solutions" but none worked. The only one working was to tell my package to look for types of the other package (since it's a monorepo, relative path going back is not an issue):
Hope this helps :) |
So I see that there's no 'official' solution but in my case non of the suggested variants worked. Description. Technologies:
Project structure: B depends on A. C depends on A+B. I need to perform type-check on git hooks (pre-push) only for the single project (e.g. working on project C type check to be performed only for projectC files). I need no .js outputs. For some reasons, when I run There are next questions:
What have I tried:
Non of this worked and I beg you guys for the help with the solution of the problem, since it blocks us from having a proper type handling on the project. Fun fact is that VSCode handles all the types correctly and produces no type errors, while TSC does. UPD: |
I am also having this issue with lerna. All instructions given to the The way I understand the purpose of tsconfig is that it overwrites the parent tsconfig. But other libraries installed apparently can also overwrite it ? It feels like I have no control typescript config, rather other dependencies do. Is this something particular of lerna forcefully overwriting ? |
It happens to me with wagmi (nextjs 13.x config) and I've already set I don't know why, but I just upgraded typescript to 5.0.4 and now the error is gone. It might be worth trying to upgrade the ts version if you can. Added: I needed to set |
I guess I got stuck with the same problem: monorepo:
cli
the problem was solved |
…issues (#466) ## Affected Packages Apps - [x] portal Packages - [x] 1ui - [ ] api - [ ] protocol - [ ] sdk Tools - [ ] tools ## Overview - Stop tsc from checking types of consumed packages - Fix remaining type errors in portal - Make 1ui emit types and the have it be a `composite` library so that the types can be included as references in portal Source: microsoft/TypeScript#38538 (comment) ## Screen Captures If applicable, add screenshots or screen captures of your changes. ## Declaration - [x] I hereby declare that I have abided by the rules and regulations as outlined in the [CONTRIBUTING.md](https://github.com/0xIntuition/intuition-ts/blob/main/CONTRIBUTING.md)
Same issue |
TypeScript Version: 3.8.3
Search Terms:
Code
Expected behavior:
Hope that i can ignore the syntax check of the node_modules module through exclude and skipLibCheck configuration.But these configurations did not work.
Actual behavior:
Tsc throws errors about node_modules ,as follows :
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: