简体   繁体   中英

Ignore flowtype error when using specific pattern

I'm trying to use typescript together with flowtype in a transition period where everything is changing to typescript. However, flowtype is giving me an error, when I try to import declarations from a typescript file in a regular js|jsx file. I get the usual Cannot resolve module '*.tsx . Is it possible to ignore this flow error globally without having to use $FlowFixMe above my import statements?

This is giving flow errors, that I want to supress:

import foo from 'foobar.tsx';

That is likewise an error in TypeScript. Depending on your module loader/bundler's extension resolution, use either

import foo from 'foobar';

or

import foo from 'foobar.js';

Since you are using JSX it's worth noting that

import foo from 'foobar.jsx';

is also incorrect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM