UNPKG
typescript-types
Version:
latest (1.0.3)
1.0.3
1.0.2
1.0.1
1.0.0
Typescript typings
github.com/krewi1/typescript-typings
typescript-types
/
types
/
object
/
oneOfProp.ts
5 lines
(3 loc)
•
188 B
text/typescript
View Raw
1
2
3
4
5
import
{ Omit } from "./omit"; export type
OneOfProp
<
T
,
K
extends keyof
T
= keyof
T
>
=
Omit
<
T
,
K
>
&
{ [
I
in
K
]
-?
:
Required
<
Pick
<
T
,
I
>> &
Partial
<
Record
<
Exclude
<
K
,
I
>, undefined>> }[
K
];