Closed erik-slack closed 4 years ago
Hi Erik, no, you are doing it right :)
Flamelink's export requires either synthetic default imports or the esModuleInterop
flag to be enabled. This is because of the design decision we made to have the main export the Flamelink app factory function, ie. flamelink({ ...config })
. I'm not sure at this stage if it is the best. We've considered changing it to be similar to how Firebase's SDK works, which will then export an object and you have to call the initializeApp
method on it, ie. firebase.initializeApp({ ...config })
.
Does the allowSyntheticDefaultImports
break anything for you?
No it doesn't, it just throws a linter error. I'll set it to allowed then. Thanks, it helps knowing you've made it that way on purpose.
Do you perhaps have more info on what type of bugs that linting rule would catch? I'm not aware of any specific problems with using synthetic default imports.
After reading up more about it I think you're good. Sorry for the snipe hunt!
My source: https://github.com/Microsoft/TypeScript/issues/10895
The docs say to use
import flamelink from 'flamelink';
but because of the default rule
"allowSyntheticDefaultImports": false
I get this from my tslint:
So changing it to
import * as flamelink from 'flamelink/app';
was what I figured would fix it, but then I get this at runtime:
TypeError: flamelink_app__WEBPACK_IMPORTED_MODULE_7__ is not a function
I can bypass this issue by adding
"allowSyntheticDefaultImports": true
in my tsconfig.json tocompilerOptions
. But that just seems wrong.Am I doing this wrong?