reactjs / reactjs/react-docgen

Failed to parse

Open
#910 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.8k
Forks
316
Avg merge
5h 7m
Merged PRs (30d)
4

Description

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;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the generated src/Api/v1_0.swagger.ts file and Storybook 8.0.8, focusing on line 2716 and the reported generic Promise.resolve syntax. Trace how react-docgen parses this TypeScript input; done means the file no longer produces the Unexpected token error.

Written by the indexing model from the issue text.

Assessment

Tech stack
storybook, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.