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.

Failed to generate .d.ts.Error: Failed to generate .d.ts.

See original GitHub issue

Something in the new reslease broke the generation of .d.ts.

I’m getting the error

yarn run v1.22.4
$ graphql-let
[ graphql-let ] Generating .d.ts...
[ graphql-let ] Failed to generate .d.ts.Error: Failed to generate .d.ts.
    at Object.genDts (C:\Users\USER_NAME\client\node_modules\graphql-let\dist\lib\dts.js:71:15)
    at processDtsForCodegenContext (C:\Users\USER_NAME\client\node_modules\graphql-let\dist\lib\full-generate.js:97:31)
    at Object.fullGenerate [as default] (C:\Users\USER_NAME\client\node_modules\graphql-let\dist\lib\full-generate.js:112:15)
    at async gen (C:\Users\USER_NAME\client\node_modules\graphql-let\dist\gen.js:26:28)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! with-typescript-graphql@0.1.0 dev: `yarn codegen && next`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the with-typescript-graphql@0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\matthiass\AppData\Roaming\npm-cache\_logs\2020-07-10T16_41_33_559Z-debug.log

I just did a clean

yarn create next-app --example with-typescript-graphql with-typescript-graphql-app
yarn
yarn dev

Here is my package.json

{
  "name": "with-typescript-graphql",
  "version": "0.1.0",
  "author": "",
  "license": "ISC",
  "scripts": {
    "codegen": "graphql-let",
    "dev": "yarn codegen && next",
    "build": "yarn codegen && next build",
    "start": "next start"
  },
  "dependencies": {
    "@apollo/react-common": "3.1.4",
    "@apollo/react-components": "^3.1.5",
    "@apollo/react-hooks": "3.1.5",
    "apollo-cache": "^1.3.5",
    "apollo-cache-inmemory": "^1.6.6",
    "apollo-client": "^2.6.10",
    "apollo-link": "1.2.14",
    "apollo-link-http": "1.5.17",
    "apollo-link-schema": "1.2.5",
    "apollo-server-micro": "^2.14.2",
    "apollo-utilities": "^1.3.3",
    "graphql": "^14.6.0",
    "graphql-tag": "^2.10.3",
    "next": "latest",
    "react": "^16.13.1",
    "react-dom": "^16.13.1"
  },
  "devDependencies": {
    "@graphql-codegen/cli": "^1.15.1",
    "@graphql-codegen/plugin-helpers": "^1.15.1",
    "@graphql-codegen/typescript": "^1.13.3",
    "@graphql-codegen/typescript-operations": "^1.13.3",
    "@graphql-codegen/typescript-react-apollo": "^1.13.3",
    "@graphql-codegen/typescript-resolvers": "^1.15.1",
    "@types/react": "^16.9.34",
    "@types/react-dom": "^16.9.7",
    "graphql-let": "0.x",
    "typescript": "^3.8.3"
  }
}

On a windows machine with npm@latest

Reverting to graphql-let: "0.10.0" fixed the issue

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
marklawlorcommented, Jul 11, 2020

Confirming that the issue isn’t just the latest release, it occurs with both v0.11.1 and v0.11.0

Downgrading back to v0.10.0 works as expected

1reaction
marklawlorcommented, Jul 31, 2020

Replicated issue using a slightly modified example here https://github.com/marklawlor/graphql-let-118

Points to note:

  • Running graphql-let still generates the caches and .d.ts files, but exits with the error
  • The command graphql-let will only error when there is no generated folder
  • Removing the baseUrl option from tsconfig will stop the error, but I would expect this library to work regardless of this option
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to generate declaration files d.ts #20302 - GitHub
Hi guys, I have problem with generating .d.ts files. tsc won't generate them for me, even though I have declaration: true in tsconfig.json...
Read more >
Module parse failed for d.ts files in create-react-app
So the first thing you need to do is install react-app-rewired in your project using this command: npm i -D react-app-rewired.
Read more >
TypeStrong/ts-loader - Gitter
When I try executing yarn exec tsc -- -m ESNext -t ESNext /Users/richardseviora/Projects/zhu-li/do/the/thing/site.ts , it generates similar "cannot find module ...
Read more >
ts-loader - npm
Code Splitting and Loading Other Resources; Declarations (.d.ts); Failing the build on TypeScript compilation error; baseUrl / paths module ...
Read more >
Documentation - Creating .d.ts Files from .js files - TypeScript
Add TypeScript to your dev dependencies · Add a tsconfig.json to configure TypeScript · Run the TypeScript compiler to generate the corresponding d.ts...
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