-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
fix(enum-values): access optional prop child props #2139
base: main
Are you sure you want to change the base?
Conversation
👷 Deploy request for openapi-ts pending review.Visit the deploys page to approve it
|
|
b11ceea
to
d5ccbf8
Compare
I've committed some further modifications to handle corner cases like the following that I've found in my codebase: FormFieldBulkStoreRequest: {
data: {
composite_fields?: {
type: "TextSingleLine" | "TextMultiLine" | "Integer" | "Boolean" | "Date" | "Datetime" | "Reference" | "Asset";
}[] | null;
}[] | null;
}; |
I'm not for this approach. Currently we export consts which reference into the existing types. Instead, the consts themselves should represent the basis for the type, and the This is the approach I've already taken in #2051, so I'll prioritize making those changes backwards-compatible with the 7.x branch, which should address both #2138 and #2140. |
I think #2051 doesn't address #941 as it expresses the concrete values as const array, and side-steps indexed access. There's still open discussion about naming. |
@duncanbeevers why don't we base everything on top of the enum? export enum StatusEnum {
ACTIVE = 'active',
INACTIVE = 'inactive'
}
export type Status = `${StatusEnum}`
export const StatusValues: Status[] = Object.values(StatusEnum)
export interface components {
schemas: {
Status: Status
}
} The approach is the same of your PR but you get #941 for free. |
Changes
Fixes #2138 and #2140
How to Review
How can a reviewer review your changes? What should be kept in mind for this review?
Checklist
docs/
updated (if necessary)pnpm run update:examples
run (only applicable for openapi-typescript)