Open mz8i opened 2 weeks ago
This was the commit in question: 3bc0da730f6d0bfa351934300e1eff85798c1c22
The proposal sounds reasonable to me, the hoops to jump through type checking and submodule imports are not awesome right now.
cc @shiarella for any comments?
I noticed one of the last commits by @tomalrussell was cleaning up the d3 imports a bit. This has been annoying how d3 needs to be imported in projects relying in ES6 modules in quite a different manner than it used to work back in the days of global objects. Especially when you need to use functions from more than two submodules in one file. Recently I came up with this approach on a different project:
[in a file such as
/lib/d3.ts
]:The
d3
object contains all the exports from all the installed submodules. They need to be manually destructured just once in this central file. Later, it's enough to just importd3
from this file, and because it's a named export, it works well with IntelliSense etc. Usage is:The
D3
namespace helps with the fact that it's not possible to destructure and re-export types. Usage is:I won't change this for now, but something to consider. I've been quite happy with the DX this provides on other projects.