-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(output): don't allow empty outputs
Outputs will always have at least one response, requests cannot respond to nothing so now outputs do not allow empty responses BREAKING CHANGE: Any empty outputs will now fail type check. Any endpoints MUST now have at least one key in the output object
- Loading branch information
1 parent
076268c
commit 25dc301
Showing
3 changed files
with
20 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
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,2 +1,4 @@ | ||
export type OneOrMore<T> = T | [T, ...T[]] | ||
export type ValueOf<T> = T[keyof T] | ||
export type NonEmptyObj<T extends Record<string, unknown>, Message extends string = 'Object cannot be empty'> = | ||
T extends Record<string, never> ? Message : 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