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

Promise.withResolvers is always polyfilled even when not desired #438

Open
char opened this issue Nov 19, 2024 · 3 comments
Open

Promise.withResolvers is always polyfilled even when not desired #438

char opened this issue Nov 19, 2024 · 3 comments

Comments

@char
Copy link

char commented Nov 19, 2024

In our use case we are supplying our own polyfill for everything already so we set target to "Latest" to avoid dnt polyfills -- but since Promise.withResolvers is hardcoded to always polyfill, it's breaking our dnt generation runs:

src/_dnt.polyfills.ts:1:9 - error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.

1 declare global {
          ~~~~~~

error: Uncaught (in promise) Error: Had 1 diagnostics.
          throw new Error(`Had ${diagnostics.length} diagnostics.`);
@char
Copy link
Author

char commented Nov 19, 2024

What do we think about a change where there are no polyfills introduced at all for ScriptTarget::Latest ? Or some different way to opt out of polyfills altogether

@dsherret
Copy link
Member

That would be good. It would be nice to be able to more easily opt out of polyfills too.

@mb21
Copy link

mb21 commented Nov 26, 2024

Yes! I came here looking for some way to opt out of polyfills. (for me it's the Array.fromAsync, which has quite okay browser support nowadays).

I read the whole README and read all about shims only to realize that apparently polyfills are something separate in DNT that cannot be opted out of currently?

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

No branches or pull requests

3 participants