You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When importing a module using TS, it's expected to be able to write a line like this:
import * as posthtml from 'posthtml'
posthtml(...)
This would get the exports from the module into a single identifier. However, since the default export is a function, it actually doesn't work at all. You get the following error message:
TypeError: posthtml_1.default is not a function
There is no easy workaround for this, given the current type bindings. It's generally suggested to avoid using default exports.
express handles this pretty well. You can see its TS bindings here.
A similar fix for posthtml would involve making its binding look more like this:
There might be a better way, but this worked for me. I am able to use my example import code from above this way. TS is very important for my project, and having proper bindings will go a long way.
The text was updated successfully, but these errors were encountered:
When importing a module using TS, it's expected to be able to write a line like this:
This would get the exports from the module into a single identifier. However, since the default export is a function, it actually doesn't work at all. You get the following error message:
There is no easy workaround for this, given the current type bindings. It's generally suggested to avoid using default exports.
express handles this pretty well. You can see its TS bindings here.
A similar fix for posthtml would involve making its binding look more like this:
There might be a better way, but this worked for me. I am able to use my example import code from above this way. TS is very important for my project, and having proper bindings will go a long way.
The text was updated successfully, but these errors were encountered: