Axel Rauschmayer on Nostr: #TypeScript: I don’t think TColor being Color can be avoided(?) class Color { ...
#TypeScript: I don’t think TColor being Color can be avoided(?)
class Color {
static red = new Color();
static green = new Color();
static blue = new Color();
}
type TColor = typeof Color.red | typeof Color.green | typeof Color.red;
Even adding a private slot to make Color nominal doesn’t change anything.
Published at
2025-01-22 10:41:52 UTCEvent JSON
{
"id": "b05c20070c311952fc3bd1823defd67010ef1f7e87d5cbed43a7fcb0b84dff30",
"pubkey": "7a7a0978cc46ef7fd548fb125e51c04de7d4ca639417a21b56aa95e3711c0b38",
"created_at": 1737542512,
"kind": 1,
"tags": [
[
"proxy",
"https://fosstodon.org/@rauschma/113871586121010455",
"web"
],
[
"t",
"typescript"
],
[
"proxy",
"https://fosstodon.org/users/rauschma/statuses/113871586121010455",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://fosstodon.org/users/rauschma/statuses/113871586121010455",
"pink.momostr"
],
[
"-"
]
],
"content": "#TypeScript: I don’t think TColor being Color can be avoided(?)\n\nclass Color {\n static red = new Color();\n static green = new Color();\n static blue = new Color();\n}\ntype TColor = typeof Color.red | typeof Color.green | typeof Color.red;\n\nEven adding a private slot to make Color nominal doesn’t change anything.",
"sig": "58369e7b527af4b010456db765e8be82ba13be4dc1966eb61b8b52c06800ed46791f4d1d756369f65ab4360598c65e0ac865fec9d38a34c1e0187984d057642d"
}