ScalablyTyped / Converter

Typescript to Scala.js converter
https://scalablytyped.org
GNU General Public License v3.0
219 stars 42 forks source link

Support for webpack exports (and fix firebase) #367

Closed oyvindberg closed 2 years ago

oyvindberg commented 3 years ago

https://webpack.js.org/guides/package-exports/

this is required to support newest version of firebase, and probably other libraries with peculiar layouts.

This will be done after the cleanups in #366 , and will come with a slight revamp of how ST handles javascript modules. In particular, let's try to check which JS files actually exist and only generate modules corresponding to those.

steinybot commented 3 years ago

I ran into this issue with https://github.com/pmndrs/jotai. In that case I just needed to use the correct mod. It's a little annoying as some types have to be imported from typings.jotai.atomMod which is not exported and I have to be careful not to use any of the functions in there and instead use the functions in typings.jotai.mod.

oyvindberg commented 3 years ago

Yeah, this is absolutely a known gotcha. the problem has always been that if you write code using that same import in typescript it will compile and fail in the same way.

Like I wrote in the description here I'm considering looking for which Javascript files are actually there, because we could use that information to remove all values from not-really-exported modules like atomMod. The downside is that the import is now dependent upon having both the types and the library itself, which is something I really wanted to avoid