embroider-build / addon-blueprint

Blueprint for v2-formatted Ember addons
MIT License
29 stars 24 forks source link

verbatimModuleSyntax causes type errors in dependencies #228

Closed simonihmig closed 9 months ago

simonihmig commented 10 months ago

Using the latest version of the blueprint failed for me when using the verbatimModuleSyntax option introduced in https://github.com/embroider-build/addon-blueprint/pull/214, with type errors from node_modules:

[types] ../../../../node_modules/@ember/test-helpers/public-types/@ember/test-helpers/dom/-target.d.ts:2:16 - error TS1284: An 'export default' must reference a value when 'verbatimModuleSyntax' is enabled, but 'Target' only refers to a type.
[types] 
[types] 2 export default Target;
[types]                  ~~~~~~
[types] 
[types] ../../../../node_modules/@types/ember__polyfills/types.d.ts:4:16 - error TS1284: An 'export default' must reference a value when 'verbatimModuleSyntax' is enabled, but 'Mix' only refers to a type.
[types] 
[types] 4 export default Mix;
[types]                  ~~~
[types] 

Seems to me we shouldn't use this, but have a lint rule only? /cc @NullVoxPopuli

NullVoxPopuli commented 10 months ago

option introduced in https://github.com/embroider-build/addon-blueprint/pull/214

It's now also in @tsconfig/ember

me we shouldn't use this

I consider this a bug in the libraries, because you could accidentally ship side-effecting imports from libraries until they fix their TS.

As a work around. Skiplibcheck is an option, but we should fix upsteam as the motivation for verbatim module syntax is beyond just v2 addons

Odds are, forgetting type was a mistake, as a lot of people are already using type imports, but without enforcement, it's easy to miss

NullVoxPopuli commented 9 months ago

Gonna close this, as the problem lies elsewhere, in other libraries in this case.