Skip to content
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

Improve DX error message for scripts/apidoc/signature.ts #1685

Closed
Shinigami92 opened this issue Dec 25, 2022 · 1 comment · Fixed by #1694
Closed

Improve DX error message for scripts/apidoc/signature.ts #1685

Shinigami92 opened this issue Dec 25, 2022 · 1 comment · Fixed by #1694
Assignees
Labels
c: docs Improvements or additions to documentation p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug

Comments

@Shinigami92
Copy link
Member

Clear and concise description of the problem

While running pnpm run generate:api-docs I got an error like this

- nearbyGPSCoordinate
/home/shinigami/OpenSource/faker/scripts/apidoc/signature.ts:238
            (property.type as ReflectionType)?.declaration.signatures?.[0]
                                               ^

TypeError: Cannot read properties of undefined (reading 'signatures')
    at <anonymous> (/home/shinigami/OpenSource/faker/scripts/apidoc/signature.ts:238:48)
    at Array.map (<anonymous>)
    at analyzeParameterOptions (/home/shinigami/OpenSource/faker/scripts/apidoc/signature.ts:231:23)
    at <anonymous> (/home/shinigami/OpenSource/faker/scripts/apidoc/signature.ts:227:7)
    at Array.flatMap (<anonymous>)
    at analyzeParameterOptions (/home/shinigami/OpenSource/faker/scripts/apidoc/signature.ts:226:32)
    at analyzeParameter (/home/shinigami/OpenSource/faker/scripts/apidoc/signature.ts:210:22)
    at analyzeSignature (/home/shinigami/OpenSource/faker/scripts/apidoc/signature.ts:128:20)
    at processModuleMethod (/home/shinigami/OpenSource/faker/scripts/apidoc/moduleMethods.ts:77:18)
    at processModuleMethods (/home/shinigami/OpenSource/faker/scripts/apidoc/moduleMethods.ts:34:19)

Suggested solution

Instead of TypeError: Cannot read properties of undefined (reading 'signatures') we should try to provide a message about what happend and why this error occurs

Alternative

No response

Additional context

Currently the error is terrible DX and a potential contributor could decide to just stop working on a PR and we would loose potential contributions

@Shinigami92 Shinigami92 added the s: pending triage Pending Triage label Dec 25, 2022
@Shinigami92 Shinigami92 changed the title Improve DX error message for Improve DX error message for scripts/apidoc/signature.ts Dec 25, 2022
@ST-DDT
Copy link
Member

ST-DDT commented Dec 25, 2022

I'll have a look soon.

@ST-DDT ST-DDT self-assigned this Dec 27, 2022
@ST-DDT ST-DDT added c: docs Improvements or additions to documentation p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug and removed s: pending triage Pending Triage labels Dec 27, 2022
@ST-DDT ST-DDT added this to the v8.0 - Module Re-Shuffling milestone Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: docs Improvements or additions to documentation p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants