1

I'm using react-custom-scrollbars, the index.d.ts file inside package doesn't works for me, while @types/react-custom-scrollbars works well.

as this issue mentioned. https://github.com/malte-wessel/react-custom-scrollbars/issues/133

My problem is, before this package makes any change, can I use @types/react-custom-scrollbars instead of index.d.ts inside this package?

I try to add explicit reference path

/// <reference path="../../../../../../node_modules/@types/react-custom-scrollbars/index.d.ts" />

In Visual Studio Code, it compiles. But when running, error still:

ERROR in /Users/alen/Workspace/Qunhe/core/node_modules/react-custom-scrollbars/index.d.ts
(3,20): error TS2304: Cannot find name '__React'. 

Btw, I'm using webpack 2.

Alen Liang
  • 529
  • 5
  • 13
  • I'm not sure if it will work, but you can try excluding the bundled `index.d.ts` using `exclude` in your `tsconfig.json`. – unional Mar 09 '17 at 06:54
  • I tried, it didn't work. and I find an excellent answer about all this tings http://stackoverflow.com/questions/40222162/typescript-2-custom-typings-for-untyped-npm-module I got it works after set 'paths' of compilerOptions, I'll post my solution later. – Alen Liang Mar 09 '17 at 08:08
  • I realized it's you again, last week you help me solved another question about typescript.. – Alen Liang Mar 09 '17 at 08:09
  • That's good. The problem you have is not a simple one. Glad that you found a solution. The problem is that the TS team was reluctant on disabling the auto searching for typings inside the actual package. I know of an issue related to that. `path` is a nice way out of this by doing one-offs pointing the typings to somewhere else. I didn't think of using it for this purpose so nice find. :) – unional Mar 09 '17 at 09:49

1 Answers1

0
{
  "compilerOptions": {
    "skipLibCheck": true
  },
}
Alex Rintt
  • 1,618
  • 1
  • 11
  • 18
magentaqin
  • 1,949
  • 13
  • 10