Closed declanchiu closed 2 years ago
This didn't change between 4.3 and 4.7 as far as I can tell. The current behavior is the expected behavior; if you want the "expected" behavior use as const
either on the strings themselves or the entire object
export const OpenApiVersionExportName = {
[OpenApiVersion.openapi31]: 'openapi',
[OpenApiVersion.openapi30]: 'openapi',
[OpenApiVersion.openapi2]: 'swagger',
} as const
我这如果真的,你是在和 4.3.7 之间变化。当前行为是没有行为;“潜在”行为
as const
,在字符串本身就是对象上使用export const OpenApiVersionExportName = { [OpenApiVersion.openapi31]: 'openapi', [OpenApiVersion.openapi30]: 'openapi', [OpenApiVersion.openapi2]: 'swagger', } as const
oh !! I am very sorry for wasting your precious time, it is my negligence that caused. 😖
Bug Report
🔎 Search Terms
typecript does not automatically generate the correct type、enum、Object key in enum
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Typescript Generated Types 👇
🙂 Expected behavior
This is my expectation 👇