Skip to content

Commit

Permalink
feat: exporting types for KeyLabelSetSerialized and all individual types
Browse files Browse the repository at this point in the history
  • Loading branch information
eturino committed Mar 11, 2020
1 parent 1670b59 commit 861e071
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/key-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import {
isValidKey,
Key,
KeyLabelSet,
KeyLabelSetAllExceptSomeSerialized,
KeyLabelSetAllSerialized,
KeyLabelSetNoneSerialized,
KeyLabelSetSerialized,
KeyLabelSetSomeSerialized,
KeySet,
KeySetAllExceptSomeSerialized,
KeySetAllSerialized,
Expand Down Expand Up @@ -68,6 +73,11 @@ export {
KeySetAllSerialized,
KeySetNoneSerialized,
KeySetSomeSerialized,
KeyLabelSetAllSerialized,
KeyLabelSetNoneSerialized,
KeyLabelSetSomeSerialized,
KeyLabelSetAllExceptSomeSerialized,
KeyLabelSetSerialized,
IKeyLabel,
InvalidKeySetError,
InvalidEmptySetError,
Expand Down
25 changes: 25 additions & 0 deletions src/lib/key-set/-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,31 @@ export type KeySetSerialized<T extends Key = Key> =
| KeySetSomeSerialized<T>
| KeySetAllExceptSomeSerialized<T>;

export type KeyLabelSetAllSerialized<T extends string | number = string | number> =
| { type: KeySetTypes.all }
| { type: KeySetTypes.all; elements: EmptyArray<T> };

export type KeyLabelSetNoneSerialized<T extends string | number = string | number> =
| { type: KeySetTypes.none }
| { type: KeySetTypes.none; elements: EmptyArray<T> };

export type KeyLabelSetSomeSerialized<T extends string | number = string | number> = {
type: KeySetTypes.some;
elements: NonEmptyArray<IKeyLabel<T>>;
};

export type KeyLabelSetAllExceptSomeSerialized<T extends string | number = string | number> = {
type: KeySetTypes.allExceptSome;
elements: NonEmptyArray<IKeyLabel<T>>;
};

export type KeyLabelSetSerialized<T extends string | number = string | number> =
| { type: KeySetTypes }
| KeyLabelSetAllSerialized<T>
| KeyLabelSetNoneSerialized<T>
| KeyLabelSetSomeSerialized<T>
| KeyLabelSetAllExceptSomeSerialized<T>;

export interface IKeySetClass {
/**
* returns the KeySetType that defines this class
Expand Down

0 comments on commit 861e071

Please sign in to comment.