Last active
February 6, 2024 20:28
-
-
Save Willmo36/132e5fcc84f24fb94ce72dc0ca28e701 to your computer and use it in GitHub Desktop.
TypeScript Lambda@edge enforce Capitalized-Header-Keys
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
type CapKebabCase<S extends string> = S extends `${infer A}-${infer B}` ? `${Capitalize<A>}-${CapKebabCase<B>}` : Capitalize<S>; | |
declare function test<S extends string>(s: S & CapKebabCase<S>): void | |
test("hello-there") | |
test("Hello-there") | |
test("Hello-There") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment