Explicit Resource Management Proposal is so good but DisposableStack is so limited.
There's no way to remove disposables from the stack so any long-lived DisposableStack will keep them around forever until disposed.
github.com/tc39/proposal-exp…
Concretely:
const stack = new DisposableStack();
stack.use(disposable);
disposable.dispose();
Will still retain a reference to `disposable` until `stack.dispose()` is called.
Protip: In VSCode set `editor.minimap.renderCharacters` to `false`. Before and after.
So much nicer. No idea why it isn't the default.
I wish there was an easy way to define Symbol.toStringTag like native types do. To replicate the native behaviour in TypeScript you have to do this.
Even if you use a utility, you still need the TypeScript suppression which is very annoying. Is there a better way?
This is maybe the least worst option but feels... wrong. It's defined once on the prototype, non-enumerable and Foo.prototype[@@toStringTag] is accessible. Decorators would also be an option but I do not use them.
I have started adding getters back into my JS. Why?
- They are not writable, unless you have a setter. Often what you want for a public API (backed by private props is 😙🤌)
- Nicer API for boolean checks: `user.loggedIn` vs. `user.isLoggedIn()`
- No tangible performance impact.
this is so cursed wtf, i had no idea localStorage and sessionStorage were a map and that these were equivalent.
i feel like this api is too recent for this to be excusable? this makes implementing the Storage interface a pain in the ass, basically requiring a Proxy.
Sebastian retweeted
I'm excited to announce that the code of Athena Crisis is now open source under the MIT-License.
Check out the announcement:
why can't you
fetch(url, {json: true, body: {key: 'value'}})
why are we forced to
fetch(url, {body: JSON.stringify({key: 'value'}), headers: { 'Content-Type': 'application/json' }})
1.5m files, imagine the keystrokes this would save annually github.com/search?q=JSON.str…




![class Foo { // @ts-expect-error: It's defined on the prototype public [Symbol.toStringTag]: string; } Object.defineProperty(Foo.prototype, Symbol.toStringTag, { value: 'Foo', writable: false, enumerable: false, configurable: true, });](https://pbs.twimg.com/media/GOdZkjAWQAAONS5.jpg?name=small&format=webp)


