expo/spawn-async

TypeError: spawn_async_1.default is not a function

ffflorian opened this issue · 8 comments

When I import spawnAsync in TypeScript like this:

import spawnAsync from '@expo/spawn-async';
// spawnAsync( ... )

And try running it, I get the error

TypeError: spawn_async_1.default is not a function
ide commented

Try setting allowSyntheticDefaultImports in your TypeScript configuration. This allows TS to import from CJS modules too.

ide commented

I added a test here to ensure that there isn't a regression: 5cb842f. If you would like to figure out a way to address your issue without allowSyntheticDefaultImports, please make sure the tests continue to pass (although I'm not sure it is possible).

Try setting allowSyntheticDefaultImports in your TypeScript configuration. This allows TS to import from CJS modules too.

Alright, thanks!

In general I think it's easier to just export it as an object instead of using a default export and CJS hacks. But that's a different story 🙂

I have allowSyntheticDefaultImports set in my tsconfig.json and I still get the same error.

Same here, could we re-open the issue?

Hi, any updates here ?

ide commented

We haven’t had an issue with importing this module across multiple projects. If you are certain the issue is not with your project configuration and you have a proposal for how to address the issue that keeps 5cb842f passing you are welcome to share it here.