microsoft / tslib

Runtime library for TypeScript helpers.
BSD Zero Clause License
1.26k stars 128 forks source link

Unable to build react project when using tslib #13

Closed nickzelei closed 7 years ago

nickzelei commented 7 years ago

I wanted to try using tslib with my React project, but am running into tsc compiler errors. It works fine with Webpack, but when compiling with "tsc" the React type definitions are not playing nicely.

186     class PureComponent<P, S> extends Component<P, S> { }
                                  ~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@types/react/index.d.ts(186,31): error TS2354: This syntax requires an imported helper but module 'tslib' cannot be found.

I have tslib installed as a dev-dependency and in my tsconfig.json I have the compilerOption set: "importHelpers": true

DanielRosenwasser commented 7 years ago

This is a duplicate of https://github.com/Microsoft/TypeScript/issues/12724. We'll be publishing TypeScript 2.1.5, but you can ignore the error for the time being if you still need to use tslib (or install typescript@next).