问题
Build a default react-native application, with Typescript and add styled-components, reference it in the app and attempt to compile causes the following error:
node_modules/styled-components/typings/styled-components.d.ts(116,44): error TS2503: Cannot find namespace 'NodeJS'.
Please see repo to reproduce. https://github.com/StevenTCramer/Issue1
回答1:
You will need install @types/node
with npm in order to pick up the NodeJS namespace.
$ npm install --save-dev @types/node
来源:https://stackoverflow.com/questions/49495257/adding-styled-components-to-project-causes-cannot-find-namespace-nodejs