Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Commit

Permalink
Update from deprecated $Enum to $Keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan953 committed Jul 6, 2019
1 parent a5ef6d2 commit d9376c1
Show file tree
Hide file tree
Showing 3 changed files with 3,617 additions and 10 deletions.
10 changes: 5 additions & 5 deletions index.js.flow
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* @flow */

type EnumDefinition<T> = {[key: $Enum<T>]: $Enum<T>};
type EnumDefinition<T> = {[key: $Keys<T>]: $Keys<T>};

declare type Enum<T> = {
[key: $Enum<T>]: $Enum<T>,
forEach: (iter: (val: $Enum<T>) => void) => void,
[key: $Keys<T>]: $Keys<T>,
forEach: (iter: (val: $Keys<T>) => void) => void,
};

declare module.exports: {
make: (dfn: EnumDefinition<*>) => Enum<*>,
coalesce: (obj: Enum<*>, field: ?$Enum<*>) => ?$Enum<*>,
enforce: (obj: Enum<*>, field: $Enum<*>) => $Enum<*>,
coalesce: (obj: Enum<*>, field: ?$Keys<*>) => ?$Keys<*>,
enforce: (obj: Enum<*>, field: $Keys<*>) => $Keys<*>,
};
10 changes: 5 additions & 5 deletions interfaces/Enumjs.js.flow
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/* @flow */

type EnumDefinition<T> = {[key: $Enum<T>]: $Enum<T>};
type EnumDefinition<T> = {[key: $Keys<T>]: $Keys<T>};

declare type Enum<T> = {
[key: $Enum<T>]: $Enum<T>,
forEach: (iter: (val: $Enum<T>) => void) => void,
[key: $Keys<T>]: $Keys<T>,
forEach: (iter: (val: $Keys<T>) => void) => void,
};

declare module 'Enumjs' {
declare module.exports: {
make: (dfn: EnumDefinition<*>) => Enum<*>,
coalesce: (obj: Enum<*>, field: ?$Enum<*>) => ?$Enum<*>,
enforce: (obj: Enum<*>, field: $Enum<*>) => $Enum<*>,
coalesce: (obj: Enum<*>, field: ?$Keys<*>) => ?$Keys<*>,
enforce: (obj: Enum<*>, field: $Keys<*>) => $Keys<*>,
};
};
Loading

0 comments on commit d9376c1

Please sign in to comment.