fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

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

Open jquintozamora opened this issue 9 years ago • 6 comments

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!!

jquintozamora avatar Jul 19 '17 15:07 jquintozamora

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?

jquintozamora avatar Jul 19 '17 15:07 jquintozamora

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

micahgodbolt avatar Jul 19 '17 16:07 micahgodbolt

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.

Feiyang1 avatar Aug 07 '17 19:08 Feiyang1

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

micahgodbolt avatar Aug 07 '17 19:08 micahgodbolt

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 ...

wpo365 avatar Jul 17 '18 18:07 wpo365

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

micahgodbolt avatar Jul 17 '18 19:07 micahgodbolt