typed-ember / glint

TypeScript powered tooling for Glimmer templates
https://typed-ember.gitbook.io/glint
MIT License
110 stars 51 forks source link

Declare `@ember/test-helpers` as a peerDependency #516

Closed NullVoxPopuli closed 1 year ago

NullVoxPopuli commented 1 year ago

Update (2023-01-17):

Demonstration of problem across all package managers: https://github.com/NullVoxPopuli/repro-v2-addon-ts-test-helpers-issue/actions/runs/3943846299


Related to: https://github.com/typed-ember/glint/issues/515 I'm working on adding a thorough test for the --typescript flag over here: https://github.com/embroider-build/addon-blueprint/pull/89

but, I was getting TS errors because @glint/environment-ember-loose imports a package that it did not declare in its package.json.

details after this PR: https://github.com/embroider-build/addon-blueprint/pull/96 ``` prepare$ pnpm build . prepare: > my-addon@0.0.0 build /private/var/folders/q2/ympzs0z52tq2r4lv2gl0849w0000gn/T/v2-addon-blueprint--e4UDnn/my-addon . prepare: > pnpm --filter my-addon build . prepare: > my-addon@0.0.0 build /private/var/folders/q2/ympzs0z52tq2r4lv2gl0849w0000gn/T/v2-addon-blueprint--e4UDnn/my-addon/my-addon . prepare: > rollup --config . prepare: . prepare: → dist... . prepare: (!) Generated empty chunks . prepare: index, template-registry . prepare: [!] (plugin Typescript) TS2688: Cannot find type definition file for 'ember__test-helpers'. . prepare: The file is in the program because: . prepare: Entry point for implicit type library 'ember__test-helpers' . prepare: undefined . prepare: /private/var/folders/q2/ympzs0z52tq2r4lv2gl0849w0000gn/T/v2-addon-blueprint--e4UDnn/my-addon/my-addon: . prepare:  ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  my-addon@0.0.0 build: `rollup --config` ```

This likely wasn't caught before because we've all been using @types/ember__test-helpers for the longest time, and those type augmentations are global -- and is totally independent of package-manager, unlike what my commit says (I tested on yarn@1 as well)

Now that @ember/test-helpers actually publishes its own types (yay!!) -- as of 2.9.0 -- I think we had a silly timing issue between the different repo's expectations.

This PR adds @ember/test-helpers ^2.9.x as a peerDep, so that consumers install it.

NullVoxPopuli commented 1 year ago

turns out this issue is only present in npm and yarn. pnpm doesn't report this error at all