flowgen
flowgen copied to clipboard
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'file' of undefined
Hi, I'm trying to export some flow definitions for this package: https://github.com/notifee/react-native-notifee/tree/master/src
I have followed the readme and made a bash script:
#!/bin/zsh
for i in $(find react-native/dist -type f -name "*.d.ts");
do sh -c "flowgen $i -o ${i%.*.*}.js.flow";
done;
It works great - it goes through the file definitions and creates a js.flow file. However if I try to use the --flow-typed-format option:
#!/bin/zsh
for i in $(find react-native/dist -type f -name "*.d.ts");
do sh -c "flowgen --flow-typed-format $i -o ${i%.*.*}.js.flow";
done;
I always run into the following error:
(node:41042) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'file' of undefined
at Object.compile (~/.nvm/versions/node/v12.19.0/lib/node_modules/flowgen/lib/cli/runner.js:187:78)
at Command.<anonymous> (~/.nvm/versions/node/v12.19.0/lib/node_modules/flowgen/lib/cli/index.js:25:6)
at Command.listener [as _actionHandler] (~/.nvm/versions/node/v12.19.0/lib/node_modules/flowgen/node_modules/commander/index.js:426:31)
at Command._parseCommand (~/.nvm/versions/node/v12.19.0/lib/node_modules/flowgen/node_modules/commander/index.js:1002:14)
at Command.parse (~/.nvm/versions/node/v12.19.0/lib/node_modules/flowgen/node_modules/commander/index.js:801:10)
at Object.<anonymous> (~/.nvm/versions/node/v12.19.0/lib/node_modules/flowgen/lib/cli/index.js:28:20)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
(node:41042) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:41042) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Am I doing something wrong here?