-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
3.7.4 emits d.ts files incompatible as inputs to programs with noImplicitAny
or strict
flags
#36216
3.7.4 emits d.ts files incompatible as inputs to programs with noImplicitAny
or strict
flags
#36216
Comments
Typescript 3.7 now emits d.ts files for getters differently than prior versions, and there seems to be a bug in how it strips private types without replacing them with explicit 'any' type. This then leads to compilation failures in projects compiled against our packages that don't have skipLibCheck turned on but do have strict or noImplicitAny check on. I'm working around this by marking the affected getters as @internal and adding a test to prevent future regressions. I believe this is a TypeScript bug, and I filed a bug report: microsoft/TypeScript#36216
Real world d.ts file that fails to compile: https://unpkg.com/browse/@angular/compiler@9.0.0-rc.9/src/output/abstract_emitter.d.ts#L23 You can test it by compiling a simple program: setup: yarn add @angular/compiler@9.0.0-rc.9 program: import * as test from '@angular/compiler';
export default { test }; |
Typescript 3.7 now emits d.ts files for getters differently than prior versions, and there seems to be a bug in how it strips private types without replacing them with explicit 'any' type. This then leads to compilation failures in projects compiled against our packages that don't have skipLibCheck turned on but do have strict or noImplicitAny check on. I'm working around this by marking the affected getters as @internal and adding a test to prevent future regressions. I believe this is a TypeScript bug, and I filed a bug report: microsoft/TypeScript#36216
Ugh, this is awkward. We shouldn't have ever complained about the missing I am inclined to make a 3.7.6 to prevent this from turning into a long-term compat annoyance. Would that be sufficient for your setup? |
cc @sandersn in case he has any thoughts |
I think it would be sufficient for our setup, yes. If doing a 3.7.6, we could also use #36098 since it affects other parts of our setup. |
This should already be fixed with #33896 which according to the tags is included in v3.7.4 |
@ajafff I think your fix addresses the problem for consumers on 3.7.4, is that correct? In our case we have typings created with 3.7.4 that we also wish to be consumed by users on 3.6. |
@filipesilva you are right. My PR removes this restriction from 3.7.4, it doesn't change the emitted declarations.
So this is a duplicate of #36207 (and many more). The proposed solution is to use https://www.npmjs.com/package/downlevel-dts. This tool could probably add an explicit |
@RyanCavanaugh yes |
…#34798) Typescript 3.7 now emits d.ts files for getters differently than prior versions, and there seems to be a bug in how it strips private types without replacing them with explicit 'any' type. This then leads to compilation failures in projects compiled against our packages that don't have skipLibCheck turned on but do have strict or noImplicitAny check on. I'm working around this by marking the affected getters as @internal and adding a test to prevent future regressions. I believe this is a TypeScript bug, and I filed a bug report: microsoft/TypeScript#36216 PR Close #34798
…#34798) Typescript 3.7 now emits d.ts files for getters differently than prior versions, and there seems to be a bug in how it strips private types without replacing them with explicit 'any' type. This then leads to compilation failures in projects compiled against our packages that don't have skipLibCheck turned on but do have strict or noImplicitAny check on. I'm working around this by marking the affected getters as @internal and adding a test to prevent future regressions. I believe this is a TypeScript bug, and I filed a bug report: microsoft/TypeScript#36216 PR Close #34798
So what's the new behavior? Always emit these with an |
We could also make 3.6 not error on this instead because I think it's the only version that actually recognizes getters in a |
We're going to do the latter. Users who run into issues will be able to upgrade to 3.6.5 from ≤3.6.4. |
3.6.5 should be available now. Thanks for the the heads up on all this! |
In case we can help confused users https://stackoverflow.com/questions/59886814/why-do-i-get-an-implicit-any-error-on-a-private-getter-in-my-d-ts-files/59886845#59886845 |
TypeScript Version: 3.7.4
Search Terms:
noImplicitAny, strict, d.ts, declaration, getter, get, private
Code
tsconfig.json
Expected behavior:
produces d.ts which if compiled against in a program with
strict
mode on is compiled successfully, for example (note_privateRef(): any
):Actual behavior:
get _privateRef()
is emitted without any explicit type and is implicitly set toany
which triggers compilation failure:resulting in:
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: