With the following example:
import { RequireAtLeastOne } from "type-fest";
type T = RequireAtLeastOne<{ a: string; b: string }>;
const getResult = (value: T) => value.a ?? value.b;
getResult
has a return type of string | undefined
, but I would expect it to have a return type of string
, as if value.a
is undefined
, value.b
should have a type of string
? Would this be possible to achieve?
Note that I have tested this with the latest version of typescript
at the time of writing (4.3.5
).
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too