-
Notifications
You must be signed in to change notification settings - Fork 12.8k
[3.7.0] Generic class with private property generates d.ts file missing type on generic property #33877
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
Comments
Shouldn't the expected behavior be not to change the emit, but to remove the error? declare class C { private v } |
O_o Given that That doesn't quite seem right. |
The alternative is obligating declarations to expose more information about private members than is required. Maybe the emit could be changed to do this, regardless of the type of declare class C { private get f(): never } That would maintain backwards compatibility. |
That seems reasonable. I'm ok with that. The tangential question is ... what is the expectation for |
The error when consuming such declaration files will be fixed by #33896 |
The error should just be removed. Accessors were not allowed in d.ts files until 3.6 anyway, so it is not possible to make them compatible with anything 3.5 or below. @ajaff Thanks for the PR! |
TypeScript Version:
3.7.0-beta
(and just tested with typescript@next)Search Terms: private field declaration
Given a class:
Actual behavior:
running:
.\node_modules\.bin\tsc .\foo.ts --target es2016 --declaration
you will get a
foo.d.ts
file that looks like this:Dependent projects consuming that
d.ts
file will break, because the generic type isn't propagated to the private field declaration.Expected behavior:
Playground Link: playground doesn't generate d.ts file... (grrr!)
Related Issues: no.
The text was updated successfully, but these errors were encountered: