Ben
Ben
I'll post a type that meets your request later here, let me know what you think!
rescript, which is the basis of ts-belt, does not work like this because it uses a stricter type system than typescript. Since typescript is much more flexible than rescript, there...
just finished making a simple proof-of-concept. here's [link](https://www.typescriptlang.org/play?noUncheckedIndexedAccess=true&noUnusedLocals=true&noUnusedParameters=true&jsx=0&useUnknownInCatchVariables=true&exactOptionalPropertyTypes=true&noFallthroughCasesInSwitch=true&noImplicitOverride=true&noPropertyAccessFromIndexSignature=true#code/JYWwDg9gTgLgBAbzgFQK5gDYFMDOAaOAeQCMArLAYxnzgAVgwsCBVAO2AlZoDFW4BfOADMoEEHADkACwjUKUBjAkAoZTACejIgGsAPMgB8cALyJlcCygCCAcQBcABjznLANwCGGVFjvJl-VQ0tAFEoKH0jYwRlAEhkWzsARliPLx8-ALVNLDgAJVxUDBh9PGZInQiAH1DwstUKThx4CG0TOAiAClTvXwBKO0I9QxMjDoR4+ydurH5e5QaueCwwts7pvrsaiJG4MYmkvGnZ1UDsuAApCGBWNg5WfTgsAA8YLFYAExw8gqLdVFZtKwIAB3Vh4f6AkGsAzleiMEoAbVit0aADpkBA0JgmLEsdgcKibKJ0AAhdS6EjkKgEmxYYoAIgm9JhzhiAFl3GA2GB3BRtAA1TzeXisymUaio4KsGAKXCslFcVEcsC6fI8vm8AzKAC6WuU11eUCEvJyat52l4jxeb0+cEt0RiUDpqCgrDssRiMCkwBwCPp7igAHMHPTtVbXh8vgjrkJltYbHgY3HBWltR6APxwACSQmCGBwWF0wQAivpbHgHAY8INdCnvFWtnWsDC4B67HBWFhXMt-K2YvrpctjRQctzzU3Lc8I7b7bEnTAXW6PV6fX6A8HQ+GbV98jhCsUIUDQeCAUfoX2YpmV77-UGQ2Gp9uKkmoHB+UY4Jn+W24Ne13fN0fSM4C2F83yML8PRiaCYJg9tO27KAfwQntMgNIcTTgZUxz5Cc+CAmc+AdedF3daC-1vDcH2tYD8gaKB3l0VhUBAYhljwXd9z+U8oRPSFQQMBFdQzRAEQAaTga44G0LB1AgIRf29G913vbU7DhQsKJU0NxO1PAETxXAlU5XQcIFIUsE1PBDIJDEFV1AJoPgrtUNUZ5IFgX8zloUQ2IcNpLmuBVdB8iBiGwEBkGyLUAHoYssBLLAAPXTE44sUnIhGuTxHm6dxXneLzGCyLQAGUIC8GA7geAidx+A8eOPQ8oRbUxApudhOAiZR0osFKTiCHJQvCrBIrOUwa2Y1jlgMaowl0JoFFYQNZq2BB1imtioDwEBcBwdxAx8RbrkDfgtUG7N3iwTwoq0Ca9E2ma4EqED5uO5bKnWiy7Ee7bdpwfbDrsd7Tti+KLqEaBcvcQp8pyLAAEdUE8YANBKnISxKOAyhMFwOl0GwDA6XodhsLdgOQT84ESOB2wAJhJ2q8YJomSeMIwydq7GqZp+mSavKBvFp4RPALABuU4tBzPMCxCp13mACg4esvBuFheXFbh8nbRlbxM2QdtuAGs5OKKAB9Npysq6rhoi27mx6+K+tSx2isyqGU2ABWNDgABhKRKG0ZR3OgeALv9wPTExq3UCqrrbdG+2qyzK6bui13EoSlKgA)
While it may enhance developer experience(at least at a type level), I think It's a hacky way to achieve with the current state of typescript's type system. I didn't consider...
guess it's ok to close this issue?
It abstracts the absence of a given type T. You could think of it as just an alias for type representation in raw typescript: T|null|undefined, but there's little more about...
could be fixed easily by changing the signature of the update function with ``` export declare function update(dict: T, key: K, fn: (value: T[K]) => R): {[Kx in Exclude]:T[Kx]} &...
btw, unlike other fp languages, typescript can infer keyof T type in compile-time, so the value of T[K] should be typeof T[K] instead of Option, I guess.
revisited this issue, seems D.update has been fixed in 4.0.0, but updateUnsafe isn't.
+1 for this. with ts-pattern, I always use { TAG:0 } instead of { __:'OK' }, which leads poor readability.