[gatsby-core-utils] update from 1.0.28 to latest causes 3 typescript errors with default export with `configstore` and `module` dependencies, and gatsby-link
See original GitHub issue[gatsby-core-utils] update from 1.0.28 to 1.0.30 brings new dependency configstore “^5.0.0”, which causes errors in typescript
Describe the issue that you’re seeing.
Steps to reproduce
Clear steps describing how to reproduce the issue. Please please please link to a demo project if possible, this makes your issue much easier to diagnose (seriously).
How to Make a Minimal Reproduction: https://www.gatsbyjs.org/contributing/how-to-make-a-reproducible-test-case/
Expected result
No errors in typescript
Actual result
Got new TS error
error TS1259: Module '"/Users/justfly/projects/poolotto-gatsby/node_modules/@types/configstore/index"' can only be default-imported using the 'esModuleInterop' flag
1 import ConfigStore from "configstore"
~~~~~~~~~~~
node_modules/@types/configstore/index.d.ts:6:1
6 export = Configstore;
~~~~~~~~~~~~~~~~~~~~~
This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
Found 1 error.
error Command failed with exit code 1.
Environment
System: OS: macOS 10.15.2 CPU: (16) x64 Intel® Core™ i9-9980HK CPU @ 2.40GHz Shell: 5.7.1 - /bin/zsh Binaries: Node: 13.10.1 - ~/.nvm/versions/node/v13.10.1/bin/node Yarn: 1.22.1 - /usr/local/bin/yarn npm: 6.13.7 - ~/.nvm/versions/node/v13.10.1/bin/npm Languages: Python: 2.7.16 - /usr/bin/python Browsers: Chrome: 80.0.3987.132 Firefox: 72.0.2 Safari: 13.0.4 npmPackages: gatsby: 2.19.32 => 2.19.32 gatsby-plugin-manifest: 2.2.44 => 2.2.44 gatsby-plugin-no-sourcemaps: 2.1.2 => 2.1.2 gatsby-plugin-offline: 3.0.37 => 3.0.37 gatsby-plugin-purgecss: 4.0.1 => 4.0.1 gatsby-plugin-react-helmet: 3.1.23 => 3.1.23 gatsby-plugin-robots-txt: 1.5.0 => 1.5.0 gatsby-plugin-root-import: 2.0.5 => 2.0.5 gatsby-plugin-sitemap: 2.2.28 => 2.2.28 gatsby-plugin-typescript: 2.2.2 => 2.2.2 gatsby-plugin-webpack-bundle-analyzer: 1.0.5 => 1.0.5 npmGlobalPackages: gatsby: 2.19.32
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:20 (3 by maintainers)
@blainekasten you are right, the problem is not in the build, it is successful.
The problem occurs when we run
npx tsc --noEmit
. Thetypescript@3.8.3
compiler finds these errors when analyzing the entire project.Our project is configured so that when trying to commit, the code is checked for validity using
typescript
.Now I saw where the problem is: you include
*.d.ts
files in the library package. In which the compiler finds errors. Probably*.d.ts
files were mistakenly in the assembly.@blainekasten @awwit I’m currently found the only way to workaround current 3 TS bugs, is add flag
--skipLibCheck
totsc
invocation before lint-staged.this is my set of npm scripts for those who has same issues as me:
without --skipLibCheck there is 3 typescript errors. I’m still afraid that there could be some other serious dependency issue, so we are going to update dependencies manually, instead of merging commits automatically with dependabot.