From 7a19e981ac590de00f7dfbcfcd80ac1969b5daf6 Mon Sep 17 00:00:00 2001 From: Oleksandr Tarasiuk Date: Tue, 25 Nov 2025 00:44:31 +0200 Subject: [PATCH 1/2] fix(2157): resolve jsdoc host for binary expression statements --- internal/parser/reparser.go | 4 + ...unctionWithExtraTypedefsMembers.errors.txt | 16 -- ...onWithExtraTypedefsMembers.errors.txt.diff | 20 --- ...ssignedFunctionWithExtraTypedefsMembers.js | 23 ++- ...edFunctionWithExtraTypedefsMembers.js.diff | 25 ++- ...gnedFunctionWithExtraTypedefsMembers.types | 14 +- ...unctionWithExtraTypedefsMembers.types.diff | 23 +-- ...mentAccessNoContextualTypeCrash.errors.txt | 8 +- ...ccessNoContextualTypeCrash.errors.txt.diff | 8 +- ...jsElementAccessNoContextualTypeCrash.types | 26 ++-- ...mentAccessNoContextualTypeCrash.types.diff | 39 ++--- .../compiler/jsFileMethodOverloads4.types | 8 +- .../jsFileMethodOverloads4.types.diff | 10 +- ...OnVariableDeclaredFunctionExpression.types | 8 +- ...assCanExtendConstructorFunction.errors.txt | 13 +- ...nExtendConstructorFunction.errors.txt.diff | 32 +++- .../classCanExtendConstructorFunction.symbols | 4 + ...sCanExtendConstructorFunction.symbols.diff | 21 +-- .../classCanExtendConstructorFunction.types | 64 ++++---- ...assCanExtendConstructorFunction.types.diff | 76 ++++------ ...torFunctionMethodTypeParameters.errors.txt | 5 +- ...nctionMethodTypeParameters.errors.txt.diff | 5 +- ...structorFunctionMethodTypeParameters.types | 10 +- ...torFunctionMethodTypeParameters.types.diff | 24 +-- .../constructorFunctions3.errors.txt | 8 +- .../constructorFunctions3.errors.txt.diff | 8 +- .../conformance/constructorFunctions3.types | 42 +++--- .../constructorFunctions3.types.diff | 57 +++---- .../jsDeclarationsClassMethod.errors.txt | 32 +--- .../jsDeclarationsClassMethod.errors.txt.diff | 32 +--- .../conformance/jsDeclarationsClassMethod.js | 4 +- .../jsDeclarationsClassMethod.js.diff | 4 +- .../jsDeclarationsClassMethod.types | 84 +++++------ .../jsDeclarationsClassMethod.types.diff | 142 +++--------------- ...ignedConstructorFunctionWithSub.errors.txt | 8 +- ...ConstructorFunctionWithSub.errors.txt.diff | 8 +- ...xportAssignedConstructorFunctionWithSub.js | 2 +- ...AssignedConstructorFunctionWithSub.js.diff | 2 +- ...rtAssignedConstructorFunctionWithSub.types | 36 ++--- ...ignedConstructorFunctionWithSub.types.diff | 40 +++-- .../jsDeclarationsFunctionsCjs.errors.txt | 4 +- ...jsDeclarationsFunctionsCjs.errors.txt.diff | 4 +- .../conformance/jsDeclarationsFunctionsCjs.js | 12 +- .../jsDeclarationsFunctionsCjs.js.diff | 12 +- .../jsDeclarationsFunctionsCjs.types | 52 +++---- .../jsDeclarationsFunctionsCjs.types.diff | 78 +++------- ...sdocTemplateConstructorFunction.errors.txt | 34 +++++ ...emplateConstructorFunction.errors.txt.diff | 51 +++---- .../jsdocTemplateConstructorFunction.types | 14 +- ...sdocTemplateConstructorFunction.types.diff | 32 ++-- ...docTemplateConstructorFunction2.errors.txt | 8 +- ...mplateConstructorFunction2.errors.txt.diff | 19 ++- .../jsdocTemplateConstructorFunction2.symbols | 2 + ...cTemplateConstructorFunction2.symbols.diff | 4 +- .../jsdocTemplateConstructorFunction2.types | 16 +- ...docTemplateConstructorFunction2.types.diff | 22 +-- .../conformance/jsdocTemplateTag.errors.txt | 12 +- .../jsdocTemplateTag.errors.txt.diff | 24 ++- .../conformance/jsdocTemplateTag.types | 6 +- .../conformance/jsdocTemplateTag.types.diff | 6 +- .../conformance/jsdocTemplateTag4.errors.txt | 33 ++-- .../jsdocTemplateTag4.errors.txt.diff | 33 ++-- .../conformance/jsdocTemplateTag4.types | 46 +++--- .../conformance/jsdocTemplateTag4.types.diff | 82 ++++------ .../conformance/jsdocTemplateTag5.errors.txt | 4 +- .../jsdocTemplateTag5.errors.txt.diff | 4 +- .../conformance/jsdocTemplateTag5.types | 22 +-- .../conformance/jsdocTemplateTag5.types.diff | 22 +-- ...leExportWithExportPropertyAssignment.types | 6 +- ...ortWithExportPropertyAssignment.types.diff | 9 +- .../conformance/paramTagTypeResolution.types | 32 ++-- .../paramTagTypeResolution.types.diff | 53 +------ ...ignmentMergeWithInterfaceMethod.errors.txt | 8 +- ...ntMergeWithInterfaceMethod.errors.txt.diff | 17 +-- ...tyAssignmentMergeWithInterfaceMethod.types | 6 +- ...ignmentMergeWithInterfaceMethod.types.diff | 7 +- ...rototypeMethodCompoundAssignmentJs.symbols | 4 +- ...ypeMethodCompoundAssignmentJs.symbols.diff | 4 +- ...sPrototypeMethodCompoundAssignmentJs.types | 8 +- ...otypeMethodCompoundAssignmentJs.types.diff | 22 --- .../thisTypeOfConstructorFunctions.errors.txt | 8 +- ...TypeOfConstructorFunctions.errors.txt.diff | 8 +- .../typeFromPropertyAssignment10.types | 10 +- .../typeFromPropertyAssignment10.types.diff | 18 +-- .../typeFromPropertyAssignment10_1.types | 10 +- .../typeFromPropertyAssignment10_1.types.diff | 18 +-- .../typeFromPropertyAssignment9.types | 10 +- .../typeFromPropertyAssignment9.types.diff | 18 +-- .../typeFromPropertyAssignment9_1.types | 10 +- .../typeFromPropertyAssignment9_1.types.diff | 18 +-- ...iableDeclaredFunctionExpression.types.diff | 17 --- 91 files changed, 834 insertions(+), 1140 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.types.diff diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go index 892ab56b88..c795ad3d82 100644 --- a/internal/parser/reparser.go +++ b/internal/parser/reparser.go @@ -587,6 +587,10 @@ func getFunctionLikeHost(host *ast.Node) (*ast.Node, bool) { fun = host.Expression() } else if host.Kind == ast.KindReturnStatement { fun = host.Expression() + } else if host.Kind == ast.KindExpressionStatement { + if ast.IsBinaryExpression(host.Expression()) { + fun = host.Expression().AsBinaryExpression().Right + } } if ast.IsFunctionLike(fun) { return fun, true diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt deleted file mode 100644 index 9da858c20f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -index.js(9,34): error TS7006: Parameter 'options' implicitly has an 'any' type. - - -==== index.js (1 errors) ==== - /** - * @typedef Options - * @property {string} opt - */ - - /** - * @param {Options} options - */ - module.exports = function loader(options) {} - ~~~~~~~ -!!! error TS7006: Parameter 'options' implicitly has an 'any' type. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff deleted file mode 100644 index c67d7cf39f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt -+++ new.jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.js(9,34): error TS7006: Parameter 'options' implicitly has an 'any' type. -+ -+ -+==== index.js (1 errors) ==== -+ /** -+ * @typedef Options -+ * @property {string} opt -+ */ -+ -+ /** -+ * @param {Options} options -+ */ -+ module.exports = function loader(options) {} -+ ~~~~~~~ -+!!! error TS7006: Parameter 'options' implicitly has an 'any' type. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js index 8c549d99a2..02499abac7 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js @@ -32,5 +32,26 @@ module.exports = function loader(options) { }; export type Options = { opt: string; }; -declare const _default: (options: any) => void; +declare const _default: (options: Options) => void; export = _default; + + +//// [DtsFileErrors] + + +out/index.d.ts(9,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + +==== out/index.d.ts (1 errors) ==== + /** + * @typedef Options + * @property {string} opt + */ + export type Options = { + opt: string; + }; + declare const _default: (options: Options) => void; + export = _default; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js.diff index 271736f253..018318dba1 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js.diff @@ -17,5 +17,26 @@ +export type Options = { opt: string; }; -+declare const _default: (options: any) => void; -+export = _default; \ No newline at end of file ++declare const _default: (options: Options) => void; ++export = _default; ++ ++ ++//// [DtsFileErrors] ++ ++ ++out/index.d.ts(9,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++ ++ ++==== out/index.d.ts (1 errors) ==== ++ /** ++ * @typedef Options ++ * @property {string} opt ++ */ ++ export type Options = { ++ opt: string; ++ }; ++ declare const _default: (options: Options) => void; ++ export = _default; ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types index a781c3469e..c839ae735a 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types @@ -10,11 +10,11 @@ * @param {Options} options */ module.exports = function loader(options) {} ->module.exports = function loader(options) {} : (options: any) => void ->module.exports : (options: any) => void ->module : { "export=": (options: any) => void; } ->exports : (options: any) => void ->function loader(options) {} : (options: any) => void ->loader : (options: any) => void ->options : any +>module.exports = function loader(options) {} : (options: Options) => void +>module.exports : (options: Options) => void +>module : { "export=": (options: Options) => void; } +>exports : (options: Options) => void +>function loader(options) {} : (options: Options) => void +>loader : (options: Options) => void +>options : Options diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types.diff index 835c6a3144..284b64c94a 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types.diff @@ -1,20 +1,11 @@ --- old.jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types +++ new.jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types -@@= skipped -9, +9 lines =@@ - * @param {Options} options - */ +@@= skipped -11, +11 lines =@@ module.exports = function loader(options) {} -->module.exports = function loader(options) {} : (options: Options) => void -->module.exports : (options: Options) => void + >module.exports = function loader(options) {} : (options: Options) => void + >module.exports : (options: Options) => void ->module : { exports: (options: Options) => void; } -->exports : (options: Options) => void -->function loader(options) {} : (options: Options) => void -->loader : (options: Options) => void -->options : Options -+>module.exports = function loader(options) {} : (options: any) => void -+>module.exports : (options: any) => void -+>module : { "export=": (options: any) => void; } -+>exports : (options: any) => void -+>function loader(options) {} : (options: any) => void -+>loader : (options: any) => void -+>options : any ++>module : { "export=": (options: Options) => void; } + >exports : (options: Options) => void + >function loader(options) {} : (options: Options) => void + >loader : (options: Options) => void \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.errors.txt b/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.errors.txt index 51082100d2..dac9af49a5 100644 --- a/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.errors.txt @@ -1,13 +1,13 @@ -jsElementAccessNoContextualTypeCrash.js(2,1): error TS2322: Type '{ localize: (string: any) => any; } | {}' is not assignable to type '{ localize: (string: any) => any; }'. - Property 'localize' is missing in type '{}' but required in type '{ localize: (string: any) => any; }'. +jsElementAccessNoContextualTypeCrash.js(2,1): error TS2322: Type '{ localize: (string: string) => string; } | {}' is not assignable to type '{ localize: (string: string) => string; }'. + Property 'localize' is missing in type '{}' but required in type '{ localize: (string: string) => string; }'. ==== jsElementAccessNoContextualTypeCrash.js (1 errors) ==== var Common = {}; self['Common'] = self['Common'] || {}; ~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ localize: (string: any) => any; } | {}' is not assignable to type '{ localize: (string: any) => any; }'. -!!! error TS2322: Property 'localize' is missing in type '{}' but required in type '{ localize: (string: any) => any; }'. +!!! error TS2322: Type '{ localize: (string: string) => string; } | {}' is not assignable to type '{ localize: (string: string) => string; }'. +!!! error TS2322: Property 'localize' is missing in type '{}' but required in type '{ localize: (string: string) => string; }'. !!! related TS2728 jsElementAccessNoContextualTypeCrash.js:7:1: 'localize' is declared here. /** * @param {string} string diff --git a/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.errors.txt.diff index 9cc83c3f2b..001a66ef0f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.errors.txt.diff @@ -2,8 +2,8 @@ +++ new.jsElementAccessNoContextualTypeCrash.errors.txt @@= skipped -0, +0 lines =@@ -jsElementAccessNoContextualTypeCrash.js(2,1): error TS2741: Property 'localize' is missing in type '{}' but required in type 'typeof Common'. -+jsElementAccessNoContextualTypeCrash.js(2,1): error TS2322: Type '{ localize: (string: any) => any; } | {}' is not assignable to type '{ localize: (string: any) => any; }'. -+ Property 'localize' is missing in type '{}' but required in type '{ localize: (string: any) => any; }'. ++jsElementAccessNoContextualTypeCrash.js(2,1): error TS2322: Type '{ localize: (string: string) => string; } | {}' is not assignable to type '{ localize: (string: string) => string; }'. ++ Property 'localize' is missing in type '{}' but required in type '{ localize: (string: string) => string; }'. ==== jsElementAccessNoContextualTypeCrash.js (1 errors) ==== @@ -11,8 +11,8 @@ self['Common'] = self['Common'] || {}; ~~~~~~~~~~~~~~ -!!! error TS2741: Property 'localize' is missing in type '{}' but required in type 'typeof Common'. -+!!! error TS2322: Type '{ localize: (string: any) => any; } | {}' is not assignable to type '{ localize: (string: any) => any; }'. -+!!! error TS2322: Property 'localize' is missing in type '{}' but required in type '{ localize: (string: any) => any; }'. ++!!! error TS2322: Type '{ localize: (string: string) => string; } | {}' is not assignable to type '{ localize: (string: string) => string; }'. ++!!! error TS2322: Property 'localize' is missing in type '{}' but required in type '{ localize: (string: string) => string; }'. !!! related TS2728 jsElementAccessNoContextualTypeCrash.js:7:1: 'localize' is declared here. /** * @param {string} string \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.types b/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.types index d1bc8f8328..5c6be51a7f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.types +++ b/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.types @@ -2,16 +2,16 @@ === jsElementAccessNoContextualTypeCrash.js === var Common = {}; ->Common : { localize: (string: any) => any; } ->{} : { localize: (string: any) => any; } +>Common : { localize: (string: string) => string; } +>{} : { localize: (string: string) => string; } self['Common'] = self['Common'] || {}; ->self['Common'] = self['Common'] || {} : { localize: (string: any) => any; } | {} ->self['Common'] : { localize: (string: any) => any; } +>self['Common'] = self['Common'] || {} : { localize: (string: string) => string; } | {} +>self['Common'] : { localize: (string: string) => string; } >self : Window & typeof globalThis >'Common' : "Common" ->self['Common'] || {} : { localize: (string: any) => any; } | {} ->self['Common'] : { localize: (string: any) => any; } +>self['Common'] || {} : { localize: (string: string) => string; } | {} +>self['Common'] : { localize: (string: string) => string; } >self : Window & typeof globalThis >'Common' : "Common" >{} : {} @@ -21,14 +21,14 @@ self['Common'] = self['Common'] || {}; * @return {string} */ Common.localize = function (string) { ->Common.localize = function (string) { return string;} : (string: any) => any ->Common.localize : (string: any) => any ->Common : { localize: (string: any) => any; } ->localize : (string: any) => any ->function (string) { return string;} : (string: any) => any ->string : any +>Common.localize = function (string) { return string;} : (string: string) => string +>Common.localize : (string: string) => string +>Common : { localize: (string: string) => string; } +>localize : (string: string) => string +>function (string) { return string;} : (string: string) => string +>string : string return string; ->string : any +>string : string }; diff --git a/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.types.diff b/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.types.diff index 90e6e551d7..5c55fbecf8 100644 --- a/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.types.diff +++ b/testdata/baselines/reference/submodule/compiler/jsElementAccessNoContextualTypeCrash.types.diff @@ -6,42 +6,29 @@ var Common = {}; ->Common : typeof Common ->{} : {} -+>Common : { localize: (string: any) => any; } -+>{} : { localize: (string: any) => any; } ++>Common : { localize: (string: string) => string; } ++>{} : { localize: (string: string) => string; } self['Common'] = self['Common'] || {}; ->self['Common'] = self['Common'] || {} : {} ->self['Common'] : typeof Common -+>self['Common'] = self['Common'] || {} : { localize: (string: any) => any; } | {} -+>self['Common'] : { localize: (string: any) => any; } ++>self['Common'] = self['Common'] || {} : { localize: (string: string) => string; } | {} ++>self['Common'] : { localize: (string: string) => string; } >self : Window & typeof globalThis >'Common' : "Common" ->self['Common'] || {} : {} ->self['Common'] : typeof Common -+>self['Common'] || {} : { localize: (string: any) => any; } | {} -+>self['Common'] : { localize: (string: any) => any; } ++>self['Common'] || {} : { localize: (string: string) => string; } | {} ++>self['Common'] : { localize: (string: string) => string; } >self : Window & typeof globalThis >'Common' : "Common" >{} : {} -@@= skipped -19, +19 lines =@@ - * @return {string} - */ +@@= skipped -21, +21 lines =@@ Common.localize = function (string) { -->Common.localize = function (string) { return string;} : (string: string) => string -->Common.localize : (string: string) => string + >Common.localize = function (string) { return string;} : (string: string) => string + >Common.localize : (string: string) => string ->Common : typeof Common -->localize : (string: string) => string -->function (string) { return string;} : (string: string) => string -->string : string -+>Common.localize = function (string) { return string;} : (string: any) => any -+>Common.localize : (string: any) => any -+>Common : { localize: (string: any) => any; } -+>localize : (string: any) => any -+>function (string) { return string;} : (string: any) => any -+>string : any - - return string; -->string : string -+>string : any - - }; \ No newline at end of file ++>Common : { localize: (string: string) => string; } + >localize : (string: string) => string + >function (string) { return string;} : (string: string) => string + >string : string \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads4.types b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads4.types index f5e4e23f89..da9d594ec0 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads4.types +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads4.types @@ -23,13 +23,13 @@ export function Foo() { } * @return {void} */ Foo.prototype.bar = function (a, b) { } ->Foo.prototype.bar = function (a, b) { } : (a: any, b: any) => void +>Foo.prototype.bar = function (a, b) { } : (a: string | number, b?: string) => void >Foo.prototype.bar : any >Foo.prototype : any >Foo : () => void >prototype : any >bar : any ->function (a, b) { } : (a: any, b: any) => void ->a : any ->b : any +>function (a, b) { } : (a: string | number, b?: string) => void +>a : string | number +>b : string diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads4.types.diff b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads4.types.diff index 65bb97d4fa..6a989b006f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads4.types.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads4.types.diff @@ -14,7 +14,7 @@ */ Foo.prototype.bar = function (a, b) { } ->Foo.prototype.bar = function (a, b) { } : { (a: string): void; (a: number, b: string): void; } -+>Foo.prototype.bar = function (a, b) { } : (a: any, b: any) => void ++>Foo.prototype.bar = function (a, b) { } : (a: string | number, b?: string) => void >Foo.prototype.bar : any >Foo.prototype : any ->Foo : typeof Foo @@ -22,8 +22,6 @@ >prototype : any >bar : any ->function (a, b) { } : { (a: string): void; (a: number, b: string): void; } -->a : string | number -->b : string -+>function (a, b) { } : (a: any, b: any) => void -+>a : any -+>b : any ++>function (a, b) { } : (a: string | number, b?: string) => void + >a : string | number + >b : string diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types b/testdata/baselines/reference/submodule/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types index 56bcad7bfb..e149c29640 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types @@ -20,11 +20,11 @@ var y; * @param {boolean!} b */ y = function bar(b) {} ->y = function bar(b) {} : (b: any) => void +>y = function bar(b) {} : (b: boolean) => void >y : any ->function bar(b) {} : (b: any) => void ->bar : (b: any) => void ->b : any +>function bar(b) {} : (b: boolean) => void +>bar : (b: boolean) => void +>b : boolean /** * @param {string} s diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt index 41f712b4c4..ad368a8d07 100644 --- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt @@ -1,4 +1,5 @@ -first.js(21,19): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. +first.js(8,13): error TS2749: 'Wagon' refers to a value, but is being used as a type here. Did you mean 'typeof Wagon'? +first.js(21,19): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }' is not a constructor function type. first.js(44,4): error TS2339: Property 'numberOxen' does not exist on type 'Sql'. first.js(47,24): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. generic.js(9,23): error TS2507: Type '(flavour: T) => void' is not a constructor function type. @@ -7,11 +8,11 @@ generic.js(17,27): error TS2554: Expected 0 arguments, but got 1. generic.js(18,9): error TS2339: Property 'flavour' does not exist on type 'Chowder'. generic.js(20,32): error TS2554: Expected 0 arguments, but got 1. second.ts(8,25): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. -second.ts(14,25): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. +second.ts(14,25): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }' is not a constructor function type. second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Conestoga'. -==== first.js (3 errors) ==== +==== first.js (4 errors) ==== /** * @constructor * @param {number} numberOxen @@ -20,6 +21,8 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con this.numberOxen = numberOxen } /** @param {Wagon[]=} wagons */ + ~~~~~ +!!! error TS2749: 'Wagon' refers to a value, but is being used as a type here. Did you mean 'typeof Wagon'? Wagon.circle = function (wagons) { return wagons ? wagons.length : 3.14; } @@ -34,7 +37,7 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con // ok class Sql extends Wagon { ~~~~~ -!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. +!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }' is not a constructor function type. constructor() { super(); // error: not enough arguments this.foonly = 12 @@ -86,7 +89,7 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con // ok class Conestoga extends Wagon { ~~~~~ -!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. +!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }' is not a constructor function type. constructor(public drunkOO: true) { // error: wrong type super('nope'); diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt.diff index cb9d8268fe..f2648e97f4 100644 --- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt.diff @@ -5,7 +5,8 @@ -first.js(31,5): error TS2416: Property 'load' in type 'Sql' is not assignable to the same property in base type 'Wagon'. - Type '(files: string[], format: "csv" | "json" | "xmlolololol") => void' is not assignable to type '(supplies?: any[]) => void'. - Target signature provides too few arguments. Expected 2 or more, but got 1. -+first.js(21,19): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. ++first.js(8,13): error TS2749: 'Wagon' refers to a value, but is being used as a type here. Did you mean 'typeof Wagon'? ++first.js(21,19): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }' is not a constructor function type. +first.js(44,4): error TS2339: Property 'numberOxen' does not exist on type 'Sql'. first.js(47,24): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. -generic.js(19,19): error TS2554: Expected 1 arguments, but got 0. @@ -23,17 +24,32 @@ - Type 'Wagon[]' is not assignable to type '(typeof Wagon)[]'. - Property 'circle' is missing in type 'Wagon' but required in type 'typeof Wagon'. -second.ts(17,15): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -+second.ts(14,25): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. +- +- +-==== first.js (3 errors) ==== ++second.ts(14,25): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }' is not a constructor function type. +second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Conestoga'. - - - ==== first.js (3 errors) ==== -@@= skipped -36, +32 lines =@@ ++ ++ ++==== first.js (4 errors) ==== + /** + * @constructor + * @param {number} numberOxen +@@= skipped -23, +20 lines =@@ + this.numberOxen = numberOxen + } + /** @param {Wagon[]=} wagons */ ++ ~~~~~ ++!!! error TS2749: 'Wagon' refers to a value, but is being used as a type here. Did you mean 'typeof Wagon'? + Wagon.circle = function (wagons) { + return wagons ? wagons.length : 3.14; + } +@@= skipped -13, +15 lines =@@ } // ok class Sql extends Wagon { + ~~~~~ -+!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. ++!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }' is not a constructor function type. constructor() { super(); // error: not enough arguments - ~~~~~ @@ -75,7 +91,7 @@ -!!! error TS2417: Property 'circle' is missing in type 'Wagon' but required in type 'typeof Wagon'. -!!! related TS2728 first.js:9:1: 'circle' is declared here. + ~~~~~ -+!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. ++!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }' is not a constructor function type. constructor(public drunkOO: true) { // error: wrong type super('nope'); diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.symbols b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.symbols index 811656ee41..22eb39e195 100644 --- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.symbols +++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.symbols @@ -21,7 +21,9 @@ Wagon.circle = function (wagons) { return wagons ? wagons.length : 3.14; >wagons : Symbol(wagons, Decl(first.js, 8, 25)) +>wagons.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) >wagons : Symbol(wagons, Decl(first.js, 8, 25)) +>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) } /** @param {*[]=} supplies - *[]= is my favourite type */ Wagon.prototype.load = function (supplies) { @@ -37,7 +39,9 @@ Wagon.prototype.weight = supplies => supplies ? supplies.length : -1 >prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) >supplies : Symbol(supplies, Decl(first.js, 15, 24)) >supplies : Symbol(supplies, Decl(first.js, 15, 24)) +>supplies.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) >supplies : Symbol(supplies, Decl(first.js, 15, 24)) +>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) Wagon.prototype.speed = function () { >Wagon.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.symbols.diff b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.symbols.diff index 6ef5dde33f..38cbfbdf73 100644 --- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.symbols.diff @@ -22,11 +22,7 @@ >circle : Symbol(Wagon.circle, Decl(first.js, 6, 1)) >wagons : Symbol(wagons, Decl(first.js, 8, 25)) - return wagons ? wagons.length : 3.14; - >wagons : Symbol(wagons, Decl(first.js, 8, 25)) -->wagons.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) - >wagons : Symbol(wagons, Decl(first.js, 8, 25)) -->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) +@@= skipped -24, +21 lines =@@ } /** @param {*[]=} supplies - *[]= is my favourite type */ Wagon.prototype.load = function (supplies) { @@ -46,14 +42,11 @@ +>Wagon : Symbol(Wagon, Decl(first.js, 0, 0)) >prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->weight : Symbol(Wagon.weight, Decl(first.js, 13, 1)) -->supplies : Symbol(supplies, Decl(first.js, 15, 24)) -->supplies : Symbol(supplies, Decl(first.js, 15, 24)) -->supplies.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) -->supplies : Symbol(supplies, Decl(first.js, 15, 24)) -->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) -+>supplies : Symbol(supplies, Decl(first.js, 15, 24)) -+>supplies : Symbol(supplies, Decl(first.js, 15, 24)) -+>supplies : Symbol(supplies, Decl(first.js, 15, 24)) + >supplies : Symbol(supplies, Decl(first.js, 15, 24)) + >supplies : Symbol(supplies, Decl(first.js, 15, 24)) + >supplies.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) +@@= skipped -19, +17 lines =@@ + >length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) Wagon.prototype.speed = function () { ->Wagon.prototype : Symbol(Wagon.speed, Decl(first.js, 15, 68)) @@ -84,7 +77,7 @@ this.foonly = 12 >this.foonly : Symbol(Sql.foonly, Decl(first.js, 22, 16)) >this : Symbol(Sql, Decl(first.js, 18, 1)) -@@= skipped -88, +70 lines =@@ +@@= skipped -45, +36 lines =@@ } else { super.speed() // run faster diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types index 1d3bcb67ae..8fe647e328 100644 --- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types +++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types @@ -6,7 +6,7 @@ * @param {number} numberOxen */ function Wagon(numberOxen) { ->Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } +>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } >numberOxen : number this.numberOxen = numberOxen @@ -18,47 +18,47 @@ function Wagon(numberOxen) { } /** @param {Wagon[]=} wagons */ Wagon.circle = function (wagons) { ->Wagon.circle = function (wagons) { return wagons ? wagons.length : 3.14;} : (wagons: any) => any ->Wagon.circle : (wagons: any) => any ->Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } ->circle : (wagons: any) => any ->function (wagons) { return wagons ? wagons.length : 3.14;} : (wagons: any) => any ->wagons : any +>Wagon.circle = function (wagons) { return wagons ? wagons.length : 3.14;} : (wagons?: Wagon[]) => number +>Wagon.circle : (wagons?: Wagon[]) => number +>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } +>circle : (wagons?: Wagon[]) => number +>function (wagons) { return wagons ? wagons.length : 3.14;} : (wagons?: Wagon[]) => number +>wagons : Wagon[] return wagons ? wagons.length : 3.14; ->wagons ? wagons.length : 3.14 : any ->wagons : any ->wagons.length : any ->wagons : any ->length : any +>wagons ? wagons.length : 3.14 : number +>wagons : Wagon[] +>wagons.length : number +>wagons : Wagon[] +>length : number >3.14 : 3.14 } /** @param {*[]=} supplies - *[]= is my favourite type */ Wagon.prototype.load = function (supplies) { ->Wagon.prototype.load = function (supplies) {} : (supplies: any) => void +>Wagon.prototype.load = function (supplies) {} : (supplies?: any[]) => void >Wagon.prototype.load : any >Wagon.prototype : any ->Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } +>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } >prototype : any >load : any ->function (supplies) {} : (supplies: any) => void ->supplies : any +>function (supplies) {} : (supplies?: any[]) => void +>supplies : any[] } /** @param {*[]=} supplies - Yep, still a great type */ Wagon.prototype.weight = supplies => supplies ? supplies.length : -1 ->Wagon.prototype.weight = supplies => supplies ? supplies.length : -1 : (supplies: any) => any +>Wagon.prototype.weight = supplies => supplies ? supplies.length : -1 : (supplies?: any[]) => number >Wagon.prototype.weight : any >Wagon.prototype : any ->Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } +>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } >prototype : any >weight : any ->supplies => supplies ? supplies.length : -1 : (supplies: any) => any ->supplies : any ->supplies ? supplies.length : -1 : any ->supplies : any ->supplies.length : any ->supplies : any ->length : any +>supplies => supplies ? supplies.length : -1 : (supplies?: any[]) => number +>supplies : any[] +>supplies ? supplies.length : -1 : number +>supplies : any[] +>supplies.length : number +>supplies : any[] +>length : number >-1 : -1 >1 : 1 @@ -66,7 +66,7 @@ Wagon.prototype.speed = function () { >Wagon.prototype.speed = function () { return this.numberOxen / this.weight()} : () => number >Wagon.prototype.speed : any >Wagon.prototype : any ->Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } +>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } >prototype : any >speed : any >function () { return this.numberOxen / this.weight()} : () => number @@ -84,7 +84,7 @@ Wagon.prototype.speed = function () { // ok class Sql extends Wagon { >Sql : Sql ->Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } +>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } constructor() { super(); // error: not enough arguments @@ -188,7 +188,7 @@ class Firedrake extends Dragon { // ok class Conestoga extends Wagon { >Conestoga : Conestoga ->Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } +>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } constructor(public drunkOO: true) { >drunkOO : true @@ -202,13 +202,13 @@ class Conestoga extends Wagon { } // should error since others is not optional static circle(others: (typeof Wagon)[]) { ->circle : (others: { (numberOxen: number): void; circle: (wagons: any) => any; }[]) => number ->others : { (numberOxen: number): void; circle: (wagons: any) => any; }[] ->Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } +>circle : (others: { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }[]) => number +>others : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }[] +>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } return others.length >others.length : number ->others : { (numberOxen: number): void; circle: (wagons: any) => any; }[] +>others : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }[] >length : number } } diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types.diff b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types.diff index 0b363ed230..a9feb81fc8 100644 --- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types.diff +++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types.diff @@ -5,7 +5,7 @@ */ function Wagon(numberOxen) { ->Wagon : typeof Wagon -+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } ++>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } >numberOxen : number this.numberOxen = numberOxen @@ -23,75 +23,51 @@ ->Wagon : typeof Wagon ->circle : (wagons?: Wagon[] | undefined) => number ->function (wagons) { return wagons ? wagons.length : 3.14;} : (wagons?: Wagon[] | undefined) => number -->wagons : Wagon[] -+>Wagon.circle = function (wagons) { return wagons ? wagons.length : 3.14;} : (wagons: any) => any -+>Wagon.circle : (wagons: any) => any -+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } -+>circle : (wagons: any) => any -+>function (wagons) { return wagons ? wagons.length : 3.14;} : (wagons: any) => any -+>wagons : any ++>Wagon.circle = function (wagons) { return wagons ? wagons.length : 3.14;} : (wagons?: Wagon[]) => number ++>Wagon.circle : (wagons?: Wagon[]) => number ++>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } ++>circle : (wagons?: Wagon[]) => number ++>function (wagons) { return wagons ? wagons.length : 3.14;} : (wagons?: Wagon[]) => number + >wagons : Wagon[] return wagons ? wagons.length : 3.14; -->wagons ? wagons.length : 3.14 : number -->wagons : Wagon[] -->wagons.length : number -->wagons : Wagon[] -->length : number -+>wagons ? wagons.length : 3.14 : any -+>wagons : any -+>wagons.length : any -+>wagons : any -+>length : any - >3.14 : 3.14 +@@= skipped -29, +29 lines =@@ } /** @param {*[]=} supplies - *[]= is my favourite type */ Wagon.prototype.load = function (supplies) { ->Wagon.prototype.load = function (supplies) {} : (supplies?: any[] | undefined) => void -+>Wagon.prototype.load = function (supplies) {} : (supplies: any) => void ++>Wagon.prototype.load = function (supplies) {} : (supplies?: any[]) => void >Wagon.prototype.load : any >Wagon.prototype : any ->Wagon : typeof Wagon -+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } ++>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } >prototype : any >load : any ->function (supplies) {} : (supplies?: any[] | undefined) => void -->supplies : any[] -+>function (supplies) {} : (supplies: any) => void -+>supplies : any ++>function (supplies) {} : (supplies?: any[]) => void + >supplies : any[] } /** @param {*[]=} supplies - Yep, still a great type */ Wagon.prototype.weight = supplies => supplies ? supplies.length : -1 ->Wagon.prototype.weight = supplies => supplies ? supplies.length : -1 : (supplies?: any[] | undefined) => number -+>Wagon.prototype.weight = supplies => supplies ? supplies.length : -1 : (supplies: any) => any ++>Wagon.prototype.weight = supplies => supplies ? supplies.length : -1 : (supplies?: any[]) => number >Wagon.prototype.weight : any >Wagon.prototype : any ->Wagon : typeof Wagon -+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } ++>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } >prototype : any >weight : any ->supplies => supplies ? supplies.length : -1 : (supplies?: any[] | undefined) => number -->supplies : any[] -->supplies ? supplies.length : -1 : number -->supplies : any[] -->supplies.length : number -->supplies : any[] -->length : number -+>supplies => supplies ? supplies.length : -1 : (supplies: any) => any -+>supplies : any -+>supplies ? supplies.length : -1 : any -+>supplies : any -+>supplies.length : any -+>supplies : any -+>length : any - >-1 : -1 - >1 : 1 - -@@= skipped -60, +60 lines =@@ ++>supplies => supplies ? supplies.length : -1 : (supplies?: any[]) => number + >supplies : any[] + >supplies ? supplies.length : -1 : number + >supplies : any[] +@@= skipped -31, +31 lines =@@ >Wagon.prototype.speed = function () { return this.numberOxen / this.weight()} : () => number >Wagon.prototype.speed : any >Wagon.prototype : any ->Wagon : typeof Wagon -+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } ++>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } >prototype : any >speed : any >function () { return this.numberOxen / this.weight()} : () => number @@ -117,7 +93,7 @@ class Sql extends Wagon { >Sql : Sql ->Wagon : Wagon -+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } ++>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } constructor() { super(); // error: not enough arguments @@ -179,7 +155,7 @@ class Conestoga extends Wagon { >Conestoga : Conestoga ->Wagon : Wagon -+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } ++>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } constructor(public drunkOO: true) { >drunkOO : true @@ -196,14 +172,14 @@ ->circle : (others: (typeof Wagon)[]) => number ->others : (typeof Wagon)[] ->Wagon : typeof Wagon -+>circle : (others: { (numberOxen: number): void; circle: (wagons: any) => any; }[]) => number -+>others : { (numberOxen: number): void; circle: (wagons: any) => any; }[] -+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } ++>circle : (others: { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }[]) => number ++>others : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }[] ++>Wagon : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; } return others.length >others.length : number ->others : (typeof Wagon)[] -+>others : { (numberOxen: number): void; circle: (wagons: any) => any; }[] ++>others : { (numberOxen: number): void; circle: (wagons?: Wagon[]) => number; }[] >length : number } } diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt index 051cf5113e..7215a8d53f 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt @@ -1,8 +1,9 @@ +constructorFunctionMethodTypeParameters.js(11,12): error TS2304: Cannot find name 'T'. constructorFunctionMethodTypeParameters.js(22,16): error TS2304: Cannot find name 'T'. constructorFunctionMethodTypeParameters.js(24,17): error TS2304: Cannot find name 'T'. -==== constructorFunctionMethodTypeParameters.js (2 errors) ==== +==== constructorFunctionMethodTypeParameters.js (3 errors) ==== /** * @template {string} T * @param {T} t @@ -14,6 +15,8 @@ constructorFunctionMethodTypeParameters.js(24,17): error TS2304: Cannot find nam /** * @template {string} V * @param {T} t + ~ +!!! error TS2304: Cannot find name 'T'. * @param {V} v * @return {V} */ diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff index 0ba61e4376..0496d0169a 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff @@ -2,11 +2,12 @@ +++ new.constructorFunctionMethodTypeParameters.errors.txt @@= skipped -0, +0 lines =@@ - ++constructorFunctionMethodTypeParameters.js(11,12): error TS2304: Cannot find name 'T'. +constructorFunctionMethodTypeParameters.js(22,16): error TS2304: Cannot find name 'T'. +constructorFunctionMethodTypeParameters.js(24,17): error TS2304: Cannot find name 'T'. + + -+==== constructorFunctionMethodTypeParameters.js (2 errors) ==== ++==== constructorFunctionMethodTypeParameters.js (3 errors) ==== + /** + * @template {string} T + * @param {T} t @@ -18,6 +19,8 @@ + /** + * @template {string} V + * @param {T} t ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @param {V} v + * @return {V} + */ diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types index 3c44273775..6827bb6534 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types @@ -24,18 +24,18 @@ function Cls(t) { * @return {V} */ Cls.prototype.topLevelComment = function (t, v) { ->Cls.prototype.topLevelComment = function (t, v) { return v} : (t: any, v: any) => any +>Cls.prototype.topLevelComment = function (t, v) { return v} : (t: T, v: V) => V >Cls.prototype.topLevelComment : any >Cls.prototype : any >Cls : (t: T) => void >prototype : any >topLevelComment : any ->function (t, v) { return v} : (t: any, v: any) => any ->t : any ->v : any +>function (t, v) { return v} : (t: T, v: V) => V +>t : T +>v : V return v ->v : any +>v : V }; diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types.diff b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types.diff index 5e7a9a8310..11b501bf66 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types.diff +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types.diff @@ -16,32 +16,16 @@ >t : any >t : T } -@@= skipped -18, +18 lines =@@ - * @return {V} - */ - Cls.prototype.topLevelComment = function (t, v) { -->Cls.prototype.topLevelComment = function (t, v) { return v} : (t: T, v: V) => V -+>Cls.prototype.topLevelComment = function (t, v) { return v} : (t: any, v: any) => any +@@= skipped -21, +21 lines =@@ + >Cls.prototype.topLevelComment = function (t, v) { return v} : (t: T, v: V) => V >Cls.prototype.topLevelComment : any >Cls.prototype : any ->Cls : typeof Cls +>Cls : (t: T) => void >prototype : any >topLevelComment : any -->function (t, v) { return v} : (t: T, v: V) => V -->t : T -->v : V -+>function (t, v) { return v} : (t: any, v: any) => any -+>t : any -+>v : any - - return v -->v : V -+>v : any - - }; - -@@= skipped -19, +19 lines =@@ + >function (t, v) { return v} : (t: T, v: V) => V +@@= skipped -16, +16 lines =@@ >Cls.prototype.nestedComment = /** * @template {string} U * @param {T} t * @param {U} u * @return {T} */ function (t, u) { return t } : (t: T, u: U) => T >Cls.prototype.nestedComment : any >Cls.prototype : any diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctions3.errors.txt b/testdata/baselines/reference/submodule/conformance/constructorFunctions3.errors.txt index 0d32deb717..03faa3f400 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctions3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctions3.errors.txt @@ -1,11 +1,9 @@ a.js(4,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. a.js(12,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -a.js(23,28): error TS7006: Parameter 'n' implicitly has an 'any' type. -a.js(27,18): error TS7006: Parameter 'm' implicitly has an 'any' type. a.js(30,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -==== a.js (5 errors) ==== +==== a.js (3 errors) ==== function Instance() { this.i = 'simple' } @@ -33,14 +31,10 @@ a.js(30,9): error TS7009: 'new' expression, whose target lacks a construct signa } /** @param {number} n */ A.prototype.z = function f(n) { - ~ -!!! error TS7006: Parameter 'n' implicitly has an 'any' type. return n + this.x } /** @param {number} m */ A.t = function g(m) { - ~ -!!! error TS7006: Parameter 'm' implicitly has an 'any' type. return m + 1 } var a = new A() diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctions3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/constructorFunctions3.errors.txt.diff index 04d8a248ca..ac72e5dcd7 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctions3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctions3.errors.txt.diff @@ -4,12 +4,10 @@ - +a.js(4,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. +a.js(12,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -+a.js(23,28): error TS7006: Parameter 'n' implicitly has an 'any' type. -+a.js(27,18): error TS7006: Parameter 'm' implicitly has an 'any' type. +a.js(30,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. + + -+==== a.js (5 errors) ==== ++==== a.js (3 errors) ==== + function Instance() { + this.i = 'simple' + } @@ -37,14 +35,10 @@ + } + /** @param {number} n */ + A.prototype.z = function f(n) { -+ ~ -+!!! error TS7006: Parameter 'n' implicitly has an 'any' type. + return n + this.x + } + /** @param {number} m */ + A.t = function g(m) { -+ ~ -+!!! error TS7006: Parameter 'm' implicitly has an 'any' type. + return m + 1 + } + var a = new A() diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctions3.types b/testdata/baselines/reference/submodule/conformance/constructorFunctions3.types index 62fe215033..d6148ae416 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctions3.types +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctions3.types @@ -52,7 +52,7 @@ StaticToo; // Both! function A () { ->A : { (): void; t: (m: any) => any; } +>A : { (): void; t: (m: number) => number; } this.x = 1 >this.x = 1 : 1 @@ -71,42 +71,42 @@ function A () { } /** @param {number} n */ A.prototype.z = function f(n) { ->A.prototype.z = function f(n) { return n + this.x} : (n: any) => any +>A.prototype.z = function f(n) { return n + this.x} : (n: number) => any >A.prototype.z : any >A.prototype : any ->A : { (): void; t: (m: any) => any; } +>A : { (): void; t: (m: number) => number; } >prototype : any >z : any ->function f(n) { return n + this.x} : (n: any) => any ->f : (n: any) => any ->n : any +>function f(n) { return n + this.x} : (n: number) => any +>f : (n: number) => any +>n : number return n + this.x >n + this.x : any ->n : any +>n : number >this.x : any >this : any >x : any } /** @param {number} m */ A.t = function g(m) { ->A.t = function g(m) { return m + 1} : (m: any) => any ->A.t : (m: any) => any ->A : { (): void; t: (m: any) => any; } ->t : (m: any) => any ->function g(m) { return m + 1} : (m: any) => any ->g : (m: any) => any ->m : any +>A.t = function g(m) { return m + 1} : (m: number) => number +>A.t : (m: number) => number +>A : { (): void; t: (m: number) => number; } +>t : (m: number) => number +>function g(m) { return m + 1} : (m: number) => number +>g : (m: number) => number +>m : number return m + 1 ->m + 1 : any ->m : any +>m + 1 : number +>m : number >1 : 1 } var a = new A() >a : any >new A() : any ->A : { (): void; t: (m: any) => any; } +>A : { (): void; t: (m: number) => number; } a.z(3) >a.z(3) : any @@ -116,10 +116,10 @@ a.z(3) >3 : 3 A.t(2) ->A.t(2) : any ->A.t : (m: any) => any ->A : { (): void; t: (m: any) => any; } ->t : (m: any) => any +>A.t(2) : number +>A.t : (m: number) => number +>A : { (): void; t: (m: number) => number; } +>t : (m: number) => number >2 : 2 a.second = 1 diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctions3.types.diff b/testdata/baselines/reference/submodule/conformance/constructorFunctions3.types.diff index 595be4cec1..e9763e9e00 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctions3.types.diff +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctions3.types.diff @@ -70,7 +70,7 @@ // Both! function A () { ->A : typeof A -+>A : { (): void; t: (m: any) => any; } ++>A : { (): void; t: (m: number) => number; } this.x = 1 >this.x = 1 : 1 @@ -94,54 +94,40 @@ /** @param {number} n */ A.prototype.z = function f(n) { ->A.prototype.z = function f(n) { return n + this.x} : (n: number) => number -+>A.prototype.z = function f(n) { return n + this.x} : (n: any) => any ++>A.prototype.z = function f(n) { return n + this.x} : (n: number) => any >A.prototype.z : any >A.prototype : any ->A : typeof A -+>A : { (): void; t: (m: any) => any; } ++>A : { (): void; t: (m: number) => number; } >prototype : any >z : any ->function f(n) { return n + this.x} : (n: number) => number ->f : (n: number) => number -->n : number -+>function f(n) { return n + this.x} : (n: any) => any -+>f : (n: any) => any -+>n : any ++>function f(n) { return n + this.x} : (n: number) => any ++>f : (n: number) => any + >n : number return n + this.x ->n + this.x : number -->n : number ++>n + this.x : any + >n : number ->this.x : number ->this : this ->x : number -+>n + this.x : any -+>n : any +>this.x : any +>this : any +>x : any } /** @param {number} m */ A.t = function g(m) { -->A.t = function g(m) { return m + 1} : (m: number) => number -->A.t : (m: number) => number + >A.t = function g(m) { return m + 1} : (m: number) => number + >A.t : (m: number) => number ->A : typeof A -->t : (m: number) => number -->function g(m) { return m + 1} : (m: number) => number -->g : (m: number) => number -->m : number -+>A.t = function g(m) { return m + 1} : (m: any) => any -+>A.t : (m: any) => any -+>A : { (): void; t: (m: any) => any; } -+>t : (m: any) => any -+>function g(m) { return m + 1} : (m: any) => any -+>g : (m: any) => any -+>m : any - - return m + 1 -->m + 1 : number -->m : number -+>m + 1 : any -+>m : any ++>A : { (): void; t: (m: number) => number; } + >t : (m: number) => number + >function g(m) { return m + 1} : (m: number) => number + >g : (m: number) => number +@@= skipped -102, +102 lines =@@ >1 : 1 } var a = new A() @@ -150,7 +136,7 @@ ->A : typeof A +>a : any +>new A() : any -+>A : { (): void; t: (m: any) => any; } ++>A : { (): void; t: (m: number) => number; } a.z(3) ->a.z(3) : number @@ -164,14 +150,11 @@ >3 : 3 A.t(2) -->A.t(2) : number -->A.t : (m: number) => number + >A.t(2) : number + >A.t : (m: number) => number ->A : typeof A -->t : (m: number) => number -+>A.t(2) : any -+>A.t : (m: any) => any -+>A : { (): void; t: (m: any) => any; } -+>t : (m: any) => any ++>A : { (): void; t: (m: number) => number; } + >t : (m: number) => number >2 : 2 a.second = 1 diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt index 57d5ec44df..5e56632f6e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt @@ -1,17 +1,7 @@ -jsDeclarationsClassMethod.js(8,27): error TS7006: Parameter 'x' implicitly has an 'any' type. -jsDeclarationsClassMethod.js(8,30): error TS7006: Parameter 'y' implicitly has an 'any' type. -jsDeclarationsClassMethod.js(19,33): error TS7006: Parameter 'x' implicitly has an 'any' type. -jsDeclarationsClassMethod.js(19,36): error TS7006: Parameter 'y' implicitly has an 'any' type. -jsDeclarationsClassMethod.js(29,27): error TS7006: Parameter 'x' implicitly has an 'any' type. -jsDeclarationsClassMethod.js(29,30): error TS7006: Parameter 'y' implicitly has an 'any' type. jsDeclarationsClassMethod.js(51,14): error TS2551: Property 'method2' does not exist on type 'C2'. Did you mean 'method1'? -jsDeclarationsClassMethod.js(51,34): error TS7006: Parameter 'x' implicitly has an 'any' type. -jsDeclarationsClassMethod.js(51,37): error TS7006: Parameter 'y' implicitly has an 'any' type. -jsDeclarationsClassMethod.js(61,27): error TS7006: Parameter 'x' implicitly has an 'any' type. -jsDeclarationsClassMethod.js(61,30): error TS7006: Parameter 'y' implicitly has an 'any' type. -==== jsDeclarationsClassMethod.js (11 errors) ==== +==== jsDeclarationsClassMethod.js (1 errors) ==== function C1() { /** * A comment prop @@ -20,10 +10,6 @@ jsDeclarationsClassMethod.js(61,30): error TS7006: Parameter 'y' implicitly has * @returns {number} */ this.prop = function (x, y) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'y' implicitly has an 'any' type. return x + y; } } @@ -35,10 +21,6 @@ jsDeclarationsClassMethod.js(61,30): error TS7006: Parameter 'y' implicitly has * @returns {number} */ C1.prototype.method = function (x, y) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'y' implicitly has an 'any' type. return x + y; } @@ -49,10 +31,6 @@ jsDeclarationsClassMethod.js(61,30): error TS7006: Parameter 'y' implicitly has * @returns {number} */ C1.staticProp = function (x, y) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'y' implicitly has an 'any' type. return x + y; } @@ -78,10 +56,6 @@ jsDeclarationsClassMethod.js(61,30): error TS7006: Parameter 'y' implicitly has ~~~~~~~ !!! error TS2551: Property 'method2' does not exist on type 'C2'. Did you mean 'method1'? !!! related TS2728 jsDeclarationsClassMethod.js:40:5: 'method1' is declared here. - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'y' implicitly has an 'any' type. return x + y; } @@ -92,10 +66,6 @@ jsDeclarationsClassMethod.js(61,30): error TS7006: Parameter 'y' implicitly has * @returns {number} */ C2.staticProp = function (x, y) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'y' implicitly has an 'any' type. return x + y; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt.diff index 47035117e1..7b3da0cb35 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt.diff @@ -2,20 +2,10 @@ +++ new.jsDeclarationsClassMethod.errors.txt @@= skipped -0, +0 lines =@@ - -+jsDeclarationsClassMethod.js(8,27): error TS7006: Parameter 'x' implicitly has an 'any' type. -+jsDeclarationsClassMethod.js(8,30): error TS7006: Parameter 'y' implicitly has an 'any' type. -+jsDeclarationsClassMethod.js(19,33): error TS7006: Parameter 'x' implicitly has an 'any' type. -+jsDeclarationsClassMethod.js(19,36): error TS7006: Parameter 'y' implicitly has an 'any' type. -+jsDeclarationsClassMethod.js(29,27): error TS7006: Parameter 'x' implicitly has an 'any' type. -+jsDeclarationsClassMethod.js(29,30): error TS7006: Parameter 'y' implicitly has an 'any' type. +jsDeclarationsClassMethod.js(51,14): error TS2551: Property 'method2' does not exist on type 'C2'. Did you mean 'method1'? -+jsDeclarationsClassMethod.js(51,34): error TS7006: Parameter 'x' implicitly has an 'any' type. -+jsDeclarationsClassMethod.js(51,37): error TS7006: Parameter 'y' implicitly has an 'any' type. -+jsDeclarationsClassMethod.js(61,27): error TS7006: Parameter 'x' implicitly has an 'any' type. -+jsDeclarationsClassMethod.js(61,30): error TS7006: Parameter 'y' implicitly has an 'any' type. + + -+==== jsDeclarationsClassMethod.js (11 errors) ==== ++==== jsDeclarationsClassMethod.js (1 errors) ==== + function C1() { + /** + * A comment prop @@ -24,10 +14,6 @@ + * @returns {number} + */ + this.prop = function (x, y) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'y' implicitly has an 'any' type. + return x + y; + } + } @@ -39,10 +25,6 @@ + * @returns {number} + */ + C1.prototype.method = function (x, y) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'y' implicitly has an 'any' type. + return x + y; + } + @@ -53,10 +35,6 @@ + * @returns {number} + */ + C1.staticProp = function (x, y) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'y' implicitly has an 'any' type. + return x + y; + } + @@ -82,10 +60,6 @@ + ~~~~~~~ +!!! error TS2551: Property 'method2' does not exist on type 'C2'. Did you mean 'method1'? +!!! related TS2728 jsDeclarationsClassMethod.js:40:5: 'method1' is declared here. -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'y' implicitly has an 'any' type. + return x + y; + } + @@ -96,10 +70,6 @@ + * @returns {number} + */ + C2.staticProp = function (x, y) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'y' implicitly has an 'any' type. + return x + y; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js index c4da697a19..9c75137dcb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js @@ -130,7 +130,7 @@ C2.staticProp = function (x, y) { //// [jsDeclarationsClassMethod.d.ts] declare function C1(): void; declare namespace C1 { - var staticProp: (x: any, y: any) => any; + var staticProp: (x: number, y: number) => number; } declare class C2 { /** @@ -142,5 +142,5 @@ declare class C2 { method1(x: number, y: number): number; } declare namespace C2 { - var staticProp: (x: any, y: any) => any; + var staticProp: (x: number, y: number) => number; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js.diff index 864b04d0c7..a601ce50d0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js.diff @@ -28,7 +28,7 @@ - * @returns {number} - */ - function staticProp(x: number, y: number): number; -+ var staticProp: (x: any, y: any) => any; ++ var staticProp: (x: number, y: number) => number; } declare class C2 { /** @@ -52,5 +52,5 @@ - * @returns {number} - */ - function staticProp(x: number, y: number): number; -+ var staticProp: (x: any, y: any) => any; ++ var staticProp: (x: number, y: number) => number; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.types index 3bde44e8b9..25b872802f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.types @@ -2,7 +2,7 @@ === jsDeclarationsClassMethod.js === function C1() { ->C1 : { (): void; staticProp: (x: any, y: any) => any; } +>C1 : { (): void; staticProp: (x: number, y: number) => number; } /** * A comment prop @@ -11,18 +11,18 @@ function C1() { * @returns {number} */ this.prop = function (x, y) { ->this.prop = function (x, y) { return x + y; } : (x: any, y: any) => any +>this.prop = function (x, y) { return x + y; } : (x: number, y: number) => number >this.prop : any >this : any >prop : any ->function (x, y) { return x + y; } : (x: any, y: any) => any ->x : any ->y : any +>function (x, y) { return x + y; } : (x: number, y: number) => number +>x : number +>y : number return x + y; ->x + y : any ->x : any ->y : any +>x + y : number +>x : number +>y : number } } @@ -33,20 +33,20 @@ function C1() { * @returns {number} */ C1.prototype.method = function (x, y) { ->C1.prototype.method = function (x, y) { return x + y;} : (x: any, y: any) => any +>C1.prototype.method = function (x, y) { return x + y;} : (x: number, y: number) => number >C1.prototype.method : any >C1.prototype : any ->C1 : { (): void; staticProp: (x: any, y: any) => any; } +>C1 : { (): void; staticProp: (x: number, y: number) => number; } >prototype : any >method : any ->function (x, y) { return x + y;} : (x: any, y: any) => any ->x : any ->y : any +>function (x, y) { return x + y;} : (x: number, y: number) => number +>x : number +>y : number return x + y; ->x + y : any ->x : any ->y : any +>x + y : number +>x : number +>y : number } /** @@ -56,18 +56,18 @@ C1.prototype.method = function (x, y) { * @returns {number} */ C1.staticProp = function (x, y) { ->C1.staticProp = function (x, y) { return x + y;} : (x: any, y: any) => any ->C1.staticProp : (x: any, y: any) => any ->C1 : { (): void; staticProp: (x: any, y: any) => any; } ->staticProp : (x: any, y: any) => any ->function (x, y) { return x + y;} : (x: any, y: any) => any ->x : any ->y : any +>C1.staticProp = function (x, y) { return x + y;} : (x: number, y: number) => number +>C1.staticProp : (x: number, y: number) => number +>C1 : { (): void; staticProp: (x: number, y: number) => number; } +>staticProp : (x: number, y: number) => number +>function (x, y) { return x + y;} : (x: number, y: number) => number +>x : number +>y : number return x + y; ->x + y : any ->x : any ->y : any +>x + y : number +>x : number +>y : number } class C2 { @@ -98,20 +98,20 @@ class C2 { * @returns {number} */ C2.prototype.method2 = function (x, y) { ->C2.prototype.method2 = function (x, y) { return x + y;} : (x: any, y: any) => any +>C2.prototype.method2 = function (x, y) { return x + y;} : (x: number, y: number) => number >C2.prototype.method2 : any >C2.prototype : C2 >C2 : typeof C2 >prototype : C2 >method2 : any ->function (x, y) { return x + y;} : (x: any, y: any) => any ->x : any ->y : any +>function (x, y) { return x + y;} : (x: number, y: number) => number +>x : number +>y : number return x + y; ->x + y : any ->x : any ->y : any +>x + y : number +>x : number +>y : number } /** @@ -121,17 +121,17 @@ C2.prototype.method2 = function (x, y) { * @returns {number} */ C2.staticProp = function (x, y) { ->C2.staticProp = function (x, y) { return x + y;} : (x: any, y: any) => any ->C2.staticProp : (x: any, y: any) => any +>C2.staticProp = function (x, y) { return x + y;} : (x: number, y: number) => number +>C2.staticProp : (x: number, y: number) => number >C2 : typeof C2 ->staticProp : (x: any, y: any) => any ->function (x, y) { return x + y;} : (x: any, y: any) => any ->x : any ->y : any +>staticProp : (x: number, y: number) => number +>function (x, y) { return x + y;} : (x: number, y: number) => number +>x : number +>y : number return x + y; ->x + y : any ->x : any ->y : any +>x + y : number +>x : number +>y : number } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.types.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.types.diff index 49ac0190d4..837ff9fbf5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.types.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.types.diff @@ -5,148 +5,48 @@ === jsDeclarationsClassMethod.js === function C1() { ->C1 : typeof C1 -+>C1 : { (): void; staticProp: (x: any, y: any) => any; } ++>C1 : { (): void; staticProp: (x: number, y: number) => number; } /** * A comment prop -@@= skipped -9, +9 lines =@@ - * @returns {number} - */ +@@= skipped -11, +11 lines =@@ this.prop = function (x, y) { -->this.prop = function (x, y) { return x + y; } : (x: number, y: number) => number -+>this.prop = function (x, y) { return x + y; } : (x: any, y: any) => any + >this.prop = function (x, y) { return x + y; } : (x: number, y: number) => number >this.prop : any ->this : this +>this : any >prop : any -->function (x, y) { return x + y; } : (x: number, y: number) => number -->x : number -->y : number -+>function (x, y) { return x + y; } : (x: any, y: any) => any -+>x : any -+>y : any - - return x + y; -->x + y : number -->x : number -->y : number -+>x + y : any -+>x : any -+>y : any - } - } - -@@= skipped -22, +22 lines =@@ - * @returns {number} - */ - C1.prototype.method = function (x, y) { -->C1.prototype.method = function (x, y) { return x + y;} : (x: number, y: number) => number -+>C1.prototype.method = function (x, y) { return x + y;} : (x: any, y: any) => any + >function (x, y) { return x + y; } : (x: number, y: number) => number + >x : number +@@= skipped -23, +23 lines =@@ + >C1.prototype.method = function (x, y) { return x + y;} : (x: number, y: number) => number >C1.prototype.method : any >C1.prototype : any ->C1 : typeof C1 -+>C1 : { (): void; staticProp: (x: any, y: any) => any; } ++>C1 : { (): void; staticProp: (x: number, y: number) => number; } >prototype : any >method : any -->function (x, y) { return x + y;} : (x: number, y: number) => number -->x : number -->y : number -+>function (x, y) { return x + y;} : (x: any, y: any) => any -+>x : any -+>y : any - - return x + y; -->x + y : number -->x : number -->y : number -+>x + y : any -+>x : any -+>y : any - } - - /** -@@= skipped -23, +23 lines =@@ - * @returns {number} - */ + >function (x, y) { return x + y;} : (x: number, y: number) => number +@@= skipped -22, +22 lines =@@ C1.staticProp = function (x, y) { -->C1.staticProp = function (x, y) { return x + y;} : (x: number, y: number) => number -->C1.staticProp : (x: number, y: number) => number + >C1.staticProp = function (x, y) { return x + y;} : (x: number, y: number) => number + >C1.staticProp : (x: number, y: number) => number ->C1 : typeof C1 -->staticProp : (x: number, y: number) => number -->function (x, y) { return x + y;} : (x: number, y: number) => number -->x : number -->y : number -+>C1.staticProp = function (x, y) { return x + y;} : (x: any, y: any) => any -+>C1.staticProp : (x: any, y: any) => any -+>C1 : { (): void; staticProp: (x: any, y: any) => any; } -+>staticProp : (x: any, y: any) => any -+>function (x, y) { return x + y;} : (x: any, y: any) => any -+>x : any -+>y : any - - return x + y; -->x + y : number -->x : number -->y : number -+>x + y : any -+>x : any -+>y : any - } - - class C2 { -@@= skipped -42, +42 lines =@@ - * @returns {number} ++>C1 : { (): void; staticProp: (x: number, y: number) => number; } + >staticProp : (x: number, y: number) => number + >function (x, y) { return x + y;} : (x: number, y: number) => number + >x : number +@@= skipped -41, +41 lines =@@ */ C2.prototype.method2 = function (x, y) { -->C2.prototype.method2 = function (x, y) { return x + y;} : (x: number, y: number) => number + >C2.prototype.method2 = function (x, y) { return x + y;} : (x: number, y: number) => number ->C2.prototype.method2 : (x: number, y: number) => number -+>C2.prototype.method2 = function (x, y) { return x + y;} : (x: any, y: any) => any +>C2.prototype.method2 : any >C2.prototype : C2 >C2 : typeof C2 >prototype : C2 ->method2 : (x: number, y: number) => number -->function (x, y) { return x + y;} : (x: number, y: number) => number -->x : number -->y : number +>method2 : any -+>function (x, y) { return x + y;} : (x: any, y: any) => any -+>x : any -+>y : any - - return x + y; -->x + y : number -->x : number -->y : number -+>x + y : any -+>x : any -+>y : any - } - - /** -@@= skipped -23, +23 lines =@@ - * @returns {number} - */ - C2.staticProp = function (x, y) { -->C2.staticProp = function (x, y) { return x + y;} : (x: number, y: number) => number -->C2.staticProp : (x: number, y: number) => number -+>C2.staticProp = function (x, y) { return x + y;} : (x: any, y: any) => any -+>C2.staticProp : (x: any, y: any) => any - >C2 : typeof C2 -->staticProp : (x: number, y: number) => number -->function (x, y) { return x + y;} : (x: number, y: number) => number -->x : number -->y : number -+>staticProp : (x: any, y: any) => any -+>function (x, y) { return x + y;} : (x: any, y: any) => any -+>x : any -+>y : any - - return x + y; -->x + y : number -->x : number -->y : number -+>x + y : any -+>x : any -+>y : any - } + >function (x, y) { return x + y;} : (x: number, y: number) => number + >x : number + >y : number \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt index bdcd1428a7..eacb15b531 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt @@ -1,6 +1,6 @@ jsDeclarationsExportAssignedConstructorFunctionWithSub.js(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -jsDeclarationsExportAssignedConstructorFunctionWithSub.js(7,16): error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. -jsDeclarationsExportAssignedConstructorFunctionWithSub.js(10,16): error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. +jsDeclarationsExportAssignedConstructorFunctionWithSub.js(7,16): error TS2339: Property 'Sub' does not exist on type '(p: number) => void'. +jsDeclarationsExportAssignedConstructorFunctionWithSub.js(10,16): error TS2339: Property 'Sub' does not exist on type '(p: number) => void'. ==== jsDeclarationsExportAssignedConstructorFunctionWithSub.js (3 errors) ==== @@ -16,10 +16,10 @@ jsDeclarationsExportAssignedConstructorFunctionWithSub.js(10,16): error TS2339: !!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.Sub = function() { ~~~ -!!! error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. +!!! error TS2339: Property 'Sub' does not exist on type '(p: number) => void'. this.instance = new module.exports(10); } module.exports.Sub.prototype = { } ~~~ -!!! error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. +!!! error TS2339: Property 'Sub' does not exist on type '(p: number) => void'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt.diff index fd12f89044..de63b75e54 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt.diff @@ -7,8 +7,8 @@ - -==== jsDeclarationsExportAssignedConstructorFunctionWithSub.js (2 errors) ==== +jsDeclarationsExportAssignedConstructorFunctionWithSub.js(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+jsDeclarationsExportAssignedConstructorFunctionWithSub.js(7,16): error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. -+jsDeclarationsExportAssignedConstructorFunctionWithSub.js(10,16): error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. ++jsDeclarationsExportAssignedConstructorFunctionWithSub.js(7,16): error TS2339: Property 'Sub' does not exist on type '(p: number) => void'. ++jsDeclarationsExportAssignedConstructorFunctionWithSub.js(10,16): error TS2339: Property 'Sub' does not exist on type '(p: number) => void'. + + +==== jsDeclarationsExportAssignedConstructorFunctionWithSub.js (3 errors) ==== @@ -28,10 +28,10 @@ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.Sub = function() { + ~~~ -+!!! error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. ++!!! error TS2339: Property 'Sub' does not exist on type '(p: number) => void'. this.instance = new module.exports(10); } module.exports.Sub.prototype = { } + ~~~ -+!!! error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. ++!!! error TS2339: Property 'Sub' does not exist on type '(p: number) => void'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.js index f470e836cf..bd73c59f81 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.js @@ -30,6 +30,6 @@ module.exports.Sub.prototype = {}; //// [jsDeclarationsExportAssignedConstructorFunctionWithSub.d.ts] -declare const _default: (p: any) => void; +declare const _default: (p: number) => void; export = _default; export declare var Sub: () => void; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.js.diff index 8816133088..4a4defdd73 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.js.diff @@ -14,6 +14,6 @@ + + +//// [jsDeclarationsExportAssignedConstructorFunctionWithSub.d.ts] -+declare const _default: (p: any) => void; ++declare const _default: (p: number) => void; +export = _default; +export declare var Sub: () => void; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types index 175998a419..48b8e7616f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types @@ -5,28 +5,28 @@ * @param {number} p */ module.exports = function (p) { ->module.exports = function (p) { this.t = 12 + p;} : (p: any) => void ->module.exports : (p: any) => void ->module : { "export=": (p: any) => void; } ->exports : (p: any) => void ->function (p) { this.t = 12 + p;} : (p: any) => void ->p : any +>module.exports = function (p) { this.t = 12 + p;} : (p: number) => void +>module.exports : (p: number) => void +>module : { "export=": (p: number) => void; } +>exports : (p: number) => void +>function (p) { this.t = 12 + p;} : (p: number) => void +>p : number this.t = 12 + p; ->this.t = 12 + p : any +>this.t = 12 + p : number >this.t : any >this : any >t : any ->12 + p : any +>12 + p : number >12 : 12 ->p : any +>p : number } module.exports.Sub = function() { >module.exports.Sub = function() { this.instance = new module.exports(10);} : () => void >module.exports.Sub : any ->module.exports : (p: any) => void ->module : { "export=": (p: any) => void; } ->exports : (p: any) => void +>module.exports : (p: number) => void +>module : { "export=": (p: number) => void; } +>exports : (p: number) => void >Sub : any >function() { this.instance = new module.exports(10);} : () => void @@ -36,18 +36,18 @@ module.exports.Sub = function() { >this : any >instance : any >new module.exports(10) : any ->module.exports : (p: any) => void ->module : { "export=": (p: any) => void; } ->exports : (p: any) => void +>module.exports : (p: number) => void +>module : { "export=": (p: number) => void; } +>exports : (p: number) => void >10 : 10 } module.exports.Sub.prototype = { } >module.exports.Sub.prototype = { } : {} >module.exports.Sub.prototype : any >module.exports.Sub : any ->module.exports : (p: any) => void ->module : { "export=": (p: any) => void; } ->exports : (p: any) => void +>module.exports : (p: number) => void +>module : { "export=": (p: number) => void; } +>exports : (p: number) => void >Sub : any >prototype : any >{ } : {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types.diff index 61fe270fcd..ed66d5fd5b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types.diff @@ -9,26 +9,22 @@ ->module : { exports: { (p: number): void; new (p: number): exports; Sub: typeof Sub; }; } ->exports : { (p: number): void; new (p: number): exports; Sub: typeof Sub; } ->function (p) { this.t = 12 + p;} : typeof exports -->p : number -+>module.exports = function (p) { this.t = 12 + p;} : (p: any) => void -+>module.exports : (p: any) => void -+>module : { "export=": (p: any) => void; } -+>exports : (p: any) => void -+>function (p) { this.t = 12 + p;} : (p: any) => void -+>p : any ++>module.exports = function (p) { this.t = 12 + p;} : (p: number) => void ++>module.exports : (p: number) => void ++>module : { "export=": (p: number) => void; } ++>exports : (p: number) => void ++>function (p) { this.t = 12 + p;} : (p: number) => void + >p : number this.t = 12 + p; -->this.t = 12 + p : number -+>this.t = 12 + p : any + >this.t = 12 + p : number >this.t : any ->this : this +>this : any >t : any -->12 + p : number -+>12 + p : any + >12 + p : number >12 : 12 -->p : number -+>p : any + >p : number } module.exports.Sub = function() { ->module.exports.Sub = function() { this.instance = new module.exports(10);} : typeof Sub @@ -40,9 +36,9 @@ ->function() { this.instance = new module.exports(10);} : typeof Sub +>module.exports.Sub = function() { this.instance = new module.exports(10);} : () => void +>module.exports.Sub : any -+>module.exports : (p: any) => void -+>module : { "export=": (p: any) => void; } -+>exports : (p: any) => void ++>module.exports : (p: number) => void ++>module : { "export=": (p: number) => void; } ++>exports : (p: number) => void +>Sub : any +>function() { this.instance = new module.exports(10);} : () => void @@ -58,9 +54,9 @@ ->module : { exports: { (p: number): void; new (p: number): exports; Sub: typeof Sub; }; } ->exports : { (p: number): void; new (p: number): exports; Sub: typeof Sub; } +>new module.exports(10) : any -+>module.exports : (p: any) => void -+>module : { "export=": (p: any) => void; } -+>exports : (p: any) => void ++>module.exports : (p: number) => void ++>module : { "export=": (p: number) => void; } ++>exports : (p: number) => void >10 : 10 } module.exports.Sub.prototype = { } @@ -74,9 +70,9 @@ ->prototype : {} +>module.exports.Sub.prototype : any +>module.exports.Sub : any -+>module.exports : (p: any) => void -+>module : { "export=": (p: any) => void; } -+>exports : (p: any) => void ++>module.exports : (p: number) => void ++>module : { "export=": (p: number) => void; } ++>exports : (p: number) => void +>Sub : any +>prototype : any >{ } : {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt index e4e224acd2..f543992cff 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt @@ -1,6 +1,6 @@ index.js(4,18): error TS2339: Property 'cat' does not exist on type '() => void'. index.js(7,18): error TS2339: Property 'Cls' does not exist on type '() => void'. -index.js(31,18): error TS2339: Property 'self' does not exist on type '(a: any) => any'. +index.js(31,18): error TS2339: Property 'self' does not exist on type '(a: T) => T'. index.js(35,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(45,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -42,7 +42,7 @@ index.js(45,23): error TS2580: Cannot find name 'module'. Do you need to install } module.exports.f.self = module.exports.f; ~~~~ -!!! error TS2339: Property 'self' does not exist on type '(a: any) => any'. +!!! error TS2339: Property 'self' does not exist on type '(a: T) => T'. /** * @param {{x: string}} a diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff index 4d291444a9..c70300bafd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff @@ -4,7 +4,7 @@ - +index.js(4,18): error TS2339: Property 'cat' does not exist on type '() => void'. +index.js(7,18): error TS2339: Property 'Cls' does not exist on type '() => void'. -+index.js(31,18): error TS2339: Property 'self' does not exist on type '(a: any) => any'. ++index.js(31,18): error TS2339: Property 'self' does not exist on type '(a: T) => T'. +index.js(35,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(45,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + @@ -46,7 +46,7 @@ + } + module.exports.f.self = module.exports.f; + ~~~~ -+!!! error TS2339: Property 'self' does not exist on type '(a: any) => any'. ++!!! error TS2339: Property 'self' does not exist on type '(a: T) => T'. + + /** + * @param {{x: string}} a diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.js index 6ab4694cfb..a35f3d141c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.js @@ -76,7 +76,7 @@ module.exports.c.Cls = class { * @param {number} b * @return {string} */ -export var d = function d(a, b) { return /** @type {*} */ (null as ); }; +export var d = function d(a: number, b: number): string { return /** @type {*} */ (null as ); }; /** * @param {number} a * @param {number} b @@ -89,7 +89,7 @@ module.exports.d = function d(a, b) { return /** @type {*} */ null; }; * @param {U} b * @return {T & U} */ -export var e = function e(a, b) { return /** @type {*} */ (null as ); }; +export var e = function e(a: T, b: U): T & U { return /** @type {*} */ (null as ); }; /** * @template T,U * @param {T} a @@ -101,7 +101,7 @@ module.exports.e = function e(a, b) { return /** @type {*} */ null; }; * @template T * @param {T} a */ -export var f = function f(a) { +export var f = function f(a: T) { return a; }; /** @@ -146,9 +146,9 @@ module.exports.j = function j() { }; export declare var a: () => void; export declare var b: () => void; export declare var c: () => void; -export declare var d: (a: any, b: any) => any; -export declare var e: (a: any, b: any) => any; -export declare var f: (a: any) => any; +export declare var d: (a: number, b: number) => string; +export declare var e: (a: T, b: U) => T & U; +export declare var f: (a: T) => T; /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.js.diff index ded27f1704..b9e1ea2cb2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.js.diff @@ -25,7 +25,7 @@ - * @return {T & U} - */ -module.exports.e = function e(a, b) { return /** @type {*} */ (null); }; -+export var d = function d(a, b) { return /** @type {*} */ (null as ); }; ++export var d = function d(a: number, b: number): string { return /** @type {*} */ (null as ); }; +/** + * @param {number} a + * @param {number} b @@ -38,7 +38,7 @@ + * @param {U} b + * @return {T & U} + */ -+export var e = function e(a, b) { return /** @type {*} */ (null as ); }; ++export var e = function e(a: T, b: U): T & U { return /** @type {*} */ (null as ); }; +/** + * @template T,U + * @param {T} a @@ -50,7 +50,7 @@ + * @template T + * @param {T} a + */ -+export var f = function f(a) { ++export var f = function f(a: T) { + return a; +}; /** @@ -106,9 +106,9 @@ +export declare var a: () => void; +export declare var b: () => void; +export declare var c: () => void; -+export declare var d: (a: any, b: any) => any; -+export declare var e: (a: any, b: any) => any; -+export declare var f: (a: any) => any; ++export declare var d: (a: number, b: number) => string; ++export declare var e: (a: T, b: U) => T & U; ++export declare var f: (a: T) => T; /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types index d25931180d..19cd228c3c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types @@ -59,16 +59,16 @@ module.exports.c.Cls = class {} * @return {string} */ module.exports.d = function d(a, b) { return /** @type {*} */(null); } ->module.exports.d = function d(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any ->module.exports.d : (a: any, b: any) => any +>module.exports.d = function d(a, b) { return /** @type {*} */(null); } : (a: number, b: number) => string +>module.exports.d : (a: number, b: number) => string >module.exports : typeof import("index") >module : { "\"index\"": typeof import("index"); } >exports : typeof import("index") ->d : (a: any, b: any) => any ->function d(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any ->d : (a: any, b: any) => any ->a : any ->b : any +>d : (a: number, b: number) => string +>function d(a, b) { return /** @type {*} */(null); } : (a: number, b: number) => string +>d : (a: number, b: number) => string +>a : number +>b : number >(null) : any /** @@ -78,16 +78,16 @@ module.exports.d = function d(a, b) { return /** @type {*} */(null); } * @return {T & U} */ module.exports.e = function e(a, b) { return /** @type {*} */(null); } ->module.exports.e = function e(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any ->module.exports.e : (a: any, b: any) => any +>module.exports.e = function e(a, b) { return /** @type {*} */(null); } : (a: T, b: U) => T & U +>module.exports.e : (a: T, b: U) => T & U >module.exports : typeof import("index") >module : { "\"index\"": typeof import("index"); } >exports : typeof import("index") ->e : (a: any, b: any) => any ->function e(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any ->e : (a: any, b: any) => any ->a : any ->b : any +>e : (a: T, b: U) => T & U +>function e(a, b) { return /** @type {*} */(null); } : (a: T, b: U) => T & U +>e : (a: T, b: U) => T & U +>a : T +>b : U >(null) : any /** @@ -95,33 +95,33 @@ module.exports.e = function e(a, b) { return /** @type {*} */(null); } * @param {T} a */ module.exports.f = function f(a) { ->module.exports.f = function f(a) { return a;} : (a: any) => any ->module.exports.f : (a: any) => any +>module.exports.f = function f(a) { return a;} : (a: T) => T +>module.exports.f : (a: T) => T >module.exports : typeof import("index") >module : { "\"index\"": typeof import("index"); } >exports : typeof import("index") ->f : (a: any) => any ->function f(a) { return a;} : (a: any) => any ->f : (a: any) => any ->a : any +>f : (a: T) => T +>function f(a) { return a;} : (a: T) => T +>f : (a: T) => T +>a : T return a; ->a : any +>a : T } module.exports.f.self = module.exports.f; ->module.exports.f.self = module.exports.f : (a: any) => any +>module.exports.f.self = module.exports.f : (a: T) => T >module.exports.f.self : any ->module.exports.f : (a: any) => any +>module.exports.f : (a: T) => T >module.exports : typeof import("index") >module : { "\"index\"": typeof import("index"); } >exports : typeof import("index") ->f : (a: any) => any +>f : (a: T) => T >self : any ->module.exports.f : (a: any) => any +>module.exports.f : (a: T) => T >module.exports : typeof import("index") >module : { "\"index\"": typeof import("index"); } >exports : typeof import("index") ->f : (a: any) => any +>f : (a: T) => T /** * @param {{x: string}} a diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types.diff index 7bfe7d2274..0a8ec75a40 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types.diff @@ -87,61 +87,33 @@ >class {} : typeof Cls /** -@@= skipped -55, +55 lines =@@ - * @return {string} - */ +@@= skipped -57, +57 lines =@@ module.exports.d = function d(a, b) { return /** @type {*} */(null); } -->module.exports.d = function d(a, b) { return /** @type {*} */(null); } : (a: number, b: number) => string -->module.exports.d : (a: number, b: number) => string + >module.exports.d = function d(a, b) { return /** @type {*} */(null); } : (a: number, b: number) => string + >module.exports.d : (a: number, b: number) => string ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->d : (a: number, b: number) => string -->function d(a, b) { return /** @type {*} */(null); } : (a: number, b: number) => string -->d : (a: number, b: number) => string -->a : number -->b : number -+>module.exports.d = function d(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any -+>module.exports.d : (a: any, b: any) => any +>module.exports : typeof import("index") +>module : { "\"index\"": typeof import("index"); } +>exports : typeof import("index") -+>d : (a: any, b: any) => any -+>function d(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any -+>d : (a: any, b: any) => any -+>a : any -+>b : any - >(null) : any - - /** + >d : (a: number, b: number) => string + >function d(a, b) { return /** @type {*} */(null); } : (a: number, b: number) => string + >d : (a: number, b: number) => string @@= skipped -19, +19 lines =@@ - * @return {T & U} - */ module.exports.e = function e(a, b) { return /** @type {*} */(null); } -->module.exports.e = function e(a, b) { return /** @type {*} */(null); } : (a: T, b: U) => T & U -->module.exports.e : (a: T, b: U) => T & U + >module.exports.e = function e(a, b) { return /** @type {*} */(null); } : (a: T, b: U) => T & U + >module.exports.e : (a: T, b: U) => T & U ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->e : (a: T, b: U) => T & U -->function e(a, b) { return /** @type {*} */(null); } : (a: T, b: U) => T & U -->e : (a: T, b: U) => T & U -->a : T -->b : U -+>module.exports.e = function e(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any -+>module.exports.e : (a: any, b: any) => any +>module.exports : typeof import("index") +>module : { "\"index\"": typeof import("index"); } +>exports : typeof import("index") -+>e : (a: any, b: any) => any -+>function e(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any -+>e : (a: any, b: any) => any -+>a : any -+>b : any - >(null) : any - - /** -@@= skipped -17, +17 lines =@@ + >e : (a: T, b: U) => T & U + >function e(a, b) { return /** @type {*} */(null); } : (a: T, b: U) => T & U + >e : (a: T, b: U) => T & U +@@= skipped -15, +15 lines =@@ * @param {T} a */ module.exports.f = function f(a) { @@ -153,20 +125,18 @@ ->f : { (a: T): T; self: any; } ->function f(a) { return a;} : { (a: T): T; self: any; } ->f : { (a: T): T; self: any; } -->a : T -+>module.exports.f = function f(a) { return a;} : (a: any) => any -+>module.exports.f : (a: any) => any ++>module.exports.f = function f(a) { return a;} : (a: T) => T ++>module.exports.f : (a: T) => T +>module.exports : typeof import("index") +>module : { "\"index\"": typeof import("index"); } +>exports : typeof import("index") -+>f : (a: any) => any -+>function f(a) { return a;} : (a: any) => any -+>f : (a: any) => any -+>a : any ++>f : (a: T) => T ++>function f(a) { return a;} : (a: T) => T ++>f : (a: T) => T + >a : T return a; -->a : T -+>a : any + >a : T } module.exports.f.self = module.exports.f; ->module.exports.f.self = module.exports.f : { (a: T): T; self: any; } @@ -182,19 +152,19 @@ ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->f : { (a: T): T; self: any; } -+>module.exports.f.self = module.exports.f : (a: any) => any ++>module.exports.f.self = module.exports.f : (a: T) => T +>module.exports.f.self : any -+>module.exports.f : (a: any) => any ++>module.exports.f : (a: T) => T +>module.exports : typeof import("index") +>module : { "\"index\"": typeof import("index"); } +>exports : typeof import("index") -+>f : (a: any) => any ++>f : (a: T) => T +>self : any -+>module.exports.f : (a: any) => any ++>module.exports.f : (a: T) => T +>module.exports : typeof import("index") +>module : { "\"index\"": typeof import("index"); } +>exports : typeof import("index") -+>f : (a: any) => any ++>f : (a: T) => T /** * @param {{x: string}} a diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt new file mode 100644 index 0000000000..3190a46534 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt @@ -0,0 +1,34 @@ +templateTagOnConstructorFunctions.js(15,12): error TS2304: Cannot find name 'T'. +templateTagOnConstructorFunctions.js(16,15): error TS2304: Cannot find name 'T'. + + +==== templateTagOnConstructorFunctions.js (2 errors) ==== + /** + * @template U + * @typedef {(u: U) => U} Id + */ + /** + * @param {T} t + * @template T + */ + function Zet(t) { + /** @type {T} */ + this.u + this.t = t + } + /** + * @param {T} v + ~ +!!! error TS2304: Cannot find name 'T'. + * @param {Id} id + ~ +!!! error TS2304: Cannot find name 'T'. + */ + Zet.prototype.add = function(v, id) { + this.u = v || this.t + return id(this.u) + } + var z = new Zet(1) + z.t = 2 + z.u = false + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt.diff index fd8c906846..724c5799ca 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt.diff @@ -5,31 +5,30 @@ - - -==== templateTagOnConstructorFunctions.js (1 errors) ==== -- /** -- * @template U -- * @typedef {(u: U) => U} Id -- */ -- /** -- * @param {T} t -- * @template T -- */ -- function Zet(t) { -- /** @type {T} */ -- this.u -- this.t = t -- } -- /** -- * @param {T} v -- * @param {Id} id -- */ -- Zet.prototype.add = function(v, id) { -- this.u = v || this.t -- return id(this.u) -- } -- var z = new Zet(1) -- z.t = 2 -- z.u = false ++templateTagOnConstructorFunctions.js(15,12): error TS2304: Cannot find name 'T'. ++templateTagOnConstructorFunctions.js(16,15): error TS2304: Cannot find name 'T'. ++ ++ ++==== templateTagOnConstructorFunctions.js (2 errors) ==== + /** + * @template U + * @typedef {(u: U) => U} Id +@@= skipped -16, +17 lines =@@ + } + /** + * @param {T} v ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @param {Id} id ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + Zet.prototype.add = function(v, id) { + this.u = v || this.t +@@= skipped -9, +13 lines =@@ + var z = new Zet(1) + z.t = 2 + z.u = false - ~~~ -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. -- -+ \ No newline at end of file + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types index e3e64c3c17..b84739cc08 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types @@ -31,15 +31,15 @@ function Zet(t) { * @param {Id} id */ Zet.prototype.add = function(v, id) { ->Zet.prototype.add = function(v, id) { this.u = v || this.t return id(this.u)} : (v: any, id: any) => any +>Zet.prototype.add = function(v, id) { this.u = v || this.t return id(this.u)} : (v: T, id: Id) => T >Zet.prototype.add : any >Zet.prototype : any >Zet : (t: T) => void >prototype : any >add : any ->function(v, id) { this.u = v || this.t return id(this.u)} : (v: any, id: any) => any ->v : any ->id : any +>function(v, id) { this.u = v || this.t return id(this.u)} : (v: T, id: Id) => T +>v : T +>id : Id this.u = v || this.t >this.u = v || this.t : any @@ -47,14 +47,14 @@ Zet.prototype.add = function(v, id) { >this : any >u : any >v || this.t : any ->v : any +>v : T >this.t : any >this : any >t : any return id(this.u) ->id(this.u) : any ->id : any +>id(this.u) : T +>id : Id >this.u : any >this : any >u : any diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types.diff index ec0739d6b8..37251f14d2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types.diff @@ -25,24 +25,17 @@ >t : any >t : T } -@@= skipped -21, +21 lines =@@ - * @param {Id} id - */ - Zet.prototype.add = function(v, id) { -->Zet.prototype.add = function(v, id) { this.u = v || this.t return id(this.u)} : (v: T, id: Id) => T -+>Zet.prototype.add = function(v, id) { this.u = v || this.t return id(this.u)} : (v: any, id: any) => any +@@= skipped -24, +24 lines =@@ + >Zet.prototype.add = function(v, id) { this.u = v || this.t return id(this.u)} : (v: T, id: Id) => T >Zet.prototype.add : any >Zet.prototype : any ->Zet : typeof Zet +>Zet : (t: T) => void >prototype : any >add : any -->function(v, id) { this.u = v || this.t return id(this.u)} : (v: T, id: Id) => T -->v : T -->id : Id -+>function(v, id) { this.u = v || this.t return id(this.u)} : (v: any, id: any) => any -+>v : any -+>id : any + >function(v, id) { this.u = v || this.t return id(this.u)} : (v: T, id: Id) => T +@@= skipped -8, +8 lines =@@ + >id : Id this.u = v || this.t ->this.u = v || this.t : T @@ -50,28 +43,25 @@ ->this : this ->u : T ->v || this.t : T -->v : T -->this.t : T -->this : this -->t : T +>this.u = v || this.t : any +>this.u : any +>this : any +>u : any +>v || this.t : any -+>v : any + >v : T +->this.t : T +->this : this +->t : T +>this.t : any +>this : any +>t : any return id(this.u) -->id(this.u) : T -->id : Id + >id(this.u) : T + >id : Id ->this.u : T ->this : this ->u : T -+>id(this.u) : any -+>id : any +>this.u : any +>this : any +>u : any diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt index db4a9a3064..dd5719fa25 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt @@ -1,7 +1,9 @@ +templateTagWithNestedTypeLiteral.js(11,12): error TS2304: Cannot find name 'T'. +templateTagWithNestedTypeLiteral.js(13,12): error TS2304: Cannot find name 'T'. templateTagWithNestedTypeLiteral.js(28,15): error TS2304: Cannot find name 'T'. -==== templateTagWithNestedTypeLiteral.js (1 errors) ==== +==== templateTagWithNestedTypeLiteral.js (3 errors) ==== /** * @param {T} t * @template T @@ -13,8 +15,12 @@ templateTagWithNestedTypeLiteral.js(28,15): error TS2304: Cannot find name 'T'. } /** * @param {T} v + ~ +!!! error TS2304: Cannot find name 'T'. * @param {object} o * @param {T} o.nested + ~ +!!! error TS2304: Cannot find name 'T'. */ Zet.prototype.add = function(v, o) { this.u = v || o.nested diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff index 1de308f13e..f8c36b8201 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff @@ -2,15 +2,30 @@ +++ new.jsdocTemplateConstructorFunction2.errors.txt @@= skipped -0, +0 lines =@@ -templateTagWithNestedTypeLiteral.js(21,1): error TS2322: Type 'boolean' is not assignable to type 'number'. ++templateTagWithNestedTypeLiteral.js(11,12): error TS2304: Cannot find name 'T'. ++templateTagWithNestedTypeLiteral.js(13,12): error TS2304: Cannot find name 'T'. templateTagWithNestedTypeLiteral.js(28,15): error TS2304: Cannot find name 'T'. -==== templateTagWithNestedTypeLiteral.js (2 errors) ==== -+==== templateTagWithNestedTypeLiteral.js (1 errors) ==== ++==== templateTagWithNestedTypeLiteral.js (3 errors) ==== /** * @param {T} t * @template T -@@= skipped -23, +22 lines =@@ +@@= skipped -13, +14 lines =@@ + } + /** + * @param {T} v ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @param {object} o + * @param {T} o.nested ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + Zet.prototype.add = function(v, o) { + this.u = v || o.nested +@@= skipped -10, +14 lines =@@ var z = new Zet(1) z.t = 2 z.u = false diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols index 120776cfd6..754532ce7d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols @@ -28,7 +28,9 @@ Zet.prototype.add = function(v, o) { this.u = v || o.nested >v : Symbol(v, Decl(templateTagWithNestedTypeLiteral.js, 14, 29)) +>o.nested : Symbol(nested, Decl(templateTagWithNestedTypeLiteral.js, 12, 3)) >o : Symbol(o, Decl(templateTagWithNestedTypeLiteral.js, 14, 31)) +>nested : Symbol(nested, Decl(templateTagWithNestedTypeLiteral.js, 12, 3)) return this.u } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols.diff index 772beb043a..4e250cd19c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols.diff @@ -32,9 +32,9 @@ ->this : Symbol(Zet, Decl(templateTagWithNestedTypeLiteral.js, 0, 0)) ->u : Symbol(Zet.u, Decl(templateTagWithNestedTypeLiteral.js, 4, 17), Decl(templateTagWithNestedTypeLiteral.js, 14, 36)) >v : Symbol(v, Decl(templateTagWithNestedTypeLiteral.js, 14, 29)) -->o.nested : Symbol(nested, Decl(templateTagWithNestedTypeLiteral.js, 12, 3)) + >o.nested : Symbol(nested, Decl(templateTagWithNestedTypeLiteral.js, 12, 3)) >o : Symbol(o, Decl(templateTagWithNestedTypeLiteral.js, 14, 31)) -->nested : Symbol(nested, Decl(templateTagWithNestedTypeLiteral.js, 12, 3)) + >nested : Symbol(nested, Decl(templateTagWithNestedTypeLiteral.js, 12, 3)) return this.u ->this.u : Symbol(Zet.u, Decl(templateTagWithNestedTypeLiteral.js, 4, 17), Decl(templateTagWithNestedTypeLiteral.js, 14, 36)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types index 6248d2cc34..b5587741cf 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types @@ -28,15 +28,15 @@ function Zet(t) { * @param {T} o.nested */ Zet.prototype.add = function(v, o) { ->Zet.prototype.add = function(v, o) { this.u = v || o.nested return this.u} : (v: any, o: any) => any +>Zet.prototype.add = function(v, o) { this.u = v || o.nested return this.u} : (v: T, o: { nested: T; }) => any >Zet.prototype.add : any >Zet.prototype : any >Zet : (t: T) => void >prototype : any >add : any ->function(v, o) { this.u = v || o.nested return this.u} : (v: any, o: any) => any ->v : any ->o : any +>function(v, o) { this.u = v || o.nested return this.u} : (v: T, o: { nested: T; }) => any +>v : T +>o : { nested: T; } this.u = v || o.nested >this.u = v || o.nested : any @@ -44,10 +44,10 @@ Zet.prototype.add = function(v, o) { >this : any >u : any >v || o.nested : any ->v : any ->o.nested : any ->o : any ->nested : any +>v : T +>o.nested : T +>o : { nested: T; } +>nested : T return this.u >this.u : any diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types.diff index ee44a44f02..866bf42b8f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types.diff @@ -30,7 +30,7 @@ */ Zet.prototype.add = function(v, o) { ->Zet.prototype.add = function(v, o) { this.u = v || o.nested return this.u} : (v: T, o: { nested: T;}) => T -+>Zet.prototype.add = function(v, o) { this.u = v || o.nested return this.u} : (v: any, o: any) => any ++>Zet.prototype.add = function(v, o) { this.u = v || o.nested return this.u} : (v: T, o: { nested: T; }) => any >Zet.prototype.add : any >Zet.prototype : any ->Zet : typeof Zet @@ -38,11 +38,9 @@ >prototype : any >add : any ->function(v, o) { this.u = v || o.nested return this.u} : (v: T, o: { nested: T;}) => T -->v : T -->o : { nested: T; } -+>function(v, o) { this.u = v || o.nested return this.u} : (v: any, o: any) => any -+>v : any -+>o : any ++>function(v, o) { this.u = v || o.nested return this.u} : (v: T, o: { nested: T; }) => any + >v : T + >o : { nested: T; } this.u = v || o.nested ->this.u = v || o.nested : T @@ -50,19 +48,15 @@ ->this : this ->u : T ->v || o.nested : T -->v : T -->o.nested : T -->o : { nested: T; } -->nested : T +>this.u = v || o.nested : any +>this.u : any +>this : any +>u : any +>v || o.nested : any -+>v : any -+>o.nested : any -+>o : any -+>nested : any + >v : T + >o.nested : T + >o : { nested: T; } + >nested : T return this.u ->this.u : T diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt index c2c29e32e4..c1a11b43f9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt @@ -1,7 +1,9 @@ forgot.js(13,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? forgot.js(13,22): error TS1005: '}' expected. -forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. - Type 'void' is not assignable to type 'Animation'. +forgot.js(23,1): error TS2322: Type '(keyframes: Object[]) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. + Types of parameters 'keyframes' and 'keyframes' are incompatible. + Type 'Keyframe[] | PropertyIndexedKeyframes' is not assignable to type 'Object[]'. + Type 'PropertyIndexedKeyframes' is missing the following properties from type 'Object[]': length, pop, push, concat, and 35 more. ==== forgot.js (3 errors) ==== @@ -34,6 +36,8 @@ forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKey */ Element.prototype.animate = function(keyframes) {}; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. -!!! error TS2322: Type 'void' is not assignable to type 'Animation'. +!!! error TS2322: Type '(keyframes: Object[]) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. +!!! error TS2322: Types of parameters 'keyframes' and 'keyframes' are incompatible. +!!! error TS2322: Type 'Keyframe[] | PropertyIndexedKeyframes' is not assignable to type 'Object[]'. +!!! error TS2322: Type 'PropertyIndexedKeyframes' is missing the following properties from type 'Object[]': length, pop, push, concat, and 35 more. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff index bd9d4ecccb..5a15e11ac9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff @@ -2,18 +2,23 @@ +++ new.jsdocTemplateTag.errors.txt @@= skipped -0, +0 lines =@@ -forgot.js(23,1): error TS2322: Type '(keyframes: any[]) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. +- Type 'void' is not assignable to type 'Animation'. +- +- +-==== forgot.js (1 errors) ==== +forgot.js(13,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +forgot.js(13,22): error TS1005: '}' expected. -+forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. - Type 'void' is not assignable to type 'Animation'. - - --==== forgot.js (1 errors) ==== ++forgot.js(23,1): error TS2322: Type '(keyframes: Object[]) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. ++ Types of parameters 'keyframes' and 'keyframes' are incompatible. ++ Type 'Keyframe[] | PropertyIndexedKeyframes' is not assignable to type 'Object[]'. ++ Type 'PropertyIndexedKeyframes' is missing the following properties from type 'Object[]': length, pop, push, concat, and 35 more. ++ ++ +==== forgot.js (3 errors) ==== /** * @param {T} a * @template T -@@= skipped -15, +17 lines =@@ +@@= skipped -15, +19 lines =@@ * @param {T} a * @template T * @returns {function(): T} @@ -30,6 +35,9 @@ Element.prototype.animate = function(keyframes) {}; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '(keyframes: any[]) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. -+!!! error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. - !!! error TS2322: Type 'void' is not assignable to type 'Animation'. +-!!! error TS2322: Type 'void' is not assignable to type 'Animation'. ++!!! error TS2322: Type '(keyframes: Object[]) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. ++!!! error TS2322: Types of parameters 'keyframes' and 'keyframes' are incompatible. ++!!! error TS2322: Type 'Keyframe[] | PropertyIndexedKeyframes' is not assignable to type 'Object[]'. ++!!! error TS2322: Type 'PropertyIndexedKeyframes' is missing the following properties from type 'Object[]': length, pop, push, concat, and 35 more. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.types index 7ad6085463..70b066a343 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.types @@ -44,12 +44,12 @@ let s = g('hi')() * @param {Array.} keyframes - Can't look up types on Element since it's a global in another file. (But it shouldn't crash). */ Element.prototype.animate = function(keyframes) {}; ->Element.prototype.animate = function(keyframes) {} : (keyframes: Keyframe[] | PropertyIndexedKeyframes) => void +>Element.prototype.animate = function(keyframes) {} : (keyframes: Object[]) => void >Element.prototype.animate : (keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation >Element.prototype : Element >Element : { new (): Element; prototype: Element; } >prototype : Element >animate : (keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation ->function(keyframes) {} : (keyframes: Keyframe[] | PropertyIndexedKeyframes) => void ->keyframes : Keyframe[] | PropertyIndexedKeyframes +>function(keyframes) {} : (keyframes: Object[]) => void +>keyframes : Object[] diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.types.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.types.diff index 4c425f5218..57efc3aad5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.types.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.types.diff @@ -29,7 +29,7 @@ Element.prototype.animate = function(keyframes) {}; ->Element.prototype.animate = function(keyframes) {} : (keyframes: Array) => void ->Element.prototype.animate : (keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions) => Animation -+>Element.prototype.animate = function(keyframes) {} : (keyframes: Keyframe[] | PropertyIndexedKeyframes) => void ++>Element.prototype.animate = function(keyframes) {} : (keyframes: Object[]) => void +>Element.prototype.animate : (keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation >Element.prototype : Element >Element : { new (): Element; prototype: Element; } @@ -38,5 +38,5 @@ ->function(keyframes) {} : (keyframes: Array) => void ->keyframes : any[] +>animate : (keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation -+>function(keyframes) {} : (keyframes: Keyframe[] | PropertyIndexedKeyframes) => void -+>keyframes : Keyframe[] | PropertyIndexedKeyframes ++>function(keyframes) {} : (keyframes: Object[]) => void ++>keyframes : Object[] diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.errors.txt index b365cc2208..0816950240 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.errors.txt @@ -1,15 +1,18 @@ a.js(8,16): error TS2315: Type 'Object' is not generic. a.js(9,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -a.js(16,36): error TS7006: Parameter 'key' implicitly has an 'any' type. +a.js(13,12): error TS2304: Cannot find name 'K'. +a.js(14,14): error TS2304: Cannot find name 'V'. a.js(27,16): error TS2315: Type 'Object' is not generic. a.js(28,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -a.js(35,37): error TS7006: Parameter 'key' implicitly has an 'any' type. +a.js(32,12): error TS2304: Cannot find name 'K'. +a.js(33,14): error TS2304: Cannot find name 'V'. a.js(47,16): error TS2315: Type 'Object' is not generic. -a.js(48,10): error TS2339: Property '_map' does not exist on type '{ Multimap3: () => void; }'. -a.js(55,40): error TS7006: Parameter 'key' implicitly has an 'any' type. +a.js(48,10): error TS2339: Property '_map' does not exist on type '{ Multimap3: () => void; }'. +a.js(52,12): error TS2304: Cannot find name 'K'. +a.js(53,14): error TS2304: Cannot find name 'V'. -==== a.js (9 errors) ==== +==== a.js (12 errors) ==== /** * Should work for function declarations * @constructor @@ -27,11 +30,13 @@ a.js(55,40): error TS7006: Parameter 'key' implicitly has an 'any' type. /** * @param {K} key the key ok + ~ +!!! error TS2304: Cannot find name 'K'. * @returns {V} the value ok + ~ +!!! error TS2304: Cannot find name 'V'. */ Multimap.prototype.get = function (key) { - ~~~ -!!! error TS7006: Parameter 'key' implicitly has an 'any' type. return this._map[key + '']; } @@ -52,11 +57,13 @@ a.js(55,40): error TS7006: Parameter 'key' implicitly has an 'any' type. /** * @param {K} key the key ok + ~ +!!! error TS2304: Cannot find name 'K'. * @returns {V} the value ok + ~ +!!! error TS2304: Cannot find name 'V'. */ Multimap2.prototype.get = function (key) { - ~~~ -!!! error TS7006: Parameter 'key' implicitly has an 'any' type. return this._map[key + '']; } @@ -73,16 +80,18 @@ a.js(55,40): error TS7006: Parameter 'key' implicitly has an 'any' type. !!! error TS2315: Type 'Object' is not generic. this._map = {}; ~~~~ -!!! error TS2339: Property '_map' does not exist on type '{ Multimap3: () => void; }'. +!!! error TS2339: Property '_map' does not exist on type '{ Multimap3: () => void; }'. }; /** * @param {K} key the key ok + ~ +!!! error TS2304: Cannot find name 'K'. * @returns {V} the value ok + ~ +!!! error TS2304: Cannot find name 'V'. */ Ns.Multimap3.prototype.get = function (key) { - ~~~ -!!! error TS7006: Parameter 'key' implicitly has an 'any' type. return this._map[key + '']; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.errors.txt.diff index 0f87797d38..9b0e369d4a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.errors.txt.diff @@ -4,16 +4,19 @@ - +a.js(8,16): error TS2315: Type 'Object' is not generic. +a.js(9,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+a.js(16,36): error TS7006: Parameter 'key' implicitly has an 'any' type. ++a.js(13,12): error TS2304: Cannot find name 'K'. ++a.js(14,14): error TS2304: Cannot find name 'V'. +a.js(27,16): error TS2315: Type 'Object' is not generic. +a.js(28,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+a.js(35,37): error TS7006: Parameter 'key' implicitly has an 'any' type. ++a.js(32,12): error TS2304: Cannot find name 'K'. ++a.js(33,14): error TS2304: Cannot find name 'V'. +a.js(47,16): error TS2315: Type 'Object' is not generic. -+a.js(48,10): error TS2339: Property '_map' does not exist on type '{ Multimap3: () => void; }'. -+a.js(55,40): error TS7006: Parameter 'key' implicitly has an 'any' type. ++a.js(48,10): error TS2339: Property '_map' does not exist on type '{ Multimap3: () => void; }'. ++a.js(52,12): error TS2304: Cannot find name 'K'. ++a.js(53,14): error TS2304: Cannot find name 'V'. + + -+==== a.js (9 errors) ==== ++==== a.js (12 errors) ==== + /** + * Should work for function declarations + * @constructor @@ -31,11 +34,13 @@ + + /** + * @param {K} key the key ok ++ ~ ++!!! error TS2304: Cannot find name 'K'. + * @returns {V} the value ok ++ ~ ++!!! error TS2304: Cannot find name 'V'. + */ + Multimap.prototype.get = function (key) { -+ ~~~ -+!!! error TS7006: Parameter 'key' implicitly has an 'any' type. + return this._map[key + '']; + } + @@ -56,11 +61,13 @@ + + /** + * @param {K} key the key ok ++ ~ ++!!! error TS2304: Cannot find name 'K'. + * @returns {V} the value ok ++ ~ ++!!! error TS2304: Cannot find name 'V'. + */ + Multimap2.prototype.get = function (key) { -+ ~~~ -+!!! error TS7006: Parameter 'key' implicitly has an 'any' type. + return this._map[key + '']; + } + @@ -77,16 +84,18 @@ +!!! error TS2315: Type 'Object' is not generic. + this._map = {}; + ~~~~ -+!!! error TS2339: Property '_map' does not exist on type '{ Multimap3: () => void; }'. ++!!! error TS2339: Property '_map' does not exist on type '{ Multimap3: () => void; }'. + }; + + /** + * @param {K} key the key ok ++ ~ ++!!! error TS2304: Cannot find name 'K'. + * @returns {V} the value ok ++ ~ ++!!! error TS2304: Cannot find name 'V'. + */ + Ns.Multimap3.prototype.get = function (key) { -+ ~~~ -+!!! error TS7006: Parameter 'key' implicitly has an 'any' type. + return this._map[key + '']; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.types index e02920f24c..bb9ab72589 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.types @@ -25,14 +25,14 @@ function Multimap() { * @returns {V} the value ok */ Multimap.prototype.get = function (key) { ->Multimap.prototype.get = function (key) { return this._map[key + ''];} : (key: any) => any +>Multimap.prototype.get = function (key) { return this._map[key + ''];} : (key: K) => V >Multimap.prototype.get : any >Multimap.prototype : any >Multimap : () => void >prototype : any >get : any ->function (key) { return this._map[key + ''];} : (key: any) => any ->key : any +>function (key) { return this._map[key + ''];} : (key: K) => V +>key : K return this._map[key + '']; >this._map[key + ''] : any @@ -40,7 +40,7 @@ Multimap.prototype.get = function (key) { >this : any >_map : any >key + '' : string ->key : any +>key : K >'' : "" } @@ -69,14 +69,14 @@ var Multimap2 = function() { * @returns {V} the value ok */ Multimap2.prototype.get = function (key) { ->Multimap2.prototype.get = function (key) { return this._map[key + ''];} : (key: any) => any +>Multimap2.prototype.get = function (key) { return this._map[key + ''];} : (key: K) => V >Multimap2.prototype.get : any >Multimap2.prototype : any >Multimap2 : () => void >prototype : any >get : any ->function (key) { return this._map[key + ''];} : (key: any) => any ->key : any +>function (key) { return this._map[key + ''];} : (key: K) => V +>key : K return this._map[key + '']; >this._map[key + ''] : any @@ -84,13 +84,13 @@ Multimap2.prototype.get = function (key) { >this : any >_map : any >key + '' : string ->key : any +>key : K >'' : "" } var Ns = {}; ->Ns : { Multimap3: () => void; } ->{} : { Multimap3: () => void; } +>Ns : { Multimap3: () => void; } +>{} : { Multimap3: () => void; } /** * Should work for expando-namespaced initialisers too @@ -99,17 +99,17 @@ var Ns = {}; * @template V */ Ns.Multimap3 = function() { ->Ns.Multimap3 = function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void ->Ns.Multimap3 : () => void ->Ns : { Multimap3: () => void; } ->Multimap3 : () => void ->function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void +>Ns.Multimap3 = function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void +>Ns.Multimap3 : () => void +>Ns : { Multimap3: () => void; } +>Multimap3 : () => void +>function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {}; >this._map = {} : {} >this._map : any ->this : { Multimap3: () => void; } +>this : { Multimap3: () => void; } >_map : any >{} : {} @@ -120,16 +120,16 @@ Ns.Multimap3 = function() { * @returns {V} the value ok */ Ns.Multimap3.prototype.get = function (key) { ->Ns.Multimap3.prototype.get = function (key) { return this._map[key + ''];} : (key: any) => any +>Ns.Multimap3.prototype.get = function (key) { return this._map[key + ''];} : (key: K) => V >Ns.Multimap3.prototype.get : any >Ns.Multimap3.prototype : any ->Ns.Multimap3 : () => void ->Ns : { Multimap3: () => void; } ->Multimap3 : () => void +>Ns.Multimap3 : () => void +>Ns : { Multimap3: () => void; } +>Multimap3 : () => void >prototype : any >get : any ->function (key) { return this._map[key + ''];} : (key: any) => any ->key : any +>function (key) { return this._map[key + ''];} : (key: K) => V +>key : K return this._map[key + '']; >this._map[key + ''] : any @@ -137,7 +137,7 @@ Ns.Multimap3.prototype.get = function (key) { >this : any >_map : any >key + '' : string ->key : any +>key : K >'' : "" } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.types.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.types.diff index 3ac508dd5a..1c71493bfb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.types.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.types.diff @@ -19,22 +19,16 @@ >{} : {} }; -@@= skipped -17, +17 lines =@@ - * @returns {V} the value ok - */ - Multimap.prototype.get = function (key) { -->Multimap.prototype.get = function (key) { return this._map[key + ''];} : (key: K) => V -+>Multimap.prototype.get = function (key) { return this._map[key + ''];} : (key: any) => any +@@= skipped -20, +20 lines =@@ + >Multimap.prototype.get = function (key) { return this._map[key + ''];} : (key: K) => V >Multimap.prototype.get : any >Multimap.prototype : any ->Multimap : typeof Multimap +>Multimap : () => void >prototype : any >get : any -->function (key) { return this._map[key + ''];} : (key: K) => V -->key : K -+>function (key) { return this._map[key + ''];} : (key: any) => any -+>key : any + >function (key) { return this._map[key + ''];} : (key: K) => V + >key : K return this._map[key + '']; ->this._map[key + ''] : V @@ -46,12 +40,9 @@ +>this : any +>_map : any >key + '' : string -->key : K -+>key : any + >key : K >'' : "" - } - -@@= skipped -26, +26 lines =@@ +@@= skipped -23, +23 lines =@@ * @template V */ var Multimap2 = function() { @@ -72,22 +63,16 @@ >{} : {} }; -@@= skipped -18, +18 lines =@@ - * @returns {V} the value ok - */ - Multimap2.prototype.get = function (key) { -->Multimap2.prototype.get = function (key) { return this._map[key + ''];} : (key: K) => V -+>Multimap2.prototype.get = function (key) { return this._map[key + ''];} : (key: any) => any +@@= skipped -21, +21 lines =@@ + >Multimap2.prototype.get = function (key) { return this._map[key + ''];} : (key: K) => V >Multimap2.prototype.get : any >Multimap2.prototype : any ->Multimap2 : typeof Multimap2 +>Multimap2 : () => void >prototype : any >get : any -->function (key) { return this._map[key + ''];} : (key: K) => V -->key : K -+>function (key) { return this._map[key + ''];} : (key: any) => any -+>key : any + >function (key) { return this._map[key + ''];} : (key: K) => V + >key : K return this._map[key + '']; ->this._map[key + ''] : V @@ -99,20 +84,19 @@ +>this : any +>_map : any >key + '' : string -->key : K -+>key : any + >key : K >'' : "" } var Ns = {}; ->Ns : typeof Ns ->{} : {} -+>Ns : { Multimap3: () => void; } -+>{} : { Multimap3: () => void; } ++>Ns : { Multimap3: () => void; } ++>{} : { Multimap3: () => void; } /** * Should work for expando-namespaced initialisers too -@@= skipped -30, +30 lines =@@ +@@= skipped -27, +27 lines =@@ * @template V */ Ns.Multimap3 = function() { @@ -121,11 +105,11 @@ ->Ns : typeof Ns ->Multimap3 : typeof Multimap3 ->function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : typeof Multimap3 -+>Ns.Multimap3 = function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void -+>Ns.Multimap3 : () => void -+>Ns : { Multimap3: () => void; } -+>Multimap3 : () => void -+>function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void ++>Ns.Multimap3 = function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void ++>Ns.Multimap3 : () => void ++>Ns : { Multimap3: () => void; } ++>Multimap3 : () => void ++>function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {}; @@ -134,31 +118,25 @@ ->this : this ->_map : { [x: string]: V; } +>this._map : any -+>this : { Multimap3: () => void; } ++>this : { Multimap3: () => void; } +>_map : any >{} : {} }; -@@= skipped -21, +21 lines =@@ - * @returns {V} the value ok - */ - Ns.Multimap3.prototype.get = function (key) { -->Ns.Multimap3.prototype.get = function (key) { return this._map[key + ''];} : (key: K) => V -+>Ns.Multimap3.prototype.get = function (key) { return this._map[key + ''];} : (key: any) => any +@@= skipped -24, +24 lines =@@ + >Ns.Multimap3.prototype.get = function (key) { return this._map[key + ''];} : (key: K) => V >Ns.Multimap3.prototype.get : any >Ns.Multimap3.prototype : any ->Ns.Multimap3 : typeof Multimap3 ->Ns : typeof Ns ->Multimap3 : typeof Multimap3 -+>Ns.Multimap3 : () => void -+>Ns : { Multimap3: () => void; } -+>Multimap3 : () => void ++>Ns.Multimap3 : () => void ++>Ns : { Multimap3: () => void; } ++>Multimap3 : () => void >prototype : any >get : any -->function (key) { return this._map[key + ''];} : (key: K) => V -->key : K -+>function (key) { return this._map[key + ''];} : (key: any) => any -+>key : any + >function (key) { return this._map[key + ''];} : (key: K) => V + >key : K return this._map[key + '']; ->this._map[key + ''] : V @@ -170,7 +148,5 @@ +>this : any +>_map : any >key + '' : string -->key : K -+>key : any - >'' : "" - } + >key : K + >'' : "" \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt index 1c664fdd19..5d29fb72f6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt @@ -9,7 +9,7 @@ a.js(35,16): error TS2304: Cannot find name 'K'. a.js(36,18): error TS2304: Cannot find name 'V'. a.js(39,21): error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. a.js(51,16): error TS2315: Type 'Object' is not generic. -a.js(52,10): error TS2339: Property '_map' does not exist on type '{ Multimap3: { (): void; prototype: { get(key: K): V; }; }; }'. +a.js(52,10): error TS2339: Property '_map' does not exist on type '{ Multimap3: { (): void; prototype: { get(key: K): V; }; }; }'. a.js(57,16): error TS2304: Cannot find name 'K'. a.js(58,18): error TS2304: Cannot find name 'V'. a.js(61,21): error TS2339: Property '_map' does not exist on type '{ get(key: K): V; }'. @@ -91,7 +91,7 @@ a.js(61,21): error TS2339: Property '_map' does not exist on type '{ get(key: K) !!! error TS2315: Type 'Object' is not generic. this._map = {}; ~~~~ -!!! error TS2339: Property '_map' does not exist on type '{ Multimap3: { (): void; prototype: { get(key: K): V; }; }; }'. +!!! error TS2339: Property '_map' does not exist on type '{ Multimap3: { (): void; prototype: { get(key: K): V; }; }; }'. }; Ns.Multimap3.prototype = { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff index 4b8b9d6040..bb8e2bad3c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff @@ -13,7 +13,7 @@ +a.js(36,18): error TS2304: Cannot find name 'V'. +a.js(39,21): error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. +a.js(51,16): error TS2315: Type 'Object' is not generic. -+a.js(52,10): error TS2339: Property '_map' does not exist on type '{ Multimap3: { (): void; prototype: { get(key: K): V; }; }; }'. ++a.js(52,10): error TS2339: Property '_map' does not exist on type '{ Multimap3: { (): void; prototype: { get(key: K): V; }; }; }'. +a.js(57,16): error TS2304: Cannot find name 'K'. +a.js(58,18): error TS2304: Cannot find name 'V'. +a.js(61,21): error TS2339: Property '_map' does not exist on type '{ get(key: K): V; }'. @@ -95,7 +95,7 @@ +!!! error TS2315: Type 'Object' is not generic. + this._map = {}; + ~~~~ -+!!! error TS2339: Property '_map' does not exist on type '{ Multimap3: { (): void; prototype: { get(key: K): V; }; }; }'. ++!!! error TS2339: Property '_map' does not exist on type '{ Multimap3: { (): void; prototype: { get(key: K): V; }; }; }'. + }; + + Ns.Multimap3.prototype = { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.types index baf34c1c1e..eab716da70 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.types @@ -94,8 +94,8 @@ Multimap2.prototype = { } var Ns = {}; ->Ns : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } ->{} : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } +>Ns : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } +>{} : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } /** * Should work for expando-namespaced initialisers too @@ -104,17 +104,17 @@ var Ns = {}; * @template V */ Ns.Multimap3 = function() { ->Ns.Multimap3 = function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : { (): void; prototype: { get(key: K): V; }; } ->Ns.Multimap3 : { (): void; prototype: { get(key: K): V; }; } ->Ns : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } ->Multimap3 : { (): void; prototype: { get(key: K): V; }; } ->function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : { (): void; prototype: { get(key: K): V; }; } +>Ns.Multimap3 = function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : { (): void; prototype: { get(key: K): V; }; } +>Ns.Multimap3 : { (): void; prototype: { get(key: K): V; }; } +>Ns : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } +>Multimap3 : { (): void; prototype: { get(key: K): V; }; } +>function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : { (): void; prototype: { get(key: K): V; }; } /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {}; >this._map = {} : {} >this._map : any ->this : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } +>this : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } >_map : any >{} : {} @@ -123,9 +123,9 @@ Ns.Multimap3 = function() { Ns.Multimap3.prototype = { >Ns.Multimap3.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get(key: K): V; } >Ns.Multimap3.prototype : { get(key: K): V; } ->Ns.Multimap3 : { (): void; prototype: { get(key: K): V; }; } ->Ns : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } ->Multimap3 : { (): void; prototype: { get(key: K): V; }; } +>Ns.Multimap3 : { (): void; prototype: { get(key: K): V; }; } +>Ns : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } +>Multimap3 : { (): void; prototype: { get(key: K): V; }; } >prototype : { get(key: K): V; } >{ /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get(key: K): V; } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.types.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.types.diff index 93396c3234..d98ff5b049 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.types.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.types.diff @@ -94,8 +94,8 @@ var Ns = {}; ->Ns : typeof Ns ->{} : {} -+>Ns : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } -+>{} : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } ++>Ns : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } ++>{} : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } /** * Should work for expando-namespaced initialisers too @@ -108,11 +108,11 @@ ->Ns : typeof Ns ->Multimap3 : typeof Multimap3 ->function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : typeof Multimap3 -+>Ns.Multimap3 = function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : { (): void; prototype: { get(key: K): V; }; } -+>Ns.Multimap3 : { (): void; prototype: { get(key: K): V; }; } -+>Ns : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } -+>Multimap3 : { (): void; prototype: { get(key: K): V; }; } -+>function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : { (): void; prototype: { get(key: K): V; }; } ++>Ns.Multimap3 = function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : { (): void; prototype: { get(key: K): V; }; } ++>Ns.Multimap3 : { (): void; prototype: { get(key: K): V; }; } ++>Ns : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } ++>Multimap3 : { (): void; prototype: { get(key: K): V; }; } ++>function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : { (): void; prototype: { get(key: K): V; }; } /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {}; @@ -121,7 +121,7 @@ ->this : this ->_map : { [x: string]: V; } +>this._map : any -+>this : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } ++>this : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } +>_map : any >{} : {} @@ -133,9 +133,9 @@ ->Ns.Multimap3 : typeof Multimap3 ->Ns : typeof Ns ->Multimap3 : typeof Multimap3 -+>Ns.Multimap3 : { (): void; prototype: { get(key: K): V; }; } -+>Ns : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } -+>Multimap3 : { (): void; prototype: { get(key: K): V; }; } ++>Ns.Multimap3 : { (): void; prototype: { get(key: K): V; }; } ++>Ns : { Multimap3: { (): void; prototype: { get(key: K): V; }; }; } ++>Multimap3 : { (): void; prototype: { get(key: K): V; }; } >prototype : { get(key: K): V; } >{ /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get(key: K): V; } diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types index ee42485873..47c22d23d0 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types @@ -38,12 +38,12 @@ module.exports = function () { } /** @param {number} a */ module.exports.f = function (a) { } ->module.exports.f = function (a) { } : (a: any) => void +>module.exports.f = function (a) { } : (a: number) => void >module.exports.f : any >module.exports : () => void >module : { "export=": () => void; } >exports : () => void >f : any ->function (a) { } : (a: any) => void ->a : any +>function (a) { } : (a: number) => void +>a : number diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types.diff index 7179afaef8..2b6a0e41e5 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types.diff @@ -44,19 +44,16 @@ /** @param {number} a */ module.exports.f = function (a) { } -->module.exports.f = function (a) { } : (a: number) => void + >module.exports.f = function (a) { } : (a: number) => void ->module.exports.f : (a: number) => void ->module.exports : { (): void; f: (a: number) => void; } ->module : { exports: { (): void; f: (a: number) => void; }; } ->exports : { (): void; f: (a: number) => void; } ->f : (a: number) => void -->function (a) { } : (a: number) => void -->a : number -+>module.exports.f = function (a) { } : (a: any) => void +>module.exports.f : any +>module.exports : () => void +>module : { "export=": () => void; } +>exports : () => void +>f : any -+>function (a) { } : (a: any) => void -+>a : any + >function (a) { } : (a: number) => void + >a : number diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types index 9d2cd3f0d4..a8fb179f71 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types @@ -2,17 +2,17 @@ === main.js === var f = require('./first'); ->f : (x: any, k: any) => any ->require('./first') : (x: any, k: any) => any +>f : (x: T, k: (t: T) => void) => void +>require('./first') : (x: T, k: (t: T) => void) => void >require : any >'./first' : "./first" f(1, n => { }) ->f(1, n => { }) : any ->f : (x: any, k: any) => any +>f(1, n => { }) : void +>f : (x: T, k: (t: T) => void) => void >1 : 1 ->n => { } : (n: any) => void ->n : any +>n => { } : (n: number) => void +>n : number === first.js === /** @template T @@ -20,14 +20,14 @@ f(1, n => { }) * @param {(t: T) => void} k */ module.exports = function (x, k) { return k(x) } ->module.exports = function (x, k) { return k(x) } : (x: any, k: any) => any ->module.exports : (x: any, k: any) => any ->module : { "export=": (x: any, k: any) => any; } ->exports : (x: any, k: any) => any ->function (x, k) { return k(x) } : (x: any, k: any) => any ->x : any ->k : any ->k(x) : any ->k : any ->x : any +>module.exports = function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void +>module.exports : (x: T, k: (t: T) => void) => void +>module : { "export=": (x: T, k: (t: T) => void) => void; } +>exports : (x: T, k: (t: T) => void) => void +>function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void +>x : T +>k : (t: T) => void +>k(x) : void +>k : (t: T) => void +>x : T diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types.diff b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types.diff index 6e059f16d1..16f129a17a 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types.diff +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types.diff @@ -1,50 +1,11 @@ --- old.paramTagTypeResolution.types +++ new.paramTagTypeResolution.types -@@= skipped -1, +1 lines =@@ - - === main.js === - var f = require('./first'); -->f : (x: T, k: (t: T) => void) => void -->require('./first') : (x: T, k: (t: T) => void) => void -+>f : (x: any, k: any) => any -+>require('./first') : (x: any, k: any) => any - >require : any - >'./first' : "./first" - - f(1, n => { }) -->f(1, n => { }) : void -->f : (x: T, k: (t: T) => void) => void -+>f(1, n => { }) : any -+>f : (x: any, k: any) => any - >1 : 1 -->n => { } : (n: number) => void -->n : number -+>n => { } : (n: any) => void -+>n : any - - === first.js === - /** @template T -@@= skipped -18, +18 lines =@@ - * @param {(t: T) => void} k - */ +@@= skipped -21, +21 lines =@@ module.exports = function (x, k) { return k(x) } -->module.exports = function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void -->module.exports : (x: T, k: (t: T) => void) => void + >module.exports = function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void + >module.exports : (x: T, k: (t: T) => void) => void ->module : { exports: (x: T, k: (t: T) => void) => void; } -->exports : (x: T, k: (t: T) => void) => void -->function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void -->x : T -->k : (t: T) => void -->k(x) : void -->k : (t: T) => void -->x : T -+>module.exports = function (x, k) { return k(x) } : (x: any, k: any) => any -+>module.exports : (x: any, k: any) => any -+>module : { "export=": (x: any, k: any) => any; } -+>exports : (x: any, k: any) => any -+>function (x, k) { return k(x) } : (x: any, k: any) => any -+>x : any -+>k : any -+>k(x) : any -+>k : any -+>x : any ++>module : { "export=": (x: T, k: (t: T) => void) => void; } + >exports : (x: T, k: (t: T) => void) => void + >function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void + >x : T \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.errors.txt b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.errors.txt index 890ca2f997..0a8e08acf8 100644 --- a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.errors.txt @@ -3,6 +3,8 @@ lovefield-ts.d.ts(5,24): error TS2503: Cannot find namespace 'schema'. lovefield-ts.d.ts(7,25): error TS2503: Cannot find namespace 'query'. lovefield-ts.d.ts(9,14): error TS2552: Cannot find name 'TransactionStats'. Did you mean 'Transaction'? lovefield.js(1,1): error TS2708: Cannot use namespace 'lf' as a value. +lovefield.js(3,23): error TS2694: Namespace 'lf' has no exported member 'schema'. +lovefield.js(4,14): error TS2304: Cannot find name 'IThenable'. lovefield.js(6,1): error TS2708: Cannot use namespace 'lf' as a value. @@ -26,13 +28,17 @@ lovefield.js(6,1): error TS2708: Cannot use namespace 'lf' as a value. !!! error TS2552: Cannot find name 'TransactionStats'. Did you mean 'Transaction'? } } -==== lovefield.js (2 errors) ==== +==== lovefield.js (4 errors) ==== lf.Transaction = function() {}; ~~ !!! error TS2708: Cannot use namespace 'lf' as a value. /** * @param {!Array} scope + ~~~~~~ +!!! error TS2694: Namespace 'lf' has no exported member 'schema'. * @return {!IThenable} + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'IThenable'. */ lf.Transaction.prototype.begin = function(scope) {}; ~~ diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.errors.txt.diff index 95b658df11..4dc627825a 100644 --- a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.errors.txt.diff @@ -4,31 +4,30 @@ lovefield-ts.d.ts(5,24): error TS2503: Cannot find namespace 'schema'. lovefield-ts.d.ts(7,25): error TS2503: Cannot find namespace 'query'. lovefield-ts.d.ts(9,14): error TS2552: Cannot find name 'TransactionStats'. Did you mean 'Transaction'? --lovefield.js(3,23): error TS2694: Namespace 'lf' has no exported member 'schema'. --lovefield.js(4,14): error TS2304: Cannot find name 'IThenable'. +lovefield.js(1,1): error TS2708: Cannot use namespace 'lf' as a value. + lovefield.js(3,23): error TS2694: Namespace 'lf' has no exported member 'schema'. + lovefield.js(4,14): error TS2304: Cannot find name 'IThenable'. +lovefield.js(6,1): error TS2708: Cannot use namespace 'lf' as a value. ==== lovefield-ts.d.ts (4 errors) ==== -@@= skipped -22, +22 lines =@@ +@@= skipped -22, +24 lines =@@ stats(): TransactionStats ~~~~~~~~~~~~~~~~ !!! error TS2552: Cannot find name 'TransactionStats'. Did you mean 'Transaction'? -!!! related TS2728 lovefield.js:1:1: 'Transaction' is declared here. } } - ==== lovefield.js (2 errors) ==== +-==== lovefield.js (2 errors) ==== ++==== lovefield.js (4 errors) ==== lf.Transaction = function() {}; + ~~ +!!! error TS2708: Cannot use namespace 'lf' as a value. /** * @param {!Array} scope -- ~~~~~~ --!!! error TS2694: Namespace 'lf' has no exported member 'schema'. - * @return {!IThenable} -- ~~~~~~~~~ --!!! error TS2304: Cannot find name 'IThenable'. + ~~~~~~ +@@= skipped -14, +15 lines =@@ + !!! error TS2304: Cannot find name 'IThenable'. */ lf.Transaction.prototype.begin = function(scope) {}; + ~~ diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.types b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.types index 43dd4c3369..d8a938cb13 100644 --- a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.types +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.types @@ -42,7 +42,7 @@ lf.Transaction = function() {}; * @return {!IThenable} */ lf.Transaction.prototype.begin = function(scope) {}; ->lf.Transaction.prototype.begin = function(scope) {} : (scope: any) => void +>lf.Transaction.prototype.begin = function(scope) {} : (scope: lf.schema.Table[]) => IThenable >lf.Transaction.prototype.begin : any >lf.Transaction.prototype : any >lf.Transaction : any @@ -50,6 +50,6 @@ lf.Transaction.prototype.begin = function(scope) {}; >Transaction : any >prototype : any >begin : any ->function(scope) {} : (scope: any) => void ->scope : any +>function(scope) {} : (scope: lf.schema.Table[]) => IThenable +>scope : lf.schema.Table[] diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.types.diff b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.types.diff index 412095fa27..71879fc5e9 100644 --- a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.types.diff +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeWithInterfaceMethod.types.diff @@ -45,7 +45,7 @@ */ lf.Transaction.prototype.begin = function(scope) {}; ->lf.Transaction.prototype.begin = function(scope) {} : (scope: Array) => IThenable -+>lf.Transaction.prototype.begin = function(scope) {} : (scope: any) => void ++>lf.Transaction.prototype.begin = function(scope) {} : (scope: lf.schema.Table[]) => IThenable >lf.Transaction.prototype.begin : any >lf.Transaction.prototype : any ->lf.Transaction : typeof Transaction @@ -57,6 +57,5 @@ >prototype : any >begin : any ->function(scope) {} : (scope: Array) => IThenable -->scope : lf.schema.Table[] -+>function(scope) {} : (scope: any) => void -+>scope : any ++>function(scope) {} : (scope: lf.schema.Table[]) => IThenable + >scope : lf.schema.Table[] diff --git a/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.symbols b/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.symbols index 0aa17cca62..2c2fb74a5d 100644 --- a/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.symbols +++ b/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.symbols @@ -31,10 +31,10 @@ Element.prototype.remove ??= function () { this.parentNode?.removeChild(this); >this.parentNode?.removeChild : Symbol(Node.removeChild, Decl(lib.dom.d.ts, --, --)) >this.parentNode : Symbol(Node.parentNode, Decl(lib.dom.d.ts, --, --)) ->this : Symbol(Element, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>this : Symbol((Missing), Decl(index.js, 5, 4)) >parentNode : Symbol(Node.parentNode, Decl(lib.dom.d.ts, --, --)) >removeChild : Symbol(Node.removeChild, Decl(lib.dom.d.ts, --, --)) ->this : Symbol(Element, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>this : Symbol((Missing), Decl(index.js, 5, 4)) }; diff --git a/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.symbols.diff b/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.symbols.diff index 12ffe84778..1ccf580ce6 100644 --- a/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.symbols.diff @@ -5,10 +5,10 @@ >this.parentNode?.removeChild : Symbol(Node.removeChild, Decl(lib.dom.d.ts, --, --)) >this.parentNode : Symbol(Node.parentNode, Decl(lib.dom.d.ts, --, --)) ->this : Symbol(this) -+>this : Symbol(Element, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) ++>this : Symbol((Missing), Decl(index.js, 5, 4)) >parentNode : Symbol(Node.parentNode, Decl(lib.dom.d.ts, --, --)) >removeChild : Symbol(Node.removeChild, Decl(lib.dom.d.ts, --, --)) ->this : Symbol(this) -+>this : Symbol(Element, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) ++>this : Symbol((Missing), Decl(index.js, 5, 4)) }; diff --git a/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.types b/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.types index 207503dec2..f560544293 100644 --- a/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.types +++ b/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.types @@ -31,16 +31,16 @@ Element.prototype.remove ??= function () { >Element : { new (): Element; prototype: Element; } >prototype : Element >remove : () => void ->function () { this.parentNode?.removeChild(this);} : () => void +>function () { this.parentNode?.removeChild(this);} : (this: Node) => void this.parentNode?.removeChild(this); ->this.parentNode?.removeChild(this) : Element | undefined +>this.parentNode?.removeChild(this) : Node | undefined >this.parentNode?.removeChild : ((child: T) => T) | undefined >this.parentNode : ParentNode | null ->this : Element +>this : Node >parentNode : ParentNode | null >removeChild : ((child: T) => T) | undefined ->this : Element +>this : Node }; diff --git a/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.types.diff b/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.types.diff deleted file mode 100644 index 6426470382..0000000000 --- a/testdata/baselines/reference/submodule/conformance/thisPrototypeMethodCompoundAssignmentJs.types.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.thisPrototypeMethodCompoundAssignmentJs.types -+++ new.thisPrototypeMethodCompoundAssignmentJs.types -@@= skipped -30, +30 lines =@@ - >Element : { new (): Element; prototype: Element; } - >prototype : Element - >remove : () => void -->function () { this.parentNode?.removeChild(this);} : (this: Node) => void -+>function () { this.parentNode?.removeChild(this);} : () => void - - this.parentNode?.removeChild(this); -->this.parentNode?.removeChild(this) : Node | undefined -+>this.parentNode?.removeChild(this) : Element | undefined - >this.parentNode?.removeChild : ((child: T) => T) | undefined - >this.parentNode : ParentNode | null -->this : Node -+>this : Element - >parentNode : ParentNode | null - >removeChild : ((child: T) => T) | undefined -->this : Node -+>this : Element - - }; diff --git a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt index 0961be452d..19a261ab56 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt @@ -1,10 +1,12 @@ +thisTypeOfConstructorFunctions.js(10,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface. thisTypeOfConstructorFunctions.js(15,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface. +thisTypeOfConstructorFunctions.js(29,14): error TS2526: A 'this' type is available only in a non-static member of a class or interface. thisTypeOfConstructorFunctions.js(38,12): error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? thisTypeOfConstructorFunctions.js(41,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? thisTypeOfConstructorFunctions.js(43,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? -==== thisTypeOfConstructorFunctions.js (4 errors) ==== +==== thisTypeOfConstructorFunctions.js (6 errors) ==== /** * @class * @template T @@ -15,6 +17,8 @@ thisTypeOfConstructorFunctions.js(43,12): error TS2749: 'Cp' refers to a value, this.dit = this this.y = t /** @return {this} */ + ~~~~ +!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. this.m3 = () => this } @@ -36,6 +40,8 @@ thisTypeOfConstructorFunctions.js(43,12): error TS2749: 'Cp' refers to a value, this.y = t } /** @return {this} */ + ~~~~ +!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. Cpp.prototype.m2 = function () { this.z = this.y; return this } diff --git a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff index 0d0f4cee34..f8a556c6fa 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff @@ -2,13 +2,15 @@ +++ new.thisTypeOfConstructorFunctions.errors.txt @@= skipped -0, +0 lines =@@ - ++thisTypeOfConstructorFunctions.js(10,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface. +thisTypeOfConstructorFunctions.js(15,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface. ++thisTypeOfConstructorFunctions.js(29,14): error TS2526: A 'this' type is available only in a non-static member of a class or interface. +thisTypeOfConstructorFunctions.js(38,12): error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? +thisTypeOfConstructorFunctions.js(41,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? +thisTypeOfConstructorFunctions.js(43,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? + + -+==== thisTypeOfConstructorFunctions.js (4 errors) ==== ++==== thisTypeOfConstructorFunctions.js (6 errors) ==== + /** + * @class + * @template T @@ -19,6 +21,8 @@ + this.dit = this + this.y = t + /** @return {this} */ ++ ~~~~ ++!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. + this.m3 = () => this + } + @@ -40,6 +44,8 @@ + this.y = t + } + /** @return {this} */ ++ ~~~~ ++!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. + Cpp.prototype.m2 = function () { + this.z = this.y; return this + } diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.types index cee63223df..bff390d8f7 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.types @@ -77,19 +77,19 @@ example.y; /** @param {number} k */ Outer.app.statische = function (k) { ->Outer.app.statische = function (k) { return k ** k;} : (k: any) => number +>Outer.app.statische = function (k) { return k ** k;} : (k: number) => number >Outer.app.statische : any >Outer.app : any >Outer : any >app : any >statische : any ->function (k) { return k ** k;} : (k: any) => number ->k : any +>function (k) { return k ** k;} : (k: number) => number +>k : number return k ** k; >k ** k : number ->k : any ->k : any +>k : number +>k : number } === application.js === Outer.app.Application = (function () { diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.types.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.types.diff index 429adcdbfa..0b0c43927c 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.types.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.types.diff @@ -93,29 +93,21 @@ /** @param {number} k */ Outer.app.statische = function (k) { -->Outer.app.statische = function (k) { return k ** k;} : (k: number) => number + >Outer.app.statische = function (k) { return k ** k;} : (k: number) => number ->Outer.app.statische : (k: number) => number ->Outer.app : typeof Outer.app ->Outer : typeof Outer ->app : typeof Outer.app ->statische : (k: number) => number -->function (k) { return k ** k;} : (k: number) => number -->k : number -+>Outer.app.statische = function (k) { return k ** k;} : (k: any) => number +>Outer.app.statische : any +>Outer.app : any +>Outer : any +>app : any +>statische : any -+>function (k) { return k ** k;} : (k: any) => number -+>k : any - - return k ** k; - >k ** k : number -->k : number -->k : number -+>k : any -+>k : any + >function (k) { return k ** k;} : (k: number) => number + >k : number + +@@= skipped -31, +31 lines =@@ } === application.js === Outer.app.Application = (function () { diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.types index 7e43b29727..7db3e4f419 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.types @@ -77,19 +77,19 @@ example.y; /** @param {number} k */ Outer.app.statische = function (k) { ->Outer.app.statische = function (k) { return k ** k;} : (k: any) => number +>Outer.app.statische = function (k) { return k ** k;} : (k: number) => number >Outer.app.statische : any >Outer.app : any >Outer : any >app : any >statische : any ->function (k) { return k ** k;} : (k: any) => number ->k : any +>function (k) { return k ** k;} : (k: number) => number +>k : number return k ** k; >k ** k : number ->k : any ->k : any +>k : number +>k : number } === application.js === Outer.app.Application = (function () { diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.types.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.types.diff index 3c1f08e0c8..ff53945dbf 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.types.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.types.diff @@ -93,29 +93,21 @@ /** @param {number} k */ Outer.app.statische = function (k) { -->Outer.app.statische = function (k) { return k ** k;} : (k: number) => number + >Outer.app.statische = function (k) { return k ** k;} : (k: number) => number ->Outer.app.statische : (k: number) => number ->Outer.app : typeof Outer.app ->Outer : typeof Outer ->app : typeof Outer.app ->statische : (k: number) => number -->function (k) { return k ** k;} : (k: number) => number -->k : number -+>Outer.app.statische = function (k) { return k ** k;} : (k: any) => number +>Outer.app.statische : any +>Outer.app : any +>Outer : any +>app : any +>statische : any -+>function (k) { return k ** k;} : (k: any) => number -+>k : any - - return k ** k; - >k ** k : number -->k : number -->k : number -+>k : any -+>k : any + >function (k) { return k ** k;} : (k: number) => number + >k : number + +@@= skipped -31, +31 lines =@@ } === application.js === Outer.app.Application = (function () { diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9.types index bb57768330..38a916f11e 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9.types @@ -9,16 +9,16 @@ var my = my || {}; /** @param {number} n */ my.method = function(n) { ->my.method = function(n) { return n + 1;} : (n: any) => any +>my.method = function(n) { return n + 1;} : (n: number) => number >my.method : any >my : any >method : any ->function(n) { return n + 1;} : (n: any) => any ->n : any +>function(n) { return n + 1;} : (n: number) => number +>n : number return n + 1; ->n + 1 : any ->n : any +>n + 1 : number +>n : number >1 : 1 } my.number = 1; diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9.types.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9.types.diff index 1d2d547c1e..5500e2df87 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9.types.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9.types.diff @@ -14,25 +14,17 @@ /** @param {number} n */ my.method = function(n) { -->my.method = function(n) { return n + 1;} : (n: number) => number + >my.method = function(n) { return n + 1;} : (n: number) => number ->my.method : (n: number) => number ->my : typeof my ->method : (n: number) => number -->function(n) { return n + 1;} : (n: number) => number -->n : number -+>my.method = function(n) { return n + 1;} : (n: any) => any +>my.method : any +>my : any +>method : any -+>function(n) { return n + 1;} : (n: any) => any -+>n : any + >function(n) { return n + 1;} : (n: number) => number + >n : number - return n + 1; -->n + 1 : number -->n : number -+>n + 1 : any -+>n : any - >1 : 1 +@@= skipped -21, +21 lines =@@ } my.number = 1; >my.number = 1 : 1 @@ -139,7 +131,7 @@ >function () { return 1;} : () => number return 1; -@@= skipped -90, +90 lines =@@ +@@= skipped -69, +69 lines =@@ } my.predicate.query.result = 'none' >my.predicate.query.result = 'none' : "none" diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9_1.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9_1.types index 33efa580bf..8652867562 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9_1.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9_1.types @@ -9,16 +9,16 @@ var my = my ?? {}; /** @param {number} n */ my.method = function(n) { ->my.method = function(n) { return n + 1;} : (n: any) => any +>my.method = function(n) { return n + 1;} : (n: number) => number >my.method : any >my : any >method : any ->function(n) { return n + 1;} : (n: any) => any ->n : any +>function(n) { return n + 1;} : (n: number) => number +>n : number return n + 1; ->n + 1 : any ->n : any +>n + 1 : number +>n : number >1 : 1 } my.number = 1; diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9_1.types.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9_1.types.diff index 197cd5fd6f..c3bc05b80c 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9_1.types.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment9_1.types.diff @@ -14,25 +14,17 @@ /** @param {number} n */ my.method = function(n) { -->my.method = function(n) { return n + 1;} : (n: number) => number + >my.method = function(n) { return n + 1;} : (n: number) => number ->my.method : (n: number) => number ->my : typeof my ->method : (n: number) => number -->function(n) { return n + 1;} : (n: number) => number -->n : number -+>my.method = function(n) { return n + 1;} : (n: any) => any +>my.method : any +>my : any +>method : any -+>function(n) { return n + 1;} : (n: any) => any -+>n : any + >function(n) { return n + 1;} : (n: number) => number + >n : number - return n + 1; -->n + 1 : number -->n : number -+>n + 1 : any -+>n : any - >1 : 1 +@@= skipped -21, +21 lines =@@ } my.number = 1; >my.number = 1 : 1 @@ -139,7 +131,7 @@ >function () { return 1;} : () => number return 1; -@@= skipped -90, +90 lines =@@ +@@= skipped -69, +69 lines =@@ } my.predicate.query.result = 'none' >my.predicate.query.result = 'none' : "none" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types.diff index 78a438eab2..0d6aa45d41 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types.diff @@ -12,20 +12,3 @@ +>foo : (n?: number, s?: string) => void >n : number >s : string - -@@= skipped -13, +13 lines =@@ - * @param {boolean!} b - */ - y = function bar(b) {} -->y = function bar(b) {} : (b: boolean) => void -+>y = function bar(b) {} : (b: any) => void - >y : any -->function bar(b) {} : (b: boolean) => void -->bar : (b: boolean) => void -->b : boolean -+>function bar(b) {} : (b: any) => void -+>bar : (b: any) => void -+>b : any - - /** - * @param {string} s \ No newline at end of file From b1b85f57b13d2f7bedeb50a830a2a9a10dcb319f Mon Sep 17 00:00:00 2001 From: Oleksandr Tarasiuk Date: Tue, 25 Nov 2025 01:30:20 +0200 Subject: [PATCH 2/2] update baseline --- internal/fourslash/_scripts/failingTests.txt | 1 - internal/fourslash/tests/gen/getJavaScriptCompletions18_test.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/fourslash/_scripts/failingTests.txt b/internal/fourslash/_scripts/failingTests.txt index 76d4a8f894..bb01a0e577 100644 --- a/internal/fourslash/_scripts/failingTests.txt +++ b/internal/fourslash/_scripts/failingTests.txt @@ -242,7 +242,6 @@ TestGetJavaScriptCompletions10 TestGetJavaScriptCompletions12 TestGetJavaScriptCompletions13 TestGetJavaScriptCompletions15 -TestGetJavaScriptCompletions18 TestGetJavaScriptCompletions20 TestGetJavaScriptCompletions8 TestGetJavaScriptCompletions9 diff --git a/internal/fourslash/tests/gen/getJavaScriptCompletions18_test.go b/internal/fourslash/tests/gen/getJavaScriptCompletions18_test.go index c03b46a66e..030b5a5442 100644 --- a/internal/fourslash/tests/gen/getJavaScriptCompletions18_test.go +++ b/internal/fourslash/tests/gen/getJavaScriptCompletions18_test.go @@ -11,7 +11,7 @@ import ( func TestGetJavaScriptCompletions18(t *testing.T) { t.Parallel() - t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @allowNonTsExtensions: true // @Filename: file.js