question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
awwitcommented, Mar 30, 2020

@blainekasten you are right, the problem is not in the build, it is successful.

The problem occurs when we run npx tsc --noEmit. The typescript@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.

Screenshot_20200330_213756

1reaction
JustFly1984commented, Apr 2, 2020

@blainekasten @awwit I’m currently found the only way to workaround current 3 TS bugs, is add flag --skipLibCheck to tsc invocation before lint-staged.

this is my set of npm scripts for those who has same issues as me:

    "tc": "npx tsc -p ./tsconfig.json --noEmit",
    "tc:trace-resolution": "npx tsc -p ./tsconfig.json --noEmit --traceResolution",
    "tc:skip-lib-check": "npx tsc -p ./tsconfig.json --noEmit --skipLibCheck",

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TSConfig Option: allowSyntheticDefaultImports - TypeScript
This option brings the behavior of TypeScript in-line with Babel, where extra code is emitted to make using a default export of a...
Read more >
Gatsby Changelog | 5.3.0
Now, when a code update or data update is made for the <Header> component, only the HTML for the Slice will be updated,...
Read more >
Default Exports in JavaScript Modules Are Terrible - Reddit
There's really just one use for default exports I support and that is if your exports are being handled by 3rd party code...
Read more >
gatsby-link - npm
An enhanced Link component for Gatsby sites with support for resource prefetching. Latest version: 5.3.1, last published: 10 days ago.
Read more >
typescript: import default export from module - Stack Overflow
I get the next error: Module "Transformer" resolves to a non-module entity and cannot be imported using this construct. How could I import...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found