Scratch pad - TS2307: Cannot find module 'react' or its corresponding type declarations.

I am running my file in a scratch pad. The .js version is fine but the .tsx gives an error.

 

I tried to install @types/react globally but still get a TS error. Any idea how I can get the scratchpads to pick it up?

 

Scratch pad - TS2307: Cannot find module 'react' or its corresponding type declarations.

import React  from 'react';

 

1 comment
Comment actions Permalink

Installing react typings to the scratches folder (<IDE config dir>/scratches) seems to be the only way to go:( See https://www.jetbrains.com/help/webstorm/directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#config-directory for information about the configuration folder location

0

Please sign in to leave a comment.