Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types are incorrecly published and reference the ember-source built in preview types (which do not exist in sufficiently new enough projects) #111

Closed
NullVoxPopuli opened this issue Aug 21, 2023 · 6 comments · Fixed by #113

Comments

@NullVoxPopuli
Copy link
Collaborator

NullVoxPopuli commented Aug 21, 2023

I think everything would be fine if just these /// reference lines weren't present:

[types] ../node_modules/.pnpm/ember-element-helper@0.8.2_@glint+environment-ember-loose@1.0.2_@glint+template@1.0.2_ember-source@5.2.0/node_modules/ember-element-helper/declarations/helpers/element.d.ts:1:23 - error TS2688: Cannot find type definition file for 'ember-source/types/preview/@ember/object/core'.
[types] 
[types] 1 /// <reference types="ember-source/types/preview/@ember/object/core" />
[types]                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[types] 
[types] ../node_modules/.pnpm/ember-element-helper@0.8.2_@glint+environment-ember-loose@1.0.2_@glint+template@1.0.2_ember-source@5.2.0/node_modules/ember-element-helper/declarations/helpers/element.d.ts:2:23 - error TS2688: Cannot find type definition file for 'ember-source/types/preview/@ember/object/mixin'.
[types] 
[types] 2 /// <reference types="ember-source/types/preview/@ember/object/mixin" />
[types]      

image

Not really sure why ts or glint would do this, as ember-source is marked as a peerDependency

@gitKrystan
Copy link

It's probably this: ember-a11y/ember-a11y-testing#498 (comment)

@NullVoxPopuli
Copy link
Collaborator Author

NullVoxPopuli commented Aug 24, 2023

I'm not so sure

I made an attempt here: #112 but no dice -- /// reference is still present in the declarations output

@SergeAstapov
Copy link
Contributor

@gitKrystan @NullVoxPopuli the strange thing is that https://www.npmjs.com/package/ember-modifier?activeTab=code does not suffer from such issue and no /// reference present in published code

@NullVoxPopuli
Copy link
Collaborator Author

ember-modifier is using rollup-plugin-typescript to generate the type declarations: https://github.com/ember-modifier/ember-modifier/blob/main/ember-modifier/rollup.config.mjs#L28

so perhaps there is some secret its doing that we need to find for folks directly using tsc / glint to generate their declarations

@SergeAstapov
Copy link
Contributor

ember-modifier is using rollup-plugin-typescript to generate the type declarations: https://github.com/ember-modifier/ember-modifier/blob/main/ember-modifier/rollup.config.mjs#L28

I planned to update ember-modifier setup with latest blueprint, will see what the output will be

@NullVoxPopuli
Copy link
Collaborator Author

Made a tool to help out in the future: https://github.com/NullVoxPopuli/fix-bad-declaration-output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants