Created
January 22, 2023 18:16
-
-
Save andreypopp/81106f00291d3894d287e8534d24ab4c to your computer and use it in GitHub Desktop.
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
diff --git a/nextjs-api/types.ts b/nextjs-api/types.ts | |
index c7a7b7b..bff8e10 100644 | |
--- a/nextjs-api/types.ts | |
+++ b/nextjs-api/types.ts | |
@@ -28,29 +28,21 @@ export interface MakeEndpointConstruct<C, R, U, D> { | |
// TODO: How to make optional types work with generics?! | |
export interface EndpointConstructClient<C, R, U, D, URLParams> { | |
// FIXME - this is not working | |
- post?: C extends undefined | |
- ? undefined | |
- : ( | |
+ post?: ( | |
params: URLParams, | |
body: object | |
) => Promise<{ response: C | undefined; error: unknown }>; | |
// FIXME - this is not working | |
- get?: R extends undefined | |
- ? undefined | |
- : ( | |
+ get?: ( | |
params: URLParams | |
) => Promise<{ response: R | undefined; error: unknown }>; | |
// FIXME - this is not working | |
- update?: U extends undefined | |
- ? undefined | |
- : ( | |
+ update?: ( | |
params: URLParams, | |
body: object | |
) => Promise<{ response: U | undefined; error: unknown }>; | |
// FIXME - this is not working | |
- delete?: D extends undefined | |
- ? undefined | |
- : ( | |
+ delete?: ( | |
params: URLParams, | |
body?: object | |
) => Promise<{ response: D | undefined; error: unknown }>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment