diff --git a/internal/ast/ast.go b/internal/ast/ast.go index a5cb1ecbeb..bda9af8067 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -2,6 +2,7 @@ package ast import ( "fmt" + "iter" "strings" "sync" "sync/atomic" @@ -224,6 +225,7 @@ func (n *Node) AsNode() *Node { return n } func (n *Node) Pos() int { return n.Loc.Pos() } func (n *Node) End() int { return n.Loc.End() } func (n *Node) ForEachChild(v Visitor) bool { return n.data.ForEachChild(v) } +func (n *Node) IterChildren() iter.Seq[*Node] { return n.data.IterChildren() } func (n *Node) Clone(f NodeFactoryCoercible) *Node { return n.data.Clone(f) } func (n *Node) VisitEachChild(v *NodeVisitor) *Node { return n.data.VisitEachChild(v) } func (n *Node) Name() *DeclarationName { return n.data.Name() } @@ -1655,6 +1657,7 @@ func (n *Node) AsSyntaxList() *SyntaxList { type nodeData interface { AsNode() *Node ForEachChild(v Visitor) bool + IterChildren() iter.Seq[*Node] VisitEachChild(v *NodeVisitor) *Node Clone(v NodeFactoryCoercible) *Node Name() *DeclarationName @@ -1681,8 +1684,21 @@ type NodeDefault struct { Node } -func (node *NodeDefault) AsNode() *Node { return &node.Node } -func (node *NodeDefault) ForEachChild(v Visitor) bool { return false } +func invert(yield func(v *Node) bool) Visitor { + return func(n *Node) bool { + return !yield(n) + } +} + +func (node *NodeDefault) AsNode() *Node { return &node.Node } +func (node *NodeDefault) ForEachChild(v Visitor) bool { return false } +func (node *NodeDefault) forEachChildIter(yield func(v *Node) bool) { + node.data.ForEachChild(invert(yield)) // `true` is return early for a ts visitor, `false` is return early for a go iterator yield function +} + +func (node *NodeDefault) IterChildren() iter.Seq[*Node] { + return node.forEachChildIter +} func (node *NodeDefault) VisitEachChild(v *NodeVisitor) *Node { return node.AsNode() } func (node *NodeDefault) Clone(v NodeFactoryCoercible) *Node { return nil } func (node *NodeDefault) Name() *DeclarationName { return nil } diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 6710d43adc..bdb84cb488 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -30198,7 +30198,7 @@ func (c *Checker) getSymbolOfNameOrPropertyAccessExpression(name *ast.Node) *ast return c.getSymbolOfNode(name.Parent) } - if name.Parent.Kind == ast.KindExportAssignment && ast.IsEntityNameExpression(name) { + if (name.Parent.Kind == ast.KindExportAssignment || name.Parent.Kind == ast.KindJSExportAssignment) && ast.IsEntityNameExpression(name) { // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression success := c.resolveEntityName( name, diff --git a/internal/compiler/fileloader.go b/internal/compiler/fileloader.go index 72202fd95e..708307c455 100644 --- a/internal/compiler/fileloader.go +++ b/internal/compiler/fileloader.go @@ -561,13 +561,13 @@ func getDefaultResolutionModeForFile(fileName string, meta ast.SourceFileMetaDat } func getModeForUsageLocation(fileName string, meta ast.SourceFileMetaData, usage *ast.StringLiteralLike, options *core.CompilerOptions) core.ResolutionMode { - if ast.IsImportDeclaration(usage.Parent) || ast.IsExportDeclaration(usage.Parent) || ast.IsJSDocImportTag(usage.Parent) { + if ast.IsImportDeclaration(usage.Parent) || usage.Parent.Kind == ast.KindJSImportDeclaration || ast.IsExportDeclaration(usage.Parent) || ast.IsJSDocImportTag(usage.Parent) { isTypeOnly := ast.IsExclusivelyTypeOnlyImportOrExport(usage.Parent) if isTypeOnly { var override core.ResolutionMode var ok bool switch usage.Parent.Kind { - case ast.KindImportDeclaration: + case ast.KindImportDeclaration, ast.KindJSImportDeclaration: override, ok = usage.Parent.AsImportDeclaration().Attributes.GetResolutionModeOverride() case ast.KindExportDeclaration: override, ok = usage.Parent.AsExportDeclaration().Attributes.GetResolutionModeOverride() diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index 08b0c6ca69..532b035780 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -44,6 +44,7 @@ func (p *Parser) withJSDoc(node *ast.Node, hasJSDoc bool) []*ast.Node { pos := node.Pos() for _, comment := range ranges { if parsed := p.parseJSDocComment(node, comment.Pos(), comment.End(), pos); parsed != nil { + parsed.Parent = node jsdoc = append(jsdoc, parsed) pos = parsed.End() } @@ -977,6 +978,9 @@ func (p *Parser) parseTypedefTag(start int, tagName *ast.IdentifierNode, indent typedefTag := p.factory.NewJSDocTypedefTag(tagName, typeExpression, fullName, comment) p.finishNodeWithEnd(typedefTag, start, end) + if typeExpression != nil { + typeExpression.Parent = typedefTag // forcibly overwrite parent potentially set by inner type expression parse + } return typedefTag } diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 18c4456794..446b22ff6b 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -78,13 +78,22 @@ type Parser struct { jsdocTagCommentsSpace []string reparseList []*ast.Node commonJSModuleIndicator *ast.Node + + currentParent *ast.Node + setParentFromContext ast.Visitor +} + +func newParser() *Parser { + res := &Parser{} + res.initializeClosures() + return res } var viableKeywordSuggestions = scanner.GetViableKeywordSuggestions() var parserPool = sync.Pool{ New: func() any { - return &Parser{} + return newParser() }, } @@ -93,7 +102,7 @@ func getParser() *Parser { } func putParser(p *Parser) { - *p = Parser{scanner: p.scanner} + *p = Parser{scanner: p.scanner, setParentFromContext: p.setParentFromContext} parserPool.Put(p) } @@ -108,6 +117,13 @@ func ParseSourceFile(opts ast.SourceFileParseOptions, sourceText string, scriptK return p.parseSourceFileWorker() } +func (p *Parser) initializeClosures() { + p.setParentFromContext = func(n *ast.Node) bool { + n.Parent = p.currentParent + return false + } +} + func (p *Parser) parseJSONText() *ast.SourceFile { pos := p.nodePos() var statements *ast.NodeList @@ -354,14 +370,6 @@ func (p *Parser) finishSourceFile(result *ast.SourceFile, isDeclarationFile bool result.IdentifierCount = p.identifierCount result.SetJSDocCache(p.jsdocCache) - ast.SetParentInChildren(result.AsNode()) - for parent, children := range p.jsdocCache { - for _, child := range children { - child.Parent = parent - ast.SetParentInChildren(child) - } - } - ast.SetExternalModuleIndicator(result, p.opts.ExternalModuleIndicatorOptions) } @@ -467,7 +475,11 @@ func (p *Parser) reparseTopLevelAwait(sourceFile *ast.SourceFile) *ast.Node { } } - return p.factory.NewSourceFile(sourceFile.ParseOptions(), p.sourceText, p.newNodeList(sourceFile.Statements.Loc, statements)) + result := p.factory.NewSourceFile(sourceFile.ParseOptions(), p.sourceText, p.newNodeList(sourceFile.Statements.Loc, statements)) + for _, s := range statements { + s.Parent = result.AsNode() // force (re)set parent to reparsed source file + } + return result } func (p *Parser) parseListIndex(kind ParsingContext, parseElement func(p *Parser, index int) *ast.Node) *ast.NodeList { @@ -3572,6 +3584,7 @@ func (p *Parser) parseTupleElementType() *ast.TypeNode { node := p.factory.NewOptionalTypeNode(typeNode.Type()) node.Flags = typeNode.Flags node.Loc = typeNode.Loc + typeNode.Type().Parent = node return node } return typeNode @@ -4693,6 +4706,16 @@ func (p *Parser) parseJsxElementOrSelfClosingElementOrFragment(inExpressionConte p.finishNodeWithEnd(newClosingElement, end, end) newLast := p.factory.NewJsxElement(lastChild.AsJsxElement().OpeningElement, lastChild.AsJsxElement().Children, newClosingElement) p.finishNodeWithEnd(newLast, lastChild.AsJsxElement().OpeningElement.Pos(), end) + // force reset parent pointers from discarded parse result + if lastChild.AsJsxElement().OpeningElement != nil { + lastChild.AsJsxElement().OpeningElement.Parent = newLast + } + if lastChild.AsJsxElement().Children != nil { + for _, c := range lastChild.AsJsxElement().Children.Nodes { + c.Parent = newLast + } + } + newClosingElement.Parent = newLast children = p.newNodeList(core.NewTextRange(children.Pos(), newLast.End()), append(children.Nodes[0:len(children.Nodes)-1], newLast)) closingElement = lastChild.AsJsxElement().ClosingElement } else { @@ -4709,6 +4732,7 @@ func (p *Parser) parseJsxElementOrSelfClosingElementOrFragment(inExpressionConte } result = p.factory.NewJsxElement(opening, children, closingElement) p.finishNode(result, pos) + closingElement.Parent = result // force reset parent pointers from possibly discarded parse result case ast.KindJsxOpeningFragment: result = p.factory.NewJsxFragment(opening, p.parseJsxChildren(opening), p.parseJsxClosingFragment(inExpressionContext)) p.finishNode(result, pos) @@ -5316,7 +5340,9 @@ func (p *Parser) parseMemberExpressionRest(pos int, expression *ast.Expression, if p.isTemplateStartOfTaggedTemplate() { // Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments if questionDotToken == nil && ast.IsExpressionWithTypeArguments(expression) { - expression = p.parseTaggedTemplateRest(pos, expression.AsExpressionWithTypeArguments().Expression, questionDotToken, expression.AsExpressionWithTypeArguments().TypeArguments) + original := expression.AsExpressionWithTypeArguments() + expression = p.parseTaggedTemplateRest(pos, original.Expression, questionDotToken, original.TypeArguments) + p.unparseExpressionWithTypeArguments(original.Expression, original.TypeArguments, expression) } else { expression = p.parseTaggedTemplateRest(pos, expression, questionDotToken, nil /*typeArguments*/) } @@ -5431,10 +5457,12 @@ func (p *Parser) parseCallExpressionRest(pos int, expression *ast.Expression) *a typeArguments = expression.AsExpressionWithTypeArguments().TypeArguments expression = expression.AsExpressionWithTypeArguments().Expression } + inner := expression argumentList := p.parseArgumentList() isOptionalChain := questionDotToken != nil || p.tryReparseOptionalChain(expression) expression = p.factory.NewCallExpression(expression, questionDotToken, typeArguments, argumentList, core.IfElse(isOptionalChain, ast.NodeFlagsOptionalChain, ast.NodeFlagsNone)) p.finishNode(expression, pos) + p.unparseExpressionWithTypeArguments(inner, typeArguments, expression) continue } if questionDotToken != nil { @@ -5715,6 +5743,18 @@ func (p *Parser) parseDecoratedExpression() *ast.Expression { return result } +func (p *Parser) unparseExpressionWithTypeArguments(expression *ast.Node, typeArguments *ast.NodeList, result *ast.Node) { + // force overwrite the `.Parent` of the expression and type arguments to erase the fact that they may have originally been parsed as an ExpressionWithTypeArguments and be parented to such + if expression != nil { + expression.Parent = result + } + if typeArguments != nil { + for _, a := range typeArguments.Nodes { + a.Parent = result + } + } +} + func (p *Parser) parseNewExpressionOrNewDotTarget() *ast.Node { pos := p.nodePos() p.parseExpected(ast.KindNewKeyword) @@ -5741,6 +5781,7 @@ func (p *Parser) parseNewExpressionOrNewDotTarget() *ast.Node { } result := p.factory.NewNewExpression(expression, typeArguments, argumentList) p.finishNode(result, pos) + p.unparseExpressionWithTypeArguments(expression, typeArguments, result) return result } @@ -5889,6 +5930,13 @@ func (p *Parser) finishNodeWithEnd(node *ast.Node, pos int, end int) { node.Flags |= ast.NodeFlagsThisNodeHasError p.hasParseError = false } + p.overrideParentInImmediateChildren(node) +} + +func (p *Parser) overrideParentInImmediateChildren(node *ast.Node) { + p.currentParent = node + node.ForEachChild(p.setParentFromContext) + p.currentParent = nil } func (p *Parser) nextTokenIsSlash() bool { diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go index 05148147d7..557d672bc2 100644 --- a/internal/parser/reparser.go +++ b/internal/parser/reparser.go @@ -5,6 +5,10 @@ import ( "github.com/microsoft/typescript-go/internal/core" ) +func (p *Parser) finishReparsedNode(node *ast.Node) { + p.overrideParentInImmediateChildren(node) +} + func (p *Parser) reparseCommonJS(node *ast.Node, jsdoc []*ast.Node) { if p.scriptKind != core.ScriptKindJS && p.scriptKind != core.ScriptKindJSX { return @@ -31,6 +35,8 @@ func (p *Parser) reparseCommonJS(node *ast.Node, jsdoc []*ast.Node) { p.reparseList = append(p.reparseList, export) p.commonJSModuleIndicator = export p.reparseTags(export, jsdoc) + p.finishReparsedNode(export) + p.finishReparsedNode(bin.AsNode()) // TODO: the same node appears in both the new export declaration and the original binary expression - both locations cannot have correct `.Parent` pointers. For now, the binary expression being correctly parented is baselined behavior, since it appears first in the AST. } } @@ -81,6 +87,7 @@ func (p *Parser) reparseUnhosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Nod typeAlias.AsTypeAliasDeclaration().Type = t typeAlias.Loc = tag.Loc typeAlias.Flags = p.contextFlags | ast.NodeFlagsReparsed + p.finishReparsedNode(typeAlias) p.reparseList = append(p.reparseList, typeAlias) case ast.KindJSDocCallbackTag: callbackTag := tag.AsJSDocCallbackTag() @@ -98,20 +105,24 @@ func (p *Parser) reparseUnhosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Nod typeAlias.AsTypeAliasDeclaration().TypeParameters = p.gatherTypeParameters(jsDoc, tag, typeAlias) typeAlias.Loc = tag.Loc typeAlias.Flags = p.contextFlags | ast.NodeFlagsReparsed + p.finishReparsedNode(typeAlias) p.reparseList = append(p.reparseList, typeAlias) case ast.KindJSDocImportTag: importTag := tag.AsJSDocImportTag() importClause := importTag.ImportClause importClause.Flags |= ast.NodeFlagsReparsed importClause.AsImportClause().IsTypeOnly = true + p.finishReparsedNode(importClause) importDeclaration := p.factory.NewJSImportDeclaration(importTag.Modifiers(), importClause, importTag.ModuleSpecifier, importTag.Attributes) importDeclaration.Loc = tag.Loc importDeclaration.Flags = p.contextFlags | ast.NodeFlagsReparsed importTag.JSImportDeclaration = importDeclaration.AsImportDeclaration() + p.finishReparsedNode(importDeclaration) p.reparseList = append(p.reparseList, importDeclaration) case ast.KindJSDocOverloadTag: if fun, ok := getFunctionLikeHost(parent); ok { p.reparseList = append(p.reparseList, p.reparseJSDocSignature(tag.AsJSDocOverloadTag().TypeExpression, fun, jsDoc, tag)) + p.finishReparsedNode(fun) } } } @@ -153,6 +164,7 @@ func (p *Parser) reparseJSDocSignature(jsSignature *ast.Node, fun *ast.Node, jsD } parameter.Loc = param.Loc parameter.Flags = p.contextFlags | ast.NodeFlagsReparsed + p.finishReparsedNode(parameter) parameters = append(parameters, parameter) } signature.FunctionLikeData().Parameters = p.newNodeList(jsSignature.AsJSDocSignature().Parameters.Loc, parameters) @@ -165,6 +177,7 @@ func (p *Parser) reparseJSDocSignature(jsSignature *ast.Node, fun *ast.Node, jsD signature.Loc = tag.AsJSDocOverloadTag().TagName.Loc } signature.Flags = p.contextFlags | ast.NodeFlagsReparsed + p.finishReparsedNode(signature) return signature } @@ -187,6 +200,7 @@ func (p *Parser) reparseJSDocTypeLiteral(t *ast.TypeNode) *ast.Node { } property.Loc = prop.Loc property.Flags = p.contextFlags | ast.NodeFlagsReparsed + p.finishReparsedNode(property) properties = append(properties, property) } loc := t.Loc @@ -194,10 +208,12 @@ func (p *Parser) reparseJSDocTypeLiteral(t *ast.TypeNode) *ast.Node { t.Loc = loc t.Flags = p.contextFlags | ast.NodeFlagsReparsed if isArrayType { + p.finishReparsedNode(t) t = p.factory.NewArrayTypeNode(t) t.Flags = p.contextFlags | ast.NodeFlagsReparsed t.Loc = loc } + p.finishReparsedNode(t) } return t } @@ -246,6 +262,7 @@ func (p *Parser) gatherTypeParameters(j *ast.Node, tagWithTypeParameters *ast.No panic("JSDoc type parameter already has a host: " + tag.AsJSDocTemplateTag().Host.Kind.String()) } reparse.Flags |= ast.NodeFlagsReparsed + p.finishReparsedNode(reparse) typeParameters = append(typeParameters, reparse) firstTypeParameter = false } @@ -266,6 +283,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) for _, declaration := range parent.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { if declaration.AsVariableDeclaration().Type == nil { declaration.AsVariableDeclaration().Type = setHost(tag.AsJSDocTypeTag().TypeExpression, declaration) + p.finishReparsedNode(declaration) break } } @@ -273,43 +291,52 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) case ast.KindVariableDeclaration: if parent.AsVariableDeclaration().Type == nil { parent.AsVariableDeclaration().Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent) + p.finishReparsedNode(parent) } case ast.KindCommonJSExport: export := parent.AsCommonJSExport() if export.Type == nil { export.Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent) + p.finishReparsedNode(parent) } case ast.KindPropertyDeclaration: declaration := parent.AsPropertyDeclaration() if declaration.Type == nil { declaration.Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent) + p.finishReparsedNode(parent) } case ast.KindPropertyAssignment: prop := parent.AsPropertyAssignment() if prop.Type == nil { prop.Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent) + p.finishReparsedNode(parent) } case ast.KindShorthandPropertyAssignment: prop := parent.AsShorthandPropertyAssignment() if prop.Type == nil { prop.Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent) + p.finishReparsedNode(parent) } case ast.KindExportAssignment, ast.KindJSExportAssignment: export := parent.AsExportAssignment() if export.Type == nil { export.Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent) + p.finishReparsedNode(parent) } case ast.KindReturnStatement: ret := parent.AsReturnStatement() ret.Expression = p.makeNewCast(setHost(tag.AsJSDocTypeTag().TypeExpression, nil), ret.Expression, true /*isAssertion*/) + p.finishReparsedNode(parent) case ast.KindParenthesizedExpression: paren := parent.AsParenthesizedExpression() paren.Expression = p.makeNewCast(setHost(tag.AsJSDocTypeTag().TypeExpression, nil), paren.Expression, true /*isAssertion*/) + p.finishReparsedNode(parent) case ast.KindExpressionStatement: if parent.AsExpressionStatement().Expression.Kind == ast.KindBinaryExpression { bin := parent.AsExpressionStatement().Expression.AsBinaryExpression() if kind := ast.GetAssignmentDeclarationKind(bin); kind != ast.JSDeclarationKindNone { bin.Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent.AsExpressionStatement().Expression) + p.finishReparsedNode(bin.AsNode()) } } } @@ -317,21 +344,25 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) if parent.Kind == ast.KindParenthesizedExpression { paren := parent.AsParenthesizedExpression() paren.Expression = p.makeNewCast(setHost(tag.AsJSDocSatisfiesTag().TypeExpression, nil), paren.Expression, false /*isAssertion*/) + p.finishReparsedNode(parent) } case ast.KindJSDocTemplateTag: if fun, ok := getFunctionLikeHost(parent); ok { if fun.TypeParameters() == nil { fun.FunctionLikeData().TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/, fun) + p.finishReparsedNode(fun) } } else if parent.Kind == ast.KindClassDeclaration { class := parent.AsClassDeclaration() if class.TypeParameters == nil { class.TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/, parent) + p.finishReparsedNode(parent) } } else if parent.Kind == ast.KindClassExpression { class := parent.AsClassExpression() if class.TypeParameters == nil { class.TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/, parent) + p.finishReparsedNode(parent) } } case ast.KindJSDocParameterTag: @@ -346,6 +377,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) param.QuestionToken = question } } + p.finishReparsedNode(param.AsNode()) } } case ast.KindJSDocThisTag: @@ -363,6 +395,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) thisParam.AsParameterDeclaration().Type = setHost(tag.AsJSDocThisTag().TypeExpression, thisParam) thisParam.Loc = tag.AsJSDocThisTag().TagName.Loc thisParam.Flags = p.contextFlags | ast.NodeFlagsReparsed + p.finishReparsedNode(thisParam) newParams := p.nodeSlicePool.NewSlice(len(params) + 1) newParams[0] = thisParam @@ -371,12 +404,14 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) } fun.FunctionLikeData().Parameters = p.newNodeList(thisParam.Loc, newParams) + p.finishReparsedNode(fun) } } case ast.KindJSDocReturnTag: if fun, ok := getFunctionLikeHost(parent); ok { if fun.Type() == nil { fun.FunctionLikeData().Type = setHost(tag.AsJSDocReturnTag().TypeExpression, fun) + p.finishReparsedNode(fun) } } case ast.KindJSDocReadonlyTag, ast.KindJSDocPrivateTag, ast.KindJSDocPublicTag, ast.KindJSDocProtectedTag, ast.KindJSDocOverrideTag: @@ -412,6 +447,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) loc = parent.Modifiers().Loc } parent.AsMutable().SetModifiers(p.newModifierList(loc, nodes)) + p.finishReparsedNode(parent) } case ast.KindJSDocImplementsTag: if class := getClassLikeData(parent); class != nil { @@ -422,6 +458,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) return node.AsHeritageClause().Token == ast.KindImplementsKeyword }); implementsClause != nil { implementsClause.AsHeritageClause().Types.Nodes = append(implementsClause.AsHeritageClause().Types.Nodes, implementsTag.ClassName) + p.finishReparsedNode(implementsClause) return } } @@ -431,6 +468,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) heritageClause := p.factory.NewHeritageClause(ast.KindImplementsKeyword, typesList) heritageClause.Loc = implementsTag.ClassName.Loc heritageClause.Flags = p.contextFlags | ast.NodeFlagsReparsed + p.finishReparsedNode(heritageClause) if class.HeritageClauses == nil { heritageClauses := p.newNodeList(implementsTag.ClassName.Loc, p.nodeSlicePool.NewSlice1(heritageClause)) @@ -438,6 +476,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) } else { class.HeritageClauses.Nodes = append(class.HeritageClauses.Nodes, heritageClause) } + p.finishReparsedNode(parent) } case ast.KindJSDocAugmentsTag: if class := getClassLikeData(parent); class != nil && class.HeritageClauses != nil { @@ -452,6 +491,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) for _, typeArg := range source.TypeArguments.Nodes { typeArg.Flags |= ast.NodeFlagsReparsed } + p.finishReparsedNode(target.AsNode()) } return } @@ -521,6 +561,7 @@ func (p *Parser) makeNewCast(t *ast.TypeNode, e *ast.Node, isAssertion bool) *as } assert.Flags = p.contextFlags | ast.NodeFlagsReparsed assert.Loc = core.NewTextRange(e.Pos(), e.End()) + p.finishReparsedNode(assert) return assert } diff --git a/internal/testrunner/compiler_runner.go b/internal/testrunner/compiler_runner.go index be1d3d0d9c..b026db61aa 100644 --- a/internal/testrunner/compiler_runner.go +++ b/internal/testrunner/compiler_runner.go @@ -10,6 +10,7 @@ import ( "strings" "testing" + "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/checker" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/repo" @@ -179,6 +180,7 @@ func (r *CompilerBaselineRunner) runSingleConfigTest(t *testing.T, testName stri // !!! Verify all baselines compilerTest.verifyUnionOrdering(t) + compilerTest.verifyParentPointers(t) } type compilerFileBasedTest struct { @@ -511,6 +513,44 @@ func (c *compilerTest) verifyUnionOrdering(t *testing.T) { }) } +func (c *compilerTest) verifyParentPointers(t *testing.T) { + t.Run("source file parent pointers", func(t *testing.T) { + var parent *ast.Node + var verifier func(n *ast.Node) bool + verifier = func(n *ast.Node) bool { + if n == nil { + return false + } + assert.Assert(t, n.Parent != nil, "parent node does not exist") + elab := "" + if !ast.NodeIsSynthesized(n) { + elab += ast.GetSourceFileOfNode(n).Text()[n.Loc.Pos():n.Loc.End()] + } else { + elab += "!synthetic! no text available" + } + if ((n.Parent.Kind == ast.KindBinaryExpression || n.Parent.Kind == ast.KindPropertyAccessExpression || n.Parent.Kind == ast.KindElementAccessExpression) && (parent.Kind == ast.KindJSExportAssignment || parent.Kind == ast.KindCommonJSExport)) || + ((parent.Kind == ast.KindBinaryExpression || parent.Kind == ast.KindPropertyAccessExpression || parent.Kind == ast.KindElementAccessExpression) && (n.Parent.Kind == ast.KindJSExportAssignment || n.Parent.Kind == ast.KindCommonJSExport)) || + (ast.IsFunctionLike(n.Parent) && ast.IsFunctionLike(parent)) { + // known current violation of parent pointer invariant, ignore (type nodes on js exports/binary expressions, names on signatures) + } else { + assert.Assert(t, n.Parent == parent, "parent node does not match traversed parent: "+n.Kind.String()+": "+elab) + } + oldParent := parent + parent = n + n.ForEachChild(verifier) + parent = oldParent + return false + } + for _, f := range c.result.Program.GetSourceFiles() { + if c.result.Program.IsSourceFileDefaultLibrary(f.Path()) { + continue + } + parent = f.AsNode() + f.AsNode().ForEachChild(verifier) + } + }) +} + func (c *compilerTest) containsUnsupportedOptionsForDiagnostics() bool { if len(c.result.Program.UnsupportedExtensions()) != 0 { return true diff --git a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols index 916f7562f3..c6faa1ec8d 100644 --- a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols @@ -18,5 +18,6 @@ module.exports = { exports.customSymbol2 = Symbol("custom"); >exports : Symbol("file", Decl(file.js, 0, 0)) +>customSymbol2 : Symbol(customSymbol2, Decl(file.js, 5, 2)) >Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols.diff index a3d9141331..05b6d05104 100644 --- a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols.diff @@ -19,6 +19,6 @@ exports.customSymbol2 = Symbol("custom"); ->exports.customSymbol2 : Symbol(customSymbol2, Decl(file.js, 5, 2)) ->exports : Symbol(customSymbol2, Decl(file.js, 5, 2)) -->customSymbol2 : Symbol(customSymbol2, Decl(file.js, 5, 2)) +>exports : Symbol("file", Decl(file.js, 0, 0)) + >customSymbol2 : Symbol(customSymbol2, Decl(file.js, 5, 2)) >Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.types b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.types index 7cf7bc14ae..bdc838d831 100644 --- a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.types +++ b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.types @@ -24,7 +24,7 @@ exports.customSymbol2 = Symbol("custom"); >exports.customSymbol2 = Symbol("custom") : symbol >exports.customSymbol2 : any >exports : typeof import("./file") ->customSymbol2 : any +>customSymbol2 : symbol >Symbol("custom") : symbol >Symbol : SymbolConstructor >"custom" : "custom" diff --git a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols index ec76d78072..c24099df56 100644 --- a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols @@ -5,6 +5,7 @@ module.exports.x = 1; >module.exports : Symbol(export=, Decl(x.js, 0, 21)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(x.js, 0, 21)) +>x : Symbol(x, Decl(x.js, 0, 0)) module.exports = require("./y.js"); >module.exports : Symbol(export=, Decl(x.js, 0, 21)) diff --git a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols.diff index 4f7e0ab0db..af7d240bef 100644 --- a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols.diff @@ -12,6 +12,7 @@ +>module.exports : Symbol(export=, Decl(x.js, 0, 21)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(x.js, 0, 21)) ++>x : Symbol(x, Decl(x.js, 0, 0)) module.exports = require("./y.js"); ->module.exports : Symbol(module.exports, Decl(x.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.types b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.types index 62f3736bfb..ee4e91419b 100644 --- a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.types +++ b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.types @@ -7,7 +7,7 @@ module.exports.x = 1; >module.exports : typeof import("./y.js") >module : { "export=": typeof import("./y.js"); } >exports : typeof import("./y.js") ->x : any +>x : 1 >1 : 1 module.exports = require("./y.js"); diff --git a/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols b/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols index 738988b717..3be97da01d 100644 --- a/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols +++ b/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols @@ -8,5 +8,6 @@ module.exports = function () {}; exports.blah = exports.someProp; >exports : Symbol("bar", Decl(bar.js, 0, 0)) +>blah : Symbol(blah, Decl(bar.js, 0, 32)) >exports : Symbol("bar", Decl(bar.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols.diff b/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols.diff index 0866617f76..cfcf13c667 100644 --- a/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols.diff @@ -13,6 +13,6 @@ exports.blah = exports.someProp; ->exports.blah : Symbol(blah, Decl(bar.js, 0, 32)) ->exports : Symbol(blah, Decl(bar.js, 0, 32)) -->blah : Symbol(blah, Decl(bar.js, 0, 32)) +>exports : Symbol("bar", Decl(bar.js, 0, 0)) + >blah : Symbol(blah, Decl(bar.js, 0, 32)) >exports : Symbol("bar", Decl(bar.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt new file mode 100644 index 0000000000..501d8cad97 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt @@ -0,0 +1,45 @@ +/a.js(21,44): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T1'. +/a.js(22,38): error TS2741: Property 'a' is missing in type '{}' but required in type 'T1'. +/a.js(31,49): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T4'. + + +==== /a.js (3 errors) ==== + /** + * @typedef {Object} T1 + * @property {number} a + */ + + /** + * @typedef {Object} T2 + * @property {"a" | "b"} a + */ + + /** + * @typedef {(x: string) => string} T3 + */ + + /** + * @typedef {Object} T4 + * @property {string} a + */ + + const t1 = /** @satisfies {T1} */ ({ a: 1 }); + const t2 = /** @satisfies {T1} */ ({ a: 1, b: 1 }); + ~ +!!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T1'. + const t3 = /** @satisfies {T1} */ ({}); + ~ +!!! error TS2741: Property 'a' is missing in type '{}' but required in type 'T1'. +!!! related TS2728 /a.js:3:23: 'a' is declared here. + + /** @type {T2} */ + const t4 = /** @satisfies {T2} */ ({ a: "a" }); + + /** @type {(m: string) => string} */ + const t5 = /** @satisfies {T3} */((m) => m.substring(0)); + const t6 = /** @satisfies {[number, number]} */ ([1, 2]); + const t7 = /** @satisfies {T4} */ ({ a: 'test' }); + const t8 = /** @satisfies {T4} */ ({ a: 'test', b: 'test' }); + ~ +!!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T4'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag10.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag10.errors.txt index c6a17d12f4..4b23f0cb68 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag10.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag10.errors.txt @@ -1,13 +1,16 @@ +/a.js(6,5): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type 'Partial>'. /a.js(14,11): error TS2339: Property 'd' does not exist on type '{ a: number; b: string; x: number; }'. -==== /a.js (1 errors) ==== +==== /a.js (2 errors) ==== /** @typedef {"a" | "b" | "c" | "d"} Keys */ const p = /** @satisfies {Partial>} */ ({ a: 0, b: "hello", x: 8 // Should error, 'x' isn't in 'Keys' + ~ +!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type 'Partial>'. }); // Should be OK -- retain info that a is number and b is string diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag4.errors.txt new file mode 100644 index 0000000000..17573f218b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag4.errors.txt @@ -0,0 +1,20 @@ +/a.js(5,43): error TS2741: Property 'a' is missing in type '{}' but required in type 'Foo'. + + +==== /a.js (1 errors) ==== + /** + * @typedef {Object} Foo + * @property {number} a + */ + export default /** @satisfies {Foo} */ ({}); + ~ +!!! error TS2741: Property 'a' is missing in type '{}' but required in type 'Foo'. +!!! related TS2728 /a.js:3:23: 'a' is declared here. + +==== /b.js (0 errors) ==== + /** + * @typedef {Object} Foo + * @property {number} a + */ + + export default /** @satisfies {Foo} */ ({ a: 1 }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag7.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag7.errors.txt index 3a364a6628..509ca8498b 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag7.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag7.errors.txt @@ -1,13 +1,16 @@ +/a.js(6,5): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type 'Record'. /a.js(14,11): error TS2339: Property 'd' does not exist on type '{ a: number; b: string; x: number; }'. -==== /a.js (1 errors) ==== +==== /a.js (2 errors) ==== /** @typedef {"a" | "b" | "c" | "d"} Keys */ const p = /** @satisfies {Record} */ ({ a: 0, b: "hello", x: 8 // Should error, 'x' isn't in 'Keys' + ~ +!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type 'Record'. }) // Should be OK -- retain info that a is number and b is string diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag9.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag9.errors.txt new file mode 100644 index 0000000000..41ef78bd24 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag9.errors.txt @@ -0,0 +1,20 @@ +/a.js(11,26): error TS2353: Object literal may only specify known properties, and 'd' does not exist in type 'Color'. + + +==== /a.js (1 errors) ==== + /** + * @typedef {Object} Color + * @property {number} r + * @property {number} g + * @property {number} b + */ + + // All of these should be Colors, but I only use some of them here. + export const Palette = /** @satisfies {Record} */ ({ + white: { r: 255, g: 255, b: 255 }, + black: { r: 0, g: 0, d: 0 }, // <- oops! 'd' in place of 'b' + ~ +!!! error TS2353: Object literal may only specify known properties, and 'd' does not exist in type 'Color'. + blue: { r: 0, g: 0, b: 255 }, + }); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols index 8c3b8e0421..bfad582d2d 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols +++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols @@ -37,5 +37,6 @@ module.exports.funky = funky; >module.exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) >module : Symbol(module.exports) >exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) +>funky : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24)) >funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29)) diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff index 57e789428e..823745175a 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff @@ -17,8 +17,8 @@ ->module.exports : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24)) ->module : Symbol(module, Decl(commonJSAliasedExport.js, 4, 1)) ->exports : Symbol(module.exports, Decl(commonJSAliasedExport.js, 0, 0)) -->funky : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24)) +>module.exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) +>module : Symbol(module.exports) +>exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) + >funky : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24)) >funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29)) diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types index b4d9bc810d..9fa899723e 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types @@ -45,6 +45,6 @@ module.exports.funky = funky; >module.exports : (ast: any) => any >module : { readonly donkey: (ast: any) => any; } >exports : (ast: any) => any ->funky : any +>funky : (declaration: any) => boolean >funky : (declaration: any) => boolean diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols index bd1cc110ec..41ca988325 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols @@ -30,6 +30,7 @@ module.exports.Strings = Strings; >module.exports : Symbol(Foo, Decl(cls.js, 4, 2)) >module : Symbol(module.exports) >exports : Symbol(Foo, Decl(cls.js, 4, 2)) +>Strings : Symbol(Strings, Decl(cls.js, 6, 21)) >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) === bar.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff index 92f53b9b9c..81e6807cec 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff @@ -17,14 +17,13 @@ ->module.exports : Symbol(Strings, Decl(cls.js, 6, 21)) ->module : Symbol(module, Decl(cls.js, 5, 24)) ->exports : Symbol(module.exports, Decl(cls.js, 0, 0)) -->Strings : Symbol(Strings, Decl(cls.js, 6, 21)) +>module.exports : Symbol(Foo, Decl(cls.js, 4, 2)) +>module : Symbol(module.exports) +>exports : Symbol(Foo, Decl(cls.js, 4, 2)) + >Strings : Symbol(Strings, Decl(cls.js, 6, 21)) >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) - === bar.js === -@@= skipped -18, +16 lines =@@ +@@= skipped -18, +17 lines =@@ >Bar : Symbol(Bar, Decl(bar.js, 0, 0)) module.exports = Bar; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types index d2474b76c9..5cf45c94be 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types @@ -37,7 +37,7 @@ module.exports.Strings = Strings; >module.exports : typeof Foo >module : { Foo: typeof Foo; } >exports : typeof Foo ->Strings : any +>Strings : { a: string; b: string; } >Strings : { a: string; b: string; } === bar.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols index 1ac50eb1ca..edbfc17ea6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols @@ -39,6 +39,7 @@ module.exports.Strings = Strings >module.exports : Symbol(Handler, Decl(source.js, 0, 0)) >module : Symbol(module.exports) >exports : Symbol(Handler, Decl(source.js, 0, 0)) +>Strings : Symbol(Strings, Decl(source.js, 14, 25)) >Strings : Symbol(Strings, Decl(source.js, 9, 5)) /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff index 073884c653..cb7eb9a942 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff @@ -47,10 +47,8 @@ ->module.exports : Symbol(Strings, Decl(source.js, 14, 25)) ->module : Symbol(module, Decl(source.js, 12, 1)) ->exports : Symbol(module.exports, Decl(source.js, 0, 0)) -->Strings : Symbol(Strings, Decl(source.js, 14, 25)) +>module.exports : Symbol(Handler, Decl(source.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(Handler, Decl(source.js, 0, 0)) + >Strings : Symbol(Strings, Decl(source.js, 14, 25)) >Strings : Symbol(Strings, Decl(source.js, 9, 5)) - - /** \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types index 3901dc7659..160a039d38 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types @@ -48,7 +48,7 @@ module.exports.Strings = Strings >module.exports : typeof Handler >module : { Handler: typeof Handler; } >exports : typeof Handler ->Strings : any +>Strings : { a: string; b: string; } >Strings : { a: string; b: string; } /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols index b9ba0605bd..5f4b9038b2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols @@ -18,6 +18,7 @@ module.exports.memberName = "thing"; >module.exports : Symbol(validate, Decl(exporter.js, 0, 0)) >module : Symbol(module.exports) >exports : Symbol(validate, Decl(exporter.js, 0, 0)) +>memberName : Symbol(memberName, Decl(index.js, 2, 27)) === exporter.js === function validate() {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols.diff index 7d0dc8fb9a..8cdda24efc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols.diff @@ -25,10 +25,9 @@ ->module.exports : Symbol(memberName, Decl(index.js, 2, 27)) ->module : Symbol(module, Decl(index.js, 0, 32)) ->exports : Symbol(module.exports, Decl(index.js, 0, 0)) -->memberName : Symbol(memberName, Decl(index.js, 2, 27)) +>module.exports : Symbol(validate, Decl(exporter.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(validate, Decl(exporter.js, 0, 0)) + >memberName : Symbol(memberName, Decl(index.js, 2, 27)) - === exporter.js === - function validate() {} \ No newline at end of file + === exporter.js === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.types index b61fc27bfe..bfa141dd6c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.types @@ -22,7 +22,7 @@ module.exports.memberName = "thing"; >module.exports : () => void >module : { validate(): void; } >exports : () => void ->memberName : any +>memberName : "thing" >"thing" : "thing" === exporter.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols index d41006552a..42fcda9dbb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols @@ -23,6 +23,7 @@ module.exports.Sub = class { >module.exports : Symbol(exports, Decl(index.js, 0, 16)) >module : Symbol(module.exports) >exports : Symbol(exports, Decl(index.js, 0, 16)) +>Sub : Symbol(Sub, Decl(index.js, 7, 1)) constructor() { this.instance = new module.exports(10); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols.diff index ae78b1e9d9..ed8774b8e7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols.diff @@ -30,10 +30,10 @@ ->module.exports : Symbol(Sub, Decl(index.js, 7, 1)) ->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 : Symbol(module.exports) +>exports : Symbol(exports, Decl(index.js, 0, 16)) + >Sub : Symbol(Sub, Decl(index.js, 7, 1)) constructor() { this.instance = new module.exports(10); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types index c652b6029e..0a80cd5e49 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types @@ -30,7 +30,7 @@ module.exports.Sub = class { >module.exports : typeof import(".") >module : { "\uFFFDclass": typeof import("."); } >exports : typeof import(".") ->Sub : any +>Sub : typeof Sub >class { constructor() { this.instance = new module.exports(10); }} : typeof Sub constructor() { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols index 4fcf0449c5..a1bd4f9755 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols @@ -32,5 +32,6 @@ module.exports.Another = Q; >module.exports : Symbol(Q, Decl(index.js, 6, 16)) >module : Symbol(module.exports) >exports : Symbol(Q, Decl(index.js, 6, 16)) +>Another : Symbol(Another, Decl(index.js, 10, 1)) >Q : Symbol(Q, Decl(index.js, 2, 1)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols.diff index 6ca85363f6..9d9f791cdc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols.diff @@ -39,8 +39,8 @@ ->module.exports : Symbol(Another, Decl(index.js, 10, 1)) ->module : Symbol(module, Decl(index.js, 5, 1)) ->exports : Symbol(module.exports, Decl(index.js, 0, 0)) -->Another : Symbol(Another, Decl(index.js, 10, 1)) +>module.exports : Symbol(Q, Decl(index.js, 6, 16)) +>module : Symbol(module.exports) +>exports : Symbol(Q, Decl(index.js, 6, 16)) + >Another : Symbol(Another, Decl(index.js, 10, 1)) >Q : Symbol(Q, Decl(index.js, 2, 1)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types index 5df299934a..832f5e4420 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types @@ -40,6 +40,6 @@ module.exports.Another = Q; >module.exports : typeof import(".") >module : { Q: typeof import("."); } >exports : typeof import(".") ->Another : any +>Another : typeof Q >Q : typeof Q diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols index 7d970daaef..b0e05682b1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols @@ -21,4 +21,5 @@ module.exports.additional = 20; >module.exports : Symbol(export=, Decl(index.js, 3, 1)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(index.js, 3, 1)) +>additional : Symbol(additional, Decl(index.js, 5, 27)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols.diff index b7b0d03fcd..2a34a4e086 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols.diff @@ -25,7 +25,7 @@ ->module.exports : Symbol(additional, Decl(index.js, 5, 27)) ->module : Symbol(module, Decl(index.js, 3, 1)) ->exports : Symbol(module.exports, Decl(index.js, 0, 0)) -->additional : Symbol(additional, Decl(index.js, 5, 27)) +>module.exports : Symbol(export=, Decl(index.js, 3, 1)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(index.js, 3, 1)) + >additional : Symbol(additional, Decl(index.js, 5, 27)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.types index d8d5961fa5..46201f1ec5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.types @@ -27,6 +27,6 @@ module.exports.additional = 20; >module.exports : Foo >module : { "export=": Foo; } >exports : Foo ->additional : any +>additional : 20 >20 : 20 diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols index 472779ff9e..7309a8814b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols @@ -17,6 +17,7 @@ module.exports.Sub = function() { >module.exports : Symbol(export=, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 0, 0)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 0, 0)) +>Sub : Symbol(Sub, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 5, 1)) this.instance = new module.exports(10); >module.exports : Symbol(export=, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols.diff index c239422c61..bed12d2407 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols.diff @@ -26,6 +26,7 @@ +>module.exports : Symbol(export=, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 0, 0)) ++>Sub : Symbol(Sub, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 5, 1)) this.instance = new module.exports(10); ->this.instance : Symbol(Sub.instance, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 6, 33)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types index 175998a419..3c764a6b5d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types @@ -27,7 +27,7 @@ module.exports.Sub = function() { >module.exports : (p: any) => void >module : { "export=": (p: any) => void; } >exports : (p: any) => void ->Sub : any +>Sub : () => void >function() { this.instance = new module.exports(10);} : () => void this.instance = new module.exports(10); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols index b2e68c2f07..1dcdb59470 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols @@ -33,5 +33,6 @@ module.exports.Strings = Strings; >module.exports : Symbol(export=, Decl(index.js, 3, 2)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(index.js, 3, 2)) +>Strings : Symbol(Strings, Decl(index.js, 10, 2)) >Strings : Symbol(Strings, Decl(index.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols.diff index d625cf320c..321f9314d2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols.diff @@ -19,8 +19,8 @@ ->module.exports : Symbol(Strings, Decl(index.js, 10, 2)) ->module : Symbol(module, Decl(index.js, 3, 2)) ->exports : Symbol(module.exports, Decl(index.js, 0, 0)) -->Strings : Symbol(Strings, Decl(index.js, 10, 2)) +>module.exports : Symbol(export=, Decl(index.js, 3, 2)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(index.js, 3, 2)) + >Strings : Symbol(Strings, Decl(index.js, 10, 2)) >Strings : Symbol(Strings, Decl(index.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types index 934820272b..ba5dc7573c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types @@ -44,6 +44,6 @@ module.exports.Strings = Strings; >module.exports : { thing: string; also: string; desc: { item: string; }; } >module : { "export=": { thing: string; also: string; desc: { item: string; }; }; } >exports : { thing: string; also: string; desc: { item: string; }; } ->Strings : any +>Strings : { a: string; b: string; } >Strings : { a: string; b: string; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols index d03e2da5ce..7fa53c9314 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols @@ -25,6 +25,7 @@ function foo() { } exports.methods = m; >exports : Symbol("index", Decl(index.js, 0, 0)) +>methods : Symbol(methods, Decl(index.js, 7, 5)) >m : Symbol(m, Decl(index.js, 5, 9)) } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols.diff index 10a3348251..622ebe70e3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols.diff @@ -16,7 +16,7 @@ } exports.methods = m; ->exports : Symbol(methods, Decl(index.js, 7, 5)) -->methods : Symbol(methods, Decl(index.js, 7, 5)) +>exports : Symbol("index", Decl(index.js, 0, 0)) + >methods : Symbol(methods, Decl(index.js, 7, 5)) >m : Symbol(m, Decl(index.js, 5, 9)) - } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types index cd082c13a1..eb97480cb0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types @@ -41,7 +41,7 @@ function foo() { >exports.methods = m : () => void >exports.methods : any >exports : typeof import(".") ->methods : any +>methods : () => void >m : () => void } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols index b68cc7cae5..e6f5b059ca 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols @@ -24,5 +24,6 @@ module.exports.Strings = Strings; >module.exports : Symbol(Foo, Decl(cls.js, 3, 2)) >module : Symbol(module.exports) >exports : Symbol(Foo, Decl(cls.js, 3, 2)) +>Strings : Symbol(Strings, Decl(cls.js, 5, 21)) >Strings : Symbol(Strings, Decl(cls.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff index fbda01c9ed..9dd6a0c1a3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff @@ -17,8 +17,8 @@ ->module.exports : Symbol(Strings, Decl(cls.js, 5, 21)) ->module : Symbol(module, Decl(cls.js, 4, 12)) ->exports : Symbol(module.exports, Decl(cls.js, 0, 0)) -->Strings : Symbol(Strings, Decl(cls.js, 5, 21)) +>module.exports : Symbol(Foo, Decl(cls.js, 3, 2)) +>module : Symbol(module.exports) +>exports : Symbol(Foo, Decl(cls.js, 3, 2)) + >Strings : Symbol(Strings, Decl(cls.js, 5, 21)) >Strings : Symbol(Strings, Decl(cls.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types index 2bc348dc16..2232cf861d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types @@ -30,6 +30,6 @@ module.exports.Strings = Strings; >module.exports : typeof Foo >module : { Foo: typeof Foo; } >exports : typeof Foo ->Strings : any +>Strings : { a: string; b: string; } >Strings : { a: string; b: string; } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt deleted file mode 100644 index 7dc6690cfb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt +++ /dev/null @@ -1,112 +0,0 @@ -a.js(2,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -a.js(14,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -a.js(26,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -a.js(37,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -a.js(48,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -a.js(59,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -a.js(68,18): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class - - -==== a.js (7 errors) ==== - /** - * @template const T - ~~~~~ -!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class - * @param {T} x - * @returns {T} - */ - function f1(x) { - return x; - } - const t1 = f1("a"); - const t2 = f1(["a", ["b", "c"]]); - const t3 = f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); - - /** - * @template const T, U - ~~~~~ -!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class - * @param {T} x - * @returns {T} - */ - function f2(x) { - return x; - }; - const t4 = f2('a'); - const t5 = f2(['a', ['b', 'c']]); - const t6 = f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); - - /** - * @template const T - ~~~~~ -!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class - * @param {T} x - * @returns {T[]} - */ - function f3(x) { - return [x]; - } - const t7 = f3("hello"); - const t8 = f3("hello"); - - /** - * @template const T - ~~~~~ -!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class - * @param {[T, T]} x - * @returns {T} - */ - function f4(x) { - return x[0]; - } - const t9 = f4([[1, "x"], [2, "y"]]); - const t10 = f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]); - - /** - * @template const T - ~~~~~ -!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class - * @param {{ x: T, y: T}} obj - * @returns {T} - */ - function f5(obj) { - return obj.x; - } - const t11 = f5({ x: [1, "x"], y: [2, "y"] }); - const t12 = f5({ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } }); - - /** - * @template const T - ~~~~~ -!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class - */ - class C { - /** - * @param {T} x - */ - constructor(x) {} - - /** - * @template const U - ~~~~~ -!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class - * @param {U} x - */ - foo(x) { - return x; - } - } - - const t13 = new C({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); - const t14 = t13.foo(["a", ["b", "c"]]); - - /** - * @template {readonly unknown[]} const T - * @param {T} args - * @returns {T} - */ - function f6(...args) { - return args; - } - const t15 = f6(1, 'b', { a: 1, b: 'x' }); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt index dcc4c36af3..6d5770242e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt @@ -1,9 +1,8 @@ a.js(2,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -a.js(7,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class a.js(12,14): error TS1273: 'private' modifier cannot appear on a type parameter -==== a.js (3 errors) ==== +==== a.js (2 errors) ==== /** * @template const T ~~~~~ @@ -13,8 +12,6 @@ a.js(12,14): error TS1273: 'private' modifier cannot appear on a type parameter /** * @template const T - ~~~~~ -!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class */ class C { } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt index 7d3cba7e4f..5c9e0ed33d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt @@ -1,30 +1,28 @@ a.js(2,14): error TS1274: 'out' modifier can only appear on a type parameter of a class, interface or type alias -a.js(4,15): error TS2304: Cannot find name 'T'. a.js(18,1): error TS2322: Type 'Covariant' is not assignable to type 'Covariant'. Type 'unknown' is not assignable to type 'string'. a.js(21,14): error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias -a.js(23,19): error TS2304: Cannot find name 'T'. a.js(36,1): error TS2322: Type 'Contravariant' is not assignable to type 'Contravariant'. Type 'unknown' is not assignable to type 'string'. a.js(40,14): error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias -a.js(42,19): error TS2304: Cannot find name 'T'. -a.js(42,25): error TS2304: Cannot find name 'T'. a.js(55,1): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. - Type 'unknown' is not assignable to type 'string'. + Types of property 'f' are incompatible. + Type '(x: string) => string' is not assignable to type '(x: unknown) => unknown'. + Types of parameters 'x' and 'x' are incompatible. + Type 'unknown' is not assignable to type 'string'. a.js(56,1): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. - Type 'unknown' is not assignable to type 'string'. + The types returned by 'f(...)' are incompatible between these types. + Type 'unknown' is not assignable to type 'string'. a.js(59,14): error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias -==== a.js (12 errors) ==== +==== a.js (8 errors) ==== /** * @template out T ~~~ !!! error TS1274: 'out' modifier can only appear on a type parameter of a class, interface or type alias * @typedef {Object} Covariant * @property {T} x - ~ -!!! error TS2304: Cannot find name 'T'. */ /** @@ -49,8 +47,6 @@ a.js(59,14): error TS1274: 'in' modifier can only appear on a type parameter of !!! error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias * @typedef {Object} Contravariant * @property {(x: T) => void} f - ~ -!!! error TS2304: Cannot find name 'T'. */ /** @@ -75,10 +71,6 @@ a.js(59,14): error TS1274: 'in' modifier can only appear on a type parameter of !!! error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias * @typedef {Object} Invariant * @property {(x: T) => T} f - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'T'. */ /** @@ -94,11 +86,15 @@ a.js(59,14): error TS1274: 'in' modifier can only appear on a type parameter of super_invariant = sub_invariant; // Error ~~~~~~~~~~~~~~~ !!! error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. -!!! error TS2322: Type 'unknown' is not assignable to type 'string'. +!!! error TS2322: Types of property 'f' are incompatible. +!!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: unknown) => unknown'. +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2322: Type 'unknown' is not assignable to type 'string'. sub_invariant = super_invariant; // Error ~~~~~~~~~~~~~ !!! error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. -!!! error TS2322: Type 'unknown' is not assignable to type 'string'. +!!! error TS2322: The types returned by 'f(...)' are incompatible between these types. +!!! error TS2322: Type 'unknown' is not assignable to type 'string'. /** * @template in T diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.types index 535be9edb4..d085ff77d0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.types @@ -46,20 +46,20 @@ sub_covariant = super_covariant; // Error */ let super_contravariant = { f: (x) => {} }; >super_contravariant : Contravariant ->{ f: (x) => {} } : { f: (x: T) => void; } ->f : (x: T) => void ->(x) => {} : (x: T) => void ->x : T +>{ f: (x) => {} } : { f: (x: unknown) => void; } +>f : (x: unknown) => void +>(x) => {} : (x: unknown) => void +>x : unknown /** * @type {Contravariant} */ let sub_contravariant = { f: (x) => {} }; >sub_contravariant : Contravariant ->{ f: (x) => {} } : { f: (x: T) => void; } ->f : (x: T) => void ->(x) => {} : (x: T) => void ->x : T +>{ f: (x) => {} } : { f: (x: string) => void; } +>f : (x: string) => void +>(x) => {} : (x: string) => void +>x : string super_contravariant = sub_contravariant; // Error >super_contravariant = sub_contravariant : Contravariant @@ -82,20 +82,20 @@ sub_contravariant = super_contravariant; */ let super_invariant = { f: (x) => {} }; >super_invariant : Invariant ->{ f: (x) => {} } : { f: (x: T) => void; } ->f : (x: T) => void ->(x) => {} : (x: T) => void ->x : T +>{ f: (x) => {} } : { f: (x: unknown) => void; } +>f : (x: unknown) => void +>(x) => {} : (x: unknown) => void +>x : unknown /** * @type {Invariant} */ let sub_invariant = { f: (x) => { return "" } }; >sub_invariant : Invariant ->{ f: (x) => { return "" } } : { f: (x: T) => string; } ->f : (x: T) => string ->(x) => { return "" } : (x: T) => string ->x : T +>{ f: (x) => { return "" } } : { f: (x: string) => string; } +>f : (x: string) => string +>(x) => { return "" } : (x: string) => string +>x : string >"" : "" super_invariant = sub_invariant; // Error diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols index db9cea396e..2bba22ef22 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols @@ -75,6 +75,7 @@ exportsAlias.func1 = function () { }; exports.func2 = function () { }; >exports : Symbol("b", Decl(b.js, 0, 0)) +>func2 : Symbol(func2, Decl(b.js, 1, 37)) var moduleExportsAlias = module.exports; >moduleExportsAlias : Symbol(moduleExportsAlias, Decl(b.js, 4, 3)) @@ -89,6 +90,7 @@ module.exports.func4 = function () { }; >module.exports : Symbol(export=, Decl(b.js, 41, 40)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(b.js, 41, 40)) +>func4 : Symbol(func4, Decl(b.js, 5, 43)) var multipleDeclarationAlias1 = exports = module.exports; >multipleDeclarationAlias1 : Symbol(multipleDeclarationAlias1, Decl(b.js, 8, 3)) @@ -160,11 +162,13 @@ exports = module.exports = someOtherVariable = {}; exports.func11 = function () { }; >exports : Symbol("b", Decl(b.js, 0, 0)) +>func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50)) module.exports.func12 = function () { }; >module.exports : Symbol(export=, Decl(b.js, 41, 40)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(b.js, 41, 40)) +>func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) exports = module.exports = someOtherVariable = {}; >exports : Symbol("b", Decl(b.js, 0, 0)) @@ -175,11 +179,13 @@ exports = module.exports = someOtherVariable = {}; exports.func11 = function () { }; >exports : Symbol("b", Decl(b.js, 0, 0)) +>func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50)) module.exports.func12 = function () { }; >module.exports : Symbol(export=, Decl(b.js, 41, 40)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(b.js, 41, 40)) +>func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) exports = module.exports = {}; >exports : Symbol("b", Decl(b.js, 0, 0)) @@ -189,11 +195,13 @@ exports = module.exports = {}; exports.func13 = function () { }; >exports : Symbol("b", Decl(b.js, 0, 0)) +>func13 : Symbol(func13, Decl(b.js, 35, 30)) module.exports.func14 = function () { }; >module.exports : Symbol(export=, Decl(b.js, 41, 40)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(b.js, 41, 40)) +>func14 : Symbol(func14, Decl(b.js, 36, 33)) exports = module.exports = {}; >exports : Symbol("b", Decl(b.js, 0, 0)) @@ -203,11 +211,13 @@ exports = module.exports = {}; exports.func15 = function () { }; >exports : Symbol("b", Decl(b.js, 0, 0)) +>func15 : Symbol(func15, Decl(b.js, 39, 30)) module.exports.func16 = function () { }; >module.exports : Symbol(export=, Decl(b.js, 41, 40)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(b.js, 41, 40)) +>func16 : Symbol(func16, Decl(b.js, 40, 33)) module.exports = exports = {}; >module.exports : Symbol(export=, Decl(b.js, 41, 40)) @@ -217,11 +227,13 @@ module.exports = exports = {}; exports.func17 = function () { }; >exports : Symbol("b", Decl(b.js, 0, 0)) +>func17 : Symbol(func17, Decl(b.js, 43, 30)) module.exports.func18 = function () { }; >module.exports : Symbol(export=, Decl(b.js, 41, 40)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(b.js, 41, 40)) +>func18 : Symbol(func18, Decl(b.js, 44, 33)) module.exports = {}; >module.exports : Symbol(export=, Decl(b.js, 41, 40)) @@ -230,10 +242,12 @@ module.exports = {}; exports.func19 = function () { }; >exports : Symbol("b", Decl(b.js, 0, 0)) +>func19 : Symbol(func19, Decl(b.js, 47, 20)) module.exports.func20 = function () { }; >module.exports : Symbol(export=, Decl(b.js, 41, 40)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(b.js, 41, 40)) +>func20 : Symbol(func20, Decl(b.js, 48, 33)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols.diff index 7c68f5c1af..997672a24d 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols.diff @@ -116,8 +116,8 @@ exports.func2 = function () { }; ->exports.func2 : Symbol(func2, Decl(b.js, 1, 37)) ->exports : Symbol(func2, Decl(b.js, 1, 37)) -->func2 : Symbol(func2, Decl(b.js, 1, 37)) +>exports : Symbol("b", Decl(b.js, 0, 0)) + >func2 : Symbol(func2, Decl(b.js, 1, 37)) var moduleExportsAlias = module.exports; >moduleExportsAlias : Symbol(moduleExportsAlias, Decl(b.js, 4, 3)) @@ -138,10 +138,10 @@ ->module.exports : Symbol(func4, Decl(b.js, 5, 43)) ->module : Symbol(module, Decl(b.js, 4, 24)) ->exports : Symbol(module.exports, Decl(b.js, 0, 0)) -->func4 : Symbol(func4, Decl(b.js, 5, 43)) +>module.exports : Symbol(export=, Decl(b.js, 41, 40)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(b.js, 41, 40)) + >func4 : Symbol(func4, Decl(b.js, 5, 43)) var multipleDeclarationAlias1 = exports = module.exports; >multipleDeclarationAlias1 : Symbol(multipleDeclarationAlias1, Decl(b.js, 8, 3)) @@ -175,7 +175,7 @@ var someOtherVariable; >someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3)) -@@= skipped -60, +48 lines =@@ +@@= skipped -60, +50 lines =@@ >exports : Symbol("b", Decl(b.js, 0, 0)) multipleDeclarationAlias3.func7 = function () { }; @@ -227,74 +227,58 @@ ->multipleDeclarationAlias6.func10 : Symbol(func10, Decl(b.js, 24, 62)) >multipleDeclarationAlias6 : Symbol(multipleDeclarationAlias6, Decl(b.js, 24, 3)) ->func10 : Symbol(func10, Decl(b.js, 24, 62)) -- --exports = module.exports = someOtherVariable = {}; -->exports : Symbol("b", Decl(b.js, 0, 0)) + + exports = module.exports = someOtherVariable = {}; + >exports : Symbol("b", Decl(b.js, 0, 0)) ->module.exports : Symbol(module.exports, Decl(b.js, 0, 0)) ->module : Symbol(module, Decl(b.js, 4, 24)) ->exports : Symbol(module.exports, Decl(b.js, 0, 0)) -->someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3)) -- --exports.func11 = function () { }; ++>module.exports : Symbol(export=, Decl(b.js, 41, 40)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(b.js, 41, 40)) + >someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3)) + + exports.func11 = function () { }; ->exports.func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50)) ->exports : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50)) -->func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50)) -- --module.exports.func12 = function () { }; ++>exports : Symbol("b", Decl(b.js, 0, 0)) + >func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50)) + + module.exports.func12 = function () { }; ->module.exports.func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) ->module.exports : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) ->module : Symbol(module, Decl(b.js, 4, 24)) ->exports : Symbol(module.exports, Decl(b.js, 0, 0)) -->func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) -- --exports = module.exports = someOtherVariable = {}; -->exports : Symbol("b", Decl(b.js, 0, 0)) ++>module.exports : Symbol(export=, Decl(b.js, 41, 40)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(b.js, 41, 40)) + >func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) + + exports = module.exports = someOtherVariable = {}; + >exports : Symbol("b", Decl(b.js, 0, 0)) ->module.exports : Symbol(module.exports, Decl(b.js, 0, 0)) ->module : Symbol(module, Decl(b.js, 4, 24)) ->exports : Symbol(module.exports, Decl(b.js, 0, 0)) -->someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3)) -- --exports.func11 = function () { }; ++>module.exports : Symbol(export=, Decl(b.js, 41, 40)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(b.js, 41, 40)) + >someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3)) + + exports.func11 = function () { }; ->exports.func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50)) ->exports : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50)) -->func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50)) -- --module.exports.func12 = function () { }; ++>exports : Symbol("b", Decl(b.js, 0, 0)) + >func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50)) + + module.exports.func12 = function () { }; ->module.exports.func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) ->module.exports : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) ->module : Symbol(module, Decl(b.js, 4, 24)) ->exports : Symbol(module.exports, Decl(b.js, 0, 0)) -->func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) -+ -+exports = module.exports = someOtherVariable = {}; -+>exports : Symbol("b", Decl(b.js, 0, 0)) -+>module.exports : Symbol(export=, Decl(b.js, 41, 40)) -+>module : Symbol(module.exports) -+>exports : Symbol(export=, Decl(b.js, 41, 40)) -+>someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3)) -+ -+exports.func11 = function () { }; -+>exports : Symbol("b", Decl(b.js, 0, 0)) -+ -+module.exports.func12 = function () { }; -+>module.exports : Symbol(export=, Decl(b.js, 41, 40)) -+>module : Symbol(module.exports) -+>exports : Symbol(export=, Decl(b.js, 41, 40)) -+ -+exports = module.exports = someOtherVariable = {}; -+>exports : Symbol("b", Decl(b.js, 0, 0)) -+>module.exports : Symbol(export=, Decl(b.js, 41, 40)) -+>module : Symbol(module.exports) -+>exports : Symbol(export=, Decl(b.js, 41, 40)) -+>someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3)) -+ -+exports.func11 = function () { }; -+>exports : Symbol("b", Decl(b.js, 0, 0)) -+ -+module.exports.func12 = function () { }; +>module.exports : Symbol(export=, Decl(b.js, 41, 40)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(b.js, 41, 40)) + >func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) exports = module.exports = {}; >exports : Symbol("b", Decl(b.js, 0, 0)) @@ -308,18 +292,18 @@ exports.func13 = function () { }; ->exports.func13 : Symbol(func13, Decl(b.js, 35, 30)) ->exports : Symbol(func13, Decl(b.js, 35, 30)) -->func13 : Symbol(func13, Decl(b.js, 35, 30)) +>exports : Symbol("b", Decl(b.js, 0, 0)) + >func13 : Symbol(func13, Decl(b.js, 35, 30)) module.exports.func14 = function () { }; ->module.exports.func14 : Symbol(func14, Decl(b.js, 36, 33)) ->module.exports : Symbol(func14, Decl(b.js, 36, 33)) ->module : Symbol(module, Decl(b.js, 4, 24)) ->exports : Symbol(module.exports, Decl(b.js, 0, 0)) -->func14 : Symbol(func14, Decl(b.js, 36, 33)) +>module.exports : Symbol(export=, Decl(b.js, 41, 40)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(b.js, 41, 40)) + >func14 : Symbol(func14, Decl(b.js, 36, 33)) exports = module.exports = {}; >exports : Symbol("b", Decl(b.js, 0, 0)) @@ -333,18 +317,18 @@ exports.func15 = function () { }; ->exports.func15 : Symbol(func15, Decl(b.js, 39, 30)) ->exports : Symbol(func15, Decl(b.js, 39, 30)) -->func15 : Symbol(func15, Decl(b.js, 39, 30)) +>exports : Symbol("b", Decl(b.js, 0, 0)) + >func15 : Symbol(func15, Decl(b.js, 39, 30)) module.exports.func16 = function () { }; ->module.exports.func16 : Symbol(func16, Decl(b.js, 40, 33)) ->module.exports : Symbol(func16, Decl(b.js, 40, 33)) ->module : Symbol(module, Decl(b.js, 4, 24)) ->exports : Symbol(module.exports, Decl(b.js, 0, 0)) -->func16 : Symbol(func16, Decl(b.js, 40, 33)) +>module.exports : Symbol(export=, Decl(b.js, 41, 40)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(b.js, 41, 40)) + >func16 : Symbol(func16, Decl(b.js, 40, 33)) module.exports = exports = {}; ->module.exports : Symbol(module.exports, Decl(b.js, 0, 0)) @@ -358,18 +342,18 @@ exports.func17 = function () { }; ->exports.func17 : Symbol(func17, Decl(b.js, 43, 30)) ->exports : Symbol(func17, Decl(b.js, 43, 30)) -->func17 : Symbol(func17, Decl(b.js, 43, 30)) +>exports : Symbol("b", Decl(b.js, 0, 0)) + >func17 : Symbol(func17, Decl(b.js, 43, 30)) module.exports.func18 = function () { }; ->module.exports.func18 : Symbol(func18, Decl(b.js, 44, 33)) ->module.exports : Symbol(func18, Decl(b.js, 44, 33)) ->module : Symbol(module, Decl(b.js, 4, 24)) ->exports : Symbol(module.exports, Decl(b.js, 0, 0)) -->func18 : Symbol(func18, Decl(b.js, 44, 33)) +>module.exports : Symbol(export=, Decl(b.js, 41, 40)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(b.js, 41, 40)) + >func18 : Symbol(func18, Decl(b.js, 44, 33)) module.exports = {}; ->module.exports : Symbol(module.exports, Decl(b.js, 0, 0)) @@ -382,16 +366,16 @@ exports.func19 = function () { }; ->exports.func19 : Symbol(func19, Decl(b.js, 47, 20)) ->exports : Symbol(func19, Decl(b.js, 47, 20)) -->func19 : Symbol(func19, Decl(b.js, 47, 20)) +>exports : Symbol("b", Decl(b.js, 0, 0)) + >func19 : Symbol(func19, Decl(b.js, 47, 20)) module.exports.func20 = function () { }; ->module.exports.func20 : Symbol(func20, Decl(b.js, 48, 33)) ->module.exports : Symbol(func20, Decl(b.js, 48, 33)) ->module : Symbol(module, Decl(b.js, 4, 24)) ->exports : Symbol(module.exports, Decl(b.js, 0, 0)) -->func20 : Symbol(func20, Decl(b.js, 48, 33)) +>module.exports : Symbol(export=, Decl(b.js, 41, 40)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(b.js, 41, 40)) + >func20 : Symbol(func20, Decl(b.js, 48, 33)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias.types b/testdata/baselines/reference/submodule/conformance/moduleExportAlias.types index c1a0b90c39..fbeca727fe 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias.types @@ -121,7 +121,7 @@ exports.func2 = function () { }; >exports.func2 = function () { } : () => void >exports.func2 : any >exports : typeof import("./b") ->func2 : any +>func2 : () => void >function () { } : () => void var moduleExportsAlias = module.exports; @@ -143,7 +143,7 @@ module.exports.func4 = function () { }; >module.exports : {} >module : { "export=": {}; } >exports : {} ->func4 : any +>func4 : () => void >function () { } : () => void var multipleDeclarationAlias1 = exports = module.exports; @@ -256,7 +256,7 @@ exports.func11 = function () { }; >exports.func11 = function () { } : () => void >exports.func11 : any >exports : typeof import("./b") ->func11 : any +>func11 : () => void >function () { } : () => void module.exports.func12 = function () { }; @@ -265,7 +265,7 @@ module.exports.func12 = function () { }; >module.exports : {} >module : { "export=": {}; } >exports : {} ->func12 : any +>func12 : () => void >function () { } : () => void exports = module.exports = someOtherVariable = {}; @@ -283,7 +283,7 @@ exports.func11 = function () { }; >exports.func11 = function () { } : () => void >exports.func11 : any >exports : typeof import("./b") ->func11 : any +>func11 : () => void >function () { } : () => void module.exports.func12 = function () { }; @@ -292,7 +292,7 @@ module.exports.func12 = function () { }; >module.exports : {} >module : { "export=": {}; } >exports : {} ->func12 : any +>func12 : () => void >function () { } : () => void exports = module.exports = {}; @@ -308,7 +308,7 @@ exports.func13 = function () { }; >exports.func13 = function () { } : () => void >exports.func13 : any >exports : typeof import("./b") ->func13 : any +>func13 : () => void >function () { } : () => void module.exports.func14 = function () { }; @@ -317,7 +317,7 @@ module.exports.func14 = function () { }; >module.exports : {} >module : { "export=": {}; } >exports : {} ->func14 : any +>func14 : () => void >function () { } : () => void exports = module.exports = {}; @@ -333,7 +333,7 @@ exports.func15 = function () { }; >exports.func15 = function () { } : () => void >exports.func15 : any >exports : typeof import("./b") ->func15 : any +>func15 : () => void >function () { } : () => void module.exports.func16 = function () { }; @@ -342,7 +342,7 @@ module.exports.func16 = function () { }; >module.exports : {} >module : { "export=": {}; } >exports : {} ->func16 : any +>func16 : () => void >function () { } : () => void module.exports = exports = {}; @@ -358,7 +358,7 @@ exports.func17 = function () { }; >exports.func17 = function () { } : () => void >exports.func17 : any >exports : typeof import("./b") ->func17 : any +>func17 : () => void >function () { } : () => void module.exports.func18 = function () { }; @@ -367,7 +367,7 @@ module.exports.func18 = function () { }; >module.exports : {} >module : { "export=": {}; } >exports : {} ->func18 : any +>func18 : () => void >function () { } : () => void module.exports = {}; @@ -381,7 +381,7 @@ exports.func19 = function () { }; >exports.func19 = function () { } : () => void >exports.func19 : any >exports : typeof import("./b") ->func19 : any +>func19 : () => void >function () { } : () => void module.exports.func20 = function () { }; @@ -390,7 +390,7 @@ module.exports.func20 = function () { }; >module.exports : {} >module : { "export=": {}; } >exports : {} ->func20 : any +>func20 : () => void >function () { } : () => void diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols index b87494dc53..707190491a 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols @@ -17,5 +17,6 @@ module.exports.D = class D { } >module.exports : Symbol(C, Decl(bug24024.js, 2, 16)) >module : Symbol(module.exports) >exports : Symbol(C, Decl(bug24024.js, 2, 16)) +>D : Symbol(D, Decl(bug24024.js, 2, 27)) >D : Symbol(D, Decl(bug24024.js, 3, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols.diff index eb88743e90..043c63a645 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols.diff @@ -23,4 +23,5 @@ +>module.exports : Symbol(C, Decl(bug24024.js, 2, 16)) +>module : Symbol(module.exports) +>exports : Symbol(C, Decl(bug24024.js, 2, 16)) ++>D : Symbol(D, Decl(bug24024.js, 2, 27)) +>D : Symbol(D, Decl(bug24024.js, 3, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.types b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.types index 5bdcdbf1b4..0a70bddce0 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.types @@ -22,7 +22,7 @@ module.exports.D = class D { } >module.exports : typeof wat >module : { C: typeof wat; } >exports : typeof wat ->D : any +>D : typeof D >class D { } : typeof D >D : typeof D diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasElementAccessExpression.types b/testdata/baselines/reference/submodule/conformance/moduleExportAliasElementAccessExpression.types index e8e3ae4cbe..7b52d06f08 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasElementAccessExpression.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasElementAccessExpression.types @@ -8,7 +8,7 @@ exports["D"] = D; >exports["D"] = D : () => void >exports["D"] : () => void >exports : typeof import("./moduleExportAliasElementAccessExpression") ->"D" : "D" +>"D" : () => void >D : () => void // (the only package I could find that uses spaces in identifiers is webidl-conversions) @@ -16,6 +16,6 @@ exports["Does not work yet"] = D; >exports["Does not work yet"] = D : () => void >exports["Does not work yet"] : () => void >exports : typeof import("./moduleExportAliasElementAccessExpression") ->"Does not work yet" : "Does not work yet" +>"Does not work yet" : () => void >D : () => void diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols index 7f1206e1a5..6f8bcd86e4 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols @@ -3,6 +3,7 @@ === bug28014.js === exports.version = 1 >exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) +>version : Symbol(version, Decl(bug28014.js, 0, 0)) function alias() { } >alias : Symbol(alias, Decl(bug28014.js, 0, 19)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff index 3de71be421..052bd5f1ab 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff @@ -6,8 +6,8 @@ exports.version = 1 ->exports.version : Symbol(version, Decl(bug28014.js, 0, 0)) ->exports : Symbol(version, Decl(bug28014.js, 0, 0)) -->version : Symbol(version, Decl(bug28014.js, 0, 0)) +>exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) + >version : Symbol(version, Decl(bug28014.js, 0, 0)) function alias() { } >alias : Symbol(alias, Decl(bug28014.js, 0, 19)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types index 8aae436c98..853d3adb4c 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types @@ -5,7 +5,7 @@ exports.version = 1 >exports.version = 1 : 1 >exports.version : any >exports : typeof import("./bug28014") ->version : any +>version : 1 >1 : 1 function alias() { } diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols index 33e6b8ac42..354fc497a9 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols @@ -9,4 +9,5 @@ module.exports = window.nonprop; exports.foo = bar; >exports : Symbol("bug27025", Decl(bug27025.js, 0, 0)) +>foo : Symbol(foo, Decl(bug27025.js, 0, 32)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols.diff index 179701bcbd..930775c079 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols.diff @@ -14,5 +14,5 @@ exports.foo = bar; ->exports : Symbol(foo, Decl(bug27025.js, 0, 32)) -->foo : Symbol(foo, Decl(bug27025.js, 0, 32)) +>exports : Symbol("bug27025", Decl(bug27025.js, 0, 0)) + >foo : Symbol(foo, Decl(bug27025.js, 0, 32)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols index 723e4e6100..77637d117b 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols @@ -3,6 +3,7 @@ === async.js === exports.default = { m: 1, a: 1 } >exports : Symbol("async", Decl(async.js, 0, 0)) +>default : Symbol(default, Decl(async.js, 0, 0)) >m : Symbol(m, Decl(async.js, 0, 19)) >a : Symbol(a, Decl(async.js, 0, 25)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols.diff index 2ea079bfe5..b1450f31be 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols.diff @@ -5,8 +5,8 @@ === async.js === exports.default = { m: 1, a: 1 } ->exports : Symbol(default, Decl(async.js, 0, 0)) -->default : Symbol(default, Decl(async.js, 0, 0)) +>exports : Symbol("async", Decl(async.js, 0, 0)) + >default : Symbol(default, Decl(async.js, 0, 0)) >m : Symbol(m, Decl(async.js, 0, 19)) >a : Symbol(a, Decl(async.js, 0, 25)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.types index 155e39e2e2..2030ce4503 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.types @@ -5,7 +5,7 @@ exports.default = { m: 1, a: 1 } >exports.default = { m: 1, a: 1 } : { m: number; a: number; } >exports.default : any >exports : typeof import("./async") ->default : any +>default : { m: number; a: number; } >{ m: 1, a: 1 } : { m: number; a: number; } >m : number >1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols index e1144e754b..73fbdc5ef8 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols @@ -29,5 +29,6 @@ module.exports.default = axios; >module.exports : Symbol(axios, Decl(axios.js, 5, 3)) >module : Symbol(module.exports) >exports : Symbol(axios, Decl(axios.js, 5, 3)) +>default : Symbol(default, Decl(axios.js, 8, 23)) >axios : Symbol(axios, Decl(axios.js, 5, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff index 8bddad8825..3a6d0a5407 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff @@ -33,8 +33,8 @@ ->module.exports : Symbol(default, Decl(axios.js, 8, 23)) ->module : Symbol(module, Decl(axios.js, 7, 9)) ->exports : Symbol(module.exports, Decl(axios.js, 0, 0)) -->default : Symbol(default, Decl(axios.js, 8, 23)) +>module.exports : Symbol(axios, Decl(axios.js, 5, 3)) +>module : Symbol(module.exports) +>exports : Symbol(axios, Decl(axios.js, 5, 3)) + >default : Symbol(default, Decl(axios.js, 8, 23)) >axios : Symbol(axios, Decl(axios.js, 5, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types index 68d421dd4e..012970f595 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types @@ -34,6 +34,6 @@ module.exports.default = axios; >module.exports : Axios >module : { axios: Axios; } >exports : Axios ->default : any +>default : Axios >axios : Axios diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols index 49ff0d0d69..bc9feb80c2 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols @@ -14,5 +14,6 @@ module.exports.default = axios >module.exports : Symbol(axios, Decl(axios.js, 0, 3)) >module : Symbol(module.exports) >exports : Symbol(axios, Decl(axios.js, 0, 3)) +>default : Symbol(default, Decl(axios.js, 1, 22)) >axios : Symbol(axios, Decl(axios.js, 0, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff index d12f7626db..0fdd48e9aa 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff @@ -17,8 +17,8 @@ ->module.exports : Symbol(default, Decl(axios.js, 1, 22)) ->module : Symbol(module, Decl(axios.js, 0, 14)) ->exports : Symbol(module.exports, Decl(axios.js, 0, 0)) -->default : Symbol(default, Decl(axios.js, 1, 22)) +>module.exports : Symbol(axios, Decl(axios.js, 0, 3)) +>module : Symbol(module.exports) +>exports : Symbol(axios, Decl(axios.js, 0, 3)) + >default : Symbol(default, Decl(axios.js, 1, 22)) >axios : Symbol(axios, Decl(axios.js, 0, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types index 722a2dd211..4d8af48105 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types @@ -18,6 +18,6 @@ module.exports.default = axios >module.exports : {} >module : { axios: {}; } >exports : {} ->default : any +>default : {} >axios : {} diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols index 72949ef09f..24841a0c3b 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols @@ -34,5 +34,6 @@ module.exports.f = function (a) { } >module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>f : Symbol(f, Decl(mod1.js, 1, 32)) >a : Symbol(a, Decl(mod1.js, 3, 29)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff index 1f47a437b4..39f31df60d 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff @@ -26,8 +26,8 @@ ->module.exports : Symbol(f, Decl(mod1.js, 1, 32)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) -->f : Symbol(f, Decl(mod1.js, 1, 32)) +>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 0, 0)) + >f : Symbol(f, Decl(mod1.js, 1, 32)) >a : Symbol(a, Decl(mod1.js, 3, 29)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types index ee42485873..aa185d0bff 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types @@ -43,7 +43,7 @@ module.exports.f = function (a) { } >module.exports : () => void >module : { "export=": () => void; } >exports : () => void ->f : any +>f : (a: any) => void >function (a) { } : (a: any) => void >a : any diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols index ab4d96a505..d503b48b98 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols @@ -35,4 +35,5 @@ module.exports.f = function () { } >module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>f : Symbol(f, Decl(mod1.js, 1, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff index 3f7dac72aa..f57088913f 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff @@ -26,7 +26,7 @@ ->module.exports : Symbol(f, Decl(mod1.js, 1, 18)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) -->f : Symbol(f, Decl(mod1.js, 1, 18)) +>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 0, 0)) + >f : Symbol(f, Decl(mod1.js, 1, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types index 8c1b21c209..99ade937ce 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types @@ -45,6 +45,6 @@ module.exports.f = function () { } >module.exports : 1 >module : { "export=": 1; } >exports : 1 ->f : any +>f : () => void >function () { } : () => void diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols index 98651fb010..c64bb0e83f 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols @@ -47,7 +47,7 @@ module.exports.bothBefore = 'string' >module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(mod1.js, 1, 36)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) module.exports = { >module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) @@ -68,10 +68,11 @@ module.exports.bothAfter = 'string' >module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(mod1.js, 1, 36)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 6, 1)) module.exports.justProperty = 'string' >module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) >module : Symbol(module.exports) >exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff index 197654e3e3..2274077249 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff @@ -47,12 +47,11 @@ ->module.exports : Symbol(bothBefore, Decl(mod1.js, 0, 0)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) -->bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) +>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) +>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 1, 36)) -+>bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) + >bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) module.exports = { ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) @@ -70,19 +69,18 @@ ->module.exports : Symbol(bothAfter, Decl(mod1.js, 6, 1)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) -->bothAfter : Symbol(bothAfter, Decl(mod1.js, 6, 1)) +>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) +>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 1, 36)) -+>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) + >bothAfter : Symbol(bothAfter, Decl(mod1.js, 6, 1)) module.exports.justProperty = 'string' ->module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35)) ->module.exports : Symbol(justProperty, Decl(mod1.js, 7, 35)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) -->justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35)) +>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 1, 36)) + >justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types index f3b476d806..837b8ef76b 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types @@ -56,7 +56,7 @@ module.exports.bothBefore = 'string' >module.exports : { justExport: number; bothBefore: number; bothAfter: number; } >module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } >exports : { justExport: number; bothBefore: number; bothAfter: number; } ->bothBefore : number +>bothBefore : "string" >'string' : "string" module.exports = { @@ -84,7 +84,7 @@ module.exports.bothAfter = 'string' >module.exports : { justExport: number; bothBefore: number; bothAfter: number; } >module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } >exports : { justExport: number; bothBefore: number; bothAfter: number; } ->bothAfter : number +>bothAfter : "string" >'string' : "string" module.exports.justProperty = 'string' @@ -93,6 +93,6 @@ module.exports.justProperty = 'string' >module.exports : { justExport: number; bothBefore: number; bothAfter: number; } >module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } >exports : { justExport: number; bothBefore: number; bothAfter: number; } ->justProperty : any +>justProperty : "string" >'string' : "string" diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols index b236c055da..996bd6e42d 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols @@ -47,7 +47,7 @@ module.exports.bothBefore = 'string' >module.exports : Symbol(A, Decl(mod1.js, 5, 18)) >module : Symbol(module.exports) >exports : Symbol(A, Decl(mod1.js, 5, 18)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) A.justExport = 4 >A.justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) @@ -80,10 +80,11 @@ module.exports.bothAfter = 'string' >module.exports : Symbol(A, Decl(mod1.js, 5, 18)) >module : Symbol(module.exports) >exports : Symbol(A, Decl(mod1.js, 5, 18)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) module.exports.justProperty = 'string' >module.exports : Symbol(A, Decl(mod1.js, 5, 18)) >module : Symbol(module.exports) >exports : Symbol(A, Decl(mod1.js, 5, 18)) +>justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff index 1c0d1c740e..b077f732f4 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff @@ -54,7 +54,7 @@ +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) -+>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) A.justExport = 4 ->A.justExport : Symbol(A.justExport, Decl(mod1.js, 1, 36)) @@ -109,14 +109,14 @@ +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) -+>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) module.exports.justProperty = 'string' ->module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) ->module.exports : Symbol(justProperty, Decl(mod1.js, 9, 35)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) -->justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) + >justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types index 48e342babc..f39707c789 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types @@ -56,7 +56,7 @@ module.exports.bothBefore = 'string' >module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } >exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->bothBefore : number +>bothBefore : "string" >'string' : "string" A.justExport = 4 @@ -103,7 +103,7 @@ module.exports.bothAfter = 'string' >module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } >exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->bothAfter : number +>bothAfter : "string" >'string' : "string" module.exports.justProperty = 'string' @@ -112,6 +112,6 @@ module.exports.justProperty = 'string' >module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } >exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->justProperty : any +>justProperty : "string" >'string' : "string" diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types index c84643db7c..861ad3cd3e 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types @@ -53,7 +53,7 @@ exports["b"] = { x: "x" }; >exports["b"] = { x: "x" } : { x: string; } >exports["b"] : { x: string; } >exports : typeof import("./mod1") ->"b" : "b" +>"b" : { x: string; } >{ x: "x" } : { x: string; } >x : string >"x" : "x" @@ -62,7 +62,7 @@ exports["default"] = { x: "x" }; >exports["default"] = { x: "x" } : { x: string; } >exports["default"] : { x: string; } >exports : typeof import("./mod1") ->"default" : "default" +>"default" : { x: string; } >{ x: "x" } : { x: string; } >x : string >"x" : "x" @@ -73,7 +73,7 @@ module.exports["c"] = { x: "x" }; >module.exports : typeof import("./mod1") >module : { "\"mod1\"": typeof import("./mod1"); } >exports : typeof import("./mod1") ->"c" : "c" +>"c" : { x: string; } >{ x: "x" } : { x: string; } >x : string >"x" : "x" @@ -84,7 +84,7 @@ module["exports"]["d"] = {}; >module["exports"] : typeof import("./mod1") >module : { "\"mod1\"": typeof import("./mod1"); } >"exports" : "exports" ->"d" : "d" +>"d" : {} >{} : {} module["exports"]["d"].e = 0; diff --git a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols index f4dc35d0c9..815a9d7522 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols @@ -10,7 +10,7 @@ const o1 = { this.b = n => n; >this.b : Symbol(b, Decl(bug25926.js, 0, 23)) ->this : Symbol(__type, Decl(bug25926.js, 0, 11)) +>this : Symbol(o1, Decl(bug25926.js, 0, 11)) >b : Symbol(b, Decl(bug25926.js, 0, 23)) >n : Symbol(n, Decl(bug25926.js, 3, 16)) >n : Symbol(n, Decl(bug25926.js, 3, 16)) @@ -26,14 +26,14 @@ const o2 = { this.e = this.f = m => this.g || m; >this.e : Symbol(e, Decl(bug25926.js, 7, 23)) ->this : Symbol(__type, Decl(bug25926.js, 7, 11)) +>this : Symbol(o2, Decl(bug25926.js, 7, 11)) >e : Symbol(e, Decl(bug25926.js, 7, 23)) >this.f : Symbol(f, Decl(bug25926.js, 7, 46)) ->this : Symbol(__type, Decl(bug25926.js, 7, 11)) +>this : Symbol(o2, Decl(bug25926.js, 7, 11)) >f : Symbol(f, Decl(bug25926.js, 7, 46)) >m : Symbol(m, Decl(bug25926.js, 10, 25)) >this.g : Symbol(g, Decl(bug25926.js, 7, 69)) ->this : Symbol(__type, Decl(bug25926.js, 7, 11)) +>this : Symbol(o2, Decl(bug25926.js, 7, 11)) >g : Symbol(g, Decl(bug25926.js, 7, 69)) >m : Symbol(m, Decl(bug25926.js, 10, 25)) } diff --git a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols.diff index 4d74104c94..09e86615e3 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols.diff @@ -1,24 +1,33 @@ --- old.typeFromContextualThisType.symbols +++ new.typeFromContextualThisType.symbols -@@= skipped -10, +10 lines =@@ +@@= skipped -9, +9 lines =@@ + this.b = n => n; >this.b : Symbol(b, Decl(bug25926.js, 0, 23)) - >this : Symbol(__type, Decl(bug25926.js, 0, 11)) +->this : Symbol(__type, Decl(bug25926.js, 0, 11)) ->b : Symbol(b, Decl(bug25926.js, 2, 9)) ++>this : Symbol(o1, Decl(bug25926.js, 0, 11)) +>b : Symbol(b, Decl(bug25926.js, 0, 23)) >n : Symbol(n, Decl(bug25926.js, 3, 16)) >n : Symbol(n, Decl(bug25926.js, 3, 16)) } @@= skipped -16, +16 lines =@@ + this.e = this.f = m => this.g || m; >this.e : Symbol(e, Decl(bug25926.js, 7, 23)) - >this : Symbol(__type, Decl(bug25926.js, 7, 11)) +->this : Symbol(__type, Decl(bug25926.js, 7, 11)) ->e : Symbol(e, Decl(bug25926.js, 9, 9)) ++>this : Symbol(o2, Decl(bug25926.js, 7, 11)) +>e : Symbol(e, Decl(bug25926.js, 7, 23)) >this.f : Symbol(f, Decl(bug25926.js, 7, 46)) - >this : Symbol(__type, Decl(bug25926.js, 7, 11)) +->this : Symbol(__type, Decl(bug25926.js, 7, 11)) ->f : Symbol(f, Decl(bug25926.js, 10, 16)) ++>this : Symbol(o2, Decl(bug25926.js, 7, 11)) +>f : Symbol(f, Decl(bug25926.js, 7, 46)) >m : Symbol(m, Decl(bug25926.js, 10, 25)) >this.g : Symbol(g, Decl(bug25926.js, 7, 69)) - >this : Symbol(__type, Decl(bug25926.js, 7, 11)) \ No newline at end of file +->this : Symbol(__type, Decl(bug25926.js, 7, 11)) ++>this : Symbol(o2, Decl(bug25926.js, 7, 11)) + >g : Symbol(g, Decl(bug25926.js, 7, 69)) + >m : Symbol(m, Decl(bug25926.js, 10, 25)) + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols index 2104a285c8..859b7d29e7 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols @@ -30,6 +30,7 @@ class Foo { } // should error /** @typedef {number} Bar */ exports.Bar = class { } >exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>Bar : Symbol(Bar, Decl(mod1.js, 5, 4), Decl(mod1.js, 3, 13)) /** @typedef {number} Baz */ module.exports = { @@ -50,6 +51,7 @@ var Qux = 2; /** @typedef {number} Quid */ exports.Quid = 2; >exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>Quid : Symbol(Quid, Decl(mod1.js, 18, 4), Decl(mod1.js, 16, 12)) /** @typedef {number} Quack */ module.exports = { diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff index b01cc9dce5..ad7f9a063e 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff @@ -24,6 +24,7 @@ ->exports : Symbol(Bar, Decl(mod1.js, 3, 13), Decl(mod1.js, 5, 4)) ->Bar : Symbol(Bar, Decl(mod1.js, 3, 13), Decl(mod1.js, 5, 4)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>Bar : Symbol(Bar, Decl(mod1.js, 5, 4), Decl(mod1.js, 3, 13)) /** @typedef {number} Baz */ module.exports = { @@ -36,7 +37,7 @@ Baz: class { } >Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) -@@= skipped -31, +29 lines =@@ +@@= skipped -31, +30 lines =@@ /** @typedef {number} Qux */ var Qux = 2; @@ -49,6 +50,7 @@ ->exports : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) ->Quid : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>Quid : Symbol(Quid, Decl(mod1.js, 18, 4), Decl(mod1.js, 16, 12)) /** @typedef {number} Quack */ module.exports = { diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types index e597356b31..ccb1bf27ab 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types @@ -34,7 +34,7 @@ exports.Bar = class { } >exports.Bar = class { } : typeof Bar >exports.Bar : any >exports : typeof import("./mod1") ->Bar : any +>Bar : typeof Bar >class { } : typeof Bar /** @typedef {number} Baz */ @@ -62,7 +62,7 @@ exports.Quid = 2; >exports.Quid = 2 : 2 >exports.Quid : any >exports : typeof import("./mod1") ->Quid : any +>Quid : 2 >2 : 2 /** @typedef {number} Quack */ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportAssignmentNonMutableLocation.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportAssignmentNonMutableLocation.types.diff index 9cf27815e6..848456ac7f 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportAssignmentNonMutableLocation.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportAssignmentNonMutableLocation.types.diff @@ -27,7 +27,7 @@ +>exports.customSymbol2 = Symbol("custom") : symbol +>exports.customSymbol2 : any +>exports : typeof import("./file") -+>customSymbol2 : any ++>customSymbol2 : symbol +>Symbol("custom") : symbol >Symbol : SymbolConstructor >"custom" : "custom" diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation3.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation3.types.diff index 0d098f61be..43753a1571 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation3.types.diff @@ -8,12 +8,11 @@ ->module.exports : typeof import("/y") ->module : { exports: typeof import("/y"); } ->exports : typeof import("/y") -->x : 1 +>module.exports.x : any +>module.exports : typeof import("./y.js") +>module : { "export=": typeof import("./y.js"); } +>exports : typeof import("./y.js") -+>x : any + >x : 1 >1 : 1 module.exports = require("./y.js"); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.errors.txt.diff index 5a96ab6f2a..ade10090ef 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.errors.txt.diff @@ -1,51 +1,24 @@ --- old.checkJsdocSatisfiesTag1.errors.txt +++ new.checkJsdocSatisfiesTag1.errors.txt @@= skipped -0, +0 lines =@@ --/a.js(21,44): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T1'. + /a.js(21,44): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T1'. -/a.js(22,17): error TS1360: Type '{}' does not satisfy the expected type 'T1'. - Property 'a' is missing in type '{}' but required in type 'T1'. --/a.js(31,49): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T4'. -- -- --==== /a.js (3 errors) ==== -- /** -- * @typedef {Object} T1 -- * @property {number} a -- */ -- -- /** -- * @typedef {Object} T2 -- * @property {"a" | "b"} a -- */ -- -- /** -- * @typedef {(x: string) => string} T3 -- */ -- -- /** -- * @typedef {Object} T4 -- * @property {string} a -- */ -- -- const t1 = /** @satisfies {T1} */ ({ a: 1 }); -- const t2 = /** @satisfies {T1} */ ({ a: 1, b: 1 }); -- ~ --!!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T1'. -- const t3 = /** @satisfies {T1} */ ({}); ++/a.js(22,38): error TS2741: Property 'a' is missing in type '{}' but required in type 'T1'. + /a.js(31,49): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T4'. + + +@@= skipped -28, +27 lines =@@ + ~ + !!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T1'. + const t3 = /** @satisfies {T1} */ ({}); - ~~~~~~~~~ -!!! error TS1360: Type '{}' does not satisfy the expected type 'T1'. -!!! error TS1360: Property 'a' is missing in type '{}' but required in type 'T1'. -!!! related TS2728 /a.js:3:4: 'a' is declared here. -- -- /** @type {T2} */ -- const t4 = /** @satisfies {T2} */ ({ a: "a" }); -- -- /** @type {(m: string) => string} */ -- const t5 = /** @satisfies {T3} */((m) => m.substring(0)); -- const t6 = /** @satisfies {[number, number]} */ ([1, 2]); -- const t7 = /** @satisfies {T4} */ ({ a: 'test' }); -- const t8 = /** @satisfies {T4} */ ({ a: 'test', b: 'test' }); -- ~ --!!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T4'. -- -+ \ No newline at end of file ++ ~ ++!!! error TS2741: Property 'a' is missing in type '{}' but required in type 'T1'. ++!!! related TS2728 /a.js:3:23: 'a' is declared here. + + /** @type {T2} */ + const t4 = /** @satisfies {T2} */ ({ a: "a" }); \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag10.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag10.errors.txt.diff deleted file mode 100644 index dd3f1b3f02..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag10.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.checkJsdocSatisfiesTag10.errors.txt -+++ new.checkJsdocSatisfiesTag10.errors.txt -@@= skipped -0, +0 lines =@@ --/a.js(6,5): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type 'Partial>'. - /a.js(14,11): error TS2339: Property 'd' does not exist on type '{ a: number; b: string; x: number; }'. - - --==== /a.js (2 errors) ==== -+==== /a.js (1 errors) ==== - /** @typedef {"a" | "b" | "c" | "d"} Keys */ - - const p = /** @satisfies {Partial>} */ ({ - a: 0, - b: "hello", - x: 8 // Should error, 'x' isn't in 'Keys' -- ~ --!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type 'Partial>'. - }); - - // Should be OK -- retain info that a is number and b is string \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag4.errors.txt.diff index 8753ec0e9d..50185c3ada 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag4.errors.txt.diff @@ -3,24 +3,21 @@ @@= skipped -0, +0 lines =@@ -/a.js(5,21): error TS1360: Type '{}' does not satisfy the expected type 'Foo'. - Property 'a' is missing in type '{}' but required in type 'Foo'. -- -- --==== /a.js (1 errors) ==== -- /** -- * @typedef {Object} Foo -- * @property {number} a -- */ -- export default /** @satisfies {Foo} */ ({}); ++/a.js(5,43): error TS2741: Property 'a' is missing in type '{}' but required in type 'Foo'. + + + ==== /a.js (1 errors) ==== +@@= skipped -7, +6 lines =@@ + * @property {number} a + */ + export default /** @satisfies {Foo} */ ({}); - ~~~~~~~~~ -!!! error TS1360: Type '{}' does not satisfy the expected type 'Foo'. -!!! error TS1360: Property 'a' is missing in type '{}' but required in type 'Foo'. -!!! related TS2728 /a.js:3:4: 'a' is declared here. -- --==== /b.js (0 errors) ==== -- /** -- * @typedef {Object} Foo -- * @property {number} a -- */ -- -- export default /** @satisfies {Foo} */ ({ a: 1 }); -+ \ No newline at end of file ++ ~ ++!!! error TS2741: Property 'a' is missing in type '{}' but required in type 'Foo'. ++!!! related TS2728 /a.js:3:23: 'a' is declared here. + + ==== /b.js (0 errors) ==== + /** \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag7.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag7.errors.txt.diff deleted file mode 100644 index 04f0c99ec4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag7.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.checkJsdocSatisfiesTag7.errors.txt -+++ new.checkJsdocSatisfiesTag7.errors.txt -@@= skipped -0, +0 lines =@@ --/a.js(6,5): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type 'Record'. - /a.js(14,11): error TS2339: Property 'd' does not exist on type '{ a: number; b: string; x: number; }'. - - --==== /a.js (2 errors) ==== -+==== /a.js (1 errors) ==== - /** @typedef {"a" | "b" | "c" | "d"} Keys */ - - const p = /** @satisfies {Record} */ ({ - a: 0, - b: "hello", - x: 8 // Should error, 'x' isn't in 'Keys' -- ~ --!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type 'Record'. - }) - - // Should be OK -- retain info that a is number and b is string \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag9.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag9.errors.txt.diff deleted file mode 100644 index 3d3d4bb240..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag9.errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.checkJsdocSatisfiesTag9.errors.txt -+++ new.checkJsdocSatisfiesTag9.errors.txt -@@= skipped -0, +0 lines =@@ --/a.js(11,26): error TS2353: Object literal may only specify known properties, and 'd' does not exist in type 'Color'. -- -- --==== /a.js (1 errors) ==== -- /** -- * @typedef {Object} Color -- * @property {number} r -- * @property {number} g -- * @property {number} b -- */ -- -- // All of these should be Colors, but I only use some of them here. -- export const Palette = /** @satisfies {Record} */ ({ -- white: { r: 255, g: 255, b: 255 }, -- black: { r: 0, g: 0, d: 0 }, // <- oops! 'd' in place of 'b' -- ~ --!!! error TS2353: Object literal may only specify known properties, and 'd' does not exist in type 'Color'. -- blue: { r: 0, g: 0, b: 255 }, -- }); -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff index 77a534523c..cb7ae9e15e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff @@ -40,10 +40,9 @@ ->module.exports : { (ast: any): any; funky: (declaration: any) => boolean; } ->module : { exports: { (ast: any): any; funky: (declaration: any) => boolean; }; } ->exports : { (ast: any): any; funky: (declaration: any) => boolean; } -->funky : (declaration: any) => boolean +>module.exports.funky : any +>module.exports : (ast: any) => any +>module : { readonly donkey: (ast: any) => any; } +>exports : (ast: any) => any -+>funky : any + >funky : (declaration: any) => boolean >funky : (declaration: any) => boolean diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff index 90fb3fbf2c..3131e07864 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff @@ -17,11 +17,8 @@ ->module : { exports: typeof Foo; } +>module : { Foo: typeof Foo; } >exports : typeof Foo -->Strings : { a: string; b: string; } -+>Strings : any >Strings : { a: string; b: string; } - - === bar.js === + >Strings : { a: string; b: string; } @@= skipped -20, +20 lines =@@ module.exports = Bar; >module.exports = Bar : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff index 2366108956..25e8e64f18 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff @@ -17,8 +17,5 @@ ->module : { exports: typeof Handler; } +>module : { Handler: typeof Handler; } >exports : typeof Handler -->Strings : { a: string; b: string; } -+>Strings : any >Strings : { a: string; b: string; } - - /** \ No newline at end of file + >Strings : { a: string; b: string; } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCrossfileMerge.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCrossfileMerge.types.diff index 72e62b10b6..13a3d346f8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCrossfileMerge.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCrossfileMerge.types.diff @@ -24,12 +24,11 @@ ->module.exports : typeof m.default ->module : { exports: typeof m.default; } ->exports : typeof m.default -->memberName : "thing" +>module.exports.memberName : any +>module.exports : () => void +>module : { validate(): void; } +>exports : () => void -+>memberName : any + >memberName : "thing" >"thing" : "thing" === exporter.js === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff index f6ed465161..c325c55012 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff @@ -37,12 +37,11 @@ ->module.exports : typeof import("index") ->module : { exports: typeof import("index"); } ->exports : typeof import("index") -->Sub : typeof Sub +>module.exports.Sub : any +>module.exports : typeof import(".") +>module : { "\uFFFDclass": typeof import("."); } +>exports : typeof import(".") -+>Sub : any + >Sub : typeof Sub >class { constructor() { this.instance = new module.exports(10); }} : typeof Sub constructor() { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types.diff index aff43a9cf2..e3d1c5685d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types.diff @@ -35,10 +35,9 @@ ->module.exports : typeof import("index") ->module : { exports: typeof import("index"); } ->exports : typeof import("index") -->Another : typeof Q +>module.exports.Another : any +>module.exports : typeof import(".") +>module : { Q: typeof import("."); } +>exports : typeof import(".") -+>Another : any + >Another : typeof Q >Q : typeof Q diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassInstance3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassInstance3.types.diff index a8e58d7687..145c4adaaf 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassInstance3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassInstance3.types.diff @@ -21,10 +21,9 @@ ->module.exports : { member: number; additional: 20; } ->module : { exports: { member: number; additional: 20; }; } ->exports : { member: number; additional: 20; } -->additional : 20 +>module.exports.additional : any +>module.exports : Foo +>module : { "export=": Foo; } +>exports : Foo -+>additional : any + >additional : 20 >20 : 20 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types.diff index 61fe270fcd..2cc9e8cb17 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types.diff @@ -43,7 +43,7 @@ +>module.exports : (p: any) => void +>module : { "export=": (p: any) => void; } +>exports : (p: any) => void -+>Sub : any ++>Sub : () => void +>function() { this.instance = new module.exports(10);} : () => void this.instance = new module.exports(10); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types.diff index 96c4f08cc2..70bcd2d5e4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types.diff @@ -23,10 +23,9 @@ ->module.exports : { thing: string; also: string; desc: { item: string; }; Strings: { a: string; b: string; }; } ->module : { exports: { thing: string; also: string; desc: { item: string; }; Strings: { a: string; b: string; }; }; } ->exports : { thing: string; also: string; desc: { item: string; }; Strings: { a: string; b: string; }; } -->Strings : { a: string; b: string; } +>module.exports.Strings : any +>module.exports : { thing: string; also: string; desc: { item: string; }; } +>module : { "export=": { thing: string; also: string; desc: { item: string; }; }; } +>exports : { thing: string; also: string; desc: { item: string; }; } -+>Strings : any + >Strings : { a: string; b: string; } >Strings : { a: string; b: string; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types.diff index ffb4c2c0cf..9a119ca258 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types.diff @@ -46,7 +46,8 @@ >exports.methods = m : () => void >exports.methods : any ->exports : any +->methods : any +>exports : typeof import(".") - >methods : any ++>methods : () => void >m : () => void - } \ No newline at end of file + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff index b518598bbc..7544619a0d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff @@ -17,6 +17,5 @@ ->module : { exports: typeof Foo; } +>module : { Foo: typeof Foo; } >exports : typeof Foo -->Strings : { a: string; b: string; } -+>Strings : any >Strings : { a: string; b: string; } + >Strings : { a: string; b: string; } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag6.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag6.errors.txt.diff deleted file mode 100644 index ad27c1d2fb..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag6.errors.txt.diff +++ /dev/null @@ -1,116 +0,0 @@ ---- old.jsdocTemplateTag6.errors.txt -+++ new.jsdocTemplateTag6.errors.txt -@@= skipped -0, +0 lines =@@ -- -+a.js(2,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+a.js(14,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+a.js(26,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+a.js(37,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+a.js(48,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+a.js(59,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+a.js(68,18): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+ -+ -+==== a.js (7 errors) ==== -+ /** -+ * @template const T -+ ~~~~~ -+!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+ * @param {T} x -+ * @returns {T} -+ */ -+ function f1(x) { -+ return x; -+ } -+ const t1 = f1("a"); -+ const t2 = f1(["a", ["b", "c"]]); -+ const t3 = f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); -+ -+ /** -+ * @template const T, U -+ ~~~~~ -+!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+ * @param {T} x -+ * @returns {T} -+ */ -+ function f2(x) { -+ return x; -+ }; -+ const t4 = f2('a'); -+ const t5 = f2(['a', ['b', 'c']]); -+ const t6 = f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); -+ -+ /** -+ * @template const T -+ ~~~~~ -+!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+ * @param {T} x -+ * @returns {T[]} -+ */ -+ function f3(x) { -+ return [x]; -+ } -+ const t7 = f3("hello"); -+ const t8 = f3("hello"); -+ -+ /** -+ * @template const T -+ ~~~~~ -+!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+ * @param {[T, T]} x -+ * @returns {T} -+ */ -+ function f4(x) { -+ return x[0]; -+ } -+ const t9 = f4([[1, "x"], [2, "y"]]); -+ const t10 = f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]); -+ -+ /** -+ * @template const T -+ ~~~~~ -+!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+ * @param {{ x: T, y: T}} obj -+ * @returns {T} -+ */ -+ function f5(obj) { -+ return obj.x; -+ } -+ const t11 = f5({ x: [1, "x"], y: [2, "y"] }); -+ const t12 = f5({ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } }); -+ -+ /** -+ * @template const T -+ ~~~~~ -+!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+ */ -+ class C { -+ /** -+ * @param {T} x -+ */ -+ constructor(x) {} -+ -+ /** -+ * @template const U -+ ~~~~~ -+!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+ * @param {U} x -+ */ -+ foo(x) { -+ return x; -+ } -+ } -+ -+ const t13 = new C({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); -+ const t14 = t13.foo(["a", ["b", "c"]]); -+ -+ /** -+ * @template {readonly unknown[]} const T -+ * @param {T} args -+ * @returns {T} -+ */ -+ function f6(...args) { -+ return args; -+ } -+ const t15 = f6(1, 'b', { a: 1, b: 'x' }); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag7.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag7.errors.txt.diff deleted file mode 100644 index c7e3efdbb8..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag7.errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.jsdocTemplateTag7.errors.txt -+++ new.jsdocTemplateTag7.errors.txt -@@= skipped -0, +0 lines =@@ - a.js(2,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -+a.js(7,14): error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class - a.js(12,14): error TS1273: 'private' modifier cannot appear on a type parameter - - --==== a.js (2 errors) ==== -+==== a.js (3 errors) ==== - /** - * @template const T - ~~~~~ -@@= skipped -11, +12 lines =@@ - - /** - * @template const T -+ ~~~~~ -+!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class - */ - class C { } - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.errors.txt.diff index 989f7fbd7d..8b2d7d7f0b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.errors.txt.diff @@ -2,43 +2,29 @@ +++ new.jsdocTemplateTag8.errors.txt @@= skipped -0, +0 lines =@@ +a.js(2,14): error TS1274: 'out' modifier can only appear on a type parameter of a class, interface or type alias -+a.js(4,15): error TS2304: Cannot find name 'T'. a.js(18,1): error TS2322: Type 'Covariant' is not assignable to type 'Covariant'. Type 'unknown' is not assignable to type 'string'. +a.js(21,14): error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias -+a.js(23,19): error TS2304: Cannot find name 'T'. a.js(36,1): error TS2322: Type 'Contravariant' is not assignable to type 'Contravariant'. Type 'unknown' is not assignable to type 'string'. +a.js(40,14): error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias -+a.js(42,19): error TS2304: Cannot find name 'T'. -+a.js(42,25): error TS2304: Cannot find name 'T'. a.js(55,1): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. -- Types of property 'f' are incompatible. -- Type '(x: string) => string' is not assignable to type '(x: unknown) => unknown'. -- Types of parameters 'x' and 'x' are incompatible. -- Type 'unknown' is not assignable to type 'string'. -+ Type 'unknown' is not assignable to type 'string'. - a.js(56,1): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. -- The types returned by 'f(...)' are incompatible between these types. -- Type 'unknown' is not assignable to type 'string'. -+ Type 'unknown' is not assignable to type 'string'. + Types of property 'f' are incompatible. + Type '(x: string) => string' is not assignable to type '(x: unknown) => unknown'. +@@= skipped -12, +15 lines =@@ a.js(59,14): error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias -==== a.js (5 errors) ==== -+==== a.js (12 errors) ==== ++==== a.js (8 errors) ==== /** * @template out T + ~~~ +!!! error TS1274: 'out' modifier can only appear on a type parameter of a class, interface or type alias * @typedef {Object} Covariant * @property {T} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. */ - - /** -@@= skipped -37, +44 lines =@@ +@@= skipped -25, +27 lines =@@ /** * @template in T @@ -46,12 +32,8 @@ +!!! error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias * @typedef {Object} Contravariant * @property {(x: T) => void} f -+ ~ -+!!! error TS2304: Cannot find name 'T'. */ - - /** -@@= skipped -22, +26 lines =@@ +@@= skipped -22, +24 lines =@@ /** * @template in out T @@ -59,28 +41,4 @@ +!!! error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias * @typedef {Object} Invariant * @property {(x: T) => T} f -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - - /** -@@= skipped -17, +23 lines =@@ - super_invariant = sub_invariant; // Error - ~~~~~~~~~~~~~~~ - !!! error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. --!!! error TS2322: Types of property 'f' are incompatible. --!!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: unknown) => unknown'. --!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. --!!! error TS2322: Type 'unknown' is not assignable to type 'string'. -+!!! error TS2322: Type 'unknown' is not assignable to type 'string'. - sub_invariant = super_invariant; // Error - ~~~~~~~~~~~~~ - !!! error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. --!!! error TS2322: The types returned by 'f(...)' are incompatible between these types. --!!! error TS2322: Type 'unknown' is not assignable to type 'string'. -+!!! error TS2322: Type 'unknown' is not assignable to type 'string'. - - /** - * @template in T \ No newline at end of file + */ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.types.diff deleted file mode 100644 index 1d65a74dcf..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.types.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.jsdocTemplateTag8.types -+++ new.jsdocTemplateTag8.types -@@= skipped -45, +45 lines =@@ - */ - let super_contravariant = { f: (x) => {} }; - >super_contravariant : Contravariant -->{ f: (x) => {} } : { f: (x: unknown) => void; } -->f : (x: unknown) => void -->(x) => {} : (x: unknown) => void -->x : unknown -+>{ f: (x) => {} } : { f: (x: T) => void; } -+>f : (x: T) => void -+>(x) => {} : (x: T) => void -+>x : T - - /** - * @type {Contravariant} - */ - let sub_contravariant = { f: (x) => {} }; - >sub_contravariant : Contravariant -->{ f: (x) => {} } : { f: (x: string) => void; } -->f : (x: string) => void -->(x) => {} : (x: string) => void -->x : string -+>{ f: (x) => {} } : { f: (x: T) => void; } -+>f : (x: T) => void -+>(x) => {} : (x: T) => void -+>x : T - - super_contravariant = sub_contravariant; // Error - >super_contravariant = sub_contravariant : Contravariant -@@= skipped -36, +36 lines =@@ - */ - let super_invariant = { f: (x) => {} }; - >super_invariant : Invariant -->{ f: (x) => {} } : { f: (x: unknown) => void; } -->f : (x: unknown) => void -->(x) => {} : (x: unknown) => void -->x : unknown -+>{ f: (x) => {} } : { f: (x: T) => void; } -+>f : (x: T) => void -+>(x) => {} : (x: T) => void -+>x : T - - /** - * @type {Invariant} - */ - let sub_invariant = { f: (x) => { return "" } }; - >sub_invariant : Invariant -->{ f: (x) => { return "" } } : { f: (x: string) => string; } -->f : (x: string) => string -->(x) => { return "" } : (x: string) => string -->x : string -+>{ f: (x) => { return "" } } : { f: (x: T) => string; } -+>f : (x: T) => string -+>(x) => { return "" } : (x: T) => string -+>x : T - >"" : "" - - super_invariant = sub_invariant; // Error \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias.types.diff index 91276e3db0..7280e45e16 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias.types.diff @@ -189,10 +189,9 @@ >exports.func2 = function () { } : () => void ->exports.func2 : () => void ->exports : typeof import("b") -->func2 : () => void +>exports.func2 : any +>exports : typeof import("./b") -+>func2 : any + >func2 : () => void >function () { } : () => void var moduleExportsAlias = module.exports; @@ -221,12 +220,11 @@ ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->func4 : () => void +>module.exports.func4 : any +>module.exports : {} +>module : { "export=": {}; } +>exports : {} -+>func4 : any + >func4 : () => void >function () { } : () => void var multipleDeclarationAlias1 = exports = module.exports; @@ -370,117 +368,87 @@ ->multipleDeclarationAlias6.func10 : () => void ->multipleDeclarationAlias6 : typeof module.exports ->func10 : () => void -->function () { } : () => void -- --exports = module.exports = someOtherVariable = {}; -->exports = module.exports = someOtherVariable = {} : typeof module.exports -->exports : typeof import("b") -->module.exports = someOtherVariable = {} : typeof module.exports -->module.exports : typeof module.exports -->module : { exports: typeof module.exports; } -->exports : typeof module.exports -->someOtherVariable = {} : {} -->someOtherVariable : any -->{} : {} -- --exports.func11 = function () { }; -->exports.func11 = function () { } : () => void -->exports.func11 : () => void -->exports : typeof import("b") -->func11 : () => void -->function () { } : () => void -- --module.exports.func12 = function () { }; -->module.exports.func12 = function () { } : () => void -->module.exports.func12 : () => void -->module.exports : typeof module.exports -->module : { exports: typeof module.exports; } -->exports : typeof module.exports -->func12 : () => void -->function () { } : () => void -- --exports = module.exports = someOtherVariable = {}; ++>multipleDeclarationAlias6.func10 : any ++>multipleDeclarationAlias6 : {} ++>func10 : any + >function () { } : () => void + + exports = module.exports = someOtherVariable = {}; ->exports = module.exports = someOtherVariable = {} : typeof module.exports ->exports : typeof import("b") ->module.exports = someOtherVariable = {} : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->someOtherVariable = {} : {} -->someOtherVariable : any -->{} : {} -- --exports.func11 = function () { }; -->exports.func11 = function () { } : () => void -->exports.func11 : () => void -->exports : typeof import("b") -->func11 : () => void -->function () { } : () => void -- --module.exports.func12 = function () { }; -->module.exports.func12 = function () { } : () => void -->module.exports.func12 : () => void -->module.exports : typeof module.exports -->module : { exports: typeof module.exports; } -->exports : typeof module.exports -->func12 : () => void -+>multipleDeclarationAlias6.func10 : any -+>multipleDeclarationAlias6 : {} -+>func10 : any -+>function () { } : () => void -+ -+exports = module.exports = someOtherVariable = {}; +>exports = module.exports = someOtherVariable = {} : {} +>exports : any +>module.exports = someOtherVariable = {} : {} +>module.exports : {} +>module : { "export=": {}; } +>exports : {} -+>someOtherVariable = {} : {} -+>someOtherVariable : any -+>{} : {} -+ -+exports.func11 = function () { }; -+>exports.func11 = function () { } : () => void + >someOtherVariable = {} : {} + >someOtherVariable : any + >{} : {} + + exports.func11 = function () { }; + >exports.func11 = function () { } : () => void +->exports.func11 : () => void +->exports : typeof import("b") +>exports.func11 : any +>exports : typeof import("./b") -+>func11 : any -+>function () { } : () => void -+ -+module.exports.func12 = function () { }; -+>module.exports.func12 = function () { } : () => void + >func11 : () => void + >function () { } : () => void + + module.exports.func12 = function () { }; + >module.exports.func12 = function () { } : () => void +->module.exports.func12 : () => void +->module.exports : typeof module.exports +->module : { exports: typeof module.exports; } +->exports : typeof module.exports +>module.exports.func12 : any +>module.exports : {} +>module : { "export=": {}; } +>exports : {} -+>func12 : any -+>function () { } : () => void -+ -+exports = module.exports = someOtherVariable = {}; + >func12 : () => void + >function () { } : () => void + + exports = module.exports = someOtherVariable = {}; +->exports = module.exports = someOtherVariable = {} : typeof module.exports +->exports : typeof import("b") +->module.exports = someOtherVariable = {} : typeof module.exports +->module.exports : typeof module.exports +->module : { exports: typeof module.exports; } +->exports : typeof module.exports +>exports = module.exports = someOtherVariable = {} : {} +>exports : any +>module.exports = someOtherVariable = {} : {} +>module.exports : {} +>module : { "export=": {}; } +>exports : {} -+>someOtherVariable = {} : {} -+>someOtherVariable : any -+>{} : {} -+ -+exports.func11 = function () { }; -+>exports.func11 = function () { } : () => void + >someOtherVariable = {} : {} + >someOtherVariable : any + >{} : {} + + exports.func11 = function () { }; + >exports.func11 = function () { } : () => void +->exports.func11 : () => void +->exports : typeof import("b") +>exports.func11 : any +>exports : typeof import("./b") -+>func11 : any -+>function () { } : () => void -+ -+module.exports.func12 = function () { }; -+>module.exports.func12 = function () { } : () => void + >func11 : () => void + >function () { } : () => void + + module.exports.func12 = function () { }; + >module.exports.func12 = function () { } : () => void +->module.exports.func12 : () => void +->module.exports : typeof module.exports +->module : { exports: typeof module.exports; } +->exports : typeof module.exports +>module.exports.func12 : any +>module.exports : {} +>module : { "export=": {}; } +>exports : {} -+>func12 : any + >func12 : () => void >function () { } : () => void exports = module.exports = {}; @@ -502,10 +470,9 @@ >exports.func13 = function () { } : () => void ->exports.func13 : () => void ->exports : typeof import("b") -->func13 : () => void +>exports.func13 : any +>exports : typeof import("./b") -+>func13 : any + >func13 : () => void >function () { } : () => void module.exports.func14 = function () { }; @@ -514,12 +481,11 @@ ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->func14 : () => void +>module.exports.func14 : any +>module.exports : {} +>module : { "export=": {}; } +>exports : {} -+>func14 : any + >func14 : () => void >function () { } : () => void exports = module.exports = {}; @@ -541,10 +507,9 @@ >exports.func15 = function () { } : () => void ->exports.func15 : () => void ->exports : typeof import("b") -->func15 : () => void +>exports.func15 : any +>exports : typeof import("./b") -+>func15 : any + >func15 : () => void >function () { } : () => void module.exports.func16 = function () { }; @@ -553,12 +518,11 @@ ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->func16 : () => void +>module.exports.func16 : any +>module.exports : {} +>module : { "export=": {}; } +>exports : {} -+>func16 : any + >func16 : () => void >function () { } : () => void module.exports = exports = {}; @@ -579,10 +543,9 @@ >exports.func17 = function () { } : () => void ->exports.func17 : () => void ->exports : typeof import("b") -->func17 : () => void +>exports.func17 : any +>exports : typeof import("./b") -+>func17 : any + >func17 : () => void >function () { } : () => void module.exports.func18 = function () { }; @@ -591,12 +554,11 @@ ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->func18 : () => void +>module.exports.func18 : any +>module.exports : {} +>module : { "export=": {}; } +>exports : {} -+>func18 : any + >func18 : () => void >function () { } : () => void module.exports = {}; @@ -614,10 +576,9 @@ >exports.func19 = function () { } : () => void ->exports.func19 : () => void ->exports : typeof import("b") -->func19 : () => void +>exports.func19 : any +>exports : typeof import("./b") -+>func19 : any + >func19 : () => void >function () { } : () => void module.exports.func20 = function () { }; @@ -626,11 +587,9 @@ ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->func20 : () => void +>module.exports.func20 : any +>module.exports : {} +>module : { "export=": {}; } +>exports : {} -+>func20 : any + >func20 : () => void >function () { } : () => void - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias4.types.diff index 57ca50b7d5..68d1637176 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias4.types.diff @@ -22,6 +22,6 @@ ->D : typeof wat.D ->class D { } : typeof wat.D ->D : typeof wat.D -+>D : any ++>D : typeof D +>class D { } : typeof D +>D : typeof D diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasElementAccessExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasElementAccessExpression.types.diff index 4b590a05fe..7ed1b2bc40 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasElementAccessExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasElementAccessExpression.types.diff @@ -5,15 +5,17 @@ >exports["D"] = D : () => void >exports["D"] : () => void ->exports : typeof import("moduleExportAliasElementAccessExpression") +->"D" : "D" +>exports : typeof import("./moduleExportAliasElementAccessExpression") - >"D" : "D" ++>"D" : () => void >D : () => void -@@= skipped -8, +8 lines =@@ + // (the only package I could find that uses spaces in identifiers is webidl-conversions) exports["Does not work yet"] = D; >exports["Does not work yet"] = D : () => void >exports["Does not work yet"] : () => void ->exports : typeof import("moduleExportAliasElementAccessExpression") +->"Does not work yet" : "Does not work yet" +>exports : typeof import("./moduleExportAliasElementAccessExpression") - >"Does not work yet" : "Does not work yet" ++>"Does not work yet" : () => void >D : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff index c2ddbdd552..24d661c0ab 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff @@ -6,10 +6,9 @@ >exports.version = 1 : 1 ->exports.version : 1 ->exports : typeof alias -->version : 1 +>exports.version : any +>exports : typeof import("./bug28014") -+>version : any + >version : 1 >1 : 1 function alias() { } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment4.types.diff index 343c89c389..12049554e2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment4.types.diff @@ -5,10 +5,12 @@ >exports.default = { m: 1, a: 1 } : { m: number; a: number; } >exports.default : any ->exports : any +->default : any +>exports : typeof import("./async") - >default : any ++>default : { m: number; a: number; } >{ m: 1, a: 1 } : { m: number; a: number; } >m : number + >1 : 1 @@= skipped -9, +9 lines =@@ >1 : 1 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff index a9346d39e9..8aad28b2dd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff @@ -20,10 +20,9 @@ ->module.exports : { m(): void; default: Axios; } ->module : { exports: { m(): void; default: Axios; }; } ->exports : { m(): void; default: Axios; } -->default : Axios +>module.exports.default : any +>module.exports : Axios +>module : { axios: Axios; } +>exports : Axios -+>default : any + >default : Axios >axios : Axios diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff index ed40ccdb9e..3c08ff6172 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff @@ -33,5 +33,5 @@ +>module.exports : {} +>module : { axios: {}; } +>exports : {} -+>default : any ++>default : {} +>axios : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff index 7179afaef8..731b08cc0d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff @@ -57,6 +57,6 @@ +>module.exports : () => void +>module : { "export=": () => void; } +>exports : () => void -+>f : any ++>f : (a: any) => void +>function (a) { } : (a: any) => void +>a : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff index 9bbc38b930..671dd77965 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff @@ -47,8 +47,9 @@ ->module.exports : number ->module : { exports: number; } ->exports : number +->f : any +>module.exports : 1 +>module : { "export=": 1; } +>exports : 1 - >f : any ++>f : () => void >function () { } : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff index 2db4d6cc09..157aa7624a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff @@ -75,7 +75,7 @@ +>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } +>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { justExport: number; bothBefore: number; bothAfter: number; } -+>bothBefore : number ++>bothBefore : "string" >'string' : "string" module.exports = { @@ -103,7 +103,7 @@ +>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } +>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { justExport: number; bothBefore: number; bothAfter: number; } -+>bothAfter : number ++>bothAfter : "string" >'string' : "string" module.exports.justProperty = 'string' @@ -112,10 +112,9 @@ ->module.exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->module : { exports: { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; }; } ->exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } -->justProperty : "string" +>module.exports.justProperty : any +>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } +>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { justExport: number; bothBefore: number; bothAfter: number; } -+>justProperty : any + >justProperty : "string" >'string' : "string" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff index ad7a4d3685..18cabe3453 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff @@ -75,7 +75,7 @@ +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>bothBefore : number ++>bothBefore : "string" >'string' : "string" A.justExport = 4 @@ -141,7 +141,7 @@ +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>bothAfter : number ++>bothAfter : "string" >'string' : "string" module.exports.justProperty = 'string' @@ -150,10 +150,9 @@ ->module.exports : typeof A ->module : { exports: typeof A; } ->exports : typeof A -->justProperty : "string" +>module.exports.justProperty : any +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>justProperty : any + >justProperty : "string" >'string' : "string" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff index af3ced87ac..315180f865 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff @@ -37,19 +37,23 @@ >exports["b"] = { x: "x" } : { x: string; } >exports["b"] : { x: string; } ->exports : typeof import("mod1") +->"b" : "b" +>exports : typeof import("./mod1") - >"b" : "b" ++>"b" : { x: string; } >{ x: "x" } : { x: string; } >x : string + >"x" : "x" @@= skipped -9, +9 lines =@@ exports["default"] = { x: "x" }; >exports["default"] = { x: "x" } : { x: string; } >exports["default"] : { x: string; } ->exports : typeof import("mod1") +->"default" : "default" +>exports : typeof import("./mod1") - >"default" : "default" ++>"default" : { x: string; } >{ x: "x" } : { x: string; } >x : string + >"x" : "x" @@= skipped -9, +9 lines =@@ module.exports["c"] = { x: "x" }; >module.exports["c"] = { x: "x" } : { x: string; } @@ -57,10 +61,11 @@ ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports +->"c" : "c" +>module.exports : typeof import("./mod1") +>module : { "\"mod1\"": typeof import("./mod1"); } +>exports : typeof import("./mod1") - >"c" : "c" ++>"c" : { x: string; } >{ x: "x" } : { x: string; } >x : string >"x" : "x" @@ -75,7 +80,8 @@ +>module["exports"] : typeof import("./mod1") +>module : { "\"mod1\"": typeof import("./mod1"); } >"exports" : "exports" - >"d" : "d" +->"d" : "d" ++>"d" : {} >{} : {} module["exports"]["d"].e = 0; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff index f33a595b97..957890343f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff @@ -36,10 +36,9 @@ >exports.Bar = class { } : typeof Bar ->exports.Bar : typeof Bar ->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } -->Bar : typeof Bar +>exports.Bar : any +>exports : typeof import("./mod1") -+>Bar : any + >Bar : typeof Bar >class { } : typeof Bar /** @typedef {number} Baz */ @@ -61,10 +60,9 @@ >exports.Quid = 2 : 2 ->exports.Quid : 2 ->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } -->Quid : 2 +>exports.Quid : any +>exports : typeof import("./mod1") -+>Quid : any + >Quid : 2 >2 : 2 /** @typedef {number} Quack */