You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 4, 2020. It is now read-only.
Importing the package and using it in a basic typescript app results in the typescript error Could not find a declaration file for module 'lodash'.
This error can be fixed if you manually install @types/lodash (by running yarn add @types/lodash -D). However, for a good developer experience, this shouldn't be necessary - (perhaps @types/lodash should be among the dependencies of the package, or included through some other build mechanism).
Steps
I've made a sample repo that demonstrates the issue - repo steps are in the README there.
To reproduce from scratch, here are the high-levels steps.
Set up a simple "hello-world" typescript + react project using the tooling chain of your choice.
Add fluent-ui-react to the project.
Add a simple button component to your app.
Expected Result
TSC should compile without warnings.
Actual Result
node_modules/@fluentui/react/dist/es/components/Carousel/Carousel.d.ts:3:20 - error TS7016: Could not find a declaration file for module 'lodash'. '/Users/Andrew/Projects/fluent-ui-react-test/node_modules/lodash/lodash.js' implicitly has an 'any' type.
Try `npm install @types/lodash` if it exists or add a new declaration (.d.ts) file containing `declare module 'lodash';`
3 import * as _ from 'lodash';
~~~~~~~~
node_modules/@fluentui/react/dist/es/components/Dropdown/Dropdown.d.ts:3:20 - error TS7016: Could not find a declaration file for module 'lodash'. '/Users/Andrew/Projects/fluent-ui-react-test/node_modules/lodash/lodash.js' implicitly has an 'any' type.
Try `npm install @types/lodash` if it exists or add a new declaration (.d.ts) file containing `declare module 'lodash';`
3 import * as _ from 'lodash';
~~~~~~~~
node_modules/@fluentui/react/dist/es/utils/applyAccessibilityKeyHandlers.d.ts:2:20 - error TS7016: Could not find a declaration file for module 'lodash'. '/Users/Andrew/Projects/fluent-ui-react-test/node_modules/lodash/lodash.js' implicitly has an 'any' type.
Try `npm install @types/lodash` if it exists or add a new declaration (.d.ts) file containing `declare module 'lodash';`
2 import * as _ from 'lodash';
~~~~~~~~
I investigated creating a sample on codesandbox.io, but it appears that they use react-scripts to do the compilation, which won't check (I think) for errors in npm packages the way that tsc does.