-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
invalid type(_object) is generated in sdk. #293
Comments
Use exact type instead of |
this is second case (위와 다른 상황) @Get()
async findMany(
@Query('page') page?: string,
): Promise<
PaginatedResponse<IProduct.Summary> | typeof Exception.INVALID_QUERY // union type
> {
const npage = Number(page ?? 1);
if (isNaN(npage) || !typia.is<Page>({ page: npage }))
return Exception.INVALID_QUERY;
throw Error();
//return ProductUsecase.findMany(npage);
}
// in sdk file
export type Output = { readonly code: "4002"; readonly data: "유효하지 않은 query입니다."; } | PaginatedResponse<Summary>;
// "PaginatedResponse<Summary>" doesn't imported. (import없이 타입명만 그대로 작성됩니다.) |
but why typeof statement is not recommend? |
|
@industriously |
I can understand number 1, but it's hard to understand that there's no problem when there's more than two "typeof". |
@kakasoo 카카수님 블로그보고 적용한 사항이에용 :) you're right. |
@samchon |
Decided to prohibit unnamed type using. |
sdk doesn't generate Output type properly in specific case.
and it's really my code.
The text was updated successfully, but these errors were encountered: