(predicate: (value: T, index: number) => boolean) => T
/**
* @param {number} [pose]
* @param {number} [_]
*/
(pose, _) => true
->(pose, _) => true : (pose: any, _: any) => boolean
->pose : any
->_ : any
+>(pose, _) => true : (pose?: number | undefined, _?: number | undefined) => true
+>pose : number | undefined
+>_ : number | undefined
>true : true
);
diff --git a/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.errors.txt b/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.errors.txt
index eb26152e91..d525041aed 100644
--- a/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.errors.txt
@@ -1,5 +1,4 @@
-uglify.js(5,5): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
-uglify.js(6,7): error TS2339: Property 'val' does not exist on type 'number'.
+uglify.js(6,7): error TS2339: Property 'val' does not exist on type '{}'.
==== controlFlowInstanceof.ts (0 errors) ====
@@ -111,16 +110,14 @@ uglify.js(6,7): error TS2339: Property 'val' does not exist on type 'number'.
}
// Repro from #27550 (based on uglify code)
-==== uglify.js (2 errors) ====
+==== uglify.js (1 errors) ====
/** @constructor */
function AtTop(val) { this.val = val }
/** @type {*} */
var v = 1;
if (v instanceof AtTop) {
- ~
-!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
v.val
~~~
-!!! error TS2339: Property 'val' does not exist on type 'number'.
+!!! error TS2339: Property 'val' does not exist on type '{}'.
}
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.types b/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.types
index 35f27c01f2..428048cfd2 100644
--- a/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.types
+++ b/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.types
@@ -276,17 +276,17 @@ function AtTop(val) { this.val = val }
/** @type {*} */
var v = 1;
->v : number
+>v : any
>1 : 1
if (v instanceof AtTop) {
>v instanceof AtTop : boolean
->v : number
+>v : any
>AtTop : (val: any) => void
v.val
>v.val : any
->v : number
+>v : {}
>val : any
}
diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt
deleted file mode 100644
index 12832c191f..0000000000
--- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-input.js(5,7): error TS7005: Variable 'something' implicitly has an 'any' type.
-input.js(13,77): error TS7006: Parameter 'req' implicitly has an 'any' type.
-input.js(21,64): error TS7006: Parameter 'req' implicitly has an 'any' type.
-input.js(37,88): error TS7006: Parameter 'b' implicitly has an 'any' type.
-
-
-==== input.js (4 errors) ====
- /**
- * @typedef {{ } & { name?: string }} P
- */
-
- const something = /** @type {*} */(null);
- ~~~~~~~~~
-!!! error TS7005: Variable 'something' implicitly has an 'any' type.
-
- export let vLet = /** @type {P} */(something);
- export const vConst = /** @type {P} */(something);
-
- export function fn(p = /** @type {P} */(something)) {}
-
- /** @param {number} req */
- export function fnWithRequiredDefaultParam(p = /** @type {P} */(something), req) {}
- ~~~
-!!! error TS7006: Parameter 'req' implicitly has an 'any' type.
-
- export class C {
- field = /** @type {P} */(something);
- /** @optional */ optField = /** @type {P} */(something); // not a thing
- /** @readonly */ roFiled = /** @type {P} */(something);
- method(p = /** @type {P} */(something)) {}
- /** @param {number} req */
- methodWithRequiredDefault(p = /** @type {P} */(something), req) {}
- ~~~
-!!! error TS7006: Parameter 'req' implicitly has an 'any' type.
-
- constructor(ctorField = /** @type {P} */(something)) {}
-
- get x() { return /** @type {P} */(something) }
- set x(v) { }
- }
-
- export default /** @type {P} */(something);
-
- // allows `undefined` on the input side, thanks to the initializer
- /**
- *
- * @param {P} x
- * @param {number} b
- */
- export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {}
- ~
-!!! error TS7006: Parameter 'b' implicitly has an 'any' type.
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt
deleted file mode 100644
index 16b7800eb5..0000000000
--- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-input.js(13,77): error TS7006: Parameter 'req' implicitly has an 'any' type.
-input.js(21,64): error TS7006: Parameter 'req' implicitly has an 'any' type.
-input.js(37,88): error TS7006: Parameter 'b' implicitly has an 'any' type.
-
-
-==== input.js (3 errors) ====
- /**
- * @typedef {{ } & { name?: string }} P
- */
-
- const something = /** @type {*} */(null);
-
- export let vLet = /** @type {P} */(something);
- export const vConst = /** @type {P} */(something);
-
- export function fn(p = /** @type {P} */(something)) {}
-
- /** @param {number} req */
- export function fnWithRequiredDefaultParam(p = /** @type {P} */(something), req) {}
- ~~~
-!!! error TS7006: Parameter 'req' implicitly has an 'any' type.
-
- export class C {
- field = /** @type {P} */(something);
- /** @optional */ optField = /** @type {P} */(something); // not a thing
- /** @readonly */ roFiled = /** @type {P} */(something);
- method(p = /** @type {P} */(something)) {}
- /** @param {number} req */
- methodWithRequiredDefault(p = /** @type {P} */(something), req) {}
- ~~~
-!!! error TS7006: Parameter 'req' implicitly has an 'any' type.
-
- constructor(ctorField = /** @type {P} */(something)) {}
-
- get x() { return /** @type {P} */(something) }
- set x(v) { }
- }
-
- export default /** @type {P} */(something);
-
- // allows `undefined` on the input side, thanks to the initializer
- /**
- *
- * @param {P} x
- * @param {number} b
- */
- export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {}
- ~
-!!! error TS7006: Parameter 'b' implicitly has an 'any' type.
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitClassAccessorsJs1.types b/testdata/baselines/reference/submodule/compiler/declarationEmitClassAccessorsJs1.types
index df731ebadf..e8ac74c47f 100644
--- a/testdata/baselines/reference/submodule/compiler/declarationEmitClassAccessorsJs1.types
+++ b/testdata/baselines/reference/submodule/compiler/declarationEmitClassAccessorsJs1.types
@@ -21,7 +21,7 @@ export class VFile {
*/
set path(path) {
>path : string
->path : string
+>path : string | URL
}
}
diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitClassSetAccessorParamNameInJs.types b/testdata/baselines/reference/submodule/compiler/declarationEmitClassSetAccessorParamNameInJs.types
index dd5665f03f..be39b7f5a6 100644
--- a/testdata/baselines/reference/submodule/compiler/declarationEmitClassSetAccessorParamNameInJs.types
+++ b/testdata/baselines/reference/submodule/compiler/declarationEmitClassSetAccessorParamNameInJs.types
@@ -12,7 +12,7 @@ export class Foo {
* @param {string} baz Baz.
*/
set bar(baz) {}
->bar : any
->baz : any
+>bar : string
+>baz : string
}
diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt
deleted file mode 100644
index 8be1ee55b1..0000000000
--- a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-index.js(48,7): error TS7032: Property 'x' implicitly has type 'any', because its set accessor lacks a parameter type annotation.
-index.js(48,9): error TS7006: Parameter 'a' implicitly has an 'any' type.
-
-
-==== index.js (2 errors) ====
- // same type accessors
- export const obj1 = {
- /**
- * my awesome getter (first in source order)
- * @returns {string}
- */
- get x() {
- return "";
- },
- /**
- * my awesome setter (second in source order)
- * @param {string} a
- */
- set x(a) {},
- };
-
- // divergent accessors
- export const obj2 = {
- /**
- * my awesome getter
- * @returns {string}
- */
- get x() {
- return "";
- },
- /**
- * my awesome setter
- * @param {number} a
- */
- set x(a) {},
- };
-
- export const obj3 = {
- /**
- * my awesome getter
- * @returns {string}
- */
- get x() {
- return "";
- },
- };
-
- export const obj4 = {
- /**
- * my awesome setter
- * @param {number} a
- */
- set x(a) {},
- ~
-!!! error TS7032: Property 'x' implicitly has type 'any', because its set accessor lacks a parameter type annotation.
- ~
-!!! error TS7006: Parameter 'a' implicitly has an 'any' type.
- };
-
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.types b/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.types
index 602610b8d4..1217753d64 100644
--- a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.types
+++ b/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.types
@@ -49,7 +49,7 @@ export const obj2 = {
*/
set x(a) {},
>x : string
->a : string
+>a : number
};
@@ -71,16 +71,16 @@ export const obj3 = {
};
export const obj4 = {
->obj4 : { x: any; }
->{ /** * my awesome setter * @param {number} a */ set x(a) {},} : { x: any; }
+>obj4 : { x: number; }
+>{ /** * my awesome setter * @param {number} a */ set x(a) {},} : { x: number; }
/**
* my awesome setter
* @param {number} a
*/
set x(a) {},
->x : any
->a : any
+>x : number
+>a : number
};
diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt
index 602c5117a3..f18be0c0f6 100644
--- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt
@@ -1,13 +1,16 @@
+input.js(5,48): error TS2304: Cannot find name 'P'.
input.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
-==== input.js (2 errors) ====
+==== input.js (3 errors) ====
/** @typedef {{ color: "red" | "blue" }} MyComponentProps */
/**
* @template P
* @typedef {{ (): any; defaultProps?: Partial }} StatelessComponent */
+ ~
+!!! error TS2304: Cannot find name 'P'.
/**
* @type {StatelessComponent}
diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols
index 9e8ff6f580..6096d22301 100644
--- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols
+++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols
@@ -14,9 +14,9 @@ const MyComponent = () => /* @type {any} */(null);
>MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5))
MyComponent.defaultProps = {
->MyComponent.defaultProps : Symbol(defaultProps, Decl(input.js, 9, 50))
+>MyComponent.defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23))
>MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5))
->defaultProps : Symbol(defaultProps, Decl(input.js, 9, 50))
+>defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23))
color: "red"
>color : Symbol(color, Decl(input.js, 11, 28))
diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff
index 0c95b7d058..372acfcf31 100644
--- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff
+++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff
@@ -8,15 +8,12 @@
+>MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5))
MyComponent.defaultProps = {
-->MyComponent.defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23))
+ >MyComponent.defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23))
->MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5), Decl(input.js, 9, 50))
-->defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23))
-+>MyComponent.defaultProps : Symbol(defaultProps, Decl(input.js, 9, 50))
+>MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5))
-+>defaultProps : Symbol(defaultProps, Decl(input.js, 9, 50))
+ >defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23))
color: "red"
- >color : Symbol(color, Decl(input.js, 11, 28))
@@= skipped -13, +13 lines =@@
};
diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types
index e83844de53..002b1288c6 100644
--- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types
+++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types
@@ -11,15 +11,15 @@
* @type {StatelessComponent}
*/
const MyComponent = () => /* @type {any} */(null);
->MyComponent : { (): any; defaultProps: { color: string; }; }
+>MyComponent : { (): any; defaultProps?: P; }
>() => /* @type {any} */(null) : { (): any; defaultProps: { color: string; }; }
>(null) : null
MyComponent.defaultProps = {
>MyComponent.defaultProps = { color: "red"} : { color: string; }
->MyComponent.defaultProps : { color: string; }
->MyComponent : { (): any; defaultProps: { color: string; }; }
->defaultProps : { color: string; }
+>MyComponent.defaultProps : P
+>MyComponent : { (): any; defaultProps?: P; }
+>defaultProps : P
>{ color: "red"} : { color: string; }
color: "red"
@@ -51,7 +51,7 @@ MyComponent2.defaultProps = {
* @type {StatelessComponent}
*/
const check = MyComponent2;
->check : { (): any; defaultProps: { color: string; }; }
+>check : { (): any; defaultProps?: P; }
>MyComponent2 : { (): any; defaultProps: { color: string; }; }
/**
@@ -59,8 +59,8 @@ const check = MyComponent2;
* @param {{ props: MyComponentProps }} p
*/
function expectLiteral(p) {}
->expectLiteral : (p: any) => void
->p : any
+>expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void
+>p : { props: { color: "blue" | "red"; }; }
function foo() {
>foo : () => void
@@ -79,7 +79,7 @@ function foo() {
expectLiteral(this);
>expectLiteral(this) : void
->expectLiteral : (p: any) => void
+>expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void
>this : any
}
@@ -100,7 +100,7 @@ module.exports = {
expectLiteral({ props: module.exports });
>expectLiteral({ props: module.exports }) : void
->expectLiteral : (p: any) => void
+>expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void
>{ props: module.exports } : { props: any; }
>props : any
>module.exports : any
diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionSymbolPropertyJs.types b/testdata/baselines/reference/submodule/compiler/expandoFunctionSymbolPropertyJs.types
index 40716d3972..82846722f7 100644
--- a/testdata/baselines/reference/submodule/compiler/expandoFunctionSymbolPropertyJs.types
+++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionSymbolPropertyJs.types
@@ -21,7 +21,7 @@ import { symb } from "./types";
* @returns {import("./types").TestSymb}
*/
export function test() {
->test : () => { (): void; inner[symb]: boolean; }
+>test : () => TestSymb
function inner() {}
>inner : { (): void; inner[symb]: boolean; }
diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types
index 8f0db308a6..03b13b004b 100644
--- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types
+++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types
@@ -7,15 +7,16 @@
*/
/** @type {NumberLike[]} */export default ([ ]);
+>([ ]) : (string | number)[]
>([ ]) : undefined[]
>[ ] : undefined[]
=== b.ts ===
import A from './a'
->A : any[]
+>A : (string | number)[]
A[0]
->A[0] : any
->A : any[]
+>A[0] : string | number
+>A : (string | number)[]
>0 : 0
diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types
index 8347487f4e..cf343ba62c 100644
--- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types
+++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types
@@ -7,15 +7,16 @@
*/
export default /** @type {NumberLike[]} */([ ]);
->([ ]) : undefined[]
+>([ ]) : (string | number)[]
+>[ ] : (string | number)[]
>[ ] : undefined[]
=== b.ts ===
import A from './a'
->A : any[]
+>A : (string | number)[]
A[0]
->A[0] : any
->A : any[]
+>A[0] : string | number
+>A : (string | number)[]
>0 : 0
diff --git a/testdata/baselines/reference/submodule/compiler/extendedUnicodePlaneIdentifiersJSDoc.types b/testdata/baselines/reference/submodule/compiler/extendedUnicodePlaneIdentifiersJSDoc.types
index d8a79b3b31..859dc355e0 100644
--- a/testdata/baselines/reference/submodule/compiler/extendedUnicodePlaneIdentifiersJSDoc.types
+++ b/testdata/baselines/reference/submodule/compiler/extendedUnicodePlaneIdentifiersJSDoc.types
@@ -7,16 +7,16 @@
* @param {number} 𝑀
*/
function foo(𝑚, 𝑀) {
->foo : (𝑚: any, 𝑀: any) => void
->𝑚 : any
->𝑀 : any
+>foo : (𝑚: number, 𝑀: number) => void
+>𝑚 : number
+>𝑀 : number
console.log(𝑀 + 𝑚);
>console.log(𝑀 + 𝑚) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
->𝑀 + 𝑚 : any
->𝑀 : any
->𝑚 : any
+>𝑀 + 𝑚 : number
+>𝑀 : number
+>𝑚 : number
}
diff --git a/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt
new file mode 100644
index 0000000000..3f5fe39172
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt
@@ -0,0 +1,15 @@
+usage.js(1,12): error TS2304: Cannot find name 'Bar'.
+
+
+==== interfaces.d.ts (0 errors) ====
+ export interface Bar {
+ prop: string
+ }
+
+==== usage.js (1 errors) ====
+ /** @type {Bar} */
+ ~~~
+!!! error TS2304: Cannot find name 'Bar'.
+ export let bar;
+
+ /** @typedef {import('./interfaces').Bar} Bar */
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.types b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.types
index 8ac7c588a1..fad53ca758 100644
--- a/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.types
+++ b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.types
@@ -9,6 +9,6 @@ export interface Bar {
=== usage.js ===
/** @type {Bar} */
export let bar;
->bar : any
+>bar : Bar
/** @typedef {import('./interfaces').Bar} Bar */
diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols
index 6beb97fe7a..8918628870 100644
--- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols
+++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols
@@ -39,11 +39,15 @@ class X extends Test {
>super : Symbol(Test, Decl(Test.js, 0, 0))
if (options.test) {
+>options.test : Symbol(test, Decl(index.js, 4, 3))
>options : Symbol(options, Decl(index.js, 11, 16))
+>test : Symbol(test, Decl(index.js, 4, 3))
this.test = new options.test();
>this : Symbol(X, Decl(index.js, 0, 33))
+>options.test : Symbol(test, Decl(index.js, 4, 3))
>options : Symbol(options, Decl(index.js, 11, 16))
+>test : Symbol(test, Decl(index.js, 4, 3))
}
}
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff
index f3923b5792..23c36473e0 100644
--- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff
+++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff
@@ -1,20 +1,12 @@
--- old.jsDeclarationEmitDoesNotRenameImport.symbols
+++ new.jsDeclarationEmitDoesNotRenameImport.symbols
-@@= skipped -38, +38 lines =@@
- >super : Symbol(Test, Decl(Test.js, 0, 0))
-
- if (options.test) {
-->options.test : Symbol(test, Decl(index.js, 4, 3))
- >options : Symbol(options, Decl(index.js, 11, 16))
-->test : Symbol(test, Decl(index.js, 4, 3))
+@@= skipped -43, +43 lines =@@
+ >test : Symbol(test, Decl(index.js, 4, 3))
this.test = new options.test();
->this.test : Symbol(X.test, Decl(index.js, 13, 27))
>this : Symbol(X, Decl(index.js, 0, 33))
->test : Symbol(X.test, Decl(index.js, 13, 27))
-->options.test : Symbol(test, Decl(index.js, 4, 3))
+ >options.test : Symbol(test, Decl(index.js, 4, 3))
>options : Symbol(options, Decl(index.js, 11, 16))
-->test : Symbol(test, Decl(index.js, 4, 3))
- }
- }
- }
+ >test : Symbol(test, Decl(index.js, 4, 3))
diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.types b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.types
index 380b84a5d6..7153b102ef 100644
--- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.types
+++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.types
@@ -33,7 +33,7 @@ class X extends Test {
* @param {Options} options
*/
constructor(options) {
->options : any
+>options : Options
super();
>super() : void
@@ -41,7 +41,7 @@ class X extends Test {
if (options.test) {
>options.test : any
->options : any
+>options : Options
>test : any
this.test = new options.test();
@@ -51,7 +51,7 @@ class X extends Test {
>test : any
>new options.test() : any
>options.test : any
->options : any
+>options : Options
>test : any
}
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.types b/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.types
index 72943a7e96..1dadd19467 100644
--- a/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.types
+++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.types
@@ -18,7 +18,7 @@
* @type {A}
*/
value;
->value : any
+>value : A
}
class C2 extends C1 {
@@ -29,7 +29,7 @@ class C2 extends C1 {
* @type {A}
*/
value;
->value : any
+>value : A
}
class C3 extends C1 {
@@ -40,6 +40,6 @@ class C3 extends C1 {
* @type {A & B}
*/
value;
->value : any
+>value : A & B
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt
deleted file mode 100644
index 4fabc2c738..0000000000
--- a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-index.js(9,49): error TS7006: Parameter 'init' implicitly has an 'any' type.
-
-
-==== package.json (0 errors) ====
- {
- "name": "typescript-issue",
- "private": true,
- "version": "0.0.0",
- "type": "module"
- }
-==== node_modules/@lion/ajax/package.json (0 errors) ====
- {
- "name": "@lion/ajax",
- "version": "2.0.2",
- "type": "module",
- "exports": {
- ".": {
- "types": "./dist-types/src/index.d.ts",
- "default": "./src/index.js"
- },
- "./docs/*": "./docs/*"
- }
- }
-==== node_modules/@lion/ajax/dist-types/src/index.d.ts (0 errors) ====
- export type LionRequestInit = import('../types/types.js').LionRequestInit;
-==== node_modules/@lion/ajax/dist-types/types/types.d.ts (0 errors) ====
- export interface LionRequestInit {
- body?: null | Object;
- }
-==== index.js (1 errors) ====
- /**
- * @typedef {import('@lion/ajax').LionRequestInit} LionRequestInit
- */
-
- export class NewAjax {
- /**
- * @param {LionRequestInit} [init]
- */
- case5_unexpectedlyResolvesPathToNodeModules(init) {}
- ~~~~
-!!! error TS7006: Parameter 'init' implicitly has an 'any' type.
- }
-
- /**
- * @type {(init?: LionRequestInit) => void}
- */
- // @ts-expect-error
- NewAjax.prototype.case6_unexpectedlyResolvesPathToNodeModules;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types
index e7f00dd9c5..da661d7226 100644
--- a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types
+++ b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types
@@ -21,8 +21,8 @@ export class NewAjax {
* @param {LionRequestInit} [init]
*/
case5_unexpectedlyResolvesPathToNodeModules(init) {}
->case5_unexpectedlyResolvesPathToNodeModules : (init: any) => void
->init : any
+>case5_unexpectedlyResolvesPathToNodeModules : (init?: LionRequestInit | undefined) => void
+>init : LionRequestInit | undefined
}
/**
diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt
index f441eb2c8d..313ac6eb7b 100644
--- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt
@@ -2,7 +2,10 @@ enumDef.js(2,6): error TS2339: Property 'UserMetrics' does not exist on type '{}
enumDef.js(4,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'.
enumDef.js(16,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'.
index.js(2,7): error TS2339: Property 'Cls' does not exist on type '{}'.
-index.js(8,26): error TS2339: Property 'UserMetrics' does not exist on type '{}'.
+index.js(4,17): error TS2503: Cannot find namespace 'Host'.
+index.js(8,21): error TS2304: Cannot find name 'Host'.
+index.js(13,11): error TS2503: Cannot find namespace 'Host'.
+index.js(18,11): error TS2503: Cannot find namespace 'Host'.
==== enumDef.js (3 errors) ====
@@ -30,29 +33,35 @@ index.js(8,26): error TS2339: Property 'UserMetrics' does not exist on type '{}'
!!! error TS2339: Property 'UserMetrics' does not exist on type '{}'.
x: 12
}
-==== index.js (2 errors) ====
+==== index.js (5 errors) ====
var Other = {};
Other.Cls = class {
~~~
!!! error TS2339: Property 'Cls' does not exist on type '{}'.
/**
* @param {!Host.UserMetrics.Action} p
+ ~~~~
+!!! error TS2503: Cannot find namespace 'Host'.
*/
method(p) {}
usage() {
this.method(Host.UserMetrics.Action.WindowDocked);
- ~~~~~~~~~~~
-!!! error TS2339: Property 'UserMetrics' does not exist on type '{}'.
+ ~~~~
+!!! error TS2304: Cannot find name 'Host'.
}
}
/**
* @type {Host.UserMetrics.Bargh}
+ ~~~~
+!!! error TS2503: Cannot find namespace 'Host'.
*/
var x = "ok";
/**
* @type {Host.UserMetrics.Blah}
+ ~~~~
+!!! error TS2503: Cannot find namespace 'Host'.
*/
var y = "ok";
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols
index 90f61ad2c3..ac90bfca9d 100644
--- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols
+++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols
@@ -2,14 +2,14 @@
=== enumDef.js ===
var Host = {};
->Host : Symbol(Host, Decl(enumDef.js, 0, 3))
+>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3))
Host.UserMetrics = {};
->Host : Symbol(Host, Decl(enumDef.js, 0, 3))
+>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3))
/** @enum {number} */
Host.UserMetrics.Action = {
->Host : Symbol(Host, Decl(enumDef.js, 0, 3))
+>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3))
WindowDocked: 1,
>WindowDocked : Symbol(WindowDocked, Decl(enumDef.js, 3, 27))
@@ -31,7 +31,7 @@ Host.UserMetrics.Action = {
* @typedef {string}
*/
Host.UserMetrics.Blah = {
->Host : Symbol(Host, Decl(enumDef.js, 0, 3))
+>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3))
x: 12
>x : Symbol(x, Decl(enumDef.js, 15, 25))
@@ -57,7 +57,6 @@ Other.Cls = class {
>this.method : Symbol(method, Decl(index.js, 1, 19))
>this : Symbol(Cls, Decl(index.js, 1, 11))
>method : Symbol(method, Decl(index.js, 1, 19))
->Host : Symbol(Host, Decl(enumDef.js, 0, 3))
}
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff
index 9afcfcb679..517a97f509 100644
--- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff
+++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff
@@ -5,13 +5,13 @@
=== enumDef.js ===
var Host = {};
->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 0, 14), Decl(enumDef.js, 1, 22), Decl(enumDef.js, 8, 2), Decl(enumDef.js, 10, 21))
-+>Host : Symbol(Host, Decl(enumDef.js, 0, 3))
++>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3))
Host.UserMetrics = {};
->Host.UserMetrics : Symbol(Host.UserMetrics, Decl(enumDef.js, 0, 14), Decl(enumDef.js, 3, 5), Decl(enumDef.js, 15, 5), Decl(enumDef.js, 10, 26))
->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 0, 14), Decl(enumDef.js, 1, 22), Decl(enumDef.js, 8, 2), Decl(enumDef.js, 10, 21))
->UserMetrics : Symbol(Host.UserMetrics, Decl(enumDef.js, 0, 14), Decl(enumDef.js, 3, 5), Decl(enumDef.js, 15, 5), Decl(enumDef.js, 10, 26))
-+>Host : Symbol(Host, Decl(enumDef.js, 0, 3))
++>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3))
/** @enum {number} */
Host.UserMetrics.Action = {
@@ -20,7 +20,7 @@
->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 0, 14), Decl(enumDef.js, 1, 22), Decl(enumDef.js, 8, 2), Decl(enumDef.js, 10, 21))
->UserMetrics : Symbol(Host.UserMetrics, Decl(enumDef.js, 0, 14), Decl(enumDef.js, 3, 5), Decl(enumDef.js, 15, 5), Decl(enumDef.js, 10, 26))
->Action : Symbol(Host.UserMetrics.Action, Decl(enumDef.js, 1, 22), Decl(enumDef.js, 3, 17), Decl(enumDef.js, 2, 4))
-+>Host : Symbol(Host, Decl(enumDef.js, 0, 3))
++>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3))
WindowDocked: 1,
>WindowDocked : Symbol(WindowDocked, Decl(enumDef.js, 3, 27))
@@ -33,7 +33,7 @@
->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 0, 14), Decl(enumDef.js, 1, 22), Decl(enumDef.js, 8, 2), Decl(enumDef.js, 10, 21))
->UserMetrics : Symbol(Host.UserMetrics, Decl(enumDef.js, 0, 14), Decl(enumDef.js, 3, 5), Decl(enumDef.js, 15, 5), Decl(enumDef.js, 10, 26))
->Blah : Symbol(Host.UserMetrics.Blah, Decl(enumDef.js, 8, 2), Decl(enumDef.js, 15, 17), Decl(enumDef.js, 13, 3))
-+>Host : Symbol(Host, Decl(enumDef.js, 0, 3))
++>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3))
x: 12
>x : Symbol(x, Decl(enumDef.js, 15, 25))
@@ -74,7 +74,6 @@
->Action : Symbol(Host.UserMetrics.Action, Decl(enumDef.js, 1, 22), Decl(enumDef.js, 3, 17), Decl(enumDef.js, 2, 4))
->WindowDocked : Symbol(WindowDocked, Decl(enumDef.js, 3, 27))
+>method : Symbol(method, Decl(index.js, 1, 19))
-+>Host : Symbol(Host, Decl(enumDef.js, 0, 3))
}
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types
index 3a053ba851..f3d61380fc 100644
--- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types
+++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types
@@ -74,21 +74,21 @@ Other.Cls = class {
* @param {!Host.UserMetrics.Action} p
*/
method(p) {}
->method : (p: any) => void
->p : any
+>method : (p: Action) => void
+>p : Action
usage() {
>usage : () => void
this.method(Host.UserMetrics.Action.WindowDocked);
>this.method(Host.UserMetrics.Action.WindowDocked) : void
->this.method : (p: any) => void
+>this.method : (p: Action) => void
>this : this
->method : (p: any) => void
+>method : (p: Action) => void
>Host.UserMetrics.Action.WindowDocked : any
>Host.UserMetrics.Action : any
>Host.UserMetrics : any
->Host : {}
+>Host : any
>UserMetrics : any
>Action : any
>WindowDocked : any
@@ -99,13 +99,13 @@ Other.Cls = class {
* @type {Host.UserMetrics.Bargh}
*/
var x = "ok";
->x : string
+>x : Bargh
>"ok" : "ok"
/**
* @type {Host.UserMetrics.Blah}
*/
var y = "ok";
->y : string
+>y : Blah
>"ok" : "ok"
diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types
index f17480103c..a845130443 100644
--- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types
+++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types
@@ -30,7 +30,7 @@ cbThing(type => {
/** @type {LogEntry} */
const logEntry = {
->logEntry : { time: number; type: any; }
+>logEntry : LogEntry
>{ time: Date.now(), type, } : { time: number; type: any; }
time: Date.now(),
diff --git a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation.types b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation.types
index 5f2e6574f4..da00b8944d 100644
--- a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation.types
+++ b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation.types
@@ -6,7 +6,7 @@ class Abcde {
/** @type {string} */
x;
->x : any
+>x : string
}
module.exports = {
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols
index 2dfc1c07a7..e3f8506167 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols
+++ b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols
@@ -27,29 +27,39 @@ function apply(func, thisArg, ...args) {
>length : Symbol(length, Decl(_apply.js, 11, 7))
case 0: return func.call(thisArg);
+>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>func : Symbol(func, Decl(_apply.js, 10, 15))
+>call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20))
case 1: return func.call(thisArg, args[0]);
+>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>func : Symbol(func, Decl(_apply.js, 10, 15))
+>call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20))
>args : Symbol(args, Decl(_apply.js, 10, 29))
case 2: return func.call(thisArg, args[0], args[1]);
+>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>func : Symbol(func, Decl(_apply.js, 10, 15))
+>call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20))
>args : Symbol(args, Decl(_apply.js, 10, 29))
>args : Symbol(args, Decl(_apply.js, 10, 29))
case 3: return func.call(thisArg, args[0], args[1], args[2]);
+>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>func : Symbol(func, Decl(_apply.js, 10, 15))
+>call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20))
>args : Symbol(args, Decl(_apply.js, 10, 29))
>args : Symbol(args, Decl(_apply.js, 10, 29))
>args : Symbol(args, Decl(_apply.js, 10, 29))
}
return func.apply(thisArg, args);
+>func.apply : Symbol(apply, Decl(lib.es5.d.ts, --, --))
>func : Symbol(func, Decl(_apply.js, 10, 15))
+>apply : Symbol(apply, Decl(lib.es5.d.ts, --, --))
>thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20))
>args : Symbol(args, Decl(_apply.js, 10, 29))
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff
index 528cc70ef5..b6fe49ba6d 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff
+++ b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff
@@ -15,29 +15,37 @@
case 0: return func.call(thisArg);
->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
++>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>func : Symbol(func, Decl(_apply.js, 10, 15))
->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
++>call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20))
case 1: return func.call(thisArg, args[0]);
->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
++>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>func : Symbol(func, Decl(_apply.js, 10, 15))
->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
++>call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20))
>args : Symbol(args, Decl(_apply.js, 10, 29))
case 2: return func.call(thisArg, args[0], args[1]);
->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
++>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>func : Symbol(func, Decl(_apply.js, 10, 15))
->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
++>call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20))
>args : Symbol(args, Decl(_apply.js, 10, 29))
>args : Symbol(args, Decl(_apply.js, 10, 29))
case 3: return func.call(thisArg, args[0], args[1], args[2]);
->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
++>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>func : Symbol(func, Decl(_apply.js, 10, 15))
->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
++>call : Symbol(call, Decl(lib.es5.d.ts, --, --))
>thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20))
>args : Symbol(args, Decl(_apply.js, 10, 29))
>args : Symbol(args, Decl(_apply.js, 10, 29))
@@ -45,8 +53,10 @@
}
return func.apply(thisArg, args);
->func.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --))
++>func.apply : Symbol(apply, Decl(lib.es5.d.ts, --, --))
>func : Symbol(func, Decl(_apply.js, 10, 15))
->apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --))
++>apply : Symbol(apply, Decl(lib.es5.d.ts, --, --))
>thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20))
>args : Symbol(args, Decl(_apply.js, 10, 29))
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.types b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.types
index 35f0505a2b..ae2faddc79 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.types
+++ b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.types
@@ -12,8 +12,8 @@
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, ...args) {
->apply : (func: any, thisArg: any, ...args: any[]) => any
->func : any
+>apply : (func: Function, thisArg: any, ...args: any[]) => any
+>func : Function
>thisArg : any
>args : any[]
@@ -29,17 +29,17 @@ function apply(func, thisArg, ...args) {
case 0: return func.call(thisArg);
>0 : 0
>func.call(thisArg) : any
->func.call : any
->func : any
->call : any
+>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any
+>func : Function
+>call : (this: Function, thisArg: any, ...argArray: any[]) => any
>thisArg : any
case 1: return func.call(thisArg, args[0]);
>1 : 1
>func.call(thisArg, args[0]) : any
->func.call : any
->func : any
->call : any
+>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any
+>func : Function
+>call : (this: Function, thisArg: any, ...argArray: any[]) => any
>thisArg : any
>args[0] : any
>args : any[]
@@ -48,9 +48,9 @@ function apply(func, thisArg, ...args) {
case 2: return func.call(thisArg, args[0], args[1]);
>2 : 2
>func.call(thisArg, args[0], args[1]) : any
->func.call : any
->func : any
->call : any
+>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any
+>func : Function
+>call : (this: Function, thisArg: any, ...argArray: any[]) => any
>thisArg : any
>args[0] : any
>args : any[]
@@ -62,9 +62,9 @@ function apply(func, thisArg, ...args) {
case 3: return func.call(thisArg, args[0], args[1], args[2]);
>3 : 3
>func.call(thisArg, args[0], args[1], args[2]) : any
->func.call : any
->func : any
->call : any
+>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any
+>func : Function
+>call : (this: Function, thisArg: any, ...argArray: any[]) => any
>thisArg : any
>args[0] : any
>args : any[]
@@ -78,13 +78,13 @@ function apply(func, thisArg, ...args) {
}
return func.apply(thisArg, args);
>func.apply(thisArg, args) : any
->func.apply : any
->func : any
->apply : any
+>func.apply : (this: Function, thisArg: any, argArray?: any) => any
+>func : Function
+>apply : (this: Function, thisArg: any, argArray?: any) => any
>thisArg : any
>args : any[]
}
export default apply;
->apply : (func: any, thisArg: any, ...args: any[]) => any
+>apply : (func: Function, thisArg: any, ...args: any[]) => any
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileCompilationSyntaxError.types b/testdata/baselines/reference/submodule/compiler/jsFileCompilationSyntaxError.types
index 7e106890a7..42c5386bac 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileCompilationSyntaxError.types
+++ b/testdata/baselines/reference/submodule/compiler/jsFileCompilationSyntaxError.types
@@ -6,5 +6,5 @@
* @type {string}
*/
var v;
->v : any
+>v : number
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols
index c34e289aaa..06d3e43822 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols
+++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols
@@ -70,7 +70,9 @@ function flatMap(array, iterable = identity) {
for (let i = 0; i < array.length; i += 1) {
>i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10))
>i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10))
+>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --))
>array : Symbol(array, Decl(jsFileFunctionOverloads.js, 49, 17))
+>length : Symbol(length, Decl(lib.es5.d.ts, --, --))
>i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10))
result.push(.../** @type {unknown[]} */(iterable(array[i])));
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff
index c8c88cff47..f653c587e3 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff
+++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff
@@ -5,8 +5,10 @@
>i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10))
>i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10))
->array.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
++>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --))
>array : Symbol(array, Decl(jsFileFunctionOverloads.js, 49, 17))
->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
++>length : Symbol(length, Decl(lib.es5.d.ts, --, --))
>i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10))
result.push(.../** @type {unknown[]} */(iterable(array[i])));
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.types b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.types
index b38bffc913..112ad7ff6f 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.types
+++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.types
@@ -21,12 +21,12 @@
* @returns {string}
*/
function getTypeName(x) {
->getTypeName : (x: any) => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined"
->x : any
+>getTypeName : (x: unknown) => string
+>x : unknown
return typeof x;
>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined"
->x : any
+>x : unknown
}
/**
@@ -35,10 +35,10 @@
* @returns {T}
*/
const identity = x => x;
->identity : (x: any) => any
->x => x : (x: any) => any
->x : any
->x : any
+>identity : (x: T) => T
+>x => x : (x: T) => T
+>x : T
+>x : T
/**
* @template T
@@ -60,14 +60,14 @@ const identity = x => x;
* @returns {unknown[]}
*/
function flatMap(array, iterable = identity) {
->flatMap : (array: any, iterable?: (x: any) => any) => any[]
->array : any
->iterable : (x: any) => any
->identity : (x: any) => any
+>flatMap : (array: unknown[], iterable?: (x: unknown) => unknown) => unknown[]
+>array : unknown[]
+>iterable : (x: unknown) => unknown
+>identity : (x: T) => T
/** @type {unknown[]} */
const result = [];
->result : any[]
+>result : unknown[]
>[] : undefined[]
for (let i = 0; i < array.length; i += 1) {
@@ -75,27 +75,28 @@ function flatMap(array, iterable = identity) {
>0 : 0
>i < array.length : boolean
>i : number
->array.length : any
->array : any
->length : any
+>array.length : number
+>array : unknown[]
+>length : number
>i += 1 : number
>i : number
>1 : 1
result.push(.../** @type {unknown[]} */(iterable(array[i])));
>result.push(.../** @type {unknown[]} */(iterable(array[i]))) : number
->result.push : (...items: any[]) => number
->result : any[]
->push : (...items: any[]) => number
->.../** @type {unknown[]} */(iterable(array[i])) : any
->(iterable(array[i])) : any
->iterable(array[i]) : any
->iterable : (x: any) => any
->array[i] : any
->array : any
+>result.push : (...items: unknown[]) => number
+>result : unknown[]
+>push : (...items: unknown[]) => number
+>.../** @type {unknown[]} */(iterable(array[i])) : unknown
+>(iterable(array[i])) : unknown[]
+>iterable(array[i]) : unknown[]
+>iterable(array[i]) : unknown
+>iterable : (x: unknown) => unknown
+>array[i] : unknown
+>array : unknown[]
>i : number
}
return result;
->result : any[]
+>result : unknown[]
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols
index ad011c6104..226798dfdc 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols
+++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols
@@ -65,7 +65,9 @@ function flatMap(array, iterable = identity) {
for (let i = 0; i < array.length; i += 1) {
>i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10))
>i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10))
+>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --))
>array : Symbol(array, Decl(jsFileFunctionOverloads2.js, 44, 17))
+>length : Symbol(length, Decl(lib.es5.d.ts, --, --))
>i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10))
result.push(.../** @type {unknown[]} */(iterable(array[i])));
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff
index 397b980305..3a61f98336 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff
+++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff
@@ -5,8 +5,10 @@
>i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10))
>i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10))
->array.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
++>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --))
>array : Symbol(array, Decl(jsFileFunctionOverloads2.js, 44, 17))
->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
++>length : Symbol(length, Decl(lib.es5.d.ts, --, --))
>i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10))
result.push(.../** @type {unknown[]} */(iterable(array[i])));
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.types b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.types
index ea16329399..240501cb14 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.types
+++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.types
@@ -19,12 +19,12 @@
* @returns {string}
*/
function getTypeName(x) {
->getTypeName : (x: any) => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined"
->x : any
+>getTypeName : (x: unknown) => string
+>x : unknown
return typeof x;
>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined"
->x : any
+>x : unknown
}
/**
@@ -33,10 +33,10 @@
* @returns {T}
*/
const identity = x => x;
->identity : (x: any) => any
->x => x : (x: any) => any
->x : any
->x : any
+>identity : (x: T) => T
+>x => x : (x: T) => T
+>x : T
+>x : T
/**
* @template T
@@ -55,14 +55,14 @@ const identity = x => x;
* @returns {unknown[]}
*/
function flatMap(array, iterable = identity) {
->flatMap : (array: any, iterable?: (x: any) => any) => any[]
->array : any
->iterable : (x: any) => any
->identity : (x: any) => any
+>flatMap : (array: unknown[], iterable?: (x: unknown) => unknown) => unknown[]
+>array : unknown[]
+>iterable : (x: unknown) => unknown
+>identity : (x: T) => T
/** @type {unknown[]} */
const result = [];
->result : any[]
+>result : unknown[]
>[] : undefined[]
for (let i = 0; i < array.length; i += 1) {
@@ -70,27 +70,28 @@ function flatMap(array, iterable = identity) {
>0 : 0
>i < array.length : boolean
>i : number
->array.length : any
->array : any
->length : any
+>array.length : number
+>array : unknown[]
+>length : number
>i += 1 : number
>i : number
>1 : 1
result.push(.../** @type {unknown[]} */(iterable(array[i])));
>result.push(.../** @type {unknown[]} */(iterable(array[i]))) : number
->result.push : (...items: any[]) => number
->result : any[]
->push : (...items: any[]) => number
->.../** @type {unknown[]} */(iterable(array[i])) : any
->(iterable(array[i])) : any
->iterable(array[i]) : any
->iterable : (x: any) => any
->array[i] : any
->array : any
+>result.push : (...items: unknown[]) => number
+>result : unknown[]
+>push : (...items: unknown[]) => number
+>.../** @type {unknown[]} */(iterable(array[i])) : unknown
+>(iterable(array[i])) : unknown[]
+>iterable(array[i]) : unknown[]
+>iterable(array[i]) : unknown
+>iterable : (x: unknown) => unknown
+>array[i] : unknown
+>array : unknown[]
>i : number
}
return result;
->result : any[]
+>result : unknown[]
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt
index 195fc4054f..afd42d87b7 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt
@@ -1,5 +1,5 @@
-index.js(9,10): error TS7006: Parameter 'obj' implicitly has an 'any' type.
-index.js(9,15): error TS7006: Parameter 'vm' implicitly has an 'any' type.
+index.js(11,12): error TS2339: Property 'objects' does not exist on type 'object'.
+index.js(13,26): error TS2698: Spread types may only be created from object types.
==== dash.d.ts (0 errors) ====
@@ -22,14 +22,14 @@ index.js(9,15): error TS7006: Parameter 'vm' implicitly has an 'any' type.
* @param {object} vm
*/
test(obj, vm) {
- ~~~
-!!! error TS7006: Parameter 'obj' implicitly has an 'any' type.
- ~~
-!!! error TS7006: Parameter 'vm' implicitly has an 'any' type.
let index = 0;
vm.objects = _.mapValues(
+ ~~~~~~~
+!!! error TS2339: Property 'objects' does not exist on type 'object'.
obj,
object => ({ ...object, [INDEX_FIELD]: index++ }),
+ ~~~~~~~~~
+!!! error TS2698: Spread types may only be created from object types.
);
}
}
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.types b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.types
index 634d15ef90..9d91b4b1de 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.types
+++ b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.types
@@ -39,33 +39,33 @@ export class Test {
* @param {object} vm
*/
test(obj, vm) {
->test : (obj: any, vm: any) => void
->obj : any
->vm : any
+>test : (obj: object, vm: object) => void
+>obj : object
+>vm : object
let index = 0;
>index : number
>0 : 0
vm.objects = _.mapValues(
->vm.objects = _.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : { [x: string]: any; }
+>vm.objects = _.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : object
>vm.objects : any
->vm : any
+>vm : object
>objects : any
->_.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : { [x: string]: any; }
+>_.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : object
>_.mapValues : (obj: T | null | undefined, callback: ObjectIterator) => { [P in keyof T]: TResult; }
>_ : LoDashStatic
>mapValues : (obj: T | null | undefined, callback: ObjectIterator) => { [P in keyof T]: TResult; }
obj,
->obj : any
+>obj : object
object => ({ ...object, [INDEX_FIELD]: index++ }),
->object => ({ ...object, [INDEX_FIELD]: index++ }) : (object: any) => any
->object : any
+>object => ({ ...object, [INDEX_FIELD]: index++ }) : (object: never) => any
+>object : never
>({ ...object, [INDEX_FIELD]: index++ }) : any
>{ ...object, [INDEX_FIELD]: index++ } : any
->object : any
+>object : never
>[INDEX_FIELD] : number
>INDEX_FIELD : "__INDEX"
>index++ : number
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt
index 942187b6f0..89bd8e1449 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt
@@ -1,7 +1,7 @@
-jsFileMethodOverloads.js(9,10): error TS2339: Property 'value' does not exist on type 'Example'.
-jsFileMethodOverloads.js(26,24): error TS2339: Property 'value' does not exist on type 'Example'.
-jsFileMethodOverloads.js(44,25): error TS2339: Property 'value' does not exist on type 'Example'.
-jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist on type 'Example'.
+jsFileMethodOverloads.js(9,10): error TS2339: Property 'value' does not exist on type 'Example'.
+jsFileMethodOverloads.js(26,24): error TS2339: Property 'value' does not exist on type 'Example'.
+jsFileMethodOverloads.js(44,25): error TS2339: Property 'value' does not exist on type 'Example'.
+jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist on type 'Example'.
==== jsFileMethodOverloads.js (4 errors) ====
@@ -15,7 +15,7 @@ jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist o
constructor(value) {
this.value = value;
~~~~~
-!!! error TS2339: Property 'value' does not exist on type 'Example'.
+!!! error TS2339: Property 'value' does not exist on type 'Example'.
}
/**
@@ -34,7 +34,7 @@ jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist o
getTypeName() {
return typeof this.value;
~~~~~
-!!! error TS2339: Property 'value' does not exist on type 'Example'.
+!!! error TS2339: Property 'value' does not exist on type 'Example'.
}
/**
@@ -54,9 +54,9 @@ jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist o
transform(fn) {
return fn ? fn(this.value) : this.value;
~~~~~
-!!! error TS2339: Property 'value' does not exist on type 'Example'.
+!!! error TS2339: Property 'value' does not exist on type 'Example'.
~~~~~
-!!! error TS2339: Property 'value' does not exist on type 'Example'.
+!!! error TS2339: Property 'value' does not exist on type 'Example'.
}
}
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.types b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.types
index 45753f8947..bc65bc8731 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.types
+++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.types
@@ -5,20 +5,20 @@
* @template T
*/
class Example {
->Example : Example
+>Example : Example
/**
* @param {T} value
*/
constructor(value) {
->value : any
+>value : T
this.value = value;
->this.value = value : any
+>this.value = value : T
>this.value : any
>this : this
>value : any
->value : any
+>value : T
}
/**
@@ -35,7 +35,7 @@
* @returns {string}
*/
getTypeName() {
->getTypeName : () => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined"
+>getTypeName : () => string
return typeof this.value;
>typeof this.value : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined"
@@ -59,14 +59,14 @@
* @returns {unknown}
*/
transform(fn) {
->transform : (fn: any) => any
->fn : any
+>transform : (fn?: (y: T) => unknown) => unknown
+>fn : (y: T) => unknown
return fn ? fn(this.value) : this.value;
>fn ? fn(this.value) : this.value : any
->fn : any
->fn(this.value) : any
->fn : any
+>fn : (y: T) => unknown
+>fn(this.value) : unknown
+>fn : (y: T) => unknown
>this.value : any
>this : this
>value : any
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt
index 4e6cf1d02b..1a58e0d84c 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt
@@ -1,7 +1,7 @@
-jsFileMethodOverloads2.js(10,10): error TS2339: Property 'value' does not exist on type 'Example'.
-jsFileMethodOverloads2.js(25,24): error TS2339: Property 'value' does not exist on type 'Example'.
-jsFileMethodOverloads2.js(41,25): error TS2339: Property 'value' does not exist on type 'Example'.
-jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist on type 'Example'.
+jsFileMethodOverloads2.js(10,10): error TS2339: Property 'value' does not exist on type 'Example'.
+jsFileMethodOverloads2.js(25,24): error TS2339: Property 'value' does not exist on type 'Example'.
+jsFileMethodOverloads2.js(41,25): error TS2339: Property 'value' does not exist on type 'Example'.
+jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist on type 'Example'.
==== jsFileMethodOverloads2.js (4 errors) ====
@@ -16,7 +16,7 @@ jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist
constructor(value) {
this.value = value;
~~~~~
-!!! error TS2339: Property 'value' does not exist on type 'Example'.
+!!! error TS2339: Property 'value' does not exist on type 'Example'.
}
/**
@@ -33,7 +33,7 @@ jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist
getTypeName() {
return typeof this.value;
~~~~~
-!!! error TS2339: Property 'value' does not exist on type 'Example'.
+!!! error TS2339: Property 'value' does not exist on type 'Example'.
}
/**
@@ -51,9 +51,9 @@ jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist
transform(fn) {
return fn ? fn(this.value) : this.value;
~~~~~
-!!! error TS2339: Property 'value' does not exist on type 'Example'.
+!!! error TS2339: Property 'value' does not exist on type 'Example'.
~~~~~
-!!! error TS2339: Property 'value' does not exist on type 'Example'.
+!!! error TS2339: Property 'value' does not exist on type 'Example'.
}
}
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.types b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.types
index ec63a0dce3..070ca77f5a 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.types
+++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.types
@@ -6,20 +6,20 @@
* @template T
*/
class Example {
->Example : Example
+>Example : Example
/**
* @param {T} value
*/
constructor(value) {
->value : any
+>value : T
this.value = value;
->this.value = value : any
+>this.value = value : T
>this.value : any
>this : this
>value : any
->value : any
+>value : T
}
/**
@@ -34,7 +34,7 @@
* @returns {string}
*/
getTypeName() {
->getTypeName : () => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined"
+>getTypeName : () => string
return typeof this.value;
>typeof this.value : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined"
@@ -56,14 +56,14 @@
* @returns {unknown}
*/
transform(fn) {
->transform : (fn: any) => any
->fn : any
+>transform : (fn?: (y: T) => unknown) => unknown
+>fn : (y: T) => unknown
return fn ? fn(this.value) : this.value;
>fn ? fn(this.value) : this.value : any
->fn : any
->fn(this.value) : any
->fn : any
+>fn : (y: T) => unknown
+>fn(this.value) : unknown
+>fn : (y: T) => unknown
>this.value : any
>this : this
>value : any
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.errors.txt
deleted file mode 100644
index a97d142c96..0000000000
--- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.errors.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-/a.js(15,13): error TS7006: Parameter 'x' implicitly has an 'any' type.
-
-
-==== /a.js (1 errors) ====
- /**
- * @overload
- * @param {number} x
- */
-
- /**
- * @overload
- * @param {string} x
- */
-
- /**
- * @param {string | number} x
- * @returns {string | number}
- */
- function id(x) {
- ~
-!!! error TS7006: Parameter 'x' implicitly has an 'any' type.
- return x;
- }
-
- export let a = id(123);
- export let b = id("hello");
-
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.types b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.types
index e1287e3d94..ce1d43bf3e 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.types
+++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.types
@@ -16,22 +16,22 @@
* @returns {string | number}
*/
function id(x) {
->id : (x: any) => any
->x : any
+>id : (x: string | number) => string | number
+>x : string | number
return x;
->x : any
+>x : string | number
}
export let a = id(123);
->a : any
->id(123) : any
->id : (x: any) => any
+>a : string | number
+>id(123) : string | number
+>id : (x: string | number) => string | number
>123 : 123
export let b = id("hello");
->b : any
->id("hello") : any
->id : (x: any) => any
+>b : string | number
+>id("hello") : string | number
+>id : (x: string | number) => string | number
>"hello" : "hello"
diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads5.types b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads5.types
index 3fa2a07bb4..ac868dedf5 100644
--- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads5.types
+++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads5.types
@@ -19,8 +19,8 @@
* @param {number} [b]
*/
export const foo = function (a, b) { }
->foo : (a: any, b: any) => void
->function (a, b) { } : (a: any, b: any) => void
->a : any
->b : any
+>foo : (a: string | number, b?: number) => void
+>function (a, b) { } : (a: string | number, b?: number) => void
+>a : string | number
+>b : number
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocAccessEnumType.types b/testdata/baselines/reference/submodule/compiler/jsdocAccessEnumType.types
index b2876f7741..19126cb8a8 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocAccessEnumType.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocAccessEnumType.types
@@ -11,7 +11,7 @@ import { E } from "./a";
/** @type {E} */
const e = E.A;
->e : E.A
+>e : E
>E.A : E
>E : typeof E
>A : E
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt
new file mode 100644
index 0000000000..1d9b3df6af
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt
@@ -0,0 +1,69 @@
+jsdocArrayObjectPromiseImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s).
+jsdocArrayObjectPromiseImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s).
+jsdocArrayObjectPromiseImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s).
+jsdocArrayObjectPromiseImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s).
+jsdocArrayObjectPromiseImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s).
+jsdocArrayObjectPromiseImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s).
+jsdocArrayObjectPromiseImplicitAny.js(30,18): error TS2322: Type 'number' is not assignable to type '() => Object'.
+jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic.
+
+
+==== jsdocArrayObjectPromiseImplicitAny.js (8 errors) ====
+ /** @type {Array} */
+ ~~~~~
+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s).
+ var anyArray = [5];
+
+ /** @type {Array} */
+ var numberArray = [5];
+
+ /**
+ * @param {Array} arr
+ ~~~~~
+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s).
+ * @return {Array}
+ ~~~~~
+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s).
+ */
+ function returnAnyArray(arr) {
+ return arr;
+ }
+
+ /** @type {Promise} */
+ ~~~~~~~
+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s).
+ var anyPromise = Promise.resolve(5);
+
+ /** @type {Promise} */
+ var numberPromise = Promise.resolve(5);
+
+ /**
+ * @param {Promise} pr
+ ~~~~~~~
+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s).
+ * @return {Promise}
+ ~~~~~~~
+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s).
+ */
+ function returnAnyPromise(pr) {
+ return pr;
+ }
+
+ /** @type {Object} */
+ var anyObject = {valueOf: 1}; // not an error since assigning to any.
+ ~~~~~~~
+!!! error TS2322: Type 'number' is not assignable to type '() => Object'.
+
+ /** @type {Object} */
+ ~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2315: Type 'Object' is not generic.
+ var paramedObject = {valueOf: 1};
+
+ /**
+ * @param {Object} obj
+ * @return {Object}
+ */
+ function returnAnyObject(obj) {
+ return obj;
+ }
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.types b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.types
index 297a113198..bc48d858c0 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.types
@@ -3,7 +3,7 @@
=== jsdocArrayObjectPromiseImplicitAny.js ===
/** @type {Array} */
var anyArray = [5];
->anyArray : number[]
+>anyArray : any
>[5] : number[]
>5 : 5
@@ -27,7 +27,7 @@ function returnAnyArray(arr) {
/** @type {Promise} */
var anyPromise = Promise.resolve(5);
->anyPromise : Promise
+>anyPromise : any
>Promise.resolve(5) : Promise
>Promise.resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; }
>Promise : PromiseConstructor
@@ -57,14 +57,14 @@ function returnAnyPromise(pr) {
/** @type {Object} */
var anyObject = {valueOf: 1}; // not an error since assigning to any.
->anyObject : { valueOf: number; }
+>anyObject : Object
>{valueOf: 1} : { valueOf: number; }
>valueOf : number
>1 : 1
/** @type {Object} */
var paramedObject = {valueOf: 1};
->paramedObject : { valueOf: number; }
+>paramedObject : any
>{valueOf: 1} : { valueOf: number; }
>valueOf : number
>1 : 1
@@ -74,10 +74,10 @@ var paramedObject = {valueOf: 1};
* @return {Object}
*/
function returnAnyObject(obj) {
->returnAnyObject : (obj: any) => any
->obj : any
+>returnAnyObject : (obj: Object) => Object
+>obj : Object
return obj;
->obj : any
+>obj : Object
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt
index df10787ae2..c88b521e45 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt
@@ -1,10 +1,17 @@
-jsdocArrayObjectPromiseNoImplicitAny.js(11,28): error TS7006: Parameter 'arr' implicitly has an 'any' type.
-jsdocArrayObjectPromiseNoImplicitAny.js(25,30): error TS7006: Parameter 'pr' implicitly has an 'any' type.
-jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' implicitly has an 'any' type.
+jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s).
+jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s).
+jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s).
+jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s).
+jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s).
+jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s).
+jsdocArrayObjectPromiseNoImplicitAny.js(30,21): error TS2322: Type 'number' is not assignable to type '() => Object'.
+jsdocArrayObjectPromiseNoImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic.
-==== jsdocArrayObjectPromiseNoImplicitAny.js (3 errors) ====
+==== jsdocArrayObjectPromiseNoImplicitAny.js (8 errors) ====
/** @type {Array} */
+ ~~~~~
+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s).
var notAnyArray = [5];
/** @type {Array} */
@@ -12,15 +19,19 @@ jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' im
/**
* @param {Array} arr
+ ~~~~~
+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s).
* @return {Array}
+ ~~~~~
+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s).
*/
function returnNotAnyArray(arr) {
- ~~~
-!!! error TS7006: Parameter 'arr' implicitly has an 'any' type.
return arr;
}
/** @type {Promise} */
+ ~~~~~~~
+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s).
var notAnyPromise = Promise.resolve(5);
/** @type {Promise} */
@@ -28,18 +39,24 @@ jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' im
/**
* @param {Promise} pr
+ ~~~~~~~
+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s).
* @return {Promise}
+ ~~~~~~~
+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s).
*/
function returnNotAnyPromise(pr) {
- ~~
-!!! error TS7006: Parameter 'pr' implicitly has an 'any' type.
return pr;
}
/** @type {Object} */
var notAnyObject = {valueOf: 1}; // error since assigning to Object, not any.
+ ~~~~~~~
+!!! error TS2322: Type 'number' is not assignable to type '() => Object'.
/** @type {Object} */
+ ~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2315: Type 'Object' is not generic.
var paramedObject = {valueOf: 1};
/**
@@ -47,8 +64,6 @@ jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' im
* @return {Object}
*/
function returnNotAnyObject(obj) {
- ~~~
-!!! error TS7006: Parameter 'obj' implicitly has an 'any' type.
return obj;
}
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.types b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.types
index 86c778286f..87eee09470 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.types
@@ -3,7 +3,7 @@
=== jsdocArrayObjectPromiseNoImplicitAny.js ===
/** @type {Array} */
var notAnyArray = [5];
->notAnyArray : number[]
+>notAnyArray : any
>[5] : number[]
>5 : 5
@@ -27,7 +27,7 @@ function returnNotAnyArray(arr) {
/** @type {Promise} */
var notAnyPromise = Promise.resolve(5);
->notAnyPromise : Promise
+>notAnyPromise : any
>Promise.resolve(5) : Promise
>Promise.resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; }
>Promise : PromiseConstructor
@@ -57,14 +57,14 @@ function returnNotAnyPromise(pr) {
/** @type {Object} */
var notAnyObject = {valueOf: 1}; // error since assigning to Object, not any.
->notAnyObject : { valueOf: number; }
+>notAnyObject : Object
>{valueOf: 1} : { valueOf: number; }
>valueOf : number
>1 : 1
/** @type {Object} */
var paramedObject = {valueOf: 1};
->paramedObject : { valueOf: number; }
+>paramedObject : any
>{valueOf: 1} : { valueOf: number; }
>valueOf : number
>1 : 1
@@ -74,10 +74,10 @@ var paramedObject = {valueOf: 1};
* @return {Object}
*/
function returnNotAnyObject(obj) {
->returnNotAnyObject : (obj: any) => any
->obj : any
+>returnNotAnyObject : (obj: Object) => Object
+>obj : Object
return obj;
->obj : any
+>obj : Object
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt
index 9697d6f2aa..d8a5fdf957 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt
@@ -1,7 +1,8 @@
index.js(12,14): error TS7006: Parameter 'arg' implicitly has an 'any' type.
+index.js(20,16): error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'.
-==== index.js (1 errors) ====
+==== index.js (2 errors) ====
/** @type () => string */
function fn1() {
return 42;
@@ -24,4 +25,7 @@ index.js(12,14): error TS7006: Parameter 'arg' implicitly has an 'any' type.
/** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */
const obj2 = { type: "other", prop: 10 };
+ ~~~~
+!!! error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'.
+!!! related TS6500 index.js:19:14: The expected type comes from property 'type' which is declared here on type '({ type: "foo"; } | { type: "bar"; }) & { prop: number; }'
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.types b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.types
index 3ac9df5434..7b33e57538 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.types
@@ -28,18 +28,18 @@ function fn3(arg) {
/** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */
const obj1 = { type: "foo", prop: 10 };
->obj1 : { type: string; prop: number; }
->{ type: "foo", prop: 10 } : { type: string; prop: number; }
->type : string
+>obj1 : ({ type: "foo"; } | { type: "bar"; }) & { prop: number; }
+>{ type: "foo", prop: 10 } : { type: "foo"; prop: number; }
+>type : "foo"
>"foo" : "foo"
>prop : number
>10 : 10
/** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */
const obj2 = { type: "other", prop: 10 };
->obj2 : { type: string; prop: number; }
->{ type: "other", prop: 10 } : { type: string; prop: number; }
->type : string
+>obj2 : ({ type: "foo"; } | { type: "bar"; }) & { prop: number; }
+>{ type: "other", prop: 10 } : { type: "other"; prop: number; }
+>type : "other"
>"other" : "other"
>prop : number
>10 : 10
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt
new file mode 100644
index 0000000000..79546958ff
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt
@@ -0,0 +1,15 @@
+/a.js(5,12): error TS2304: Cannot find name 'B'.
+
+
+==== /a.js (1 errors) ====
+ /**
+ * @template T
+ * @callback B
+ */
+ /** @type {B} */
+ ~
+!!! error TS2304: Cannot find name 'B'.
+ let b;
+ b();
+ b(1);
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.types b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.types
index bf983c11a3..c4f0ae9435 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.types
@@ -7,14 +7,14 @@
*/
/** @type {B} */
let b;
->b : any
+>b : B
b();
>b() : any
->b : any
+>b : B
b(1);
>b(1) : any
->b : any
+>b : B
>1 : 1
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt
index 6e095e3bd3..ae966c3990 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt
@@ -1,4 +1,4 @@
-/a.js(5,12): error TS7006: Parameter 'p' implicitly has an 'any' type.
+/a.js(4,13): error TS2314: Generic type 'C' requires 1 type argument(s).
==== /a.js (1 errors) ====
@@ -6,7 +6,7 @@
class C {}
/** @param {C} p */
+ ~
+!!! error TS2314: Generic type 'C' requires 1 type argument(s).
function f(p) {}
- ~
-!!! error TS7006: Parameter 'p' implicitly has an 'any' type.
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.types b/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.types
index b458dedce9..4ea043d906 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.types
@@ -3,7 +3,7 @@
=== /a.js ===
/** @template T */
class C {}
->C : C
+>C : C
/** @param {C} p */
function f(p) {}
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.errors.txt
index 1164ca5f46..eef47833f9 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.errors.txt
@@ -1,21 +1,15 @@
-/a.js(5,21): error TS7006: Parameter 'x' implicitly has an 'any' type.
-/a.js(5,24): error TS7006: Parameter 'y' implicitly has an 'any' type.
/a.js(6,11): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
/a.js(7,16): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
/a.js(9,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
/a.js(10,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
-==== /a.js (6 errors) ====
+==== /a.js (4 errors) ====
/**
* @param {number | undefined} x
* @param {number | undefined} y
*/
export function Foo(x, y) {
- ~
-!!! error TS7006: Parameter 'x' implicitly has an 'any' type.
- ~
-!!! error TS7006: Parameter 'y' implicitly has an 'any' type.
if (!(this instanceof Foo)) {
~~~~
!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.types b/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.types
index 63a9c61048..a39bf86359 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.types
@@ -6,35 +6,35 @@
* @param {number | undefined} y
*/
export function Foo(x, y) {
->Foo : (x: any, y: any) => any
->x : any
->y : any
+>Foo : (x: number | undefined, y: number | undefined) => any
+>x : number | undefined
+>y : number | undefined
if (!(this instanceof Foo)) {
>!(this instanceof Foo) : boolean
>(this instanceof Foo) : boolean
>this instanceof Foo : boolean
>this : any
->Foo : (x: any, y: any) => any
+>Foo : (x: number | undefined, y: number | undefined) => any
return new Foo(x, y);
>new Foo(x, y) : any
->Foo : (x: any, y: any) => any
->x : any
->y : any
+>Foo : (x: number | undefined, y: number | undefined) => any
+>x : number | undefined
+>y : number | undefined
}
this.x = x;
->this.x = x : any
+>this.x = x : number | undefined
>this.x : any
>this : any
>x : any
->x : any
+>x : number | undefined
this.y = y;
->this.y = y : any
+>this.y = y : number | undefined
>this.y : any
>this : any
>y : any
->y : any
+>y : number | undefined
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt
new file mode 100644
index 0000000000..4147bce1d5
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt
@@ -0,0 +1,9 @@
+/a.js(1,13): error TS1098: Type parameter list cannot be empty.
+
+
+==== /a.js (1 errors) ====
+ /** @param {<} x */
+ ~~
+!!! error TS1098: Type parameter list cannot be empty.
+ function f(x) {}
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.types b/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.types
index 6c6737f256..022619f274 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.types
@@ -3,6 +3,6 @@
=== /a.js ===
/** @param {<} x */
function f(x) {}
->f : (x: any) => void
->x : any
+>f : (x: () => any) => void
+>x : () => any
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt
new file mode 100644
index 0000000000..018ec07e52
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt
@@ -0,0 +1,18 @@
+/a.js(2,9): error TS1092: Type parameters cannot appear on a constructor declaration.
+/a.js(6,18): error TS1093: Type annotation cannot appear on a constructor declaration.
+
+
+==== /a.js (2 errors) ====
+ class C {
+ /** @template T */
+ ~~~~~~~~~~~~
+!!! error TS1092: Type parameters cannot appear on a constructor declaration.
+ constructor() { }
+ }
+ class D {
+ /** @return {number} */
+ ~~~~~~
+!!! error TS1093: Type annotation cannot appear on a constructor declaration.
+ constructor() {}
+ }
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.errors.txt
new file mode 100644
index 0000000000..ba53f8f4d7
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.errors.txt
@@ -0,0 +1,16 @@
+Main.js(2,49): error TS2694: Namespace '"GeometryType"' has no exported member 'default'.
+
+
+==== GeometryType.d.ts (0 errors) ====
+ declare namespace _default {
+ export const POINT: string;
+ }
+ export default _default;
+
+==== Main.js (1 errors) ====
+ export default function () {
+ return /** @type {import('./GeometryType.js').default} */ ('Point');
+ ~~~~~~~
+!!! error TS2694: Namespace '"GeometryType"' has no exported member 'default'.
+ }
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.types b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.types
index 61a78c7d38..c851fa7232 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.types
@@ -13,7 +13,8 @@ export default _default;
=== Main.js ===
export default function () {
return /** @type {import('./GeometryType.js').default} */ ('Point');
->('Point') : "Point"
+>('Point') : any
+>'Point' : any
>'Point' : "Point"
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.types b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.types
index 71d6a2daa6..5dfcd2bb11 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.types
@@ -12,5 +12,5 @@ export class MyClass {
*/
/** @type {options} */
let v;
->v : any
+>v : options
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.errors.txt
deleted file mode 100644
index e65be0d9ba..0000000000
--- a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.errors.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-/a.js(3,9): error TS7006: Parameter 'x' implicitly has an 'any' type.
-
-
-==== /a.js (1 errors) ====
- class Foo {
- /**@param {string} x */
- m = x => x.toLowerCase();
- ~
-!!! error TS7006: Parameter 'x' implicitly has an 'any' type.
- }
-
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols
index 45e5696a1a..8e62ab992a 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols
+++ b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols
@@ -8,6 +8,8 @@ class Foo {
m = x => x.toLowerCase();
>m : Symbol(m, Decl(a.js, 0, 11))
>x : Symbol(x, Decl(a.js, 2, 7))
+>x.toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(a.js, 2, 7))
+>toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --))
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff
index 9d7a20e19d..da85b80884 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff
+++ b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff
@@ -8,7 +8,9 @@
+>m : Symbol(m, Decl(a.js, 0, 11))
>x : Symbol(x, Decl(a.js, 2, 7))
->x.toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --))
++>x.toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(a.js, 2, 7))
->toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --))
++>toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --))
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.types b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.types
index f70e8dc78c..9602588f55 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.types
@@ -6,12 +6,12 @@ class Foo {
/**@param {string} x */
m = x => x.toLowerCase();
->m : (x: any) => any
->x => x.toLowerCase() : (x: any) => any
->x : any
->x.toLowerCase() : any
->x.toLowerCase : any
->x : any
->toLowerCase : any
+>m : (x: string) => string
+>x => x.toLowerCase() : (x: string) => string
+>x : string
+>x.toLowerCase() : string
+>x.toLowerCase : () => string
+>x : string
+>toLowerCase : () => string
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt
new file mode 100644
index 0000000000..1b0b2a8cd2
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt
@@ -0,0 +1,12 @@
+example.js(3,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+
+
+==== example.js (1 errors) ====
+ // @ts-check
+ /**
+ * @type {function(@foo)}
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
+ */
+ let x;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.types b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.types
index 314873b882..3d6f8823f8 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.types
@@ -6,5 +6,5 @@
* @type {function(@foo)}
*/
let x;
->x : any
+>x : function
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.types b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.types
index 597373ce56..53f50b7fe4 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.types
@@ -8,16 +8,16 @@
/** @param {MyType} p */
export function f(p) { }
->f : (p: any) => void
->p : any
+>f : (p: MyType) => void
+>p : MyType
=== /b.js ===
import { f } from "./a.js"
->f : (p: any) => void
+>f : (p: MyType) => void
f({ x: 42 })
>f({ x: 42 }) : void
->f : (p: any) => void
+>f : (p: MyType) => void
>{ x: 42 } : { x: number; }
>x : number
>42 : 42
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocReferenceGlobalTypeInCommonJs.types b/testdata/baselines/reference/submodule/compiler/jsdocReferenceGlobalTypeInCommonJs.types
index 8300ebe55f..8df103b0e1 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocReferenceGlobalTypeInCommonJs.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocReferenceGlobalTypeInCommonJs.types
@@ -9,7 +9,7 @@ const other = require('./other');
/** @type {Puppeteer.Keyboard} */
var ppk;
->ppk : any
+>ppk : Keyboard
Puppeteer.connect;
>Puppeteer.connect : (name: string) => void
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt
new file mode 100644
index 0000000000..6c3a675c1e
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt
@@ -0,0 +1,15 @@
+/a.js(2,12): error TS2304: Cannot find name 'Ty'.
+
+
+==== /a.js (1 errors) ====
+ /**
+ * @param {Ty} x
+ ~~
+!!! error TS2304: Cannot find name 'Ty'.
+ */
+ function f(x) {}
+
+ /**
+ * @typedef {CantResolveThis} Ty
+ */
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.types b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.types
index 901d06a344..475bea13be 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.types
@@ -5,8 +5,8 @@
* @param {Ty} x
*/
function f(x) {}
->f : (x: any) => void
->x : any
+>f : (x: Ty) => void
+>x : Ty
/**
* @typedef {CantResolveThis} Ty
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.errors.txt
index 9d767c9949..40e75b1fda 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.errors.txt
@@ -1,13 +1,10 @@
-/a.js(2,12): error TS7006: Parameter 'a' implicitly has an 'any' type.
/a.js(8,6): error TS2554: Expected 1 arguments, but got 2.
/a.js(9,6): error TS2554: Expected 1 arguments, but got 2.
-==== /a.js (3 errors) ====
+==== /a.js (2 errors) ====
/** @param {...number} a */
function f(a) {
- ~
-!!! error TS7006: Parameter 'a' implicitly has an 'any' type.
a; // number | undefined
// Ideally this would be a number. But currently checker.ts has only one `argumentsSymbol`, so it's `any`.
arguments[0];
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.types b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.types
index d9826557ab..21e6295150 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.types
@@ -3,11 +3,11 @@
=== /a.js ===
/** @param {...number} a */
function f(a) {
->f : (a: any) => void
->a : any
+>f : (a: number[]) => void
+>a : number[]
a; // number | undefined
->a : any
+>a : number[]
// Ideally this would be a number. But currently checker.ts has only one `argumentsSymbol`, so it's `any`.
arguments[0];
@@ -17,20 +17,20 @@ function f(a) {
}
f([1, 2]); // Error
>f([1, 2]) : void
->f : (a: any) => void
+>f : (a: number[]) => void
>[1, 2] : number[]
>1 : 1
>2 : 2
f(1, "2"); // Error
>f(1, "2") : void
->f : (a: any) => void
+>f : (a: number[]) => void
>1 : 1
>"2" : "2"
f(1, 2);
>f(1, 2) : void
->f : (a: any) => void
+>f : (a: number[]) => void
>1 : 1
>2 : 2
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.errors.txt
deleted file mode 100644
index 1b9bff4e55..0000000000
--- a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.errors.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-/a.js(2,12): error TS7019: Rest parameter 'a' implicitly has an 'any[]' type.
-
-
-==== /a.js (1 errors) ====
- /** @param {...number} a */
- function f(...a) {
- ~~~~
-!!! error TS7019: Rest parameter 'a' implicitly has an 'any[]' type.
- a; // number[]
- }
-
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.types b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.types
index cd5374a8c5..f452668a53 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.types
@@ -3,10 +3,10 @@
=== /a.js ===
/** @param {...number} a */
function f(...a) {
->f : (...a: any[]) => void
->a : any[]
+>f : (...a: number[]) => void
+>a : number[]
a; // number[]
->a : any[]
+>a : number[]
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt
new file mode 100644
index 0000000000..c104964181
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt
@@ -0,0 +1,26 @@
+jsdocTypeCast.js(6,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'.
+jsdocTypeCast.js(10,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'.
+
+
+==== jsdocTypeCast.js (2 errors) ====
+ /**
+ * @param {string} x
+ */
+ function f(x) {
+ /** @type {'a' | 'b'} */
+ let a = (x); // Error
+ ~
+!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'.
+ a;
+
+ /** @type {'a' | 'b'} */
+ let b = (((x))); // Error
+ ~
+!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'.
+ b;
+
+ /** @type {'a' | 'b'} */
+ let c = /** @type {'a' | 'b'} */ (x); // Ok
+ c;
+ }
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.types b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.types
index 7a4cf5b041..1ba298ee22 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.types
@@ -5,36 +5,37 @@
* @param {string} x
*/
function f(x) {
->f : (x: any) => void
->x : any
+>f : (x: string) => void
+>x : string
/** @type {'a' | 'b'} */
let a = (x); // Error
->a : any
->(x) : any
->x : any
+>a : "a" | "b"
+>(x) : string
+>x : string
a;
->a : any
+>a : "a" | "b"
/** @type {'a' | 'b'} */
let b = (((x))); // Error
->b : any
->(((x))) : any
->((x)) : any
->(x) : any
->x : any
+>b : "a" | "b"
+>(((x))) : string
+>((x)) : string
+>(x) : string
+>x : string
b;
->b : any
+>b : "a" | "b"
/** @type {'a' | 'b'} */
let c = /** @type {'a' | 'b'} */ (x); // Ok
->c : any
->(x) : any
->x : any
+>c : "a" | "b"
+>(x) : "a" | "b"
+>x : "a" | "b"
+>x : string
c;
->c : any
+>c : "a" | "b"
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeGenericInstantiationAttempt.types b/testdata/baselines/reference/submodule/compiler/jsdocTypeGenericInstantiationAttempt.types
index e3a8cd07d7..e4bf7c2750 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocTypeGenericInstantiationAttempt.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeGenericInstantiationAttempt.types
@@ -5,10 +5,10 @@
* @param {Array<*>} list
*/
function thing(list) {
->thing : (list: any) => any
->list : any
+>thing : (list: any[]) => any[]
+>list : any[]
return list;
->list : any
+>list : any[]
}
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt
new file mode 100644
index 0000000000..2bb4e07c0e
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt
@@ -0,0 +1,118 @@
+index.js(2,19): error TS2315: Type 'Boolean' is not generic.
+index.js(2,27): error TS2304: Cannot find name 'T'.
+index2.js(2,19): error TS2304: Cannot find name 'Void'.
+index2.js(2,24): error TS2304: Cannot find name 'T'.
+index3.js(2,19): error TS2304: Cannot find name 'Undefined'.
+index3.js(2,29): error TS2304: Cannot find name 'T'.
+index4.js(2,19): error TS2315: Type 'Function' is not generic.
+index4.js(2,28): error TS2304: Cannot find name 'T'.
+index5.js(2,19): error TS2315: Type 'String' is not generic.
+index5.js(2,26): error TS2304: Cannot find name 'T'.
+index6.js(2,19): error TS2315: Type 'Number' is not generic.
+index6.js(2,26): error TS2304: Cannot find name 'T'.
+index7.js(2,19): error TS2315: Type 'Object' is not generic.
+index7.js(2,26): error TS2304: Cannot find name 'T'.
+index8.js(4,12): error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'?
+index8.js(4,15): error TS2304: Cannot find name 'T'.
+
+
+==== index.js (2 errors) ====
+ /**
+ * @param {(m: Boolean) => string} somebody
+ ~~~~~~~~~~
+!!! error TS2315: Type 'Boolean' is not generic.
+ ~
+!!! error TS2304: Cannot find name 'T'.
+ */
+ function sayHello(somebody) {
+ return 'Hello ' + somebody;
+ }
+
+==== index2.js (2 errors) ====
+ /**
+ * @param {(m: Void) => string} somebody
+ ~~~~
+!!! error TS2304: Cannot find name 'Void'.
+ ~
+!!! error TS2304: Cannot find name 'T'.
+ */
+ function sayHello2(somebody) {
+ return 'Hello ' + somebody;
+ }
+
+
+==== index3.js (2 errors) ====
+ /**
+ * @param {(m: Undefined) => string} somebody
+ ~~~~~~~~~
+!!! error TS2304: Cannot find name 'Undefined'.
+ ~
+!!! error TS2304: Cannot find name 'T'.
+ */
+ function sayHello3(somebody) {
+ return 'Hello ' + somebody;
+ }
+
+
+==== index4.js (2 errors) ====
+ /**
+ * @param {(m: Function) => string} somebody
+ ~~~~~~~~~~~
+!!! error TS2315: Type 'Function' is not generic.
+ ~
+!!! error TS2304: Cannot find name 'T'.
+ */
+ function sayHello4(somebody) {
+ return 'Hello ' + somebody;
+ }
+
+
+==== index5.js (2 errors) ====
+ /**
+ * @param {(m: String) => string} somebody
+ ~~~~~~~~~
+!!! error TS2315: Type 'String' is not generic.
+ ~
+!!! error TS2304: Cannot find name 'T'.
+ */
+ function sayHello5(somebody) {
+ return 'Hello ' + somebody;
+ }
+
+
+==== index6.js (2 errors) ====
+ /**
+ * @param {(m: Number) => string} somebody
+ ~~~~~~~~~
+!!! error TS2315: Type 'Number' is not generic.
+ ~
+!!! error TS2304: Cannot find name 'T'.
+ */
+ function sayHello6(somebody) {
+ return 'Hello ' + somebody;
+ }
+
+
+==== index7.js (2 errors) ====
+ /**
+ * @param {(m: Object) => string} somebody
+ ~~~~~~~~~
+!!! error TS2315: Type 'Object' is not generic.
+ ~
+!!! error TS2304: Cannot find name 'T'.
+ */
+ function sayHello7(somebody) {
+ return 'Hello ' + somebody;
+ }
+
+==== index8.js (2 errors) ====
+ function fn() {}
+
+ /**
+ * @param {fn} somebody
+ ~~
+!!! error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'?
+ ~
+!!! error TS2304: Cannot find name 'T'.
+ */
+ function sayHello8(somebody) { }
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.types b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.types
index 946d5fc1c8..1783c242b0 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.types
@@ -5,13 +5,13 @@
* @param {(m: Boolean) => string} somebody
*/
function sayHello(somebody) {
->sayHello : (somebody: any) => string
->somebody : any
+>sayHello : (somebody: (m: any) => string) => string
+>somebody : (m: any) => string
return 'Hello ' + somebody;
>'Hello ' + somebody : string
>'Hello ' : "Hello "
->somebody : any
+>somebody : (m: any) => string
}
=== index2.js ===
@@ -19,13 +19,13 @@ function sayHello(somebody) {
* @param {(m: Void) => string} somebody
*/
function sayHello2(somebody) {
->sayHello2 : (somebody: any) => string
->somebody : any
+>sayHello2 : (somebody: (m: Void) => string) => string
+>somebody : (m: Void) => string
return 'Hello ' + somebody;
>'Hello ' + somebody : string
>'Hello ' : "Hello "
->somebody : any
+>somebody : (m: Void) => string
}
@@ -34,13 +34,13 @@ function sayHello2(somebody) {
* @param {(m: Undefined) => string} somebody
*/
function sayHello3(somebody) {
->sayHello3 : (somebody: any) => string
->somebody : any
+>sayHello3 : (somebody: (m: Undefined) => string) => string
+>somebody : (m: Undefined) => string
return 'Hello ' + somebody;
>'Hello ' + somebody : string
>'Hello ' : "Hello "
->somebody : any
+>somebody : (m: Undefined) => string
}
@@ -49,13 +49,13 @@ function sayHello3(somebody) {
* @param {(m: Function) => string} somebody
*/
function sayHello4(somebody) {
->sayHello4 : (somebody: any) => string
->somebody : any
+>sayHello4 : (somebody: (m: any) => string) => string
+>somebody : (m: any) => string
return 'Hello ' + somebody;
>'Hello ' + somebody : string
>'Hello ' : "Hello "
->somebody : any
+>somebody : (m: any) => string
}
@@ -64,13 +64,13 @@ function sayHello4(somebody) {
* @param {(m: String) => string} somebody
*/
function sayHello5(somebody) {
->sayHello5 : (somebody: any) => string
->somebody : any
+>sayHello5 : (somebody: (m: any) => string) => string
+>somebody : (m: any) => string
return 'Hello ' + somebody;
>'Hello ' + somebody : string
>'Hello ' : "Hello "
->somebody : any
+>somebody : (m: any) => string
}
@@ -79,13 +79,13 @@ function sayHello5(somebody) {
* @param {(m: Number) => string} somebody
*/
function sayHello6(somebody) {
->sayHello6 : (somebody: any) => string
->somebody : any
+>sayHello6 : (somebody: (m: any) => string) => string
+>somebody : (m: any) => string
return 'Hello ' + somebody;
>'Hello ' + somebody : string
>'Hello ' : "Hello "
->somebody : any
+>somebody : (m: any) => string
}
@@ -94,13 +94,13 @@ function sayHello6(somebody) {
* @param {(m: Object) => string} somebody
*/
function sayHello7(somebody) {
->sayHello7 : (somebody: any) => string
->somebody : any
+>sayHello7 : (somebody: (m: any) => string) => string
+>somebody : (m: any) => string
return 'Hello ' + somebody;
>'Hello ' + somebody : string
>'Hello ' : "Hello "
->somebody : any
+>somebody : (m: any) => string
}
=== index8.js ===
@@ -111,6 +111,6 @@ function fn() {}
* @param {fn} somebody
*/
function sayHello8(somebody) { }
->sayHello8 : (somebody: any) => void
->somebody : any
+>sayHello8 : (somebody: fn) => void
+>somebody : fn
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.types b/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.types
index 0e21514ee4..6a018ffbb1 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.types
@@ -27,7 +27,7 @@
* @param b {AlsoNotADuplicate}
*/
function makeSureTypedefsAreStillRecognized(a, b) {}
->makeSureTypedefsAreStillRecognized : (a: any, b: any) => void
->a : any
->b : any
+>makeSureTypedefsAreStillRecognized : (a: number, b: number) => void
+>a : number
+>b : number
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.types b/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.types
index 71b185202a..f011988191 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.types
@@ -16,7 +16,7 @@ const t = 0;
/** @type Person */
const person = { name: "" };
->person : { name: string; }
+>person : Person
>{ name: "" } : { name: string; }
>name : string
>"" : ""
diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.types b/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.types
index d82a1e6fd1..3b56be2744 100644
--- a/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.types
+++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.types
@@ -8,7 +8,7 @@
/** @type {Foo} */
const x = { foo: 0 };
->x : { foo: number; }
+>x : Foo
>{ foo: 0 } : { foo: number; }
>foo : number
>0 : 0
diff --git a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.errors.txt b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.errors.txt
index de941a86d5..3f08e2966f 100644
--- a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.errors.txt
@@ -1,14 +1,17 @@
a.js(2,11): error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'.
+a.js(4,48): error TS2304: Cannot find name 'B'.
a.js(5,11): error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'.
-==== a.js (2 errors) ====
+==== a.js (3 errors) ====
/** @typedef {{ endTime: number, screenshots: number}} A.*/
Animation.AnimationModel.ScreenshotCapture.Request;
~~~~~~~~~~~~~~
!!! error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'.
/** @typedef {{ endTime: number, screenshots: !B.}} */
+ ~
+!!! error TS2304: Cannot find name 'B'.
Animation.AnimationModel.ScreenshotCapture.Request;
~~~~~~~~~~~~~~
!!! error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'.
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt
deleted file mode 100644
index ebff087957..0000000000
--- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-index.js(8,26): error TS7006: Parameter 'key' implicitly has an 'any' type.
-
-
-==== index.js (1 errors) ====
- /** @type {Map>} */
- const cache = new Map()
-
- /**
- * @param {string} key
- * @returns {() => string}
- */
- const getStringGetter = (key) => {
- ~~~
-!!! error TS7006: Parameter 'key' implicitly has an 'any' type.
- return () => {
- return /** @type {string} */ (cache.get(key))
- }
- }
-
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.types b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.types
index fa1dd127ea..ad819605f9 100644
--- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.types
+++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.types
@@ -3,7 +3,7 @@
=== index.js ===
/** @type {Map>} */
const cache = new Map()
->cache : Map
+>cache : Map>
>new Map() : Map
>Map : MapConstructor
@@ -12,20 +12,21 @@ const cache = new Map()
* @returns {() => string}
*/
const getStringGetter = (key) => {
->getStringGetter : (key: any) => () => any
->(key) => { return () => { return /** @type {string} */ (cache.get(key)) }} : (key: any) => () => any
->key : any
+>getStringGetter : (key: string) => () => string
+>(key) => { return () => { return /** @type {string} */ (cache.get(key)) }} : (key: string) => () => string
+>key : string
return () => {
->() => { return /** @type {string} */ (cache.get(key)) } : () => any
+>() => { return /** @type {string} */ (cache.get(key)) } : () => string
return /** @type {string} */ (cache.get(key))
->(cache.get(key)) : any
->cache.get(key) : any
->cache.get : (key: any) => any
->cache : Map
->get : (key: any) => any
->key : any
+>(cache.get(key)) : string
+>cache.get(key) : string
+>cache.get(key) : string | Set | undefined
+>cache.get : (key: string) => string | Set | undefined
+>cache : Map>
+>get : (key: string) => string | Set | undefined
+>key : string
}
}
diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.errors.txt b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.errors.txt
new file mode 100644
index 0000000000..c50bcf83c9
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.errors.txt
@@ -0,0 +1,22 @@
+index.js(12,8): error TS2678: Type '"invalid"' is not comparable to type '"bar" | "foo"'.
+
+
+==== index.js (1 errors) ====
+ let value = "";
+
+ switch (/** @type {"foo" | "bar"} */ (value)) {
+ case "bar":
+ value;
+ break;
+
+ case "foo":
+ value;
+ break;
+
+ case "invalid":
+ ~~~~~~~~~
+!!! error TS2678: Type '"invalid"' is not comparable to type '"bar" | "foo"'.
+ value;
+ break;
+ }
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.types b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.types
index 6b4d950d51..fd2f5c031c 100644
--- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.types
+++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.types
@@ -6,14 +6,15 @@ let value = "";
>"" : ""
switch (/** @type {"foo" | "bar"} */ (value)) {
->(value) : string
+>(value) : "bar" | "foo"
+>value : "bar" | "foo"
>value : string
case "bar":
>"bar" : "bar"
value;
->value : "bar"
+>value : string
break;
@@ -21,7 +22,7 @@ switch (/** @type {"foo" | "bar"} */ (value)) {
>"foo" : "foo"
value;
->value : "foo"
+>value : string
break;
@@ -29,7 +30,7 @@ switch (/** @type {"foo" | "bar"} */ (value)) {
>"invalid" : "invalid"
value;
->value : "invalid"
+>value : string
break;
}
diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols
index e68a2c1803..4d4e83f4f4 100644
--- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols
+++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols
@@ -12,7 +12,9 @@ const json1 = require("./json.json"); // No error (bad)
>json1 : Symbol(json1, Decl(user.js, 4, 5))
json1.b; // No error (OK since that's the type annotation)
+>json1.b : Symbol(b, Decl(user.js, 3, 12))
>json1 : Symbol(json1, Decl(user.js, 4, 5))
+>b : Symbol(b, Decl(user.js, 3, 12))
const js0 = require("./js.js");
>js0 : Symbol(js0, Decl(user.js, 7, 5))
@@ -25,7 +27,9 @@ const js1 = require("./js.js"); // Error (good)
>js1 : Symbol(js1, Decl(user.js, 11, 5))
js1.b;
+>js1.b : Symbol(b, Decl(user.js, 10, 12))
>js1 : Symbol(js1, Decl(user.js, 11, 5))
+>b : Symbol(b, Decl(user.js, 10, 12))
=== /json.json ===
{ "a": 0 }
diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff
index 4a853f1c3a..99b69ac56e 100644
--- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff
+++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff
@@ -17,9 +17,8 @@
->"./json.json" : Symbol("/json", Decl(json.json, 0, 0))
json1.b; // No error (OK since that's the type annotation)
-->json1.b : Symbol(b, Decl(user.js, 3, 12))
- >json1 : Symbol(json1, Decl(user.js, 4, 5))
-->b : Symbol(b, Decl(user.js, 3, 12))
+ >json1.b : Symbol(b, Decl(user.js, 3, 12))
+@@= skipped -10, +8 lines =@@
const js0 = require("./js.js");
>js0 : Symbol(js0, Decl(user.js, 7, 5))
@@ -28,7 +27,7 @@
json0.b; // Error (good)
>json0 : Symbol(json0, Decl(user.js, 0, 5))
-@@= skipped -19, +13 lines =@@
+@@= skipped -9, +7 lines =@@
/** @type {{ b: number }} */
const js1 = require("./js.js"); // Error (good)
>js1 : Symbol(js1, Decl(user.js, 11, 5))
@@ -36,9 +35,8 @@
->"./js.js" : Symbol("/js", Decl(js.js, 0, 0))
js1.b;
-->js1.b : Symbol(b, Decl(user.js, 10, 12))
- >js1 : Symbol(js1, Decl(user.js, 11, 5))
-->b : Symbol(b, Decl(user.js, 10, 12))
+ >js1.b : Symbol(b, Decl(user.js, 10, 12))
+@@= skipped -10, +8 lines =@@
=== /json.json ===
{ "a": 0 }
diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types
index af498ff59b..4afa7dc442 100644
--- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types
+++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types
@@ -14,15 +14,15 @@ json0.b; // Error (good)
/** @type {{ b: number }} */
const json1 = require("./json.json"); // No error (bad)
->json1 : any
+>json1 : { b: number; }
>require("./json.json") : any
>require : any
>"./json.json" : "./json.json"
json1.b; // No error (OK since that's the type annotation)
->json1.b : any
->json1 : any
->b : any
+>json1.b : number
+>json1 : { b: number; }
+>b : number
const js0 = require("./js.js");
>js0 : any
@@ -37,15 +37,15 @@ json0.b; // Error (good)
/** @type {{ b: number }} */
const js1 = require("./js.js"); // Error (good)
->js1 : any
+>js1 : { b: number; }
>require("./js.js") : any
>require : any
>"./js.js" : "./js.js"
js1.b;
->js1.b : any
->js1 : any
->b : any
+>js1.b : number
+>js1 : { b: number; }
+>b : number
=== /json.json ===
{ "a": 0 }
diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt
new file mode 100644
index 0000000000..ae46bda792
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt
@@ -0,0 +1,25 @@
+a.js(14,7): error TS2375: Type '{ value: undefined; }' is not assignable to type '{ value?: number; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
+ Types of property 'value' are incompatible.
+ Type 'undefined' is not assignable to type 'number'.
+
+
+==== a.js (1 errors) ====
+ /**
+ * @typedef {object} A
+ * @property {number} [value]
+ */
+
+ /** @type {A} */
+ const a = { value: undefined }; // error
+
+ /**
+ * @typedef {{ value?: number }} B
+ */
+
+ /** @type {B} */
+ const b = { value: undefined }; // error
+ ~
+!!! error TS2375: Type '{ value: undefined; }' is not assignable to type '{ value?: number; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
+!!! error TS2375: Types of property 'value' are incompatible.
+!!! error TS2375: Type 'undefined' is not assignable to type 'number'.
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types
index 2eb9d12c85..72d35c1e04 100644
--- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types
+++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types
@@ -8,7 +8,7 @@
/** @type {A} */
const a = { value: undefined }; // error
->a : { value: undefined; }
+>a : A
>{ value: undefined } : { value: undefined; }
>value : undefined
>undefined : undefined
@@ -19,7 +19,7 @@ const a = { value: undefined }; // error
/** @type {B} */
const b = { value: undefined }; // error
->b : { value: undefined; }
+>b : { value?: number; }
>{ value: undefined } : { value: undefined; }
>value : undefined
>undefined : undefined
diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.errors.txt b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.errors.txt
deleted file mode 100644
index 768549149e..0000000000
--- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.errors.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-a.js(7,3): error TS2339: Property 'foo' does not exist on type '{}'.
-a.js(10,3): error TS2339: Property 'foo' does not exist on type '{}'.
-
-
-==== a.js (2 errors) ====
- /**
- * @typedef Foo
- * @property {number} [foo]
- */
-
- const x = /** @type {Foo} */ ({});
- x.foo; // number | undefined
- ~~~
-!!! error TS2339: Property 'foo' does not exist on type '{}'.
-
- const y = /** @type {Required} */ ({});
- y.foo; // number
- ~~~
-!!! error TS2339: Property 'foo' does not exist on type '{}'.
-
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols
index 1499abdaf5..f048b853b5 100644
--- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols
+++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols
@@ -10,11 +10,15 @@ const x = /** @type {Foo} */ ({});
>x : Symbol(x, Decl(a.js, 5, 5))
x.foo; // number | undefined
+>x.foo : Symbol(foo, Decl(a.js, 2, 3))
>x : Symbol(x, Decl(a.js, 5, 5))
+>foo : Symbol(foo, Decl(a.js, 2, 3))
const y = /** @type {Required} */ ({});
>y : Symbol(y, Decl(a.js, 8, 5))
y.foo; // number
+>y.foo : Symbol(foo, Decl(a.js, 2, 3))
>y : Symbol(y, Decl(a.js, 8, 5))
+>foo : Symbol(foo, Decl(a.js, 2, 3))
diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff
deleted file mode 100644
index 4be70e1063..0000000000
--- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff
+++ /dev/null
@@ -1,18 +0,0 @@
---- old.strictOptionalProperties4.symbols
-+++ new.strictOptionalProperties4.symbols
-@@= skipped -9, +9 lines =@@
- >x : Symbol(x, Decl(a.js, 5, 5))
-
- x.foo; // number | undefined
-->x.foo : Symbol(foo, Decl(a.js, 2, 3))
- >x : Symbol(x, Decl(a.js, 5, 5))
-->foo : Symbol(foo, Decl(a.js, 2, 3))
-
- const y = /** @type {Required} */ ({});
- >y : Symbol(y, Decl(a.js, 8, 5))
-
- y.foo; // number
-->y.foo : Symbol(foo, Decl(a.js, 2, 3))
- >y : Symbol(y, Decl(a.js, 8, 5))
-->foo : Symbol(foo, Decl(a.js, 2, 3))
-
diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types
index 9063ffd4a2..1773918b3c 100644
--- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types
+++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types
@@ -7,22 +7,24 @@
*/
const x = /** @type {Foo} */ ({});
->x : {}
->({}) : {}
+>x : Foo
+>({}) : Foo
+>{} : Foo
>{} : {}
x.foo; // number | undefined
>x.foo : any
->x : {}
+>x : Foo
>foo : any
const y = /** @type {Required} */ ({});
->y : {}
->({}) : {}
+>y : Required
+>({}) : Required
+>{} : Required
>{} : {}
y.foo; // number
>y.foo : any
->y : {}
+>y : Required
>foo : any
diff --git a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt
index 222af3b09f..e97bdfb5ac 100644
--- a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt
@@ -1,3 +1,5 @@
+file1.js(2,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent'.
+ Index signature for type 'number' is missing in type 'C'.
tile1.ts(2,30): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'.
tile1.ts(6,81): error TS2744: Type parameter defaults can only reference previously declared type parameters.
tile1.ts(11,40): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'.
@@ -56,7 +58,10 @@ tile1.ts(24,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent
~~~~~
!!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'.
!!! error TS2322: Index signature for type 'number' is missing in type 'C'.
-==== file1.js (0 errors) ====
+==== file1.js (1 errors) ====
/** @type {ClassComponent} */
const test9 = new C();
+ ~~~~~
+!!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'.
+!!! error TS2322: Index signature for type 'number' is missing in type 'C'.
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.types b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.types
index d222d06700..a444bdcca5 100644
--- a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.types
+++ b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.types
@@ -52,7 +52,7 @@ const test8: ClassComponent = new C();
=== file1.js ===
/** @type {ClassComponent} */
const test9 = new C();
->test9 : C
+>test9 : ClassComponent
>new C() : C
>C : typeof C
diff --git a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable02.types b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable02.types
index d2920b1889..146ad274af 100644
--- a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable02.types
+++ b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable02.types
@@ -57,7 +57,7 @@ const test8: ClassComponent = new C();
=== file1.js ===
/** @type {ClassComponent} */
const test9 = new C();
->test9 : C
+>test9 : ClassComponent
>new C() : C
>C : typeof C
diff --git a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.types b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.types
index 70ff3c3075..04cb4fe45a 100644
--- a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.types
+++ b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.types
@@ -56,8 +56,8 @@ interface Person {
* @param {Human} param used as a validation tool
*/
function doHumanThings(param) {}
->doHumanThings : (param: any) => void
->param : any
+>doHumanThings : (param: Human) => void
+>param : Human
const dice1 = () => Math.floor(Math.random() * 6);
>dice1 : { (): number; last: string; }
@@ -115,7 +115,7 @@ dice1.last = 'Calrissian';
doHumanThings(dice2)
>doHumanThings(dice2) : void
->doHumanThings : (param: any) => void
+>doHumanThings : (param: Human) => void
>dice2 : { (): number; first: string; last: string; }
}
diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInJSDoc.types b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInJSDoc.types
index 815c6a477a..363466c2f6 100644
--- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInJSDoc.types
+++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInJSDoc.types
@@ -6,18 +6,18 @@
* @param {number} a\u0061
*/
function foo(a, aa) {
->foo : (a: any, aa: any) => void
->a : any
->aa : any
+>foo : (a: number, aa: number) => void
+>a : number
+>aa : number
console.log(a + aa);
>console.log(a + aa) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
->a + aa : any
->a : any
->aa : any
+>a + aa : number
+>a : number
+>aa : number
}
/**
@@ -25,17 +25,17 @@ function foo(a, aa) {
* @param {number} a\u{0061}
*/
function bar(a, aa) {
->bar : (a: any, aa: any) => void
->a : any
->aa : any
+>bar : (a: number, aa: number) => void
+>a : number
+>aa : number
console.log(a + aa);
>console.log(a + aa) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
->a + aa : any
->a : any
->aa : any
+>a + aa : number
+>a : number
+>aa : number
}
diff --git a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt
new file mode 100644
index 0000000000..9e2a2f66c8
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt
@@ -0,0 +1,19 @@
+file1.js(3,21): error TS2304: Cannot find name 'T'.
+
+
+==== file1.js (1 errors) ====
+ /**
+ * @template {string} T
+ * @typedef {{ foo: T }} Foo
+ ~
+!!! error TS2304: Cannot find name 'T'.
+ */
+
+ export default {};
+
+==== file2.js (0 errors) ====
+ /**
+ * @template T
+ * @typedef {import('./file1').Foo} Bar
+ */
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.errors.txt b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.errors.txt
new file mode 100644
index 0000000000..cfd276ebcd
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.errors.txt
@@ -0,0 +1,9 @@
+/a.js(1,15): error TS6196: 'T' is declared but never used.
+
+
+==== /a.js (1 errors) ====
+ /** @template T */
+ ~
+!!! error TS6196: 'T' is declared but never used.
+ function f() {}
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.types b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.types
index 5e8dabf8aa..9123dc4771 100644
--- a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.types
+++ b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.types
@@ -3,5 +3,5 @@
=== /a.js ===
/** @template T */
function f() {}
->f : () => void
+>f : () => void
diff --git a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.errors.txt b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.errors.txt
index 4ba937de21..941b063cbf 100644
--- a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.errors.txt
@@ -1,36 +1,49 @@
-/a.js(8,14): error TS2339: Property 'p' does not exist on type 'C1'.
-/a.js(25,14): error TS2339: Property 'p' does not exist on type 'C3'.
+/a.js(2,3): error TS6205: All type parameters are unused.
+/a.js(8,14): error TS2339: Property 'p' does not exist on type 'C1'.
+/a.js(13,3): error TS6205: All type parameters are unused.
+/a.js(20,3): error TS6205: All type parameters are unused.
+/a.js(25,14): error TS2339: Property 'p' does not exist on type 'C3'.
-==== /a.js (2 errors) ====
+==== /a.js (5 errors) ====
/**
* @template T
+ ~~~~~~~~~~~~
* @template V
+ ~~~~~~~~~~~~~~
*/
+ ~~
+!!! error TS6205: All type parameters are unused.
class C1 {
constructor() {
/** @type {T} */
this.p;
~
-!!! error TS2339: Property 'p' does not exist on type 'C1'.
+!!! error TS2339: Property 'p' does not exist on type 'C1'.
}
}
/**
* @template T,V
+ ~~~~~~~~~~~~~~
*/
+ ~~
+!!! error TS6205: All type parameters are unused.
class C2 {
constructor() { }
}
/**
* @template T,V,X
+ ~~~~~~~~~~~~~~~~
*/
+ ~~
+!!! error TS6205: All type parameters are unused.
class C3 {
constructor() {
/** @type {T} */
this.p;
~
-!!! error TS2339: Property 'p' does not exist on type 'C3'.
+!!! error TS2339: Property 'p' does not exist on type 'C3'.
}
}
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.types b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.types
index 677e8b9729..79efeecbe1 100644
--- a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.types
+++ b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.types
@@ -6,7 +6,7 @@
* @template V
*/
class C1 {
->C1 : C1
+>C1 : C1
constructor() {
/** @type {T} */
@@ -21,7 +21,7 @@ class C1 {
* @template T,V
*/
class C2 {
->C2 : C2
+>C2 : C2
constructor() { }
}
@@ -30,7 +30,7 @@ class C2 {
* @template T,V,X
*/
class C3 {
->C3 : C3
+>C3 : C3
constructor() {
/** @type {T} */
diff --git a/testdata/baselines/reference/submodule/conformance/annotatedThisPropertyInitializerDoesntNarrow.types b/testdata/baselines/reference/submodule/conformance/annotatedThisPropertyInitializerDoesntNarrow.types
index 1646c3be5a..6dfed7c6ed 100644
--- a/testdata/baselines/reference/submodule/conformance/annotatedThisPropertyInitializerDoesntNarrow.types
+++ b/testdata/baselines/reference/submodule/conformance/annotatedThisPropertyInitializerDoesntNarrow.types
@@ -4,8 +4,8 @@
// from webpack/lib/Compilation.js and filed at #26427
/** @param {{ [s: string]: number }} map */
function mappy(map) {}
->mappy : (map: any) => void
->map : any
+>mappy : (map: { [s: string]: number; }) => void
+>map : { [s: string]: number; }
export class C {
>C : C
@@ -24,7 +24,7 @@ export class C {
mappy(this.assets)
>mappy(this.assets) : void
->mappy : (map: any) => void
+>mappy : (map: { [s: string]: number; }) => void
>this.assets : any
>this : this
>assets : any
diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt
new file mode 100644
index 0000000000..472f0246c4
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt
@@ -0,0 +1,33 @@
+assertionTypePredicates2.js(21,5): error TS2775: Assertions require every name in the call target to be declared with an explicit type annotation.
+assertionTypePredicates2.js(21,5): error TS2775: Assertions require every name in the call target to be declared with an explicit type annotation.
+
+
+==== assertionTypePredicates2.js (2 errors) ====
+ /**
+ * @typedef {{ x: number }} A
+ */
+
+ /**
+ * @typedef { A & { y: number } } B
+ */
+
+ /**
+ * @param {A} a
+ * @returns { asserts a is B }
+ */
+ const foo = (a) => {
+ if (/** @type { B } */ (a).y !== 0) throw TypeError();
+ return undefined;
+ };
+
+ export const main = () => {
+ /** @type { A } */
+ const a = { x: 1 };
+ foo(a);
+ ~~~
+!!! error TS2775: Assertions require every name in the call target to be declared with an explicit type annotation.
+!!! related TS2782 assertionTypePredicates2.js:13:7: 'foo' needs an explicit type annotation.
+ ~~~
+!!! error TS2775: Assertions require every name in the call target to be declared with an explicit type annotation.
+ };
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols
index 3030bb1d97..2bb05c5574 100644
--- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols
+++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols
@@ -18,7 +18,9 @@ const foo = (a) => {
>a : Symbol(a, Decl(assertionTypePredicates2.js, 12, 13))
if (/** @type { B } */ (a).y !== 0) throw TypeError();
+>(a).y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19))
>a : Symbol(a, Decl(assertionTypePredicates2.js, 12, 13))
+>y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19))
>TypeError : Symbol(TypeError, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
return undefined;
diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff
deleted file mode 100644
index a27b754ac7..0000000000
--- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff
+++ /dev/null
@@ -1,12 +0,0 @@
---- old.assertionTypePredicates2.symbols
-+++ new.assertionTypePredicates2.symbols
-@@= skipped -17, +17 lines =@@
- >a : Symbol(a, Decl(assertionTypePredicates2.js, 12, 13))
-
- if (/** @type { B } */ (a).y !== 0) throw TypeError();
-->(a).y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19))
- >a : Symbol(a, Decl(assertionTypePredicates2.js, 12, 13))
-->y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19))
- >TypeError : Symbol(TypeError, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
-
- return undefined;
diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types
index caa9f13697..8aaa0c1341 100644
--- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types
+++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types
@@ -14,16 +14,17 @@
* @returns { asserts a is B }
*/
const foo = (a) => {
->foo : (a: any) => any
->(a) => { if (/** @type { B } */ (a).y !== 0) throw TypeError(); return undefined;} : (a: any) => any
->a : any
+>foo : (a: { x: number; }) => asserts a is { x: number; } & { y: number; }
+>(a) => { if (/** @type { B } */ (a).y !== 0) throw TypeError(); return undefined;} : (a: { x: number; }) => asserts a is { x: number; } & { y: number; }
+>a : { x: number; }
if (/** @type { B } */ (a).y !== 0) throw TypeError();
>(a).y !== 0 : boolean
->(a).y : any
->(a) : any
->a : any
->y : any
+>(a).y : number
+>(a) : { x: number; } & { y: number; }
+>a : { x: number; } & { y: number; }
+>a : { x: number; }
+>y : number
>0 : 0
>TypeError() : TypeError
>TypeError : TypeErrorConstructor
@@ -45,8 +46,8 @@ export const main = () => {
>1 : 1
foo(a);
->foo(a) : any
->foo : (a: any) => any
+>foo(a) : void
+>foo : (a: { x: number; }) => asserts a is { x: number; } & { y: number; }
>a : { x: number; }
};
diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt
new file mode 100644
index 0000000000..7925bfb827
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt
@@ -0,0 +1,69 @@
+assertionsAndNonReturningFunctions.js(46,9): error TS7027: Unreachable code detected.
+assertionsAndNonReturningFunctions.js(58,5): error TS7027: Unreachable code detected.
+
+
+==== assertionsAndNonReturningFunctions.js (2 errors) ====
+ /** @typedef {(check: boolean) => asserts check} AssertFunc */
+
+ /** @type {AssertFunc} */
+ const assert = check => {
+ if (!check) throw new Error();
+ }
+
+ /** @type {(x: unknown) => asserts x is string } */
+ function assertIsString(x) {
+ if (!(typeof x === "string")) throw new Error();
+ }
+
+ /**
+ * @param {boolean} check
+ * @returns {asserts check}
+ */
+ function assert2(check) {
+ if (!check) throw new Error();
+ }
+
+ /**
+ * @returns {never}
+ */
+ function fail() {
+ throw new Error();
+ }
+
+ /**
+ * @param {*} x
+ */
+ function f1(x) {
+ if (!!true) {
+ assert(typeof x === "string");
+ x.length;
+ }
+ if (!!true) {
+ assert2(typeof x === "string");
+ x.length;
+ }
+ if (!!true) {
+ assertIsString(x);
+ x.length;
+ }
+ if (!!true) {
+ fail();
+ x; // Unreachable
+ ~~
+!!! error TS7027: Unreachable code detected.
+ }
+ }
+
+ /**
+ * @param {boolean} b
+ */
+ function f2(b) {
+ switch (b) {
+ case true: return 1;
+ case false: return 0;
+ }
+ b; // Unreachable
+ ~~
+!!! error TS7027: Unreachable code detected.
+ }
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols
index 4e28ee1edd..5f8301528a 100644
--- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols
+++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols
@@ -59,7 +59,9 @@ function f1(x) {
>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12))
x.length;
+>x.length : Symbol(length, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12))
+>length : Symbol(length, Decl(lib.es5.d.ts, --, --))
}
if (!!true) {
assert2(typeof x === "string");
@@ -67,7 +69,9 @@ function f1(x) {
>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12))
x.length;
+>x.length : Symbol(length, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12))
+>length : Symbol(length, Decl(lib.es5.d.ts, --, --))
}
if (!!true) {
assertIsString(x);
diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff
index 50d5a23cbb..9040133d0e 100644
--- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff
@@ -5,22 +5,26 @@
x.length;
->x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
++>x.length : Symbol(length, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12))
->length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
++>length : Symbol(length, Decl(lib.es5.d.ts, --, --))
}
if (!!true) {
assert2(typeof x === "string");
-@@= skipped -10, +8 lines =@@
+@@= skipped -10, +10 lines =@@
>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12))
x.length;
->x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
++>x.length : Symbol(length, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12))
->length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
++>length : Symbol(length, Decl(lib.es5.d.ts, --, --))
}
if (!!true) {
assertIsString(x);
-@@= skipped -10, +8 lines =@@
+@@= skipped -10, +10 lines =@@
>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12))
x.length;
diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types
index c2ac1067df..460c077286 100644
--- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types
+++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types
@@ -5,13 +5,13 @@
/** @type {AssertFunc} */
const assert = check => {
->assert : (check: any) => void
->check => { if (!check) throw new Error();} : (check: any) => void
->check : any
+>assert : (check: boolean) => asserts check
+>check => { if (!check) throw new Error();} : (check: boolean) => void
+>check : boolean
if (!check) throw new Error();
>!check : boolean
->check : any
+>check : boolean
>new Error() : Error
>Error : ErrorConstructor
}
@@ -37,12 +37,12 @@ function assertIsString(x) {
* @returns {asserts check}
*/
function assert2(check) {
->assert2 : (check: any) => void
->check : any
+>assert2 : (check: boolean) => asserts check
+>check : boolean
if (!check) throw new Error();
>!check : boolean
->check : any
+>check : boolean
>new Error() : Error
>Error : ErrorConstructor
}
@@ -51,7 +51,7 @@ function assert2(check) {
* @returns {never}
*/
function fail() {
->fail : () => void
+>fail : () => never
throw new Error();
>new Error() : Error
@@ -72,16 +72,16 @@ function f1(x) {
assert(typeof x === "string");
>assert(typeof x === "string") : void
->assert : (check: any) => void
+>assert : (check: boolean) => asserts check
>typeof x === "string" : boolean
>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined"
>x : any
>"string" : "string"
x.length;
->x.length : any
->x : any
->length : any
+>x.length : number
+>x : string
+>length : number
}
if (!!true) {
>!!true : boolean
@@ -90,16 +90,16 @@ function f1(x) {
assert2(typeof x === "string");
>assert2(typeof x === "string") : void
->assert2 : (check: any) => void
+>assert2 : (check: boolean) => asserts check
>typeof x === "string" : boolean
>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined"
>x : any
>"string" : "string"
x.length;
->x.length : any
->x : any
->length : any
+>x.length : number
+>x : string
+>length : number
}
if (!!true) {
>!!true : boolean
@@ -122,8 +122,8 @@ function f1(x) {
>true : true
fail();
->fail() : void
->fail : () => void
+>fail() : never
+>fail : () => never
x; // Unreachable
>x : any
@@ -134,11 +134,11 @@ function f1(x) {
* @param {boolean} b
*/
function f2(b) {
->f2 : (b: any) => 0 | 1
->b : any
+>f2 : (b: boolean) => 0 | 1
+>b : boolean
switch (b) {
->b : any
+>b : boolean
case true: return 1;
>true : true
@@ -149,6 +149,6 @@ function f2(b) {
>0 : 0
}
b; // Unreachable
->b : any
+>b : never
}
diff --git a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt
new file mode 100644
index 0000000000..6dc5427f14
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt
@@ -0,0 +1,50 @@
+file.js(2,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+file.js(6,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+file.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+file.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+
+
+==== file.js (5 errors) ====
+ // Error (good)
+ /** @type {function(): string} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
+ const a = () => 0
+
+ // Error (good)
+ /** @type {function(): string} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
+ const b = async () => 0
+
+ // No error (bad)
+ /** @type {function(): string} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
+ const c = async () => {
+ return 0
+ }
+
+ // Error (good)
+ /** @type {function(): string} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
+ const d = async () => {
+ return ""
+ }
+
+ /** @type {function(function(): string): void} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
+ const f = (p) => {}
+
+ // Error (good)
+ f(async () => {
+ return 0
+ })
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.types b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.types
index f54b0ced23..2e9f7ae259 100644
--- a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.types
+++ b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.types
@@ -4,21 +4,21 @@
// Error (good)
/** @type {function(): string} */
const a = () => 0
->a : () => number
+>a : function
>() => 0 : () => number
>0 : 0
// Error (good)
/** @type {function(): string} */
const b = async () => 0
->b : () => Promise
+>b : function
>async () => 0 : () => Promise
>0 : 0
// No error (bad)
/** @type {function(): string} */
const c = async () => {
->c : () => Promise
+>c : function
>async () => { return 0} : () => Promise
return 0
@@ -28,7 +28,7 @@ const c = async () => {
// Error (good)
/** @type {function(): string} */
const d = async () => {
->d : () => Promise
+>d : function
>async () => { return ""} : () => Promise
return ""
@@ -37,14 +37,14 @@ const d = async () => {
/** @type {function(function(): string): void} */
const f = (p) => {}
->f : (p: any) => void
+>f : function
>(p) => {} : (p: any) => void
>p : any
// Error (good)
f(async () => {
->f(async () => { return 0}) : void
->f : (p: any) => void
+>f(async () => { return 0}) : any
+>f : function
>async () => { return 0} : () => Promise
return 0
diff --git a/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt
new file mode 100644
index 0000000000..18d3c442d6
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt
@@ -0,0 +1,67 @@
+/a.js(21,14): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'?
+/a.js(27,12): error TS2304: Cannot find name 'T1'.
+/a.js(40,12): error TS2304: Cannot find name 'T2'.
+/a.js(45,12): error TS2304: Cannot find name 'T3'.
+
+
+==== /types.d.ts (0 errors) ====
+ declare class Thenable { then(): void; }
+
+==== /a.js (4 errors) ====
+ /**
+ * @callback T1
+ * @param {string} str
+ * @returns {string}
+ */
+
+ /**
+ * @callback T2
+ * @param {string} str
+ * @returns {Promise}
+ */
+
+ /**
+ * @callback T3
+ * @param {string} str
+ * @returns {Thenable}
+ */
+
+ /**
+ * @param {string} str
+ * @returns {string}
+ ~~~~~~
+!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'?
+ */
+ const f1 = async str => {
+ return str;
+ }
+
+ /** @type {T1} */
+ ~~
+!!! error TS2304: Cannot find name 'T1'.
+ const f2 = async str => {
+ return str;
+ }
+
+ /**
+ * @param {string} str
+ * @returns {Promise}
+ */
+ const f3 = async str => {
+ return str;
+ }
+
+ /** @type {T2} */
+ ~~
+!!! error TS2304: Cannot find name 'T2'.
+ const f4 = async str => {
+ return str;
+ }
+
+ /** @type {T3} */
+ ~~
+!!! error TS2304: Cannot find name 'T3'.
+ const f5 = async str => {
+ return str;
+ }
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.types b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.types
index 0e885cffb4..3a95e08bd6 100644
--- a/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.types
+++ b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.types
@@ -29,17 +29,17 @@ declare class Thenable { then(): void; }
* @returns {string}
*/
const f1 = async str => {
->f1 : (str: any) => Promise
->async str => { return str;} : (str: any) => Promise
->str : any
+>f1 : (str: string) => string
+>async str => { return str;} : (str: string) => string
+>str : string
return str;
->str : any
+>str : string
}
/** @type {T1} */
const f2 = async str => {
->f2 : (str: any) => Promise
+>f2 : T1
>async str => { return str;} : (str: any) => Promise
>str : any
@@ -52,17 +52,17 @@ const f2 = async str => {
* @returns {Promise}
*/
const f3 = async str => {
->f3 : (str: any) => Promise
->async str => { return str;} : (str: any) => Promise
->str : any
+>f3 : (str: string) => Promise
+>async str => { return str;} : (str: string) => Promise
+>str : string
return str;
->str : any
+>str : string
}
/** @type {T2} */
const f4 = async str => {
->f4 : (str: any) => Promise
+>f4 : T2
>async str => { return str;} : (str: any) => Promise
>str : any
@@ -72,7 +72,7 @@ const f4 = async str => {
/** @type {T3} */
const f5 = async str => {
->f5 : (str: any) => Promise
+>f5 : T3
>async str => { return str;} : (str: any) => Promise
>str : any
diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt
index 2994a55aa7..dbbbe1f34c 100644
--- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt
@@ -1,4 +1,5 @@
mod1.js(5,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
+use.js(1,20): error TS2306: File 'mod1.js' is not a module.
==== mod1.js (1 errors) ====
@@ -13,8 +14,10 @@ mod1.js(5,1): error TS2580: Cannot find name 'module'. Do you need to install ty
this.p = 1
}
-==== use.js (0 errors) ====
+==== use.js (1 errors) ====
/** @param {import('./mod1').Con} k */
+ ~~~~~~~~
+!!! error TS2306: File 'mod1.js' is not a module.
function f(k) {
if (1 === 2 - 1) {
// I guess basic math works!
diff --git a/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt
new file mode 100644
index 0000000000..9b0c649c61
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt
@@ -0,0 +1,20 @@
+callbackOnConstructor.js(12,12): error TS2304: Cannot find name 'ValueGetter_2'.
+
+
+==== callbackOnConstructor.js (1 errors) ====
+ export class Preferences {
+ assignability = "no"
+ /**
+ * @callback ValueGetter_2
+ * @param {string} name
+ * @returns {boolean|number|string|undefined}
+ */
+ constructor() {}
+ }
+
+
+ /** @type {ValueGetter_2} */
+ ~~~~~~~~~~~~~
+!!! error TS2304: Cannot find name 'ValueGetter_2'.
+ var ooscope2 = s => s.length > 0
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.types b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.types
index 87c02bf622..448a21aa29 100644
--- a/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.types
+++ b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.types
@@ -19,7 +19,7 @@ export class Preferences {
/** @type {ValueGetter_2} */
var ooscope2 = s => s.length > 0
->ooscope2 : (s: any) => boolean
+>ooscope2 : ValueGetter_2
>s => s.length > 0 : (s: any) => boolean
>s : any
>s.length > 0 : boolean
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt
new file mode 100644
index 0000000000..1ef41942a9
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt
@@ -0,0 +1,27 @@
+cb.js(7,12): error TS2304: Cannot find name 'Sid'.
+cb.js(11,12): error TS2304: Cannot find name 'NoReturn'.
+
+
+==== cb.js (2 errors) ====
+ /** @callback Sid
+ * @param {string} s
+ * @returns {string} What were you expecting
+ */
+ var x = 1
+
+ /** @type {Sid} smallId */
+ ~~~
+!!! error TS2304: Cannot find name 'Sid'.
+ var sid = s => s + "!";
+
+
+ /** @type {NoReturn} */
+ ~~~~~~~~
+!!! error TS2304: Cannot find name 'NoReturn'.
+ var noreturn = obj => void obj.title
+
+ /**
+ * @callback NoReturn
+ * @param {{ e: number, m: number, title: string }} s - Knee deep, shores, etc
+ */
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag1.types b/testdata/baselines/reference/submodule/conformance/callbackTag1.types
index 2ebad26f87..43c91380f7 100644
--- a/testdata/baselines/reference/submodule/conformance/callbackTag1.types
+++ b/testdata/baselines/reference/submodule/conformance/callbackTag1.types
@@ -11,7 +11,7 @@ var x = 1
/** @type {Sid} smallId */
var sid = s => s + "!";
->sid : (s: any) => string
+>sid : Sid
>s => s + "!" : (s: any) => string
>s : any
>s + "!" : string
@@ -21,7 +21,7 @@ var sid = s => s + "!";
/** @type {NoReturn} */
var noreturn = obj => void obj.title
->noreturn : (obj: any) => any
+>noreturn : NoReturn
>obj => void obj.title : (obj: any) => any
>obj : any
>void obj.title : undefined
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt
index 2dbccc172d..c1bec010f7 100644
--- a/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt
@@ -1,7 +1,10 @@
-cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'.
+cb.js(8,12): error TS2304: Cannot find name 'Id'.
+cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'.
+cb.js(22,12): error TS2304: Cannot find name 'SharedId'.
+cb.js(25,12): error TS2304: Cannot find name 'Final'.
-==== cb.js (1 errors) ====
+==== cb.js (4 errors) ====
/** @template T
* @callback Id
* @param {T} t
@@ -10,6 +13,8 @@ cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'.
var x = 1
/** @type {Id} I actually wanted to write `const "120"` */
+ ~~
+!!! error TS2304: Cannot find name 'Id'.
var one_twenty = s => "120";
/** @template S
@@ -22,13 +27,17 @@ cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'.
/** @type {SharedId} */
this.id;
~~
-!!! error TS2339: Property 'id' does not exist on type 'SharedClass'.
+!!! error TS2339: Property 'id' does not exist on type 'SharedClass'.
}
}
/** @type {SharedId} */
+ ~~~~~~~~
+!!! error TS2304: Cannot find name 'SharedId'.
var outside = n => n + 1;
/** @type {Final<{ fantasy }, { heroes }>} */
+ ~~~~~
+!!! error TS2304: Cannot find name 'Final'.
var noreturn = (barts, tidus, noctis) => "cecil"
/**
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag2.types b/testdata/baselines/reference/submodule/conformance/callbackTag2.types
index 9480c8d69f..c6fb9fcc81 100644
--- a/testdata/baselines/reference/submodule/conformance/callbackTag2.types
+++ b/testdata/baselines/reference/submodule/conformance/callbackTag2.types
@@ -12,7 +12,7 @@ var x = 1
/** @type {Id} I actually wanted to write `const "120"` */
var one_twenty = s => "120";
->one_twenty : (s: any) => string
+>one_twenty : Id
>s => "120" : (s: any) => string
>s : any
>"120" : "120"
@@ -23,7 +23,7 @@ var one_twenty = s => "120";
* @return {S}
*/
class SharedClass {
->SharedClass : SharedClass
+>SharedClass : SharedClass
constructor() {
/** @type {SharedId} */
@@ -35,7 +35,7 @@ class SharedClass {
}
/** @type {SharedId} */
var outside = n => n + 1;
->outside : (n: any) => any
+>outside : SharedId
>n => n + 1 : (n: any) => any
>n : any
>n + 1 : any
@@ -44,7 +44,7 @@ var outside = n => n + 1;
/** @type {Final<{ fantasy }, { heroes }>} */
var noreturn = (barts, tidus, noctis) => "cecil"
->noreturn : (barts: any, tidus: any, noctis: any) => string
+>noreturn : Final<{ fantasy: any; }, { heroes: any; }>
>(barts, tidus, noctis) => "cecil" : (barts: any, tidus: any, noctis: any) => string
>barts : any
>tidus : any
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt
new file mode 100644
index 0000000000..0ea6446b4b
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt
@@ -0,0 +1,13 @@
+cb.js(4,12): error TS2304: Cannot find name 'Miracle'.
+
+
+==== cb.js (1 errors) ====
+ /** @callback Miracle
+ * @returns {string} What were you expecting
+ */
+ /** @type {Miracle} smallId */
+ ~~~~~~~
+!!! error TS2304: Cannot find name 'Miracle'.
+ var sid = () => "!";
+
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag3.types b/testdata/baselines/reference/submodule/conformance/callbackTag3.types
index 087e6ac571..044d714993 100644
--- a/testdata/baselines/reference/submodule/conformance/callbackTag3.types
+++ b/testdata/baselines/reference/submodule/conformance/callbackTag3.types
@@ -6,7 +6,7 @@
*/
/** @type {Miracle} smallId */
var sid = () => "!";
->sid : () => string
+>sid : Miracle
>() => "!" : () => string
>"!" : "!"
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt
index e4e4f3b568..654e48ca41 100644
--- a/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt
@@ -1,9 +1,10 @@
+a.js(9,12): error TS2304: Cannot find name 'C'.
a.js(10,22): error TS7006: Parameter 'a' implicitly has an 'any' type.
a.js(10,25): error TS7006: Parameter 'b' implicitly has an 'any' type.
a.js(11,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
-==== a.js (3 errors) ====
+==== a.js (4 errors) ====
/**
* @callback C
* @this {{ a: string, b: number }}
@@ -13,6 +14,8 @@ a.js(11,5): error TS2683: 'this' implicitly has type 'any' because it does not h
*/
/** @type {C} */
+ ~
+!!! error TS2304: Cannot find name 'C'.
const cb = function (a, b) {
~
!!! error TS7006: Parameter 'a' implicitly has an 'any' type.
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag4.types b/testdata/baselines/reference/submodule/conformance/callbackTag4.types
index 759eb0650d..5e7d68b92d 100644
--- a/testdata/baselines/reference/submodule/conformance/callbackTag4.types
+++ b/testdata/baselines/reference/submodule/conformance/callbackTag4.types
@@ -11,7 +11,7 @@
/** @type {C} */
const cb = function (a, b) {
->cb : (a: any, b: any) => boolean
+>cb : C
>function (a, b) { this return true} : (a: any, b: any) => boolean
>a : any
>b : any
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt
new file mode 100644
index 0000000000..fa694a91df
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt
@@ -0,0 +1,23 @@
+cb_nested.js(11,12): error TS2304: Cannot find name 'WorksWithPeopleCallback'.
+
+
+==== cb_nested.js (1 errors) ====
+ /**
+ * @callback WorksWithPeopleCallback
+ * @param {Object} person
+ * @param {string} person.name
+ * @param {number} [person.age]
+ * @returns {void}
+ */
+
+ /**
+ * For each person, calls your callback.
+ * @param {WorksWithPeopleCallback} callback
+ ~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2304: Cannot find name 'WorksWithPeopleCallback'.
+ * @returns {void}
+ */
+ function eachPerson(callback) {
+ callback({ name: "Empty" });
+ }
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.types b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.types
index 09a041e0ca..f51212f4e6 100644
--- a/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.types
+++ b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.types
@@ -15,12 +15,12 @@
* @returns {void}
*/
function eachPerson(callback) {
->eachPerson : (callback: any) => void
->callback : any
+>eachPerson : (callback: WorksWithPeopleCallback) => void
+>callback : WorksWithPeopleCallback
callback({ name: "Empty" });
>callback({ name: "Empty" }) : any
->callback : any
+>callback : WorksWithPeopleCallback
>{ name: "Empty" } : { name: string; }
>name : string
>"Empty" : "Empty"
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt
index b3b3740431..79b28e665e 100644
--- a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt
@@ -1,4 +1,4 @@
-callbackTagVariadicType.js(9,13): error TS2554: Expected 0 arguments, but got 2.
+callbackTagVariadicType.js(7,12): error TS2304: Cannot find name 'Foo'.
==== callbackTagVariadicType.js (1 errors) ====
@@ -9,8 +9,8 @@ callbackTagVariadicType.js(9,13): error TS2554: Expected 0 arguments, but got 2.
*/
/** @type {Foo} */
+ ~~~
+!!! error TS2304: Cannot find name 'Foo'.
export const x = () => 1
var res = x('a', 'b')
- ~~~~~~~~
-!!! error TS2554: Expected 0 arguments, but got 2.
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.types b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.types
index fb68217605..a80d7af3a7 100644
--- a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.types
+++ b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.types
@@ -9,14 +9,14 @@
/** @type {Foo} */
export const x = () => 1
->x : () => number
+>x : Foo
>() => 1 : () => number
>1 : 1
var res = x('a', 'b')
->res : number
->x('a', 'b') : number
->x : () => number
+>res : any
+>x('a', 'b') : any
+>x : Foo
>'a' : "a"
>'b' : "b"
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.errors.txt
new file mode 100644
index 0000000000..b29c988e17
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.errors.txt
@@ -0,0 +1,14 @@
+0.js(7,20): error TS1016: A required parameter cannot follow an optional parameter.
+
+
+==== 0.js (1 errors) ====
+ // @ts-check
+ /**
+ * @param {number} a
+ * @param {number} [b]
+ * @param {number} c
+ */
+ function foo(a, b, c) {}
+ ~
+!!! error TS1016: A required parameter cannot follow an optional parameter.
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.types b/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.types
index a487e8cda1..00c4c537df 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.types
@@ -8,8 +8,8 @@
* @param {number} c
*/
function foo(a, b, c) {}
->foo : (a: any, b: any, c: any) => void
->a : any
->b : any
->c : any
+>foo : (a: number, b: number, c: number) => void
+>a : number
+>b : number
+>c : number
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types b/testdata/baselines/reference/submodule/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types
index f797aaae7d..56bcad7bfb 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types
@@ -7,11 +7,11 @@
* @param {string} [s]
*/
var x = function foo(n, s) {}
->x : (n: any, s: any) => void
->function foo(n, s) {} : (n: any, s: any) => void
->foo : (n: any, s: any) => void
->n : any
->s : any
+>x : (n?: number, s?: string) => void
+>function foo(n, s) {} : (n?: number, s?: string) => void
+>foo : (n?: number, s?: string) => void
+>n : number
+>s : string
var y;
>y : any
@@ -30,9 +30,9 @@ y = function bar(b) {}
* @param {string} s
*/
var one = function (s) { }, two = function (untyped) { };
->one : (s: any) => void
->function (s) { } : (s: any) => void
->s : any
+>one : (s: string) => void
+>function (s) { } : (s: string) => void
+>s : string
>two : (untyped: any) => void
>function (untyped) { } : (untyped: any) => void
>untyped : any
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.errors.txt
deleted file mode 100644
index 6d58c39a5f..0000000000
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.errors.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-0.js(8,1): error TS2554: Expected 2 arguments, but got 0.
-0.js(9,1): error TS2554: Expected 2 arguments, but got 1.
-
-
-==== 0.js (2 errors) ====
- // @ts-check
- /**
- * @param {number=} n
- * @param {string} [s]
- */
- function foo(n, s) {}
-
- foo();
- ~~~
-!!! error TS2554: Expected 2 arguments, but got 0.
-!!! related TS6210 0.js:6:14: An argument for 'n' was not provided.
- foo(1);
- ~~~
-!!! error TS2554: Expected 2 arguments, but got 1.
-!!! related TS6210 0.js:6:17: An argument for 's' was not provided.
- foo(1, "hi");
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.types
index 4714ea7317..b5f97088c1 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.types
@@ -7,22 +7,22 @@
* @param {string} [s]
*/
function foo(n, s) {}
->foo : (n: any, s: any) => void
->n : any
->s : any
+>foo : (n?: number, s?: string) => void
+>n : number
+>s : string
foo();
>foo() : void
->foo : (n: any, s: any) => void
+>foo : (n?: number, s?: string) => void
foo(1);
>foo(1) : void
->foo : (n: any, s: any) => void
+>foo : (n?: number, s?: string) => void
>1 : 1
foo(1, "hi");
>foo(1, "hi") : void
->foo : (n: any, s: any) => void
+>foo : (n?: number, s?: string) => void
>1 : 1
>"hi" : "hi"
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag1.types
index 6d52c3a702..39f1932261 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag1.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag1.types
@@ -26,7 +26,7 @@ function f1() {
* @returns {string|number} This comment is not currently exposed
*/
function f2() {
->f2 : () => "hello" | 5
+>f2 : () => string | number
return 5 || "hello";
>5 || "hello" : "hello" | 5
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt
index ab240f6d40..c5ab204ed8 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt
@@ -1,13 +1,18 @@
+returns.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'.
+returns.js(13,5): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'.
+ Type 'boolean' is not assignable to type 'string | number'.
returns.js(13,12): error TS2872: This kind of expression is always truthy.
-==== returns.js (1 errors) ====
+==== returns.js (3 errors) ====
// @ts-check
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
return 5;
+ ~~~~~~
+!!! error TS2322: Type 'number' is not assignable to type 'string'.
}
/**
@@ -15,6 +20,9 @@ returns.js(13,12): error TS2872: This kind of expression is always truthy.
*/
function f1() {
return 5 || true;
+ ~~~~~~
+!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'.
+!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'.
~
!!! error TS2872: This kind of expression is always truthy.
}
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.types b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.types
index bf6e5e53e5..6ad8c3fb20 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.types
@@ -6,7 +6,7 @@
* @returns {string} This comment is not currently exposed
*/
function f() {
->f : () => number
+>f : () => string
return 5;
>5 : 5
@@ -16,7 +16,7 @@ function f() {
* @returns {string | number} This comment is not currently exposed
*/
function f1() {
->f1 : () => 5 | true
+>f1 : () => string | number
return 5 || true;
>5 || true : 5 | true
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols
index b2946f8e46..41e26adfcd 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols
@@ -41,7 +41,9 @@ const t4 = /** @satisfies {T2} */ ({ a: "a" });
const t5 = /** @satisfies {T3} */((m) => m.substring(0));
>t5 : Symbol(t5, Decl(a.js, 27, 5))
>m : Symbol(m, Decl(a.js, 27, 35))
+>m.substring : Symbol(substring, Decl(lib.es5.d.ts, --, --))
>m : Symbol(m, Decl(a.js, 27, 35))
+>substring : Symbol(substring, Decl(lib.es5.d.ts, --, --))
const t6 = /** @satisfies {[number, number]} */ ([1, 2]);
>t6 : Symbol(t6, Decl(a.js, 28, 5))
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff
index 6e16092f24..d1e4e15083 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff
@@ -5,8 +5,10 @@
>t5 : Symbol(t5, Decl(a.js, 27, 5))
>m : Symbol(m, Decl(a.js, 27, 35))
->m.substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
++>m.substring : Symbol(substring, Decl(lib.es5.d.ts, --, --))
>m : Symbol(m, Decl(a.js, 27, 35))
->substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
++>substring : Symbol(substring, Decl(lib.es5.d.ts, --, --))
const t6 = /** @satisfies {[number, number]} */ ([1, 2]);
>t6 : Symbol(t6, Decl(a.js, 28, 5))
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types
index 9333923866..565314abff 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types
@@ -43,7 +43,7 @@ const t3 = /** @satisfies {T1} */ ({});
/** @type {T2} */
const t4 = /** @satisfies {T2} */ ({ a: "a" });
->t4 : { a: string; }
+>t4 : T2
>({ a: "a" }) : { a: string; }
>{ a: "a" } : { a: string; }
>a : string
@@ -51,14 +51,14 @@ const t4 = /** @satisfies {T2} */ ({ a: "a" });
/** @type {(m: string) => string} */
const t5 = /** @satisfies {T3} */((m) => m.substring(0));
->t5 : (m: any) => any
->((m) => m.substring(0)) : (m: any) => any
->(m) => m.substring(0) : (m: any) => any
->m : any
->m.substring(0) : any
->m.substring : any
->m : any
->substring : any
+>t5 : (m: string) => string
+>((m) => m.substring(0)) : (m: string) => string
+>(m) => m.substring(0) : (m: string) => string
+>m : string
+>m.substring(0) : string
+>m.substring : (start: number, end?: number) => string
+>m : string
+>substring : (start: number, end?: number) => string
>0 : 0
const t6 = /** @satisfies {[number, number]} */ ([1, 2]);
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.errors.txt
new file mode 100644
index 0000000000..c3c65f4fb8
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.errors.txt
@@ -0,0 +1,16 @@
+/a.js(1,15): error TS2315: Type 'Object' is not generic.
+/a.js(1,21): error TS8020: JSDoc types can only be used inside documentation comments.
+
+
+==== /a.js (2 errors) ====
+ /** @typedef {Object. boolean>} Predicates */
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2315: Type 'Object' is not generic.
+ ~
+!!! error TS8020: JSDoc types can only be used inside documentation comments.
+
+ const p = /** @satisfies {Predicates} */ ({
+ isEven: n => n % 2 === 0,
+ isOdd: n => n % 2 === 1
+ });
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt
index ff2916a9e4..f41bb7633d 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt
@@ -1,14 +1,11 @@
-/a.js(3,7): error TS7006: Parameter 's' implicitly has an 'any' type.
/a.js(4,7): error TS7006: Parameter 's' implicitly has an 'any' type.
/a.js(8,49): error TS7006: Parameter 'x' implicitly has an 'any' type.
-==== /a.js (3 errors) ====
+==== /a.js (2 errors) ====
/** @type {{ f(s: string): void } & Record }} */
let obj = /** @satisfies {{ g(s: string): void } & Record} */ ({
f(s) { }, // "incorrect" implicit any on 's'
- ~
-!!! error TS7006: Parameter 's' implicitly has an 'any' type.
g(s) { }
~
!!! error TS7006: Parameter 's' implicitly has an 'any' type.
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.types
index d25248b35d..7504a36f45 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.types
@@ -3,13 +3,13 @@
=== /a.js ===
/** @type {{ f(s: string): void } & Record }} */
let obj = /** @satisfies {{ g(s: string): void } & Record} */ ({
->obj : { f: (s: any) => void; g: (s: any) => void; }
->({ f(s) { }, // "incorrect" implicit any on 's' g(s) { }}) : { f: (s: any) => void; g: (s: any) => void; }
->{ f(s) { }, // "incorrect" implicit any on 's' g(s) { }} : { f: (s: any) => void; g: (s: any) => void; }
+>obj : { f: (s: string) => void; } & Record
+>({ f(s) { }, // "incorrect" implicit any on 's' g(s) { }}) : { f: (s: string) => void; g: (s: any) => void; }
+>{ f(s) { }, // "incorrect" implicit any on 's' g(s) { }} : { f: (s: string) => void; g: (s: any) => void; }
f(s) { }, // "incorrect" implicit any on 's'
->f : (s: any) => void
->s : any
+>f : (s: string) => void
+>s : string
g(s) { }
>g : (s: any) => void
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.errors.txt
new file mode 100644
index 0000000000..cc59dca024
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.errors.txt
@@ -0,0 +1,17 @@
+/a.js(1,15): error TS2315: Type 'Object' is not generic.
+/a.js(1,21): error TS8020: JSDoc types can only be used inside documentation comments.
+
+
+==== /a.js (2 errors) ====
+ /** @typedef {Object.} Facts */
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2315: Type 'Object' is not generic.
+ ~
+!!! error TS8020: JSDoc types can only be used inside documentation comments.
+
+ // Should be able to detect a failure here
+ const x = /** @satisfies {Facts} */ ({
+ m: true,
+ s: "false"
+ })
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt
index c38dd87402..beeb1723a4 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt
@@ -1,8 +1,10 @@
-0.js(10,1): error TS2322: Type 'string' is not assignable to type 'number'.
-0.js(14,1): error TS2322: Type 'string' is not assignable to type 'number'.
+0.js(20,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+0.js(24,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+0.js(28,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+0.js(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'object', but here has type 'Object'.
-==== 0.js (2 errors) ====
+==== 0.js (4 errors) ====
// @ts-check
/** @type {String} */
var S = "hello world";
@@ -13,28 +15,33 @@
/** @type {*} */
var anyT = 2;
anyT = "hello";
- ~~~~
-!!! error TS2322: Type 'string' is not assignable to type 'number'.
/** @type {?} */
var anyT1 = 2;
anyT1 = "hi";
- ~~~~~
-!!! error TS2322: Type 'string' is not assignable to type 'number'.
/** @type {Function} */
const x = (a) => a + 1;
x(1);
/** @type {function} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
const y = (a) => a + 1;
y(1);
/** @type {function (number)} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
const x1 = (a) => a + 1;
x1(0);
/** @type {function (number): number} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
const x2 = (a) => a + 1;
x2(0);
@@ -47,4 +54,7 @@
* @type {Object}
*/
var props = {};
+ ~~~~~
+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'object', but here has type 'Object'.
+!!! related TS6203 0.js:35:5: 'props' was also declared here.
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.types
index f9016dbaac..35991b8037 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.types
@@ -4,7 +4,7 @@
// @ts-check
/** @type {String} */
var S = "hello world";
->S : string
+>S : String
>"hello world" : "hello world"
/** @type {number} */
@@ -14,27 +14,27 @@ var n = 10;
/** @type {*} */
var anyT = 2;
->anyT : number
+>anyT : any
>2 : 2
anyT = "hello";
>anyT = "hello" : "hello"
->anyT : number
+>anyT : any
>"hello" : "hello"
/** @type {?} */
var anyT1 = 2;
->anyT1 : number
+>anyT1 : any
>2 : 2
anyT1 = "hi";
>anyT1 = "hi" : "hi"
->anyT1 : number
+>anyT1 : any
>"hi" : "hi"
/** @type {Function} */
const x = (a) => a + 1;
->x : (a: any) => any
+>x : Function
>(a) => a + 1 : (a: any) => any
>a : any
>a + 1 : any
@@ -43,12 +43,12 @@ const x = (a) => a + 1;
x(1);
>x(1) : any
->x : (a: any) => any
+>x : Function
>1 : 1
/** @type {function} */
const y = (a) => a + 1;
->y : (a: any) => any
+>y : function
>(a) => a + 1 : (a: any) => any
>a : any
>a + 1 : any
@@ -57,12 +57,12 @@ const y = (a) => a + 1;
y(1);
>y(1) : any
->y : (a: any) => any
+>y : function
>1 : 1
/** @type {function (number)} */
const x1 = (a) => a + 1;
->x1 : (a: any) => any
+>x1 : function
>(a) => a + 1 : (a: any) => any
>a : any
>a + 1 : any
@@ -71,12 +71,12 @@ const x1 = (a) => a + 1;
x1(0);
>x1(0) : any
->x1 : (a: any) => any
+>x1 : function
>0 : 0
/** @type {function (number): number} */
const x2 = (a) => a + 1;
->x2 : (a: any) => any
+>x2 : function
>(a) => a + 1 : (a: any) => any
>a : any
>a + 1 : any
@@ -85,20 +85,20 @@ const x2 = (a) => a + 1;
x2(0);
>x2(0) : any
->x2 : (a: any) => any
+>x2 : function
>0 : 0
/**
* @type {object}
*/
var props = {};
->props : {}
+>props : object
>{} : {}
/**
* @type {Object}
*/
var props = {};
->props : {}
+>props : object
>{} : {}
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt
new file mode 100644
index 0000000000..76933dc06a
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt
@@ -0,0 +1,50 @@
+0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'String'.
+0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'.
+0.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+0.js(12,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+0.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+0.js(23,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+
+
+==== 0.js (6 errors) ====
+ // @ts-check
+ /** @type {String} */
+ var S = true;
+ ~
+!!! error TS2322: Type 'boolean' is not assignable to type 'String'.
+
+ /** @type {number} */
+ var n = "hello";
+ ~
+!!! error TS2322: Type 'string' is not assignable to type 'number'.
+
+ /** @type {function (number)} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
+ const x1 = (a) => a + 1;
+ x1("string");
+
+ /** @type {function (number): number} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
+ const x2 = (a) => a + 1;
+
+ /** @type {string} */
+ var a;
+ a = x2(0);
+
+ /** @type {function (number): number} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
+ const x3 = (a) => a.concat("hi");
+ x3(0);
+
+ /** @type {function (number): string} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
+ const x4 = (a) => a + 1;
+ x4(0);
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.types
index a60c701770..7fc0f656f2 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.types
@@ -4,17 +4,17 @@
// @ts-check
/** @type {String} */
var S = true;
->S : boolean
+>S : String
>true : true
/** @type {number} */
var n = "hello";
->n : string
+>n : number
>"hello" : "hello"
/** @type {function (number)} */
const x1 = (a) => a + 1;
->x1 : (a: any) => any
+>x1 : function
>(a) => a + 1 : (a: any) => any
>a : any
>a + 1 : any
@@ -23,12 +23,12 @@ const x1 = (a) => a + 1;
x1("string");
>x1("string") : any
->x1 : (a: any) => any
+>x1 : function
>"string" : "string"
/** @type {function (number): number} */
const x2 = (a) => a + 1;
->x2 : (a: any) => any
+>x2 : function
>(a) => a + 1 : (a: any) => any
>a : any
>a + 1 : any
@@ -37,18 +37,18 @@ const x2 = (a) => a + 1;
/** @type {string} */
var a;
->a : any
+>a : string
a = x2(0);
>a = x2(0) : any
->a : any
+>a : string
>x2(0) : any
->x2 : (a: any) => any
+>x2 : function
>0 : 0
/** @type {function (number): number} */
const x3 = (a) => a.concat("hi");
->x3 : (a: any) => any
+>x3 : function
>(a) => a.concat("hi") : (a: any) => any
>a : any
>a.concat("hi") : any
@@ -59,12 +59,12 @@ const x3 = (a) => a.concat("hi");
x3(0);
>x3(0) : any
->x3 : (a: any) => any
+>x3 : function
>0 : 0
/** @type {function (number): string} */
const x4 = (a) => a + 1;
->x4 : (a: any) => any
+>x4 : function
>(a) => a + 1 : (a: any) => any
>a : any
>a + 1 : any
@@ -73,6 +73,6 @@ const x4 = (a) => a + 1;
x4(0);
>x4(0) : any
->x4 : (a: any) => any
+>x4 : function
>0 : 0
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag3.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag3.types
index eb35563b92..593bac0790 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag3.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag3.types
@@ -3,5 +3,5 @@
=== test.js ===
/** @type {Array} */
var nns;
->nns : any
+>nns : number[]
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt
new file mode 100644
index 0000000000..1120047dc2
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt
@@ -0,0 +1,24 @@
+test.js(3,19): error TS2304: Cannot find name 'U'.
+test.js(5,14): error TS2344: Type 'number' does not satisfy the constraint 'string'.
+test.js(7,14): error TS2344: Type 'number' does not satisfy the constraint 'string'.
+
+
+==== t.d.ts (0 errors) ====
+ type A = { a: T }
+
+==== test.js (3 errors) ====
+ /** Also should error for jsdoc typedefs
+ * @template {string} U
+ * @typedef {{ b: U }} B
+ ~
+!!! error TS2304: Cannot find name 'U'.
+ */
+ /** @type {A} */
+ ~~~~~~
+!!! error TS2344: Type 'number' does not satisfy the constraint 'string'.
+ var a;
+ /** @type {B} */
+ ~~~~~~
+!!! error TS2344: Type 'number' does not satisfy the constraint 'string'.
+ var b;
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types
index dbf09e07c0..5004b47a1a 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types
@@ -12,9 +12,9 @@ type A = { a: T }
*/
/** @type {A} */
var a;
->a : any
+>a : A
/** @type {B} */
var b;
->b : any
+>b : { b: U; }
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt
new file mode 100644
index 0000000000..285e2ac7c4
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt
@@ -0,0 +1,64 @@
+test.js(5,14): error TS2322: Type 'number' is not assignable to type 'string'.
+test.js(7,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'.
+ Type 'number' is not assignable to type 'string'.
+test.js(12,14): error TS2322: Type 'number' is not assignable to type 'string'.
+test.js(14,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'.
+ Type 'number' is not assignable to type 'string'.
+test.js(24,5): error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'.
+test.js(34,5): error TS2322: Type '1 | 2' is not assignable to type '2 | 3'.
+ Type '1' is not assignable to type '2 | 3'.
+
+
+==== test.js (6 errors) ====
+ // all 6 should error on return statement/expression
+ /** @type {(x: number) => string} */
+ function h(x) { return x }
+ /** @type {(x: number) => string} */
+ var f = x => x
+ ~
+!!! error TS2322: Type 'number' is not assignable to type 'string'.
+!!! related TS6502 test.js:4:12: The expected type comes from the return type of this signature.
+ /** @type {(x: number) => string} */
+ var g = function (x) { return x }
+ ~
+!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'.
+!!! error TS2322: Type 'number' is not assignable to type 'string'.
+
+ /** @type {{ (x: number): string }} */
+ function i(x) { return x }
+ /** @type {{ (x: number): string }} */
+ var j = x => x
+ ~
+!!! error TS2322: Type 'number' is not assignable to type 'string'.
+!!! related TS6502 test.js:11:12: The expected type comes from the return type of this signature.
+ /** @type {{ (x: number): string }} */
+ var k = function (x) { return x }
+ ~
+!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'.
+!!! error TS2322: Type 'number' is not assignable to type 'string'.
+
+
+ /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */
+ /** @type {Argle} */
+ function blargle(s) {
+ return 0;
+ }
+
+ /** @type {0 | 1 | 2} - assignment should not error */
+ var zeroonetwo = blargle('hi')
+ ~~~~~~~~~~
+!!! error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'.
+
+ /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */
+
+ /** @type {Gioconda} */
+ function monaLisa(sb) {
+ return typeof sb === 'string' ? 1 : 2;
+ }
+
+ /** @type {2 | 3} - overloads are not supported, so there will be an error */
+ var twothree = monaLisa(false);
+ ~~~~~~~~
+!!! error TS2322: Type '1 | 2' is not assignable to type '2 | 3'.
+!!! error TS2322: Type '1' is not assignable to type '2 | 3'.
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types
index 0f3aa5e20d..e571cb95ec 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types
@@ -10,17 +10,17 @@ function h(x) { return x }
/** @type {(x: number) => string} */
var f = x => x
->f : (x: any) => any
->x => x : (x: any) => any
->x : any
->x : any
+>f : (x: number) => string
+>x => x : (x: number) => number
+>x : number
+>x : number
/** @type {(x: number) => string} */
var g = function (x) { return x }
->g : (x: any) => any
->function (x) { return x } : (x: any) => any
->x : any
->x : any
+>g : (x: number) => string
+>function (x) { return x } : (x: number) => number
+>x : number
+>x : number
/** @type {{ (x: number): string }} */
function i(x) { return x }
@@ -30,17 +30,17 @@ function i(x) { return x }
/** @type {{ (x: number): string }} */
var j = x => x
->j : (x: any) => any
->x => x : (x: any) => any
->x : any
->x : any
+>j : (x: number) => string
+>x => x : (x: number) => number
+>x : number
+>x : number
/** @type {{ (x: number): string }} */
var k = function (x) { return x }
->k : (x: any) => any
->function (x) { return x } : (x: any) => any
->x : any
->x : any
+>k : (x: number) => string
+>function (x) { return x } : (x: number) => number
+>x : number
+>x : number
/** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */
@@ -55,7 +55,7 @@ function blargle(s) {
/** @type {0 | 1 | 2} - assignment should not error */
var zeroonetwo = blargle('hi')
->zeroonetwo : number
+>zeroonetwo : 0 | 1 | 2
>blargle('hi') : number
>blargle : (s: any) => number
>'hi' : "hi"
@@ -79,7 +79,7 @@ function monaLisa(sb) {
/** @type {2 | 3} - overloads are not supported, so there will be an error */
var twothree = monaLisa(false);
->twothree : number
+>twothree : 2 | 3
>monaLisa(false) : 1 | 2
>monaLisa : (sb: any) => 1 | 2
>false : false
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt
new file mode 100644
index 0000000000..34a62935d5
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt
@@ -0,0 +1,52 @@
+test.js(7,5): error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'.
+test.js(27,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'.
+ Target signature provides too few arguments. Expected 1 or more, but got 0.
+test.js(30,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'.
+ Target signature provides too few arguments. Expected 1 or more, but got 0.
+
+
+==== test.js (3 errors) ====
+ /** @type {number} */
+ function f() {
+ return 1
+ }
+
+ /** @type {{ prop: string }} */
+ var g = function (prop) {
+ ~
+!!! error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'.
+ }
+
+ /** @type {(a: number) => number} */
+ function add1(a, b) { return a + b; }
+
+ /** @type {(a: number, b: number) => number} */
+ function add2(a, b) { return a + b; }
+
+ // TODO: Should be an error since signature doesn't match.
+ /** @type {(a: number, b: number, c: number) => number} */
+ function add3(a, b) { return a + b; }
+
+ // Confirm initializers are compatible.
+ // They can't have more parameters than the type/context.
+
+ /** @type {() => void} */
+ function funcWithMoreParameters(more) {} // error
+
+ /** @type {() => void} */
+ const variableWithMoreParameters = function (more) {}; // error
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'.
+!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0.
+
+ /** @type {() => void} */
+ const arrowWithMoreParameters = (more) => {}; // error
+ ~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'.
+!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0.
+
+ ({
+ /** @type {() => void} */
+ methodWithMoreParameters(more) {}, // error
+ });
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.types
index 66a0efe8a4..f965842389 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.types
@@ -11,7 +11,7 @@ function f() {
/** @type {{ prop: string }} */
var g = function (prop) {
->g : (prop: any) => void
+>g : { prop: string; }
>function (prop) {} : (prop: any) => void
>prop : any
}
@@ -54,13 +54,13 @@ function funcWithMoreParameters(more) {} // error
/** @type {() => void} */
const variableWithMoreParameters = function (more) {}; // error
->variableWithMoreParameters : (more: any) => void
+>variableWithMoreParameters : () => void
>function (more) {} : (more: any) => void
>more : any
/** @type {() => void} */
const arrowWithMoreParameters = (more) => {}; // error
->arrowWithMoreParameters : (more: any) => void
+>arrowWithMoreParameters : () => void
>(more) => {} : (more: any) => void
>more : any
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt
index 14b4f4d795..35c7d11f52 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt
@@ -1,8 +1,7 @@
-0.js(19,1): error TS2322: Type '"string"' is not assignable to type 'undefined'.
-0.js(21,1): error TS2322: Type 'undefined' is not assignable to type 'string'.
+0.js(16,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
-==== 0.js (2 errors) ====
+==== 0.js (1 errors) ====
// @ts-check
var lol = "hello Lol"
const obj = {
@@ -19,15 +18,14 @@
/** @type {number} */
['b' + 'ar1']: 42,
/** @type {function(number): number} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
arrowFunc: (num) => num + 42
}
obj.foo = 'string'
- ~~~~~~~
-!!! error TS2322: Type '"string"' is not assignable to type 'undefined'.
obj.lol
obj.bar = undefined;
- ~~~~~~~
-!!! error TS2322: Type 'undefined' is not assignable to type 'string'.
var k = obj.method1(0);
obj.bar1 = "42";
obj.arrowFunc(0);
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.types
index cb261a3ebd..e62fd337bd 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.types
@@ -7,17 +7,19 @@ var lol = "hello Lol"
>"hello Lol" : "hello Lol"
const obj = {
->obj : { [x: string]: string | number | ((n1: any) => any) | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; }
->{ /** @type {string|undefined} */ foo: undefined, /** @type {string|undefined} */ bar: "42", /** @type {function(number): number} */ method1(n1) { return n1 + 42; }, /** @type {string} */ lol, /** @type {number} */ ['b' + 'ar1']: 42, /** @type {function(number): number} */ arrowFunc: (num) => num + 42} : { [x: string]: string | number | ((n1: any) => any) | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; }
+>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; }
+>{ /** @type {string|undefined} */ foo: undefined, /** @type {string|undefined} */ bar: "42", /** @type {function(number): number} */ method1(n1) { return n1 + 42; }, /** @type {string} */ lol, /** @type {number} */ ['b' + 'ar1']: 42, /** @type {function(number): number} */ arrowFunc: (num) => num + 42} : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; }
/** @type {string|undefined} */
foo: undefined,
->foo : undefined
+>foo : string | undefined
+>undefined : string | undefined
>undefined : undefined
/** @type {string|undefined} */
bar: "42",
->bar : string
+>bar : string | undefined
+>"42" : string | undefined
>"42" : "42"
/** @type {function(number): number} */
@@ -41,11 +43,13 @@ const obj = {
>'b' + 'ar1' : string
>'b' : "b"
>'ar1' : "ar1"
+>42 : number
>42 : 42
/** @type {function(number): number} */
arrowFunc: (num) => num + 42
->arrowFunc : (num: any) => any
+>arrowFunc : function
+>(num) => num + 42 : function
>(num) => num + 42 : (num: any) => any
>num : any
>num + 42 : any
@@ -54,42 +58,42 @@ const obj = {
}
obj.foo = 'string'
>obj.foo = 'string' : "string"
->obj.foo : undefined
->obj : { [x: string]: string | number | ((n1: any) => any) | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; }
->foo : undefined
+>obj.foo : string | undefined
+>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; }
+>foo : string | undefined
>'string' : "string"
obj.lol
>obj.lol : string
->obj : { [x: string]: string | number | ((n1: any) => any) | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; }
+>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; }
>lol : string
obj.bar = undefined;
>obj.bar = undefined : undefined
->obj.bar : string
->obj : { [x: string]: string | number | ((n1: any) => any) | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; }
->bar : string
+>obj.bar : string | undefined
+>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; }
+>bar : string | undefined
>undefined : undefined
var k = obj.method1(0);
>k : any
>obj.method1(0) : any
>obj.method1 : (n1: any) => any
->obj : { [x: string]: string | number | ((n1: any) => any) | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; }
+>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; }
>method1 : (n1: any) => any
>0 : 0
obj.bar1 = "42";
>obj.bar1 = "42" : "42"
->obj.bar1 : string | number | ((n1: any) => any) | undefined
->obj : { [x: string]: string | number | ((n1: any) => any) | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; }
->bar1 : string | number | ((n1: any) => any) | undefined
+>obj.bar1 : any
+>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; }
+>bar1 : any
>"42" : "42"
obj.arrowFunc(0);
>obj.arrowFunc(0) : any
->obj.arrowFunc : (num: any) => any
->obj : { [x: string]: string | number | ((n1: any) => any) | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; }
->arrowFunc : (num: any) => any
+>obj.arrowFunc : function
+>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; }
+>arrowFunc : function
>0 : 0
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt
new file mode 100644
index 0000000000..579a296c34
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt
@@ -0,0 +1,36 @@
+0.js(5,8): error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
+0.js(10,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+0.js(12,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+
+
+==== 0.js (3 errors) ====
+ // @ts-check
+ var lol;
+ const obj = {
+ /** @type {string|undefined} */
+ bar: 42,
+ ~~
+!!! error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
+ /** @type {function(number): number} */
+ method1(n1) {
+ return "42";
+ },
+ /** @type {function(number): number} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
+ method2: (n1) => "lol",
+ /** @type {function(number): number} */
+ ~~~~~~~~
+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here.
+ arrowFunc: (num="0") => num + 42,
+ /** @type {string} */
+ lol
+ }
+ lol = "string"
+ /** @type {string} */
+ var s = obj.method1(0);
+
+ /** @type {string} */
+ var s1 = obj.method2("0");
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.types
index 0976ecc6c6..442a08a945 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.types
@@ -6,12 +6,13 @@ var lol;
>lol : any
const obj = {
->obj : { bar: number; method1: (n1: any) => string; method2: (n1: any) => string; arrowFunc: (num?: string) => string; lol: any; }
->{ /** @type {string|undefined} */ bar: 42, /** @type {function(number): number} */ method1(n1) { return "42"; }, /** @type {function(number): number} */ method2: (n1) => "lol", /** @type {function(number): number} */ arrowFunc: (num="0") => num + 42, /** @type {string} */ lol} : { bar: number; method1: (n1: any) => string; method2: (n1: any) => string; arrowFunc: (num?: string) => string; lol: any; }
+>obj : { bar: string | undefined; method1: (n1: any) => string; method2: function; arrowFunc: function; lol: any; }
+>{ /** @type {string|undefined} */ bar: 42, /** @type {function(number): number} */ method1(n1) { return "42"; }, /** @type {function(number): number} */ method2: (n1) => "lol", /** @type {function(number): number} */ arrowFunc: (num="0") => num + 42, /** @type {string} */ lol} : { bar: string | undefined; method1: (n1: any) => string; method2: function; arrowFunc: function; lol: any; }
/** @type {string|undefined} */
bar: 42,
->bar : number
+>bar : string | undefined
+>42 : string | undefined
>42 : 42
/** @type {function(number): number} */
@@ -25,14 +26,16 @@ const obj = {
},
/** @type {function(number): number} */
method2: (n1) => "lol",
->method2 : (n1: any) => string
+>method2 : function
+>(n1) => "lol" : function
>(n1) => "lol" : (n1: any) => string
>n1 : any
>"lol" : "lol"
/** @type {function(number): number} */
arrowFunc: (num="0") => num + 42,
->arrowFunc : (num?: string) => string
+>arrowFunc : function
+>(num="0") => num + 42 : function
>(num="0") => num + 42 : (num?: string) => string
>num : string
>"0" : "0"
@@ -54,16 +57,16 @@ var s = obj.method1(0);
>s : string
>obj.method1(0) : string
>obj.method1 : (n1: any) => string
->obj : { bar: number; method1: (n1: any) => string; method2: (n1: any) => string; arrowFunc: (num?: string) => string; lol: any; }
+>obj : { bar: string | undefined; method1: (n1: any) => string; method2: function; arrowFunc: function; lol: any; }
>method1 : (n1: any) => string
>0 : 0
/** @type {string} */
var s1 = obj.method2("0");
>s1 : string
->obj.method2("0") : string
->obj.method2 : (n1: any) => string
->obj : { bar: number; method1: (n1: any) => string; method2: (n1: any) => string; arrowFunc: (num?: string) => string; lol: any; }
->method2 : (n1: any) => string
+>obj.method2("0") : any
+>obj.method2 : function
+>obj : { bar: string | undefined; method1: (n1: any) => string; method2: function; arrowFunc: function; lol: any; }
+>method2 : function
>"0" : "0"
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt
new file mode 100644
index 0000000000..5c9948e856
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt
@@ -0,0 +1,56 @@
+0.js(15,5): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': y, z, w
+0.js(28,6): error TS2741: Property 'anotherY' is missing in type '{ anotherX: string; }' but required in type 'AnotherOpts'.
+0.js(42,6): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': y, z, w
+
+
+==== 0.js (3 errors) ====
+ // @ts-check
+ /**
+ * @typedef {Object} Opts
+ * @property {string} x
+ * @property {string=} y
+ * @property {string} [z]
+ * @property {string} [w="hi"]
+ *
+ * @param {Opts} opts
+ */
+ function foo(opts) {
+ opts.x;
+ }
+
+ foo({x: 'abc'});
+ ~~~~~~~~~~
+!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': y, z, w
+
+ /**
+ * @typedef {Object} AnotherOpts
+ * @property anotherX {string}
+ * @property anotherY {string=}
+ *
+ * @param {AnotherOpts} opts
+ */
+ function foo1(opts) {
+ opts.anotherX;
+ }
+
+ foo1({anotherX: "world"});
+ ~~~~~~~~~~~~~~~~~~~
+!!! error TS2741: Property 'anotherY' is missing in type '{ anotherX: string; }' but required in type 'AnotherOpts'.
+!!! related TS2728 0.js:20:14: 'anotherY' is declared here.
+
+ /**
+ * @typedef {object} Opts1
+ * @property {string} x
+ * @property {string=} y
+ * @property {string} [z]
+ * @property {string} [w="hi"]
+ *
+ * @param {Opts1} opts
+ */
+ function foo2(opts) {
+ opts.x;
+ }
+ foo2({x: 'abc'});
+ ~~~~~~~~~~
+!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': y, z, w
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols
index 66488bb0b1..f0f06c6fc0 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols
@@ -16,7 +16,9 @@ function foo(opts) {
>opts : Symbol(opts, Decl(0.js, 10, 13))
opts.x;
+>opts.x : Symbol(x, Decl(0.js, 3, 3))
>opts : Symbol(opts, Decl(0.js, 10, 13))
+>x : Symbol(x, Decl(0.js, 3, 3))
}
foo({x: 'abc'});
@@ -35,7 +37,9 @@ function foo1(opts) {
>opts : Symbol(opts, Decl(0.js, 23, 14))
opts.anotherX;
+>opts.anotherX : Symbol(anotherX, Decl(0.js, 18, 3))
>opts : Symbol(opts, Decl(0.js, 23, 14))
+>anotherX : Symbol(anotherX, Decl(0.js, 18, 3))
}
foo1({anotherX: "world"});
@@ -56,7 +60,9 @@ function foo2(opts) {
>opts : Symbol(opts, Decl(0.js, 38, 14))
opts.x;
+>opts.x : Symbol(x, Decl(0.js, 31, 3))
>opts : Symbol(opts, Decl(0.js, 38, 14))
+>x : Symbol(x, Decl(0.js, 31, 3))
}
foo2({x: 'abc'});
>foo2 : Symbol(foo2, Decl(0.js, 27, 26))
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff
deleted file mode 100644
index 3da9dac730..0000000000
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff
+++ /dev/null
@@ -1,32 +0,0 @@
---- old.checkJsdocTypedefInParamTag1.symbols
-+++ new.checkJsdocTypedefInParamTag1.symbols
-@@= skipped -15, +15 lines =@@
- >opts : Symbol(opts, Decl(0.js, 10, 13))
-
- opts.x;
-->opts.x : Symbol(x, Decl(0.js, 3, 3))
- >opts : Symbol(opts, Decl(0.js, 10, 13))
-->x : Symbol(x, Decl(0.js, 3, 3))
- }
-
- foo({x: 'abc'});
-@@= skipped -21, +19 lines =@@
- >opts : Symbol(opts, Decl(0.js, 23, 14))
-
- opts.anotherX;
-->opts.anotherX : Symbol(anotherX, Decl(0.js, 18, 3))
- >opts : Symbol(opts, Decl(0.js, 23, 14))
-->anotherX : Symbol(anotherX, Decl(0.js, 18, 3))
- }
-
- foo1({anotherX: "world"});
-@@= skipped -23, +21 lines =@@
- >opts : Symbol(opts, Decl(0.js, 38, 14))
-
- opts.x;
-->opts.x : Symbol(x, Decl(0.js, 31, 3))
- >opts : Symbol(opts, Decl(0.js, 38, 14))
-->x : Symbol(x, Decl(0.js, 31, 3))
- }
- foo2({x: 'abc'});
- >foo2 : Symbol(foo2, Decl(0.js, 27, 26))
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.types
index f92d9126fb..1f9d8338ed 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.types
@@ -12,18 +12,18 @@
* @param {Opts} opts
*/
function foo(opts) {
->foo : (opts: any) => void
->opts : any
+>foo : (opts: Opts) => void
+>opts : Opts
opts.x;
>opts.x : any
->opts : any
+>opts : Opts
>x : any
}
foo({x: 'abc'});
>foo({x: 'abc'}) : void
->foo : (opts: any) => void
+>foo : (opts: Opts) => void
>{x: 'abc'} : { x: string; }
>x : string
>'abc' : "abc"
@@ -36,18 +36,18 @@ foo({x: 'abc'});
* @param {AnotherOpts} opts
*/
function foo1(opts) {
->foo1 : (opts: any) => void
->opts : any
+>foo1 : (opts: AnotherOpts) => void
+>opts : AnotherOpts
opts.anotherX;
>opts.anotherX : any
->opts : any
+>opts : AnotherOpts
>anotherX : any
}
foo1({anotherX: "world"});
>foo1({anotherX: "world"}) : void
->foo1 : (opts: any) => void
+>foo1 : (opts: AnotherOpts) => void
>{anotherX: "world"} : { anotherX: string; }
>anotherX : string
>"world" : "world"
@@ -62,17 +62,17 @@ foo1({anotherX: "world"});
* @param {Opts1} opts
*/
function foo2(opts) {
->foo2 : (opts: any) => void
->opts : any
+>foo2 : (opts: Opts1) => void
+>opts : Opts1
opts.x;
>opts.x : any
->opts : any
+>opts : Opts1
>x : any
}
foo2({x: 'abc'});
>foo2({x: 'abc'}) : void
->foo2 : (opts: any) => void
+>foo2 : (opts: Opts1) => void
>{x: 'abc'} : { x: string; }
>x : string
>'abc' : "abc"
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt
index a2ec89dadf..7cb22b9170 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt
@@ -1,10 +1,14 @@
+0.js(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
0.js(8,9): error TS2339: Property 'SomeName' does not exist on type '{}'.
+0.js(10,12): error TS2503: Cannot find namespace 'exports'.
-==== 0.js (1 errors) ====
+==== 0.js (3 errors) ====
// @ts-check
var exports = {};
+ ~~~~~~~
+!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
/**
* @typedef {string}
@@ -14,5 +18,7 @@
!!! error TS2339: Property 'SomeName' does not exist on type '{}'.
/** @type {exports.SomeName} */
+ ~~~~~~~
+!!! error TS2503: Cannot find namespace 'exports'.
const myString = 'str';
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.types
index 79e4c53da7..7adcabd12e 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.types
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.types
@@ -17,6 +17,6 @@ exports.SomeName;
/** @type {exports.SomeName} */
const myString = 'str';
->myString : "str"
+>myString : SomeName
>'str' : "str"
diff --git a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt
index 9e51e0e0f0..f2698865d7 100644
--- a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt
@@ -1,7 +1,9 @@
bug24252.js(2,3): error TS2339: Property 'B' does not exist on type '{}'.
+bug24252.js(8,9): error TS2322: Type 'string[]' is not assignable to type 'number[]'.
+ Type 'string' is not assignable to type 'number'.
-==== bug24252.js (1 errors) ====
+==== bug24252.js (2 errors) ====
var A = {};
A.B = class {
~
@@ -12,6 +14,9 @@ bug24252.js(2,3): error TS2339: Property 'B' does not exist on type '{}'.
/** @type {number[]} */
var y;
y = x;
+ ~
+!!! error TS2322: Type 'string[]' is not assignable to type 'number[]'.
+!!! error TS2322: Type 'string' is not assignable to type 'number'.
}
};
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.types b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.types
index 686e32f361..fdb014f9a0 100644
--- a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.types
+++ b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.types
@@ -17,17 +17,17 @@ A.B = class {
/** @type {string[]} */
var x = [];
->x : any[]
+>x : string[]
>[] : undefined[]
/** @type {number[]} */
var y;
->y : any
+>y : number[]
y = x;
->y = x : any[]
->y : any
->x : any[]
+>y = x : string[]
+>y : number[]
+>x : string[]
}
};
diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt
index 212636b13a..89f4bc9ab8 100644
--- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt
@@ -1,19 +1,20 @@
-first.js(21,19): error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type.
+first.js(21,19): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type.
first.js(24,14): error TS2339: Property 'foonly' does not exist on type 'Sql'.
+first.js(27,21): error TS8020: JSDoc types can only be used inside documentation comments.
first.js(44,4): error TS2339: Property 'numberOxen' does not exist on type 'Sql'.
first.js(44,20): error TS2339: Property 'foonly' 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: any) => void' is not a constructor function type.
+generic.js(9,23): error TS2507: Type '(flavour: T) => void' is not a constructor function type.
generic.js(11,21): error TS2339: Property 'flavour' does not exist on type 'Chowder'.
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: any): void; circle: (wagons: any) => any; }' 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(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Conestoga'.
-==== first.js (5 errors) ====
+==== first.js (6 errors) ====
/**
* @constructor
* @param {number} numberOxen
@@ -36,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: any): void; circle: (wagons: any) => any; }' is not a constructor function type.
+!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type.
constructor() {
super(); // error: not enough arguments
this.foonly = 12
@@ -45,6 +46,8 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con
}
/**
* @param {Array.} files
+ ~
+!!! error TS8020: JSDoc types can only be used inside documentation comments.
* @param {"csv" | "json" | "xmlolololol"} format
* This is not assignable, so should have a type error
*/
@@ -92,7 +95,7 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con
// ok
class Conestoga extends Wagon {
~~~~~
-!!! error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type.
+!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type.
constructor(public drunkOO: true) {
// error: wrong type
super('nope');
@@ -119,7 +122,7 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con
/** @extends {Soup<{ claim: "ignorant" | "malicious" }>} */
class Chowder extends Soup {
~~~~
-!!! error TS2507: Type '(flavour: any) => void' is not a constructor function type.
+!!! error TS2507: Type '(flavour: T) => void' is not a constructor function type.
log() {
return this.flavour
~~~~~~~
diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types
index 18242382b7..ff87ed7d40 100644
--- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types
+++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types
@@ -6,21 +6,21 @@
* @param {number} numberOxen
*/
function Wagon(numberOxen) {
->Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; }
->numberOxen : any
+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; }
+>numberOxen : number
this.numberOxen = numberOxen
->this.numberOxen = numberOxen : any
+>this.numberOxen = numberOxen : number
>this.numberOxen : any
>this : any
>numberOxen : any
->numberOxen : any
+>numberOxen : number
}
/** @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: any): void; 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
@@ -38,7 +38,7 @@ Wagon.prototype.load = function (supplies) {
>Wagon.prototype.load = function (supplies) {} : (supplies: any) => void
>Wagon.prototype.load : any
>Wagon.prototype : any
->Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; }
+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; }
>prototype : any
>load : any
>function (supplies) {} : (supplies: any) => void
@@ -49,7 +49,7 @@ Wagon.prototype.weight = supplies => supplies ? supplies.length : -1
>Wagon.prototype.weight = supplies => supplies ? supplies.length : -1 : (supplies: any) => any
>Wagon.prototype.weight : any
>Wagon.prototype : any
->Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; }
+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; }
>prototype : any
>weight : any
>supplies => supplies ? supplies.length : -1 : (supplies: any) => any
@@ -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: any): void; circle: (wagons: any) => any; }
+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; }
>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: any): void; circle: (wagons: any) => any; }
+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; }
constructor() {
super(); // error: not enough arguments
@@ -104,13 +104,13 @@ class Sql extends Wagon {
* This is not assignable, so should have a type error
*/
load(files, format) {
->load : (files: any, format: any) => void
->files : any
->format : any
+>load : (files: string[], format: "csv" | "json" | "xmlolololol") => void
+>files : string[]
+>format : "csv" | "json" | "xmlolololol"
if (format === "xmlolololol") {
>format === "xmlolololol" : boolean
->format : any
+>format : "csv" | "json" | "xmlolololol"
>"xmlolololol" : "xmlolololol"
throw new Error("please do not use XML. It was a joke.");
@@ -188,7 +188,7 @@ class Firedrake extends Dragon {
// ok
class Conestoga extends Wagon {
>Conestoga : Conestoga
->Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; }
+>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; }
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: any): void; circle: (wagons: any) => any; }[]) => number
->others : { (numberOxen: any): void; circle: (wagons: any) => any; }[]
->Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; }
+>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; }
return others.length
>others.length : number
->others : { (numberOxen: any): void; circle: (wagons: any) => any; }[]
+>others : { (numberOxen: number): void; circle: (wagons: any) => any; }[]
>length : number
}
}
@@ -234,20 +234,20 @@ c.numberOxen
* @param {T} flavour
*/
function Soup(flavour) {
->Soup : (flavour: any) => void
->flavour : any
+>Soup : (flavour: T) => void
+>flavour : T
this.flavour = flavour
->this.flavour = flavour : any
+>this.flavour = flavour : T
>this.flavour : any
>this : any
>flavour : any
->flavour : any
+>flavour : T
}
/** @extends {Soup<{ claim: "ignorant" | "malicious" }>} */
class Chowder extends Soup {
>Chowder : Chowder
->Soup : (flavour: any) => void
+>Soup : (flavour: T) => void
log() {
>log : () => any
@@ -262,7 +262,7 @@ class Chowder extends Soup {
var soup = new Soup(1);
>soup : any
>new Soup(1) : any
->Soup : (flavour: any) => void
+>Soup : (flavour: T) => void
>1 : 1
soup.flavour
diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types
index 53e5d345b8..cc0fc9ebc6 100644
--- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types
+++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types
@@ -9,10 +9,10 @@ const { funky } = require('./commonJSAliasedExport');
/** @type {boolean} */
var diddy
->diddy : any
+>diddy : boolean
var diddy = funky(1)
->diddy : any
+>diddy : boolean
>funky(1) : any
>funky : any
>1 : 1
diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt
index 0cafdc45f5..04d5cfd894 100644
--- a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt
@@ -1,6 +1,6 @@
main.js(1,9): error TS2451: Cannot redeclare block-scoped variable 'K'.
main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
-main.js(3,12): error TS7006: Parameter 'k' implicitly has an 'any' type.
+main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'?
mod1.js(1,7): error TS2451: Cannot redeclare block-scoped variable 'K'.
mod1.js(6,1): error TS2304: Cannot find name 'exports'.
@@ -13,9 +13,9 @@ mod1.js(6,1): error TS2304: Cannot find name 'exports'.
~~~~~~~
!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
/** @param {K} k */
+ ~
+!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'?
function f(k) {
- ~
-!!! error TS7006: Parameter 'k' implicitly has an 'any' type.
k.values()
}
diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types
index 98958f7c45..03ded8a6a7 100644
--- a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types
+++ b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types
@@ -9,13 +9,13 @@ const { K } = require("./mod1");
/** @param {K} k */
function f(k) {
->f : (k: any) => void
->k : any
+>f : (k: K) => void
+>k : K
k.values()
>k.values() : any
>k.values : any
->k : any
+>k : K
>values : any
}
diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt
index 4b5091844a..eb50cc5891 100644
--- a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt
@@ -1,5 +1,5 @@
main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
-main.js(3,12): error TS7006: Parameter 'k' implicitly has an 'any' type.
+main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'?
mod1.js(1,1): error TS2304: Cannot find name 'exports'.
@@ -8,9 +8,9 @@ mod1.js(1,1): error TS2304: Cannot find name 'exports'.
~~~~~~~
!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
/** @param {K} k */
+ ~
+!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'?
function f(k) {
- ~
-!!! error TS7006: Parameter 'k' implicitly has an 'any' type.
k.values()
}
diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types
index a91436eab1..271bca849a 100644
--- a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types
+++ b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types
@@ -9,13 +9,13 @@ const { K } = require("./mod1");
/** @param {K} k */
function f(k) {
->f : (k: any) => void
->k : any
+>f : (k: K) => void
+>k : K
k.values()
>k.values() : any
>k.values : any
->k : any
+>k : K
>values : any
}
diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt
index f073a561ff..0444e83a7f 100644
--- a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt
@@ -1,5 +1,5 @@
main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
-main.js(3,12): error TS7006: Parameter 'k' implicitly has an 'any' type.
+main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'?
mod1.js(2,4): error TS2339: Property 'K' does not exist on type '{}'.
mod1.js(4,23): error TS2339: Property 'K' does not exist on type '{}'.
mod1.js(7,1): error TS2304: Cannot find name 'exports'.
@@ -11,9 +11,9 @@ mod1.js(7,16): error TS2339: Property 'K' does not exist on type '{}'.
~~~~~~~
!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
/** @param {K} k */
+ ~
+!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'?
function f(k) {
- ~
-!!! error TS7006: Parameter 'k' implicitly has an 'any' type.
k.values()
}
diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types
index 14f792ae09..7176fdf016 100644
--- a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types
+++ b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types
@@ -9,13 +9,13 @@ const { K } = require("./mod1");
/** @param {K} k */
function f(k) {
->f : (k: any) => void
->k : any
+>f : (k: K) => void
+>k : K
k.values()
>k.values() : any
>k.values : any
->k : any
+>k : K
>values : any
}
diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt
new file mode 100644
index 0000000000..051cf5113e
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt
@@ -0,0 +1,43 @@
+constructorFunctionMethodTypeParameters.js(22,16): error TS2304: Cannot find name 'T'.
+constructorFunctionMethodTypeParameters.js(24,17): error TS2304: Cannot find name 'T'.
+
+
+==== constructorFunctionMethodTypeParameters.js (2 errors) ====
+ /**
+ * @template {string} T
+ * @param {T} t
+ */
+ function Cls(t) {
+ this.t = t;
+ }
+
+ /**
+ * @template {string} V
+ * @param {T} t
+ * @param {V} v
+ * @return {V}
+ */
+ Cls.prototype.topLevelComment = function (t, v) {
+ return v
+ };
+
+ Cls.prototype.nestedComment =
+ /**
+ * @template {string} U
+ * @param {T} t
+ ~
+!!! error TS2304: Cannot find name 'T'.
+ * @param {U} u
+ * @return {T}
+ ~
+!!! error TS2304: Cannot find name 'T'.
+ */
+ function (t, u) {
+ return t
+ };
+
+ var c = new Cls('a');
+ const s = c.topLevelComment('a', 'b');
+ const t = c.nestedComment('a', 'b');
+
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types
index b7173f4d71..3c44273775 100644
--- a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types
+++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types
@@ -6,15 +6,15 @@
* @param {T} t
*/
function Cls(t) {
->Cls : (t: any) => void
->t : any
+>Cls : (t: T) => void
+>t : T
this.t = t;
->this.t = t : any
+>this.t = t : T
>this.t : any
>this : any
>t : any
->t : any
+>t : T
}
/**
@@ -27,7 +27,7 @@ Cls.prototype.topLevelComment = function (t, v) {
>Cls.prototype.topLevelComment = function (t, v) { return v} : (t: any, v: any) => any
>Cls.prototype.topLevelComment : any
>Cls.prototype : any
->Cls : (t: any) => void
+>Cls : (t: T) => void
>prototype : any
>topLevelComment : any
>function (t, v) { return v} : (t: any, v: any) => any
@@ -40,10 +40,10 @@ Cls.prototype.topLevelComment = function (t, v) {
};
Cls.prototype.nestedComment =
->Cls.prototype.nestedComment = /** * @template {string} U * @param {T} t * @param {U} u * @return {T} */ function (t, u) { return t } : (t: any, u: any) => any
+>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
->Cls : (t: any) => void
+>Cls : (t: T) => void
>prototype : any
>nestedComment : any
@@ -54,19 +54,19 @@ Cls.prototype.nestedComment =
* @return {T}
*/
function (t, u) {
->function (t, u) { return t } : (t: any, u: any) => any
->t : any
->u : any
+>function (t, u) { return t } : (t: T, u: U) => T
+>t : T
+>u : U
return t
->t : any
+>t : T
};
var c = new Cls('a');
>c : any
>new Cls('a') : any
->Cls : (t: any) => void
+>Cls : (t: T) => void
>'a' : "a"
const s = c.topLevelComment('a', 'b');
diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctions.types b/testdata/baselines/reference/submodule/conformance/constructorFunctions.types
index 786e3438ed..e3e261c170 100644
--- a/testdata/baselines/reference/submodule/conformance/constructorFunctions.types
+++ b/testdata/baselines/reference/submodule/conformance/constructorFunctions.types
@@ -176,11 +176,11 @@ var c6_v1 = new C6();
* @param {number} num
*/
function C7(num) {}
->C7 : (num: any) => void
->num : any
+>C7 : (num: number) => void
+>num : number
var c7_v1 = new C7();
>c7_v1 : any
>new C7() : any
->C7 : (num: any) => void
+>C7 : (num: number) => void
diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.errors.txt b/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.errors.txt
index 7aa952a2a5..0744aa6348 100644
--- a/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.errors.txt
@@ -1,15 +1,11 @@
-a.js(2,12): error TS7006: Parameter 'x' implicitly has an 'any' type.
a.js(8,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
-a.js(13,12): error TS7006: Parameter 'x' implicitly has an 'any' type.
a.js(15,16): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
a.js(20,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
-==== a.js (5 errors) ====
+==== a.js (3 errors) ====
/** @param {number} x */
function C(x) {
- ~
-!!! error TS7006: Parameter 'x' implicitly has an 'any' type.
this.x = x
}
C.prototype.m = function() {
@@ -23,8 +19,6 @@ a.js(20,9): error TS7009: 'new' expression, whose target lacks a construct signa
/** @param {number} x */
function A(x) {
- ~
-!!! error TS7006: Parameter 'x' implicitly has an 'any' type.
if (!(this instanceof A)) {
return new A(x)
~~~~~~~~
diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.types b/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.types
index db8c347c84..1740c1a364 100644
--- a/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.types
+++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.types
@@ -3,21 +3,21 @@
=== a.js ===
/** @param {number} x */
function C(x) {
->C : (x: any) => void
->x : any
+>C : (x: number) => void
+>x : number
this.x = x
->this.x = x : any
+>this.x = x : number
>this.x : any
>this : any
>x : any
->x : any
+>x : number
}
C.prototype.m = function() {
>C.prototype.m = function() { this.y = 12} : () => void
>C.prototype.m : any
>C.prototype : any
->C : (x: any) => void
+>C : (x: number) => void
>prototype : any
>m : any
>function() { this.y = 12} : () => void
@@ -32,7 +32,7 @@ C.prototype.m = function() {
var c = new C(1)
>c : any
>new C(1) : any
->C : (x: any) => void
+>C : (x: number) => void
>1 : 1
c.x = undefined // should error
@@ -51,38 +51,38 @@ c.y = undefined // ok
/** @param {number} x */
function A(x) {
->A : (x: any) => any
->x : any
+>A : (x: number) => any
+>x : number
if (!(this instanceof A)) {
>!(this instanceof A) : boolean
>(this instanceof A) : boolean
>this instanceof A : boolean
>this : any
->A : (x: any) => any
+>A : (x: number) => any
return new A(x)
>new A(x) : any
->A : (x: any) => any
->x : any
+>A : (x: number) => any
+>x : number
}
this.x = x
->this.x = x : any
+>this.x = x : number
>this.x : any
>this : any
>x : any
->x : any
+>x : number
}
var k = A(1)
>k : any
>A(1) : any
->A : (x: any) => any
+>A : (x: number) => any
>1 : 1
var j = new A(2)
>j : any
>new A(2) : any
->A : (x: any) => any
+>A : (x: number) => any
>2 : 2
k.x === j.x
diff --git a/testdata/baselines/reference/submodule/conformance/contextualTypeFromJSDoc.types b/testdata/baselines/reference/submodule/conformance/contextualTypeFromJSDoc.types
index e5b823c60c..82c90c7c6c 100644
--- a/testdata/baselines/reference/submodule/conformance/contextualTypeFromJSDoc.types
+++ b/testdata/baselines/reference/submodule/conformance/contextualTypeFromJSDoc.types
@@ -3,18 +3,18 @@
=== index.js ===
/** @type {Array<[string, {x?:number, y?:number}]>} */
const arr = [
->arr : ((string | { x: number; })[] | (string | { y: number; })[])[]
->[ ['a', { x: 1 }], ['b', { y: 2 }]] : ((string | { x: number; })[] | (string | { y: number; })[])[]
+>arr : [string, { x?: number; y?: number; }][]
+>[ ['a', { x: 1 }], ['b', { y: 2 }]] : ([string, { x: number; }] | [string, { y: number; }])[]
['a', { x: 1 }],
->['a', { x: 1 }] : (string | { x: number; })[]
+>['a', { x: 1 }] : [string, { x: number; }]
>'a' : "a"
>{ x: 1 } : { x: number; }
>x : number
>1 : 1
['b', { y: 2 }]
->['b', { y: 2 }] : (string | { y: number; })[]
+>['b', { y: 2 }] : [string, { y: number; }]
>'b' : "b"
>{ y: 2 } : { y: number; }
>y : number
@@ -24,20 +24,20 @@ const arr = [
/** @return {Array<[string, {x?:number, y?:number}]>} */
function f() {
->f : () => ((string | { x: number; })[] | (string | { y: number; })[])[]
+>f : () => [string, { x?: number; y?: number; }][]
return [
->[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ((string | { x: number; })[] | (string | { y: number; })[])[]
+>[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ([string, { x: number; }] | [string, { y: number; }])[]
['a', { x: 1 }],
->['a', { x: 1 }] : (string | { x: number; })[]
+>['a', { x: 1 }] : [string, { x: number; }]
>'a' : "a"
>{ x: 1 } : { x: number; }
>x : number
>1 : 1
['b', { y: 2 }]
->['b', { y: 2 }] : (string | { y: number; })[]
+>['b', { y: 2 }] : [string, { y: number; }]
>'b' : "b"
>{ y: 2 } : { y: number; }
>y : number
@@ -51,24 +51,24 @@ class C {
/** @param {Array<[string, {x?:number, y?:number}]>} value */
set x(value) { }
->x : ((string | { x: number; })[] | (string | { y: number; })[])[]
->value : ((string | { x: number; })[] | (string | { y: number; })[])[]
+>x : [string, { x?: number; y?: number; }][]
+>value : [string, { x?: number; y?: number; }][]
get x() {
->x : ((string | { x: number; })[] | (string | { y: number; })[])[]
+>x : [string, { x?: number; y?: number; }][]
return [
->[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ((string | { x: number; })[] | (string | { y: number; })[])[]
+>[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ([string, { x: number; }] | [string, { y: number; }])[]
['a', { x: 1 }],
->['a', { x: 1 }] : (string | { x: number; })[]
+>['a', { x: 1 }] : [string, { x: number; }]
>'a' : "a"
>{ x: 1 } : { x: number; }
>x : number
>1 : 1
['b', { y: 2 }]
->['b', { y: 2 }] : (string | { y: number; })[]
+>['b', { y: 2 }] : [string, { y: number; }]
>'b' : "b"
>{ y: 2 } : { y: number; }
>y : number
diff --git a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt
index 686855675a..800958af53 100644
--- a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt
@@ -1,7 +1,11 @@
+a.js(24,13): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'?
+a.js(25,12): error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'?
+a.js(26,12): error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'?
+a.js(35,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'?
a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'.
-==== a.js (1 errors) ====
+==== a.js (5 errors) ====
/** @enum {string} */
const Target = {
START: "start",
@@ -26,8 +30,14 @@ a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: s
}
/** @param {Target} t
+ ~~~~~~
+!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'?
* @param {Second} s
+ ~~~~~~
+!!! error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'?
* @param {Fs} f
+ ~~
+!!! error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'?
*/
function consume(t,s,f) {
/** @type {string} */
@@ -37,6 +47,8 @@ a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: s
/** @type {(n: number) => number} */
var fun = f
/** @type {Target} */
+ ~~~~~~
+!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'?
var v = Target.START
v = Target.UNKNOWN // error, can't find 'UNKNOWN'
~~~~~~~
diff --git a/testdata/baselines/reference/submodule/conformance/enumTag.types b/testdata/baselines/reference/submodule/conformance/enumTag.types
index 14215c159e..e8fa8e9905 100644
--- a/testdata/baselines/reference/submodule/conformance/enumTag.types
+++ b/testdata/baselines/reference/submodule/conformance/enumTag.types
@@ -25,6 +25,7 @@ const Target = {
/** @type {number} */
OK_I_GUESS: 2
>OK_I_GUESS : number
+>2 : number
>2 : 2
}
/** @enum number */
@@ -43,6 +44,7 @@ const Second = {
/** @type {number} */
FINE: 2,
>FINE : number
+>2 : number
>2 : 2
}
/** @enum {function(number): number} */
@@ -78,63 +80,63 @@ const Fs = {
* @param {Fs} f
*/
function consume(t,s,f) {
->consume : (t: any, s: any, f: any) => void
->t : any
->s : any
->f : any
+>consume : (t: Target, s: Second, f: Fs) => void
+>t : Target
+>s : Second
+>f : Fs
/** @type {string} */
var str = t
->str : any
->t : any
+>str : string
+>t : Target
/** @type {number} */
var num = s
->num : any
->s : any
+>num : number
+>s : Second
/** @type {(n: number) => number} */
var fun = f
->fun : any
->f : any
+>fun : (n: number) => number
+>f : Fs
/** @type {Target} */
var v = Target.START
->v : string
+>v : Target
>Target.START : string
>Target : { START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }
>START : string
v = Target.UNKNOWN // error, can't find 'UNKNOWN'
>v = Target.UNKNOWN : any
->v : string
+>v : Target
>Target.UNKNOWN : any
>Target : { START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }
>UNKNOWN : any
v = Second.MISTAKE // meh..ok, I guess?
>v = Second.MISTAKE : string
->v : string
+>v : Target
>Second.MISTAKE : string
>Second : { MISTAKE: string; OK: number; FINE: number; }
>MISTAKE : string
v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums
>v = 'something else' : "something else"
->v : string
+>v : Target
>'something else' : "something else"
}
/** @param {string} s */
function ff(s) {
->ff : (s: any) => any
->s : any
+>ff : (s: string) => any
+>s : string
// element access with arbitrary string is an error only with noImplicitAny
if (!Target[s]) {
>!Target[s] : boolean
>Target[s] : any
>Target : { START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }
->s : any
+>s : string
return null
}
@@ -142,7 +144,7 @@ function ff(s) {
return Target[s]
>Target[s] : any
>Target : { START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }
->s : any
+>s : string
}
}
diff --git a/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt b/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt
new file mode 100644
index 0000000000..5180e90595
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt
@@ -0,0 +1,31 @@
+type.js(1,32): error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'.
+type.js(4,29): error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'.
+value.js(2,12): error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'?
+
+
+==== type.js (2 errors) ====
+ /** @typedef {import("./mod1").TestEnum} TE */
+ ~~~~~~~~
+!!! error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'.
+ /** @type {TE} */
+ const test = 'add'
+ /** @type {import("./mod1").TestEnum} */
+ ~~~~~~~~
+!!! error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'.
+ const tost = 'remove'
+
+==== value.js (1 errors) ====
+ import { TestEnum } from "./mod1"
+ /** @type {TestEnum} */
+ ~~~~~~~~
+!!! error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'?
+ const tist = TestEnum.ADD
+
+
+==== mod1.js (0 errors) ====
+ /** @enum {string} */
+ export const TestEnum = {
+ ADD: 'add',
+ REMOVE: 'remove'
+ }
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/enumTagImported.types b/testdata/baselines/reference/submodule/conformance/enumTagImported.types
index 361a32f1be..a7e576e4d9 100644
--- a/testdata/baselines/reference/submodule/conformance/enumTagImported.types
+++ b/testdata/baselines/reference/submodule/conformance/enumTagImported.types
@@ -4,12 +4,12 @@
/** @typedef {import("./mod1").TestEnum} TE */
/** @type {TE} */
const test = 'add'
->test : "add"
+>test : any
>'add' : "add"
/** @type {import("./mod1").TestEnum} */
const tost = 'remove'
->tost : "remove"
+>tost : any
>'remove' : "remove"
=== value.js ===
@@ -18,7 +18,7 @@ import { TestEnum } from "./mod1"
/** @type {TestEnum} */
const tist = TestEnum.ADD
->tist : string
+>tist : TestEnum
>TestEnum.ADD : string
>TestEnum : { ADD: string; REMOVE: string; }
>ADD : string
diff --git a/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt
new file mode 100644
index 0000000000..5aebbf567d
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt
@@ -0,0 +1,16 @@
+bug27134.js(7,11): error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'?
+
+
+==== bug27134.js (1 errors) ====
+ /**
+ * @enum {number}
+ */
+ var foo = { };
+
+ /**
+ * @type {foo}
+ ~~~
+!!! error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'?
+ */
+ var s;
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.types b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.types
index 2468c5b902..09e308a994 100644
--- a/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.types
+++ b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.types
@@ -12,5 +12,5 @@ var foo = { };
* @type {foo}
*/
var s;
->s : any
+>s : foo
diff --git a/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt
new file mode 100644
index 0000000000..35cf4728a3
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt
@@ -0,0 +1,56 @@
+foo.js(20,12): error TS2304: Cannot find name 'FunctionReturningPromise'.
+foo.js(44,12): error TS2304: Cannot find name 'FunctionReturningNever'.
+
+
+==== foo.js (2 errors) ====
+ /**
+ * @callback FunctionReturningPromise
+ * @returns {Promise}
+ */
+
+ /** @type {FunctionReturningPromise} */
+ function testPromise1() {
+ console.log("Nope");
+ }
+
+ /** @type {FunctionReturningPromise} */
+ async function testPromise2() {
+ return "asd";
+ }
+
+ var testPromise3 = /** @type {FunctionReturningPromise} */ function() {
+ console.log("test")
+ }
+
+ /** @type {FunctionReturningPromise} */
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2304: Cannot find name 'FunctionReturningPromise'.
+ var testPromise4 = function() {
+ console.log("test")
+ }
+
+ /**
+ * @callback FunctionReturningNever
+ * @returns {never}
+ */
+
+ /** @type {FunctionReturningNever} */
+ function testNever1() {
+
+ }
+
+ /** @type {FunctionReturningNever} */
+ async function testNever2() {
+ return "asd";
+ }
+
+ var testNever3 = /** @type {FunctionReturningNever} */ function() {
+ console.log("test")
+ }
+
+ /** @type {FunctionReturningNever} */
+ ~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2304: Cannot find name 'FunctionReturningNever'.
+ var testNever4 = function() {
+ console.log("test")
+ }
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.types b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.types
index 4f06c52f86..4a72817f54 100644
--- a/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.types
+++ b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.types
@@ -40,7 +40,7 @@ var testPromise3 = /** @type {FunctionReturningPromise} */ function() {
/** @type {FunctionReturningPromise} */
var testPromise4 = function() {
->testPromise4 : () => void
+>testPromise4 : FunctionReturningPromise
>function() { console.log("test")} : () => void
console.log("test")
@@ -84,7 +84,7 @@ var testNever3 = /** @type {FunctionReturningNever} */ function() {
/** @type {FunctionReturningNever} */
var testNever4 = function() {
->testNever4 : () => void
+>testNever4 : FunctionReturningNever
>function() { console.log("test")} : () => void
console.log("test")
diff --git a/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.types b/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.types
index d7d5f0ab53..b984114ef5 100644
--- a/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.types
+++ b/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.types
@@ -70,18 +70,18 @@ var classic = new s.Classic()
/** @param {s.n.K} c
@param {s.Classic} classic */
function f(c, classic) {
->f : (c: any, classic: any) => void
->c : any
->classic : any
+>f : (c: K, classic: Classic) => void
+>c : K
+>classic : Classic
c.x
>c.x : any
->c : any
+>c : K
>x : any
classic.p
>classic.p : any
->classic : any
+>classic : Classic
>p : any
}
diff --git a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt
new file mode 100644
index 0000000000..3e7597d212
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt
@@ -0,0 +1,19 @@
+use.js(3,12): error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'?
+
+
+==== def.js (0 errors) ====
+ /** @enum {number} */
+ const MyEnum = {
+ a: 1,
+ b: 2
+ };
+ export default MyEnum;
+
+==== use.js (1 errors) ====
+ import MyEnum from "./def";
+
+ /** @type {MyEnum} */
+ ~~~~~~
+!!! error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'?
+ const v = MyEnum.b;
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types
index 2742f18d3c..ac3b962eb8 100644
--- a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types
+++ b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types
@@ -24,7 +24,7 @@ import MyEnum from "./def";
/** @type {MyEnum} */
const v = MyEnum.b;
->v : number
+>v : MyEnum
>MyEnum.b : number
>MyEnum : { a: number; b: number; }
>b : number
diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag1.types b/testdata/baselines/reference/submodule/conformance/extendsTag1.types
index a96398b3ed..1fe7b48839 100644
--- a/testdata/baselines/reference/submodule/conformance/extendsTag1.types
+++ b/testdata/baselines/reference/submodule/conformance/extendsTag1.types
@@ -6,6 +6,6 @@
* @extends {Set} Should prefer this Set, not the Set in the heritage clause
*/
class My extends Set {}
->My : My
+>My : My
>Set : Set
diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt
new file mode 100644
index 0000000000..8e78b2b91f
--- /dev/null
+++ b/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt
@@ -0,0 +1,60 @@
+/a.js(26,17): error TS2314: Generic type 'A' requires 1 type argument(s).
+/a.js(34,17): error TS2314: Generic type 'A