dnt icon indicating copy to clipboard operation
dnt copied to clipboard

Promise.withResolvers is always polyfilled even when not desired

Open char opened this issue 1 year ago • 4 comments

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 avatar Nov 19 '24 16:11 char

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

char avatar Nov 19 '24 16:11 char

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

dsherret avatar Nov 22 '24 23:11 dsherret

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?

mb21 avatar Nov 26 '24 20:11 mb21

Found this issue for the same type error, and I am good with polyfilling myself.

Click to see my rant/reasoning Rushing for Latest instead of waiting for a proper named such as ES2024 doesn't feel right from the maintenance stand point.

Someone has to remember this random thing for an unspecified amount of time, it just feels uncomfortable.

vicary avatar Jan 10 '25 10:01 vicary