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

Generating declarations for readonly/shallowReadonly ref causes TS4058 error #4701

Closed
Tudzer opened this issue Sep 29, 2021 · 2 comments · Fixed by #4714
Closed

Generating declarations for readonly/shallowReadonly ref causes TS4058 error #4701

Tudzer opened this issue Sep 29, 2021 · 2 comments · Fixed by #4714

Comments

@Tudzer
Copy link

Tudzer commented Sep 29, 2021

Version

3.2.19

Reproduction link

github.com

Steps to reproduce

Run npm run build command

What is expected?

The source should be successfully compiled into .js with .d.ts declarations

What is actually happening?

The TS4058 error occurs because of RefSymbol that is used by readonly(ref) internally


The issue occurs only when "declarations": true is set in tsconfig.json as TypeScript can't resolve RefSymbol type when generating related .d.ts file

@posva
Copy link
Member

posva commented Sep 29, 2021

Maybe RefSymbol should be renamed to _RefSymbol, marked as @internal in its comment, and exported.
There are probably a few other missing exports reported by api-extractor

@LinusBorg
Copy link
Member

LinusBorg commented Sep 29, 2021

I found that the reason is found in our Deepreadonly type.

It currently doesn't account for Refs, and instead treats refs like plain objects, which exposes that RefSymbol property as a result of the recursive nature of this type.

I'll send a patch later

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

Successfully merging a pull request may close this issue.

3 participants