Open frandiox opened 2 years ago
Alternatively, you can copy the pattern that hydrogen-ui uses, and use the typesVersions
in package.json to map the types to their locations.
Though I think hydrogen-ui should actually take out the <=4.6
qualifier and instead use '*'
, so that way even if someone is using node
on TS 4.7 they still get the types.
TIL typesVersions
is a thing. That's a better way to solve this, thanks!
We recently started using
package.json#exports
instead of facade files in Hydrogen, which requires TS to usecompiler.moduleResolution: node16
to follow types from package.json.However, it seems that
node16
value might cause issues with older dependencies that don't usepackage.json#exports
-- we got a report about this issue on another channel.I think we could try copying our generated
d.ts
files after build to the root of the Hydrogendist
directory so that fallbacks tomoduleResolution: node
can at least find the types.For example, we'd copy
@shopify/hydrogen/dist/esnext/config.d.ts
to@shopify/hydrogen/config.d.ts
;@shopify/hydrogen/dist/esnext/framework/plugin.d.ts
to@shopify/hydrogen/plugin.d.ts
; etc. That way, when importing from@shopify/hydrogen/config
, even an older module resolution should find theconfig.d.ts
.Otherwise, we can reintroduce facade files.