TypeScript/tests/baselines/reference/jsdocImportType.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

61 lines
1.4 KiB
Plaintext

=== tests/cases/conformance/jsdoc/use.js ===
/// <reference path='./types.d.ts'/>
/** @typedef {import("./mod1")} C
* @type {C} */
var c;
>c : import("tests/cases/conformance/jsdoc/mod1")
c.chunk;
>c.chunk : number
>c : import("tests/cases/conformance/jsdoc/mod1")
>chunk : number
const D = require("./mod1");
>D : typeof import("tests/cases/conformance/jsdoc/mod1")
>require("./mod1") : typeof import("tests/cases/conformance/jsdoc/mod1")
>require : (name: string) => any
>"./mod1" : "./mod1"
/** @type {D} */
var d;
>d : import("tests/cases/conformance/jsdoc/mod1")
d.chunk;
>d.chunk : number
>d : import("tests/cases/conformance/jsdoc/mod1")
>chunk : number
=== tests/cases/conformance/jsdoc/types.d.ts ===
declare function require(name: string): any;
>require : (name: string) => any
>name : string
declare var exports: any;
>exports : any
declare var module: { exports: any };
>module : { exports: any; }
>exports : any
=== tests/cases/conformance/jsdoc/mod1.js ===
/// <reference path='./types.d.ts'/>
class Chunk {
>Chunk : Chunk
constructor() {
this.chunk = 1;
>this.chunk = 1 : 1
>this.chunk : any
>this : this
>chunk : any
>1 : 1
}
}
module.exports = Chunk;
>module.exports = Chunk : typeof Chunk
>module.exports : typeof Chunk
>module : { "\"tests/cases/conformance/jsdoc/mod1\"": typeof Chunk; }
>exports : typeof Chunk
>Chunk : typeof Chunk