diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 2a4de4ecda..9b9ce2880e 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -8825,7 +8825,6 @@ func (node *JSDocLinkCode) Name() *DeclarationName { type JSDocTypeExpression struct { TypeNodeBase - Host *Node Type *TypeNode } diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index 767a03c8fe..d2b05bb41d 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -651,6 +651,7 @@ func isDeclarationStatementKind(kind Kind) bool { KindExportDeclaration, KindExportAssignment, KindJSExportAssignment, + KindCommonJSExport, KindNamespaceExportDeclaration: return true } diff --git a/internal/binder/binder.go b/internal/binder/binder.go index 5f18fa716a..701f31adb5 100644 --- a/internal/binder/binder.go +++ b/internal/binder/binder.go @@ -581,7 +581,11 @@ func (b *Binder) bind(node *ast.Node) bool { if node == nil { return false } - node.Parent = b.parent + if node.Parent == nil { + node.Parent = b.parent + } else if node.Parent != b.parent { + panic("parent pointer already set, but doesn't match - collectModuleReferences probably out of sync with binder") + } saveInStrictMode := b.inStrictMode // Even though in the AST the jsdoc @typedef node belongs to the current node, // its symbol might be in the same scope with the current node's symbol. Consider: @@ -1646,8 +1650,6 @@ func (b *Binder) bindChildren(node *ast.Node) { case ast.KindObjectLiteralExpression, ast.KindArrayLiteralExpression, ast.KindPropertyAssignment, ast.KindSpreadElement: b.inAssignmentPattern = saveInAssignmentPattern b.bindEachChild(node) - case ast.KindJSExportAssignment, ast.KindCommonJSExport: - return // Reparsed nodes do not double-bind children, which are not reparsed default: b.bindEachChild(node) } diff --git a/internal/binder/nameresolver.go b/internal/binder/nameresolver.go index ca8b26f28d..f4a54ef849 100644 --- a/internal/binder/nameresolver.go +++ b/internal/binder/nameresolver.go @@ -288,13 +288,9 @@ loop: if isSelfReferenceLocation(location, lastLocation) { lastSelfReferenceLocation = location } - if location.Kind == ast.KindJSDocTypeExpression && location.AsJSDocTypeExpression().Host != nil { - lastLocation = location.AsJSDocTypeExpression().Host.Type() - location = location.AsJSDocTypeExpression().Host - } else { - lastLocation = location - location = location.Parent - } + + lastLocation = location + location = location.Parent } // We just climbed up parents looking for the name, meaning that we started in a descendant node of `lastLocation`. // If `result === lastSelfReferenceLocation.symbol`, that means that we are somewhere inside `lastSelfReferenceLocation` looking up a name, and resolving to `lastLocation` itself. diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index 580df95a1f..3758963737 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -80,11 +80,6 @@ func (p *Parser) parseJSDocTypeExpression(mayOmitBraces bool) *ast.Node { } result := p.factory.NewJSDocTypeExpression(t) - // normally parent references are set during binding. However, for clients that only need - // a syntax tree, and no semantic features, then the binding process is an unnecessary - // overhead. This functions allows us to set all the parents, without all the expense of - // binding. - ast.SetParentInChildren(result) p.finishNode(result, pos) return result } @@ -105,7 +100,6 @@ func (p *Parser) parseJSDocNameReference() *ast.Node { } result := p.factory.NewJSDocNameReference(entityName) - ast.SetParentInChildren(result) p.finishNode(result, pos) return result } diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go index 242609e2a3..ce6f910d7b 100644 --- a/internal/parser/reparser.go +++ b/internal/parser/reparser.go @@ -17,14 +17,18 @@ func (p *Parser) reparseCommonJS(node *ast.Node) { var export *ast.Node switch kind { case ast.JSDeclarationKindModuleExports: - export = p.factory.NewJSExportAssignment(bin.Right) + export = p.factory.NewJSExportAssignment(p.factory.DeepCloneNode(bin.Right)) case ast.JSDeclarationKindExportsProperty: nodes := p.nodeSlicePool.NewSlice(1) nodes[0] = p.factory.NewModifier(ast.KindExportKeyword) nodes[0].Flags = ast.NodeFlagsReparsed nodes[0].Loc = bin.Loc // TODO: Name can sometimes be a string literal, so downstream code needs to handle this - export = p.factory.NewCommonJSExport(p.newModifierList(bin.Loc, nodes), ast.GetElementOrPropertyAccessName(bin.Left), bin.Right) + export = p.factory.NewCommonJSExport( + p.newModifierList(bin.Loc, nodes), + p.factory.DeepCloneNode(ast.GetElementOrPropertyAccessName(bin.Left)), + p.factory.DeepCloneNode(bin.Right), + ) } if export != nil { export.Flags = ast.NodeFlagsReparsed @@ -63,7 +67,7 @@ func (p *Parser) reparseTags(parent *ast.Node, jsDoc []*ast.Node) { var t *ast.Node switch typeExpression.Kind { case ast.KindJSDocTypeExpression: - t = typeExpression.Type() + t = p.factory.DeepCloneNode(typeExpression.Type()) case ast.KindJSDocTypeLiteral: members := p.nodeSlicePool.NewSlice(0) for _, member := range typeExpression.AsJSDocTypeLiteral().JSDocPropertyTags { @@ -74,7 +78,7 @@ func (p *Parser) reparseTags(parent *ast.Node, jsDoc []*ast.Node) { questionToken.Loc = core.NewTextRange(member.Pos(), member.End()) questionToken.Flags = p.contextFlags | ast.NodeFlagsReparsed } - prop := p.factory.NewPropertySignatureDeclaration(nil, member.Name(), questionToken, member.Type(), nil /*initializer*/) + prop := p.factory.NewPropertySignatureDeclaration(nil, p.factory.DeepCloneNode(member.Name()), questionToken, p.factory.DeepCloneNode(member.Type()), nil /*initializer*/) prop.Loc = member.Loc prop.Flags = p.contextFlags | ast.NodeFlagsReparsed members = append(members, prop) @@ -85,16 +89,25 @@ func (p *Parser) reparseTags(parent *ast.Node, jsDoc []*ast.Node) { default: panic("typedef tag type expression should be a name reference or a type expression" + typeExpression.Kind.String()) } - typeAlias := p.factory.NewJSTypeAliasDeclaration(modifiers, tag.AsJSDocTypedefTag().Name(), typeParameters, t) + typeAlias := p.factory.NewJSTypeAliasDeclaration(modifiers, p.factory.DeepCloneNode(tag.AsJSDocTypedefTag().Name()), typeParameters, t) typeAlias.Loc = core.NewTextRange(tag.Pos(), tag.End()) typeAlias.Flags = p.contextFlags | ast.NodeFlagsReparsed + ast.SetParentInChildren(typeAlias) p.reparseList = append(p.reparseList, typeAlias) case ast.KindJSDocImportTag: importTag := tag.AsJSDocImportTag() - importClause := importTag.ImportClause.Clone(&p.factory) + importClause := p.factory.DeepCloneNode(importTag.ImportClause) importClause.Flags |= ast.NodeFlagsReparsed + var modifiers *ast.ModifierList + if importTag.Modifiers() != nil { + modifiers = importTag.Modifiers().Clone(&p.factory) + for i, m := range modifiers.Nodes { + modifiers.Nodes[i] = p.factory.DeepCloneNode(m) + modifiers.Nodes[i].Flags |= ast.NodeFlagsReparsed + } + } importClause.AsImportClause().IsTypeOnly = true - importDeclaration := p.factory.NewJSImportDeclaration(importTag.Modifiers(), importClause, importTag.ModuleSpecifier, importTag.Attributes) + importDeclaration := p.factory.NewJSImportDeclaration(modifiers, importClause, p.factory.DeepCloneNode(importTag.ModuleSpecifier), p.factory.DeepCloneNode(importTag.Attributes)) importDeclaration.Loc = core.NewTextRange(tag.Pos(), tag.End()) importDeclaration.Flags = p.contextFlags | ast.NodeFlagsReparsed p.reparseList = append(p.reparseList, importDeclaration) @@ -108,36 +121,36 @@ func (p *Parser) reparseTags(parent *ast.Node, jsDoc []*ast.Node) { if parent.Kind == ast.KindVariableStatement && parent.AsVariableStatement().DeclarationList != nil { for _, declaration := range parent.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { if declaration.AsVariableDeclaration().Type == nil { - declaration.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, declaration) + declaration.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression) break } } } else if parent.Kind == ast.KindVariableDeclaration { if parent.AsVariableDeclaration().Type == nil { - parent.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent) + parent.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression) } } else if parent.Kind == ast.KindPropertyDeclaration { declaration := parent.AsPropertyDeclaration() if declaration.Type == nil { - declaration.Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent) + declaration.Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression) } } else if parent.Kind == ast.KindPropertyAssignment { prop := parent.AsPropertyAssignment() - prop.Initializer = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), prop.Initializer) + prop.Initializer = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), prop.Initializer) } else if parent.Kind == ast.KindExportAssignment { export := parent.AsExportAssignment() - export.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), export.Expression) + export.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), export.Expression) } else if parent.Kind == ast.KindReturnStatement { ret := parent.AsReturnStatement() - ret.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), ret.Expression) + ret.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), ret.Expression) } else if parent.Kind == ast.KindParenthesizedExpression { paren := parent.AsParenthesizedExpression() - paren.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), paren.Expression) + paren.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), paren.Expression) } else if parent.Kind == ast.KindExpressionStatement && parent.AsExpressionStatement().Expression.Kind == ast.KindBinaryExpression { bin := parent.AsExpressionStatement().Expression.AsBinaryExpression() if ast.GetAssignmentDeclarationKind(bin) != ast.JSDeclarationKindNone { - bin.Right = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), bin.Right) + bin.Right = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), bin.Right) } } case ast.KindJSDocTemplateTag: @@ -161,7 +174,7 @@ func (p *Parser) reparseTags(parent *ast.Node, jsDoc []*ast.Node) { jsparam := tag.AsJSDocParameterTag() if param, ok := findMatchingParameter(fun, jsparam); ok { if param.Type() == nil { - param.AsParameterDeclaration().Type = p.makeNewType(jsparam.TypeExpression, param) + param.AsParameterDeclaration().Type = p.makeNewType(jsparam.TypeExpression) if param.AsParameterDeclaration().QuestionToken == nil && param.AsParameterDeclaration().Initializer == nil && (jsparam.IsBracketed || jsparam.TypeExpression != nil && jsparam.TypeExpression.Type().Kind == ast.KindJSDocOptionalType) { @@ -175,7 +188,7 @@ func (p *Parser) reparseTags(parent *ast.Node, jsDoc []*ast.Node) { case ast.KindJSDocReturnTag: if fun, ok := getFunctionLikeHost(parent); ok { if fun.Type() == nil { - fun.FunctionLikeData().Type = p.makeNewType(tag.AsJSDocReturnTag().TypeExpression, fun) + fun.FunctionLikeData().Type = p.makeNewType(tag.AsJSDocReturnTag().TypeExpression) } } } @@ -209,14 +222,12 @@ func (p *Parser) gatherTypeParameters(j *ast.Node) *ast.NodeList { constraint := tag.AsJSDocTemplateTag().Constraint for _, tp := range tag.AsJSDocTemplateTag().TypeParameters().Nodes { typeParameter := tp.AsTypeParameter() - var reparse *ast.Node - if constraint == nil { - reparse = typeParameter.Clone(&p.factory) - } else { - clone := constraint.Type().Clone(&p.factory) - clone.Flags |= ast.NodeFlagsReparsed - reparse = p.factory.NewTypeParameterDeclaration(typeParameter.Modifiers(), typeParameter.Name(), clone, typeParameter.DefaultType) - reparse.Loc = typeParameter.Loc + reparse := p.factory.DeepCloneNode(tp) + reparse.Loc = typeParameter.Loc + if constraint != nil { + constraintClone := p.factory.DeepCloneNode(constraint.Type()) + constraintClone.Flags |= ast.NodeFlagsReparsed + reparse.AsTypeParameter().Constraint = constraintClone } reparse.Flags |= ast.NodeFlagsReparsed typeParameters = append(typeParameters, reparse) @@ -255,25 +266,20 @@ func getFunctionLikeHost(host *ast.Node) (*ast.Node, bool) { } func (p *Parser) makeNewTypeAssertion(t *ast.TypeNode, e *ast.Node) *ast.Node { - assert := p.factory.NewTypeAssertion(t, e) + if t.Flags&ast.NodeFlagsReparsed == 0 { + panic("should only pass reparsed type nodes to makeNewTypeAssertion") + } + assert := p.factory.NewTypeAssertion(t, p.factory.DeepCloneNode(e)) assert.Flags = p.contextFlags | ast.NodeFlagsReparsed assert.Loc = core.NewTextRange(e.Pos(), e.End()) return assert } -func (p *Parser) makeNewType(typeExpression *ast.TypeNode, host *ast.Node) *ast.Node { +func (p *Parser) makeNewType(typeExpression *ast.TypeNode) *ast.Node { if typeExpression == nil || typeExpression.Type() == nil { return nil } - if typeExpression.AsJSDocTypeExpression().Host == nil { - typeExpression.AsJSDocTypeExpression().Host = host - } else { - panic("JSDoc type expression already has a host: " + typeExpression.AsJSDocTypeExpression().Host.Kind.String()) - } - t := typeExpression.Type().Clone(&p.factory) + t := p.factory.DeepCloneNode(typeExpression.Type()) t.Flags |= ast.NodeFlagsReparsed - if host != nil { - t.Parent = host - } return t } diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types index 72cdd5b336..579a93b4f2 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types @@ -24,12 +24,12 @@ export = Foo; /** @typedef {(foo: Foo) => string} FooFun */ module.exports = /** @type {FooFun} */(void 0); ->module.exports = /** @type {FooFun} */(void 0) : (foo: typeof Foo) => string ->module.exports : (foo: typeof Foo) => string ->module : { export=: (foo: typeof Foo) => string; } ->exports : (foo: typeof Foo) => string ->(void 0) : (foo: typeof Foo) => string ->void 0 : (foo: typeof Foo) => string +>module.exports = /** @type {FooFun} */(void 0) : FooFun +>module.exports : FooFun +>module : { export=: FooFun; } +>exports : FooFun +>(void 0) : FooFun +>void 0 : FooFun >void 0 : undefined >0 : 0 diff --git a/testdata/baselines/reference/submodule/compiler/commonjsAccessExports.types b/testdata/baselines/reference/submodule/compiler/commonjsAccessExports.types index d96099523f..30de41c9a8 100644 --- a/testdata/baselines/reference/submodule/compiler/commonjsAccessExports.types +++ b/testdata/baselines/reference/submodule/compiler/commonjsAccessExports.types @@ -18,9 +18,9 @@ exports.x; // 'exports' does not provide a contextual type to a function-class exports.Cls = function() { >exports.Cls = function() { this.x = 0; } : () => void ->exports.Cls : any +>exports.Cls : () => void >exports : typeof import("/a") ->Cls : any +>Cls : () => void >function() { this.x = 0; } : () => void this.x = 0; @@ -35,7 +35,7 @@ exports.x; const instance = new exports.Cls(); >instance : any >new exports.Cls() : any ->exports.Cls : any +>exports.Cls : () => void >exports : typeof import("/a") ->Cls : any +>Cls : () => void diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.types b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.types index 7fe7125499..899c9f7088 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.types +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.types @@ -15,7 +15,7 @@ function acceptNum(num) {} /** @type {Fn} */ const fn1 = ->fn1 : (a: string, b: number) => void +>fn1 : Fn /** * @param [b] @@ -46,7 +46,7 @@ const fn1 = /** @type {Fn} */ const fn2 = ->fn2 : (a: string, b: number) => void +>fn2 : Fn /** * @param {number} [b] diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt index 1960cc42df..267621261d 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt @@ -1,15 +1,12 @@ -input.js(5,48): error TS2304: Cannot find name 'P'. input.js(48,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== input.js (2 errors) ==== +==== input.js (1 errors) ==== /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ /** * @template P * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ - ~ -!!! error TS2304: Cannot find name 'P'. /** * @type {StatelessComponent} diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types index ea555dd052..e30df74384 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types @@ -11,36 +11,36 @@ * @type {StatelessComponent} */ const MyComponent = () => /* @type {any} */(null); ->MyComponent : { (): any; defaultProps?: P; } ->() => /* @type {any} */(null) : { (): any; defaultProps: { color: string; }; } +>MyComponent : StatelessComponent +>() => /* @type {any} */(null) : { (): any; defaultProps: { color: "red"; }; } >(null) : null MyComponent.defaultProps = { ->MyComponent.defaultProps = { color: "red"} : { color: string; } ->MyComponent.defaultProps : P ->MyComponent : { (): any; defaultProps?: P; } ->defaultProps : P ->{ color: "red"} : { color: string; } +>MyComponent.defaultProps = { color: "red"} : { color: "red"; } +>MyComponent.defaultProps : Partial +>MyComponent : StatelessComponent +>defaultProps : Partial +>{ color: "red"} : { color: "red"; } color: "red" ->color : string +>color : "red" >"red" : "red" }; const MyComponent2 = () => null; ->MyComponent2 : { (): any; defaultProps: { color: "blue" | "red"; }; } ->() => null : { (): any; defaultProps: { color: "blue" | "red"; }; } +>MyComponent2 : { (): any; defaultProps: MyComponentProps; } +>() => null : { (): any; defaultProps: MyComponentProps; } /** * @type {MyComponentProps} */ MyComponent2.defaultProps = { ->MyComponent2.defaultProps = { color: "red"} : { color: "blue" | "red"; } ->MyComponent2.defaultProps : { color: "blue" | "red"; } ->MyComponent2 : { (): any; defaultProps: { color: "blue" | "red"; }; } ->defaultProps : { color: "blue" | "red"; } ->{ color: "red"} : { color: "blue" | "red"; } +>MyComponent2.defaultProps = { color: "red"} : MyComponentProps +>MyComponent2.defaultProps : MyComponentProps +>MyComponent2 : { (): any; defaultProps: MyComponentProps; } +>defaultProps : MyComponentProps +>{ color: "red"} : MyComponentProps >{ color: "red"} : { color: "red"; } color: "red" @@ -52,16 +52,16 @@ MyComponent2.defaultProps = { * @type {StatelessComponent} */ const check = MyComponent2; ->check : { (): any; defaultProps?: P; } ->MyComponent2 : { (): any; defaultProps: { color: "blue" | "red"; }; } +>check : StatelessComponent +>MyComponent2 : { (): any; defaultProps: MyComponentProps; } /** * * @param {{ props: MyComponentProps }} p */ function expectLiteral(p) {} ->expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void ->p : { props: { color: "blue" | "red"; }; } +>expectLiteral : (p: { props: MyComponentProps; }) => void +>p : { props: MyComponentProps; } function foo() { >foo : () => void @@ -70,18 +70,18 @@ function foo() { * @type {MyComponentProps} */ this.props = { color: "red" }; ->this.props = { color: "red" } : { color: "blue" | "red"; } +>this.props = { color: "red" } : MyComponentProps >this.props : any >this : any >props : any ->{ color: "red" } : { color: "blue" | "red"; } +>{ color: "red" } : MyComponentProps >{ color: "red" } : { color: "red"; } >color : "red" >"red" : "red" expectLiteral(this); >expectLiteral(this) : void ->expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void +>expectLiteral : (p: { props: MyComponentProps; }) => void >this : any } @@ -89,11 +89,11 @@ function foo() { * @type {MyComponentProps} */ module.exports = { ->module.exports = { color: "red"} : { color: "blue" | "red"; } ->module.exports : { color: "blue" | "red"; } ->module : { export=: { color: "blue" | "red"; }; } ->exports : { color: "blue" | "red"; } ->{ color: "red"} : { color: "blue" | "red"; } +>module.exports = { color: "red"} : MyComponentProps +>module.exports : MyComponentProps +>module : { export=: MyComponentProps; } +>exports : MyComponentProps +>{ color: "red"} : MyComponentProps >{ color: "red"} : { color: "red"; } color: "red" @@ -103,10 +103,10 @@ module.exports = { expectLiteral({ props: module.exports }); >expectLiteral({ props: module.exports }) : void ->expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void ->{ props: module.exports } : { props: { color: "blue" | "red"; }; } ->props : { color: "blue" | "red"; } ->module.exports : { color: "blue" | "red"; } ->module : { export=: { color: "blue" | "red"; }; } ->exports : { color: "blue" | "red"; } +>expectLiteral : (p: { props: MyComponentProps; }) => void +>{ props: module.exports } : { props: MyComponentProps; } +>props : MyComponentProps +>module.exports : MyComponentProps +>module : { export=: MyComponentProps; } +>exports : MyComponentProps diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types index 03b13b004b..07c3491398 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types @@ -7,16 +7,16 @@ */ /** @type {NumberLike[]} */export default ([ ]); ->([ ]) : (string | number)[] +>([ ]) : NumberLike[] >([ ]) : undefined[] >[ ] : undefined[] === b.ts === import A from './a' ->A : (string | number)[] +>A : NumberLike[] A[0] ->A[0] : string | number ->A : (string | number)[] +>A[0] : NumberLike +>A : NumberLike[] >0 : 0 diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types index cf343ba62c..046b0d4b0d 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types @@ -7,16 +7,16 @@ */ export default /** @type {NumberLike[]} */([ ]); ->([ ]) : (string | number)[] ->[ ] : (string | number)[] +>([ ]) : NumberLike[] +>[ ] : NumberLike[] >[ ] : undefined[] === b.ts === import A from './a' ->A : (string | number)[] +>A : NumberLike[] A[0] ->A[0] : string | number ->A : (string | number)[] +>A[0] : NumberLike +>A : NumberLike[] >0 : 0 diff --git a/testdata/baselines/reference/submodule/compiler/functionExpressionNames.types b/testdata/baselines/reference/submodule/compiler/functionExpressionNames.types index 768669017f..5ddc9be0cc 100644 --- a/testdata/baselines/reference/submodule/compiler/functionExpressionNames.types +++ b/testdata/baselines/reference/submodule/compiler/functionExpressionNames.types @@ -3,9 +3,9 @@ === b.js === exports.E = function() { >exports.E = function() { this.e = 'exported'} : () => void ->exports.E : any +>exports.E : () => void >exports : typeof import("b") ->E : any +>E : () => void >function() { this.e = 'exported'} : () => void this.e = 'exported' @@ -18,9 +18,9 @@ exports.E = function() { var e = new exports.E(); >e : any >new exports.E() : any ->exports.E : any +>exports.E : () => void >exports : typeof import("b") ->E : any +>E : () => void var o = { >o : { C: () => void; } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt index 2bb4e07c0e..095a8b3c6b 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt @@ -1,105 +1,84 @@ index.js(2,19): error TS2315: Type 'Boolean' is not generic. -index.js(2,27): error TS2304: Cannot find name 'T'. index2.js(2,19): error TS2304: Cannot find name 'Void'. -index2.js(2,24): error TS2304: Cannot find name 'T'. index3.js(2,19): error TS2304: Cannot find name 'Undefined'. -index3.js(2,29): error TS2304: Cannot find name 'T'. index4.js(2,19): error TS2315: Type 'Function' is not generic. -index4.js(2,28): error TS2304: Cannot find name 'T'. index5.js(2,19): error TS2315: Type 'String' is not generic. -index5.js(2,26): error TS2304: Cannot find name 'T'. index6.js(2,19): error TS2315: Type 'Number' is not generic. -index6.js(2,26): error TS2304: Cannot find name 'T'. index7.js(2,19): error TS2315: Type 'Object' is not generic. -index7.js(2,26): error TS2304: Cannot find name 'T'. index8.js(4,12): error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? index8.js(4,15): error TS2304: Cannot find name 'T'. -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== /** * @param {(m: Boolean) => string} somebody ~~~~~~~~~~ !!! error TS2315: Type 'Boolean' is not generic. - ~ -!!! error TS2304: Cannot find name 'T'. */ function sayHello(somebody) { return 'Hello ' + somebody; } -==== index2.js (2 errors) ==== +==== index2.js (1 errors) ==== /** * @param {(m: Void) => string} somebody ~~~~ !!! error TS2304: Cannot find name 'Void'. - ~ -!!! error TS2304: Cannot find name 'T'. */ function sayHello2(somebody) { return 'Hello ' + somebody; } -==== index3.js (2 errors) ==== +==== index3.js (1 errors) ==== /** * @param {(m: Undefined) => string} somebody ~~~~~~~~~ !!! error TS2304: Cannot find name 'Undefined'. - ~ -!!! error TS2304: Cannot find name 'T'. */ function sayHello3(somebody) { return 'Hello ' + somebody; } -==== index4.js (2 errors) ==== +==== index4.js (1 errors) ==== /** * @param {(m: Function) => string} somebody ~~~~~~~~~~~ !!! error TS2315: Type 'Function' is not generic. - ~ -!!! error TS2304: Cannot find name 'T'. */ function sayHello4(somebody) { return 'Hello ' + somebody; } -==== index5.js (2 errors) ==== +==== index5.js (1 errors) ==== /** * @param {(m: String) => string} somebody ~~~~~~~~~ !!! error TS2315: Type 'String' is not generic. - ~ -!!! error TS2304: Cannot find name 'T'. */ function sayHello5(somebody) { return 'Hello ' + somebody; } -==== index6.js (2 errors) ==== +==== index6.js (1 errors) ==== /** * @param {(m: Number) => string} somebody ~~~~~~~~~ !!! error TS2315: Type 'Number' is not generic. - ~ -!!! error TS2304: Cannot find name 'T'. */ function sayHello6(somebody) { return 'Hello ' + somebody; } -==== index7.js (2 errors) ==== +==== index7.js (1 errors) ==== /** * @param {(m: Object) => string} somebody ~~~~~~~~~ !!! error TS2315: Type 'Object' is not generic. - ~ -!!! error TS2304: Cannot find name 'T'. */ function sayHello7(somebody) { return 'Hello ' + somebody; diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt index ae46bda792..80175c8972 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt @@ -1,4 +1,4 @@ -a.js(14,7): error TS2375: Type '{ value: undefined; }' is not assignable to type '{ value?: number; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. +a.js(14,7): error TS2375: Type '{ value: undefined; }' is not assignable to type 'B' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. Types of property 'value' are incompatible. Type 'undefined' is not assignable to type 'number'. @@ -19,7 +19,7 @@ a.js(14,7): error TS2375: Type '{ value: undefined; }' is not assignable to type /** @type {B} */ const b = { value: undefined }; // error ~ -!!! error TS2375: Type '{ value: undefined; }' is not assignable to type '{ value?: number; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. +!!! error TS2375: Type '{ value: undefined; }' is not assignable to type 'B' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. !!! error TS2375: Types of property 'value' are incompatible. !!! error TS2375: Type 'undefined' is not assignable to type 'number'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types index 72d35c1e04..d831b6afc4 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types @@ -19,7 +19,7 @@ const a = { value: undefined }; // error /** @type {B} */ const b = { value: undefined }; // error ->b : { value?: number; } +>b : B >{ value: undefined } : { value: undefined; } >value : undefined >undefined : undefined diff --git a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt deleted file mode 100644 index 9e2a2f66c8..0000000000 --- a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -file1.js(3,21): error TS2304: Cannot find name 'T'. - - -==== file1.js (1 errors) ==== - /** - * @template {string} T - * @typedef {{ foo: T }} Foo - ~ -!!! error TS2304: Cannot find name 'T'. - */ - - export default {}; - -==== file2.js (0 errors) ==== - /** - * @template T - * @typedef {import('./file1').Foo} Bar - */ - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types index 8aaa0c1341..513e059bec 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types @@ -14,16 +14,16 @@ * @returns { asserts a is B } */ const foo = (a) => { ->foo : (a: { x: number; }) => asserts a is { x: number; } & { y: number; } ->(a) => { if (/** @type { B } */ (a).y !== 0) throw TypeError(); return undefined;} : (a: { x: number; }) => asserts a is { x: number; } & { y: number; } ->a : { x: number; } +>foo : (a: A) => asserts a is B +>(a) => { if (/** @type { B } */ (a).y !== 0) throw TypeError(); return undefined;} : (a: A) => asserts a is B +>a : A if (/** @type { B } */ (a).y !== 0) throw TypeError(); >(a).y !== 0 : boolean >(a).y : number ->(a) : { x: number; } & { y: number; } ->a : { x: number; } & { y: number; } ->a : { x: number; } +>(a) : B +>a : B +>a : A >y : number >0 : 0 >TypeError() : TypeError @@ -40,15 +40,15 @@ export const main = () => { /** @type { A } */ const a = { x: 1 }; ->a : { x: number; } +>a : A >{ x: 1 } : { x: number; } >x : number >1 : 1 foo(a); >foo(a) : void ->foo : (a: { x: number; }) => asserts a is { x: number; } & { y: number; } ->a : { x: number; } +>foo : (a: A) => asserts a is B +>a : A }; diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types index 460c077286..7959286888 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types @@ -5,7 +5,7 @@ /** @type {AssertFunc} */ const assert = check => { ->assert : (check: boolean) => asserts check +>assert : AssertFunc >check => { if (!check) throw new Error();} : (check: boolean) => void >check : boolean @@ -72,7 +72,7 @@ function f1(x) { assert(typeof x === "string"); >assert(typeof x === "string") : void ->assert : (check: boolean) => asserts check +>assert : AssertFunc >typeof x === "string" : boolean >typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" >x : any diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt index 1120047dc2..6735c424bd 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt @@ -1,4 +1,3 @@ -test.js(3,19): error TS2304: Cannot find name 'U'. test.js(5,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. test.js(7,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. @@ -6,12 +5,10 @@ test.js(7,14): error TS2344: Type 'number' does not satisfy the constraint 'stri ==== t.d.ts (0 errors) ==== type A = { a: T } -==== test.js (3 errors) ==== +==== test.js (2 errors) ==== /** Also should error for jsdoc typedefs * @template {string} U * @typedef {{ b: U }} B - ~ -!!! error TS2304: Cannot find name 'U'. */ /** @type {A} */ ~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types index 5004b47a1a..cfec71866a 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types @@ -16,5 +16,5 @@ var a; /** @type {B} */ var b; ->b : { b: U; } +>b : B diff --git a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.errors.txt index 0eac008b4f..a8e5e9cf0d 100644 --- a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.errors.txt @@ -53,7 +53,7 @@ test.js(61,17): error TS2339: Property 'x' does not exist on type 'Thing'. status: 'done', ~~~~~~ !!! error TS2322: Type 'string' is not assignable to type '"done"'. -!!! related TS6500 test.js:2:5: The expected type comes from property 'status' which is declared here on type '{ status: "done"; m: (n: number) => void; }' +!!! related TS6500 test.js:2:5: The expected type comes from property 'status' which is declared here on type 'DoneStatus' m(n) { } ~ !!! error TS7006: Parameter 'n' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.types b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.types index 2d97e75add..b2c27da402 100644 --- a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.types @@ -13,11 +13,11 @@ var ns = {} /** @type {DoneStatus} */ ns.x = { ->ns.x = { status: 'done', m(n) { }} : { status: "done"; m: (n: number) => void; } +>ns.x = { status: 'done', m(n) { }} : DoneStatus >ns.x : any >ns : {} >x : any ->{ status: 'done', m(n) { }} : { status: "done"; m: (n: number) => void; } +>{ status: 'done', m(n) { }} : DoneStatus >{ status: 'done', m(n) { }} : { status: "done"; m: (n: number) => void; } status: 'done', @@ -57,11 +57,11 @@ class Thing { constructor() { /** @type {DoneStatus} */ this.s = { ->this.s = { status: 'done', m(n) { } } : { status: "done"; m: (n: number) => void; } ->this.s : { status: "done"; m: (n: number) => void; } +>this.s = { status: 'done', m(n) { } } : DoneStatus +>this.s : DoneStatus >this : this ->s : { status: "done"; m: (n: number) => void; } ->{ status: 'done', m(n) { } } : { status: "done"; m: (n: number) => void; } +>s : DoneStatus +>{ status: 'done', m(n) { } } : DoneStatus >{ status: 'done', m(n) { } } : { status: "done"; m: (n: number) => void; } status: 'done', @@ -79,9 +79,9 @@ class Thing { this.s = { >this.s = { status: 'done', m(n) { } } : { status: string; m: (n: any) => void; } ->this.s : { status: "done"; m: (n: number) => void; } +>this.s : DoneStatus >this : this ->s : { status: "done"; m: (n: number) => void; } +>s : DoneStatus >{ status: 'done', m(n) { } } : { status: string; m: (n: any) => void; } status: 'done', @@ -99,11 +99,11 @@ class Thing { /** @type {DoneStatus} */ exports.x = { ->exports.x = { status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } ->exports.x : { status: "done"; m: (n: number) => void; } +>exports.x = { status: "done", m(n) { }} : DoneStatus +>exports.x : DoneStatus >exports : typeof import("test") ->x : { status: "done"; m: (n: number) => void; } ->{ status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } +>x : DoneStatus +>{ status: "done", m(n) { }} : DoneStatus >{ status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } status: "done", @@ -115,19 +115,19 @@ exports.x = { >n : number } exports.x ->exports.x : { status: "done"; m: (n: number) => void; } +>exports.x : DoneStatus >exports : typeof import("test") ->x : { status: "done"; m: (n: number) => void; } +>x : DoneStatus /** @type {DoneStatus} */ module.exports.y = { ->module.exports.y = { status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } ->module.exports.y : { status: "done"; m: (n: number) => void; } +>module.exports.y = { status: "done", m(n) { }} : DoneStatus +>module.exports.y : DoneStatus >module.exports : typeof import("test") >module : { "test": typeof import("test"); } >exports : typeof import("test") ->y : { status: "done"; m: (n: number) => void; } ->{ status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } +>y : DoneStatus +>{ status: "done", m(n) { }} : DoneStatus >{ status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } status: "done", @@ -139,11 +139,11 @@ module.exports.y = { >n : number } module.exports.y ->module.exports.y : { status: "done"; m: (n: number) => void; } +>module.exports.y : DoneStatus >module.exports : typeof import("test") >module : { "test": typeof import("test"); } >exports : typeof import("test") ->y : { status: "done"; m: (n: number) => void; } +>y : DoneStatus // prototype-property assignment /** @type {DoneStatus} */ @@ -173,15 +173,15 @@ Thing.prototype.x // prototype assignment function F() { ->F : { (): void; prototype: { status: "done"; m: (n: number) => void; }; } +>F : { (): void; prototype: DoneStatus; } } /** @type {DoneStatus} */ F.prototype = { ->F.prototype = { status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } ->F.prototype : { status: "done"; m: (n: number) => void; } ->F : { (): void; prototype: { status: "done"; m: (n: number) => void; }; } ->prototype : { status: "done"; m: (n: number) => void; } ->{ status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } +>F.prototype = { status: "done", m(n) { }} : DoneStatus +>F.prototype : DoneStatus +>F : { (): void; prototype: DoneStatus; } +>prototype : DoneStatus +>{ status: "done", m(n) { }} : DoneStatus >{ status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } status: "done", diff --git a/testdata/baselines/reference/submodule/conformance/enumTagOnExports.types b/testdata/baselines/reference/submodule/conformance/enumTagOnExports.types index 47df75f2a4..12499ec762 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTagOnExports.types +++ b/testdata/baselines/reference/submodule/conformance/enumTagOnExports.types @@ -4,18 +4,18 @@ /** @enum {number} */ exports.a = {}; >exports.a = {} : {} ->exports.a : any +>exports.a : {} >exports : typeof import("enumTagOnExports") ->a : any +>a : {} >{} : {} /** @enum {string} */ module.exports.b = {}; >module.exports.b = {} : {} ->module.exports.b : any +>module.exports.b : {} >module.exports : typeof import("enumTagOnExports") >module : { "enumTagOnExports": typeof import("enumTagOnExports"); } >exports : typeof import("enumTagOnExports") ->b : any +>b : {} >{} : {} diff --git a/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.errors.txt index a02025e400..de19b01701 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.errors.txt @@ -1,10 +1,14 @@ +mod.js(2,11): error TS2339: Property 'K' does not exist on type '{}'. +use.js(3,17): error TS2339: Property 'K' does not exist on type '{}'. use.js(8,15): error TS2694: Namespace '"mod"' has no exported member 'n'. use.js(9,13): error TS2749: 's.Classic' refers to a value, but is being used as a type here. Did you mean 'typeof s.Classic'? -==== mod.js (0 errors) ==== +==== mod.js (1 errors) ==== exports.n = {}; exports.n.K = function () { + ~ +!!! error TS2339: Property 'K' does not exist on type '{}'. this.x = 10; } exports.Classic = class { @@ -13,10 +17,12 @@ use.js(9,13): error TS2749: 's.Classic' refers to a value, but is being used as } } -==== use.js (2 errors) ==== +==== use.js (3 errors) ==== import * as s from './mod' var k = new s.n.K() + ~ +!!! error TS2339: Property 'K' does not exist on type '{}'. k.x var classic = new s.Classic() diff --git a/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.types b/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.types index 306dc5cf2f..cc53b51d99 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.types +++ b/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.types @@ -3,17 +3,17 @@ === mod.js === exports.n = {}; >exports.n = {} : {} ->exports.n : any +>exports.n : {} >exports : typeof import("mod") ->n : any +>n : {} >{} : {} exports.n.K = function () { >exports.n.K = function () { this.x = 10;} : () => void >exports.n.K : any ->exports.n : any +>exports.n : {} >exports : typeof import("mod") ->n : any +>n : {} >K : any >function () { this.x = 10;} : () => void @@ -26,9 +26,9 @@ exports.n.K = function () { } exports.Classic = class { >exports.Classic = class { constructor() { this.p = 1 }} : typeof Classic ->exports.Classic : typeof Classic +>exports.Classic : typeof (Anonymous class) >exports : typeof import("mod") ->Classic : typeof Classic +>Classic : typeof (Anonymous class) >class { constructor() { this.p = 1 }} : typeof Classic constructor() { @@ -49,9 +49,9 @@ var k = new s.n.K() >k : any >new s.n.K() : any >s.n.K : any ->s.n : any +>s.n : {} >s : typeof import("mod") ->n : any +>n : {} >K : any k.x @@ -60,11 +60,11 @@ k.x >x : any var classic = new s.Classic() ->classic : Classic ->new s.Classic() : Classic ->s.Classic : typeof Classic +>classic : (Anonymous class) +>new s.Classic() : (Anonymous class) +>s.Classic : typeof (Anonymous class) >s : typeof import("mod") ->Classic : typeof Classic +>Classic : typeof (Anonymous class) /** @param {s.n.K} c diff --git a/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces2.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces2.errors.txt index 67b03a3c01..267c1730e9 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces2.errors.txt @@ -4,6 +4,8 @@ first.js(2,1): error TS2304: Cannot find name 'exports'. second.js(1,1): error TS2304: Cannot find name 'exports'. second.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. second.js(2,1): error TS2304: Cannot find name 'exports'. +use.js(3,18): error TS2339: Property 'j' does not exist on type '{}'. +use.js(4,28): error TS2339: Property 'o' does not exist on type '{}'. ==== mod.js (0 errors) ==== @@ -32,9 +34,13 @@ second.js(2,1): error TS2304: Cannot find name 'exports'. return v } -==== use.js (0 errors) ==== +==== use.js (2 errors) ==== import * as debug from './mod' debug.formatters.j + ~ +!!! error TS2339: Property 'j' does not exist on type '{}'. var one = debug.formatters.o(1) + ~ +!!! error TS2339: Property 'o' does not exist on type '{}'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces2.types b/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces2.types index da22cb32dc..58b7939dd2 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces2.types +++ b/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces2.types @@ -4,9 +4,9 @@ // Based on a pattern from adonis exports.formatters = {} >exports.formatters = {} : {} ->exports.formatters : any +>exports.formatters : {} >exports : typeof import("mod") ->formatters : any +>formatters : {} >{} : {} === first.js === @@ -58,18 +58,18 @@ import * as debug from './mod' debug.formatters.j >debug.formatters.j : any ->debug.formatters : any +>debug.formatters : {} >debug : typeof import("mod") ->formatters : any +>formatters : {} >j : any var one = debug.formatters.o(1) >one : any >debug.formatters.o(1) : any >debug.formatters.o : any ->debug.formatters : any +>debug.formatters : {} >debug : typeof import("mod") ->formatters : any +>formatters : {} >o : any >1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/exportPropertyAssignmentNameResolution.types b/testdata/baselines/reference/submodule/conformance/exportPropertyAssignmentNameResolution.types index 112acdbad3..0fddaca28e 100644 --- a/testdata/baselines/reference/submodule/conformance/exportPropertyAssignmentNameResolution.types +++ b/testdata/baselines/reference/submodule/conformance/exportPropertyAssignmentNameResolution.types @@ -3,14 +3,14 @@ === bug24492.js === module.exports.D = class { } >module.exports.D = class { } : typeof D ->module.exports.D : typeof D +>module.exports.D : typeof (Anonymous class) >module.exports : typeof import("bug24492") >module : { "bug24492": typeof import("bug24492"); } >exports : typeof import("bug24492") ->D : typeof D +>D : typeof (Anonymous class) >class { } : typeof D new D() ->new D() : D ->D : typeof D +>new D() : (Anonymous class) +>D : typeof (Anonymous class) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols index 1af9593125..c283005c22 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols @@ -2,9 +2,9 @@ === index.js === module.exports = class { ->module.exports : Symbol(exports, Decl(index.js, 0, 16)) +>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) >module : Symbol(module.exports) ->exports : Symbol(exports, Decl(index.js, 0, 16)) +>exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) /** * @param {number} p diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols.diff index 6511b45a1e..725d68b8d1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 0, 0)) ->exports : Symbol(export=, Decl(index.js, 0, 0)) -+>module.exports : Symbol(exports, Decl(index.js, 0, 16)) ++>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) +>module : Symbol(module.exports) -+>exports : Symbol(exports, Decl(index.js, 0, 16)) ++>exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) /** * @param {number} p diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types index b412728bd4..1741ca82e3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types @@ -3,9 +3,9 @@ === index.js === module.exports = class { >module.exports = class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports ->module.exports : typeof exports ->module : { exports: typeof exports; } ->exports : typeof exports +>module.exports : typeof (Anonymous class) +>module : { (Anonymous class): typeof (Anonymous class); } +>exports : typeof (Anonymous class) >class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt index 22d27100d3..f3dcd0a4a2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt @@ -1,5 +1,5 @@ index.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -index.js(9,16): error TS2339: Property 'Sub' does not exist on type 'typeof exports'. +index.js(9,16): error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'. ==== index.js (2 errors) ==== @@ -22,7 +22,7 @@ index.js(9,16): error TS2339: Property 'Sub' does not exist on type 'typeof expo !!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.Sub = class { ~~~ -!!! error TS2339: Property 'Sub' does not exist on type 'typeof exports'. +!!! error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'. constructor() { this.instance = new module.exports(10); } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols index d41006552a..a5f58ea147 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols @@ -2,9 +2,9 @@ === index.js === module.exports = class { ->module.exports : Symbol(exports, Decl(index.js, 0, 16)) +>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) >module : Symbol(module.exports) ->exports : Symbol(exports, Decl(index.js, 0, 16)) +>exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) /** * @param {number} p @@ -20,18 +20,18 @@ module.exports = class { } } module.exports.Sub = class { ->module.exports : Symbol(exports, Decl(index.js, 0, 16)) +>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) >module : Symbol(module.exports) ->exports : Symbol(exports, Decl(index.js, 0, 16)) +>exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) constructor() { this.instance = new module.exports(10); >this.instance : Symbol(instance, Decl(index.js, 9, 19)) >this : Symbol(Sub, Decl(index.js, 8, 20)) >instance : Symbol(instance, Decl(index.js, 9, 19)) ->module.exports : Symbol(exports, Decl(index.js, 0, 16)) +>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) >module : Symbol(module.exports) ->exports : Symbol(exports, Decl(index.js, 0, 16)) +>exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) } } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols.diff index ae78b1e9d9..acb0d78ae9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 0, 0)) ->exports : Symbol(export=, Decl(index.js, 0, 0)) -+>module.exports : Symbol(exports, Decl(index.js, 0, 16)) ++>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) +>module : Symbol(module.exports) -+>exports : Symbol(exports, Decl(index.js, 0, 16)) ++>exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) /** * @param {number} p @@ -31,9 +31,9 @@ ->module : Symbol(module, Decl(index.js, 0, 0), Decl(index.js, 10, 27)) ->exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->Sub : Symbol(Sub, Decl(index.js, 7, 1)) -+>module.exports : Symbol(exports, Decl(index.js, 0, 16)) ++>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) +>module : Symbol(module.exports) -+>exports : Symbol(exports, Decl(index.js, 0, 16)) ++>exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) constructor() { this.instance = new module.exports(10); @@ -45,8 +45,8 @@ ->module : Symbol(module, Decl(index.js, 0, 0), Decl(index.js, 10, 27)) ->exports : Symbol(module.exports, Decl(index.js, 0, 0)) +>instance : Symbol(instance, Decl(index.js, 9, 19)) -+>module.exports : Symbol(exports, Decl(index.js, 0, 16)) ++>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) +>module : Symbol(module.exports) -+>exports : Symbol(exports, Decl(index.js, 0, 16)) ++>exports : Symbol((Anonymous class), Decl(index.js, 0, 16)) } } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types index 52373bd837..c87589de68 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types @@ -3,9 +3,9 @@ === index.js === module.exports = class { >module.exports = class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports ->module.exports : typeof exports ->module : { exports: typeof exports; } ->exports : typeof exports +>module.exports : typeof (Anonymous class) +>module : { (Anonymous class): typeof (Anonymous class); } +>exports : typeof (Anonymous class) >class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports /** @@ -27,22 +27,22 @@ module.exports = class { module.exports.Sub = class { >module.exports.Sub = class { constructor() { this.instance = new module.exports(10); }} : typeof Sub >module.exports.Sub : any ->module.exports : typeof exports ->module : { exports: typeof exports; } ->exports : typeof exports +>module.exports : typeof (Anonymous class) +>module : { (Anonymous class): typeof (Anonymous class); } +>exports : typeof (Anonymous class) >Sub : any >class { constructor() { this.instance = new module.exports(10); }} : typeof Sub constructor() { this.instance = new module.exports(10); ->this.instance = new module.exports(10) : exports ->this.instance : exports +>this.instance = new module.exports(10) : (Anonymous class) +>this.instance : (Anonymous class) >this : this ->instance : exports ->new module.exports(10) : exports ->module.exports : typeof exports ->module : { exports: typeof exports; } ->exports : typeof exports +>instance : (Anonymous class) +>new module.exports(10) : (Anonymous class) +>module.exports : typeof (Anonymous class) +>module : { (Anonymous class): typeof (Anonymous class); } +>exports : typeof (Anonymous class) >10 : 10 } } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunction.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunction.symbols index f0c785a0b4..b2905a3bdc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunction.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunction.symbols @@ -12,11 +12,13 @@ module.exports.MyClass = function() { this.x = 1 } module.exports.MyClass.prototype = { +>module.exports.MyClass.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) >module.exports.MyClass : Symbol(MyClass, Decl(jsDeclarationsExportAssignedConstructorFunction.js, 0, 0)) >module.exports : Symbol("jsDeclarationsExportAssignedConstructorFunction", Decl(jsDeclarationsExportAssignedConstructorFunction.js, 0, 0)) >module : Symbol(module.exports) >exports : Symbol("jsDeclarationsExportAssignedConstructorFunction", Decl(jsDeclarationsExportAssignedConstructorFunction.js, 0, 0)) >MyClass : Symbol(MyClass, Decl(jsDeclarationsExportAssignedConstructorFunction.js, 0, 0)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) a: function() { >a : Symbol(a, Decl(jsDeclarationsExportAssignedConstructorFunction.js, 4, 36)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunction.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunction.symbols.diff index 094da5d353..f0a08f6844 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunction.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunction.symbols.diff @@ -28,11 +28,13 @@ ->exports : Symbol(module.exports, Decl(jsDeclarationsExportAssignedConstructorFunction.js, 0, 0)) ->MyClass : Symbol(MyClass, Decl(jsDeclarationsExportAssignedConstructorFunction.js, 0, 0), Decl(jsDeclarationsExportAssignedConstructorFunction.js, 4, 15)) ->prototype : Symbol(MyClass.prototype, Decl(jsDeclarationsExportAssignedConstructorFunction.js, 3, 1)) ++>module.exports.MyClass.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>module.exports.MyClass : Symbol(MyClass, Decl(jsDeclarationsExportAssignedConstructorFunction.js, 0, 0)) +>module.exports : Symbol("jsDeclarationsExportAssignedConstructorFunction", Decl(jsDeclarationsExportAssignedConstructorFunction.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("jsDeclarationsExportAssignedConstructorFunction", Decl(jsDeclarationsExportAssignedConstructorFunction.js, 0, 0)) +>MyClass : Symbol(MyClass, Decl(jsDeclarationsExportAssignedConstructorFunction.js, 0, 0)) ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) a: function() { >a : Symbol(a, Decl(jsDeclarationsExportAssignedConstructorFunction.js, 4, 36)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunction.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunction.types index f51807c49a..6ef4e8b4b5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunction.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunction.types @@ -4,11 +4,11 @@ /** @constructor */ module.exports.MyClass = function() { >module.exports.MyClass = function() { this.x = 1} : () => void ->module.exports.MyClass : any +>module.exports.MyClass : () => void >module.exports : typeof import("jsDeclarationsExportAssignedConstructorFunction") >module : { "jsDeclarationsExportAssignedConstructorFunction": typeof import("jsDeclarationsExportAssignedConstructorFunction"); } >exports : typeof import("jsDeclarationsExportAssignedConstructorFunction") ->MyClass : any +>MyClass : () => void >function() { this.x = 1} : () => void this.x = 1 @@ -21,11 +21,11 @@ module.exports.MyClass = function() { module.exports.MyClass.prototype = { >module.exports.MyClass.prototype = { a: function() { }} : { a: () => void; } >module.exports.MyClass.prototype : any ->module.exports.MyClass : any +>module.exports.MyClass : () => void >module.exports : typeof import("jsDeclarationsExportAssignedConstructorFunction") >module : { "jsDeclarationsExportAssignedConstructorFunction": typeof import("jsDeclarationsExportAssignedConstructorFunction"); } >exports : typeof import("jsDeclarationsExportAssignedConstructorFunction") ->MyClass : any +>MyClass : () => void >prototype : any >{ a: function() { }} : { a: () => void; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt index a435838ea1..e4e224acd2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt @@ -1,15 +1,22 @@ +index.js(4,18): error TS2339: Property 'cat' does not exist on type '() => void'. +index.js(7,18): error TS2339: Property 'Cls' does not exist on type '() => void'. +index.js(31,18): error TS2339: Property 'self' does not exist on type '(a: any) => any'. index.js(35,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(45,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== index.js (2 errors) ==== +==== index.js (5 errors) ==== module.exports.a = function a() {} module.exports.b = function b() {} module.exports.b.cat = "cat"; + ~~~ +!!! error TS2339: Property 'cat' does not exist on type '() => void'. module.exports.c = function c() {} module.exports.c.Cls = class {} + ~~~ +!!! error TS2339: Property 'Cls' does not exist on type '() => void'. /** * @param {number} a @@ -34,6 +41,8 @@ index.js(45,23): error TS2580: Cannot find name 'module'. Do you need to install return a; } module.exports.f.self = module.exports.f; + ~~~~ +!!! error TS2339: Property 'self' does not exist on type '(a: any) => any'. /** * @param {{x: string}} a diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types index 1bdd4f4235..426a93140d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types @@ -3,53 +3,53 @@ === index.js === module.exports.a = function a() {} >module.exports.a = function a() {} : () => void ->module.exports.a : any +>module.exports.a : () => void >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->a : any +>a : () => void >function a() {} : () => void >a : () => void module.exports.b = function b() {} >module.exports.b = function b() {} : () => void ->module.exports.b : any +>module.exports.b : () => void >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->b : any +>b : () => void >function b() {} : () => void >b : () => void module.exports.b.cat = "cat"; >module.exports.b.cat = "cat" : "cat" >module.exports.b.cat : any ->module.exports.b : any +>module.exports.b : () => void >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->b : any +>b : () => void >cat : any >"cat" : "cat" module.exports.c = function c() {} >module.exports.c = function c() {} : () => void ->module.exports.c : any +>module.exports.c : () => void >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->c : any +>c : () => void >function c() {} : () => void >c : () => void module.exports.c.Cls = class {} >module.exports.c.Cls = class {} : typeof Cls >module.exports.c.Cls : any ->module.exports.c : any +>module.exports.c : () => void >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->c : any +>c : () => void >Cls : any >class {} : typeof Cls @@ -60,11 +60,11 @@ module.exports.c.Cls = class {} */ module.exports.d = function d(a, b) { return /** @type {*} */(null); } >module.exports.d = function d(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any ->module.exports.d : any +>module.exports.d : (a: any, b: any) => any >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->d : any +>d : (a: any, b: any) => any >function d(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any >d : (a: any, b: any) => any >a : any @@ -80,11 +80,11 @@ module.exports.d = function d(a, b) { return /** @type {*} */(null); } */ module.exports.e = function e(a, b) { return /** @type {*} */(null); } >module.exports.e = function e(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any ->module.exports.e : any +>module.exports.e : (a: any, b: any) => any >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->e : any +>e : (a: any, b: any) => any >function e(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any >e : (a: any, b: any) => any >a : any @@ -98,11 +98,11 @@ module.exports.e = function e(a, b) { return /** @type {*} */(null); } */ module.exports.f = function f(a) { >module.exports.f = function f(a) { return a;} : (a: any) => any ->module.exports.f : any +>module.exports.f : (a: any) => any >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->f : any +>f : (a: any) => any >function f(a) { return a;} : (a: any) => any >f : (a: any) => any >a : any @@ -111,19 +111,19 @@ module.exports.f = function f(a) { >a : any } module.exports.f.self = module.exports.f; ->module.exports.f.self = module.exports.f : any +>module.exports.f.self = module.exports.f : (a: any) => any >module.exports.f.self : any ->module.exports.f : any +>module.exports.f : (a: any) => any >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->f : any +>f : (a: any) => any >self : any ->module.exports.f : any +>module.exports.f : (a: any) => any >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->f : any +>f : (a: any) => any /** * @param {{x: string}} a @@ -185,48 +185,48 @@ module.exports.h = hh; module.exports.i = function i() {} >module.exports.i = function i() {} : () => void ->module.exports.i : any +>module.exports.i : () => void >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->i : any +>i : () => void >function i() {} : () => void >i : () => void module.exports.ii = module.exports.i; ->module.exports.ii = module.exports.i : any ->module.exports.ii : any +>module.exports.ii = module.exports.i : () => void +>module.exports.ii : () => void >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->ii : any ->module.exports.i : any +>ii : () => void +>module.exports.i : () => void >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->i : any +>i : () => void // note that this last one doesn't make much sense in cjs, since exports aren't hoisted bindings module.exports.jj = module.exports.j; ->module.exports.jj = module.exports.j : any ->module.exports.jj : any +>module.exports.jj = module.exports.j : () => void +>module.exports.jj : () => void >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->jj : any ->module.exports.j : any +>jj : () => void +>module.exports.j : () => void >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->j : any +>j : () => void module.exports.j = function j() {} >module.exports.j = function j() {} : () => void ->module.exports.j : any +>module.exports.j : () => void >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->j : any +>j : () => void >function j() {} : () => void >j : () => void diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types index 4eb595b0e1..3d7197187f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types @@ -8,31 +8,31 @@ * @type {Item}; */ const x = {x: 12}; ->x : { x: number; } +>x : Item >{x: 12} : { x: number; } >x : number >12 : 12 module.exports = x; ->module.exports = x : { x: number; } ->module.exports : { x: number; } ->module : { readonly x: { x: number; }; } ->exports : { x: number; } ->x : { x: number; } +>module.exports = x : Item +>module.exports : Item +>module : { readonly x: Item; } +>exports : Item +>x : Item === index.js === /** @type {(typeof import("./folder/mod1"))[]} */ const items = [{x: 12}]; ->items : { x: number; }[] +>items : Item[] >[{x: 12}] : { x: number; }[] >{x: 12} : { x: number; } >x : number >12 : 12 module.exports = items; ->module.exports = items : { x: number; }[] ->module.exports : { x: number; }[] ->module : { readonly items: { x: number; }[]; } ->exports : { x: number; }[] ->items : { x: number; }[] +>module.exports = items : Item[] +>module.exports : Item[] +>module : { readonly items: Item[]; } +>exports : Item[] +>items : Item[] diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.errors.txt index b54ec9236b..b8e52a3a33 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.errors.txt @@ -1,7 +1,8 @@ index.js(3,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(5,18): error TS2339: Property 'B' does not exist on type '{}'. -==== index.js (1 errors) ==== +==== index.js (2 errors) ==== /// const Something = require("fs").Something; @@ -9,6 +10,8 @@ index.js(3,19): error TS2580: Cannot find name 'require'. Do you need to install !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. module.exports.A = {} module.exports.A.B = { + ~ +!!! error TS2339: Property 'B' does not exist on type '{}'. thing: new Something() } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.types index 77aefd3056..8cabdc2d91 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.types @@ -13,21 +13,21 @@ const Something = require("fs").Something; module.exports.A = {} >module.exports.A = {} : {} ->module.exports.A : any +>module.exports.A : {} >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->A : any +>A : {} >{} : {} module.exports.A.B = { >module.exports.A.B = { thing: new Something()} : { thing: any; } >module.exports.A.B : any ->module.exports.A : any +>module.exports.A : {} >module.exports : typeof import("index") >module : { "index": typeof import("index"); } >exports : typeof import("index") ->A : any +>A : {} >B : any >{ thing: new Something()} : { thing: any; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.types index f0d37471f2..7189bdfc45 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.types @@ -16,9 +16,9 @@ let id = 0 * @returns {Promise} */ const send = handlers => new Promise((resolve, reject) => { ->send : (handlers: { [id: string]: [Function, Function]; }) => Promise ->handlers => new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : (handlers: { [id: string]: [Function, Function]; }) => Promise ->handlers : { [id: string]: [Function, Function]; } +>send : (handlers: ResolveRejectMap) => Promise +>handlers => new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : (handlers: ResolveRejectMap) => Promise +>handlers : ResolveRejectMap >new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : Promise >Promise : PromiseConstructor >(resolve, reject) => { handlers[++id] = [resolve, reject]} : (resolve: (value: any) => void, reject: (reason?: any) => void) => void @@ -28,7 +28,7 @@ const send = handlers => new Promise((resolve, reject) => { handlers[++id] = [resolve, reject] >handlers[++id] = [resolve, reject] : [(value: any) => void, (reason?: any) => void] >handlers[++id] : [Function, Function] ->handlers : { [id: string]: [Function, Function]; } +>handlers : ResolveRejectMap >++id : number >id : number >[resolve, reject] : [(value: any) => void, (reason?: any) => void] diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt index 9159bcdbdb..0bb4eb949a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt @@ -1,6 +1,5 @@ index.js(3,37): error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. index.js(21,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -module.js(11,38): error TS2304: Cannot find name 'P'. module.js(24,12): error TS2315: Type 'Object' is not generic. module.js(27,1): error TS2309: An export assignment cannot be used in a module with other exported elements. @@ -31,7 +30,7 @@ module.js(27,1): error TS2309: An export assignment cannot be used in a module w module.exports = MainThreadTasks; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== module.js (3 errors) ==== +==== module.js (2 errors) ==== /** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ /** @@ -43,8 +42,6 @@ module.js(27,1): error TS2309: An export assignment cannot be used in a module w /** * @type {{[P in TaskGroupIds]: {id: P, label: string}}} - ~ -!!! error TS2304: Cannot find name 'P'. */ const taskGroups = { parseHTML: { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types index 66e4dc7661..df4ac078ef 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types @@ -2,9 +2,9 @@ === index.js === const {taskGroups, taskNameToGroup} = require('./module.js'); ->taskGroups : { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; } +>taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } >taskNameToGroup : any ->require('./module.js') : { taskGroups: { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; }; taskNameToGroup: any; } +>require('./module.js') : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } >require : any >'./module.js' : "./module.js" @@ -51,15 +51,15 @@ module.exports = MainThreadTasks; * @type {{[P in TaskGroupIds]: {id: P, label: string}}} */ const taskGroups = { ->taskGroups : { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; } ->{ parseHTML: { id: 'parseHTML', label: 'Parse HTML & CSS' }, styleLayout: { id: 'styleLayout', label: 'Style & Layout' },} : { parseHTML: { id: string; label: string; }; styleLayout: { id: string; label: string; }; } +>taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } +>{ parseHTML: { id: 'parseHTML', label: 'Parse HTML & CSS' }, styleLayout: { id: 'styleLayout', label: 'Style & Layout' },} : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } parseHTML: { ->parseHTML : { id: string; label: string; } ->{ id: 'parseHTML', label: 'Parse HTML & CSS' } : { id: string; label: string; } +>parseHTML : { id: "parseHTML"; label: string; } +>{ id: 'parseHTML', label: 'Parse HTML & CSS' } : { id: "parseHTML"; label: string; } id: 'parseHTML', ->id : string +>id : "parseHTML" >'parseHTML' : "parseHTML" label: 'Parse HTML & CSS' @@ -68,11 +68,11 @@ const taskGroups = { }, styleLayout: { ->styleLayout : { id: string; label: string; } ->{ id: 'styleLayout', label: 'Style & Layout' } : { id: string; label: string; } +>styleLayout : { id: "styleLayout"; label: string; } +>{ id: 'styleLayout', label: 'Style & Layout' } : { id: "styleLayout"; label: string; } id: 'styleLayout', ->id : string +>id : "styleLayout" >'styleLayout' : "styleLayout" label: 'Style & Layout' @@ -88,14 +88,14 @@ const taskNameToGroup = {}; >{} : {} module.exports = { ->module.exports = { taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; }; taskNameToGroup: any; } ->module.exports : { taskGroups: { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; }; taskNameToGroup: any; } ->module : { export=: { taskGroups: { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; }; taskNameToGroup: any; }; } ->exports : { taskGroups: { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; }; taskNameToGroup: any; } ->{ taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; }; taskNameToGroup: any; } +>module.exports = { taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } +>module.exports : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } +>module : { export=: { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; }; } +>exports : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } +>{ taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } taskGroups, ->taskGroups : { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; } +>taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } taskNameToGroup, >taskNameToGroup : any diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.types index 8594128d60..2d3ee3c528 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.types @@ -29,16 +29,16 @@ class Foo { * @return {T} */ foo(x, y, alpha) { ->foo : (x: T, y: (t: T) => T, alpha: (t: T) => T) => T +>foo : (x: T, y: Id, alpha: Id2) => T >x : T ->y : (t: T) => T ->alpha : (t: T) => T +>y : Id +>alpha : Id2 return alpha(y(x)) >alpha(y(x)) : T ->alpha : (t: T) => T +>alpha : Id2 >y(x) : T ->y : (t: T) => T +>y : Id >x : T } } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt index 3e6ab1d570..6ad768a099 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt @@ -1,24 +1,22 @@ -file.js(3,15): error TS2304: Cannot find name 'T'. +file.js(9,20): error TS2322: Type 'number' is not assignable to type 'string'. file.js(33,14): error TS2706: Required type parameters may not follow optional type parameters. file.js(38,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. -file.js(45,17): error TS2304: Cannot find name 'T'. file.js(53,14): error TS2706: Required type parameters may not follow optional type parameters. -file.js(60,17): error TS2304: Cannot find name 'U'. -file.js(61,17): error TS2304: Cannot find name 'T'. +file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. -==== file.js (7 errors) ==== +==== file.js (5 errors) ==== /** * @template {string | number} [T=string] - ok: defaults are permitted * @typedef {[T]} A - ~ -!!! error TS2304: Cannot find name 'T'. */ /** @type {A} */ // ok, default for `T` in `A` is `string` const aDefault1 = [""]; /** @type {A} */ // error: `number` is not assignable to string` const aDefault2 = [0]; + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. /** @type {A} */ // ok, `T` is provided for `A` const aString = [""]; /** @type {A} */ // ok, `T` is provided for `A` @@ -59,8 +57,6 @@ file.js(61,17): error TS2304: Cannot find name 'T'. /** * @template T * @template [U=T] - ok: default can reference earlier type parameter - ~ -!!! error TS2304: Cannot find name 'T'. * @param {T} a * @param {U} b */ @@ -79,10 +75,8 @@ file.js(61,17): error TS2304: Cannot find name 'T'. /** * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. ~ -!!! error TS2304: Cannot find name 'U'. +!!! error TS2744: Type parameter defaults can only reference previously declared type parameters. * @template [U=T] - ~ -!!! error TS2304: Cannot find name 'T'. * @param {T} a * @param {U} b */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.types index c191b65f31..09de64c0a6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.types @@ -8,25 +8,25 @@ /** @type {A} */ // ok, default for `T` in `A` is `string` const aDefault1 = [""]; ->aDefault1 : [T] +>aDefault1 : A >[""] : [string] >"" : "" /** @type {A} */ // error: `number` is not assignable to string` const aDefault2 = [0]; ->aDefault2 : [T] +>aDefault2 : A >[0] : [number] >0 : 0 /** @type {A} */ // ok, `T` is provided for `A` const aString = [""]; ->aString : [T] +>aString : A >[""] : [string] >"" : "" /** @type {A} */ // ok, `T` is provided for `A` const aNumber = [0]; ->aNumber : [T] +>aNumber : A >[0] : [number] >0 : 0 diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt index 5aa1f20558..64df35ea66 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt @@ -1,22 +1,16 @@ -file.js(3,21): error TS2304: Cannot find name 'T'. -file.js(4,14): error TS2304: Cannot find name 'T'. -file.js(4,16): error TS2304: Cannot find name 'K'. +file.js(10,7): error TS2322: Type 'string' is not assignable to type 'number'. -==== file.js (3 errors) ==== +==== file.js (1 errors) ==== /** * @template T * @template {keyof T} K - ~ -!!! error TS2304: Cannot find name 'T'. * @typedef {T[K]} Foo - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'K'. */ const x = { a: 1 }; /** @type {Foo} */ - const y = "a"; \ No newline at end of file + const y = "a"; + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.types index 5d05ab34ac..4c85f4f3fc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.types @@ -15,6 +15,6 @@ const x = { a: 1 }; /** @type {Foo} */ const y = "a"; ->y : T +>y : number >"a" : "a" diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.types b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.types index c0aa65b5de..adfdfb9a55 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.types @@ -11,9 +11,9 @@ const C = require("./semver") var two = C.f(1) >two : any >C.f(1) : any ->C.f : any +>C.f : (n: any) => any >C : typeof import("semver") ->f : any +>f : (n: any) => any >1 : 1 var c = new C @@ -46,9 +46,9 @@ exports = module.exports = C exports.f = n => n + 1 >exports.f = n => n + 1 : (n: any) => any ->exports.f : any +>exports.f : (n: any) => any >exports : typeof import("semver") ->f : any +>f : (n: any) => any >n => n + 1 : (n: any) => any >n : any >n + 1 : any diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment2.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment2.types index 9d1eca7397..d1ff81e590 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment2.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment2.types @@ -12,11 +12,11 @@ var npm = module.exports = function (tree) { } module.exports.asReadInstalled = function (tree) { >module.exports.asReadInstalled = function (tree) { npm(tree) // both references should be callable module.exports(tree)} : (tree: any) => void ->module.exports.asReadInstalled : any +>module.exports.asReadInstalled : (tree: any) => void >module.exports : typeof import("npm") >module : { "npm": typeof import("npm"); } >exports : typeof import("npm") ->asReadInstalled : any +>asReadInstalled : (tree: any) => void >function (tree) { npm(tree) // both references should be callable module.exports(tree)} : (tree: any) => void >tree : any diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportNestedNamespaces.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportNestedNamespaces.errors.txt index a23b0530f1..b3f788da0c 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportNestedNamespaces.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportNestedNamespaces.errors.txt @@ -1,10 +1,14 @@ +mod.js(2,18): error TS2339: Property 'K' does not exist on type '{}'. +use.js(3,17): error TS2339: Property 'K' does not exist on type '{}'. use.js(8,15): error TS2694: Namespace '"mod"' has no exported member 'n'. use.js(9,13): error TS2749: 's.Classic' refers to a value, but is being used as a type here. Did you mean 'typeof s.Classic'? -==== mod.js (0 errors) ==== +==== mod.js (1 errors) ==== module.exports.n = {}; module.exports.n.K = function C() { + ~ +!!! error TS2339: Property 'K' does not exist on type '{}'. this.x = 10; } module.exports.Classic = class { @@ -13,10 +17,12 @@ use.js(9,13): error TS2749: 's.Classic' refers to a value, but is being used as } } -==== use.js (2 errors) ==== +==== use.js (3 errors) ==== import * as s from './mod' var k = new s.n.K() + ~ +!!! error TS2339: Property 'K' does not exist on type '{}'. k.x var classic = new s.Classic() diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportNestedNamespaces.types b/testdata/baselines/reference/submodule/conformance/moduleExportNestedNamespaces.types index db883825d9..48c8c9eb7f 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportNestedNamespaces.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportNestedNamespaces.types @@ -3,21 +3,21 @@ === mod.js === module.exports.n = {}; >module.exports.n = {} : {} ->module.exports.n : any +>module.exports.n : {} >module.exports : typeof import("mod") >module : { "mod": typeof import("mod"); } >exports : typeof import("mod") ->n : any +>n : {} >{} : {} module.exports.n.K = function C() { >module.exports.n.K = function C() { this.x = 10;} : () => void >module.exports.n.K : any ->module.exports.n : any +>module.exports.n : {} >module.exports : typeof import("mod") >module : { "mod": typeof import("mod"); } >exports : typeof import("mod") ->n : any +>n : {} >K : any >function C() { this.x = 10;} : () => void >C : () => void @@ -31,11 +31,11 @@ module.exports.n.K = function C() { } module.exports.Classic = class { >module.exports.Classic = class { constructor() { this.p = 1 }} : typeof Classic ->module.exports.Classic : typeof Classic +>module.exports.Classic : typeof (Anonymous class) >module.exports : typeof import("mod") >module : { "mod": typeof import("mod"); } >exports : typeof import("mod") ->Classic : typeof Classic +>Classic : typeof (Anonymous class) >class { constructor() { this.p = 1 }} : typeof Classic constructor() { @@ -56,9 +56,9 @@ var k = new s.n.K() >k : any >new s.n.K() : any >s.n.K : any ->s.n : any +>s.n : {} >s : typeof import("mod") ->n : any +>n : {} >K : any k.x @@ -67,11 +67,11 @@ k.x >x : any var classic = new s.Classic() ->classic : Classic ->new s.Classic() : Classic ->s.Classic : typeof Classic +>classic : (Anonymous class) +>new s.Classic() : (Anonymous class) +>s.Classic : typeof (Anonymous class) >s : typeof import("mod") ->Classic : typeof Classic +>Classic : typeof (Anonymous class) /** @param {s.n.K} c diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.errors.txt index ef452d142a..da9dd12010 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.errors.txt @@ -1,33 +1,24 @@ -mod1.js(1,1): error TS7022: 'a' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -mod1.js(2,1): error TS7022: 'b' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -mod1.js(3,1): error TS7022: 'default' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -mod1.js(4,1): error TS7022: 'c' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -mod1.js(5,1): error TS7022: 'd' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. +mod1.js(6,24): error TS2339: Property 'e' does not exist on type '{}'. +mod2.js(6,8): error TS2339: Property 'e' does not exist on type '{}'. -==== mod2.js (0 errors) ==== +==== mod2.js (1 errors) ==== const mod1 = require("./mod1"); mod1.a; mod1.b; mod1.c; mod1.d; mod1.d.e; + ~ +!!! error TS2339: Property 'e' does not exist on type '{}'. mod1.default; -==== mod1.js (5 errors) ==== +==== mod1.js (1 errors) ==== exports.a = { x: "x" }; - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7022: 'a' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. exports["b"] = { x: "x" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7022: 'b' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. exports["default"] = { x: "x" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7022: 'default' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. module.exports["c"] = { x: "x" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7022: 'c' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. module["exports"]["d"] = {}; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7022: 'd' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. module["exports"]["d"].e = 0; + ~ +!!! error TS2339: Property 'e' does not exist on type '{}'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types index 0262c54af8..9a6100683c 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types @@ -8,50 +8,50 @@ const mod1 = require("./mod1"); >"./mod1" : "./mod1" mod1.a; ->mod1.a : any +>mod1.a : { x: string; } >mod1 : typeof import("mod1") ->a : any +>a : { x: string; } mod1.b; ->mod1.b : any +>mod1.b : { x: string; } >mod1 : typeof import("mod1") ->b : any +>b : { x: string; } mod1.c; ->mod1.c : any +>mod1.c : { x: string; } >mod1 : typeof import("mod1") ->c : any +>c : { x: string; } mod1.d; ->mod1.d : any +>mod1.d : {} >mod1 : typeof import("mod1") ->d : any +>d : {} mod1.d.e; >mod1.d.e : any ->mod1.d : any +>mod1.d : {} >mod1 : typeof import("mod1") ->d : any +>d : {} >e : any mod1.default; ->mod1.default : any +>mod1.default : { x: string; } >mod1 : typeof import("mod1") ->default : any +>default : { x: string; } === mod1.js === exports.a = { x: "x" }; >exports.a = { x: "x" } : { x: string; } ->exports.a : any +>exports.a : { x: string; } >exports : typeof import("mod1") ->a : any +>a : { x: string; } >{ x: "x" } : { x: string; } >x : string >"x" : "x" exports["b"] = { x: "x" }; >exports["b"] = { x: "x" } : { x: string; } ->exports["b"] : any +>exports["b"] : { x: string; } >exports : typeof import("mod1") >"b" : "b" >{ x: "x" } : { x: string; } @@ -60,7 +60,7 @@ exports["b"] = { x: "x" }; exports["default"] = { x: "x" }; >exports["default"] = { x: "x" } : { x: string; } ->exports["default"] : any +>exports["default"] : { x: string; } >exports : typeof import("mod1") >"default" : "default" >{ x: "x" } : { x: string; } @@ -69,7 +69,7 @@ exports["default"] = { x: "x" }; module.exports["c"] = { x: "x" }; >module.exports["c"] = { x: "x" } : { x: string; } ->module.exports["c"] : any +>module.exports["c"] : { x: string; } >module.exports : typeof import("mod1") >module : { "mod1": typeof import("mod1"); } >exports : typeof import("mod1") @@ -80,7 +80,7 @@ module.exports["c"] = { x: "x" }; module["exports"]["d"] = {}; >module["exports"]["d"] = {} : {} ->module["exports"]["d"] : any +>module["exports"]["d"] : {} >module["exports"] : typeof import("mod1") >module : { "mod1": typeof import("mod1"); } >"exports" : "exports" @@ -90,7 +90,7 @@ module["exports"]["d"] = {}; module["exports"]["d"].e = 0; >module["exports"]["d"].e = 0 : 0 >module["exports"]["d"].e : any ->module["exports"]["d"] : any +>module["exports"]["d"] : {} >module["exports"] : typeof import("mod1") >module : { "mod1": typeof import("mod1"); } >"exports" : "exports" diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt deleted file mode 100644 index 992effe5ec..0000000000 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -38572.js(4,39): error TS2304: Cannot find name 'K'. - - -==== 38572.js (1 errors) ==== - /** - * @template T - * @param {T} a - * @param {{[K in keyof T]: (value: T[K]) => void }} b - ~ -!!! error TS2304: Cannot find name 'K'. - */ - function f(a, b) { - } - - f({ x: 42 }, { x(param) { param.toFixed() } }); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.symbols b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.symbols index 78188b126c..eca5bba289 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.symbols +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.symbols @@ -17,5 +17,7 @@ f({ x: 42 }, { x(param) { param.toFixed() } }); >x : Symbol(x, Decl(38572.js, 8, 3)) >x : Symbol(x, Decl(38572.js, 8, 14)) >param : Symbol(param, Decl(38572.js, 8, 17)) +>param.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) >param : Symbol(param, Decl(38572.js, 8, 17)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.symbols.diff b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.symbols.diff index c3b39999d8..14e4852680 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.symbols.diff @@ -5,5 +5,7 @@ >x : Symbol(x, Decl(38572.js, 8, 14)) >param : Symbol(param, Decl(38572.js, 8, 17)) ->param.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) ++>param.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) >param : Symbol(param, Decl(38572.js, 8, 17)) ->toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.types b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.types index 6fc6473131..4e0252cb7a 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.types +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.types @@ -18,11 +18,11 @@ f({ x: 42 }, { x(param) { param.toFixed() } }); >{ x: 42 } : { x: number; } >x : number >42 : 42 ->{ x(param) { param.toFixed() } } : { x: (param: K) => void; } ->x : (param: K) => void ->param : K ->param.toFixed() : any ->param.toFixed : any ->param : K ->toFixed : any +>{ x(param) { param.toFixed() } } : { x: (param: number) => void; } +>x : (param: number) => void +>param : number +>param.toFixed() : string +>param.toFixed : (fractionDigits?: number) => string +>param : number +>toFixed : (fractionDigits?: number) => string diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt index af20fbb5f1..9c2df0fa3e 100644 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt @@ -1,64 +1,34 @@ -bug39372.js(1,36): error TS2456: Type alias 'JsonArray' circularly references itself. -bug39372.js(3,88): error TS2456: Type alias 'Json' circularly references itself. -bug39372.js(9,17): error TS2304: Cannot find name 'T'. -bug39372.js(9,32): error TS2304: Cannot find name 'T'. -bug39372.js(12,17): error TS2304: Cannot find name 'T'. -bug39372.js(14,10): error TS2304: Cannot find name 'T'. -bug39372.js(14,55): error TS2304: Cannot find name 'T'. -bug39372.js(18,15): error TS2304: Cannot find name 'T'. -bug39372.js(19,5): error TS2304: Cannot find name 'T'. -bug39372.js(20,19): error TS2304: Cannot find name 'T'. -bug39372.js(25,7): error TS2322: Type '{}' is not assignable to type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; } & { [x: string]: string | { $A: { [x: string]: (??? & ???)[]; }; $O: { [x: string]: { $$?: Record; } & (??? | ??? & ???); }; $$?: Record; } & ???; }'. - Type '{}' is missing the following properties from type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; }': $A, $O +bug39372.js(25,7): error TS2322: Type '{}' is not assignable to type 'XMLObject<{ foo: string; }>'. + Type '{}' is missing the following properties from type '{ $A: { foo?: XMLObject[]; }; $O: { foo?: { $$?: Record; } & { $: string; }; }; $$?: Record; }': $A, $O -==== bug39372.js (11 errors) ==== +==== bug39372.js (1 errors) ==== /** @typedef {ReadonlyArray} JsonArray */ - ~~~~~~~~~ -!!! error TS2456: Type alias 'JsonArray' circularly references itself. /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ - ~~~~ -!!! error TS2456: Type alias 'Json' circularly references itself. /** * @template T * @typedef {{ $A: { [K in keyof T]?: XMLObject[] - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'T'. }, $O: { [K in keyof T]?: { - ~ -!!! error TS2304: Cannot find name 'T'. $$?: Record } & (T[K] extends string ? {$:string} : XMLObject) - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'T'. }, $$?: Record, } & { [K in keyof T]?: ( - ~ -!!! error TS2304: Cannot find name 'T'. T[K] extends string ? string - ~ -!!! error TS2304: Cannot find name 'T'. : XMLObject - ~ -!!! error TS2304: Cannot find name 'T'. ) }} XMLObject */ /** @type {XMLObject<{foo:string}>} */ const p = {}; ~ -!!! error TS2322: Type '{}' is not assignable to type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; } & { [x: string]: string | { $A: { [x: string]: (??? & ???)[]; }; $O: { [x: string]: { $$?: Record; } & (??? | ??? & ???); }; $$?: Record; } & ???; }'. -!!! error TS2322: Type '{}' is missing the following properties from type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; }': $A, $O +!!! error TS2322: Type '{}' is not assignable to type 'XMLObject<{ foo: string; }>'. +!!! error TS2322: Type '{}' is missing the following properties from type '{ $A: { foo?: XMLObject[]; }; $O: { foo?: { $$?: Record; } & { $: string; }; }; $$?: Record; }': $A, $O \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.types b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.types index fd81757bb2..e4f14be2e0 100644 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.types +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.types @@ -26,6 +26,6 @@ /** @type {XMLObject<{foo:string}>} */ const p = {}; ->p : { $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; } & { [x: string]: string | { $A: { [x: string]: (??? & ???)[]; }; $O: { [x: string]: { $$?: Record; } & (??? | ??? & ???); }; $$?: Record; } & ???; } +>p : XMLObject<{ foo: string; }> >{} : {} diff --git a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types index dc6ac8e7e5..07ac1d45be 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types @@ -12,9 +12,9 @@ declare var module: any, exports: any; === a-ext.js === exports.A = function () { >exports.A = function () { this.x = 1;} : () => void ->exports.A : any +>exports.A : () => void >exports : typeof import("a-ext") ->A : any +>A : () => void >function () { this.x = 1;} : () => void this.x = 1; @@ -28,7 +28,7 @@ exports.A = function () { === a.js === const { A } = require("./a-ext"); ->A : any +>A : () => void >require("./a-ext") : typeof import("a-ext") >require : (id: string) => any >"./a-ext" : "./a-ext" @@ -44,9 +44,9 @@ function a(p) { p.x; } === b-ext.js === exports.B = class { >exports.B = class { constructor() { this.x = 1; }} : typeof B ->exports.B : typeof B +>exports.B : typeof (Anonymous class) >exports : typeof import("b-ext") ->B : typeof B +>B : typeof (Anonymous class) >class { constructor() { this.x = 1; }} : typeof B constructor() { @@ -61,7 +61,7 @@ exports.B = class { === b.js === const { B } = require("./b-ext"); ->B : typeof B +>B : typeof (Anonymous class) >require("./b-ext") : typeof import("b-ext") >require : (id: string) => any >"./b-ext" : "./b-ext" diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt index 71b0b2cce5..6104c81d3a 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt @@ -1,14 +1,14 @@ -typeTagNoErasure.js(1,39): error TS2304: Cannot find name 'T'. +typeTagNoErasure.js(7,6): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ==== typeTagNoErasure.js (1 errors) ==== /** @template T @typedef {(data: T1) => T1} Test */ - ~ -!!! error TS2304: Cannot find name 'T'. /** @type {Test} */ const test = dibbity => dibbity test(1) // ok, T=1 test('hi') // error, T=number + ~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.types b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.types index ef248f206c..db5ac9e24e 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.types +++ b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.types @@ -5,18 +5,18 @@ /** @type {Test} */ const test = dibbity => dibbity ->test : (data: T1) => T1 ->dibbity => dibbity : (dibbity: T1) => T1 +>test : Test +>dibbity => dibbity : (dibbity: T1) => T1 >dibbity : T1 >dibbity : T1 test(1) // ok, T=1 >test(1) : 1 ->test : (data: T1) => T1 +>test : Test >1 : 1 test('hi') // error, T=number ->test('hi') : "hi" ->test : (data: T1) => T1 +>test('hi') : number +>test : Test >'hi' : "hi" diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types index f7fd67e21f..b077f5df82 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types @@ -53,9 +53,9 @@ export function C() { exports.C = function() { >exports.C = function() { this.p = 1} : () => void ->exports.C : any +>exports.C : () => void >exports : typeof import("mod3") ->C : any +>C : () => void >function() { this.p = 1} : () => void this.p = 1 @@ -83,7 +83,7 @@ var both2 = both1; /** @type {import('./mod3').Both} */ var both3 = both2; ->both3 : { type: "a"; x: 1; } | { type: "b"; y: 1; } +>both3 : Both >both2 : Both diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt index 5570c99ce3..430e0df3e9 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt @@ -1,30 +1,15 @@ -a.js(6,19): error TS2304: Cannot find name 'T'. -a.js(6,25): error TS2304: Cannot find name 'U'. -a.js(6,31): error TS2304: Cannot find name 'V'. -a.js(6,37): error TS2304: Cannot find name 'W'. -a.js(6,43): error TS2304: Cannot find name 'X'. a.js(12,23): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. a.js(15,12): error TS2314: Generic type 'Everything' requires 5 type argument(s). test.ts(1,23): error TS2304: Cannot find name 'Everything'. -==== a.js (7 errors) ==== +==== a.js (2 errors) ==== /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? * @template W * @template X That last one had no comment * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'U'. - ~ -!!! error TS2304: Cannot find name 'V'. - ~ -!!! error TS2304: Cannot find name 'W'. - ~ -!!! error TS2304: Cannot find name 'X'. */ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.types b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.types index 34308527f8..1839da2652 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.types +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.types @@ -11,11 +11,11 @@ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ var tuvwx; ->tuvwx : { t: T; u: U; v: V; w: W; x: X; } +>tuvwx : Everything<{ a: number; b: "hi"; c: never; }, undefined, { c: true; d: 1; }, number, string> /** @type {Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>} */ var wrong; ->wrong : { t: T; u: U; v: V; w: W; x: X; } +>wrong : Everything<{ a: number; }, undefined, { c: 1; d: 1; }, number, string> /** @type {Everything<{ a: number }>} */ var insufficient; diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.types b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.types index bc0ab0707e..834d6de368 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.types +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.types @@ -93,24 +93,24 @@ catch (e) { * @param {Q} q */ function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { ->proof : (a: { a: string; }, b: { b: string; }, c: { c: string; }, d: { d: string; }, e: { e: string; }, f: { f: string; }, g: { g: string; }, h: { h: string; }, i: { i: string; }, j: { j: string; }, k: { k: string; }, l: { l: string; }, m: { m: string; }, n: { n: string; }, o: { o: string; }, p: { p: string; }, q: { q: string; }) => void ->a : { a: string; } ->b : { b: string; } ->c : { c: string; } ->d : { d: string; } ->e : { e: string; } ->f : { f: string; } ->g : { g: string; } ->h : { h: string; } ->i : { i: string; } ->j : { j: string; } ->k : { k: string; } ->l : { l: string; } ->m : { m: string; } ->n : { n: string; } ->o : { o: string; } ->p : { p: string; } ->q : { q: string; } +>proof : (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q) => void +>a : A +>b : B +>c : C +>d : D +>e : E +>f : F +>g : G +>h : H +>i : I +>j : J +>k : K +>l : L +>m : M +>n : N +>o : O +>p : P +>q : Q console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) >console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) : void @@ -118,60 +118,60 @@ function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { >console : Console >log : (...data: any[]) => void >a.a : string ->a : { a: string; } +>a : A >a : string >b.b : string ->b : { b: string; } +>b : B >b : string >c.c : string ->c : { c: string; } +>c : C >c : string >d.d : string ->d : { d: string; } +>d : D >d : string >e.e : string ->e : { e: string; } +>e : E >e : string >f.f : string ->f : { f: string; } +>f : F >f : string >g.g : string ->g : { g: string; } +>g : G >g : string >h.h : string ->h : { h: string; } +>h : H >h : string >i.i : string ->i : { i: string; } +>i : I >i : string >j.j : string ->j : { j: string; } +>j : J >j : string >k.k : string ->k : { k: string; } +>k : K >k : string >l.l : string ->l : { l: string; } +>l : L >l : string >m.m : string ->m : { m: string; } +>m : M >m : string >n.n : string ->n : { n: string; } +>n : N >n : string >o.o : string ->o : { o: string; } +>o : O >o : string >p.p : string ->p : { p: string; } +>p : P >p : string >q.q : string ->q : { q: string; } +>q : Q >q : string /** @type {Alpha} */ var alpha = { alpha: "aleph" } ->alpha : { alpha: string; } +>alpha : Alpha >{ alpha: "aleph" } : { alpha: string; } >alpha : string >"aleph" : "aleph" diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols index 99801b5b7e..6493017cb5 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols @@ -5,7 +5,9 @@ import foo from "foo"; >foo : Symbol(foo, Decl(a.ts, 0, 6)) foo.bar(); +>foo.bar : Symbol(bar, Decl(index.js, 0, 19)) >foo : Symbol(foo, Decl(a.ts, 0, 6)) +>bar : Symbol(bar, Decl(index.js, 0, 19)) === /node_modules/foo/index.js === exports.default = { bar() { return 0; } } diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff index f96b0963c2..b8241f1ff0 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff @@ -1,13 +1,6 @@ --- old.untypedModuleImport_allowJs.symbols +++ new.untypedModuleImport_allowJs.symbols -@@= skipped -4, +4 lines =@@ - >foo : Symbol(foo, Decl(a.ts, 0, 6)) - - foo.bar(); -->foo.bar : Symbol(bar, Decl(index.js, 0, 19)) - >foo : Symbol(foo, Decl(a.ts, 0, 6)) -->bar : Symbol(bar, Decl(index.js, 0, 19)) - +@@= skipped -11, +11 lines =@@ === /node_modules/foo/index.js === exports.default = { bar() { return 0; } } >exports.default : Symbol(default, Decl(index.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types index 08c1820b1b..9bd1d49ebf 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types @@ -2,20 +2,20 @@ === /a.ts === import foo from "foo"; ->foo : any +>foo : { bar: () => number; } foo.bar(); ->foo.bar() : any ->foo.bar : any ->foo : any ->bar : any +>foo.bar() : number +>foo.bar : () => number +>foo : { bar: () => number; } +>bar : () => number === /node_modules/foo/index.js === exports.default = { bar() { return 0; } } >exports.default = { bar() { return 0; } } : { bar: () => number; } ->exports.default : any +>exports.default : { bar: () => number; } >exports : typeof import("/node_modules/foo/index") ->default : any +>default : { bar: () => number; } >{ bar() { return 0; } } : { bar: () => number; } >bar : () => number >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff index d240f4c443..259c3a126d 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff @@ -8,12 +8,11 @@ ->module.exports : (foo: Foo) => string ->module : { exports: (foo: Foo) => string; } ->exports : (foo: Foo) => string -->(void 0) : FooFun -+>module.exports = /** @type {FooFun} */(void 0) : (foo: typeof Foo) => string -+>module.exports : (foo: typeof Foo) => string -+>module : { export=: (foo: typeof Foo) => string; } -+>exports : (foo: typeof Foo) => string -+>(void 0) : (foo: typeof Foo) => string -+>void 0 : (foo: typeof Foo) => string ++>module.exports = /** @type {FooFun} */(void 0) : FooFun ++>module.exports : FooFun ++>module : { export=: FooFun; } ++>exports : FooFun + >(void 0) : FooFun ++>void 0 : FooFun >void 0 : undefined >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/commonjsAccessExports.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/commonjsAccessExports.types.diff index ba2513baff..b1de7c4548 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/commonjsAccessExports.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/commonjsAccessExports.types.diff @@ -7,11 +7,11 @@ ->exports.Cls = function() { this.x = 0; } : typeof Cls ->exports.Cls : typeof Cls +>exports.Cls = function() { this.x = 0; } : () => void -+>exports.Cls : any ++>exports.Cls : () => void >exports : typeof import("/a") ->Cls : typeof Cls ->function() { this.x = 0; } : typeof Cls -+>Cls : any ++>Cls : () => void +>function() { this.x = 0; } : () => void this.x = 0; @@ -30,7 +30,7 @@ ->exports.Cls : typeof Cls +>instance : any +>new exports.Cls() : any -+>exports.Cls : any ++>exports.Cls : () => void >exports : typeof import("/a") ->Cls : typeof Cls -+>Cls : any ++>Cls : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.types.diff index dae231da9a..2bb9e8b929 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.types.diff @@ -1,22 +1,6 @@ --- old.contextuallyTypedParametersOptionalInJSDoc.types +++ new.contextuallyTypedParametersOptionalInJSDoc.types -@@= skipped -14, +14 lines =@@ - - /** @type {Fn} */ - const fn1 = -->fn1 : Fn -+>fn1 : (a: string, b: number) => void - - /** - * @param [b] -@@= skipped -31, +31 lines =@@ - - /** @type {Fn} */ - const fn2 = -->fn2 : Fn -+>fn2 : (a: string, b: number) => void - - /** +@@= skipped -51, +51 lines =@@ * @param {number} [b] */ function self(a, b) { @@ -27,7 +11,7 @@ >a : string >b : number | undefined -@@= skipped -18, +18 lines =@@ +@@= skipped -12, +12 lines =@@ self(""); >self("") : void diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff index da567cd68b..6569dcf3a6 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff @@ -2,18 +2,15 @@ +++ new.expandoFunctionContextualTypesJs.errors.txt @@= skipped -0, +0 lines =@@ - -+input.js(5,48): error TS2304: Cannot find name 'P'. +input.js(48,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== input.js (2 errors) ==== ++==== input.js (1 errors) ==== + /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ + + /** + * @template P + * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ -+ ~ -+!!! error TS2304: Cannot find name 'P'. + + /** + * @type {StatelessComponent} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.types.diff index d6141c8f58..fae3ba6875 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.types.diff @@ -1,74 +1,29 @@ --- old.expandoFunctionContextualTypesJs.types +++ new.expandoFunctionContextualTypesJs.types -@@= skipped -10, +10 lines =@@ - * @type {StatelessComponent} +@@= skipped -11, +11 lines =@@ */ const MyComponent = () => /* @type {any} */(null); -->MyComponent : StatelessComponent + >MyComponent : StatelessComponent ->() => /* @type {any} */(null) : { (): any; defaultProps: Partial; } -+>MyComponent : { (): any; defaultProps?: P; } -+>() => /* @type {any} */(null) : { (): any; defaultProps: { color: string; }; } ++>() => /* @type {any} */(null) : { (): any; defaultProps: { color: "red"; }; } >(null) : null MyComponent.defaultProps = { -->MyComponent.defaultProps = { color: "red"} : { color: "red"; } -->MyComponent.defaultProps : Partial -->MyComponent : StatelessComponent -->defaultProps : Partial -->{ color: "red"} : { color: "red"; } -+>MyComponent.defaultProps = { color: "red"} : { color: string; } -+>MyComponent.defaultProps : P -+>MyComponent : { (): any; defaultProps?: P; } -+>defaultProps : P -+>{ color: "red"} : { color: string; } - - color: "red" -->color : "red" -+>color : string - >"red" : "red" - - }; - - const MyComponent2 = () => null; -->MyComponent2 : { (): any; defaultProps: MyComponentProps; } -->() => null : { (): any; defaultProps: MyComponentProps; } -+>MyComponent2 : { (): any; defaultProps: { color: "blue" | "red"; }; } -+>() => null : { (): any; defaultProps: { color: "blue" | "red"; }; } - - /** +@@= skipped -24, +24 lines =@@ * @type {MyComponentProps} */ MyComponent2.defaultProps = { ->MyComponent2.defaultProps = { color: "red"} : { color: "red"; } -->MyComponent2.defaultProps : MyComponentProps -->MyComponent2 : { (): any; defaultProps: MyComponentProps; } -->defaultProps : MyComponentProps -+>MyComponent2.defaultProps = { color: "red"} : { color: "blue" | "red"; } -+>MyComponent2.defaultProps : { color: "blue" | "red"; } -+>MyComponent2 : { (): any; defaultProps: { color: "blue" | "red"; }; } -+>defaultProps : { color: "blue" | "red"; } -+>{ color: "red"} : { color: "blue" | "red"; } ++>MyComponent2.defaultProps = { color: "red"} : MyComponentProps + >MyComponent2.defaultProps : MyComponentProps + >MyComponent2 : { (): any; defaultProps: MyComponentProps; } + >defaultProps : MyComponentProps ++>{ color: "red"} : MyComponentProps >{ color: "red"} : { color: "red"; } color: "red" -@@= skipped -40, +41 lines =@@ - * @type {StatelessComponent} - */ - const check = MyComponent2; -->check : StatelessComponent -->MyComponent2 : { (): any; defaultProps: MyComponentProps; } -+>check : { (): any; defaultProps?: P; } -+>MyComponent2 : { (): any; defaultProps: { color: "blue" | "red"; }; } - - /** - * - * @param {{ props: MyComponentProps }} p - */ - function expectLiteral(p) {} -->expectLiteral : (p: { props: MyComponentProps; }) => void -->p : { props: MyComponentProps; } -+>expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void -+>p : { props: { color: "blue" | "red"; }; } +@@= skipped -27, +28 lines =@@ + >p : { props: MyComponentProps; } function foo() { ->foo : typeof foo @@ -82,52 +37,38 @@ ->this.props : MyComponentProps ->this : this ->props : MyComponentProps -+>this.props = { color: "red" } : { color: "blue" | "red"; } ++>this.props = { color: "red" } : MyComponentProps +>this.props : any +>this : any +>props : any -+>{ color: "red" } : { color: "blue" | "red"; } ++>{ color: "red" } : MyComponentProps >{ color: "red" } : { color: "red"; } >color : "red" >"red" : "red" - +@@= skipped -17, +18 lines =@@ expectLiteral(this); >expectLiteral(this) : void -->expectLiteral : (p: { props: MyComponentProps; }) => void + >expectLiteral : (p: { props: MyComponentProps; }) => void ->this : this -+>expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void +>this : any } /** - * @type {MyComponentProps} - */ +@@= skipped -9, +9 lines =@@ module.exports = { -->module.exports = { color: "red"} : MyComponentProps -->module.exports : MyComponentProps + >module.exports = { color: "red"} : MyComponentProps + >module.exports : MyComponentProps ->module : { exports: MyComponentProps; } -->exports : MyComponentProps -+>module.exports = { color: "red"} : { color: "blue" | "red"; } -+>module.exports : { color: "blue" | "red"; } -+>module : { export=: { color: "blue" | "red"; }; } -+>exports : { color: "blue" | "red"; } -+>{ color: "red"} : { color: "blue" | "red"; } ++>module : { export=: MyComponentProps; } + >exports : MyComponentProps ++>{ color: "red"} : MyComponentProps >{ color: "red"} : { color: "red"; } color: "red" -@@= skipped -49, +51 lines =@@ - - expectLiteral({ props: module.exports }); - >expectLiteral({ props: module.exports }) : void -->expectLiteral : (p: { props: MyComponentProps; }) => void -->{ props: module.exports } : { props: MyComponentProps; } -->props : MyComponentProps -->module.exports : MyComponentProps +@@= skipped -15, +16 lines =@@ + >{ props: module.exports } : { props: MyComponentProps; } + >props : MyComponentProps + >module.exports : MyComponentProps ->module : { exports: MyComponentProps; } -->exports : MyComponentProps -+>expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void -+>{ props: module.exports } : { props: { color: "blue" | "red"; }; } -+>props : { color: "blue" | "red"; } -+>module.exports : { color: "blue" | "red"; } -+>module : { export=: { color: "blue" | "red"; }; } -+>exports : { color: "blue" | "red"; } ++>module : { export=: MyComponentProps; } + >exports : MyComponentProps diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc1.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc1.types.diff index 35601938ba..2a10d2b479 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc1.types.diff @@ -1,22 +1,20 @@ --- old.exportDefaultWithJSDoc1.types +++ new.exportDefaultWithJSDoc1.types -@@= skipped -6, +6 lines =@@ - */ +@@= skipped -7, +7 lines =@@ /** @type {NumberLike[]} */export default ([ ]); -->([ ]) : NumberLike[] -+>([ ]) : (string | number)[] + >([ ]) : NumberLike[] +>([ ]) : undefined[] >[ ] : undefined[] === b.ts === import A from './a' ->A : import("a").NumberLike[] -+>A : (string | number)[] ++>A : NumberLike[] A[0] ->A[0] : import("a").NumberLike ->A : import("a").NumberLike[] -+>A[0] : string | number -+>A : (string | number)[] ++>A[0] : NumberLike ++>A : NumberLike[] >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff index e6dae4d90f..7604be6b2a 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff @@ -1,22 +1,20 @@ --- old.exportDefaultWithJSDoc2.types +++ new.exportDefaultWithJSDoc2.types -@@= skipped -6, +6 lines =@@ - */ +@@= skipped -7, +7 lines =@@ export default /** @type {NumberLike[]} */([ ]); -->([ ]) : NumberLike[] -+>([ ]) : (string | number)[] -+>[ ] : (string | number)[] + >([ ]) : NumberLike[] ++>[ ] : NumberLike[] >[ ] : undefined[] === b.ts === import A from './a' ->A : import("a").NumberLike[] -+>A : (string | number)[] ++>A : NumberLike[] A[0] ->A[0] : import("a").NumberLike ->A : import("a").NumberLike[] -+>A[0] : string | number -+>A : (string | number)[] ++>A[0] : NumberLike ++>A : NumberLike[] >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/functionExpressionNames.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/functionExpressionNames.types.diff index 059d26951f..7bc18246b7 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/functionExpressionNames.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/functionExpressionNames.types.diff @@ -7,11 +7,11 @@ ->exports.E = function() { this.e = 'exported'} : typeof E ->exports.E : typeof E +>exports.E = function() { this.e = 'exported'} : () => void -+>exports.E : any ++>exports.E : () => void >exports : typeof import("b") ->E : typeof E ->function() { this.e = 'exported'} : typeof E -+>E : any ++>E : () => void +>function() { this.e = 'exported'} : () => void this.e = 'exported' @@ -28,10 +28,10 @@ ->exports.E : typeof E +>e : any +>new exports.E() : any -+>exports.E : any ++>exports.E : () => void >exports : typeof import("b") ->E : typeof E -+>E : any ++>E : () => void var o = { ->o : { C: typeof C; } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff index 72cf35b686..2122f5ce56 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff @@ -4,120 +4,39 @@ index.js(2,19): error TS2315: Type 'Boolean' is not generic. -index2.js(2,19): error TS2315: Type 'Void' is not generic. -index3.js(2,19): error TS2315: Type 'Undefined' is not generic. -+index.js(2,27): error TS2304: Cannot find name 'T'. +index2.js(2,19): error TS2304: Cannot find name 'Void'. -+index2.js(2,24): error TS2304: Cannot find name 'T'. +index3.js(2,19): error TS2304: Cannot find name 'Undefined'. -+index3.js(2,29): error TS2304: Cannot find name 'T'. index4.js(2,19): error TS2315: Type 'Function' is not generic. -+index4.js(2,28): error TS2304: Cannot find name 'T'. index5.js(2,19): error TS2315: Type 'String' is not generic. -+index5.js(2,26): error TS2304: Cannot find name 'T'. index6.js(2,19): error TS2315: Type 'Number' is not generic. -+index6.js(2,26): error TS2304: Cannot find name 'T'. index7.js(2,19): error TS2315: Type 'Object' is not generic. -+index7.js(2,26): error TS2304: Cannot find name 'T'. +index8.js(4,12): error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? index8.js(4,15): error TS2304: Cannot find name 'T'. --==== index.js (1 errors) ==== -+==== index.js (2 errors) ==== - /** - * @param {(m: Boolean) => string} somebody - ~~~~~~~~~~ - !!! error TS2315: Type 'Boolean' is not generic. -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - function sayHello(somebody) { - return 'Hello ' + somebody; - } - --==== index2.js (1 errors) ==== -+==== index2.js (2 errors) ==== +@@= skipped -20, +21 lines =@@ + ==== index2.js (1 errors) ==== /** * @param {(m: Void) => string} somebody - ~~~~~~~ -!!! error TS2315: Type 'Void' is not generic. + ~~~~ +!!! error TS2304: Cannot find name 'Void'. -+ ~ -+!!! error TS2304: Cannot find name 'T'. */ function sayHello2(somebody) { return 'Hello ' + somebody; - } - - --==== index3.js (1 errors) ==== -+==== index3.js (2 errors) ==== +@@= skipped -11, +11 lines =@@ + ==== index3.js (1 errors) ==== /** * @param {(m: Undefined) => string} somebody - ~~~~~~~~~~~~ -!!! error TS2315: Type 'Undefined' is not generic. + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'Undefined'. -+ ~ -+!!! error TS2304: Cannot find name 'T'. */ function sayHello3(somebody) { return 'Hello ' + somebody; - } - - --==== index4.js (1 errors) ==== -+==== index4.js (2 errors) ==== - /** - * @param {(m: Function) => string} somebody - ~~~~~~~~~~~ - !!! error TS2315: Type 'Function' is not generic. -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - function sayHello4(somebody) { - return 'Hello ' + somebody; - } - - --==== index5.js (1 errors) ==== -+==== index5.js (2 errors) ==== - /** - * @param {(m: String) => string} somebody - ~~~~~~~~~ - !!! error TS2315: Type 'String' is not generic. -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - function sayHello5(somebody) { - return 'Hello ' + somebody; - } - - --==== index6.js (1 errors) ==== -+==== index6.js (2 errors) ==== - /** - * @param {(m: Number) => string} somebody - ~~~~~~~~~ - !!! error TS2315: Type 'Number' is not generic. -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - function sayHello6(somebody) { - return 'Hello ' + somebody; - } - - --==== index7.js (1 errors) ==== -+==== index7.js (2 errors) ==== - /** - * @param {(m: Object) => string} somebody - ~~~~~~~~~ - !!! error TS2315: Type 'Object' is not generic. -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - function sayHello7(somebody) { +@@= skipped -51, +51 lines =@@ return 'Hello ' + somebody; } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.errors.txt.diff index 08ec916107..0c494dddc4 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.errors.txt.diff @@ -4,17 +4,12 @@ -a.js(7,7): error TS2375: Type '{ value: undefined; }' is not assignable to type 'A' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. - Types of property 'value' are incompatible. - Type 'undefined' is not assignable to type 'number'. --a.js(14,7): error TS2375: Type '{ value: undefined; }' is not assignable to type 'B' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. -- Types of property 'value' are incompatible. -- Type 'undefined' is not assignable to type 'number'. -- -- + a.js(14,7): error TS2375: Type '{ value: undefined; }' is not assignable to type 'B' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. + Types of property 'value' are incompatible. + Type 'undefined' is not assignable to type 'number'. + + -==== a.js (2 errors) ==== -+a.js(14,7): error TS2375: Type '{ value: undefined; }' is not assignable to type '{ value?: number; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. -+ Types of property 'value' are incompatible. -+ Type 'undefined' is not assignable to type 'number'. -+ -+ +==== a.js (1 errors) ==== /** * @typedef {object} A @@ -29,13 +24,4 @@ -!!! error TS2375: Type 'undefined' is not assignable to type 'number'. /** - * @typedef {{ value?: number }} B -@@= skipped -12, +8 lines =@@ - /** @type {B} */ - const b = { value: undefined }; // error - ~ --!!! error TS2375: Type '{ value: undefined; }' is not assignable to type 'B' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. -+!!! error TS2375: Type '{ value: undefined; }' is not assignable to type '{ value?: number; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. - !!! error TS2375: Types of property 'value' are incompatible. - !!! error TS2375: Type 'undefined' is not assignable to type 'number'. - \ No newline at end of file + * @typedef {{ value?: number }} B \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.types.diff deleted file mode 100644 index 52a087eaf4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.strictOptionalProperties3.types -+++ new.strictOptionalProperties3.types -@@= skipped -18, +18 lines =@@ - - /** @type {B} */ - const b = { value: undefined }; // error -->b : B -+>b : { value?: number; } - >{ value: undefined } : { value: undefined; } - >value : undefined - >undefined : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt.diff index 1b23f849fb..c9d3ac59df 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt.diff @@ -5,26 +5,20 @@ - - -==== file1.js (0 errors) ==== -+file1.js(3,21): error TS2304: Cannot find name 'T'. -+ -+ -+==== file1.js (1 errors) ==== - /** - * @template {string} T - * @typedef {{ foo: T }} Foo -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - - export default {}; - +- /** +- * @template {string} T +- * @typedef {{ foo: T }} Foo +- */ +- +- export default {}; +- -==== file2.js (1 errors) ==== -+==== file2.js (0 errors) ==== - /** - * @template T - * @typedef {import('./file1').Foo} Bar +- /** +- * @template T +- * @typedef {import('./file1').Foo} Bar - ~ -!!! error TS2344: Type 'T' does not satisfy the constraint 'string'. -!!! related TS2208 file2.js:2:14: This type parameter might need an `extends string` constraint. - */ - \ No newline at end of file +- */ +- ++ \ 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..aaa7bc28ab 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff @@ -1,42 +1,10 @@ --- old.assertionTypePredicates2.types +++ new.assertionTypePredicates2.types -@@= skipped -13, +13 lines =@@ - * @returns { asserts a is B } - */ - const foo = (a) => { -->foo : (a: A) => asserts a is B -->(a) => { if (/** @type { B } */ (a).y !== 0) throw TypeError(); return undefined;} : (a: A) => asserts a is B -->a : A -+>foo : (a: { x: number; }) => asserts a is { x: number; } & { y: number; } -+>(a) => { if (/** @type { B } */ (a).y !== 0) throw TypeError(); return undefined;} : (a: { x: number; }) => asserts a is { x: number; } & { y: number; } -+>a : { x: number; } - - if (/** @type { B } */ (a).y !== 0) throw TypeError(); +@@= skipped -21, +21 lines =@@ >(a).y !== 0 : boolean >(a).y : number -->(a) : B -->a : A -+>(a) : { x: number; } & { y: number; } -+>a : { x: number; } & { y: number; } -+>a : { x: number; } + >(a) : B ++>a : B + >a : A >y : number - >0 : 0 - >TypeError() : TypeError -@@= skipped -25, +26 lines =@@ - - /** @type { A } */ - const a = { x: 1 }; -->a : A -+>a : { x: number; } - >{ x: 1 } : { x: number; } - >x : number - >1 : 1 - - foo(a); - >foo(a) : void -->foo : (a: A) => asserts a is B -->a : A -+>foo : (a: { x: number; }) => asserts a is { x: number; } & { y: number; } -+>a : { x: number; } - - }; + >0 : 0 \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.types.diff index 9499e17903..b4d7a603e3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.types.diff @@ -1,17 +1,15 @@ --- old.assertionsAndNonReturningFunctions.types +++ new.assertionsAndNonReturningFunctions.types -@@= skipped -4, +4 lines =@@ - +@@= skipped -5, +5 lines =@@ /** @type {AssertFunc} */ const assert = check => { -->assert : AssertFunc + >assert : AssertFunc ->check => { if (!check) throw new Error();} : (check: boolean) => asserts check -+>assert : (check: boolean) => asserts check +>check => { if (!check) throw new Error();} : (check: boolean) => void >check : boolean if (!check) throw new Error(); -@@= skipped -13, +13 lines =@@ +@@= skipped -12, +12 lines =@@ /** @type {(x: unknown) => asserts x is string } */ function assertIsString(x) { @@ -30,16 +28,7 @@ >"string" : "string" >new Error() : Error >Error : ErrorConstructor -@@= skipped -54, +54 lines =@@ - - assert(typeof x === "string"); - >assert(typeof x === "string") : void -->assert : AssertFunc -+>assert : (check: boolean) => asserts check - >typeof x === "string" : boolean - >typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" - >x : any -@@= skipped -36, +36 lines =@@ +@@= skipped -90, +90 lines =@@ assertIsString(x); >assertIsString(x) : void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.errors.txt.diff deleted file mode 100644 index 1bf5bf0abb..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.checkJsdocTypeTag4.errors.txt -+++ new.checkJsdocTypeTag4.errors.txt -@@= skipped -0, +0 lines =@@ -+test.js(3,19): error TS2304: Cannot find name 'U'. - test.js(5,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. - test.js(7,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. - -@@= skipped -4, +5 lines =@@ - ==== t.d.ts (0 errors) ==== - type A = { a: T } - --==== test.js (2 errors) ==== -+==== test.js (3 errors) ==== - /** Also should error for jsdoc typedefs - * @template {string} U - * @typedef {{ b: U }} B -+ ~ -+!!! error TS2304: Cannot find name 'U'. - */ - /** @type {A} */ - ~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.types.diff deleted file mode 100644 index 255f9cb7cd..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.types.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.checkJsdocTypeTag4.types -+++ new.checkJsdocTypeTag4.types -@@= skipped -15, +15 lines =@@ - - /** @type {B} */ - var b; -->b : B -+>b : { b: U; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.errors.txt.diff index bda64bb516..c340e3543c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.errors.txt.diff @@ -57,7 +57,7 @@ + status: 'done', + ~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type '"done"'. -+!!! related TS6500 test.js:2:5: The expected type comes from property 'status' which is declared here on type '{ status: "done"; m: (n: number) => void; }' ++!!! related TS6500 test.js:2:5: The expected type comes from property 'status' which is declared here on type 'DoneStatus' + m(n) { } + ~ +!!! error TS7006: Parameter 'n' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.types.diff index 077ee512d4..a8d488a854 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.types.diff @@ -15,11 +15,11 @@ ->ns : typeof ns ->x : DoneStatus ->{ status: 'done', m(n) { }} : { status: "done"; m(n: number): void; } -+>ns.x = { status: 'done', m(n) { }} : { status: "done"; m: (n: number) => void; } ++>ns.x = { status: 'done', m(n) { }} : DoneStatus +>ns.x : any +>ns : {} +>x : any -+>{ status: 'done', m(n) { }} : { status: "done"; m: (n: number) => void; } ++>{ status: 'done', m(n) { }} : DoneStatus +>{ status: 'done', m(n) { }} : { status: "done"; m: (n: number) => void; } status: 'done', @@ -65,14 +65,12 @@ /** @type {DoneStatus} */ this.s = { ->this.s = { status: 'done', m(n) { } } : { status: "done"; m(n: number): void; } -->this.s : DoneStatus -+>this.s = { status: 'done', m(n) { } } : { status: "done"; m: (n: number) => void; } -+>this.s : { status: "done"; m: (n: number) => void; } ++>this.s = { status: 'done', m(n) { } } : DoneStatus + >this.s : DoneStatus >this : this -->s : DoneStatus + >s : DoneStatus ->{ status: 'done', m(n) { } } : { status: "done"; m(n: number): void; } -+>s : { status: "done"; m: (n: number) => void; } -+>{ status: 'done', m(n) { } } : { status: "done"; m: (n: number) => void; } ++>{ status: 'done', m(n) { } } : DoneStatus +>{ status: 'done', m(n) { } } : { status: "done"; m: (n: number) => void; } status: 'done', @@ -82,13 +80,11 @@ this.s = { ->this.s = { status: 'done', m(n) { } } : { status: "done"; m(n: number): void; } -->this.s : DoneStatus +>this.s = { status: 'done', m(n) { } } : { status: string; m: (n: any) => void; } -+>this.s : { status: "done"; m: (n: number) => void; } + >this.s : DoneStatus >this : this -->s : DoneStatus + >s : DoneStatus ->{ status: 'done', m(n) { } } : { status: "done"; m(n: number): void; } -+>s : { status: "done"; m: (n: number) => void; } +>{ status: 'done', m(n) { } } : { status: string; m: (n: any) => void; } status: 'done', @@ -109,62 +105,47 @@ /** @type {DoneStatus} */ exports.x = { ->exports.x = { status: "done", m(n) { }} : { status: "done"; m(n: number): void; } -->exports.x : DoneStatus -+>exports.x = { status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } -+>exports.x : { status: "done"; m: (n: number) => void; } ++>exports.x = { status: "done", m(n) { }} : DoneStatus + >exports.x : DoneStatus >exports : typeof import("test") -->x : DoneStatus + >x : DoneStatus ->{ status: "done", m(n) { }} : { status: "done"; m(n: number): void; } -+>x : { status: "done"; m: (n: number) => void; } -+>{ status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } ++>{ status: "done", m(n) { }} : DoneStatus +>{ status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } status: "done", >status : "done" -@@= skipped -15, +16 lines =@@ - >n : number - } - exports.x -->exports.x : DoneStatus -+>exports.x : { status: "done"; m: (n: number) => void; } - >exports : typeof import("test") -->x : DoneStatus -+>x : { status: "done"; m: (n: number) => void; } +@@= skipped -21, +22 lines =@@ /** @type {DoneStatus} */ module.exports.y = { ->module.exports.y = { status: "done", m(n) { }} : { status: "done"; m(n: number): void; } -->module.exports.y : DoneStatus ++>module.exports.y = { status: "done", m(n) { }} : DoneStatus + >module.exports.y : DoneStatus ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->y : DoneStatus -->{ status: "done", m(n) { }} : { status: "done"; m(n: number): void; } -+>module.exports.y = { status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } -+>module.exports.y : { status: "done"; m: (n: number) => void; } +>module.exports : typeof import("test") +>module : { "test": typeof import("test"); } +>exports : typeof import("test") -+>y : { status: "done"; m: (n: number) => void; } -+>{ status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } + >y : DoneStatus +->{ status: "done", m(n) { }} : { status: "done"; m(n: number): void; } ++>{ status: "done", m(n) { }} : DoneStatus +>{ status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } status: "done", >status : "done" -@@= skipped -23, +24 lines =@@ - >n : number +@@= skipped -18, +19 lines =@@ } module.exports.y -->module.exports.y : DoneStatus + >module.exports.y : DoneStatus ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->y : DoneStatus -+>module.exports.y : { status: "done"; m: (n: number) => void; } +>module.exports : typeof import("test") +>module : { "test": typeof import("test"); } +>exports : typeof import("test") -+>y : { status: "done"; m: (n: number) => void; } + >y : DoneStatus // prototype-property assignment /** @type {DoneStatus} */ @@ -204,25 +185,23 @@ // prototype assignment function F() { ->F : typeof F -+>F : { (): void; prototype: { status: "done"; m: (n: number) => void; }; } ++>F : { (): void; prototype: DoneStatus; } } /** @type {DoneStatus} */ F.prototype = { ->F.prototype = { status: "done", m(n) { }} : { status: "done"; m(n: number): void; } -->F.prototype : DoneStatus ++>F.prototype = { status: "done", m(n) { }} : DoneStatus + >F.prototype : DoneStatus ->F : typeof F -->prototype : DoneStatus ++>F : { (): void; prototype: DoneStatus; } + >prototype : DoneStatus ->{ status: "done", m(n) { }} : { status: "done"; m(n: number): void; } -+>F.prototype = { status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } -+>F.prototype : { status: "done"; m: (n: number) => void; } -+>F : { (): void; prototype: { status: "done"; m: (n: number) => void; }; } -+>prototype : { status: "done"; m: (n: number) => void; } -+>{ status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } ++>{ status: "done", m(n) { }} : DoneStatus +>{ status: "done", m(n) { }} : { status: "done"; m: (n: number) => void; } status: "done", >status : "done" -@@= skipped -57, +58 lines =@@ +@@= skipped -56, +57 lines =@@ // module.exports assignment /** @type {{ status: 'done', m(n: number): void }} */ module.exports = { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagOnExports.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagOnExports.types.diff index ceeb15490d..00d93f6d0e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagOnExports.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagOnExports.types.diff @@ -5,10 +5,10 @@ exports.a = {}; >exports.a = {} : {} ->exports.a : typeof a -+>exports.a : any ++>exports.a : {} >exports : typeof import("enumTagOnExports") ->a : typeof a -+>a : any ++>a : {} >{} : {} /** @enum {string} */ @@ -19,9 +19,9 @@ ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->b : typeof b -+>module.exports.b : any ++>module.exports.b : {} +>module.exports : typeof import("enumTagOnExports") +>module : { "enumTagOnExports": typeof import("enumTagOnExports"); } +>exports : typeof import("enumTagOnExports") -+>b : any ++>b : {} >{} : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces.errors.txt.diff index c159897641..a86c615df7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces.errors.txt.diff @@ -2,13 +2,17 @@ +++ new.exportNestedNamespaces.errors.txt @@= skipped -0, +0 lines =@@ - ++mod.js(2,11): error TS2339: Property 'K' does not exist on type '{}'. ++use.js(3,17): error TS2339: Property 'K' does not exist on type '{}'. +use.js(8,15): error TS2694: Namespace '"mod"' has no exported member 'n'. +use.js(9,13): error TS2749: 's.Classic' refers to a value, but is being used as a type here. Did you mean 'typeof s.Classic'? + + -+==== mod.js (0 errors) ==== ++==== mod.js (1 errors) ==== + exports.n = {}; + exports.n.K = function () { ++ ~ ++!!! error TS2339: Property 'K' does not exist on type '{}'. + this.x = 10; + } + exports.Classic = class { @@ -17,10 +21,12 @@ + } + } + -+==== use.js (2 errors) ==== ++==== use.js (3 errors) ==== + import * as s from './mod' + + var k = new s.n.K() ++ ~ ++!!! error TS2339: Property 'K' does not exist on type '{}'. + k.x + var classic = new s.Classic() + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces.types.diff index d556de6cc9..79e7c8a56a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces.types.diff @@ -7,10 +7,10 @@ ->exports.n = {} : typeof n ->exports.n : typeof n +>exports.n = {} : {} -+>exports.n : any ++>exports.n : {} >exports : typeof import("mod") ->n : typeof n -+>n : any ++>n : {} >{} : {} exports.n.K = function () { @@ -19,12 +19,12 @@ ->exports.n : typeof n +>exports.n.K = function () { this.x = 10;} : () => void +>exports.n.K : any -+>exports.n : any ++>exports.n : {} >exports : typeof import("mod") ->n : typeof n ->K : typeof K ->function () { this.x = 10;} : typeof K -+>n : any ++>n : {} +>K : any +>function () { this.x = 10;} : () => void @@ -36,7 +36,15 @@ >x : any >10 : 10 } -@@= skipped -32, +32 lines =@@ + exports.Classic = class { + >exports.Classic = class { constructor() { this.p = 1 }} : typeof Classic +->exports.Classic : typeof Classic ++>exports.Classic : typeof (Anonymous class) + >exports : typeof import("mod") +->Classic : typeof Classic ++>Classic : typeof (Anonymous class) + >class { constructor() { this.p = 1 }} : typeof Classic + constructor() { this.p = 1 >this.p = 1 : 1 @@ -65,9 +73,9 @@ +>k : any +>new s.n.K() : any +>s.n.K : any -+>s.n : any ++>s.n : {} +>s : typeof import("mod") -+>n : any ++>n : {} +>K : any k.x @@ -84,11 +92,11 @@ ->s.Classic : typeof s.Classic ->s : typeof s ->Classic : typeof s.Classic -+>classic : Classic -+>new s.Classic() : Classic -+>s.Classic : typeof Classic ++>classic : (Anonymous class) ++>new s.Classic() : (Anonymous class) ++>s.Classic : typeof (Anonymous class) +>s : typeof import("mod") -+>Classic : typeof Classic ++>Classic : typeof (Anonymous class) /** @param {s.n.K} c diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces2.errors.txt.diff index b4f6da3a73..9da350756f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces2.errors.txt.diff @@ -9,6 +9,8 @@ +second.js(1,1): error TS2304: Cannot find name 'exports'. +second.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +second.js(2,1): error TS2304: Cannot find name 'exports'. ++use.js(3,18): error TS2339: Property 'j' does not exist on type '{}'. ++use.js(4,28): error TS2339: Property 'o' does not exist on type '{}'. ==== mod.js (0 errors) ==== @@ -42,4 +44,15 @@ +!!! error TS2304: Cannot find name 'exports'. return v } + +-==== use.js (0 errors) ==== ++==== use.js (2 errors) ==== + import * as debug from './mod' + + debug.formatters.j ++ ~ ++!!! error TS2339: Property 'j' does not exist on type '{}'. + var one = debug.formatters.o(1) ++ ~ ++!!! error TS2339: Property 'o' does not exist on type '{}'. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces2.types.diff index cd7f16c5cd..5a193337a2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces2.types.diff @@ -1,15 +1,6 @@ --- old.exportNestedNamespaces2.types +++ new.exportNestedNamespaces2.types -@@= skipped -3, +3 lines =@@ - // Based on a pattern from adonis - exports.formatters = {} - >exports.formatters = {} : {} -->exports.formatters : {} -+>exports.formatters : any - >exports : typeof import("mod") -->formatters : {} -+>formatters : any - >{} : {} +@@= skipped -10, +10 lines =@@ === first.js === exports = require('./mod') @@ -22,7 +13,7 @@ >require : any >'./mod' : "./mod" -@@= skipped -17, +17 lines =@@ +@@= skipped -10, +10 lines =@@ >exports.formatters.j = function (v) { return v} : (v: any) => any >exports.formatters.j : any >exports.formatters : any @@ -62,23 +53,18 @@ debug.formatters.j >debug.formatters.j : any -->debug.formatters : {} + >debug.formatters : {} ->debug : typeof debug -->formatters : {} -+>debug.formatters : any +>debug : typeof import("mod") -+>formatters : any + >formatters : {} >j : any - var one = debug.formatters.o(1) - >one : any +@@= skipped -14, +14 lines =@@ >debug.formatters.o(1) : any >debug.formatters.o : any -->debug.formatters : {} + >debug.formatters : {} ->debug : typeof debug -->formatters : {} -+>debug.formatters : any +>debug : typeof import("mod") -+>formatters : any + >formatters : {} >o : any - >1 : 1 + >1 : 1 \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/exportPropertyAssignmentNameResolution.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/exportPropertyAssignmentNameResolution.types.diff index 01c31d5598..e92c76b009 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/exportPropertyAssignmentNameResolution.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/exportPropertyAssignmentNameResolution.types.diff @@ -1,20 +1,23 @@ --- old.exportPropertyAssignmentNameResolution.types +++ new.exportPropertyAssignmentNameResolution.types -@@= skipped -3, +3 lines =@@ +@@= skipped -2, +2 lines =@@ + === bug24492.js === module.exports.D = class { } >module.exports.D = class { } : typeof D - >module.exports.D : typeof D +->module.exports.D : typeof D ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports +->D : typeof D ++>module.exports.D : typeof (Anonymous class) +>module.exports : typeof import("bug24492") +>module : { "bug24492": typeof import("bug24492"); } +>exports : typeof import("bug24492") - >D : typeof D ++>D : typeof (Anonymous class) >class { } : typeof D new D() ->new D() : any ->D : any -+>new D() : D -+>D : typeof D ++>new D() : (Anonymous class) ++>D : typeof (Anonymous class) diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types.diff index a988531d4b..ffbe288fad 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types.diff @@ -10,9 +10,9 @@ ->exports : typeof import("index") ->class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import("index") +>module.exports = class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports -+>module.exports : typeof exports -+>module : { exports: typeof exports; } -+>exports : typeof exports ++>module.exports : typeof (Anonymous class) ++>module : { (Anonymous class): typeof (Anonymous class); } ++>exports : typeof (Anonymous class) +>class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt.diff index b6ab682031..2fed47c399 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +0 lines =@@ - +index.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+index.js(9,16): error TS2339: Property 'Sub' does not exist on type 'typeof exports'. ++index.js(9,16): error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'. + + +==== index.js (2 errors) ==== @@ -26,7 +26,7 @@ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.Sub = class { + ~~~ -+!!! error TS2339: Property 'Sub' does not exist on type 'typeof exports'. ++!!! error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'. + constructor() { + this.instance = new module.exports(10); + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff index 63decd7534..134981ab5b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff @@ -10,9 +10,9 @@ ->exports : typeof import("index") ->class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import("index") +>module.exports = class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports -+>module.exports : typeof exports -+>module : { exports: typeof exports; } -+>exports : typeof exports ++>module.exports : typeof (Anonymous class) ++>module : { (Anonymous class): typeof (Anonymous class); } ++>exports : typeof (Anonymous class) +>class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports /** @@ -39,9 +39,9 @@ ->exports : typeof import("index") ->Sub : typeof Sub +>module.exports.Sub : any -+>module.exports : typeof exports -+>module : { exports: typeof exports; } -+>exports : typeof exports ++>module.exports : typeof (Anonymous class) ++>module : { (Anonymous class): typeof (Anonymous class); } ++>exports : typeof (Anonymous class) +>Sub : any >class { constructor() { this.instance = new module.exports(10); }} : typeof Sub @@ -49,19 +49,19 @@ this.instance = new module.exports(10); ->this.instance = new module.exports(10) : import("index") ->this.instance : any -+>this.instance = new module.exports(10) : exports -+>this.instance : exports ++>this.instance = new module.exports(10) : (Anonymous class) ++>this.instance : (Anonymous class) >this : this ->instance : any ->new module.exports(10) : import("index") ->module.exports : typeof import("index") ->module : { exports: typeof import("index"); } ->exports : typeof import("index") -+>instance : exports -+>new module.exports(10) : exports -+>module.exports : typeof exports -+>module : { exports: typeof exports; } -+>exports : typeof exports ++>instance : (Anonymous class) ++>new module.exports(10) : (Anonymous class) ++>module.exports : typeof (Anonymous class) ++>module : { (Anonymous class): typeof (Anonymous class); } ++>exports : typeof (Anonymous class) >10 : 10 } } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunction.types.diff index eb98ff57eb..cf098a16aa 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunction.types.diff @@ -12,11 +12,11 @@ ->MyClass : typeof MyClass ->function() { this.x = 1} : typeof MyClass +>module.exports.MyClass = function() { this.x = 1} : () => void -+>module.exports.MyClass : any ++>module.exports.MyClass : () => void +>module.exports : typeof import("jsDeclarationsExportAssignedConstructorFunction") +>module : { "jsDeclarationsExportAssignedConstructorFunction": typeof import("jsDeclarationsExportAssignedConstructorFunction"); } +>exports : typeof import("jsDeclarationsExportAssignedConstructorFunction") -+>MyClass : any ++>MyClass : () => void +>function() { this.x = 1} : () => void this.x = 1 @@ -37,11 +37,11 @@ ->MyClass : typeof MyClass ->prototype : { a: () => void; } +>module.exports.MyClass.prototype : any -+>module.exports.MyClass : any ++>module.exports.MyClass : () => void +>module.exports : typeof import("jsDeclarationsExportAssignedConstructorFunction") +>module : { "jsDeclarationsExportAssignedConstructorFunction": typeof import("jsDeclarationsExportAssignedConstructorFunction"); } +>exports : typeof import("jsDeclarationsExportAssignedConstructorFunction") -+>MyClass : any ++>MyClass : () => void +>prototype : any >{ a: function() { }} : { a: () => void; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff index 7e33df980a..4d291444a9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff @@ -2,18 +2,25 @@ +++ new.jsDeclarationsFunctionsCjs.errors.txt @@= skipped -0, +0 lines =@@ - ++index.js(4,18): error TS2339: Property 'cat' does not exist on type '() => void'. ++index.js(7,18): error TS2339: Property 'Cls' does not exist on type '() => void'. ++index.js(31,18): error TS2339: Property 'self' does not exist on type '(a: any) => any'. +index.js(35,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(45,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== index.js (2 errors) ==== ++==== index.js (5 errors) ==== + module.exports.a = function a() {} + + module.exports.b = function b() {} + module.exports.b.cat = "cat"; ++ ~~~ ++!!! error TS2339: Property 'cat' does not exist on type '() => void'. + + module.exports.c = function c() {} + module.exports.c.Cls = class {} ++ ~~~ ++!!! error TS2339: Property 'Cls' does not exist on type '() => void'. + + /** + * @param {number} a @@ -38,6 +45,8 @@ + return a; + } + module.exports.f.self = module.exports.f; ++ ~~~~ ++!!! error TS2339: Property 'self' does not exist on type '(a: any) => any'. + + /** + * @param {{x: string}} a diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.types.diff index e5917e526f..9b4567969a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.types.diff @@ -1,19 +1,16 @@ --- old.jsDeclarationsFunctionsCjs.types +++ new.jsDeclarationsFunctionsCjs.types -@@= skipped -2, +2 lines =@@ - === index.js === +@@= skipped -3, +3 lines =@@ module.exports.a = function a() {} >module.exports.a = function a() {} : () => void -->module.exports.a : () => void + >module.exports.a : () => void ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->a : () => void -+>module.exports.a : any +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>a : any + >a : () => void >function a() {} : () => void >a : () => void @@ -27,11 +24,11 @@ ->function b() {} : { (): void; cat: string; } ->b : { (): void; cat: string; } +>module.exports.b = function b() {} : () => void -+>module.exports.b : any ++>module.exports.b : () => void +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>b : any ++>b : () => void +>function b() {} : () => void +>b : () => void @@ -45,11 +42,11 @@ ->b : { (): void; cat: string; } ->cat : string +>module.exports.b.cat : any -+>module.exports.b : any ++>module.exports.b : () => void +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>b : any ++>b : () => void +>cat : any >"cat" : "cat" @@ -63,11 +60,11 @@ ->function c() {} : { (): void; Cls: typeof Cls; } ->c : { (): void; Cls: typeof Cls; } +>module.exports.c = function c() {} : () => void -+>module.exports.c : any ++>module.exports.c : () => void +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>c : any ++>c : () => void +>function c() {} : () => void +>c : () => void @@ -81,16 +78,16 @@ ->c : { (): void; Cls: typeof Cls; } ->Cls : typeof Cls +>module.exports.c.Cls : any -+>module.exports.c : any ++>module.exports.c : () => void +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>c : any ++>c : () => void +>Cls : any >class {} : typeof Cls /** -@@= skipped -56, +56 lines =@@ +@@= skipped -55, +55 lines =@@ * @return {string} */ module.exports.d = function d(a, b) { return /** @type {*} */(null); } @@ -105,11 +102,11 @@ ->a : number ->b : number +>module.exports.d = function d(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any -+>module.exports.d : any ++>module.exports.d : (a: any, b: any) => any +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>d : any ++>d : (a: any, b: any) => any +>function d(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any +>d : (a: any, b: any) => any +>a : any @@ -134,11 +131,11 @@ ->a : T ->b : U +>module.exports.e = function e(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any -+>module.exports.e : any ++>module.exports.e : (a: any, b: any) => any +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>e : any ++>e : (a: any, b: any) => any +>function e(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any +>e : (a: any, b: any) => any +>a : any @@ -161,11 +158,11 @@ ->f : { (a: T): T; self: any; } ->a : T +>module.exports.f = function f(a) { return a;} : (a: any) => any -+>module.exports.f : any ++>module.exports.f : (a: any) => any +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>f : any ++>f : (a: any) => any +>function f(a) { return a;} : (a: any) => any +>f : (a: any) => any +>a : any @@ -188,19 +185,19 @@ ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->f : { (a: T): T; self: any; } -+>module.exports.f.self = module.exports.f : any ++>module.exports.f.self = module.exports.f : (a: any) => any +>module.exports.f.self : any -+>module.exports.f : any ++>module.exports.f : (a: any) => any +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>f : any ++>f : (a: any) => any +>self : any -+>module.exports.f : any ++>module.exports.f : (a: any) => any +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>f : any ++>f : (a: any) => any /** * @param {{x: string}} a @@ -290,79 +287,65 @@ module.exports.i = function i() {} >module.exports.i = function i() {} : () => void -->module.exports.i : () => void + >module.exports.i : () => void ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->i : () => void -+>module.exports.i : any +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>i : any + >i : () => void >function i() {} : () => void >i : () => void - +@@= skipped -116, +117 lines =@@ module.exports.ii = module.exports.i; -->module.exports.ii = module.exports.i : () => void -->module.exports.ii : () => void + >module.exports.ii = module.exports.i : () => void + >module.exports.ii : () => void ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->ii : () => void -->module.exports.i : () => void -->module.exports : typeof module.exports -->module : { exports: typeof module.exports; } -->exports : typeof module.exports -->i : () => void -+>module.exports.ii = module.exports.i : any -+>module.exports.ii : any +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>ii : any -+>module.exports.i : any + >ii : () => void + >module.exports.i : () => void +->module.exports : typeof module.exports +->module : { exports: typeof module.exports; } +->exports : typeof module.exports +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>i : any + >i : () => void // note that this last one doesn't make much sense in cjs, since exports aren't hoisted bindings module.exports.jj = module.exports.j; -->module.exports.jj = module.exports.j : () => void -->module.exports.jj : () => void + >module.exports.jj = module.exports.j : () => void + >module.exports.jj : () => void ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->jj : () => void -->module.exports.j : () => void -->module.exports : typeof module.exports -->module : { exports: typeof module.exports; } -->exports : typeof module.exports -->j : () => void -+>module.exports.jj = module.exports.j : any -+>module.exports.jj : any +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>jj : any -+>module.exports.j : any + >jj : () => void + >module.exports.j : () => void +->module.exports : typeof module.exports +->module : { exports: typeof module.exports; } +->exports : typeof module.exports +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>j : any + >j : () => void module.exports.j = function j() {} >module.exports.j = function j() {} : () => void -->module.exports.j : () => void + >module.exports.j : () => void ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->j : () => void -+>module.exports.j : any +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>j : any - >function j() {} : () => void >j : () => void + >function j() {} : () => void + >j : () => void \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff index a6e0c911c7..a125a5acce 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff @@ -1,29 +1,24 @@ --- old.jsDeclarationsImportTypeBundled.types +++ new.jsDeclarationsImportTypeBundled.types -@@= skipped -7, +7 lines =@@ - * @type {Item}; - */ - const x = {x: 12}; -->x : Item -+>x : { x: number; } - >{x: 12} : { x: number; } - >x : number +@@= skipped -13, +13 lines =@@ >12 : 12 -@@= skipped -8, +8 lines =@@ + module.exports = x; - >module.exports = x : { x: number; } - >module.exports : { x: number; } +->module.exports = x : { x: number; } +->module.exports : { x: number; } ->module : { exports: { x: number; }; } -+>module : { readonly x: { x: number; }; } - >exports : { x: number; } -->x : Item -+>x : { x: number; } +->exports : { x: number; } ++>module.exports = x : Item ++>module.exports : Item ++>module : { readonly x: Item; } ++>exports : Item + >x : Item === index.js === /** @type {(typeof import("./folder/mod1"))[]} */ const items = [{x: 12}]; ->items : import("folder/mod1").Item[] -+>items : { x: number; }[] ++>items : Item[] >[{x: 12}] : { x: number; }[] >{x: 12} : { x: number; } >x : number @@ -35,8 +30,8 @@ ->module : { exports: import("folder/mod1").Item[]; } ->exports : import("folder/mod1").Item[] ->items : import("folder/mod1").Item[] -+>module.exports = items : { x: number; }[] -+>module.exports : { x: number; }[] -+>module : { readonly items: { x: number; }[]; } -+>exports : { x: number; }[] -+>items : { x: number; }[] ++>module.exports = items : Item[] ++>module.exports : Item[] ++>module : { readonly items: Item[]; } ++>exports : Item[] ++>items : Item[] diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReferences3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReferences3.errors.txt.diff index 472a6041c7..6f157d663f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReferences3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReferences3.errors.txt.diff @@ -3,9 +3,10 @@ @@= skipped -0, +0 lines =@@ - +index.js(3,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(5,18): error TS2339: Property 'B' does not exist on type '{}'. + + -+==== index.js (1 errors) ==== ++==== index.js (2 errors) ==== + /// + + const Something = require("fs").Something; @@ -13,6 +14,8 @@ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + module.exports.A = {} + module.exports.A.B = { ++ ~ ++!!! error TS2339: Property 'B' does not exist on type '{}'. + thing: new Something() + } + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReferences3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReferences3.types.diff index 6bdb026cbd..c7579b4f73 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReferences3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReferences3.types.diff @@ -23,11 +23,11 @@ ->exports : typeof module.exports ->A : typeof A +>module.exports.A = {} : {} -+>module.exports.A : any ++>module.exports.A : {} +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>A : any ++>A : {} >{} : {} module.exports.A.B = { @@ -42,11 +42,11 @@ ->{ thing: new Something()} : { thing: Something; } +>module.exports.A.B = { thing: new Something()} : { thing: any; } +>module.exports.A.B : any -+>module.exports.A : any ++>module.exports.A : {} +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") -+>A : any ++>A : {} +>B : any +>{ thing: new Something()} : { thing: any; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefFunction.types.diff deleted file mode 100644 index a1323e0ed9..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefFunction.types.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.jsDeclarationsTypedefFunction.types -+++ new.jsDeclarationsTypedefFunction.types -@@= skipped -15, +15 lines =@@ - * @returns {Promise} - */ - const send = handlers => new Promise((resolve, reject) => { -->send : (handlers: ResolveRejectMap) => Promise -->handlers => new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : (handlers: ResolveRejectMap) => Promise -->handlers : ResolveRejectMap -+>send : (handlers: { [id: string]: [Function, Function]; }) => Promise -+>handlers => new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : (handlers: { [id: string]: [Function, Function]; }) => Promise -+>handlers : { [id: string]: [Function, Function]; } - >new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : Promise - >Promise : PromiseConstructor - >(resolve, reject) => { handlers[++id] = [resolve, reject]} : (resolve: (value: any) => void, reject: (reason?: any) => void) => void -@@= skipped -12, +12 lines =@@ - handlers[++id] = [resolve, reject] - >handlers[++id] = [resolve, reject] : [(value: any) => void, (reason?: any) => void] - >handlers[++id] : [Function, Function] -->handlers : ResolveRejectMap -+>handlers : { [id: string]: [Function, Function]; } - >++id : number - >id : number - >[resolve, reject] : [(value: any) => void, (reason?: any) => void] \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff index 3062e47e9b..a95ad05e93 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff @@ -4,7 +4,6 @@ - +index.js(3,37): error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. +index.js(21,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+module.js(11,38): error TS2304: Cannot find name 'P'. +module.js(24,12): error TS2315: Type 'Object' is not generic. +module.js(27,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + @@ -35,7 +34,7 @@ + module.exports = MainThreadTasks; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+==== module.js (3 errors) ==== ++==== module.js (2 errors) ==== + /** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ + + /** @@ -47,8 +46,6 @@ + + /** + * @type {{[P in TaskGroupIds]: {id: P, label: string}}} -+ ~ -+!!! error TS2304: Cannot find name 'P'. + */ + const taskGroups = { + parseHTML: { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff index 4df9945509..943490ee5b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff @@ -1,19 +1,17 @@ --- old.jsDeclarationsTypedefPropertyAndExportAssignment.types +++ new.jsDeclarationsTypedefPropertyAndExportAssignment.types -@@= skipped -1, +1 lines =@@ - +@@= skipped -2, +2 lines =@@ === index.js === const {taskGroups, taskNameToGroup} = require('./module.js'); -->taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } + >taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } ->taskNameToGroup : { [x: string]: import("module").TaskGroup; } ->require('./module.js') : typeof import("module") -+>taskGroups : { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; } +>taskNameToGroup : any -+>require('./module.js') : { taskGroups: { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; }; taskNameToGroup: any; } ++>require('./module.js') : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } >require : any >'./module.js' : "./module.js" -@@= skipped -24, +24 lines =@@ +@@= skipped -23, +23 lines =@@ * @param {TaskNode} y */ constructor(x, y){} @@ -30,43 +28,7 @@ >exports : typeof MainThreadTasks >MainThreadTasks : typeof MainThreadTasks -@@= skipped -25, +25 lines =@@ - * @type {{[P in TaskGroupIds]: {id: P, label: string}}} - */ - const taskGroups = { -->taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } -->{ parseHTML: { id: 'parseHTML', label: 'Parse HTML & CSS' }, styleLayout: { id: 'styleLayout', label: 'Style & Layout' },} : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } -+>taskGroups : { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; } -+>{ parseHTML: { id: 'parseHTML', label: 'Parse HTML & CSS' }, styleLayout: { id: 'styleLayout', label: 'Style & Layout' },} : { parseHTML: { id: string; label: string; }; styleLayout: { id: string; label: string; }; } - - parseHTML: { -->parseHTML : { id: "parseHTML"; label: string; } -->{ id: 'parseHTML', label: 'Parse HTML & CSS' } : { id: "parseHTML"; label: string; } -+>parseHTML : { id: string; label: string; } -+>{ id: 'parseHTML', label: 'Parse HTML & CSS' } : { id: string; label: string; } - - id: 'parseHTML', -->id : "parseHTML" -+>id : string - >'parseHTML' : "parseHTML" - - label: 'Parse HTML & CSS' -@@= skipped -17, +17 lines =@@ - - }, - styleLayout: { -->styleLayout : { id: "styleLayout"; label: string; } -->{ id: 'styleLayout', label: 'Style & Layout' } : { id: "styleLayout"; label: string; } -+>styleLayout : { id: string; label: string; } -+>{ id: 'styleLayout', label: 'Style & Layout' } : { id: string; label: string; } - - id: 'styleLayout', -->id : "styleLayout" -+>id : string - >'styleLayout' : "styleLayout" - - label: 'Style & Layout' -@@= skipped -16, +16 lines =@@ +@@= skipped -58, +58 lines =@@ /** @type {Object} */ const taskNameToGroup = {}; @@ -80,15 +42,14 @@ ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->{ taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: { [x: string]: TaskGroup; }; } -+>module.exports = { taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; }; taskNameToGroup: any; } -+>module.exports : { taskGroups: { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; }; taskNameToGroup: any; } -+>module : { export=: { taskGroups: { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; }; taskNameToGroup: any; }; } -+>exports : { taskGroups: { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; }; taskNameToGroup: any; } -+>{ taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; }; taskNameToGroup: any; } ++>module.exports = { taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } ++>module.exports : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } ++>module : { export=: { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; }; } ++>exports : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } ++>{ taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } taskGroups, -->taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } -+>taskGroups : { parseHTML: { id: P; label: string; }; styleLayout: { id: P; label: string; }; } + >taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } taskNameToGroup, ->taskNameToGroup : { [x: string]: TaskGroup; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.types.diff index 7a5308d35f..e7991eeb71 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.types.diff @@ -17,18 +17,16 @@ */ foo(x, y, alpha) { ->foo : (x: T, y: Id, alpha: (t: T) => T) => T -+>foo : (x: T, y: (t: T) => T, alpha: (t: T) => T) => T ++>foo : (x: T, y: Id, alpha: Id2) => T >x : T -->y : Id -+>y : (t: T) => T - >alpha : (t: T) => T + >y : Id +->alpha : (t: T) => T ++>alpha : Id2 return alpha(y(x)) >alpha(y(x)) : T - >alpha : (t: T) => T +->alpha : (t: T) => T ++>alpha : Id2 >y(x) : T -->y : Id -+>y : (t: T) => T - >x : T - } - } \ No newline at end of file + >y : Id + >x : T \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff index d321f65d3a..31ea3f1da6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff @@ -1,37 +1,21 @@ --- old.jsdocTemplateTagDefault.errors.txt +++ new.jsdocTemplateTagDefault.errors.txt @@= skipped -0, +0 lines =@@ --file.js(9,20): error TS2322: Type 'number' is not assignable to type 'string'. + file.js(9,20): error TS2322: Type 'number' is not assignable to type 'string'. -file.js(22,34): error TS1005: '=' expected. -file.js(27,35): error TS1110: Type expected. -+file.js(3,15): error TS2304: Cannot find name 'T'. file.js(33,14): error TS2706: Required type parameters may not follow optional type parameters. file.js(38,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. -+file.js(45,17): error TS2304: Cannot find name 'T'. file.js(53,14): error TS2706: Required type parameters may not follow optional type parameters. --file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. -+file.js(60,17): error TS2304: Cannot find name 'U'. -+file.js(61,17): error TS2304: Cannot find name 'T'. + file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. - ==== file.js (7 errors) ==== +-==== file.js (7 errors) ==== ++==== file.js (5 errors) ==== /** * @template {string | number} [T=string] - ok: defaults are permitted * @typedef {[T]} A -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - - /** @type {A} */ // ok, default for `T` in `A` is `string` - const aDefault1 = [""]; - /** @type {A} */ // error: `number` is not assignable to string` - const aDefault2 = [0]; -- ~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. - /** @type {A} */ // ok, `T` is provided for `A` - const aString = [""]; - /** @type {A} */ // ok, `T` is provided for `A` -@@= skipped -31, +31 lines =@@ +@@= skipped -31, +29 lines =@@ /** * @template {string | number} [T] - error: default requires an `=type` @@ -46,25 +30,4 @@ -!!! error TS1110: Type expected. * @typedef {[T]} D */ - -@@= skipped -31, +27 lines =@@ - /** - * @template T - * @template [U=T] - ok: default can reference earlier type parameter -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @param {T} a - * @param {U} b - */ -@@= skipped -18, +20 lines =@@ - /** - * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. - ~ --!!! error TS2744: Type parameter defaults can only reference previously declared type parameters. -+!!! error TS2304: Cannot find name 'U'. - * @template [U=T] -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @param {T} a - * @param {U} b - */ \ No newline at end of file + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.types.diff index f145c95b21..a976317806 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.types.diff @@ -1,36 +1,6 @@ --- old.jsdocTemplateTagDefault.types +++ new.jsdocTemplateTagDefault.types -@@= skipped -7, +7 lines =@@ - - /** @type {A} */ // ok, default for `T` in `A` is `string` - const aDefault1 = [""]; -->aDefault1 : A -+>aDefault1 : [T] - >[""] : [string] - >"" : "" - - /** @type {A} */ // error: `number` is not assignable to string` - const aDefault2 = [0]; -->aDefault2 : A -+>aDefault2 : [T] - >[0] : [number] - >0 : 0 - - /** @type {A} */ // ok, `T` is provided for `A` - const aString = [""]; -->aString : A -+>aString : [T] - >[""] : [string] - >"" : "" - - /** @type {A} */ // ok, `T` is provided for `A` - const aNumber = [0]; -->aNumber : A -+>aNumber : [T] - >[0] : [number] - >0 : 0 - -@@= skipped -57, +57 lines =@@ +@@= skipped -64, +64 lines =@@ * @param {U} b */ function f1(a, b) {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.errors.txt.diff deleted file mode 100644 index 2fd7f9ad3e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.jsdocTemplateTagNameResolution.errors.txt -+++ new.jsdocTemplateTagNameResolution.errors.txt -@@= skipped -0, +0 lines =@@ --file.js(10,7): error TS2322: Type 'string' is not assignable to type 'number'. -- -- --==== file.js (1 errors) ==== -+file.js(3,21): error TS2304: Cannot find name 'T'. -+file.js(4,14): error TS2304: Cannot find name 'T'. -+file.js(4,16): error TS2304: Cannot find name 'K'. -+ -+ -+==== file.js (3 errors) ==== - /** - * @template T - * @template {keyof T} K -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @typedef {T[K]} Foo -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'K'. - */ - - const x = { a: 1 }; - - /** @type {Foo} */ - const y = "a"; -- ~ --!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.types.diff deleted file mode 100644 index 93b74d0464..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.types.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.jsdocTemplateTagNameResolution.types -+++ new.jsdocTemplateTagNameResolution.types -@@= skipped -14, +14 lines =@@ - - /** @type {Foo} */ - const y = "a"; -->y : number -+>y : T - >"a" : "a" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.types.diff index a04e78401d..518ab2ac14 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.types.diff @@ -11,15 +11,13 @@ >require : (name: string) => any >"./semver" : "./semver" - var two = C.f(1) +@@= skipped -9, +9 lines =@@ >two : any >C.f(1) : any -->C.f : (n: any) => any + >C.f : (n: any) => any ->C : typeof C -->f : (n: any) => any -+>C.f : any +>C : typeof import("semver") -+>f : any + >f : (n: any) => any >1 : 1 var c = new C @@ -32,7 +30,7 @@ === node.d.ts === declare function require(name: string): any; -@@= skipped -33, +33 lines =@@ +@@= skipped -24, +24 lines =@@ === semver.js === /// exports = module.exports = C @@ -53,15 +51,12 @@ exports.f = n => n + 1 >exports.f = n => n + 1 : (n: any) => any -->exports.f : (n: any) => any + >exports.f : (n: any) => any ->exports : typeof C -->f : (n: any) => any -+>exports.f : any +>exports : typeof import("semver") -+>f : any + >f : (n: any) => any >n => n + 1 : (n: any) => any >n : any - >n + 1 : any @@= skipped -20, +20 lines =@@ >1 : 1 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment2.types.diff index 853d1610f5..7337c3da09 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment2.types.diff @@ -19,16 +19,14 @@ } module.exports.asReadInstalled = function (tree) { >module.exports.asReadInstalled = function (tree) { npm(tree) // both references should be callable module.exports(tree)} : (tree: any) => void -->module.exports.asReadInstalled : (tree: any) => void + >module.exports.asReadInstalled : (tree: any) => void ->module.exports : { (tree: any): void; asReadInstalled: (tree: any) => void; } ->module : { exports: { (tree: any): void; asReadInstalled: (tree: any) => void; }; } ->exports : { (tree: any): void; asReadInstalled: (tree: any) => void; } -->asReadInstalled : (tree: any) => void -+>module.exports.asReadInstalled : any +>module.exports : typeof import("npm") +>module : { "npm": typeof import("npm"); } +>exports : typeof import("npm") -+>asReadInstalled : any + >asReadInstalled : (tree: any) => void >function (tree) { npm(tree) // both references should be callable module.exports(tree)} : (tree: any) => void >tree : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportNestedNamespaces.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportNestedNamespaces.errors.txt.diff index 048f3dc44a..de6a3161fb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportNestedNamespaces.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportNestedNamespaces.errors.txt.diff @@ -2,13 +2,17 @@ +++ new.moduleExportNestedNamespaces.errors.txt @@= skipped -0, +0 lines =@@ - ++mod.js(2,18): error TS2339: Property 'K' does not exist on type '{}'. ++use.js(3,17): error TS2339: Property 'K' does not exist on type '{}'. +use.js(8,15): error TS2694: Namespace '"mod"' has no exported member 'n'. +use.js(9,13): error TS2749: 's.Classic' refers to a value, but is being used as a type here. Did you mean 'typeof s.Classic'? + + -+==== mod.js (0 errors) ==== ++==== mod.js (1 errors) ==== + module.exports.n = {}; + module.exports.n.K = function C() { ++ ~ ++!!! error TS2339: Property 'K' does not exist on type '{}'. + this.x = 10; + } + module.exports.Classic = class { @@ -17,10 +21,12 @@ + } + } + -+==== use.js (2 errors) ==== ++==== use.js (3 errors) ==== + import * as s from './mod' + + var k = new s.n.K() ++ ~ ++!!! error TS2339: Property 'K' does not exist on type '{}'. + k.x + var classic = new s.Classic() + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportNestedNamespaces.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportNestedNamespaces.types.diff index d239761827..33fe04752c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportNestedNamespaces.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportNestedNamespaces.types.diff @@ -11,11 +11,11 @@ ->exports : typeof module.exports ->n : typeof n +>module.exports.n = {} : {} -+>module.exports.n : any ++>module.exports.n : {} +>module.exports : typeof import("mod") +>module : { "mod": typeof import("mod"); } +>exports : typeof import("mod") -+>n : any ++>n : {} >{} : {} module.exports.n.K = function C() { @@ -31,11 +31,11 @@ ->C : typeof C +>module.exports.n.K = function C() { this.x = 10;} : () => void +>module.exports.n.K : any -+>module.exports.n : any ++>module.exports.n : {} +>module.exports : typeof import("mod") +>module : { "mod": typeof import("mod"); } +>exports : typeof import("mod") -+>n : any ++>n : {} +>K : any +>function C() { this.x = 10;} : () => void +>C : () => void @@ -50,14 +50,16 @@ } module.exports.Classic = class { >module.exports.Classic = class { constructor() { this.p = 1 }} : typeof Classic - >module.exports.Classic : typeof Classic +->module.exports.Classic : typeof Classic ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports +->Classic : typeof Classic ++>module.exports.Classic : typeof (Anonymous class) +>module.exports : typeof import("mod") +>module : { "mod": typeof import("mod"); } +>exports : typeof import("mod") - >Classic : typeof Classic ++>Classic : typeof (Anonymous class) >class { constructor() { this.p = 1 }} : typeof Classic constructor() { @@ -88,9 +90,9 @@ +>k : any +>new s.n.K() : any +>s.n.K : any -+>s.n : any ++>s.n : {} +>s : typeof import("mod") -+>n : any ++>n : {} +>K : any k.x @@ -107,11 +109,11 @@ ->s.Classic : typeof s.Classic ->s : typeof s ->Classic : typeof s.Classic -+>classic : Classic -+>new s.Classic() : Classic -+>s.Classic : typeof Classic ++>classic : (Anonymous class) ++>new s.Classic() : (Anonymous class) ++>s.Classic : typeof (Anonymous class) +>s : typeof import("mod") -+>Classic : typeof Classic ++>Classic : typeof (Anonymous class) /** @param {s.n.K} c diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.errors.txt.diff index 887b42f232..42b332e921 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.errors.txt.diff @@ -2,36 +2,27 @@ +++ new.moduleExportsElementAccessAssignment.errors.txt @@= skipped -0, +0 lines =@@ - -+mod1.js(1,1): error TS7022: 'a' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -+mod1.js(2,1): error TS7022: 'b' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -+mod1.js(3,1): error TS7022: 'default' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -+mod1.js(4,1): error TS7022: 'c' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -+mod1.js(5,1): error TS7022: 'd' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. ++mod1.js(6,24): error TS2339: Property 'e' does not exist on type '{}'. ++mod2.js(6,8): error TS2339: Property 'e' does not exist on type '{}'. + + -+==== mod2.js (0 errors) ==== ++==== mod2.js (1 errors) ==== + const mod1 = require("./mod1"); + mod1.a; + mod1.b; + mod1.c; + mod1.d; + mod1.d.e; ++ ~ ++!!! error TS2339: Property 'e' does not exist on type '{}'. + mod1.default; -+==== mod1.js (5 errors) ==== ++==== mod1.js (1 errors) ==== + exports.a = { x: "x" }; -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7022: 'a' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. + exports["b"] = { x: "x" }; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7022: 'b' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. + exports["default"] = { x: "x" }; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7022: 'default' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. + module.exports["c"] = { x: "x" }; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7022: 'c' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. + module["exports"]["d"] = {}; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7022: 'd' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. + module["exports"]["d"].e = 0; ++ ~ ++!!! error TS2339: Property 'e' does not exist on type '{}'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff index 166d96f2d9..f0cd9f4349 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff @@ -12,36 +12,30 @@ >"./mod1" : "./mod1" mod1.a; -->mod1.a : { x: string; } + >mod1.a : { x: string; } ->mod1 : typeof mod1 -->a : { x: string; } -+>mod1.a : any +>mod1 : typeof import("mod1") -+>a : any + >a : { x: string; } mod1.b; -->mod1.b : { x: string; } + >mod1.b : { x: string; } ->mod1 : typeof mod1 -->b : { x: string; } -+>mod1.b : any +>mod1 : typeof import("mod1") -+>b : any + >b : { x: string; } mod1.c; -->mod1.c : { x: string; } + >mod1.c : { x: string; } ->mod1 : typeof mod1 -->c : { x: string; } -+>mod1.c : any +>mod1 : typeof import("mod1") -+>c : any + >c : { x: string; } mod1.d; ->mod1.d : typeof mod1."d" ->mod1 : typeof mod1 ->d : typeof mod1."d" -+>mod1.d : any ++>mod1.d : {} +>mod1 : typeof import("mod1") -+>d : any ++>d : {} mod1.d.e; ->mod1.d.e : number @@ -50,56 +44,25 @@ ->d : typeof mod1."d" ->e : number +>mod1.d.e : any -+>mod1.d : any ++>mod1.d : {} +>mod1 : typeof import("mod1") -+>d : any ++>d : {} +>e : any mod1.default; -->mod1.default : { x: string; } + >mod1.default : { x: string; } ->mod1 : typeof mod1 -->default : { x: string; } -+>mod1.default : any +>mod1 : typeof import("mod1") -+>default : any + >default : { x: string; } === mod1.js === - exports.a = { x: "x" }; - >exports.a = { x: "x" } : { x: string; } -->exports.a : { x: string; } -+>exports.a : any - >exports : typeof import("mod1") -->a : { x: string; } -+>a : any - >{ x: "x" } : { x: string; } - >x : string - >"x" : "x" - - exports["b"] = { x: "x" }; - >exports["b"] = { x: "x" } : { x: string; } -->exports["b"] : { x: string; } -+>exports["b"] : any - >exports : typeof import("mod1") - >"b" : "b" - >{ x: "x" } : { x: string; } -@@= skipped -58, +58 lines =@@ - - exports["default"] = { x: "x" }; - >exports["default"] = { x: "x" } : { x: string; } -->exports["default"] : { x: string; } -+>exports["default"] : any - >exports : typeof import("mod1") - >"default" : "default" - >{ x: "x" } : { x: string; } -@@= skipped -9, +9 lines =@@ - +@@= skipped -68, +68 lines =@@ module.exports["c"] = { x: "x" }; >module.exports["c"] = { x: "x" } : { x: string; } -->module.exports["c"] : { x: string; } + >module.exports["c"] : { x: string; } ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -+>module.exports["c"] : any +>module.exports : typeof import("mod1") +>module : { "mod1": typeof import("mod1"); } +>exports : typeof import("mod1") @@ -114,7 +77,7 @@ ->module["exports"] : typeof module.exports ->module : { exports: typeof module.exports; } +>module["exports"]["d"] = {} : {} -+>module["exports"]["d"] : any ++>module["exports"]["d"] : {} +>module["exports"] : typeof import("mod1") +>module : { "mod1": typeof import("mod1"); } >"exports" : "exports" @@ -128,7 +91,7 @@ ->module["exports"] : typeof module.exports ->module : { exports: typeof module.exports; } +>module["exports"]["d"].e : any -+>module["exports"]["d"] : any ++>module["exports"]["d"] : {} +>module["exports"] : typeof import("mod1") +>module : { "mod1": typeof import("mod1"); } >"exports" : "exports" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.errors.txt.diff deleted file mode 100644 index 14419ad4d7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.paramTagTypeResolution2.errors.txt -+++ new.paramTagTypeResolution2.errors.txt -@@= skipped -0, +0 lines =@@ -- -+38572.js(4,39): error TS2304: Cannot find name 'K'. -+ -+ -+==== 38572.js (1 errors) ==== -+ /** -+ * @template T -+ * @param {T} a -+ * @param {{[K in keyof T]: (value: T[K]) => void }} b -+ ~ -+!!! error TS2304: Cannot find name 'K'. -+ */ -+ function f(a, b) { -+ } -+ -+ f({ x: 42 }, { x(param) { param.toFixed() } }); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.types.diff index df8b21d9f3..95adc26463 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.types.diff @@ -5,16 +5,7 @@ >x : number >42 : 42 ->{ x(param) { param.toFixed() } } : { x(param: number): void; } -->x : (param: number) => void -->param : number -->param.toFixed() : string -->param.toFixed : (fractionDigits?: number) => string -->param : number -->toFixed : (fractionDigits?: number) => string -+>{ x(param) { param.toFixed() } } : { x: (param: K) => void; } -+>x : (param: K) => void -+>param : K -+>param.toFixed() : any -+>param.toFixed : any -+>param : K -+>toFixed : any ++>{ x(param) { param.toFixed() } } : { x: (param: number) => void; } + >x : (param: number) => void + >param : number + >param.toFixed() : string \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.errors.txt.diff deleted file mode 100644 index 6701094a59..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.recursiveTypeReferences2.errors.txt -+++ new.recursiveTypeReferences2.errors.txt -@@= skipped -0, +0 lines =@@ --bug39372.js(25,7): error TS2322: Type '{}' is not assignable to type 'XMLObject<{ foo: string; }>'. -- Type '{}' is missing the following properties from type '{ $A: { foo?: XMLObject[]; }; $O: { foo?: { $$?: Record; } & { $: string; }; }; $$?: Record; }': $A, $O -- -- --==== bug39372.js (1 errors) ==== -+bug39372.js(1,36): error TS2456: Type alias 'JsonArray' circularly references itself. -+bug39372.js(3,88): error TS2456: Type alias 'Json' circularly references itself. -+bug39372.js(9,17): error TS2304: Cannot find name 'T'. -+bug39372.js(9,32): error TS2304: Cannot find name 'T'. -+bug39372.js(12,17): error TS2304: Cannot find name 'T'. -+bug39372.js(14,10): error TS2304: Cannot find name 'T'. -+bug39372.js(14,55): error TS2304: Cannot find name 'T'. -+bug39372.js(18,15): error TS2304: Cannot find name 'T'. -+bug39372.js(19,5): error TS2304: Cannot find name 'T'. -+bug39372.js(20,19): error TS2304: Cannot find name 'T'. -+bug39372.js(25,7): error TS2322: Type '{}' is not assignable to type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; } & { [x: string]: string | { $A: { [x: string]: (??? & ???)[]; }; $O: { [x: string]: { $$?: Record; } & (??? | ??? & ???); }; $$?: Record; } & ???; }'. -+ Type '{}' is missing the following properties from type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; }': $A, $O -+ -+ -+==== bug39372.js (11 errors) ==== - /** @typedef {ReadonlyArray} JsonArray */ -+ ~~~~~~~~~ -+!!! error TS2456: Type alias 'JsonArray' circularly references itself. - /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ - /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ -+ ~~~~ -+!!! error TS2456: Type alias 'Json' circularly references itself. - - /** - * @template T - * @typedef {{ - $A: { - [K in keyof T]?: XMLObject[] -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'T'. - }, - $O: { - [K in keyof T]?: { -+ ~ -+!!! error TS2304: Cannot find name 'T'. - $$?: Record - } & (T[K] extends string ? {$:string} : XMLObject) -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'T'. - }, - $$?: Record, - } & { - [K in keyof T]?: ( -+ ~ -+!!! error TS2304: Cannot find name 'T'. - T[K] extends string ? string -+ ~ -+!!! error TS2304: Cannot find name 'T'. - : XMLObject -+ ~ -+!!! error TS2304: Cannot find name 'T'. - ) - }} XMLObject */ - - /** @type {XMLObject<{foo:string}>} */ - const p = {}; - ~ --!!! error TS2322: Type '{}' is not assignable to type 'XMLObject<{ foo: string; }>'. --!!! error TS2322: Type '{}' is missing the following properties from type '{ $A: { foo?: XMLObject[]; }; $O: { foo?: { $$?: Record; } & { $: string; }; }; $$?: Record; }': $A, $O -+!!! error TS2322: Type '{}' is not assignable to type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; } & { [x: string]: string | { $A: { [x: string]: (??? & ???)[]; }; $O: { [x: string]: { $$?: Record; } & (??? | ??? & ???); }; $$?: Record; } & ???; }'. -+!!! error TS2322: Type '{}' is missing the following properties from type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; }': $A, $O - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.types.diff deleted file mode 100644 index 0f3de27714..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.types.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.recursiveTypeReferences2.types -+++ new.recursiveTypeReferences2.types -@@= skipped -25, +25 lines =@@ - - /** @type {XMLObject<{foo:string}>} */ - const p = {}; -->p : XMLObject<{ foo: string; }> -+>p : { $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; } & { [x: string]: string | { $A: { [x: string]: (??? & ???)[]; }; $O: { [x: string]: { $$?: Record; } & (??? | ??? & ???); }; $$?: Record; } & ???; } - >{} : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff index 126995a2e7..b8811d67de 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff @@ -7,11 +7,11 @@ ->exports.A = function () { this.x = 1;} : typeof A ->exports.A : typeof A +>exports.A = function () { this.x = 1;} : () => void -+>exports.A : any ++>exports.A : () => void >exports : typeof import("a-ext") ->A : typeof A ->function () { this.x = 1;} : typeof A -+>A : any ++>A : () => void +>function () { this.x = 1;} : () => void this.x = 1; @@ -27,7 +27,7 @@ === a.js === const { A } = require("./a-ext"); ->A : typeof A -+>A : any ++>A : () => void >require("./a-ext") : typeof import("a-ext") >require : (id: string) => any >"./a-ext" : "./a-ext" @@ -43,7 +43,14 @@ === b-ext.js === exports.B = class { -@@= skipped -15, +15 lines =@@ + >exports.B = class { constructor() { this.x = 1; }} : typeof B +->exports.B : typeof B ++>exports.B : typeof (Anonymous class) + >exports : typeof import("b-ext") +->B : typeof B ++>B : typeof (Anonymous class) + >class { constructor() { this.x = 1; }} : typeof B + constructor() { this.x = 1; >this.x = 1 : 1 @@ -55,7 +62,15 @@ >1 : 1 } }; -@@= skipped -18, +18 lines =@@ + + === b.js === + const { B } = require("./b-ext"); +->B : typeof B ++>B : typeof (Anonymous class) + >require("./b-ext") : typeof import("b-ext") + >require : (id: string) => any + >"./b-ext" : "./b-ext" +@@= skipped -33, +33 lines =@@ function b(p) { p.x; } >b : (p: B) => void >p : B diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.errors.txt.diff deleted file mode 100644 index 3e84646baf..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.typeTagNoErasure.errors.txt -+++ new.typeTagNoErasure.errors.txt -@@= skipped -0, +0 lines =@@ --typeTagNoErasure.js(7,6): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -+typeTagNoErasure.js(1,39): error TS2304: Cannot find name 'T'. - - - ==== typeTagNoErasure.js (1 errors) ==== - /** @template T @typedef {(data: T1) => T1} Test */ -+ ~ -+!!! error TS2304: Cannot find name 'T'. - - /** @type {Test} */ - const test = dibbity => dibbity - - test(1) // ok, T=1 - test('hi') // error, T=number -- ~~~~ --!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.types.diff deleted file mode 100644 index 10c8a0f52e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.types.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.typeTagNoErasure.types -+++ new.typeTagNoErasure.types -@@= skipped -4, +4 lines =@@ - - /** @type {Test} */ - const test = dibbity => dibbity -->test : Test -->dibbity => dibbity : (dibbity: T1) => T1 -+>test : (data: T1) => T1 -+>dibbity => dibbity : (dibbity: T1) => T1 - >dibbity : T1 - >dibbity : T1 - - test(1) // ok, T=1 - >test(1) : 1 -->test : Test -+>test : (data: T1) => T1 - >1 : 1 - - test('hi') // error, T=number -->test('hi') : number -->test : Test -+>test('hi') : "hi" -+>test : (data: T1) => T1 - >'hi' : "hi" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff index 51eef02901..888472b2db 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff @@ -49,11 +49,11 @@ ->exports.C = function() { this.p = 1} : typeof C ->exports.C : typeof C +>exports.C = function() { this.p = 1} : () => void -+>exports.C : any ++>exports.C : () => void >exports : typeof import("mod3") ->C : typeof C ->function() { this.p = 1} : typeof C -+>C : any ++>C : () => void +>function() { this.p = 1} : () => void this.p = 1 @@ -90,7 +90,7 @@ var both3 = both2; ->both3 : import("mod3").Both ->both2 : import("mod2").A -+>both3 : { type: "a"; x: 1; } | { type: "b"; y: 1; } ++>both3 : Both +>both2 : Both diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.errors.txt.diff index dde9d36fb2..917202641a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.errors.txt.diff @@ -3,42 +3,15 @@ @@= skipped -0, +0 lines =@@ -a.js(12,23): error TS2344: Type '{ a: number; }' does not satisfy the constraint '{ a: number; b: string; }'. - Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -+a.js(6,19): error TS2304: Cannot find name 'T'. -+a.js(6,25): error TS2304: Cannot find name 'U'. -+a.js(6,31): error TS2304: Cannot find name 'V'. -+a.js(6,37): error TS2304: Cannot find name 'W'. -+a.js(6,43): error TS2304: Cannot find name 'X'. +a.js(12,23): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. a.js(15,12): error TS2314: Generic type 'Everything' requires 5 type argument(s). -test.ts(1,34): error TS2344: Type '{ a: number; }' does not satisfy the constraint '{ a: number; b: string; }'. - Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -- -- --==== a.js (2 errors) ==== +test.ts(1,23): error TS2304: Cannot find name 'Everything'. -+ -+ -+==== a.js (7 errors) ==== - /** - * @template {{ a: number, b: string }} T,U A Comment - * @template {{ c: boolean }} V uh ... are comments even supported?? - * @template W - * @template X That last one had no comment - * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'U'. -+ ~ -+!!! error TS2304: Cannot find name 'V'. -+ ~ -+!!! error TS2304: Cannot find name 'W'. -+ ~ -+!!! error TS2304: Cannot find name 'X'. - */ - - /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ -@@= skipped -18, +31 lines =@@ + + + ==== a.js (2 errors) ==== +@@= skipped -18, +16 lines =@@ /** @type {Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>} */ ~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.types.diff deleted file mode 100644 index 50ccd76b6f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.typedefMultipleTypeParameters.types -+++ new.typedefMultipleTypeParameters.types -@@= skipped -10, +10 lines =@@ - - /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ - var tuvwx; -->tuvwx : Everything<{ a: number; b: "hi"; c: never; }, undefined, { c: true; d: 1; }, number, string> -+>tuvwx : { t: T; u: U; v: V; w: W; x: X; } - - /** @type {Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>} */ - var wrong; -->wrong : Everything<{ a: number; }, undefined, { c: 1; d: 1; }, number, string> -+>wrong : { t: T; u: U; v: V; w: W; x: X; } - - /** @type {Everything<{ a: number }>} */ - var insufficient; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.types.diff index 30a5f3c400..a3b9cd6553 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.types.diff @@ -1,118 +1,11 @@ --- old.typedefOnStatements.types +++ new.typedefOnStatements.types -@@= skipped -92, +92 lines =@@ - * @param {Q} q - */ - function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { -->proof : (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q) => void -->a : A -->b : B -->c : C -->d : D -->e : E -->f : F -->g : G -->h : H -->i : I -->j : J -->k : K -->l : L -->m : M -->n : N -->o : O -->p : P -->q : Q -+>proof : (a: { a: string; }, b: { b: string; }, c: { c: string; }, d: { d: string; }, e: { e: string; }, f: { f: string; }, g: { g: string; }, h: { h: string; }, i: { i: string; }, j: { j: string; }, k: { k: string; }, l: { l: string; }, m: { m: string; }, n: { n: string; }, o: { o: string; }, p: { p: string; }, q: { q: string; }) => void -+>a : { a: string; } -+>b : { b: string; } -+>c : { c: string; } -+>d : { d: string; } -+>e : { e: string; } -+>f : { f: string; } -+>g : { g: string; } -+>h : { h: string; } -+>i : { i: string; } -+>j : { j: string; } -+>k : { k: string; } -+>l : { l: string; } -+>m : { m: string; } -+>n : { n: string; } -+>o : { o: string; } -+>p : { p: string; } -+>q : { q: string; } +@@= skipped -170, +170 lines =@@ - console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) - >console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) : void -@@= skipped -25, +25 lines =@@ - >console : Console - >log : (...data: any[]) => void - >a.a : string -->a : A -+>a : { a: string; } - >a : string - >b.b : string -->b : B -+>b : { b: string; } - >b : string - >c.c : string -->c : C -+>c : { c: string; } - >c : string - >d.d : string -->d : D -+>d : { d: string; } - >d : string - >e.e : string -->e : E -+>e : { e: string; } - >e : string - >f.f : string -->f : F -+>f : { f: string; } - >f : string - >g.g : string -->g : G -+>g : { g: string; } - >g : string - >h.h : string -->h : H -+>h : { h: string; } - >h : string - >i.i : string -->i : I -+>i : { i: string; } - >i : string - >j.j : string -->j : J -+>j : { j: string; } - >j : string - >k.k : string -->k : K -+>k : { k: string; } - >k : string - >l.l : string -->l : L -+>l : { l: string; } - >l : string - >m.m : string -->m : M -+>m : { m: string; } - >m : string - >n.n : string -->n : N -+>n : { n: string; } - >n : string - >o.o : string -->o : O -+>o : { o: string; } - >o : string - >p.p : string -->p : P -+>p : { p: string; } - >p : string - >q.q : string -->q : Q -+>q : { q: string; } - >q : string - - /** @type {Alpha} */ \ No newline at end of file + /** @type {Alpha} */ + var alpha = { alpha: "aleph" } +->alpha : { alpha: string; } ++>alpha : Alpha + >{ alpha: "aleph" } : { alpha: string; } + >alpha : string + >"aleph" : "aleph" \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff index 406f307378..ab3f58007b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff @@ -5,28 +5,25 @@ === /a.ts === import foo from "foo"; ->foo : { bar(): number; } -+>foo : any ++>foo : { bar: () => number; } foo.bar(); -->foo.bar() : number -->foo.bar : () => number + >foo.bar() : number + >foo.bar : () => number ->foo : { bar(): number; } -->bar : () => number -+>foo.bar() : any -+>foo.bar : any -+>foo : any -+>bar : any ++>foo : { bar: () => number; } + >bar : () => number === /node_modules/foo/index.js === exports.default = { bar() { return 0; } } ->exports.default = { bar() { return 0; } } : { bar(): number; } ->exports.default : { bar(): number; } +>exports.default = { bar() { return 0; } } : { bar: () => number; } -+>exports.default : any ++>exports.default : { bar: () => number; } >exports : typeof import("/node_modules/foo/index") ->default : { bar(): number; } ->{ bar() { return 0; } } : { bar(): number; } -+>default : any ++>default : { bar: () => number; } +>{ bar() { return 0; } } : { bar: () => number; } >bar : () => number >0 : 0