perry-mitchell / ulidx

ULID generator for NodeJS and the browser
MIT License
281 stars 17 forks source link

Change TypeScript target to es2019 #21

Closed mpsq closed 1 year ago

mpsq commented 1 year ago

This library is currently targeting es2020 (see tsconfig.json). This results is narrower compatibility, for example this library is affected by https://github.com/cypress-io/cypress/issues/20753 (because of es2019 does not support optional chaining. Changing the target to es2019 would increase compatibility without affecting too much the output. What do you think?

perry-mitchell commented 1 year ago

Yes I'd happily accept such a change. Would you be willing to make a PR?

mpsq commented 1 year ago

Of course, see #22

kibertoad commented 1 year ago

@mpsq But why? All modern browsers and supported Node versions are compatible with ES2020. targetting older ES is likely to have perf impact.

perry-mitchell commented 1 year ago

Ok, after checking this it seems like TS doesn't like the 2019 module type:

image

image

And having thought about it for a bit, I do concur with @kibertoad that 2020 should be plenty in terms of browser support. If required it could be compiled, again, to an older format if needed in niche environments (ie. not the concern of this project).

Apologies for wasting time here.. let's leave it as is for now.