'Filter a type to only its non-nullable attributes
given this type
type HasOptionals = {
name: string
surname?: string
}
is it possible to generate a type that excludes any optional properties?
type example = OnlyRequired<HasOptionals> // { name: string }
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
