microsoft / microsoft/TypeScript
Private members have implicit any type in generated declaration files
Open
@sandersn is already working on this.
Since Mar 27, 2020.
Needs Investigation
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
It seems the bug that was fixed in #36216 is happening again:
When generating delcarations for private class members, no type information is appended which causes the declaration file to generate errors when imported into a project with noImplicitAny enabled.
TypeScript Version: 3.8.3
Code
// Test.ts
export default class Test {
private _number: number = 0;
public str: string = '';
private get num() { return this._number; }
}
Expected behavior:
// Test.d.ts
export default class Test {
private num: any;
str: string;
private get num(): any;
}
Actual behavior:
// Test.d.ts
export default class Test {
private _number;
str: string;
private get num();
}
Related Issues: #36216, #36639
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.