Fluentui: Could not find a declaration file for module 'prop-types'

Created on 19 Jul 2017  ·  6Comments  ·  Source: microsoft/fluentui

Error

ERROR in LandingMenu\node_modules\@uifabric\utilities\lib\Customizer.d.ts(2,28): error TS7016: Could not find a declaration file for module 'prop-types'. \node_modules\prop-types\index.js' implicitly has an 'any' type.
Try npm install @types/prop-types if it exists or add a new declaration (.d.ts) file containing declare module 'prop-types';

Package.json

"dependencies": {
"@types/react": "15.0.35",
"@types/react-dom": "15.5.1",
"office-ui-fabric-react": "4.21.1",
"react": "15.6.1",
"react-dom": "15.6.1"
},

"typescript": "2.4.1",

Any help appreciated!!

Question ❔

Most helpful comment

I'm facing the same issue. Though I'm able to resolve it by running npm install @types/prop-types, I think it needs to be a dependency of the library.

All 6 comments

It was solved by installing @types/prop-types.

npm i -D @types/prop-types

Should that be added as a dependency for office-ui-fabric-react instead of devDependency?

@dzearing is prop-types needed for dev only? or is it required when using fabric?

I'm facing the same issue. Though I'm able to resolve it by running npm install @types/prop-types, I think it needs to be a dependency of the library.

Yup, that should do it. Closing this down then.

Just wondering, but today (one year after this issue was closed) I ran into the same problem and needed to manually run npm i -D @types/prop-types. However, I would expect that this package would have been added as a dependency to the office-ui-fabric-react and hence would have been loaded automatically. Or did I miss something? Thanks ...

@dzearing did we ever make a decision on moving prop-types to dependencies?

Was this page helpful?
0 / 5 - 0 ratings