microsoft / microsoft/TypeScript

Private members have implicit any type in generated declaration files

Open
#37,621 3 comments 0 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.