-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7012 from matt-tingen/actions-type
Improve actions type
- Loading branch information
Showing
4 changed files
with
86 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { ActionOptions } from './ActionOptions'; | ||
import { ActionsMap } from './ActionsMap'; | ||
|
||
export interface ActionsFunction { | ||
<T extends string>(handlerMap: Record<T, string>, options?: ActionOptions): ActionsMap<T>; | ||
<T extends string>(...handlers: T[]): ActionsMap<T>; | ||
|
||
<T extends string>(handler1: T, options?: ActionOptions): ActionsMap<T>; | ||
<T extends string>(handler1: T, handler2: T, options?: ActionOptions): ActionsMap<T>; | ||
<T extends string>(handler1: T, handler2: T, handler3: T, options?: ActionOptions): ActionsMap<T>; | ||
<T extends string>( | ||
handler1: T, | ||
handler2: T, | ||
handler3: T, | ||
handler4: T, | ||
options?: ActionOptions | ||
): ActionsMap<T>; | ||
<T extends string>( | ||
handler1: T, | ||
handler2: T, | ||
handler3: T, | ||
handler4: T, | ||
handler5: T, | ||
options?: ActionOptions | ||
): ActionsMap<T>; | ||
<T extends string>( | ||
handler1: T, | ||
handler2: T, | ||
handler3: T, | ||
handler4: T, | ||
handler5: T, | ||
handler6: T, | ||
options?: ActionOptions | ||
): ActionsMap<T>; | ||
<T extends string>( | ||
handler1: T, | ||
handler2: T, | ||
handler3: T, | ||
handler4: T, | ||
handler5: T, | ||
handler6: T, | ||
handler7: T, | ||
options?: ActionOptions | ||
): ActionsMap<T>; | ||
<T extends string>( | ||
handler1: T, | ||
handler2: T, | ||
handler3: T, | ||
handler4: T, | ||
handler5: T, | ||
handler6: T, | ||
handler7: T, | ||
handler8: T, | ||
options?: ActionOptions | ||
): ActionsMap<T>; | ||
<T extends string>( | ||
handler1: T, | ||
handler2: T, | ||
handler3: T, | ||
handler4: T, | ||
handler5: T, | ||
handler6: T, | ||
handler7: T, | ||
handler8: T, | ||
handler9: T, | ||
options?: ActionOptions | ||
): ActionsMap<T>; | ||
<T extends string>( | ||
handler1: T, | ||
handler2: T, | ||
handler3: T, | ||
handler4: T, | ||
handler5: T, | ||
handler6: T, | ||
handler7: T, | ||
handler8: T, | ||
handler9: T, | ||
handler10: T, | ||
options?: ActionOptions | ||
): ActionsMap<T>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import { HandlerFunction } from './HandlerFunction'; | ||
|
||
export interface ActionsMap { | ||
[key: string]: HandlerFunction; | ||
} | ||
export type ActionsMap<T extends string = string> = Record<T, HandlerFunction>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4922763
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully aliased the URL https://monorepo-khuyqqlpz.now.sh to the following aliases.