TypeScript/tests/baselines/reference/jsdocImplements_properties.types
Anders Hejlsberg 3919042c7f
Control flow for constructor initialized properties (#37920)
* Use CFA to determine types of properties declared by this.xxx assignments

* Accept new baselines

* Also use CFA in constructor functions

* Accept new baselines

* Fix lint error

* Only widen fresh literal types in CFA of assignment to auto-typed

* Auto-typing for declared properties with no type annotation or initializer

* Add optionality if declaration includes '?' modifier

* Always use CFA for properties with no initializer in .js files

* Small fix
2020-04-28 16:59:03 -07:00

35 lines
415 B
Plaintext

=== /a.js ===
class A { constructor() { this.x = 0; } }
>A : A
>this.x = 0 : 0
>this.x : any
>this : this
>x : any
>0 : 0
/** @implements A*/
class B {}
>B : B
/** @implements A*/
class B2 {
>B2 : B2
x = 10
>x : number
>10 : 10
}
/** @implements {A}*/
class B3 {
>B3 : B3
constructor() { this.x = 10 }
>this.x = 10 : 10
>this.x : any
>this : this
>x : any
>10 : 10
}