Working on a PR for DefinitelyTyped. How can I fix "Cannot find module 'csstype'" when I run "npm run lint markdown-to-jsx"?

Viewed 292

Here’s what I have done so far following the instructions on https://github.com/DefinitelyTyped/DefinitelyTyped#verifying.

I forked https://github.com/DefinitelyTyped/DefinitelyTyped.

I git cloned my fork and ran npm install.

I updated the type definitions and tests of types/markdown-to-jsx.

Now, running npm run lint markdown-to-jsx returns an error.

Why?

npm run lint markdown-to-jsx

> definitely-typed@0.0.3 lint /Users/sunknudsen/tmp/DefinitelyTyped
> dtslint types "markdown-to-jsx"

Error: Errors in typescript@next for external dependencies:
../react/index.d.ts(34,22): error TS2307: Cannot find module 'csstype'.
1 Answers

Did you try npm install within types/<your-package-name>, in your case:

cd types/markdown-to-jsx && npm i;

? It should fix it.

If it doesn't, you might just have some dependencies somewhere along the tree that also need to be installed. I see that these are typings for markdown-to-jsx, so I would suggest to also run npm i in the types folder of react, react-dom, and react-markdown.

I was running into a similar issue, and running it in types/react (in addition to running it in my project's types of course) solved it:

cd types/react && npm i
Related