diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go index dc6c661c8f..faab4e00b0 100644 --- a/internal/parser/reparser.go +++ b/internal/parser/reparser.go @@ -224,10 +224,10 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) } case ast.KindReturnStatement: ret := parent.AsReturnStatement() - ret.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), ret.Expression) + ret.Expression = p.makeNewCast(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), ret.Expression, true /*isAssertion*/) case ast.KindParenthesizedExpression: paren := parent.AsParenthesizedExpression() - paren.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), paren.Expression) + paren.Expression = p.makeNewCast(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), paren.Expression, true /*isAssertion*/) case ast.KindExpressionStatement: if parent.AsExpressionStatement().Expression.Kind == ast.KindBinaryExpression { bin := parent.AsExpressionStatement().Expression.AsBinaryExpression() @@ -236,6 +236,11 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) } } } + case ast.KindJSDocSatisfiesTag: + if parent.Kind == ast.KindParenthesizedExpression { + paren := parent.AsParenthesizedExpression() + paren.Expression = p.makeNewCast(p.makeNewType(tag.AsJSDocSatisfiesTag().TypeExpression, nil), paren.Expression, false /*isAssertion*/) + } case ast.KindJSDocTemplateTag: if fun, ok := getFunctionLikeHost(parent); ok { if fun.TypeParameters() == nil { @@ -266,6 +271,31 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) } } } + case ast.KindJSDocThisTag: + if fun, ok := getFunctionLikeHost(parent); ok { + params := fun.Parameters() + if len(params) == 0 || params[0].Name().Kind != ast.KindThisKeyword { + thisParam := p.factory.NewParameterDeclaration( + nil, /* decorators */ + nil, /* modifiers */ + p.factory.NewIdentifier("this"), + nil, /* questionToken */ + nil, /* type */ + nil, /* initializer */ + ) + thisParam.AsParameterDeclaration().Type = p.makeNewType(tag.AsJSDocThisTag().TypeExpression, thisParam) + thisParam.Loc = tag.AsJSDocThisTag().TagName.Loc + thisParam.Flags = p.contextFlags | ast.NodeFlagsReparsed + + newParams := p.nodeSlicePool.NewSlice(len(params) + 1) + newParams[0] = thisParam + for i, param := range params { + newParams[i+1] = param + } + + fun.FunctionLikeData().Parameters = p.newNodeList(thisParam.Loc, newParams) + } + } case ast.KindJSDocReturnTag: if fun, ok := getFunctionLikeHost(parent); ok { if fun.Type() == nil { @@ -351,7 +381,6 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) } } } - // !!! other attached tags (@this, @satisfies) support goes here } func (p *Parser) makeQuestionIfOptional(parameter *ast.JSDocParameterTag) *ast.Node { @@ -398,8 +427,13 @@ func getFunctionLikeHost(host *ast.Node) (*ast.Node, bool) { return nil, false } -func (p *Parser) makeNewTypeAssertion(t *ast.TypeNode, e *ast.Node) *ast.Node { - assert := p.factory.NewTypeAssertion(t, e) +func (p *Parser) makeNewCast(t *ast.TypeNode, e *ast.Node, isAssertion bool) *ast.Node { + var assert *ast.Node + if isAssertion { + assert = p.factory.NewAsExpression(e, t) + } else { + assert = p.factory.NewSatisfiesExpression(e, t) + } assert.Flags = p.contextFlags | ast.NodeFlagsReparsed assert.Loc = core.NewTextRange(e.Pos(), e.End()) return assert diff --git a/internal/testutil/tsbaseline/type_symbol_baseline.go b/internal/testutil/tsbaseline/type_symbol_baseline.go index bd12c1a235..dd3b3ac159 100644 --- a/internal/testutil/tsbaseline/type_symbol_baseline.go +++ b/internal/testutil/tsbaseline/type_symbol_baseline.go @@ -327,14 +327,15 @@ func forEachASTNode(node *ast.Node) []*ast.Node { for len(work) > 0 { elem := work[len(work)-1] work = work[:len(work)-1] - if elem.Flags&ast.NodeFlagsReparsed != 0 && elem.Kind != ast.KindTypeAssertionExpression { - continue + if elem.Flags&ast.NodeFlagsReparsed == 0 || elem.Kind == ast.KindAsExpression || elem.Kind == ast.KindSatisfiesExpression { + if elem.Flags&ast.NodeFlagsReparsed == 0 { + result = append(result, elem) + } + elem.ForEachChild(addChild) + slices.Reverse(resChildren) + work = append(work, resChildren...) + resChildren = resChildren[:0] } - result = append(result, elem) - elem.ForEachChild(addChild) - slices.Reverse(resChildren) - work = append(work, resChildren...) - resChildren = resChildren[:0] } return result } diff --git a/testdata/baselines/reference/submodule/compiler/arrowExpressionBodyJSDoc.types b/testdata/baselines/reference/submodule/compiler/arrowExpressionBodyJSDoc.types index 2595c45c86..73169f527c 100644 --- a/testdata/baselines/reference/submodule/compiler/arrowExpressionBodyJSDoc.types +++ b/testdata/baselines/reference/submodule/compiler/arrowExpressionBodyJSDoc.types @@ -11,7 +11,6 @@ const foo1 = value => /** @type {string} */({ ...value }); >value => /** @type {string} */({ ...value }) : (value: T | undefined) => T >value : T | undefined >({ ...value }) : string ->{ ...value } : string >{ ...value } : {} >value : T | undefined @@ -25,9 +24,7 @@ const foo2 = value => /** @type {string} */(/** @type {T} */({ ...value })); >value => /** @type {string} */(/** @type {T} */({ ...value })) : (value: T | undefined) => T >value : T | undefined >(/** @type {T} */({ ...value })) : string ->({ ...value }) : string >({ ...value }) : T ->{ ...value } : T >{ ...value } : {} >value : T | undefined diff --git a/testdata/baselines/reference/submodule/compiler/arrowExpressionJs.types b/testdata/baselines/reference/submodule/compiler/arrowExpressionJs.types index 26c9070949..7e11bdc400 100644 --- a/testdata/baselines/reference/submodule/compiler/arrowExpressionJs.types +++ b/testdata/baselines/reference/submodule/compiler/arrowExpressionJs.types @@ -11,7 +11,6 @@ const cloneObjectGood = value => /** @type {T} */({ ...value }); >value => /** @type {T} */({ ...value }) : (value: T | undefined) => T >value : T | undefined >({ ...value }) : T ->{ ...value } : T >{ ...value } : {} >value : T | undefined diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types index c50e2500bd..3494d23bc9 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types @@ -29,7 +29,6 @@ module.exports = /** @type {FooFun} */(void 0); >module : { "export=": (foo: typeof import("./file")) => string; } >exports : (foo: typeof import("./file")) => string >(void 0) : (foo: typeof import("./file")) => string ->void 0 : (foo: typeof import("./file")) => string >void 0 : undefined >0 : 0 diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types index 0a096ac73a..8f199e3acd 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types @@ -19,7 +19,6 @@ function foo(fns) { return /** @type {any} */ (null); >(null) : any ->null : any } const result = foo({ diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types index 87ac4ac308..7c43485ae5 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types @@ -12,7 +12,6 @@ function filter(predicate) { return /** @type {any} */ (null); >(null) : any ->null : any } const a = filter( diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types index cf343ba62c..f20c6945f4 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types @@ -8,7 +8,6 @@ export default /** @type {NumberLike[]} */([ ]); >([ ]) : (string | number)[] ->[ ] : (string | number)[] >[ ] : undefined[] === b.ts === diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.types b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.types index c09db52c41..928989838d 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.types +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.types @@ -89,7 +89,6 @@ function flatMap(array, iterable = identity) { >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 diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.types b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.types index 8afa9b0633..7932e4b495 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.types +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.types @@ -84,7 +84,6 @@ function flatMap(array, iterable = identity) { >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 diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.types b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.types index c851fa7232..c494efff24 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.types @@ -14,7 +14,6 @@ export default _default; export default function () { return /** @type {import('./GeometryType.js').default} */ ('Point'); >('Point') : any ->'Point' : any >'Point' : "Point" } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.types b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.types index 1ba298ee22..c74d7f74b8 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.types @@ -32,7 +32,6 @@ let c = /** @type {'a' | 'b'} */ (x); // Ok >c : "a" | "b" >(x) : "a" | "b" ->x : "a" | "b" >x : string c; diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.types b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.types index ad819605f9..cc1d5a66f9 100644 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.types +++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.types @@ -21,7 +21,6 @@ const getStringGetter = (key) => { return /** @type {string} */ (cache.get(key)) >(cache.get(key)) : string ->cache.get(key) : string >cache.get(key) : string | Set | undefined >cache.get : (key: string) => string | Set | undefined >cache : Map> diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.types b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.types index fd2f5c031c..812d848ed2 100644 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.types +++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.types @@ -7,7 +7,6 @@ let value = ""; switch (/** @type {"foo" | "bar"} */ (value)) { >(value) : "bar" | "foo" ->value : "bar" | "foo" >value : string case "bar": diff --git a/testdata/baselines/reference/submodule/compiler/returnConditionalExpressionJSDocCast.types b/testdata/baselines/reference/submodule/compiler/returnConditionalExpressionJSDocCast.types index d2016ed057..555fe6553f 100644 --- a/testdata/baselines/reference/submodule/compiler/returnConditionalExpressionJSDocCast.types +++ b/testdata/baselines/reference/submodule/compiler/returnConditionalExpressionJSDocCast.types @@ -22,7 +22,6 @@ function source(type = "javascript") { >( type ? sources.get(type) : sources.get("some other thing") ) : String type ->type ? sources.get(type) : sources.get("some other thing") : String >type ? sources.get(type) : sources.get("some other thing") : string | undefined >type : string diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types index 1773918b3c..d7b145897d 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types @@ -9,7 +9,6 @@ const x = /** @type {Foo} */ ({}); >x : Foo >({}) : Foo ->{} : Foo >{} : {} x.foo; // number | undefined @@ -20,7 +19,6 @@ x.foo; // number | undefined const y = /** @type {Required} */ ({}); >y : Required >({}) : Required ->{} : Required >{} : {} y.foo; // number diff --git a/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.errors.txt b/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.errors.txt index e00dbc28f1..d752c5ddc4 100644 --- a/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.errors.txt @@ -1,10 +1,8 @@ /a.js(9,26): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. /a.js(15,31): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -/a.js(23,31): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -/a.js(31,26): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -==== /a.js (4 errors) ==== +==== /a.js (2 errors) ==== class Test { constructor() { /** @type {number[]} */ @@ -34,9 +32,6 @@ /** @this {Test} */ function (d) { console.log(d === this.data.length) - ~~~~ -!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -!!! related TS2738 /a.js:22:9: An outer value of 'this' is shadowed by this container. }, this) } @@ -45,9 +40,6 @@ /** @this {Test} */ function (d) { return d === this.data.length - ~~~~ -!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -!!! related TS2738 /a.js:30:9: An outer value of 'this' is shadowed by this container. }, this) } } diff --git a/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.symbols b/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.symbols index 85dc614666..5bfe9f806e 100644 --- a/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.symbols +++ b/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.symbols @@ -68,6 +68,11 @@ class Test { >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >d : Symbol(d, Decl(a.js, 21, 18)) +>this.data.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) +>this.data : Symbol(data, Decl(a.js, 1, 19)) +>this : Symbol((Missing), Decl(a.js, 20, 13)) +>data : Symbol(data, Decl(a.js, 1, 19)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) }, this) >this : Symbol(Test, Decl(a.js, 0, 0)) @@ -89,6 +94,11 @@ class Test { return d === this.data.length >d : Symbol(d, Decl(a.js, 29, 18)) +>this.data.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) +>this.data : Symbol(data, Decl(a.js, 1, 19)) +>this : Symbol((Missing), Decl(a.js, 28, 13)) +>data : Symbol(data, Decl(a.js, 1, 19)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) }, this) >this : Symbol(Test, Decl(a.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.symbols.diff b/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.symbols.diff index cc66a80b1f..78ff899241 100644 --- a/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.symbols.diff @@ -89,6 +89,11 @@ ->this : Symbol(this) ->data : Symbol(Test.data, Decl(a.js, 1, 19)) ->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>this.data.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) ++>this.data : Symbol(data, Decl(a.js, 1, 19)) ++>this : Symbol((Missing), Decl(a.js, 20, 13)) ++>data : Symbol(data, Decl(a.js, 1, 19)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) }, this) >this : Symbol(Test, Decl(a.js, 0, 0)) @@ -111,7 +116,7 @@ /** @this {Test} */ function (d) { -@@= skipped -64, +59 lines =@@ +@@= skipped -64, +64 lines =@@ return d === this.data.length >d : Symbol(d, Decl(a.js, 29, 18)) @@ -120,6 +125,11 @@ ->this : Symbol(this) ->data : Symbol(Test.data, Decl(a.js, 1, 19)) ->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>this.data.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) ++>this.data : Symbol(data, Decl(a.js, 1, 19)) ++>this : Symbol((Missing), Decl(a.js, 28, 13)) ++>data : Symbol(data, Decl(a.js, 1, 19)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) }, this) >this : Symbol(Test, Decl(a.js, 0, 0)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.types b/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.types index aa86beabe2..5b5f9828c4 100644 --- a/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.types +++ b/testdata/baselines/reference/submodule/compiler/thisInFunctionCallJs.types @@ -84,7 +84,7 @@ class Test { /** @this {Test} */ function (d) { ->function (d) { console.log(d === this.data.length) } : (d: number) => void +>function (d) { console.log(d === this.data.length) } : (this: Test, d: number) => void >d : number console.log(d === this.data.length) @@ -94,11 +94,11 @@ class Test { >log : (...data: any[]) => void >d === this.data.length : boolean >d : number ->this.data.length : any ->this.data : any ->this : any ->data : any ->length : any +>this.data.length : number +>this.data : number[] +>this : Test +>data : number[] +>length : number }, this) >this : this @@ -117,17 +117,17 @@ class Test { /** @this {Test} */ function (d) { ->function (d) { return d === this.data.length } : (d: number) => boolean +>function (d) { return d === this.data.length } : (this: Test, d: number) => boolean >d : number return d === this.data.length >d === this.data.length : boolean >d : number ->this.data.length : any ->this.data : any ->this : any ->data : any ->length : any +>this.data.length : number +>this.data : number[] +>this : Test +>data : number[] +>length : number }, this) >this : this diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types index 8aaa0c1341..6acd8d393f 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types @@ -22,7 +22,6 @@ const foo = (a) => { >(a).y !== 0 : boolean >(a).y : number >(a) : { x: number; } & { y: number; } ->a : { x: number; } & { y: number; } >a : { x: number; } >y : number >0 : 0 diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types index 565314abff..4923bf3f9c 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types @@ -62,9 +62,9 @@ const t5 = /** @satisfies {T3} */((m) => m.substring(0)); >0 : 0 const t6 = /** @satisfies {[number, number]} */ ([1, 2]); ->t6 : number[] ->([1, 2]) : number[] ->[1, 2] : number[] +>t6 : [number, number] +>([1, 2]) : [number, number] +>[1, 2] : [number, number] >1 : 1 >2 : 2 diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.types index 8682c675f8..77582f6470 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.types @@ -4,8 +4,8 @@ /** @typedef {Object. boolean>} Predicates */ const p = /** @satisfies {Predicates} */ ({ ->p : { isEven: (n: any) => boolean; isOdd: (n: any) => boolean; } ->({ isEven: n => n % 2 === 0, isOdd: n => n % 2 === 1}) : { isEven: (n: any) => boolean; isOdd: (n: any) => boolean; } +>p : any +>({ isEven: n => n % 2 === 0, isOdd: n => n % 2 === 1}) : any >{ isEven: n => n % 2 === 0, isOdd: n => n % 2 === 1} : { isEven: (n: any) => boolean; isOdd: (n: any) => boolean; } isEven: n => n % 2 === 0, diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt index f41bb7633d..bb8cbbe319 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt @@ -1,18 +1,15 @@ -/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,7): error TS7006: Parameter 's' implicitly has an 'any' type. -==== /a.js (2 errors) ==== +==== /a.js (1 errors) ==== /** @type {{ f(s: string): void } & Record }} */ let obj = /** @satisfies {{ g(s: string): void } & Record} */ ({ f(s) { }, // "incorrect" implicit any on 's' - g(s) { } ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. + g(s) { } }); // This needs to not crash (outer node is not expression) /** @satisfies {{ f(s: string): void }} */ ({ f(x) { } }) - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.types index 7a15d92fc8..a8e506648b 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.types @@ -4,23 +4,23 @@ /** @type {{ f(s: string): void } & Record }} */ let obj = /** @satisfies {{ g(s: string): void } & Record} */ ({ >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' g(s) { }}) : { f(s: any): void; g(s: string): void; } +>{ f(s) { }, // "incorrect" implicit any on 's' g(s) { }} : { f(s: any): void; g(s: string): void; } f(s) { }, // "incorrect" implicit any on 's' ->f : (s: string) => void ->s : string +>f : (s: any) => void +>s : any g(s) { } ->g : (s: any) => void ->s : any +>g : (s: string) => void +>s : string }); // This needs to not crash (outer node is not expression) /** @satisfies {{ f(s: string): void }} */ ({ f(x) { } }) ->({ f(x) { } }) : { f(x: any): void; } ->{ f(x) { } } : { f(x: any): void; } ->f : (x: any) => void ->x : any +>({ f(x) { } }) : { f(x: string): void; } +>{ f(x) { } } : { f(x: string): void; } +>f : (x: string) => void +>x : string diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.types index 50d5462d4e..d11b05dedb 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.types @@ -4,16 +4,16 @@ /** @typedef {{ move(distance: number): void }} Movable */ const car = /** @satisfies {Movable & Record} */ ({ ->car : { start(): void; move(d: any): void; stop(): void; } ->({ start() { }, move(d) { // d should be number }, stop() { }}) : { start(): void; move(d: any): void; stop(): void; } ->{ start() { }, move(d) { // d should be number }, stop() { }} : { start(): void; move(d: any): void; stop(): void; } +>car : { start(): void; move(d: number): void; stop(): void; } +>({ start() { }, move(d) { // d should be number }, stop() { }}) : { start(): void; move(d: number): void; stop(): void; } +>{ start() { }, move(d) { // d should be number }, stop() { }} : { start(): void; move(d: number): void; stop(): void; } start() { }, >start : () => void move(d) { ->move : (d: any) => void ->d : any +>move : (d: number) => void +>d : number // d should be number }, diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.types index 201e3b22d0..99ad5b50a5 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.types @@ -5,8 +5,8 @@ // Should be able to detect a failure here const x = /** @satisfies {Facts} */ ({ ->x : { m: boolean; s: string; } ->({ m: true, s: "false"}) : { m: boolean; s: string; } +>x : any +>({ m: true, s: "false"}) : any >{ m: true, s: "false"} : { m: boolean; s: string; } m: true, diff --git a/testdata/baselines/reference/submodule/conformance/constructorTagWithThisTag.symbols b/testdata/baselines/reference/submodule/conformance/constructorTagWithThisTag.symbols index 43147dd22a..1b0cd017dd 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorTagWithThisTag.symbols +++ b/testdata/baselines/reference/submodule/conformance/constructorTagWithThisTag.symbols @@ -10,5 +10,11 @@ function C() { >C : Symbol(C, Decl(classthisboth.js, 0, 0)) this.e = this.m + 1 +>this.e : Symbol(e, Decl(classthisboth.js, 2, 11)) +>this : Symbol((Missing), Decl(classthisboth.js, 2, 4)) +>e : Symbol(e, Decl(classthisboth.js, 2, 11)) +>this.m : Symbol(m, Decl(classthisboth.js, 2, 22)) +>this : Symbol((Missing), Decl(classthisboth.js, 2, 4)) +>m : Symbol(m, Decl(classthisboth.js, 2, 22)) } diff --git a/testdata/baselines/reference/submodule/conformance/constructorTagWithThisTag.symbols.diff b/testdata/baselines/reference/submodule/conformance/constructorTagWithThisTag.symbols.diff index 60f30f5ecd..5a60876231 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorTagWithThisTag.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/constructorTagWithThisTag.symbols.diff @@ -1,13 +1,15 @@ --- old.constructorTagWithThisTag.symbols +++ new.constructorTagWithThisTag.symbols -@@= skipped -9, +9 lines =@@ - >C : Symbol(C, Decl(classthisboth.js, 0, 0)) +@@= skipped -10, +10 lines =@@ this.e = this.m + 1 -->this.e : Symbol(e, Decl(classthisboth.js, 2, 11)) + >this.e : Symbol(e, Decl(classthisboth.js, 2, 11)) ->this : Symbol(this) ->e : Symbol(C.e, Decl(classthisboth.js, 5, 14)) -->this.m : Symbol(m, Decl(classthisboth.js, 2, 22)) ++>this : Symbol((Missing), Decl(classthisboth.js, 2, 4)) ++>e : Symbol(e, Decl(classthisboth.js, 2, 11)) + >this.m : Symbol(m, Decl(classthisboth.js, 2, 22)) ->this : Symbol(this) -->m : Symbol(m, Decl(classthisboth.js, 2, 22)) ++>this : Symbol((Missing), Decl(classthisboth.js, 2, 4)) + >m : Symbol(m, Decl(classthisboth.js, 2, 22)) } diff --git a/testdata/baselines/reference/submodule/conformance/constructorTagWithThisTag.types b/testdata/baselines/reference/submodule/conformance/constructorTagWithThisTag.types index ee61e32e97..04c04bde03 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorTagWithThisTag.types +++ b/testdata/baselines/reference/submodule/conformance/constructorTagWithThisTag.types @@ -7,17 +7,17 @@ * this-tag should win, both 'e' and 'm' should be defined. */ function C() { ->C : () => void +>C : (this: { e: number; m: number; }) => void this.e = this.m + 1 ->this.e = this.m + 1 : any ->this.e : any ->this : any ->e : any ->this.m + 1 : any ->this.m : any ->this : any ->m : any +>this.e = this.m + 1 : number +>this.e : number +>this : { e: number; m: number; } +>e : number +>this.m + 1 : number +>this.m : number +>this : { e: number; m: number; } +>m : number >1 : 1 } diff --git a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.types b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.types index f57a8e5ea1..5521333f39 100644 --- a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.types +++ b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.types @@ -41,9 +41,7 @@ export = MyClass; let a = /** @type {Foo} */(/** @type {*} */(undefined)); >a : import("./externs") >(/** @type {*} */(undefined)) : import("./externs") ->(undefined) : import("./externs") >(undefined) : any ->undefined : any >undefined : undefined a = new Foo({doer: Foo.Bar}); @@ -60,7 +58,6 @@ a = new Foo({doer: Foo.Bar}); const q = /** @type {import("./externs").Bar} */({ doer: q => q }); >q : import("./externs").Bar >({ doer: q => q }) : import("./externs").Bar ->{ doer: q => q } : import("./externs").Bar >{ doer: q => q } : { doer: (q: string) => string; } >doer : (q: string) => string >q => q : (q: string) => string @@ -70,7 +67,6 @@ const q = /** @type {import("./externs").Bar} */({ doer: q => q }); const r = /** @type {typeof import("./externs").Bar} */(r => r); >r : (x: string, y?: number) => void >(r => r) : (x: string, y?: number) => void ->r => r : (x: string, y?: number) => void >r => r : (r: string) => string >r : string >r : string diff --git a/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt b/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt deleted file mode 100644 index fcb93bba30..0000000000 --- a/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt +++ /dev/null @@ -1,40 +0,0 @@ -/a.js(8,9): error TS2322: Type 'typeof C' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'typeof C'. -/a.js(17,9): error TS2322: Type 'this' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'this'. - - -==== /a.js (2 errors) ==== - export class C { - /** - * @template T - * @this {T} - * @return {T} - */ - static a() { - return this; - ~~~~~~ -!!! error TS2322: Type 'typeof C' is not assignable to type 'T'. -!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'typeof C'. - } - - /** - * @template T - * @this {T} - * @return {T} - */ - b() { - return this; - ~~~~~~ -!!! error TS2322: Type 'this' is not assignable to type 'T'. -!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'this'. - } - } - - const a = C.a(); - a; // typeof C - - const c = new C(); - const b = c.b(); - b; // C - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/inferThis.symbols b/testdata/baselines/reference/submodule/conformance/inferThis.symbols index cd74badd8f..0d16167492 100644 --- a/testdata/baselines/reference/submodule/conformance/inferThis.symbols +++ b/testdata/baselines/reference/submodule/conformance/inferThis.symbols @@ -13,7 +13,7 @@ export class C { >a : Symbol(a, Decl(a.js, 0, 16)) return this; ->this : Symbol(C, Decl(a.js, 0, 0)) +>this : Symbol((Missing), Decl(a.js, 3, 8)) } /** @@ -25,7 +25,7 @@ export class C { >b : Symbol(b, Decl(a.js, 8, 5)) return this; ->this : Symbol(C, Decl(a.js, 0, 0)) +>this : Symbol((Missing), Decl(a.js, 12, 8)) } } diff --git a/testdata/baselines/reference/submodule/conformance/inferThis.symbols.diff b/testdata/baselines/reference/submodule/conformance/inferThis.symbols.diff index d64ec77c0d..f78d012533 100644 --- a/testdata/baselines/reference/submodule/conformance/inferThis.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/inferThis.symbols.diff @@ -9,7 +9,7 @@ return this; ->this : Symbol(this) -+>this : Symbol(C, Decl(a.js, 0, 0)) ++>this : Symbol((Missing), Decl(a.js, 3, 8)) } /** @@ -22,7 +22,7 @@ return this; ->this : Symbol(this) -+>this : Symbol(C, Decl(a.js, 0, 0)) ++>this : Symbol((Missing), Decl(a.js, 12, 8)) } } diff --git a/testdata/baselines/reference/submodule/conformance/inferThis.types b/testdata/baselines/reference/submodule/conformance/inferThis.types index 2a0f14878e..bab430c389 100644 --- a/testdata/baselines/reference/submodule/conformance/inferThis.types +++ b/testdata/baselines/reference/submodule/conformance/inferThis.types @@ -10,10 +10,10 @@ export class C { * @return {T} */ static a() { ->a : () => T +>a : (this: T) => T return this; ->this : typeof C +>this : T } /** @@ -22,22 +22,22 @@ export class C { * @return {T} */ b() { ->b : () => T +>b : (this: T) => T return this; ->this : this +>this : T } } const a = C.a(); ->a : unknown ->C.a() : unknown ->C.a : () => T +>a : typeof C +>C.a() : typeof C +>C.a : (this: T) => T >C : typeof C ->a : () => T +>a : (this: T) => T a; // typeof C ->a : unknown +>a : typeof C const c = new C(); >c : C @@ -45,12 +45,12 @@ const c = new C(); >C : typeof C const b = c.b(); ->b : unknown ->c.b() : unknown ->c.b : () => T +>b : C +>c.b() : C +>c.b : (this: T) => T >c : C ->b : () => T +>b : (this: T) => T b; // C ->b : unknown +>b : C diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.types index 29e702a072..6fc9270168 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.types @@ -62,7 +62,6 @@ export class E { get f1() { return /** @type {*} */(null); } >f1 : U >(null) : any ->null : any /** * @param {U} _p @@ -77,7 +76,6 @@ export class E { get f2() { return /** @type {*} */(null); } >f2 : U >(null) : any ->null : any /** * @param {U} _p @@ -309,7 +307,6 @@ export class O extends N { var x = /** @type {*} */(null); >x : any >(null) : any ->null : any export class VariableBase extends x {} >VariableBase : VariableBase diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.types index 403e527ca3..e394ef665d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.types @@ -26,7 +26,6 @@ export default class Foo { a = /** @type {Foo} */(null); >a : Foo >(null) : Foo ->null : Foo }; export const X = Foo; @@ -48,7 +47,6 @@ class Bar extends Fab { x = /** @type {Bar} */(null); >x : Bar >(null) : Bar ->null : Bar } export default Bar; >Bar : Bar diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.types index 6006082d96..10150973c1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.types @@ -54,7 +54,6 @@ function d(a, b) { return /** @type {*} */(null); } >a : number >b : number >(null) : any ->null : any Object.defineProperty(module.exports, "d", { value: d }); >Object.defineProperty(module.exports, "d", { value: d }) : any @@ -81,7 +80,6 @@ function e(a, b) { return /** @type {*} */(null); } >a : T >b : U >(null) : any ->null : any Object.defineProperty(module.exports, "e", { value: e }); >Object.defineProperty(module.exports, "e", { value: e }) : any diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.types index ec9469e48d..35ff520d78 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.types @@ -34,7 +34,6 @@ export function d(a, b) { return /** @type {*} */(null); } >a : number >b : number >(null) : any ->null : any /** * @template T,U @@ -47,7 +46,6 @@ export function e(a, b) { return /** @type {*} */(null); } >a : T >b : U >(null) : any ->null : any /** * @template T diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types index a178b06c90..9da702ec33 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types @@ -70,7 +70,6 @@ module.exports.d = function d(a, b) { return /** @type {*} */(null); } >a : any >b : any >(null) : any ->null : any /** * @template T,U @@ -90,7 +89,6 @@ module.exports.e = function e(a, b) { return /** @type {*} */(null); } >a : any >b : any >(null) : any ->null : any /** * @template T diff --git a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.types b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.types index d496efe380..46dfc2effb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.types @@ -47,7 +47,6 @@ function f3() { /** @type {(a: number, b: number) => number} */ return (a, b) => { >(a, b) => { return a + b; } : (a: number, b: number) => number ->(a, b) => { return a + b; } : (a: number, b: number) => number >a : number >b : number @@ -64,7 +63,6 @@ function f4() { /** @type {(a: number, b: number) => number} */ return function (a, b){ >function (a, b){ return a + b; } : (a: number, b: number) => number ->function (a, b){ return a + b; } : (a: number, b: number) => number >a : number >b : number diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.types index 868c12ce17..c006a8ea72 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.types @@ -9,15 +9,12 @@ var W: string; var W = /** @type {string} */(/** @type {*} */ (4)); >W : string >(/** @type {*} */ (4)) : string ->(4) : string >(4) : any ->4 : any >4 : 4 var W = /** @type {string} */(4); // Error >W : string >(4) : string ->4 : string >4 : 4 /** @type {*} */ @@ -31,7 +28,6 @@ var s; var a = /** @type {*} */("" + 4); >a : any >("" + 4) : any ->"" + 4 : any >"" + 4 : string >"" : "" >4 : 4 @@ -41,7 +37,6 @@ var s = "" + /** @type {*} */(4); >"" + /** @type {*} */(4) : string >"" : "" >(4) : any ->4 : any >4 : 4 class SomeBase { @@ -123,7 +118,6 @@ someBase = /** @type {SomeBase} */(someDerived); >someBase = /** @type {SomeBase} */(someDerived) : SomeBase >someBase : SomeBase >(someDerived) : SomeBase ->someDerived : SomeBase >someDerived : SomeDerived someBase = /** @type {SomeBase} */(someBase); @@ -131,13 +125,11 @@ someBase = /** @type {SomeBase} */(someBase); >someBase : SomeBase >(someBase) : SomeBase >someBase : SomeBase ->someBase : SomeBase someBase = /** @type {SomeBase} */(someOther); // Error >someBase = /** @type {SomeBase} */(someOther) : SomeBase >someBase : SomeBase >(someOther) : SomeBase ->someOther : SomeBase >someOther : SomeOther someDerived = /** @type {SomeDerived} */(someDerived); @@ -145,34 +137,29 @@ someDerived = /** @type {SomeDerived} */(someDerived); >someDerived : SomeDerived >(someDerived) : SomeDerived >someDerived : SomeDerived ->someDerived : SomeDerived someDerived = /** @type {SomeDerived} */(someBase); >someDerived = /** @type {SomeDerived} */(someBase) : SomeDerived >someDerived : SomeDerived >(someBase) : SomeDerived ->someBase : SomeDerived >someBase : SomeBase someDerived = /** @type {SomeDerived} */(someOther); // Error >someDerived = /** @type {SomeDerived} */(someOther) : SomeDerived >someDerived : SomeDerived >(someOther) : SomeDerived ->someOther : SomeDerived >someOther : SomeOther someOther = /** @type {SomeOther} */(someDerived); // Error >someOther = /** @type {SomeOther} */(someDerived) : SomeOther >someOther : SomeOther >(someDerived) : SomeOther ->someDerived : SomeOther >someDerived : SomeDerived someOther = /** @type {SomeOther} */(someBase); // Error >someOther = /** @type {SomeOther} */(someBase) : SomeOther >someOther : SomeOther >(someBase) : SomeOther ->someBase : SomeOther >someBase : SomeBase someOther = /** @type {SomeOther} */(someOther); @@ -180,7 +167,6 @@ someOther = /** @type {SomeOther} */(someOther); >someOther : SomeOther >(someOther) : SomeOther >someOther : SomeOther ->someOther : SomeOther someFakeClass = someBase; >someFakeClass = someBase : SomeBase @@ -201,7 +187,6 @@ someBase = /** @type {SomeBase} */(someFakeClass); >someBase = /** @type {SomeBase} */(someFakeClass) : SomeBase >someBase : SomeBase >(someFakeClass) : SomeBase ->someFakeClass : SomeBase >someFakeClass : any // Type assertion cannot be a type-predicate type @@ -216,7 +201,6 @@ var str; if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error >(numOrStr === undefined) : boolean >numOrStr === undefined : boolean ->numOrStr === undefined : boolean >numOrStr : string | number >undefined : undefined @@ -231,12 +215,10 @@ var asConst1 = /** @type {const} */(1); >asConst1 : 1 >(1) : 1 >1 : 1 ->1 : 1 var asConst2 = /** @type {const} */({ >asConst2 : { readonly x: 1; } >({ x: 1}) : { readonly x: 1; } ->{ x: 1} : { readonly x: 1; } >{ x: 1} : { readonly x: 1; } x: 1 diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.types b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.types index 75beb25f20..ad48fc800f 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.types +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.types @@ -81,7 +81,6 @@ function flatMap(array, iterable = identity) { >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 diff --git a/testdata/baselines/reference/submodule/conformance/thisTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/thisTag1.errors.txt deleted file mode 100644 index 97c3329beb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/thisTag1.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -a.js(6,12): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. - - -==== a.js (1 errors) ==== - /** @this {{ n: number }} Mount Holyoke Preparatory School - * @param {string} s - * @return {number} - */ - function f(s) { - return this.n + s.length - ~~~~ -!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. - } - - const o = { - f, - n: 1 - } - o.f('hi') - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols index 123d62d3cd..7f4d8f28ed 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols +++ b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols @@ -10,6 +10,9 @@ function f(s) { >s : Symbol(s, Decl(a.js, 4, 11)) return this.n + s.length +>this.n : Symbol(n, Decl(a.js, 0, 12)) +>this : Symbol((Missing), Decl(a.js, 0, 5)) +>n : Symbol(n, Decl(a.js, 0, 12)) >s.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(a.js, 4, 11)) >length : Symbol(length, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff index dd070655e0..ca875e1cec 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff @@ -1,12 +1,12 @@ --- old.thisTag1.symbols +++ new.thisTag1.symbols -@@= skipped -9, +9 lines =@@ - >s : Symbol(s, Decl(a.js, 4, 11)) +@@= skipped -10, +10 lines =@@ return this.n + s.length -->this.n : Symbol(n, Decl(a.js, 0, 12)) + >this.n : Symbol(n, Decl(a.js, 0, 12)) ->this : Symbol(this) -->n : Symbol(n, Decl(a.js, 0, 12)) ++>this : Symbol((Missing), Decl(a.js, 0, 5)) + >n : Symbol(n, Decl(a.js, 0, 12)) ->s.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>s.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(a.js, 4, 11)) diff --git a/testdata/baselines/reference/submodule/conformance/thisTag1.types b/testdata/baselines/reference/submodule/conformance/thisTag1.types index 9643db11d1..00893c7608 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag1.types +++ b/testdata/baselines/reference/submodule/conformance/thisTag1.types @@ -6,25 +6,25 @@ * @return {number} */ function f(s) { ->f : (s: string) => number +>f : (this: { n: number; }, s: string) => number >s : string return this.n + s.length ->this.n + s.length : any ->this.n : any ->this : any ->n : any +>this.n + s.length : number +>this.n : number +>this : { n: number; } +>n : number >s.length : number >s : string >length : number } const o = { ->o : { f: (s: string) => number; n: number; } ->{ f, n: 1} : { f: (s: string) => number; n: number; } +>o : { f: (this: { n: number; }, s: string) => number; n: number; } +>{ f, n: 1} : { f: (this: { n: number; }, s: string) => number; n: number; } f, ->f : (s: string) => number +>f : (this: { n: number; }, s: string) => number n: 1 >n : number @@ -32,8 +32,8 @@ const o = { } o.f('hi') >o.f('hi') : number ->o.f : (s: string) => number ->o : { f: (s: string) => number; n: number; } ->f : (s: string) => number +>o.f : (this: { n: number; }, s: string) => number +>o : { f: (this: { n: number; }, s: string) => number; n: number; } +>f : (this: { n: number; }, s: string) => number >'hi' : "hi" diff --git a/testdata/baselines/reference/submodule/conformance/thisTag2.types b/testdata/baselines/reference/submodule/conformance/thisTag2.types index 948118dc86..e4851664c3 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag2.types +++ b/testdata/baselines/reference/submodule/conformance/thisTag2.types @@ -3,9 +3,9 @@ === a.js === /** @this {string} */ export function f1() {} ->f1 : () => void +>f1 : (this: string) => void /** @this */ export function f2() {} ->f2 : () => void +>f2 : (this: any) => void diff --git a/testdata/baselines/reference/submodule/conformance/thisTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/thisTag3.errors.txt index 5815a12963..81623b16ce 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/thisTag3.errors.txt @@ -1,7 +1,8 @@ +/a.js(7,9): error TS2730: An arrow function cannot have a 'this' parameter. /a.js(10,21): error TS2339: Property 'fn' does not exist on type 'C'. -==== /a.js (1 errors) ==== +==== /a.js (2 errors) ==== /** * @typedef {{fn(a: string): void}} T */ @@ -9,6 +10,8 @@ class C { /** * @this {T} + ~~~~ +!!! error TS2730: An arrow function cannot have a 'this' parameter. * @param {string} a */ p = (a) => this.fn("" + a); diff --git a/testdata/baselines/reference/submodule/conformance/thisTag3.types b/testdata/baselines/reference/submodule/conformance/thisTag3.types index 7a0779ce9c..b62ff516aa 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag3.types +++ b/testdata/baselines/reference/submodule/conformance/thisTag3.types @@ -13,8 +13,8 @@ class C { * @param {string} a */ p = (a) => this.fn("" + a); ->p : (a: string) => any ->(a) => this.fn("" + a) : (a: string) => any +>p : (this: { fn(a: string): void; }, a: string) => any +>(a) => this.fn("" + a) : (this: { fn(a: string): void; }, a: string) => any >a : string >this.fn("" + a) : any >this.fn : any diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/arrowExpressionBodyJSDoc.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/arrowExpressionBodyJSDoc.types.diff deleted file mode 100644 index fa44d8649d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/arrowExpressionBodyJSDoc.types.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.arrowExpressionBodyJSDoc.types -+++ new.arrowExpressionBodyJSDoc.types -@@= skipped -10, +10 lines =@@ - >value => /** @type {string} */({ ...value }) : (value: T | undefined) => T - >value : T | undefined - >({ ...value }) : string -+>{ ...value } : string - >{ ...value } : {} - >value : T | undefined - -@@= skipped -13, +14 lines =@@ - >value => /** @type {string} */(/** @type {T} */({ ...value })) : (value: T | undefined) => T - >value : T | undefined - >(/** @type {T} */({ ...value })) : string -+>({ ...value }) : string - >({ ...value }) : T -+>{ ...value } : T - >{ ...value } : {} - >value : T | undefined diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/arrowExpressionJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/arrowExpressionJs.types.diff deleted file mode 100644 index 4402005973..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/arrowExpressionJs.types.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.arrowExpressionJs.types -+++ new.arrowExpressionJs.types -@@= skipped -10, +10 lines =@@ - >value => /** @type {T} */({ ...value }) : (value: T | undefined) => T - >value : T | undefined - >({ ...value }) : T -+>{ ...value } : T - >{ ...value } : {} - >value : T | undefined diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff index fbb01ace50..0e87eff864 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff @@ -14,6 +14,5 @@ +>module : { "export=": (foo: typeof import("./file")) => string; } +>exports : (foo: typeof import("./file")) => string +>(void 0) : (foo: typeof import("./file")) => string -+>void 0 : (foo: typeof import("./file")) => string >void 0 : undefined >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types.diff index 25edfbd20f..e1e77fd2e1 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types.diff @@ -11,7 +11,6 @@ return /** @type {any} */ (null); >(null) : any -+>null : any } const result = foo({ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types.diff index da70d9ceea..f76fbfc7c6 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types.diff @@ -1,14 +1,6 @@ --- old.contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types +++ new.contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types -@@= skipped -11, +11 lines =@@ - - return /** @type {any} */ (null); - >(null) : any -+>null : any - } - - const a = filter( -@@= skipped -11, +12 lines =@@ +@@= skipped -22, +22 lines =@@ * @param {number} [pose] */ (pose) => true diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff index e6dae4d90f..c6a8e0dac4 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff @@ -6,7 +6,6 @@ export default /** @type {NumberLike[]} */([ ]); ->([ ]) : NumberLike[] +>([ ]) : (string | number)[] -+>[ ] : (string | number)[] >[ ] : undefined[] === b.ts === diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.types.diff index 2f895cd1d5..ff629280db 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.types.diff @@ -8,12 +8,4 @@ +>identity : (x: T) => T /** @type {unknown[]} */ - const result = []; -@@= skipped -26, +26 lines =@@ - >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 \ No newline at end of file + const result = []; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.types.diff deleted file mode 100644 index 70cf65b1a4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.types.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.jsFileFunctionOverloads2.types -+++ new.jsFileFunctionOverloads2.types -@@= skipped -83, +83 lines =@@ - >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 \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeNodeNamespace.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeNodeNamespace.types.diff index b94ada8080..35e05e0049 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeNodeNamespace.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeNodeNamespace.types.diff @@ -6,6 +6,5 @@ return /** @type {import('./GeometryType.js').default} */ ('Point'); ->('Point') : typeof import("GeometryType").default +>('Point') : any -+>'Point' : any >'Point' : "Point" } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeCast.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeCast.types.diff index 6a17e72a6c..de2785dd99 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeCast.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeCast.types.diff @@ -17,12 +17,4 @@ +>(((x))) : string >((x)) : string >(x) : string - >x : string -@@= skipped -12, +12 lines =@@ - let c = /** @type {'a' | 'b'} */ (x); // Ok - >c : "a" | "b" - >(x) : "a" | "b" -+>x : "a" | "b" - >x : string - - c; \ No newline at end of file + >x : string \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastAtReturnStatement.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastAtReturnStatement.types.diff deleted file mode 100644 index 74485511ec..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastAtReturnStatement.types.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.parenthesizedJSDocCastAtReturnStatement.types -+++ new.parenthesizedJSDocCastAtReturnStatement.types -@@= skipped -20, +20 lines =@@ - - return /** @type {string} */ (cache.get(key)) - >(cache.get(key)) : string -+>cache.get(key) : string - >cache.get(key) : string | Set | undefined - >cache.get : (key: string) => string | Set | undefined - >cache : Map> \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastDoesNotNarrow.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastDoesNotNarrow.types.diff deleted file mode 100644 index 0345ce8f18..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastDoesNotNarrow.types.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.parenthesizedJSDocCastDoesNotNarrow.types -+++ new.parenthesizedJSDocCastDoesNotNarrow.types -@@= skipped -6, +6 lines =@@ - - switch (/** @type {"foo" | "bar"} */ (value)) { - >(value) : "bar" | "foo" -+>value : "bar" | "foo" - >value : string - - case "bar": \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/returnConditionalExpressionJSDocCast.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/returnConditionalExpressionJSDocCast.types.diff index 6972e384cb..ab7c432482 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/returnConditionalExpressionJSDocCast.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/returnConditionalExpressionJSDocCast.types.diff @@ -14,6 +14,4 @@ +>( type ? sources.get(type) : sources.get("some other thing") ) : String type -+>type ? sources.get(type) : sources.get("some other thing") : String - >type ? sources.get(type) : sources.get("some other thing") : string | undefined - >type : string + >type ? sources.get(type) : sources.get("some other thing") : string | undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.types.diff index 4f3480caeb..cac358c0b7 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.types.diff @@ -1,10 +1,6 @@ --- old.strictOptionalProperties4.types +++ new.strictOptionalProperties4.types -@@= skipped -8, +8 lines =@@ - const x = /** @type {Foo} */ ({}); - >x : Foo - >({}) : Foo -+>{} : Foo +@@= skipped -11, +11 lines =@@ >{} : {} x.foo; // number | undefined @@ -16,8 +12,7 @@ const y = /** @type {Required} */ ({}); >y : Required - >({}) : Required -+>{} : Required +@@= skipped -10, +10 lines =@@ >{} : {} y.foo; // number diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/thisInFunctionCallJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/thisInFunctionCallJs.errors.txt.diff deleted file mode 100644 index 64df6affc6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/thisInFunctionCallJs.errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.thisInFunctionCallJs.errors.txt -+++ new.thisInFunctionCallJs.errors.txt -@@= skipped -0, +0 lines =@@ - /a.js(9,26): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. - /a.js(15,31): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -- -- --==== /a.js (2 errors) ==== -+/a.js(23,31): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+/a.js(31,26): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+ -+ -+==== /a.js (4 errors) ==== - class Test { - constructor() { - /** @type {number[]} */ -@@= skipped -31, +33 lines =@@ - /** @this {Test} */ - function (d) { - console.log(d === this.data.length) -+ ~~~~ -+!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+!!! related TS2738 /a.js:22:9: An outer value of 'this' is shadowed by this container. - }, this) - } - -@@= skipped -8, +11 lines =@@ - /** @this {Test} */ - function (d) { - return d === this.data.length -+ ~~~~ -+!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+!!! related TS2738 /a.js:30:9: An outer value of 'this' is shadowed by this container. - }, this) - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/thisInFunctionCallJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/thisInFunctionCallJs.types.diff deleted file mode 100644 index e6d1ca987f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/thisInFunctionCallJs.types.diff +++ /dev/null @@ -1,52 +0,0 @@ ---- old.thisInFunctionCallJs.types -+++ new.thisInFunctionCallJs.types -@@= skipped -83, +83 lines =@@ - - /** @this {Test} */ - function (d) { -->function (d) { console.log(d === this.data.length) } : (this: Test, d: number) => void -+>function (d) { console.log(d === this.data.length) } : (d: number) => void - >d : number - - console.log(d === this.data.length) -@@= skipped -10, +10 lines =@@ - >log : (...data: any[]) => void - >d === this.data.length : boolean - >d : number -->this.data.length : number -->this.data : number[] -->this : Test -->data : number[] -->length : number -+>this.data.length : any -+>this.data : any -+>this : any -+>data : any -+>length : any - - }, this) - >this : this -@@= skipped -23, +23 lines =@@ - - /** @this {Test} */ - function (d) { -->function (d) { return d === this.data.length } : (this: Test, d: number) => boolean -+>function (d) { return d === this.data.length } : (d: number) => boolean - >d : number - - return d === this.data.length - >d === this.data.length : boolean - >d : number -->this.data.length : number -->this.data : number[] -->this : Test -->data : number[] -->length : number -+>this.data.length : any -+>this.data : any -+>this : any -+>data : any -+>length : any - - }, this) - >this : this \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff index aca2a4e69b..d46ad406b3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff @@ -17,12 +17,11 @@ ->(a) : B ->a : A +>(a) : { x: number; } & { y: number; } -+>a : { x: number; } & { y: number; } +>a : { x: number; } >y : number >0 : 0 >TypeError() : TypeError -@@= skipped -25, +26 lines =@@ +@@= skipped -25, +25 lines =@@ /** @type { A } */ const a = { x: 1 }; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.types.diff index 0d9937ec21..b10614b61d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.types.diff @@ -12,16 +12,4 @@ +>a : string >"a" : "a" - /** @type {(m: string) => string} */ -@@= skipped -18, +18 lines =@@ - >0 : 0 - - const t6 = /** @satisfies {[number, number]} */ ([1, 2]); -->t6 : [number, number] -->([1, 2]) : [number, number] -->[1, 2] : [number, number] -+>t6 : number[] -+>([1, 2]) : number[] -+>[1, 2] : number[] - >1 : 1 - >2 : 2 + /** @type {(m: string) => string} */ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.types.diff index 696bd9501d..364707ca58 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.types.diff @@ -7,8 +7,8 @@ ->p : { isEven: (n: number) => boolean; isOdd: (n: number) => boolean; } ->({ isEven: n => n % 2 === 0, isOdd: n => n % 2 === 1}) : { isEven: (n: number) => boolean; isOdd: (n: number) => boolean; } ->{ isEven: n => n % 2 === 0, isOdd: n => n % 2 === 1} : { isEven: (n: number) => boolean; isOdd: (n: number) => boolean; } -+>p : { isEven: (n: any) => boolean; isOdd: (n: any) => boolean; } -+>({ isEven: n => n % 2 === 0, isOdd: n => n % 2 === 1}) : { isEven: (n: any) => boolean; isOdd: (n: any) => boolean; } ++>p : any ++>({ isEven: n => n % 2 === 0, isOdd: n => n % 2 === 1}) : any +>{ isEven: n => n % 2 === 0, isOdd: n => n % 2 === 1} : { isEven: (n: any) => boolean; isOdd: (n: any) => boolean; } isEven: n => n % 2 === 0, diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.errors.txt.diff deleted file mode 100644 index 6aa3005cdd..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.checkJsdocSatisfiesTag3.errors.txt -+++ new.checkJsdocSatisfiesTag3.errors.txt -@@= skipped -0, +0 lines =@@ --/a.js(3,7): error TS7006: Parameter 's' implicitly has an 'any' type. -- -- --==== /a.js (1 errors) ==== -+/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 (2 errors) ==== - /** @type {{ f(s: string): void } & Record }} */ - let obj = /** @satisfies {{ g(s: string): void } & Record} */ ({ - f(s) { }, // "incorrect" implicit any on 's' -+ g(s) { } - ~ - !!! error TS7006: Parameter 's' implicitly has an 'any' type. -- g(s) { } - }); - - // This needs to not crash (outer node is not expression) - /** @satisfies {{ f(s: string): void }} */ ({ f(x) { } }) -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.types.diff index b8afa08392..1740c8c61a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.types.diff @@ -5,32 +5,7 @@ let obj = /** @satisfies {{ g(s: string): void } & Record} */ ({ >obj : { f(s: string): void; } & Record ->({ f(s) { }, // "incorrect" implicit any on 's' g(s) { }}) : { f(s: string): void; } & Record -->{ f(s) { }, // "incorrect" implicit any on 's' g(s) { }} : { f(s: any): void; g(s: string): 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' g(s) { }} : { f(s: string): void; g(s: any): void; } ++>({ f(s) { }, // "incorrect" implicit any on 's' g(s) { }}) : { f(s: any): void; g(s: string): void; } + >{ f(s) { }, // "incorrect" implicit any on 's' g(s) { }} : { f(s: any): void; g(s: string): void; } - f(s) { }, // "incorrect" implicit any on 's' -->f : (s: any) => void -->s : any -- -- g(s) { } -->g : (s: string) => void -+>f : (s: string) => void - >s : string - -+ g(s) { } -+>g : (s: any) => void -+>s : any -+ - }); - - // This needs to not crash (outer node is not expression) - /** @satisfies {{ f(s: string): void }} */ ({ f(x) { } }) -->({ f(x) { } }) : { f(x: string): void; } -->{ f(x) { } } : { f(x: string): void; } -->f : (x: string) => void -->x : string -+>({ f(x) { } }) : { f(x: any): void; } -+>{ f(x) { } } : { f(x: any): void; } -+>f : (x: any) => void -+>x : any + f(s) { }, // "incorrect" implicit any on 's' \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag5.types.diff deleted file mode 100644 index e8ff552ef9..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag5.types.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.checkJsdocSatisfiesTag5.types -+++ new.checkJsdocSatisfiesTag5.types -@@= skipped -3, +3 lines =@@ - /** @typedef {{ move(distance: number): void }} Movable */ - - const car = /** @satisfies {Movable & Record} */ ({ -->car : { start(): void; move(d: number): void; stop(): void; } -->({ start() { }, move(d) { // d should be number }, stop() { }}) : { start(): void; move(d: number): void; stop(): void; } -->{ start() { }, move(d) { // d should be number }, stop() { }} : { start(): void; move(d: number): void; stop(): void; } -+>car : { start(): void; move(d: any): void; stop(): void; } -+>({ start() { }, move(d) { // d should be number }, stop() { }}) : { start(): void; move(d: any): void; stop(): void; } -+>{ start() { }, move(d) { // d should be number }, stop() { }} : { start(): void; move(d: any): void; stop(): void; } - - start() { }, - >start : () => void - - move(d) { -->move : (d: number) => void -->d : number -+>move : (d: any) => void -+>d : any - - // d should be number - }, \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.types.diff index 877d1b8099..d621c57253 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.types.diff @@ -7,8 +7,8 @@ ->x : { m: true; s: string; } ->({ m: true, s: "false"}) : { m: true; s: string; } ->{ m: true, s: "false"} : { m: true; s: string; } -+>x : { m: boolean; s: string; } -+>({ m: true, s: "false"}) : { m: boolean; s: string; } ++>x : any ++>({ m: true, s: "false"}) : any +>{ m: true, s: "false"} : { m: boolean; s: string; } m: true, diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/constructorTagWithThisTag.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/constructorTagWithThisTag.types.diff index a387f3f4a5..2a4233801f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/constructorTagWithThisTag.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/constructorTagWithThisTag.types.diff @@ -5,24 +5,7 @@ */ function C() { ->C : typeof C -+>C : () => void ++>C : (this: { e: number; m: number; }) => void this.e = this.m + 1 -->this.e = this.m + 1 : number -->this.e : number -->this : { e: number; m: number; } -->e : number -->this.m + 1 : number -->this.m : number -->this : { e: number; m: number; } -->m : number -+>this.e = this.m + 1 : any -+>this.e : any -+>this : any -+>e : any -+>this.m + 1 : any -+>this.m : any -+>this : any -+>m : any - >1 : 1 - } + >this.e = this.m + 1 : number \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTypeInJSDoc.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTypeInJSDoc.types.diff index 3c4417e952..8f10713cda 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTypeInJSDoc.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTypeInJSDoc.types.diff @@ -17,9 +17,7 @@ ->(/** @type {*} */(undefined)) : import("externs") +>a : import("./externs") +>(/** @type {*} */(undefined)) : import("./externs") -+>(undefined) : import("./externs") >(undefined) : any -+>undefined : any >undefined : undefined a = new Foo({doer: Foo.Bar}); @@ -43,15 +41,6 @@ ->({ doer: q => q }) : import("externs").Bar +>q : import("./externs").Bar +>({ doer: q => q }) : import("./externs").Bar -+>{ doer: q => q } : import("./externs").Bar >{ doer: q => q } : { doer: (q: string) => string; } >doer : (q: string) => string - >q => q : (q: string) => string -@@= skipped -28, +31 lines =@@ - const r = /** @type {typeof import("./externs").Bar} */(r => r); - >r : (x: string, y?: number) => void - >(r => r) : (x: string, y?: number) => void -+>r => r : (x: string, y?: number) => void - >r => r : (r: string) => string - >r : string - >r : string \ No newline at end of file + >q => q : (q: string) => string \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/inferThis.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/inferThis.errors.txt.diff deleted file mode 100644 index 583b8a4509..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/inferThis.errors.txt.diff +++ /dev/null @@ -1,44 +0,0 @@ ---- old.inferThis.errors.txt -+++ new.inferThis.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/a.js(8,9): error TS2322: Type 'typeof C' is not assignable to type 'T'. -+ 'T' could be instantiated with an arbitrary type which could be unrelated to 'typeof C'. -+/a.js(17,9): error TS2322: Type 'this' is not assignable to type 'T'. -+ 'T' could be instantiated with an arbitrary type which could be unrelated to 'this'. -+ -+ -+==== /a.js (2 errors) ==== -+ export class C { -+ /** -+ * @template T -+ * @this {T} -+ * @return {T} -+ */ -+ static a() { -+ return this; -+ ~~~~~~ -+!!! error TS2322: Type 'typeof C' is not assignable to type 'T'. -+!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'typeof C'. -+ } -+ -+ /** -+ * @template T -+ * @this {T} -+ * @return {T} -+ */ -+ b() { -+ return this; -+ ~~~~~~ -+!!! error TS2322: Type 'this' is not assignable to type 'T'. -+!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'this'. -+ } -+ } -+ -+ const a = C.a(); -+ a; // typeof C -+ -+ const c = new C(); -+ const b = c.b(); -+ b; // C -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/inferThis.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/inferThis.types.diff deleted file mode 100644 index a190113349..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/inferThis.types.diff +++ /dev/null @@ -1,62 +0,0 @@ ---- old.inferThis.types -+++ new.inferThis.types -@@= skipped -9, +9 lines =@@ - * @return {T} - */ - static a() { -->a : (this: T) => T -+>a : () => T - - return this; -->this : T -+>this : typeof C - } - - /** -@@= skipped -12, +12 lines =@@ - * @return {T} - */ - b() { -->b : (this: T) => T -+>b : () => T - - return this; -->this : T -+>this : this - } - } - - const a = C.a(); -->a : typeof C -->C.a() : typeof C -->C.a : (this: T) => T -+>a : unknown -+>C.a() : unknown -+>C.a : () => T - >C : typeof C -->a : (this: T) => T -+>a : () => T - - a; // typeof C -->a : typeof C -+>a : unknown - - const c = new C(); - >c : C -@@= skipped -23, +23 lines =@@ - >C : typeof C - - const b = c.b(); -->b : C -->c.b() : C -->c.b : (this: T) => T -+>b : unknown -+>c.b() : unknown -+>c.b : () => T - >c : C -->b : (this: T) => T -+>b : () => T - - b; // C -->b : C -+>b : unknown diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.types.diff index 94bd748104..cbf12334aa 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.types.diff @@ -1,22 +1,6 @@ --- old.jsDeclarationsClasses.types +++ new.jsDeclarationsClasses.types -@@= skipped -61, +61 lines =@@ - get f1() { return /** @type {*} */(null); } - >f1 : U - >(null) : any -+>null : any - - /** - * @param {U} _p -@@= skipped -14, +15 lines =@@ - get f2() { return /** @type {*} */(null); } - >f2 : U - >(null) : any -+>null : any - - /** - * @param {U} _p -@@= skipped -133, +134 lines =@@ +@@= skipped -208, +208 lines =@@ constructor() { this.p1 = 12; >this.p1 = 12 : 12 @@ -72,12 +56,4 @@ +>another2 : U >param : U } - } -@@= skipped -10, +10 lines =@@ - var x = /** @type {*} */(null); - >x : any - >(null) : any -+>null : any - - export class VariableBase extends x {} - >VariableBase : VariableBase \ No newline at end of file + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsDefault.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsDefault.types.diff deleted file mode 100644 index e299c94b8b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsDefault.types.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.jsDeclarationsDefault.types -+++ new.jsDeclarationsDefault.types -@@= skipped -25, +25 lines =@@ - a = /** @type {Foo} */(null); - >a : Foo - >(null) : Foo -+>null : Foo - - }; - export const X = Foo; -@@= skipped -21, +22 lines =@@ - x = /** @type {Bar} */(null); - >x : Bar - >(null) : Bar -+>null : Bar - } - export default Bar; - >Bar : Bar \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDefinePropertyEmit.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDefinePropertyEmit.types.diff index d54bfb6dd1..8cb7f93473 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDefinePropertyEmit.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDefinePropertyEmit.types.diff @@ -58,11 +58,8 @@ >"cat" : "cat" >{ value: "cat" } : { value: string; } >value : string -@@= skipped -24, +24 lines =@@ - >a : number - >b : number +@@= skipped -26, +26 lines =@@ >(null) : any -+>null : any Object.defineProperty(module.exports, "d", { value: d }); ->Object.defineProperty(module.exports, "d", { value: d }) : typeof module.exports @@ -79,11 +76,8 @@ >"d" : "d" >{ value: d } : { value: (a: number, b: number) => string; } >value : (a: number, b: number) => string -@@= skipped -26, +27 lines =@@ - >a : T - >b : U +@@= skipped -26, +26 lines =@@ >(null) : any -+>null : any Object.defineProperty(module.exports, "e", { value: e }); ->Object.defineProperty(module.exports, "e", { value: e }) : typeof module.exports @@ -100,7 +94,7 @@ >"e" : "e" >{ value: e } : { value: (a: T, b: U) => T & U; } >value : (a: T, b: U) => T & U -@@= skipped -26, +27 lines =@@ +@@= skipped -24, +24 lines =@@ >a : T } Object.defineProperty(module.exports, "f", { value: f }); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.types.diff index fe29654427..73305d22e1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.types.diff @@ -27,22 +27,7 @@ >Cls : typeof Cls >class {} : typeof Cls -@@= skipped -29, +29 lines =@@ - >a : number - >b : number - >(null) : any -+>null : any - - /** - * @template T,U -@@= skipped -12, +13 lines =@@ - >a : T - >b : U - >(null) : any -+>null : any - - /** - * @template T +@@= skipped -47, +47 lines =@@ * @param {T} a */ export function f(a) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.types.diff index a5dbd352ca..dd52e4e4ea 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.types.diff @@ -112,11 +112,9 @@ +>a : any +>b : any >(null) : any -+>null : any /** - * @template T,U -@@= skipped -19, +20 lines =@@ +@@= skipped -19, +19 lines =@@ * @return {T & U} */ module.exports.e = function e(a, b) { return /** @type {*} */(null); } @@ -141,10 +139,9 @@ +>a : any +>b : any >(null) : any -+>null : any /** - * @template T +@@= skipped -17, +17 lines =@@ * @param {T} a */ module.exports.f = function f(a) { @@ -297,7 +294,7 @@ >i : () => void >function i() {} : () => void >i : () => void -@@= skipped -116, +117 lines =@@ +@@= skipped -99, +99 lines =@@ module.exports.ii = module.exports.i; >module.exports.ii = module.exports.i : () => void >module.exports.ii : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocSignatureOnReturnedFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocSignatureOnReturnedFunction.types.diff deleted file mode 100644 index daa0a2cd3d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocSignatureOnReturnedFunction.types.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.jsdocSignatureOnReturnedFunction.types -+++ new.jsdocSignatureOnReturnedFunction.types -@@= skipped -46, +46 lines =@@ - /** @type {(a: number, b: number) => number} */ - return (a, b) => { - >(a, b) => { return a + b; } : (a: number, b: number) => number -+>(a, b) => { return a + b; } : (a: number, b: number) => number - >a : number - >b : number - -@@= skipped -15, +16 lines =@@ - - /** @type {(a: number, b: number) => number} */ - return function (a, b){ -+>function (a, b){ return a + b; } : (a: number, b: number) => number - >function (a, b){ return a + b; } : (a: number, b: number) => number - >a : number - >b : number \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagCast.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagCast.types.diff index 9160d47fcf..63cda728c4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagCast.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagCast.types.diff @@ -1,38 +1,6 @@ --- old.jsdocTypeTagCast.types +++ new.jsdocTypeTagCast.types -@@= skipped -8, +8 lines =@@ - var W = /** @type {string} */(/** @type {*} */ (4)); - >W : string - >(/** @type {*} */ (4)) : string -+>(4) : string - >(4) : any -+>4 : any - >4 : 4 - - var W = /** @type {string} */(4); // Error - >W : string - >(4) : string -+>4 : string - >4 : 4 - - /** @type {*} */ -@@= skipped -19, +22 lines =@@ - var a = /** @type {*} */("" + 4); - >a : any - >("" + 4) : any -+>"" + 4 : any - >"" + 4 : string - >"" : "" - >4 : 4 -@@= skipped -9, +10 lines =@@ - >"" + /** @type {*} */(4) : string - >"" : "" - >(4) : any -+>4 : any - >4 : 4 - - class SomeBase { -@@= skipped -8, +9 lines =@@ +@@= skipped -44, +44 lines =@@ constructor() { this.p = 42; >this.p = 42 : 42 @@ -98,66 +66,7 @@ someBase = /** @type {SomeBase} */(someDerived); >someBase = /** @type {SomeBase} */(someDerived) : SomeBase - >someBase : SomeBase - >(someDerived) : SomeBase -+>someDerived : SomeBase - >someDerived : SomeDerived - - someBase = /** @type {SomeBase} */(someBase); -@@= skipped -15, +16 lines =@@ - >someBase : SomeBase - >(someBase) : SomeBase - >someBase : SomeBase -+>someBase : SomeBase - - someBase = /** @type {SomeBase} */(someOther); // Error - >someBase = /** @type {SomeBase} */(someOther) : SomeBase - >someBase : SomeBase - >(someOther) : SomeBase -+>someOther : SomeBase - >someOther : SomeOther - - someDerived = /** @type {SomeDerived} */(someDerived); -@@= skipped -12, +14 lines =@@ - >someDerived : SomeDerived - >(someDerived) : SomeDerived - >someDerived : SomeDerived -+>someDerived : SomeDerived - - someDerived = /** @type {SomeDerived} */(someBase); - >someDerived = /** @type {SomeDerived} */(someBase) : SomeDerived - >someDerived : SomeDerived - >(someBase) : SomeDerived -+>someBase : SomeDerived - >someBase : SomeBase - - someDerived = /** @type {SomeDerived} */(someOther); // Error - >someDerived = /** @type {SomeDerived} */(someOther) : SomeDerived - >someDerived : SomeDerived - >(someOther) : SomeDerived -+>someOther : SomeDerived - >someOther : SomeOther - - someOther = /** @type {SomeOther} */(someDerived); // Error - >someOther = /** @type {SomeOther} */(someDerived) : SomeOther - >someOther : SomeOther - >(someDerived) : SomeOther -+>someDerived : SomeOther - >someDerived : SomeDerived - - someOther = /** @type {SomeOther} */(someBase); // Error - >someOther = /** @type {SomeOther} */(someBase) : SomeOther - >someOther : SomeOther - >(someBase) : SomeOther -+>someBase : SomeOther - >someBase : SomeBase - - someOther = /** @type {SomeOther} */(someOther); -@@= skipped -30, +35 lines =@@ - >someOther : SomeOther - >(someOther) : SomeOther - >someOther : SomeOther -+>someOther : SomeOther +@@= skipped -60, +60 lines =@@ someFakeClass = someBase; >someFakeClass = someBase : SomeBase @@ -183,29 +92,7 @@ >someBase : SomeBase >(someFakeClass) : SomeBase ->someFakeClass : SomeFakeClass -+>someFakeClass : SomeBase +>someFakeClass : any // Type assertion cannot be a type-predicate type - /** @type {number | string} */ -@@= skipped -34, +36 lines =@@ - if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error - >(numOrStr === undefined) : boolean - >numOrStr === undefined : boolean -+>numOrStr === undefined : boolean - >numOrStr : string | number - >undefined : undefined - -@@= skipped -14, +15 lines =@@ - >asConst1 : 1 - >(1) : 1 - >1 : 1 -+>1 : 1 - - var asConst2 = /** @type {const} */({ - >asConst2 : { readonly x: 1; } - >({ x: 1}) : { readonly x: 1; } -+>{ x: 1} : { readonly x: 1; } - >{ x: 1} : { readonly x: 1; } - - x: 1 \ No newline at end of file + /** @type {number | string} */ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.types.diff index db407bb60f..ce416d86d6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.types.diff @@ -17,12 +17,4 @@ +>identity : Call /** @type {unknown[]} */ - const result = []; -@@= skipped -26, +26 lines =@@ - >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 \ No newline at end of file + const result = []; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/thisTag1.errors.txt.diff deleted file mode 100644 index 61974e0794..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag1.errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.thisTag1.errors.txt -+++ new.thisTag1.errors.txt -@@= skipped -0, +0 lines =@@ -- -+a.js(6,12): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+ -+ -+==== a.js (1 errors) ==== -+ /** @this {{ n: number }} Mount Holyoke Preparatory School -+ * @param {string} s -+ * @return {number} -+ */ -+ function f(s) { -+ return this.n + s.length -+ ~~~~ -+!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+ } -+ -+ const o = { -+ f, -+ n: 1 -+ } -+ o.f('hi') -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/thisTag1.types.diff deleted file mode 100644 index b611b5fde8..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag1.types.diff +++ /dev/null @@ -1,47 +0,0 @@ ---- old.thisTag1.types -+++ new.thisTag1.types -@@= skipped -5, +5 lines =@@ - * @return {number} - */ - function f(s) { -->f : (this: { n: number; }, s: string) => number -+>f : (s: string) => number - >s : string - - return this.n + s.length -->this.n + s.length : number -->this.n : number -->this : { n: number; } -->n : number -+>this.n + s.length : any -+>this.n : any -+>this : any -+>n : any - >s.length : number - >s : string - >length : number - } - - const o = { -->o : { f: (this: { n: number; }, s: string) => number; n: number; } -->{ f, n: 1} : { f: (this: { n: number; }, s: string) => number; n: number; } -+>o : { f: (s: string) => number; n: number; } -+>{ f, n: 1} : { f: (s: string) => number; n: number; } - - f, -->f : (this: { n: number; }, s: string) => number -+>f : (s: string) => number - - n: 1 - >n : number -@@= skipped -26, +26 lines =@@ - } - o.f('hi') - >o.f('hi') : number -->o.f : (this: { n: number; }, s: string) => number -->o : { f: (this: { n: number; }, s: string) => number; n: number; } -->f : (this: { n: number; }, s: string) => number -+>o.f : (s: string) => number -+>o : { f: (s: string) => number; n: number; } -+>f : (s: string) => number - >'hi' : "hi" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/thisTag2.types.diff deleted file mode 100644 index 99d7f4966c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag2.types.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.thisTag2.types -+++ new.thisTag2.types -@@= skipped -2, +2 lines =@@ - === a.js === - /** @this {string} */ - export function f1() {} -->f1 : (this: string) => void -+>f1 : () => void - - /** @this */ - export function f2() {} -->f2 : (this: any) => void -+>f2 : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.errors.txt.diff deleted file mode 100644 index e71461d3b2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.thisTag3.errors.txt -+++ new.thisTag3.errors.txt -@@= skipped -0, +0 lines =@@ --/a.js(7,9): error TS2730: An arrow function cannot have a 'this' parameter. - /a.js(10,21): error TS2339: Property 'fn' does not exist on type 'C'. - - --==== /a.js (2 errors) ==== -+==== /a.js (1 errors) ==== - /** - * @typedef {{fn(a: string): void}} T - */ -@@= skipped -9, +8 lines =@@ - class C { - /** - * @this {T} -- ~~~~ --!!! error TS2730: An arrow function cannot have a 'this' parameter. - * @param {string} a - */ - p = (a) => this.fn("" + a); \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.types.diff index 614ee46645..4e89799208 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.types.diff @@ -6,8 +6,8 @@ p = (a) => this.fn("" + a); ->p : (this: T, a: string) => any ->(a) => this.fn("" + a) : (this: T, a: string) => any -+>p : (a: string) => any -+>(a) => this.fn("" + a) : (a: string) => any ++>p : (this: { fn(a: string): void; }, a: string) => any ++>(a) => this.fn("" + a) : (this: { fn(a: string): void; }, a: string) => any >a : string >this.fn("" + a) : any >this.fn : any \ No newline at end of file