I get the following error, when testing some javascript code, transpiled from a typescript file.
Here is the error:
Error: _mapAction2.default is not
Since classes in javascript are syntactic sugar, I figured I'd try to solve this issue without them. For me, switching the architecture over to prototypes seems to have solved my issue. Posting in case anyone else runs into this issue but is already doing export default
Check that your import is correct. you might miss {} for example.
import LatLngLiteral from '';
to
import { LatLngLiteral } from '';
Another solution would be to add "esModuleInterop": true,
into tsconfig.json
.
esModuleInterop
allows default imports from modules with no default export.
You need to export a default value which will look like:
export default class MapAction implements IMapAction {...
And import it as:
import MapAction from './map_action_file';
Alternatively, if you want to export multiple things from the module you can do something like:
export class MapAction ...
export class MapSomethng ...
And import it as follows:
import { MapAction, MapSomething } from './map_action_file';