-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Description
TypeScript Version: 3.7.0-beta
(and just tested with typescript@next)
Search Terms: private field declaration
Given a class:
class foo<T> {
private get value() : T {
return this.v;
}
constructor (private v:T) {
}
}
Actual behavior:
running:
.\node_modules\.bin\tsc .\foo.ts --target es2016 --declaration
you will get a foo.d.ts
file that looks like this:
declare class foo<T> {
private v;
private get value();
constructor(v: T);
}
Dependent projects consuming that d.ts
file will break, because the generic type isn't propagated to the private field declaration.
node_modules/foo/index.d.ts:3:17 - error TS7033: Property 'value' implicitly has type 'any', because its get accessor lacks a return type annotation.
private get value(); ~~~~~
Expected behavior:
declare class foo<T> {
private v: T;
private get value() : T;
constructor(v: T);
}
Playground Link: playground doesn't generate d.ts file... (grrr!)
Related Issues: no.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript