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

Polyfill types are declaring global variables #523

Closed
grncdr opened this issue Jan 26, 2022 · 0 comments · Fixed by #524
Closed

Polyfill types are declaring global variables #523

grncdr opened this issue Jan 26, 2022 · 0 comments · Fixed by #524

Comments

@grncdr
Copy link
Contributor

grncdr commented Jan 26, 2022

It seems that polyfills (and in particular the submit-event.ts) are not being interpreted as a module. This leads to the variable declarations appearing as global.

For example, put this in a typescript file:

import "@hotwired/turbo"

submittersByForm. // auto-complete works here, even though this variable is not global

I noticed this issue because another project copied the submit-event.ts polyfill and they are generating conflicting types, but the core issue is here in @hotwired/turbo.

I am not familiar with rollup, but I think this can be fixed by simply adding export {} to the file somewhere, so that TypeScript knows to interpret it as a module and not a global script.

I verified that adding export {} corrects the issue.

@grncdr grncdr changed the title Polyfill TypeScript types are declaring global variables Polyfill types are declaring global variables Jan 26, 2022
@dhh dhh closed this as completed in #524 Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant