Sebastian (@sebmck) header
Sebastian (@sebmck) profile picture
Joined April 2011
Photo by Sebastian (@sebmck)Photo by Sebastian (@sebmck)Photo by Sebastian (@sebmck)Photo by Sebastian (@sebmck)Photo by Sebastian (@sebmck)Photo by Sebastian (@sebmck)Photo by Sebastian (@sebmck)Photo by Sebastian (@sebmck)Photo by Sebastian (@sebmck)Photo by Sebastian (@sebmck)
3
3
2
38
19,363
.js, .jsx, .cjs, .mjs, .ts, .tsx, .d.ts how many extensions does one language need
69
29
19
459
60,918
I'd just like to interject for a moment. What you're referring to as JavaScript, is in fact, TypeScript, or as I've recently taken to calling it, Microsoft JavaScript#.
3
4
76
12,727
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…
1
8
8,043
Concretely: const stack = new DisposableStack(); stack.use(disposable); disposable.dispose(); Will still retain a reference to `disposable` until `stack.dispose()` is called.
2
2
4,403
May seem obvious, but wasn't initially to me. You could "fix" this by holding all references to disposables, and their dispose method, weakly, or monkey patching every single diposable that gets passed. All solutions require writing a DisposableStack implementation from scratch.
3
3,996
Protip: In VSCode set `editor.minimap.renderCharacters` to `false`. Before and after. So much nicer. No idea why it isn't the default.
8
45
7
999
173,594
"Don't use the minimap." I also don't care.
66
14,899
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?
2
4
5,755
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.
3
4
3,877
This may actually be the thing that gets me using decorators... excessively.
1
3
3,186
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.
2
13
3,788
Obviously getters shouldn't have side effects, and I generally avoid setters. But it's 2024 and the ergonomics are worth the 0.1% performance impact over regular property access. If you're doing it right then you'll actually be faster (by doing more lazily).
5
2,581
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.
17
4
1
94
39,537
I'm excited to announce that the code of Athena Crisis is now open source under the MIT-License. Check out the announcement:
24
83
15
525
109,367
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' }})
61
23
14
780
195,969
is there an argument against this that couldn't have also been used to argue against Response.prototype.json
4
32
22,122
1.5m files, imagine the keystrokes this would save annually github.com/search?q=JSON.str…
1
55
19,226