-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add strong types for response content type headers (#92)
- Loading branch information
Showing
3 changed files
with
130 additions
and
53 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
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,13 +1,3 @@ | ||
export type Modify<T, R> = Omit<T, keyof R> & R; | ||
|
||
// Accept a string with any casing - used for validating headers. | ||
// Ref: https://stackoverflow.com/a/64932909 | ||
export type AnyCase<T extends string> = string extends T | ||
? string | ||
: T extends `${infer F1}${infer F2}${infer R}` | ||
? `${Uppercase<F1> | Lowercase<F1>}${ | ||
| Uppercase<F2> | ||
| Lowercase<F2>}${AnyCase<R>}` | ||
: T extends `${infer F}${infer R}` | ||
? `${Uppercase<F> | Lowercase<F>}${AnyCase<R>}` | ||
: ''; | ||
export type AnyCase<T extends string> = T | Uppercase<T> | Lowercase<T>; |
079fc25
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 deployed to the following URLs:
next-rest-framework – ./docs
next-rest-framework-blomqma.vercel.app
next-rest-framework-git-main-blomqma.vercel.app
next-rest-framework.vercel.app
079fc25
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 deployed to the following URLs:
next-rest-framework-demo – ./apps/example
next-rest-framework-demo-blomqma.vercel.app
next-rest-framework-demo-git-main-blomqma.vercel.app
next-rest-framework-demo.vercel.app