Skip to content
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

tsd throws errors inside node_modules #76

Closed
jLouzado opened this issue Aug 27, 2020 · 4 comments · Fixed by #110
Closed

tsd throws errors inside node_modules #76

jLouzado opened this issue Aug 27, 2020 · 4 comments · Fixed by #110

Comments

@jLouzado
Copy link

Problem

  • I've setup a test in the root of my project folder
  • the test passes as expected, but then it fails because of errors thrown from node_modules
➜  data-aware git:(develop) ✗ yarn tsd
yarn run v1.12.1
$ /Users/joel/Projects/data-aware/node_modules/.bin/tsd

  node_modules/@types/react-highcharts/index.d.ts:22:32
  ✖  22:32  Namespace "/Users/<user>/Projects/data-aware/node_modules/highcharts/highcharts" has no exported member ChartObject.  
  ✖  34:34  Namespace "/Users/<user>/Projects/data-aware/node_modules/highcharts/highcharts" has no exported member Static.       

  2 errors

error Command failed with exit code 1.

I tried specifically excluding node_modules by specifying tsconfig from within package.json but to no avail.

TSConfig

{
  "compilerOptions": {
    "declaration": false,
    "module": "commonjs",
    "newLine": "LF",
    "noImplicitAny": false,
    "noUnusedLocals": true,
    "noUnusedParameters": false,
    "sourceMap": true,
    "strictNullChecks": true,
    "target": "es6",
    "skipLibCheck": true
  },
  "exclude": ["node_modules"]
}
@edi9999
Copy link

edi9999 commented Sep 3, 2020

I have the same issue, I also don't want to check anything inside my node_modules.

@edi9999
Copy link

edi9999 commented Sep 3, 2020

In my case, I had :

  node_modules/@types/puppeteer/index.d.ts:26:45
  ✖   26:45  Cannot find name Element.
  ✖   62:28  Cannot find name Element.
  ✖   78:28  Cannot find name Element.
  ✖   96:28  Cannot find name Element.
  ✖  116:28  Cannot find name Element.
  ✖  135:28  Cannot find name Element.
  ✖  151:29  Cannot find name Element.
  ✖  167:29  Cannot find name Element.
  ✖  185:29  Cannot find name Element.
  ✖  205:29  Cannot find name Element.
  ✖  224:29  Cannot find name Element.
  ✖  768:41  Cannot find name Element.
  ✖  768:51  Cannot find name Element.
```

So adding the following to my package.json fixed the issue : 


```
  "tsd": {
    "compilerOptions": {
      "lib": [
        "DOM"
      ]
    }
  }
```

However, this works only because the errors that are shown in my case are DOM related (Element exists only in DOM).

@fregante
Copy link

fregante commented Oct 9, 2020

Duplicate of #45

@BendingBender
Copy link
Collaborator

@jLouzado @edi9999

Would you mind testing my branch (https://github.com/BendingBender/tsd/tree/ignore-errors-from-node-modules) and reporting whether it fixes the problem for you? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants