reactjs / react-docgen

A CLI and library to extract information from React component files for documentation generation purposes.
https://react-docgen.dev
MIT License
3.65k stars 295 forks source link

Failed to parse #910

Open pc00001 opened 5 months ago

pc00001 commented 5 months ago

We use a swagger gen .ts file in our project.

When using storybook 8.0.8 the following issue is reported SyntaxError: .\src\Api\v1_0.swagger.ts: Unexpected token (2716:112)

2714 | result200 = null; 2715 | }

2716 | return Promise.resolve<SwaggerResponse<FileUploadMetadata[]>>(new SwaggerResponse<FileUploadMetadata[]>(status, _headers, result200)); | ^ 2717 | 2718 | } else if (status !== 200 && status !== 204) { 2719 | const _responseText = response.data;

ManasiRoy commented 5 months ago

Can you please try this once -

if (status === 200) { // Assuming result200 is defined earlier in the code return Promise.resolve<SwaggerResponse<FileUploadMetadata[]>>(new SwaggerResponse<FileUploadMetadata[]>(status, _headers, result200)); } else if (status !== 204) { const _responseText = response.data; // Handle other statuses as needed }