javascript - Flow: turn off "Unused suppression" error for supress_comment -


the production build of app produces file development build not. handle difference in code (simplified example)

const manifest = (process.env.node_env === 'production')   ? require(./production-app-manifest.json')   : { version: 'dummy development manifest' } 

flow therefore (correctly) fails on second line 'required module not found' when in development.

as docs suggest here, suppressed error so

const manifest = (process.env.node_env === 'production')   // $flowfixme: file not present in development   ? require(./production-app-manifest.json')   : { version: 'dummy development manifest' } 

this solves problem in development.

however, after production build, unused suppression error because file is present.

this quite frustrating. want tell flow ignore line, regardless of if file present or not. can configure flow turn off unused suppression error?

probably easiest way make line has error time. turn require line this:

require(('./production-app-manifest.json': string))

now, flow complains string passed require not literal string, it's suppressable error whether or not file exists.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -