Event JSON
{
"id": "a17c8c2d3d54ddf16c6d5b13063d8285c1b7c3c7f5aa4daa4e361c33cae16701",
"pubkey": "7a7a0978cc46ef7fd548fb125e51c04de7d4ca639417a21b56aa95e3711c0b38",
"created_at": 1742230788,
"kind": 1,
"tags": [
[
"t",
"typescript"
],
[
"proxy",
"https://fosstodon.org/@rauschma/114178836931498705",
"web"
],
[
"proxy",
"https://fosstodon.org/users/rauschma/statuses/114178836931498705",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://fosstodon.org/users/rauschma/statuses/114178836931498705",
"pink.momostr"
],
[
"-"
]
],
"content": "#TypeScript – surprisingly tricky to fix:\n\ntype Incrementor = {\n inc(): void,\n};\nfunction createIncrementor(start = 0): Incrementor {\n return {\n counter: start, // error\n inc() {\n this.counter++; // error\n },\n };\n}\n\nBest solution (AFAICT): Assign object to a variable, return that variable (then excess properties are allowed).\nhttps://exploringjs.com/tackling-ts/ch_typing-objects.html#allowing-excess-properties-example-incrementor",
"sig": "10de9502483cf6a4967cab962d072022d3020d4f42ccf42a8aa6e493069706c214221894968915978469c33a0bab9f128963e0e423cb30b55d971aa4ca9737e9"
}