News for hackers. Stuff that matters.
Re:TypeScript NPM Packages Done Right by SenHeng on Sunday September 24, 2023 @06:10AM (#37631716)
No idea. Matt Pocock has a much better cheat sheet for tsconfig configurations and his is set as es2022.

https://twitter.com/mattpocockuk/status/1701619240686485799

Re:TypeScript NPM Packages Done Right by fortunateregard on Sunday September 24, 2023 @08:29AM (#37632495)
Re:TypeScript NPM Packages Done Right by sedro on Sunday September 24, 2023 @12:36PM (#37634620)
This cheatsheet would have you publish dist/*.{js,d.ts}. Presumably you would use "files":["dist"] in package.json to exclude sources from being published.

The OP recommends to additionally package src/*.ts along with sourceMaps and declarationMaps.

What's actually the best practice here?

Re:TypeScript NPM Packages Done Right by antipotoad on Sunday September 24, 2023 @10:41PM (#37639128)
I poke around in node_modules with some regularity (often in combination with the debugger) and it’s always nice to find actual source files, not just source maps.
Re:TypeScript NPM Packages Done Right by herpdyderp on Sunday September 24, 2023 @09:13AM (#37632815)
I prefer to leave lib empty, it’s always caused me problems.
Re:TypeScript NPM Packages Done Right by n2d4 on Sunday September 24, 2023 @12:03PM (#37634277)
Browser support for ES2015 is about 95% [0], while most ES2022 features sit at around 90% [1]. You can find the individual benchmarks on compat-table [2].

Some, but not all of these, are transpilable/polyfillable (refer to compat-table).

[0] https://caniuse.com/es6

[1] https://caniuse.com/?feats=mdn-javascript_builtins_array_at,...

[2] https://kangax.github.io/compat-table/es2016plus/

Re:TypeScript NPM Packages Done Right by lolinder on Sunday September 24, 2023 @12:47PM (#37634739)
When we talk about "modern browsers", we're not talking about usage percentage, we're talking about browsers released in the past few years. If you need to support browsers older than that, that's great, but we don't call those modern browsers, that's legacy support.

Most modern browsers are evergreen, so targeting es2022 would be fine for most users. The exception is Safari, which is slower to incorporate new features and doesn't roll out its updates nearly as quickly as Chromium-based or Firefox, but even they have had es2016 support since 2016.

Re:TypeScript NPM Packages Done Right by nwienert on Sunday September 24, 2023 @12:57PM (#37634843)
Also Safari greatly picked up pace a few years ago and honestly it’s hard to categorize them as behind anymore. They lead in several areas, and have caught up in most.
Re:TypeScript NPM Packages Done Right by n2d4 on Sunday September 24, 2023 @01:49PM (#37635412)
Sure, but the reason why browser compatibility is being measured is to quantify that notion of "modern".

You can then use that to make your own decisions; if you're working on a high-tech video streaming platform for kids you can probably safely ignore the 5%, but if you're providing information on behalf of the government you might need to support much more than that.