Skip to content

Commit

Permalink
Remove UnTagged (#65)
Browse files Browse the repository at this point in the history
Fixes #61
  • Loading branch information
OliverJAsh authored and pelotom committed Jul 15, 2019
1 parent 2ce9a1b commit 602383b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export type RecordOf<U extends UnionTypes<any, any>> = U['_Record'];
export type UnionOf<U extends UnionTypes<any, any>> = U['_Union'];

export type Creators<Record, TaggedRecord, TagProp extends string> = {
[T in keyof Record]: {} extends Required<UnTagged<Record[T], TagProp>>
[T in keyof Record]: {} extends Required<Record[T]>
? ((value?: {}) => TaggedRecord[keyof TaggedRecord])
: ((value: UnTagged<Record[T], TagProp>) => TaggedRecord[keyof TaggedRecord])
: ((value: Record[T]) => TaggedRecord[keyof TaggedRecord])
};

export type Predicates<TaggedRecord> = {
Expand Down Expand Up @@ -61,10 +61,6 @@ export type MultiValueVariants<Record extends MultiValueRec<TagProp>, TagProp ex
: { [_ in TagProp]: T } & Record[T] // no: decorate with tag
};

export type UnTagged<Record, TagProp extends string = 'tag'> = Record extends any
? Pick<Record, Exclude<keyof Record, TagProp>>
: never;

export type SingleValueVariants<
Record extends SingleValueRec,
TagProp extends string,
Expand Down

0 comments on commit 602383b

Please sign in to comment.