-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support generics #1082
Comments
|
+1 for this, an example use case I have would be something like this: import { api, endpoint, request, response, body } from "@airtasker/spot";
@api({
name: "My API"
})
class Api {}
@endpoint({
method: "POST",
path: "/users"
})
class CreateUser {
@request
request(@body body: CreateUserRequest) {}
@response({ status: 201 })
response(@body body: StandardResponse<CreateUserResponse>) {}
}
/**
* A wrapper for all response types
*/
interface StandardResponse<T = undefined> {
traceId: string;
message: string;
data: T
}
interface CreateUserRequest {
firstName: string;
lastName: string;
}
interface CreateUserResponse {
firstName: string;
lastName: string;
role: string;
} |
Hi @lfportal, might there still be interest in this issue, I have something WIP that works for my use case. |
I also noticed the following which capability matrix:
union type -> ✅
inheritance type -> ✅
recursive -> 🔴
generics -> 🔴
Would love to hear any thoughts you have on implementing these.
Originally posted by @mahirk in #1034 (comment)
The text was updated successfully, but these errors were encountered: