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

TS compilation error: Cannot find name 'GenericObject' #2171

Closed
mrginglymus opened this issue Sep 18, 2022 · 3 comments · Fixed by #2177
Closed

TS compilation error: Cannot find name 'GenericObject' #2171

mrginglymus opened this issue Sep 18, 2022 · 3 comments · Fixed by #2177
Assignees

Comments

@mrginglymus
Copy link
Contributor

Describe the bug
Using redoc in a project with skipLibCheck: false , I get the following error:

.yarn/__virtual__/redoc-virtual-0d2672ebad/1/build/node/cache/redoc-npm-2.0.0-f00948f5d8-8.zip/node_modules/redoc/typings/services/OpenAPIParser.d.ts:15:20 - error TS2304: Cannot find name 'GenericObject'.

15     validate(spec: GenericObject): void;
                      ~~~~~~~~~~~~~

It presumably refers to the definition here:

type GenericObject = Record<string, any>;

but as things stand, either I'm holding it wrong or the shipped typescript stubs are faulty.

Expected behavior
No errors on typescript compilation

Additional context
Typescript 4.6.3, redoc 2.0.0

@AlexVarchuk AlexVarchuk added the p2 label Sep 19, 2022
@AlexVarchuk AlexVarchuk self-assigned this Sep 19, 2022
@AlexVarchuk
Copy link
Collaborator

Hi @mrginglymus, thank you for the issue.
Before we do that, you can use the workaround.
Please add this type to your project and it should work.
Thanks.

@AlexVarchuk
Copy link
Collaborator

Hi @mrginglymus.
I cannot reproduce it on CRA with a typescript template and added skipLibCheck: false. Like in documentation https://redocly.com/docs/redoc/deployment/react/

Can you provide additional steps to reproduce? It will be very useful for us.
Thanks

@mrginglymus
Copy link
Contributor Author

hi @AlexVarchuk, I've created a minimal repro repo here: https://github.com/mrginglymus/redoc-type-bug

I don't use CRA myself, but I think I've got everything right there.

I'm going to raise a PR to inline usages of genericobject, so that the shipped types are complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants