From 10c944c04538224835003dd9164b2ebb231bfd03 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 6 Mar 2025 13:49:13 -0800 Subject: [PATCH 01/25] First example of JS tag emitting types I chose to create a wrapper type node for synthetic JS types rather than cloning the type node. This is how many other tags are going to work, like `@typedef` and `@overload`, so I think it makes sense. However, running tests points out that `@type` assertions, `@satisfies`, and the modifier-like tags like `@private` and `@readonly` will need to emit non-wrapped synthetic nodes, much like in #412. Much more work to be done here on replicating the host<->tag matching rules from Strada. --- internal/ast/ast.go | 39 +++++++++++++++++++ internal/ast/kind.go | 2 + internal/ast/kind_stringer_generated.go | 15 +++---- internal/checker/checker.go | 2 + internal/parser/jsdoc.go | 32 +++++++++++++++ .../tsbaseline/type_symbol_baseline.go | 9 ++++- 6 files changed, 90 insertions(+), 9 deletions(-) diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 908e8bcf8b..b4b9a84f6e 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -1296,6 +1296,10 @@ func (n *Node) AsJSDocTypeTag() *JSDocTypeTag { return n.data.(*JSDocTypeTag) } +func (n *Node) AsJSTypeExpression() *JSTypeExpression { + return n.data.(*JSTypeExpression) +} + func (n *Node) AsJSDocUnknownTag() *JSDocUnknownTag { return n.data.(*JSDocUnknownTag) } @@ -7676,6 +7680,41 @@ func (node *JSDocOptionalType) Clone(f *NodeFactory) *Node { return updateNode(f.NewJSDocOptionalType(node.Type), node.AsNode()) } +// JSTypeExpression +type JSTypeExpression struct { + TypeNodeBase + Type *TypeNode +} + +func (f *NodeFactory) NewJSTypeExpression(typeNode *TypeNode) *Node { + data := &JSTypeExpression{} + data.Type = typeNode + return newNode(KindJSTypeExpression, data) +} + +func (f *NodeFactory) UpdateJSTypeExpression(node *JSTypeExpression, typeNode *TypeNode) *Node { + if typeNode != node.Type { + return updateNode(f.NewJSTypeExpression(typeNode), node.AsNode()) + } + return node.AsNode() +} + +func (node *JSTypeExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Type) +} + +func (node *JSTypeExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSTypeExpression(node, v.visitNode(node.Type)) +} + +func (node *JSTypeExpression) Clone(f *NodeFactory) *Node { + return updateNode(f.NewJSTypeExpression(node.Type), node.AsNode()) +} + +func IsJSTypeExpression(node *Node) bool { + return node.Kind == KindJSTypeExpression +} + // JSDocTypeTag type JSDocTypeTag struct { diff --git a/internal/ast/kind.go b/internal/ast/kind.go index cfcb41d291..34de8e1ba6 100644 --- a/internal/ast/kind.go +++ b/internal/ast/kind.go @@ -377,6 +377,8 @@ const ( KindJSDocImportTag // Synthesized list KindSyntaxList + // Synthesized JS nodes + KindJSTypeExpression // Transformation nodes KindNotEmittedStatement KindPartiallyEmittedExpression diff --git a/internal/ast/kind_stringer_generated.go b/internal/ast/kind_stringer_generated.go index b067e7f341..3b80a4afe5 100644 --- a/internal/ast/kind_stringer_generated.go +++ b/internal/ast/kind_stringer_generated.go @@ -353,16 +353,17 @@ func _() { _ = x[KindJSDocSatisfiesTag-342] _ = x[KindJSDocImportTag-343] _ = x[KindSyntaxList-344] - _ = x[KindNotEmittedStatement-345] - _ = x[KindPartiallyEmittedExpression-346] - _ = x[KindCommaListExpression-347] - _ = x[KindSyntheticReferenceExpression-348] - _ = x[KindCount-349] + _ = x[KindJSTypeExpression-345] + _ = x[KindNotEmittedStatement-346] + _ = x[KindPartiallyEmittedExpression-347] + _ = x[KindCommaListExpression-348] + _ = x[KindSyntheticReferenceExpression-349] + _ = x[KindCount-350] } -const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindBundleKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocMemberNameKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindNotEmittedStatementKindPartiallyEmittedExpressionKindCommaListExpressionKindSyntheticReferenceExpressionKindCount" +const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindBundleKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocMemberNameKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeExpressionKindNotEmittedStatementKindPartiallyEmittedExpressionKindCommaListExpressionKindSyntheticReferenceExpressionKindCount" -var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3141, 3165, 3182, 3195, 3208, 3229, 3252, 3271, 3292, 3323, 3338, 3353, 3368, 3385, 3407, 3425, 3442, 3459, 3475, 3494, 3507, 3522, 3535, 3548, 3564, 3576, 3589, 3609, 3628, 3641, 3662, 3674, 3690, 3711, 3725, 3740, 3760, 3783, 3810, 3824, 3848, 3871, 3889, 3915, 3942, 3970, 3997, 4015, 4032, 4060, 4087, 4114, 4136, 4153, 4173, 4193, 4211, 4230, 4255, 4281, 4301, 4326, 4348, 4367, 4384, 4403, 4424, 4455, 4471, 4492, 4508, 4531, 4554, 4570, 4595, 4604, 4622, 4643, 4666, 4681, 4696, 4714, 4730, 4748, 4766, 4787, 4805, 4824, 4841, 4860, 4880, 4898, 4914, 4935, 4958, 4985, 5008, 5028, 5052, 5076, 5095, 5116, 5131, 5144, 5174, 5201, 5222, 5238, 5257, 5273, 5292, 5312, 5333, 5349, 5368, 5387, 5409, 5436, 5450, 5475, 5496, 5517, 5532, 5554, 5576, 5592, 5609, 5631, 5648, 5669, 5683, 5700, 5718, 5733, 5753, 5772, 5794, 5825, 5845, 5859, 5873, 5883, 5906, 5928, 5947, 5963, 5984, 6008, 6029, 6050, 6059, 6072, 6092, 6110, 6123, 6140, 6158, 6170, 6190, 6212, 6234, 6252, 6271, 6292, 6312, 6332, 6352, 6372, 6393, 6411, 6427, 6443, 6463, 6482, 6497, 6517, 6538, 6556, 6570, 6593, 6623, 6646, 6678, 6687} +var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3141, 3165, 3182, 3195, 3208, 3229, 3252, 3271, 3292, 3323, 3338, 3353, 3368, 3385, 3407, 3425, 3442, 3459, 3475, 3494, 3507, 3522, 3535, 3548, 3564, 3576, 3589, 3609, 3628, 3641, 3662, 3674, 3690, 3711, 3725, 3740, 3760, 3783, 3810, 3824, 3848, 3871, 3889, 3915, 3942, 3970, 3997, 4015, 4032, 4060, 4087, 4114, 4136, 4153, 4173, 4193, 4211, 4230, 4255, 4281, 4301, 4326, 4348, 4367, 4384, 4403, 4424, 4455, 4471, 4492, 4508, 4531, 4554, 4570, 4595, 4604, 4622, 4643, 4666, 4681, 4696, 4714, 4730, 4748, 4766, 4787, 4805, 4824, 4841, 4860, 4880, 4898, 4914, 4935, 4958, 4985, 5008, 5028, 5052, 5076, 5095, 5116, 5131, 5144, 5174, 5201, 5222, 5238, 5257, 5273, 5292, 5312, 5333, 5349, 5368, 5387, 5409, 5436, 5450, 5475, 5496, 5517, 5532, 5554, 5576, 5592, 5609, 5631, 5648, 5669, 5683, 5700, 5718, 5733, 5753, 5772, 5794, 5825, 5845, 5859, 5873, 5883, 5906, 5928, 5947, 5963, 5984, 6008, 6029, 6050, 6059, 6072, 6092, 6110, 6123, 6140, 6158, 6170, 6190, 6212, 6234, 6252, 6271, 6292, 6312, 6332, 6352, 6372, 6393, 6411, 6427, 6443, 6463, 6482, 6497, 6517, 6538, 6556, 6570, 6590, 6613, 6643, 6666, 6698, 6707} func (i Kind) String() string { if i < 0 || i >= Kind(len(_Kind_index)-1) { diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 69ac2f9779..f256f52b78 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -20849,6 +20849,8 @@ func (c *Checker) getTypeFromTypeNodeWorker(node *ast.Node) *Type { return c.getTypeFromNamedTupleTypeNode(node) case ast.KindParenthesizedType: return c.getTypeFromTypeNode(node.AsParenthesizedTypeNode().Type) + case ast.KindJSTypeExpression: + return c.getTypeFromTypeNode(node.AsJSTypeExpression().Type) case ast.KindRestType: return c.getTypeFromRestTypeNode(node) case ast.KindFunctionType, ast.KindConstructorType, ast.KindTypeLiteral: diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index 0149988fa0..1ec1afd7fb 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -56,10 +56,42 @@ func (p *Parser) withJSDoc(node *ast.Node, hasJSDoc bool) { p.hasDeprecatedTag = false node.Flags |= ast.NodeFlagsDeprecated } + if p.scriptKind == core.ScriptKindJS || p.scriptKind == core.ScriptKindJSX { + p.attachJSDoc(node, jsDoc) + } p.jsdocCache[node] = jsDoc } } +func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { + // 1. modify the attached node + // 1b. Tags that modify their host node should only be taken from the last JSDoc (@overload is 'attached' but actually emits a separate signature node) + // 2. later, output additional sibling nodes (probably unrelated) into the nearest containing node list + for _, j := range jsDoc { + isLast := j == jsDoc[len(jsDoc)-1] + tags := j.AsJSDoc().Tags + if tags != nil { + for _, tag := range j.AsJSDoc().Tags.Nodes { + if isLast && tag.Kind == ast.KindJSDocTypeTag { + // TODO: This is somehow messing up symbols of patterns I'm NOT changing + if host.Kind == ast.KindVariableStatement && host.AsVariableStatement().DeclarationList != nil { + // TODO: Could still clone the node and mark it synthetic + for _, declaration := range host.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { + if declaration.AsVariableDeclaration().Type == nil { + t := p.factory.NewJSDocTypeExpression(tag.AsJSDocTypeTag().TypeExpression) + // TODO: What other flags? Copy from decl? from tag's typeexpression? + t.Flags |= p.contextFlags | ast.NodeFlagsSynthesized + t.Loc = core.NewTextRange(t.Type().Pos(), t.Type().End()) + declaration.AsVariableDeclaration().Type = t + } + } + } + } + } + } + } +} + func (p *Parser) parseJSDocTypeExpression(mayOmitBraces bool) *ast.Node { pos := p.nodePos() var hasBrace bool diff --git a/internal/testutil/tsbaseline/type_symbol_baseline.go b/internal/testutil/tsbaseline/type_symbol_baseline.go index ac930e8309..50dfc6c872 100644 --- a/internal/testutil/tsbaseline/type_symbol_baseline.go +++ b/internal/testutil/tsbaseline/type_symbol_baseline.go @@ -150,6 +150,9 @@ func iterateBaseline(allFiles []*harnessutil.TestFile, fullWalker *typeWriterWal if isSymbolBaseline && result.symbol == "" { return baselines } + if lastIndexWritten > result.line { + continue + } if lastIndexWritten == -1 { typeLines.WriteString(strings.Join(codeLines[:result.line+1], "\r\n")) typeLines.WriteString("\r\n") @@ -158,8 +161,10 @@ func iterateBaseline(allFiles []*harnessutil.TestFile, fullWalker *typeWriterWal (bracketLineRegex.MatchString(codeLines[lastIndexWritten+1]) || strings.TrimSpace(codeLines[lastIndexWritten+1]) == "")) { typeLines.WriteString("\r\n") } - typeLines.WriteString(strings.Join(codeLines[lastIndexWritten+1:result.line+1], "\r\n")) - typeLines.WriteString("\r\n") + if lastIndexWritten < result.line { + typeLines.WriteString(strings.Join(codeLines[lastIndexWritten+1:result.line+1], "\r\n")) + typeLines.WriteString("\r\n") + } } lastIndexWritten = result.line typeOrSymbolString := core.IfElse(isSymbolBaseline, result.symbol, result.typ) From eac0860de08943f4c6b84ceb147aee3ac5b66e3b Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 10 Mar 2025 11:20:23 -0700 Subject: [PATCH 02/25] couple of small bug fixes/refactors --- internal/ast/ast.go | 9 ++++++--- internal/parser/jsdoc.go | 39 +++++++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/internal/ast/ast.go b/internal/ast/ast.go index e630fa3697..20724b926e 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -488,6 +488,8 @@ func (n *Node) Type() *Node { return n.AsTemplateLiteralTypeSpan().Type case KindJSDocTypeExpression: return n.AsJSDocTypeExpression().Type + case KindJSTypeExpression: + return n.AsJSTypeExpression().Type case KindJSDocNullableType: return n.AsJSDocNullableType().Type case KindJSDocNonNullableType: @@ -7743,6 +7745,7 @@ func (node *JSDocOptionalType) Clone(f *NodeFactory) *Node { return cloneNode(f.NewJSDocOptionalType(node.Type), node.AsNode(), f.hooks) } +// TODO: This name is WAAAAAAAAAAAAY too close to JSDocTypeExpression. Either rename it or remove it or use an existing node // JSTypeExpression type JSTypeExpression struct { TypeNodeBase @@ -7752,12 +7755,12 @@ type JSTypeExpression struct { func (f *NodeFactory) NewJSTypeExpression(typeNode *TypeNode) *Node { data := &JSTypeExpression{} data.Type = typeNode - return newNode(KindJSTypeExpression, data) + return newNode(KindJSTypeExpression, data, f.hooks) } func (f *NodeFactory) UpdateJSTypeExpression(node *JSTypeExpression, typeNode *TypeNode) *Node { if typeNode != node.Type { - return updateNode(f.NewJSTypeExpression(typeNode), node.AsNode()) + return updateNode(f.NewJSTypeExpression(typeNode), node.AsNode(), f.hooks) } return node.AsNode() } @@ -7771,7 +7774,7 @@ func (node *JSTypeExpression) VisitEachChild(v *NodeVisitor) *Node { } func (node *JSTypeExpression) Clone(f *NodeFactory) *Node { - return updateNode(f.NewJSTypeExpression(node.Type), node.AsNode()) + return updateNode(f.NewJSTypeExpression(node.Type), node.AsNode(), f.hooks) } func IsJSTypeExpression(node *Node) bool { diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index 1ec1afd7fb..955ea13620 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -57,6 +57,10 @@ func (p *Parser) withJSDoc(node *ast.Node, hasJSDoc bool) { node.Flags |= ast.NodeFlagsDeprecated } if p.scriptKind == core.ScriptKindJS || p.scriptKind == core.ScriptKindJSX { + // TODO: This will attach type-system information, but it doesn't have a plan for attaching + // non-type-system tags to the right place. + // The most likely place this will be a problem is TSDoc, if TSDoc lets people write their tags + // on arrow initialisers of constants. p.attachJSDoc(node, jsDoc) } p.jsdocCache[node] = jsDoc @@ -70,23 +74,30 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { for _, j := range jsDoc { isLast := j == jsDoc[len(jsDoc)-1] tags := j.AsJSDoc().Tags - if tags != nil { - for _, tag := range j.AsJSDoc().Tags.Nodes { - if isLast && tag.Kind == ast.KindJSDocTypeTag { - // TODO: This is somehow messing up symbols of patterns I'm NOT changing - if host.Kind == ast.KindVariableStatement && host.AsVariableStatement().DeclarationList != nil { - // TODO: Could still clone the node and mark it synthetic - for _, declaration := range host.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { - if declaration.AsVariableDeclaration().Type == nil { - t := p.factory.NewJSDocTypeExpression(tag.AsJSDocTypeTag().TypeExpression) - // TODO: What other flags? Copy from decl? from tag's typeexpression? - t.Flags |= p.contextFlags | ast.NodeFlagsSynthesized - t.Loc = core.NewTextRange(t.Type().Pos(), t.Type().End()) - declaration.AsVariableDeclaration().Type = t - } + if tags == nil { + continue + } + for _, tag := range j.AsJSDoc().Tags.Nodes { + if !isLast { + // TODO: @overload and unattached tags support goes here + continue + } + switch tag.Kind { + case ast.KindJSDocTypeTag: + if host.Kind == ast.KindVariableStatement && host.AsVariableStatement().DeclarationList != nil { + // TODO: Could still clone the node and mark it synthetic + for _, declaration := range host.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { + if declaration.AsVariableDeclaration().Type == nil { + t := p.factory.NewJSTypeExpression(tag.AsJSDocTypeTag().TypeExpression.Type()) + // TODO: What other flags? Copy from decl? from tag's typeexpression? + t.Flags |= p.contextFlags | ast.NodeFlagsSynthesized + t.Loc = core.NewTextRange(t.Type().Pos(), t.Type().End()) + declaration.AsVariableDeclaration().Type = t } } } + // for a certain host, like a parameter declaration, with an initialiser that itself has jsdoc, + // those jsdoc are related to } } } From fce99be2a1ec32256103be5a6d3d63005e75081f Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 10 Mar 2025 15:07:26 -0700 Subject: [PATCH 03/25] Add basic uses of type and return tags For example, recursive uses aren't done yet. Test diffs look generally right but are hard to evaluate without typedef and template tags, specifically. --- internal/parser/jsdoc.go | 98 +++++++++++- ...rgumentsReferenceInConstructor4_Js.symbols | 2 - ...ntsReferenceInConstructor4_Js.symbols.diff | 4 +- .../argumentsReferenceInMethod4_Js.symbols | 2 - ...rgumentsReferenceInMethod4_Js.symbols.diff | 4 +- ...kJsObjectLiteralHasCheckedKeyof.errors.txt | 18 +++ ...jectLiteralHasCheckedKeyof.errors.txt.diff | 23 --- ...JsdocTypeTagOnExportAssignment1.errors.txt | 19 +++ ...TypeTagOnExportAssignment1.errors.txt.diff | 36 +++-- ...eckJsdocTypeTagOnExportAssignment1.symbols | 2 + ...docTypeTagOnExportAssignment1.symbols.diff | 11 ++ ...JsdocTypeTagOnExportAssignment2.errors.txt | 19 +++ ...TypeTagOnExportAssignment2.errors.txt.diff | 36 +++-- ...eckJsdocTypeTagOnExportAssignment2.symbols | 2 + ...docTypeTagOnExportAssignment2.symbols.diff | 6 + ...JsdocTypeTagOnExportAssignment3.errors.txt | 21 +++ ...TypeTagOnExportAssignment3.errors.txt.diff | 38 +++-- ...eckJsdocTypeTagOnExportAssignment3.symbols | 2 + ...docTypeTagOnExportAssignment3.symbols.diff | 11 ++ ...JsdocTypeTagOnExportAssignment4.errors.txt | 14 ++ ...TypeTagOnExportAssignment4.errors.txt.diff | 29 ++-- ...eckJsdocTypeTagOnExportAssignment4.symbols | 3 +- ...docTypeTagOnExportAssignment4.symbols.diff | 17 +++ ...JsdocTypeTagOnExportAssignment5.errors.txt | 19 +++ ...TypeTagOnExportAssignment5.errors.txt.diff | 24 +++ ...eckJsdocTypeTagOnExportAssignment5.symbols | 2 + ...docTypeTagOnExportAssignment5.symbols.diff | 11 ++ ...JsdocTypeTagOnExportAssignment6.errors.txt | 19 +++ ...TypeTagOnExportAssignment6.errors.txt.diff | 36 +++-- ...eckJsdocTypeTagOnExportAssignment6.symbols | 2 + ...docTypeTagOnExportAssignment6.symbols.diff | 11 ++ ...JsdocTypeTagOnExportAssignment7.errors.txt | 21 +++ ...TypeTagOnExportAssignment7.errors.txt.diff | 26 ++++ ...eckJsdocTypeTagOnExportAssignment7.symbols | 2 + ...docTypeTagOnExportAssignment7.symbols.diff | 11 ++ ...JsdocTypeTagOnExportAssignment8.errors.txt | 18 +++ ...TypeTagOnExportAssignment8.errors.txt.diff | 23 +++ ...eckJsdocTypeTagOnExportAssignment8.symbols | 2 + ...docTypeTagOnExportAssignment8.symbols.diff | 11 ++ ...yTypedParametersOptionalInJSDoc.errors.txt | 8 +- ...dParametersOptionalInJSDoc.errors.txt.diff | 18 ++- ...nferenceFromAnnotatedFunctionJs.errors.txt | 11 +- ...nceFromAnnotatedFunctionJs.errors.txt.diff | 11 +- ...ithAnnotatedOptionalParameterJs.errors.txt | 5 +- ...notatedOptionalParameterJs.errors.txt.diff | 5 +- .../compiler/controlFlowInstanceof.errors.txt | 8 +- .../controlFlowInstanceof.errors.txt.diff | 8 +- ...xpandoFunctionContextualTypesJs.errors.txt | 14 +- ...oFunctionContextualTypesJs.errors.txt.diff | 14 +- .../expandoFunctionContextualTypesJs.symbols | 2 - ...andoFunctionContextualTypesJs.symbols.diff | 4 +- .../exportDefaultWithJSDoc1.errors.txt | 16 ++ .../exportDefaultWithJSDoc1.errors.txt.diff | 21 +++ .../compiler/exportDefaultWithJSDoc1.symbols | 2 +- .../exportDefaultWithJSDoc1.symbols.diff | 17 +++ .../importTypeResolutionJSDocEOF.errors.txt | 15 ++ ...portTypeResolutionJSDocEOF.errors.txt.diff | 20 +++ .../jsDeclarationsInheritedTypes.errors.txt | 46 ++++++ ...DeclarationsInheritedTypes.errors.txt.diff | 51 +++++++ .../compiler/jsEnumCrossFileExport.errors.txt | 8 +- .../jsEnumCrossFileExport.errors.txt.diff | 8 +- .../jsEnumTagOnObjectFrozen.errors.txt | 5 +- .../jsEnumTagOnObjectFrozen.errors.txt.diff | 5 +- .../jsFileFunctionOverloads.errors.txt | 64 ++++++++ .../jsFileFunctionOverloads.errors.txt.diff | 69 +++++++++ .../jsFileFunctionOverloads2.errors.txt | 59 ++++++++ .../jsFileFunctionOverloads2.errors.txt.diff | 64 ++++++++ ...ocArrayObjectPromiseImplicitAny.errors.txt | 63 ++++++++ ...ayObjectPromiseImplicitAny.errors.txt.diff | 68 +++++++++ ...ArrayObjectPromiseNoImplicitAny.errors.txt | 20 ++- ...ObjectPromiseNoImplicitAny.errors.txt.diff | 45 +++--- .../jsdocBracelessTypeTag1.errors.txt | 6 +- .../jsdocBracelessTypeTag1.errors.txt.diff | 14 +- .../compiler/jsdocCallbackAndType.errors.txt | 15 ++ .../jsdocCallbackAndType.errors.txt.diff | 30 ++-- .../compiler/jsdocIllegalTags.errors.txt | 15 ++ .../compiler/jsdocIllegalTags.errors.txt.diff | 27 ++-- .../jsdocImportTypeResolution.errors.txt | 16 ++ .../jsdocImportTypeResolution.errors.txt.diff | 21 +++ ...docParameterParsingInfiniteLoop.errors.txt | 12 ++ ...rameterParsingInfiniteLoop.errors.txt.diff | 23 +-- .../jsdocTypedefMissingType.errors.txt | 20 +++ .../jsdocTypedefMissingType.errors.txt.diff | 38 +++-- ...jsdocTypedef_propertyWithNoType.errors.txt | 14 ++ ...Typedef_propertyWithNoType.errors.txt.diff | 19 +++ ...sizedJSDocCastAtReturnStatement.errors.txt | 9 +- ...JSDocCastAtReturnStatement.errors.txt.diff | 9 +- .../requireOfJsonFileInJsFile.symbols | 4 + .../requireOfJsonFileInJsFile.symbols.diff | 11 +- .../strictOptionalProperties3.errors.txt | 24 +++ .../strictOptionalProperties3.errors.txt.diff | 44 +++--- .../subclassThisTypeAssignable01.errors.txt | 7 +- ...bclassThisTypeAssignable01.errors.txt.diff | 19 +-- .../assertionTypePredicates2.errors.txt | 29 ++++ .../assertionTypePredicates2.errors.txt.diff | 34 +++++ ...ertionsAndNonReturningFunctions.errors.txt | 69 +++++++++ ...nsAndNonReturningFunctions.errors.txt.diff | 89 +++-------- .../asyncArrowFunction_allowJs.errors.txt | 50 +++++++ ...asyncArrowFunction_allowJs.errors.txt.diff | 83 +++++++---- .../asyncFunctionDeclaration16_es5.errors.txt | 67 +++++++++ ...cFunctionDeclaration16_es5.errors.txt.diff | 106 ++++++------- .../callbackOnConstructor.errors.txt | 20 +++ .../callbackOnConstructor.errors.txt.diff | 25 ++++ .../conformance/callbackTag1.errors.txt | 27 ++++ .../conformance/callbackTag1.errors.txt.diff | 32 ++++ .../conformance/callbackTag2.errors.txt | 11 +- .../conformance/callbackTag2.errors.txt.diff | 30 +++- .../conformance/callbackTag3.errors.txt | 13 ++ .../conformance/callbackTag3.errors.txt.diff | 18 +++ .../conformance/callbackTag4.errors.txt | 5 +- .../conformance/callbackTag4.errors.txt.diff | 5 +- .../callbackTagVariadicType.errors.txt | 6 +- .../callbackTagVariadicType.errors.txt.diff | 6 +- .../checkJsdocReturnTag2.errors.txt | 10 +- .../checkJsdocReturnTag2.errors.txt.diff | 32 ---- .../checkJsdocSatisfiesTag1.errors.txt | 38 +++++ .../checkJsdocSatisfiesTag1.errors.txt.diff | 62 ++++---- .../checkJsdocSatisfiesTag1.symbols | 2 + .../checkJsdocSatisfiesTag1.symbols.diff | 2 + .../checkJsdocSatisfiesTag3.errors.txt | 5 +- .../checkJsdocSatisfiesTag3.errors.txt.diff | 9 +- .../conformance/checkJsdocTypeTag1.errors.txt | 24 ++- .../checkJsdocTypeTag1.errors.txt.diff | 48 +++--- .../conformance/checkJsdocTypeTag2.errors.txt | 50 +++++++ .../checkJsdocTypeTag2.errors.txt.diff | 85 ++++++----- .../conformance/checkJsdocTypeTag4.errors.txt | 18 +++ .../checkJsdocTypeTag4.errors.txt.diff | 36 ++--- .../conformance/checkJsdocTypeTag5.errors.txt | 64 ++++++++ .../checkJsdocTypeTag5.errors.txt.diff | 106 ++++++------- .../conformance/checkJsdocTypeTag6.errors.txt | 52 +++++++ .../checkJsdocTypeTag6.errors.txt.diff | 87 +++++------ ...ckJsdocTypeTagOnObjectProperty1.errors.txt | 12 +- ...ocTypeTagOnObjectProperty1.errors.txt.diff | 12 +- ...ckJsdocTypeTagOnObjectProperty2.errors.txt | 36 +++++ ...ocTypeTagOnObjectProperty2.errors.txt.diff | 64 ++++---- ...checkJsdocTypedefOnlySourceFile.errors.txt | 5 +- ...JsdocTypedefOnlySourceFile.errors.txt.diff | 11 +- ...checkSpecialPropertyAssignments.errors.txt | 7 +- ...SpecialPropertyAssignments.errors.txt.diff | 16 +- ...torFunctionMethodTypeParameters.errors.txt | 40 +++++ ...nctionMethodTypeParameters.errors.txt.diff | 45 ++++++ .../submodule/conformance/enumTag.errors.txt | 5 +- .../conformance/enumTag.errors.txt.diff | 12 +- .../conformance/enumTagImported.errors.txt | 31 ++++ .../enumTagImported.errors.txt.diff | 36 +++++ .../enumTagUseBeforeDefCrash.errors.txt | 16 ++ .../enumTagUseBeforeDefCrash.errors.txt.diff | 21 +++ .../errorOnFunctionReturnType.errors.txt | 56 +++++++ .../errorOnFunctionReturnType.errors.txt.diff | 106 ++++++------- .../exportedEnumTypeAndValue.errors.txt | 19 +++ .../exportedEnumTypeAndValue.errors.txt.diff | 24 +++ .../conformance/importTag17.errors.txt | 44 ++++++ .../conformance/importTag17.errors.txt.diff | 67 ++++----- .../conformance/inferThis.errors.txt | 36 +++++ .../conformance/inferThis.errors.txt.diff | 41 ++++++ ...ypeParameterOnVariableStatement.errors.txt | 22 +++ ...rameterOnVariableStatement.errors.txt.diff | 27 ++++ .../jsDeclarationsClasses.errors.txt | 26 +++- .../jsDeclarationsClasses.errors.txt.diff | 26 +++- .../jsDeclarationsEnumTag.errors.txt | 54 +++++++ .../jsDeclarationsEnumTag.errors.txt.diff | 59 ++++++++ ...rationsExportDefinePropertyEmit.errors.txt | 8 +- ...nsExportDefinePropertyEmit.errors.txt.diff | 8 +- ...ctionClassesCjsExportAssignment.errors.txt | 5 +- ...ClassesCjsExportAssignment.errors.txt.diff | 5 +- .../jsDeclarationsFunctions.errors.txt | 67 +++++++++ .../jsDeclarationsFunctions.errors.txt.diff | 72 +++++++++ ...portAliasExposedWithinNamespace.errors.txt | 10 +- ...liasExposedWithinNamespace.errors.txt.diff | 26 +++- ...tAliasExposedWithinNamespaceCjs.errors.txt | 5 +- ...sExposedWithinNamespaceCjs.errors.txt.diff | 5 +- ...eclarationsImportNamespacedType.errors.txt | 14 ++ ...ationsImportNamespacedType.errors.txt.diff | 19 +++ ...jsDeclarationsImportTypeBundled.errors.txt | 10 +- ...larationsImportTypeBundled.errors.txt.diff | 10 +- ...larationsJSDocRedirectedLookups.errors.txt | 40 ++++- ...ionsJSDocRedirectedLookups.errors.txt.diff | 38 ++++- ...DeclarationsJSDocRedirectedLookups.symbols | 17 +++ ...rationsJSDocRedirectedLookups.symbols.diff | 77 +++++++++- ...clarationsMissingTypeParameters.errors.txt | 26 ++++ ...tionsMissingTypeParameters.errors.txt.diff | 31 ++++ ...larationsModuleReferenceHasEmit.errors.txt | 19 +++ ...ionsModuleReferenceHasEmit.errors.txt.diff | 24 +++ .../jsDeclarationsNestedParams.errors.txt | 8 +- ...jsDeclarationsNestedParams.errors.txt.diff | 8 +- ...ameterTagReusesInputNodeInEmit1.errors.txt | 8 +- ...rTagReusesInputNodeInEmit1.errors.txt.diff | 8 +- ...ameterTagReusesInputNodeInEmit2.errors.txt | 8 +- ...rTagReusesInputNodeInEmit2.errors.txt.diff | 8 +- .../jsDeclarationsReactComponents.errors.txt | 5 +- ...eclarationsReactComponents.errors.txt.diff | 5 +- .../jsDeclarationsReactComponents.symbols | 6 +- ...jsDeclarationsReactComponents.symbols.diff | 11 +- ...sExistingNodesMappingJSDocTypes.errors.txt | 38 +++++ ...tingNodesMappingJSDocTypes.errors.txt.diff | 43 ++++++ .../jsDeclarationsTypeAliases.errors.txt | 5 +- .../jsDeclarationsTypeAliases.errors.txt.diff | 5 +- ...DeclarationsTypedefAndLatebound.errors.txt | 5 +- ...rationsTypedefAndLatebound.errors.txt.diff | 5 +- ...jsDeclarationsUniqueSymbolUsage.errors.txt | 20 +++ ...larationsUniqueSymbolUsage.errors.txt.diff | 25 ++++ .../conformance/jsdocFunctionType.errors.txt | 17 ++- .../jsdocFunctionType.errors.txt.diff | 28 +++- .../conformance/jsdocImportType.errors.txt | 33 +++++ .../jsdocImportType.errors.txt.diff | 38 +++++ .../conformance/jsdocImportType2.errors.txt | 32 ++++ .../jsdocImportType2.errors.txt.diff | 37 +++++ ...ortTypeReferenceToStringLiteral.errors.txt | 12 ++ ...peReferenceToStringLiteral.errors.txt.diff | 17 +++ .../jsdocIndexSignature.errors.txt | 24 +++ .../jsdocIndexSignature.errors.txt.diff | 42 +++--- .../jsdocOuterTypeParameters1.errors.txt | 5 +- .../jsdocOuterTypeParameters1.errors.txt.diff | 8 +- .../jsdocOuterTypeParameters2.errors.txt | 5 +- .../jsdocOuterTypeParameters2.errors.txt.diff | 7 +- .../jsdocParseHigherOrderFunction.errors.txt | 6 +- ...ocParseHigherOrderFunction.errors.txt.diff | 6 +- ...arseParenthesizedJSDocParameter.errors.txt | 6 +- ...arenthesizedJSDocParameter.errors.txt.diff | 6 +- .../conformance/jsdocPrivateName1.errors.txt | 11 ++ .../jsdocPrivateName1.errors.txt.diff | 16 -- .../conformance/jsdocReturnTag1.errors.txt | 5 +- .../jsdocReturnTag1.errors.txt.diff | 5 +- ...sdocSignatureOnReturnedFunction.errors.txt | 14 +- ...ignatureOnReturnedFunction.errors.txt.diff | 14 +- .../jsdocSignatureOnReturnedFunction.symbols | 6 + ...ocSignatureOnReturnedFunction.symbols.diff | 22 +++ .../conformance/jsdocTemplateClass.errors.txt | 5 +- .../jsdocTemplateClass.errors.txt.diff | 16 +- ...docTemplateConstructorFunction2.errors.txt | 38 +++++ ...mplateConstructorFunction2.errors.txt.diff | 62 ++++---- .../conformance/jsdocTemplateTag.errors.txt | 6 +- .../jsdocTemplateTag.errors.txt.diff | 18 ++- .../conformance/jsdocTemplateTag2.errors.txt | 17 +++ .../jsdocTemplateTag2.errors.txt.diff | 22 +++ .../conformance/jsdocTemplateTag3.errors.txt | 39 +++++ .../jsdocTemplateTag3.errors.txt.diff | 69 +++++---- .../conformance/jsdocTemplateTag5.errors.txt | 18 ++- .../jsdocTemplateTag5.errors.txt.diff | 18 ++- .../conformance/jsdocTemplateTag6.errors.txt | 20 ++- .../jsdocTemplateTag6.errors.txt.diff | 20 ++- .../conformance/jsdocTemplateTag7.errors.txt | 5 +- .../jsdocTemplateTag7.errors.txt.diff | 8 +- .../conformance/jsdocTemplateTag8.errors.txt | 41 +++--- .../jsdocTemplateTag8.errors.txt.diff | 68 +++++---- .../jsdocTemplateTagDefault.errors.txt | 81 ++++++++++ .../jsdocTemplateTagDefault.errors.txt.diff | 139 +++++++++--------- .../jsdocTemplateTagNameResolution.errors.txt | 16 ++ ...cTemplateTagNameResolution.errors.txt.diff | 28 ++-- .../conformance/jsdocThisType.errors.txt | 50 +++++++ .../conformance/jsdocThisType.errors.txt.diff | 89 ++++++----- .../conformance/jsdocThisType.symbols | 2 + .../conformance/jsdocThisType.symbols.diff | 20 +-- .../jsdocTypeDefAtStartOfFile.errors.txt | 17 +++ .../jsdocTypeDefAtStartOfFile.errors.txt.diff | 22 +++ .../jsdocTypeReferenceExports.errors.txt | 5 +- .../jsdocTypeReferenceExports.errors.txt.diff | 5 +- .../jsdocTypeReferenceToImport.errors.txt | 8 +- ...jsdocTypeReferenceToImport.errors.txt.diff | 8 +- ...jsdocTypeReferenceToMergedClass.errors.txt | 5 +- ...TypeReferenceToMergedClass.errors.txt.diff | 5 +- .../conformance/jsdocTypeTag.errors.txt | 110 +++++--------- .../conformance/jsdocTypeTag.errors.txt.diff | 110 +++++--------- .../conformance/jsdocTypeTagCast.errors.txt | 21 +-- .../jsdocTypeTagCast.errors.txt.diff | 41 ++---- .../jsdocTypeTagParameterType.errors.txt | 6 +- .../jsdocTypeTagParameterType.errors.txt.diff | 7 +- .../jsdocTypeTagRequiredParameters.errors.txt | 8 +- ...cTypeTagRequiredParameters.errors.txt.diff | 11 +- .../conformance/jsdocVariadicType.errors.txt | 15 ++ .../jsdocVariadicType.errors.txt.diff | 20 +++ .../conformance/overloadTag3.errors.txt | 5 +- .../conformance/overloadTag3.errors.txt.diff | 5 +- ...esOfGenericConstructorFunctions.errors.txt | 58 ++++++++ ...enericConstructorFunctions.errors.txt.diff | 63 ++++++++ ...ropertyAssignmentUseParentType2.errors.txt | 38 +++++ ...tyAssignmentUseParentType2.errors.txt.diff | 61 +++++--- .../propertyAssignmentUseParentType2.symbols | 12 +- ...pertyAssignmentUseParentType2.symbols.diff | 18 +-- ...ertyAssignmentMergeAcrossFiles2.errors.txt | 8 +- ...ssignmentMergeAcrossFiles2.errors.txt.diff | 9 +- ...tyAssignmentMergedTypeReference.errors.txt | 21 +++ ...ignmentMergedTypeReference.errors.txt.diff | 26 ++++ .../recursiveTypeReferences2.errors.txt | 33 +++++ .../recursiveTypeReferences2.errors.txt.diff | 46 ++---- .../templateInsideCallback.errors.txt | 8 +- .../templateInsideCallback.errors.txt.diff | 12 +- .../thisTypeOfConstructorFunctions.errors.txt | 61 ++++++++ ...TypeOfConstructorFunctions.errors.txt.diff | 66 +++++++++ .../typeFromContextualThisType.errors.txt | 36 ----- ...typeFromContextualThisType.errors.txt.diff | 41 ------ .../typeFromContextualThisType.symbols | 16 +- .../typeFromContextualThisType.symbols.diff | 28 ++-- .../typeFromJSInitializer.errors.txt | 14 +- .../typeFromJSInitializer.errors.txt.diff | 32 +--- .../typeFromJSInitializer4.errors.txt | 11 +- .../typeFromJSInitializer4.errors.txt.diff | 35 ----- .../typeFromPropertyAssignment.errors.txt | 8 +- ...typeFromPropertyAssignment.errors.txt.diff | 8 +- .../typeFromPropertyAssignment10.errors.txt | 5 +- ...peFromPropertyAssignment10.errors.txt.diff | 5 +- .../typeFromPropertyAssignment10_1.errors.txt | 5 +- ...FromPropertyAssignment10_1.errors.txt.diff | 5 +- .../typeFromPropertyAssignment14.errors.txt | 5 +- ...peFromPropertyAssignment14.errors.txt.diff | 5 +- .../typeFromPropertyAssignment15.errors.txt | 5 +- ...peFromPropertyAssignment15.errors.txt.diff | 5 +- .../typeFromPropertyAssignment16.errors.txt | 5 +- ...peFromPropertyAssignment16.errors.txt.diff | 5 +- .../typeFromPropertyAssignment2.errors.txt | 8 +- ...ypeFromPropertyAssignment2.errors.txt.diff | 8 +- .../typeFromPropertyAssignment24.errors.txt | 5 +- ...peFromPropertyAssignment24.errors.txt.diff | 5 +- .../typeFromPropertyAssignment3.errors.txt | 8 +- ...ypeFromPropertyAssignment3.errors.txt.diff | 8 +- .../typeFromPropertyAssignment4.errors.txt | 10 +- ...ypeFromPropertyAssignment4.errors.txt.diff | 10 +- .../typeFromPropertyAssignment40.errors.txt | 14 ++ ...peFromPropertyAssignment40.errors.txt.diff | 19 +++ .../typeFromPropertyAssignment5.errors.txt | 5 +- ...ypeFromPropertyAssignment5.errors.txt.diff | 5 +- ...romPropertyAssignmentOutOfOrder.errors.txt | 5 +- ...opertyAssignmentOutOfOrder.errors.txt.diff | 5 +- .../typeFromPrototypeAssignment3.errors.txt | 10 +- ...peFromPrototypeAssignment3.errors.txt.diff | 10 +- .../conformance/typeLookupInIIFE.errors.txt | 11 ++ .../typeLookupInIIFE.errors.txt.diff | 23 +-- .../conformance/typeTagNoErasure.errors.txt | 14 ++ .../typeTagNoErasure.errors.txt.diff | 29 ++-- ...eTagOnFunctionReferencesGeneric.errors.txt | 22 +++ ...nFunctionReferencesGeneric.errors.txt.diff | 27 ++++ .../conformance/typedefCrossModule.errors.txt | 11 +- .../typedefCrossModule.errors.txt.diff | 11 +- .../typedefCrossModule2.errors.txt | 8 +- .../typedefCrossModule2.errors.txt.diff | 8 +- .../typedefMultipleTypeParameters.errors.txt | 11 +- ...edefMultipleTypeParameters.errors.txt.diff | 16 +- .../typedefOnSemicolonClassElement.errors.txt | 13 ++ ...defOnSemicolonClassElement.errors.txt.diff | 18 +++ .../typedefOnStatements.errors.txt | 5 +- .../typedefOnStatements.errors.txt.diff | 9 +- .../conformance/typedefScope1.errors.txt | 27 ++++ .../conformance/typedefScope1.errors.txt.diff | 46 +++--- .../typedefTagExtraneousProperty.errors.txt | 6 +- ...pedefTagExtraneousProperty.errors.txt.diff | 6 +- .../conformance/typedefTagNested.errors.txt | 52 +++++++ .../typedefTagNested.errors.txt.diff | 57 +++++++ .../conformance/typedefTagNested.symbols | 6 - .../conformance/typedefTagNested.symbols.diff | 6 - .../typedefTagTypeResolution.errors.txt | 40 +++++ .../typedefTagTypeResolution.errors.txt.diff | 72 ++++----- 351 files changed, 6366 insertions(+), 1927 deletions(-) create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/importTag17.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/inferThis.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/inferThis.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index 955ea13620..329e31900e 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -61,12 +61,34 @@ func (p *Parser) withJSDoc(node *ast.Node, hasJSDoc bool) { // non-type-system tags to the right place. // The most likely place this will be a problem is TSDoc, if TSDoc lets people write their tags // on arrow initialisers of constants. + // The most likely solution is to re-implement getJSDocCommentsAndTags exclusively for external use. + // TODO: In general Strada has multiple ownership of JSDoc tags. I'm going to NOT do this and see what breaks. (Probably same as above) p.attachJSDoc(node, jsDoc) } p.jsdocCache[node] = jsDoc } } +// for a variable-like host, like a parameter declaration, with an initialiser that itself has jsdoc, +// those jsdoc also belong to the parameter declaration: +// function f(p = /** @type {number} */ 1) {} +// is equivalent to /** @param {number} p */ ... +// and function f(/** @type {number} */ p = 1) {} +// this is true of all tags, not just type tags. +// HOWEVER, I think it's fine to not support this at first. It is confusing and seems wrong. + +// looking upward, there are 3 cases that iterate (plus param/type param): +// 1. parent is property access/assignment/declaration/export assignment/return/namespace x.y.z/almost any assignment (!): +// - check parent for jsdoc as well +// 2. parent.parent is a variable statement and parent is almost any assignment (!): +// - check parent.parent for jsdoc as well +// 3. parent.parent.parent is a variable statement or parent.parent.parent is a variable statement whose initialiser is the host +// - check parent.parent.parent for jsdoc as well + +// inverting this to looking downward, cases (2) and (3) are covered by the existing code, mostly +// Case 1 means that property access et al need look down to their children in the same way + +// And all the cases might need to be recursive (but probably not in practise) func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { // 1. modify the attached node // 1b. Tags that modify their host node should only be taken from the last JSDoc (@overload is 'attached' but actually emits a separate signature node) @@ -83,26 +105,88 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { continue } switch tag.Kind { + // TODO: All/most of these need to apply to param/return et amici as well case ast.KindJSDocTypeTag: if host.Kind == ast.KindVariableStatement && host.AsVariableStatement().DeclarationList != nil { // TODO: Could still clone the node and mark it synthetic for _, declaration := range host.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { if declaration.AsVariableDeclaration().Type == nil { - t := p.factory.NewJSTypeExpression(tag.AsJSDocTypeTag().TypeExpression.Type()) - // TODO: What other flags? Copy from decl? from tag's typeexpression? - t.Flags |= p.contextFlags | ast.NodeFlagsSynthesized - t.Loc = core.NewTextRange(t.Type().Pos(), t.Type().End()) - declaration.AsVariableDeclaration().Type = t + declaration.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression) } } + } else if host.Kind == ast.KindPropertyDeclaration { + decl := host.AsPropertyDeclaration() + if decl.Type == nil { + decl.Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression) + } + } else if host.Kind == ast.KindPropertyAssignment { + prop := host.AsPropertyAssignment() + prop.Initializer = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), prop.Initializer) + } else if host.Kind == ast.KindExportAssignment { + export := host.AsExportAssignment() + export.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), export.Expression) + } else if host.Kind == ast.KindReturnStatement { + ret := host.AsReturnStatement() + ret.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), ret.Expression) + } + case ast.KindJSDocParameterTag: + // TODO + case ast.KindJSDocReturnTag: + if fun, ok := p.getFunctionLikeHost(host); ok { + if fun.Type() == nil { + fun.FunctionLikeData().Type = p.makeNewType(tag.AsJSDocReturnTag().TypeExpression) + } } - // for a certain host, like a parameter declaration, with an initialiser that itself has jsdoc, - // those jsdoc are related to } } } } +func (p *Parser) getFunctionLikeHost(host *ast.Node) (*ast.Node, bool) { + fun := host + if host.Kind == ast.KindVariableStatement && host.AsVariableStatement().DeclarationList != nil { + // NOTE: This takes the first decl but in Strada it applied to every decl + for _, declaration := range host.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { + if ast.IsFunctionLike(declaration.Initializer()) { + fun = declaration.Initializer() + break + } + } + } else if host.Kind == ast.KindPropertyAssignment { + fun = host.AsPropertyAssignment().Initializer + } else if host.Kind == ast.KindPropertyDeclaration { + fun = host.AsPropertyDeclaration().Initializer + } else if host.Kind == ast.KindExportAssignment { + fun = host.AsExportAssignment().Expression + } else if host.Kind == ast.KindReturnStatement { + fun = host.AsReturnStatement().Expression + } + if ast.IsFunctionLike(fun) { + return fun, true + } + return nil, false +} + +// TODO: assertions don't have the same error reporting behaviour as actual annotations. +// I need to decide whether it's OK to have different errors. (Yeah, it's OK.) +func (p *Parser) makeNewTypeAssertion(t *ast.TypeNode, e *ast.Node) *ast.Node { + assert := p.factory.NewTypeAssertion(t, e) + assert.Flags |= p.contextFlags | ast.NodeFlagsSynthesized + assert.Loc = core.NewTextRange(assert.Type().Pos(), assert.Type().End()) + return assert +} + +func (p *Parser) makeNewType(typeExpression *ast.TypeNode) *ast.Node { + if typeExpression == nil { + return nil + } + t := p.factory.NewJSTypeExpression(typeExpression.Type()) + // TODO: What other flags? Copy from decl? from tag's typeexpression? + t.Flags |= p.contextFlags | ast.NodeFlagsSynthesized + t.Loc = core.NewTextRange(t.Type().Pos(), t.Type().End()) + return t +} + func (p *Parser) parseJSDocTypeExpression(mayOmitBraces bool) *ast.Node { pos := p.nodePos() var hasBrace bool diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.symbols b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.symbols index 8563ae3157..bfd81cc31b 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.symbols +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.symbols @@ -36,9 +36,7 @@ class A { */ this.bar = arguments.bar; >this : Symbol(A, Decl(a.js, 0, 0)) ->arguments.bar : Symbol(bar, Decl(a.js, 36, 10)) >arguments : Symbol(arguments, Decl(a.js, 17, 7)) ->bar : Symbol(bar, Decl(a.js, 36, 10)) /** * @type object diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.symbols.diff b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.symbols.diff index cbf21c4795..09538b33ee 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.symbols.diff @@ -27,9 +27,7 @@ ->this.bar : Symbol(A.bar, Decl(a.js, 17, 35)) >this : Symbol(A, Decl(a.js, 0, 0)) ->bar : Symbol(A.bar, Decl(a.js, 17, 35)) -+>arguments.bar : Symbol(bar, Decl(a.js, 36, 10)) >arguments : Symbol(arguments, Decl(a.js, 17, 7)) -+>bar : Symbol(bar, Decl(a.js, 36, 10)) /** * @type object @@ -41,7 +39,7 @@ >arguments : Symbol(arguments, Decl(a.js, 17, 7)) >key : Symbol(key, Decl(a.js, 7, 7)) -@@= skipped -27, +25 lines =@@ +@@= skipped -27, +23 lines =@@ * @type object */ this.options = arguments; diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.symbols b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.symbols index 1e6cd7b1d6..1598196cb0 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.symbols +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.symbols @@ -35,9 +35,7 @@ class A { */ this.bar = arguments.bar; >this : Symbol(A, Decl(a.js, 0, 0)) ->arguments.bar : Symbol(bar, Decl(a.js, 34, 10)) >arguments : Symbol(arguments, Decl(a.js, 15, 7)) ->bar : Symbol(bar, Decl(a.js, 34, 10)) /** * @type object diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.symbols.diff b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.symbols.diff index 06205cf733..8462d0fb15 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.symbols.diff @@ -36,9 +36,7 @@ ->this.bar : Symbol(A.bar, Decl(a.js, 15, 35)) >this : Symbol(A, Decl(a.js, 0, 0)) ->bar : Symbol(A.bar, Decl(a.js, 15, 35)) -+>arguments.bar : Symbol(bar, Decl(a.js, 34, 10)) >arguments : Symbol(arguments, Decl(a.js, 15, 7)) -+>bar : Symbol(bar, Decl(a.js, 34, 10)) /** * @type object @@ -50,7 +48,7 @@ >arguments : Symbol(arguments, Decl(a.js, 15, 7)) >key : Symbol(key, Decl(a.js, 5, 7)) -@@= skipped -27, +25 lines =@@ +@@= skipped -27, +23 lines =@@ * @type object */ this.options = arguments; diff --git a/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt new file mode 100644 index 0000000000..50e261254c --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt @@ -0,0 +1,18 @@ +file.js(11,1): error TS2322: Type '"z"' is not assignable to type '"x" | "y"'. + + +==== file.js (1 errors) ==== + // @ts-check + const obj = { + x: 1, + y: 2 + }; + + /** + * @type {keyof typeof obj} + */ + let selected = "x"; + selected = "z"; // should fail + ~~~~~~~~ +!!! error TS2322: Type '"z"' is not assignable to type '"x" | "y"'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt.diff deleted file mode 100644 index f353883d9e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.checkJsObjectLiteralHasCheckedKeyof.errors.txt -+++ new.checkJsObjectLiteralHasCheckedKeyof.errors.txt -@@= skipped -0, +-1 lines =@@ --file.js(11,1): error TS2322: Type '"z"' is not assignable to type '"x" | "y"'. -- -- --==== file.js (1 errors) ==== -- // @ts-check -- const obj = { -- x: 1, -- y: 2 -- }; -- -- /** -- * @type {keyof typeof obj} -- */ -- let selected = "x"; -- selected = "z"; // should fail -- ~~~~~~~~ --!!! error TS2322: Type '"z"' is not assignable to type '"x" | "y"'. -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt new file mode 100644 index 0000000000..f52b8b168b --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt @@ -0,0 +1,19 @@ +a.js(7,12): error TS2304: Cannot find name 'Foo'. + + +==== a.js (1 errors) ==== + /** + * @typedef {Object} Foo + * @property {boolean} a + * @property {boolean} b + */ + + /** @type {Foo} */ + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + export default { c: false }; + +==== b.js (0 errors) ==== + import a from "./a"; + a; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt.diff index 1e8ac76736..4e0fd6c24e 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt.diff @@ -1,26 +1,24 @@ --- old.checkJsdocTypeTagOnExportAssignment1.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment1.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -a.js(8,18): error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. -- -- ++a.js(7,12): error TS2304: Cannot find name 'Foo'. + + -==== checkJsdocTypeTagOnExportAssignment1.js (0 errors) ==== - --==== a.js (1 errors) ==== -- /** -- * @typedef {Object} Foo -- * @property {boolean} a -- * @property {boolean} b -- */ -- -- /** @type {Foo} */ -- export default { c: false }; + ==== a.js (1 errors) ==== + /** + * @typedef {Object} Foo +@@= skipped -10, +8 lines =@@ + */ + + /** @type {Foo} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. + export default { c: false }; - ~ -!!! error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. -- --==== b.js (0 errors) ==== -- import a from "./a"; -- a; -- -@@= skipped --1, +1 lines =@@ -+ + + ==== b.js (0 errors) ==== + import a from "./a"; diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols index 7d4e43a11e..df8b662a25 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols @@ -10,6 +10,8 @@ */ /** @type {Foo} */ +>Foo : Symbol(Foo) + export default { c: false }; >c : Symbol(c, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff new file mode 100644 index 0000000000..eaaf5c4453 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff @@ -0,0 +1,11 @@ +--- old.checkJsdocTypeTagOnExportAssignment1.symbols ++++ new.checkJsdocTypeTagOnExportAssignment1.symbols +@@= skipped -9, +9 lines =@@ + */ + + /** @type {Foo} */ ++>Foo : Symbol(Foo) ++ + export default { c: false }; + >c : Symbol(c, Decl(a.js, 7, 16)) + diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt new file mode 100644 index 0000000000..f26aaeb518 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt @@ -0,0 +1,19 @@ +b.js(1,12): error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b + + +==== a.ts (0 errors) ==== + export interface Foo { + a: number; + b: number; + } + +==== b.js (1 errors) ==== + /** @type {import("./a").Foo} */ + ~~~~~~~~~~~~~~~~~ +!!! error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b + export default { c: false }; + +==== c.js (0 errors) ==== + import b from "./b"; + b; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt.diff index d5c9b8cf66..cd7affa2e5 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt.diff @@ -1,26 +1,24 @@ --- old.checkJsdocTypeTagOnExportAssignment2.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment2.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -b.js(2,18): error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. -- -- ++b.js(1,12): error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b + + -==== checkJsdocTypeTagOnExportAssignment2.js (0 errors) ==== - --==== a.ts (0 errors) ==== -- export interface Foo { -- a: number; -- b: number; -- } -- --==== b.js (1 errors) ==== -- /** @type {import("./a").Foo} */ -- export default { c: false }; + ==== a.ts (0 errors) ==== + export interface Foo { + a: number; +@@= skipped -10, +8 lines =@@ + + ==== b.js (1 errors) ==== + /** @type {import("./a").Foo} */ ++ ~~~~~~~~~~~~~~~~~ ++!!! error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b + export default { c: false }; - ~ -!!! error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. -- --==== c.js (0 errors) ==== -- import b from "./b"; -- b; -- -@@= skipped --1, +1 lines =@@ -+ + + ==== c.js (0 errors) ==== + import b from "./b"; diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols index 8b219df576..8df54fabcf 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols @@ -15,6 +15,8 @@ export interface Foo { === b.js === /** @type {import("./a").Foo} */ +>Foo : Symbol(Foo, Decl(a.ts, 0, 0)) + export default { c: false }; >c : Symbol(c, Decl(b.js, 1, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols.diff index 9392533fce..c443ee0b44 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols.diff @@ -13,3 +13,9 @@ } === b.js === + /** @type {import("./a").Foo} */ ++>Foo : Symbol(Foo, Decl(a.ts, 0, 0)) ++ + export default { c: false }; + >c : Symbol(c, Decl(b.js, 1, 16)) + diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt new file mode 100644 index 0000000000..f7a7891e8d --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt @@ -0,0 +1,21 @@ +a.js(9,12): error TS2304: Cannot find name 'Foo'. + + +==== a.js (1 errors) ==== + /** + * @typedef {Object} Foo + * @property {boolean} a + * @property {boolean} b + */ + + const bar = { c: 1 }; + + /** @type {Foo} */ + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + export default bar; + +==== b.js (0 errors) ==== + import a from "./a"; + a; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt.diff index 5ff3a7c368..30b59b40ee 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt.diff @@ -1,28 +1,24 @@ --- old.checkJsdocTypeTagOnExportAssignment3.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment3.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -a.js(10,16): error TS2739: Type '{ c: number; }' is missing the following properties from type 'Foo': a, b -- -- ++a.js(9,12): error TS2304: Cannot find name 'Foo'. + + -==== checkJsdocTypeTagOnExportAssignment3.js (0 errors) ==== - --==== a.js (1 errors) ==== -- /** -- * @typedef {Object} Foo -- * @property {boolean} a -- * @property {boolean} b -- */ -- -- const bar = { c: 1 }; -- -- /** @type {Foo} */ -- export default bar; + ==== a.js (1 errors) ==== + /** + * @typedef {Object} Foo +@@= skipped -12, +10 lines =@@ + const bar = { c: 1 }; + + /** @type {Foo} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. + export default bar; - ~~~ -!!! error TS2739: Type '{ c: number; }' is missing the following properties from type 'Foo': a, b -- --==== b.js (0 errors) ==== -- import a from "./a"; -- a; -- -@@= skipped --1, +1 lines =@@ -+ + + ==== b.js (0 errors) ==== + import a from "./a"; diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols index ed178d097d..98c268bf38 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols @@ -14,6 +14,8 @@ const bar = { c: 1 }; >c : Symbol(c, Decl(a.js, 6, 13)) /** @type {Foo} */ +>Foo : Symbol(Foo) + export default bar; >bar : Symbol(bar, Decl(a.js, 6, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff new file mode 100644 index 0000000000..027c03a16f --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff @@ -0,0 +1,11 @@ +--- old.checkJsdocTypeTagOnExportAssignment3.symbols ++++ new.checkJsdocTypeTagOnExportAssignment3.symbols +@@= skipped -13, +13 lines =@@ + >c : Symbol(c, Decl(a.js, 6, 13)) + + /** @type {Foo} */ ++>Foo : Symbol(Foo) ++ + export default bar; + >bar : Symbol(bar, Decl(a.js, 6, 5)) + diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt new file mode 100644 index 0000000000..f5148d4872 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt @@ -0,0 +1,14 @@ +a.js(5,12): error TS2304: Cannot find name 'Foo'. + + +==== a.js (1 errors) ==== + /** + * @typedef {number} Foo + */ + + /** @type {Foo} */ + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + export default ""; + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt.diff index 32ddc1e69a..91b0d71d40 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt.diff @@ -1,21 +1,22 @@ --- old.checkJsdocTypeTagOnExportAssignment4.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment4.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -a.js(6,16): error TS2322: Type 'string' is not assignable to type 'number'. -- -- ++a.js(5,12): error TS2304: Cannot find name 'Foo'. + + -==== checkJsdocTypeTagOnExportAssignment4.js (0 errors) ==== - --==== a.js (1 errors) ==== -- /** -- * @typedef {number} Foo -- */ -- -- /** @type {Foo} */ -- export default ""; + ==== a.js (1 errors) ==== + /** + * @typedef {number} Foo + */ + + /** @type {Foo} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. + export default ""; - ~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. -- -- -@@= skipped --1, +1 lines =@@ -+ + + diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols index 0a31928944..8515c3b151 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols @@ -3,12 +3,13 @@ === checkJsdocTypeTagOnExportAssignment4.js === === a.js === - /** * @typedef {number} Foo */ /** @type {Foo} */ +>Foo : Symbol(Foo) + export default ""; diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff new file mode 100644 index 0000000000..dd5ff7099f --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff @@ -0,0 +1,17 @@ +--- old.checkJsdocTypeTagOnExportAssignment4.symbols ++++ new.checkJsdocTypeTagOnExportAssignment4.symbols +@@= skipped -2, +2 lines =@@ + === checkJsdocTypeTagOnExportAssignment4.js === + + === a.js === +- + /** + * @typedef {number} Foo + */ + + /** @type {Foo} */ ++>Foo : Symbol(Foo) ++ + export default ""; + + diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt new file mode 100644 index 0000000000..bf99967b72 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt @@ -0,0 +1,19 @@ +a.js(7,12): error TS2304: Cannot find name 'Foo'. + + +==== a.js (1 errors) ==== + /** + * @typedef {Object} Foo + * @property {number} a + * @property {number} b + */ + + /** @type {Foo} */ + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + export default { a: 1, b: 1 }; + +==== b.js (0 errors) ==== + import a from "./a"; + a; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt.diff new file mode 100644 index 0000000000..ce9049574d --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt.diff @@ -0,0 +1,24 @@ +--- old.checkJsdocTypeTagOnExportAssignment5.errors.txt ++++ new.checkJsdocTypeTagOnExportAssignment5.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++a.js(7,12): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== a.js (1 errors) ==== ++ /** ++ * @typedef {Object} Foo ++ * @property {number} a ++ * @property {number} b ++ */ ++ ++ /** @type {Foo} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ export default { a: 1, b: 1 }; ++ ++==== b.js (0 errors) ==== ++ import a from "./a"; ++ a; ++ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols index 7241719456..c395ff57f6 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols @@ -10,6 +10,8 @@ */ /** @type {Foo} */ +>Foo : Symbol(Foo) + export default { a: 1, b: 1 }; >a : Symbol(a, Decl(a.js, 7, 16)) >b : Symbol(b, Decl(a.js, 7, 22)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff new file mode 100644 index 0000000000..0285760f0d --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff @@ -0,0 +1,11 @@ +--- old.checkJsdocTypeTagOnExportAssignment5.symbols ++++ new.checkJsdocTypeTagOnExportAssignment5.symbols +@@= skipped -9, +9 lines =@@ + */ + + /** @type {Foo} */ ++>Foo : Symbol(Foo) ++ + export default { a: 1, b: 1 }; + >a : Symbol(a, Decl(a.js, 7, 16)) + >b : Symbol(b, Decl(a.js, 7, 22)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt new file mode 100644 index 0000000000..519affa186 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt @@ -0,0 +1,19 @@ +a.js(7,12): error TS2304: Cannot find name 'Foo'. + + +==== a.js (1 errors) ==== + /** + * @typedef {Object} Foo + * @property {number} a + * @property {number} b + */ + + /** @type {Foo} */ + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + export default { a: 1, b: 1, c: 1 }; + +==== b.js (0 errors) ==== + import a from "./a"; + a; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt.diff index d0a046118c..9cc8a11eeb 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt.diff @@ -1,26 +1,24 @@ --- old.checkJsdocTypeTagOnExportAssignment6.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment6.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -a.js(8,30): error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. -- -- ++a.js(7,12): error TS2304: Cannot find name 'Foo'. + + -==== checkJsdocTypeTagOnExportAssignment6.js (0 errors) ==== - --==== a.js (1 errors) ==== -- /** -- * @typedef {Object} Foo -- * @property {number} a -- * @property {number} b -- */ -- -- /** @type {Foo} */ -- export default { a: 1, b: 1, c: 1 }; + ==== a.js (1 errors) ==== + /** + * @typedef {Object} Foo +@@= skipped -10, +8 lines =@@ + */ + + /** @type {Foo} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. + export default { a: 1, b: 1, c: 1 }; - ~ -!!! error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. -- --==== b.js (0 errors) ==== -- import a from "./a"; -- a; -- -@@= skipped --1, +1 lines =@@ -+ + + ==== b.js (0 errors) ==== + import a from "./a"; diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols index 6ad4743a12..b197ce6e43 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols @@ -10,6 +10,8 @@ */ /** @type {Foo} */ +>Foo : Symbol(Foo) + export default { a: 1, b: 1, c: 1 }; >a : Symbol(a, Decl(a.js, 7, 16)) >b : Symbol(b, Decl(a.js, 7, 22)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff new file mode 100644 index 0000000000..8419849105 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff @@ -0,0 +1,11 @@ +--- old.checkJsdocTypeTagOnExportAssignment6.symbols ++++ new.checkJsdocTypeTagOnExportAssignment6.symbols +@@= skipped -9, +9 lines =@@ + */ + + /** @type {Foo} */ ++>Foo : Symbol(Foo) ++ + export default { a: 1, b: 1, c: 1 }; + >a : Symbol(a, Decl(a.js, 7, 16)) + >b : Symbol(b, Decl(a.js, 7, 22)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt new file mode 100644 index 0000000000..27024c5f72 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt @@ -0,0 +1,21 @@ +a.js(9,12): error TS2304: Cannot find name 'Foo'. + + +==== a.js (1 errors) ==== + /** + * @typedef {Object} Foo + * @property {number} a + * @property {number} b + */ + + const abc = { a: 1, b: 1, c: 1 }; + + /** @type {Foo} */ + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + export default abc; + +==== b.js (0 errors) ==== + import a from "./a"; + a; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt.diff new file mode 100644 index 0000000000..4e2e8ee5c0 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt.diff @@ -0,0 +1,26 @@ +--- old.checkJsdocTypeTagOnExportAssignment7.errors.txt ++++ new.checkJsdocTypeTagOnExportAssignment7.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++a.js(9,12): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== a.js (1 errors) ==== ++ /** ++ * @typedef {Object} Foo ++ * @property {number} a ++ * @property {number} b ++ */ ++ ++ const abc = { a: 1, b: 1, c: 1 }; ++ ++ /** @type {Foo} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ export default abc; ++ ++==== b.js (0 errors) ==== ++ import a from "./a"; ++ a; ++ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols index 679099f3e2..27a46d588e 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols @@ -16,6 +16,8 @@ const abc = { a: 1, b: 1, c: 1 }; >c : Symbol(c, Decl(a.js, 6, 25)) /** @type {Foo} */ +>Foo : Symbol(Foo) + export default abc; >abc : Symbol(abc, Decl(a.js, 6, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff new file mode 100644 index 0000000000..aef2f4d6ce --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff @@ -0,0 +1,11 @@ +--- old.checkJsdocTypeTagOnExportAssignment7.symbols ++++ new.checkJsdocTypeTagOnExportAssignment7.symbols +@@= skipped -15, +15 lines =@@ + >c : Symbol(c, Decl(a.js, 6, 25)) + + /** @type {Foo} */ ++>Foo : Symbol(Foo) ++ + export default abc; + >abc : Symbol(abc, Decl(a.js, 6, 5)) + diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt new file mode 100644 index 0000000000..6171d28ef9 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt @@ -0,0 +1,18 @@ +a.js(7,12): error TS2304: Cannot find name 'Foo'. + + +==== a.js (1 errors) ==== + /** + * @typedef Foo + * @property {string} a + * @property {'b'} b + */ + + /** @type {Foo} */ + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + export default { + a: 'a', + b: 'b' + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt.diff new file mode 100644 index 0000000000..e01014582b --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt.diff @@ -0,0 +1,23 @@ +--- old.checkJsdocTypeTagOnExportAssignment8.errors.txt ++++ new.checkJsdocTypeTagOnExportAssignment8.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++a.js(7,12): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== a.js (1 errors) ==== ++ /** ++ * @typedef Foo ++ * @property {string} a ++ * @property {'b'} b ++ */ ++ ++ /** @type {Foo} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ export default { ++ a: 'a', ++ b: 'b' ++ } ++ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols index 4e606e8a8b..afe5a7da4f 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols @@ -10,6 +10,8 @@ */ /** @type {Foo} */ +>Foo : Symbol(Foo) + export default { a: 'a', >a : Symbol(a, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff new file mode 100644 index 0000000000..b86b9ae397 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff @@ -0,0 +1,11 @@ +--- old.checkJsdocTypeTagOnExportAssignment8.symbols ++++ new.checkJsdocTypeTagOnExportAssignment8.symbols +@@= skipped -9, +9 lines =@@ + */ + + /** @type {Foo} */ ++>Foo : Symbol(Foo) ++ + export default { + a: 'a', + >a : Symbol(a, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt index 0e7a53e74f..e5fd968e1f 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt @@ -1,13 +1,15 @@ index.js(5,20): error TS7006: Parameter 'num' implicitly has an 'any' type. +index.js(11,12): error TS2304: Cannot find name 'Fn'. index.js(16,17): error TS7006: Parameter 'a' implicitly has an 'any' type. index.js(16,20): error TS7006: Parameter 'b' implicitly has an 'any' type. index.js(18,5): error TS2554: Expected 2 arguments, but got 1. +index.js(22,12): error TS2304: Cannot find name 'Fn'. index.js(27,17): error TS7006: Parameter 'a' implicitly has an 'any' type. index.js(27,20): error TS7006: Parameter 'b' implicitly has an 'any' type. index.js(29,5): error TS2554: Expected 2 arguments, but got 1. -==== index.js (7 errors) ==== +==== index.js (9 errors) ==== /** * * @param {number} num @@ -21,6 +23,8 @@ index.js(29,5): error TS2554: Expected 2 arguments, but got 1. */ /** @type {Fn} */ + ~~ +!!! error TS2304: Cannot find name 'Fn'. const fn1 = /** * @param [b] @@ -39,6 +43,8 @@ index.js(29,5): error TS2554: Expected 2 arguments, but got 1. }; /** @type {Fn} */ + ~~ +!!! error TS2304: Cannot find name 'Fn'. const fn2 = /** * @param {number} [b] diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff index 502c07252a..5582f904d8 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff @@ -6,16 +6,18 @@ -index.js(28,15): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. - Type 'undefined' is not assignable to type 'number'. +index.js(5,20): error TS7006: Parameter 'num' implicitly has an 'any' type. ++index.js(11,12): error TS2304: Cannot find name 'Fn'. +index.js(16,17): error TS7006: Parameter 'a' implicitly has an 'any' type. +index.js(16,20): error TS7006: Parameter 'b' implicitly has an 'any' type. +index.js(18,5): error TS2554: Expected 2 arguments, but got 1. ++index.js(22,12): error TS2304: Cannot find name 'Fn'. +index.js(27,17): error TS7006: Parameter 'a' implicitly has an 'any' type. +index.js(27,20): error TS7006: Parameter 'b' implicitly has an 'any' type. +index.js(29,5): error TS2554: Expected 2 arguments, but got 1. -==== index.js (2 errors) ==== -+==== index.js (7 errors) ==== ++==== index.js (9 errors) ==== /** * * @param {number} num @@ -26,7 +28,13 @@ /** * @typedef {(a: string, b: number) => void} Fn -@@= skipped -20, +25 lines =@@ + */ + + /** @type {Fn} */ ++ ~~ ++!!! error TS2304: Cannot find name 'Fn'. + const fn1 = + /** * @param [b] */ function self(a, b) { @@ -45,7 +53,11 @@ self("", undefined); }; -@@= skipped -14, +18 lines =@@ + /** @type {Fn} */ ++ ~~ ++!!! error TS2304: Cannot find name 'Fn'. + const fn2 = + /** * @param {number} [b] */ function self(a, b) { diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt index d9c6c3bfc0..503ab646db 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt @@ -1,8 +1,11 @@ +index.js(11,15): error TS2304: Cannot find name 'A'. +index.js(11,18): error TS2304: Cannot find name 'B'. index.js(13,14): error TS7006: Parameter 'fns' implicitly has an 'any' type. +index.js(14,3): error TS2322: Type 'null' is not assignable to type '[A, B]'. index.js(21,8): error TS7006: Parameter 'a' implicitly has an 'any' type. -==== index.js (2 errors) ==== +==== index.js (5 errors) ==== /** * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs * @template A @@ -14,11 +17,17 @@ index.js(21,8): error TS7006: Parameter 'a' implicitly has an 'any' type. * @template {Record} B * @param {Funcs} fns * @returns {[A, B]} + ~ +!!! error TS2304: Cannot find name 'A'. + ~ +!!! error TS2304: Cannot find name 'B'. */ function foo(fns) { ~~~ !!! error TS7006: Parameter 'fns' implicitly has an 'any' type. return /** @type {any} */ (null); + ~~~~~~ +!!! error TS2322: Type 'null' is not assignable to type '[A, B]'. } const result = foo({ diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff index 1c6304dd5d..6eaa271945 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff @@ -3,11 +3,14 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++index.js(11,15): error TS2304: Cannot find name 'A'. ++index.js(11,18): error TS2304: Cannot find name 'B'. +index.js(13,14): error TS7006: Parameter 'fns' implicitly has an 'any' type. ++index.js(14,3): error TS2322: Type 'null' is not assignable to type '[A, B]'. +index.js(21,8): error TS7006: Parameter 'a' implicitly has an 'any' type. + + -+==== index.js (2 errors) ==== ++==== index.js (5 errors) ==== + /** + * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs + * @template A @@ -19,11 +22,17 @@ + * @template {Record} B + * @param {Funcs} fns + * @returns {[A, B]} ++ ~ ++!!! error TS2304: Cannot find name 'A'. ++ ~ ++!!! error TS2304: Cannot find name 'B'. + */ + function foo(fns) { + ~~~ +!!! error TS7006: Parameter 'fns' implicitly has an 'any' type. + return /** @type {any} */ (null); ++ ~~~~~~ ++!!! error TS2322: Type 'null' is not assignable to type '[A, B]'. + } + + const result = foo({ diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt index 3415d56135..24a9382d3e 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt @@ -1,14 +1,17 @@ +index.js(4,14): error TS2304: Cannot find name 'T'. index.js(6,17): error TS7006: Parameter 'predicate' implicitly has an 'any' type. index.js(14,4): error TS7006: Parameter 'pose' implicitly has an 'any' type. index.js(22,4): error TS7006: Parameter 'pose' implicitly has an 'any' type. index.js(22,10): error TS7006: Parameter '_' implicitly has an 'any' type. -==== index.js (4 errors) ==== +==== index.js (5 errors) ==== /** * @template T * @param {(value: T, index: number) => boolean} predicate * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. */ function filter(predicate) { ~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff index 7dd3b2988c..d9a7efdec2 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff @@ -3,17 +3,20 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++index.js(4,14): error TS2304: Cannot find name 'T'. +index.js(6,17): error TS7006: Parameter 'predicate' implicitly has an 'any' type. +index.js(14,4): error TS7006: Parameter 'pose' implicitly has an 'any' type. +index.js(22,4): error TS7006: Parameter 'pose' implicitly has an 'any' type. +index.js(22,10): error TS7006: Parameter '_' implicitly has an 'any' type. + + -+==== index.js (4 errors) ==== ++==== index.js (5 errors) ==== + /** + * @template T + * @param {(value: T, index: number) => boolean} predicate + * @returns {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function filter(predicate) { + ~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.errors.txt b/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.errors.txt index eb25e6a545..dc1deddbb6 100644 --- a/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.errors.txt @@ -26,8 +26,6 @@ controlFlowInstanceof.ts(105,5): error TS2349: This expression is not callable. Not all constituents of type '() => void | null' are callable. Type 'null' has no call signatures. controlFlowInstanceof.ts(105,5): error TS2721: Cannot invoke an object which is possibly 'null'. -uglify.js(5,5): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. -uglify.js(6,7): error TS2339: Property 'val' does not exist on type 'number'. !!! error TS2318: Cannot find global type 'Array'. @@ -185,16 +183,12 @@ uglify.js(6,7): error TS2339: Property 'val' does not exist on type 'number'. } // Repro from #27550 (based on uglify code) -==== uglify.js (2 errors) ==== +==== uglify.js (0 errors) ==== /** @constructor */ function AtTop(val) { this.val = val } /** @type {*} */ var v = 1; if (v instanceof AtTop) { - ~ -!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. v.val - ~~~ -!!! error TS2339: Property 'val' does not exist on type 'number'. } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.errors.txt.diff index d7e3190f18..d2143e7cd1 100644 --- a/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.errors.txt.diff @@ -31,8 +31,6 @@ + Not all constituents of type '() => void | null' are callable. + Type 'null' has no call signatures. +controlFlowInstanceof.ts(105,5): error TS2721: Cannot invoke an object which is possibly 'null'. -+uglify.js(5,5): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. -+uglify.js(6,7): error TS2339: Property 'val' does not exist on type 'number'. + + +!!! error TS2318: Cannot find global type 'Array'. @@ -190,16 +188,12 @@ + } + + // Repro from #27550 (based on uglify code) -+==== uglify.js (2 errors) ==== ++==== uglify.js (0 errors) ==== + /** @constructor */ + function AtTop(val) { this.val = val } + /** @type {*} */ + var v = 1; + if (v instanceof AtTop) { -+ ~ -+!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. + v.val -+ ~~~ -+!!! error TS2339: Property 'val' does not exist on type 'number'. + } + diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt index 602c5117a3..eed8f74228 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt @@ -1,8 +1,12 @@ +input.js(8,12): error TS2304: Cannot find name 'StatelessComponent'. +input.js(8,31): error TS2304: Cannot find name 'MyComponentProps'. +input.js(26,12): error TS2304: Cannot find name 'StatelessComponent'. +input.js(26,31): error TS2304: Cannot find name 'MyComponentProps'. input.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== input.js (2 errors) ==== +==== input.js (6 errors) ==== /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ /** @@ -11,6 +15,10 @@ input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install /** * @type {StatelessComponent} + ~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'StatelessComponent'. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'MyComponentProps'. */ const MyComponent = () => /* @type {any} */(null); @@ -29,6 +37,10 @@ input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install /** * @type {StatelessComponent} + ~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'StatelessComponent'. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'MyComponentProps'. */ const check = MyComponent2; diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff index 19326846f3..3cb0e358ae 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff @@ -3,11 +3,15 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++input.js(8,12): error TS2304: Cannot find name 'StatelessComponent'. ++input.js(8,31): error TS2304: Cannot find name 'MyComponentProps'. ++input.js(26,12): error TS2304: Cannot find name 'StatelessComponent'. ++input.js(26,31): error TS2304: Cannot find name 'MyComponentProps'. +input.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== input.js (2 errors) ==== ++==== input.js (6 errors) ==== + /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ + + /** @@ -16,6 +20,10 @@ + + /** + * @type {StatelessComponent} ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'StatelessComponent'. ++ ~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'MyComponentProps'. + */ + const MyComponent = () => /* @type {any} */(null); + @@ -34,6 +42,10 @@ + + /** + * @type {StatelessComponent} ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'StatelessComponent'. ++ ~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'MyComponentProps'. + */ + const check = MyComponent2; + diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols index 9e8ff6f580..12c77658c2 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols @@ -14,9 +14,7 @@ const MyComponent = () => /* @type {any} */(null); >MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5)) MyComponent.defaultProps = { ->MyComponent.defaultProps : Symbol(defaultProps, Decl(input.js, 9, 50)) >MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5)) ->defaultProps : Symbol(defaultProps, Decl(input.js, 9, 50)) color: "red" >color : Symbol(color, Decl(input.js, 11, 28)) diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff index 0c95b7d058..fc209accdd 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff @@ -11,13 +11,11 @@ ->MyComponent.defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23)) ->MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5), Decl(input.js, 9, 50)) ->defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23)) -+>MyComponent.defaultProps : Symbol(defaultProps, Decl(input.js, 9, 50)) +>MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5)) -+>defaultProps : Symbol(defaultProps, Decl(input.js, 9, 50)) color: "red" >color : Symbol(color, Decl(input.js, 11, 28)) -@@= skipped -13, +13 lines =@@ +@@= skipped -13, +11 lines =@@ }; const MyComponent2 = () => null; diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt new file mode 100644 index 0000000000..61fd199c4a --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt @@ -0,0 +1,16 @@ +a.js(6,12): error TS2304: Cannot find name 'NumberLike'. + + +==== a.js (1 errors) ==== + /** + * A number, or a string containing a number. + * @typedef {(number|string)} NumberLike + */ + + /** @type {NumberLike[]} */export default ([ ]); + ~~~~~~~~~~ +!!! error TS2304: Cannot find name 'NumberLike'. + +==== b.ts (0 errors) ==== + import A from './a' + A[0] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt.diff new file mode 100644 index 0000000000..2050c328f3 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt.diff @@ -0,0 +1,21 @@ +--- old.exportDefaultWithJSDoc1.errors.txt ++++ new.exportDefaultWithJSDoc1.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++a.js(6,12): error TS2304: Cannot find name 'NumberLike'. ++ ++ ++==== a.js (1 errors) ==== ++ /** ++ * A number, or a string containing a number. ++ * @typedef {(number|string)} NumberLike ++ */ ++ ++ /** @type {NumberLike[]} */export default ([ ]); ++ ~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'NumberLike'. ++ ++==== b.ts (0 errors) ==== ++ import A from './a' ++ A[0] diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols index 43a0a20b31..99e6ed71b5 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols @@ -1,13 +1,13 @@ //// [tests/cases/compiler/exportDefaultWithJSDoc1.ts] //// === a.js === - /** * A number, or a string containing a number. * @typedef {(number|string)} NumberLike */ /** @type {NumberLike[]} */export default ([ ]); +>NumberLike : Symbol(NumberLike) === b.ts === import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff new file mode 100644 index 0000000000..57d8df4129 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff @@ -0,0 +1,17 @@ +--- old.exportDefaultWithJSDoc1.symbols ++++ new.exportDefaultWithJSDoc1.symbols +@@= skipped -0, +0 lines =@@ + //// [tests/cases/compiler/exportDefaultWithJSDoc1.ts] //// + + === a.js === +- + /** + * A number, or a string containing a number. + * @typedef {(number|string)} NumberLike + */ + + /** @type {NumberLike[]} */export default ([ ]); ++>NumberLike : Symbol(NumberLike) + + === b.ts === + import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt new file mode 100644 index 0000000000..3f5fe39172 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt @@ -0,0 +1,15 @@ +usage.js(1,12): error TS2304: Cannot find name 'Bar'. + + +==== interfaces.d.ts (0 errors) ==== + export interface Bar { + prop: string + } + +==== usage.js (1 errors) ==== + /** @type {Bar} */ + ~~~ +!!! error TS2304: Cannot find name 'Bar'. + export let bar; + + /** @typedef {import('./interfaces').Bar} Bar */ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt.diff new file mode 100644 index 0000000000..2f9a807d64 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt.diff @@ -0,0 +1,20 @@ +--- old.importTypeResolutionJSDocEOF.errors.txt ++++ new.importTypeResolutionJSDocEOF.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++usage.js(1,12): error TS2304: Cannot find name 'Bar'. ++ ++ ++==== interfaces.d.ts (0 errors) ==== ++ export interface Bar { ++ prop: string ++ } ++ ++==== usage.js (1 errors) ==== ++ /** @type {Bar} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Bar'. ++ export let bar; ++ ++ /** @typedef {import('./interfaces').Bar} Bar */ diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt b/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt new file mode 100644 index 0000000000..ab1fc23499 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt @@ -0,0 +1,46 @@ +a.js(13,15): error TS2304: Cannot find name 'A'. +a.js(20,15): error TS2304: Cannot find name 'A'. +a.js(27,15): error TS2304: Cannot find name 'A'. +a.js(27,19): error TS2304: Cannot find name 'B'. + + +==== a.js (4 errors) ==== + /** + * @typedef A + * @property {string} a + */ + + /** + * @typedef B + * @property {number} b + */ + + class C1 { + /** + * @type {A} + ~ +!!! error TS2304: Cannot find name 'A'. + */ + value; + } + + class C2 extends C1 { + /** + * @type {A} + ~ +!!! error TS2304: Cannot find name 'A'. + */ + value; + } + + class C3 extends C1 { + /** + * @type {A & B} + ~ +!!! error TS2304: Cannot find name 'A'. + ~ +!!! error TS2304: Cannot find name 'B'. + */ + value; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt.diff new file mode 100644 index 0000000000..b51b83eedf --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt.diff @@ -0,0 +1,51 @@ +--- old.jsDeclarationsInheritedTypes.errors.txt ++++ new.jsDeclarationsInheritedTypes.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++a.js(13,15): error TS2304: Cannot find name 'A'. ++a.js(20,15): error TS2304: Cannot find name 'A'. ++a.js(27,15): error TS2304: Cannot find name 'A'. ++a.js(27,19): error TS2304: Cannot find name 'B'. ++ ++ ++==== a.js (4 errors) ==== ++ /** ++ * @typedef A ++ * @property {string} a ++ */ ++ ++ /** ++ * @typedef B ++ * @property {number} b ++ */ ++ ++ class C1 { ++ /** ++ * @type {A} ++ ~ ++!!! error TS2304: Cannot find name 'A'. ++ */ ++ value; ++ } ++ ++ class C2 extends C1 { ++ /** ++ * @type {A} ++ ~ ++!!! error TS2304: Cannot find name 'A'. ++ */ ++ value; ++ } ++ ++ class C3 extends C1 { ++ /** ++ * @type {A & B} ++ ~ ++!!! error TS2304: Cannot find name 'A'. ++ ~ ++!!! error TS2304: Cannot find name 'B'. ++ */ ++ value; ++ } ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt index f441eb2c8d..da0169af5a 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt @@ -3,6 +3,8 @@ enumDef.js(4,6): error TS2339: Property 'UserMetrics' does not exist on type '{} enumDef.js(16,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'. index.js(2,7): error TS2339: Property 'Cls' does not exist on type '{}'. index.js(8,26): error TS2339: Property 'UserMetrics' does not exist on type '{}'. +index.js(13,11): error TS2503: Cannot find namespace 'Host'. +index.js(18,11): error TS2503: Cannot find namespace 'Host'. ==== enumDef.js (3 errors) ==== @@ -30,7 +32,7 @@ index.js(8,26): error TS2339: Property 'UserMetrics' does not exist on type '{}' !!! error TS2339: Property 'UserMetrics' does not exist on type '{}'. x: 12 } -==== index.js (2 errors) ==== +==== index.js (4 errors) ==== var Other = {}; Other.Cls = class { ~~~ @@ -48,11 +50,15 @@ index.js(8,26): error TS2339: Property 'UserMetrics' does not exist on type '{}' /** * @type {Host.UserMetrics.Bargh} + ~~~~ +!!! error TS2503: Cannot find namespace 'Host'. */ var x = "ok"; /** * @type {Host.UserMetrics.Blah} + ~~~~ +!!! error TS2503: Cannot find namespace 'Host'. */ var y = "ok"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt.diff index 61a65b20a6..69bc939bd6 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt.diff @@ -8,6 +8,8 @@ +enumDef.js(16,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'. +index.js(2,7): error TS2339: Property 'Cls' does not exist on type '{}'. +index.js(8,26): error TS2339: Property 'UserMetrics' does not exist on type '{}'. ++index.js(13,11): error TS2503: Cannot find namespace 'Host'. ++index.js(18,11): error TS2503: Cannot find namespace 'Host'. + + +==== enumDef.js (3 errors) ==== @@ -35,7 +37,7 @@ +!!! error TS2339: Property 'UserMetrics' does not exist on type '{}'. + x: 12 + } -+==== index.js (2 errors) ==== ++==== index.js (4 errors) ==== + var Other = {}; + Other.Cls = class { + ~~~ @@ -53,11 +55,15 @@ + + /** + * @type {Host.UserMetrics.Bargh} ++ ~~~~ ++!!! error TS2503: Cannot find namespace 'Host'. + */ + var x = "ok"; + + /** + * @type {Host.UserMetrics.Blah} ++ ~~~~ ++!!! error TS2503: Cannot find namespace 'Host'. + */ + var y = "ok"; + diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt index 7e856086bc..db25c6ae25 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt @@ -1,7 +1,8 @@ usage.js(1,38): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +usage.js(12,16): error TS2304: Cannot find name 'LogEntry'. -==== usage.js (1 errors) ==== +==== usage.js (2 errors) ==== const { Thing, useThing, cbThing } = require("./index"); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -16,6 +17,8 @@ usage.js(1,38): error TS2580: Cannot find name 'require'. Do you need to install cbThing(type => { /** @type {LogEntry} */ + ~~~~~~~~ +!!! error TS2304: Cannot find name 'LogEntry'. const logEntry = { time: Date.now(), type, diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff index 7354401ab1..cf1ff34342 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff @@ -4,9 +4,10 @@ - @@= skipped --1, +1 lines =@@ +usage.js(1,38): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++usage.js(12,16): error TS2304: Cannot find name 'LogEntry'. + + -+==== usage.js (1 errors) ==== ++==== usage.js (2 errors) ==== + const { Thing, useThing, cbThing } = require("./index"); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -21,6 +22,8 @@ + + cbThing(type => { + /** @type {LogEntry} */ ++ ~~~~~~~~ ++!!! error TS2304: Cannot find name 'LogEntry'. + const logEntry = { + time: Date.now(), + type, diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt new file mode 100644 index 0000000000..3cafaf3dce --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt @@ -0,0 +1,64 @@ +jsFileFunctionOverloads.js(27,14): error TS2304: Cannot find name 'T'. + + +==== jsFileFunctionOverloads.js (1 errors) ==== + /** + * @overload + * @param {number} x + * @returns {'number'} + */ + /** + * @overload + * @param {string} x + * @returns {'string'} + */ + /** + * @overload + * @param {boolean} x + * @returns {'boolean'} + */ + /** + * @param {unknown} x + * @returns {string} + */ + function getTypeName(x) { + return typeof x; + } + + /** + * @template T + * @param {T} x + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + const identity = x => x; + + /** + * @template T + * @template U + * @overload + * @param {T[]} array + * @param {(x: T) => U[]} iterable + * @returns {U[]} + */ + /** + * @template T + * @overload + * @param {T[][]} array + * @returns {T[]} + */ + /** + * @param {unknown[]} array + * @param {(x: unknown) => unknown} iterable + * @returns {unknown[]} + */ + function flatMap(array, iterable = identity) { + /** @type {unknown[]} */ + const result = []; + for (let i = 0; i < array.length; i += 1) { + result.push(.../** @type {unknown[]} */(iterable(array[i]))); + } + return result; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt.diff new file mode 100644 index 0000000000..b730ce7f31 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt.diff @@ -0,0 +1,69 @@ +--- old.jsFileFunctionOverloads.errors.txt ++++ new.jsFileFunctionOverloads.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++jsFileFunctionOverloads.js(27,14): error TS2304: Cannot find name 'T'. ++ ++ ++==== jsFileFunctionOverloads.js (1 errors) ==== ++ /** ++ * @overload ++ * @param {number} x ++ * @returns {'number'} ++ */ ++ /** ++ * @overload ++ * @param {string} x ++ * @returns {'string'} ++ */ ++ /** ++ * @overload ++ * @param {boolean} x ++ * @returns {'boolean'} ++ */ ++ /** ++ * @param {unknown} x ++ * @returns {string} ++ */ ++ function getTypeName(x) { ++ return typeof x; ++ } ++ ++ /** ++ * @template T ++ * @param {T} x ++ * @returns {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ const identity = x => x; ++ ++ /** ++ * @template T ++ * @template U ++ * @overload ++ * @param {T[]} array ++ * @param {(x: T) => U[]} iterable ++ * @returns {U[]} ++ */ ++ /** ++ * @template T ++ * @overload ++ * @param {T[][]} array ++ * @returns {T[]} ++ */ ++ /** ++ * @param {unknown[]} array ++ * @param {(x: unknown) => unknown} iterable ++ * @returns {unknown[]} ++ */ ++ function flatMap(array, iterable = identity) { ++ /** @type {unknown[]} */ ++ const result = []; ++ for (let i = 0; i < array.length; i += 1) { ++ result.push(.../** @type {unknown[]} */(iterable(array[i]))); ++ } ++ return result; ++ } ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt new file mode 100644 index 0000000000..b3d9fa5b12 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt @@ -0,0 +1,59 @@ +jsFileFunctionOverloads2.js(25,14): error TS2304: Cannot find name 'T'. + + +==== jsFileFunctionOverloads2.js (1 errors) ==== + // Also works if all @overload tags are combined in one comment. + /** + * @overload + * @param {number} x + * @returns {'number'} + * + * @overload + * @param {string} x + * @returns {'string'} + * + * @overload + * @param {boolean} x + * @returns {'boolean'} + * + * @param {unknown} x + * @returns {string} + */ + function getTypeName(x) { + return typeof x; + } + + /** + * @template T + * @param {T} x + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + const identity = x => x; + + /** + * @template T + * @template U + * @overload + * @param {T[]} array + * @param {(x: T) => U[]} iterable + * @returns {U[]} + * + * @overload + * @param {T[][]} array + * @returns {T[]} + * + * @param {unknown[]} array + * @param {(x: unknown) => unknown} iterable + * @returns {unknown[]} + */ + function flatMap(array, iterable = identity) { + /** @type {unknown[]} */ + const result = []; + for (let i = 0; i < array.length; i += 1) { + result.push(.../** @type {unknown[]} */(iterable(array[i]))); + } + return result; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt.diff new file mode 100644 index 0000000000..dfafcbf209 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt.diff @@ -0,0 +1,64 @@ +--- old.jsFileFunctionOverloads2.errors.txt ++++ new.jsFileFunctionOverloads2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++jsFileFunctionOverloads2.js(25,14): error TS2304: Cannot find name 'T'. ++ ++ ++==== jsFileFunctionOverloads2.js (1 errors) ==== ++ // Also works if all @overload tags are combined in one comment. ++ /** ++ * @overload ++ * @param {number} x ++ * @returns {'number'} ++ * ++ * @overload ++ * @param {string} x ++ * @returns {'string'} ++ * ++ * @overload ++ * @param {boolean} x ++ * @returns {'boolean'} ++ * ++ * @param {unknown} x ++ * @returns {string} ++ */ ++ function getTypeName(x) { ++ return typeof x; ++ } ++ ++ /** ++ * @template T ++ * @param {T} x ++ * @returns {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ const identity = x => x; ++ ++ /** ++ * @template T ++ * @template U ++ * @overload ++ * @param {T[]} array ++ * @param {(x: T) => U[]} iterable ++ * @returns {U[]} ++ * ++ * @overload ++ * @param {T[][]} array ++ * @returns {T[]} ++ * ++ * @param {unknown[]} array ++ * @param {(x: unknown) => unknown} iterable ++ * @returns {unknown[]} ++ */ ++ function flatMap(array, iterable = identity) { ++ /** @type {unknown[]} */ ++ const result = []; ++ for (let i = 0; i < array.length; i += 1) { ++ result.push(.../** @type {unknown[]} */(iterable(array[i]))); ++ } ++ return result; ++ } ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt new file mode 100644 index 0000000000..0e15ed6e44 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt @@ -0,0 +1,63 @@ +jsdocArrayObjectPromiseImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(30,18): error TS2322: Type 'number' is not assignable to type '() => Object'. +jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. + + +==== jsdocArrayObjectPromiseImplicitAny.js (6 errors) ==== + /** @type {Array} */ + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + var anyArray = [5]; + + /** @type {Array} */ + var numberArray = [5]; + + /** + * @param {Array} arr + * @return {Array} + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + */ + function returnAnyArray(arr) { + return arr; + } + + /** @type {Promise} */ + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + var anyPromise = Promise.resolve(5); + + /** @type {Promise} */ + var numberPromise = Promise.resolve(5); + + /** + * @param {Promise} pr + * @return {Promise} + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + */ + function returnAnyPromise(pr) { + return pr; + } + + /** @type {Object} */ + var anyObject = {valueOf: 1}; // not an error since assigning to any. + ~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type '() => Object'. + + /** @type {Object} */ + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + var paramedObject = {valueOf: 1}; + + /** + * @param {Object} obj + * @return {Object} + */ + function returnAnyObject(obj) { + return obj; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff new file mode 100644 index 0000000000..571362dfb3 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff @@ -0,0 +1,68 @@ +--- old.jsdocArrayObjectPromiseImplicitAny.errors.txt ++++ new.jsdocArrayObjectPromiseImplicitAny.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++jsdocArrayObjectPromiseImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++jsdocArrayObjectPromiseImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++jsdocArrayObjectPromiseImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). ++jsdocArrayObjectPromiseImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). ++jsdocArrayObjectPromiseImplicitAny.js(30,18): error TS2322: Type 'number' is not assignable to type '() => Object'. ++jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. ++ ++ ++==== jsdocArrayObjectPromiseImplicitAny.js (6 errors) ==== ++ /** @type {Array} */ ++ ~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). ++ var anyArray = [5]; ++ ++ /** @type {Array} */ ++ var numberArray = [5]; ++ ++ /** ++ * @param {Array} arr ++ * @return {Array} ++ ~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). ++ */ ++ function returnAnyArray(arr) { ++ return arr; ++ } ++ ++ /** @type {Promise} */ ++ ~~~~~~~ ++!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). ++ var anyPromise = Promise.resolve(5); ++ ++ /** @type {Promise} */ ++ var numberPromise = Promise.resolve(5); ++ ++ /** ++ * @param {Promise} pr ++ * @return {Promise} ++ ~~~~~~~ ++!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). ++ */ ++ function returnAnyPromise(pr) { ++ return pr; ++ } ++ ++ /** @type {Object} */ ++ var anyObject = {valueOf: 1}; // not an error since assigning to any. ++ ~~~~~~~ ++!!! error TS2322: Type 'number' is not assignable to type '() => Object'. ++ ++ /** @type {Object} */ ++ ~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. ++ var paramedObject = {valueOf: 1}; ++ ++ /** ++ * @param {Object} obj ++ * @return {Object} ++ */ ++ function returnAnyObject(obj) { ++ return obj; ++ } ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt index df10787ae2..36bd088c1d 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt @@ -1,10 +1,18 @@ +jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). jsdocArrayObjectPromiseNoImplicitAny.js(11,28): error TS7006: Parameter 'arr' implicitly has an 'any' type. +jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). jsdocArrayObjectPromiseNoImplicitAny.js(25,30): error TS7006: Parameter 'pr' implicitly has an 'any' type. +jsdocArrayObjectPromiseNoImplicitAny.js(30,21): error TS2322: Type 'number' is not assignable to type '() => Object'. +jsdocArrayObjectPromiseNoImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' implicitly has an 'any' type. -==== jsdocArrayObjectPromiseNoImplicitAny.js (3 errors) ==== +==== jsdocArrayObjectPromiseNoImplicitAny.js (9 errors) ==== /** @type {Array} */ + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). var notAnyArray = [5]; /** @type {Array} */ @@ -13,6 +21,8 @@ jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' im /** * @param {Array} arr * @return {Array} + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). */ function returnNotAnyArray(arr) { ~~~ @@ -21,6 +31,8 @@ jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' im } /** @type {Promise} */ + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). var notAnyPromise = Promise.resolve(5); /** @type {Promise} */ @@ -29,6 +41,8 @@ jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' im /** * @param {Promise} pr * @return {Promise} + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). */ function returnNotAnyPromise(pr) { ~~ @@ -38,8 +52,12 @@ jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' im /** @type {Object} */ var notAnyObject = {valueOf: 1}; // error since assigning to Object, not any. + ~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type '() => Object'. /** @type {Object} */ + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. var paramedObject = {valueOf: 1}; /** diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff index f983e79f48..e6c7da425b 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff @@ -4,32 +4,37 @@ -jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'Array' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'Array' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'Array' requires 1 type argument(s). --jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). --jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). --jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). --jsdocArrayObjectPromiseNoImplicitAny.js(30,21): error TS2322: Type 'number' is not assignable to type '() => Object'. ++jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(11,28): error TS7006: Parameter 'arr' implicitly has an 'any' type. + jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +-jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). + jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(25,30): error TS7006: Parameter 'pr' implicitly has an 'any' type. + jsdocArrayObjectPromiseNoImplicitAny.js(30,21): error TS2322: Type 'number' is not assignable to type '() => Object'. ++jsdocArrayObjectPromiseNoImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. +jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' implicitly has an 'any' type. -==== jsdocArrayObjectPromiseNoImplicitAny.js (7 errors) ==== -+==== jsdocArrayObjectPromiseNoImplicitAny.js (3 errors) ==== ++==== jsdocArrayObjectPromiseNoImplicitAny.js (9 errors) ==== /** @type {Array} */ -- ~~~~~ + ~~~~~ -!!! error TS2314: Generic type 'Array' requires 1 type argument(s). ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). var notAnyArray = [5]; /** @type {Array} */ -@@= skipped -17, +11 lines =@@ +@@= skipped -17, +19 lines =@@ /** * @param {Array} arr - ~~~~~ -!!! error TS2314: Generic type 'Array' requires 1 type argument(s). * @return {Array} -- ~~~~~ + ~~~~~ -!!! error TS2314: Generic type 'Array' requires 1 type argument(s). ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). */ function returnNotAnyArray(arr) { + ~~~ @@ -37,21 +42,15 @@ return arr; } - /** @type {Promise} */ -- ~~~~~~~ --!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). - var notAnyPromise = Promise.resolve(5); - - /** @type {Promise} */ -@@= skipped -20, +16 lines =@@ +@@= skipped -20, +20 lines =@@ /** * @param {Promise} pr - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). * @return {Promise} -- ~~~~~~~ --!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + ~~~~~~~ + !!! error TS2314: Generic type 'Promise' requires 1 type argument(s). */ function returnNotAnyPromise(pr) { + ~~ @@ -59,14 +58,16 @@ return pr; } - /** @type {Object} */ - var notAnyObject = {valueOf: 1}; // error since assigning to Object, not any. -- ~~~~~~~ --!!! error TS2322: Type 'number' is not assignable to type '() => Object'. +@@= skipped -16, +16 lines =@@ + !!! error TS2322: Type 'number' is not assignable to type '() => Object'. /** @type {Object} */ ++ ~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. var paramedObject = {valueOf: 1}; -@@= skipped -23, +19 lines =@@ + + /** +@@= skipped -7, +9 lines =@@ * @return {Object} */ function returnNotAnyObject(obj) { diff --git a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt index 9697d6f2aa..d8a5fdf957 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt @@ -1,7 +1,8 @@ index.js(12,14): error TS7006: Parameter 'arg' implicitly has an 'any' type. +index.js(20,16): error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'. -==== index.js (1 errors) ==== +==== index.js (2 errors) ==== /** @type () => string */ function fn1() { return 42; @@ -24,4 +25,7 @@ index.js(12,14): error TS7006: Parameter 'arg' implicitly has an 'any' type. /** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */ const obj2 = { type: "other", prop: 10 }; + ~~~~ +!!! error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'. +!!! related TS6500 index.js:19:14: The expected type comes from property 'type' which is declared here on type '({ type: "foo"; } | { type: "bar"; }) & { prop: number; }' \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt.diff index d1d1cf09bd..fc65d1e9e5 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt.diff @@ -4,10 +4,10 @@ -index.js(3,3): error TS2322: Type 'number' is not assignable to type 'string'. -index.js(20,16): error TS2322: Type '"other"' is not assignable to type '"foo" | "bar"'. +index.js(12,14): error TS7006: Parameter 'arg' implicitly has an 'any' type. ++index.js(20,16): error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'. --==== index.js (2 errors) ==== -+==== index.js (1 errors) ==== + ==== index.js (2 errors) ==== /** @type () => string */ function fn1() { return 42; @@ -16,7 +16,7 @@ } /** @type () => string */ -@@= skipped -16, +13 lines =@@ +@@= skipped -16, +14 lines =@@ /** @type (arg: string) => string */ function fn3(arg) { @@ -25,11 +25,11 @@ return arg; } -@@= skipped -8, +10 lines =@@ - +@@= skipped -9, +11 lines =@@ /** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */ const obj2 = { type: "other", prop: 10 }; -- ~~~~ + ~~~~ -!!! error TS2322: Type '"other"' is not assignable to type '"foo" | "bar"'. --!!! related TS6500 index.js:19:14: The expected type comes from property 'type' which is declared here on type '({ type: "foo"; } | { type: "bar"; }) & { prop: number; }' ++!!! error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'. + !!! related TS6500 index.js:19:14: The expected type comes from property 'type' which is declared here on type '({ type: "foo"; } | { type: "bar"; }) & { prop: number; }' diff --git a/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt new file mode 100644 index 0000000000..79546958ff --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt @@ -0,0 +1,15 @@ +/a.js(5,12): error TS2304: Cannot find name 'B'. + + +==== /a.js (1 errors) ==== + /** + * @template T + * @callback B + */ + /** @type {B} */ + ~ +!!! error TS2304: Cannot find name 'B'. + let b; + b(); + b(1); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt.diff index 68509d8155..9f045ce14f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt.diff @@ -1,20 +1,20 @@ --- old.jsdocCallbackAndType.errors.txt +++ new.jsdocCallbackAndType.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(8,3): error TS2554: Expected 0 arguments, but got 1. -- -- --==== /a.js (1 errors) ==== -- /** -- * @template T -- * @callback B -- */ -- /** @type {B} */ -- let b; -- b(); -- b(1); ++/a.js(5,12): error TS2304: Cannot find name 'B'. + + + ==== /a.js (1 errors) ==== +@@= skipped -6, +6 lines =@@ + * @callback B + */ + /** @type {B} */ ++ ~ ++!!! error TS2304: Cannot find name 'B'. + let b; + b(); + b(1); - ~ -!!! error TS2554: Expected 0 arguments, but got 1. -- -@@= skipped --1, +1 lines =@@ -+ + diff --git a/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt new file mode 100644 index 0000000000..0720aa43ad --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt @@ -0,0 +1,15 @@ +/a.js(6,18): error TS1093: Type annotation cannot appear on a constructor declaration. + + +==== /a.js (1 errors) ==== + class C { + /** @template T */ + constructor() { } + } + class D { + /** @return {number} */ + ~~~~~~ +!!! error TS1093: Type annotation cannot appear on a constructor declaration. + constructor() {} + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt.diff index e6699eee2c..a7a65f54e0 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt.diff @@ -1,23 +1,16 @@ --- old.jsdocIllegalTags.errors.txt +++ new.jsdocIllegalTags.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(2,19): error TS1092: Type parameters cannot appear on a constructor declaration. --/a.js(6,18): error TS1093: Type annotation cannot appear on a constructor declaration. -- -- + /a.js(6,18): error TS1093: Type annotation cannot appear on a constructor declaration. + + -==== /a.js (2 errors) ==== -- class C { -- /** @template T */ ++==== /a.js (1 errors) ==== + class C { + /** @template T */ - ~ -!!! error TS1092: Type parameters cannot appear on a constructor declaration. -- constructor() { } -- } -- class D { -- /** @return {number} */ -- ~~~~~~ --!!! error TS1093: Type annotation cannot appear on a constructor declaration. -- constructor() {} -- } -- -@@= skipped --1, +1 lines =@@ -+ + constructor() { } + } + class D { diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt new file mode 100644 index 0000000000..6fce29fff1 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt @@ -0,0 +1,16 @@ +usage.js(5,12): error TS2304: Cannot find name 'options'. + + +==== module.js (0 errors) ==== + export class MyClass { + } + +==== usage.js (1 errors) ==== + /** + * @typedef {Object} options + * @property {import("./module").MyClass} option + */ + /** @type {options} */ + ~~~~~~~ +!!! error TS2304: Cannot find name 'options'. + let v; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt.diff new file mode 100644 index 0000000000..aa4adc138b --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt.diff @@ -0,0 +1,21 @@ +--- old.jsdocImportTypeResolution.errors.txt ++++ new.jsdocImportTypeResolution.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++usage.js(5,12): error TS2304: Cannot find name 'options'. ++ ++ ++==== module.js (0 errors) ==== ++ export class MyClass { ++ } ++ ++==== usage.js (1 errors) ==== ++ /** ++ * @typedef {Object} options ++ * @property {import("./module").MyClass} option ++ */ ++ /** @type {options} */ ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'options'. ++ let v; diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt new file mode 100644 index 0000000000..1b0b2a8cd2 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt @@ -0,0 +1,12 @@ +example.js(3,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + +==== example.js (1 errors) ==== + // @ts-check + /** + * @type {function(@foo)} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + */ + let x; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff index 795b5d4d8d..02309368e5 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff @@ -1,22 +1,25 @@ --- old.jsdocParameterParsingInfiniteLoop.errors.txt +++ new.jsdocParameterParsingInfiniteLoop.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -example.js(3,11): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -example.js(3,20): error TS1110: Type expected. -example.js(3,21): error TS2304: Cannot find name 'foo'. -- -- ++example.js(3,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + -==== example.js (3 errors) ==== -- // @ts-check -- /** -- * @type {function(@foo)} ++==== example.js (1 errors) ==== + // @ts-check + /** + * @type {function(@foo)} - ~~~~~~~~~~~~~~ -!!! error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. - ~ -!!! error TS1110: Type expected. - ~~~ -!!! error TS2304: Cannot find name 'foo'. -- */ -- let x; -@@= skipped --1, +1 lines =@@ -+ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + */ + let x; diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt new file mode 100644 index 0000000000..630d35b328 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt @@ -0,0 +1,20 @@ +/a.js(12,11): error TS2304: Cannot find name 'Person'. + + +==== /a.js (1 errors) ==== + // Bad: missing a type + /** @typedef T */ + + const t = 0; + + // OK: missing a type, but have property tags. + /** + * @typedef Person + * @property {string} name + */ + + /** @type Person */ + ~~~~~~ +!!! error TS2304: Cannot find name 'Person'. + const person = { name: "" }; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt.diff index d849c2bad5..e65bd272f2 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt.diff @@ -1,25 +1,23 @@ --- old.jsdocTypedefMissingType.errors.txt +++ new.jsdocTypedefMissingType.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(2,14): error TS8021: JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags. -- -- --==== /a.js (1 errors) ==== -- // Bad: missing a type -- /** @typedef T */ ++/a.js(12,11): error TS2304: Cannot find name 'Person'. + + + ==== /a.js (1 errors) ==== + // Bad: missing a type + /** @typedef T */ - ~ -!!! error TS8021: JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags. -- -- const t = 0; -- -- // OK: missing a type, but have property tags. -- /** -- * @typedef Person -- * @property {string} name -- */ -- -- /** @type Person */ -- const person = { name: "" }; -- -@@= skipped --1, +1 lines =@@ -+ + + const t = 0; + +@@= skipped -15, +13 lines =@@ + */ + + /** @type Person */ ++ ~~~~~~ ++!!! error TS2304: Cannot find name 'Person'. + const person = { name: "" }; + diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt new file mode 100644 index 0000000000..929b50f960 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt @@ -0,0 +1,14 @@ +/a.js(6,12): error TS2304: Cannot find name 'Foo'. + + +==== /a.js (1 errors) ==== + /** + * @typedef Foo + * @property foo + */ + + /** @type {Foo} */ + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + const x = { foo: 0 }; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt.diff new file mode 100644 index 0000000000..64d63eca72 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt.diff @@ -0,0 +1,19 @@ +--- old.jsdocTypedef_propertyWithNoType.errors.txt ++++ new.jsdocTypedef_propertyWithNoType.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/a.js(6,12): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== /a.js (1 errors) ==== ++ /** ++ * @typedef Foo ++ * @property foo ++ */ ++ ++ /** @type {Foo} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ const x = { foo: 0 }; ++ diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt index ebff087957..dbf4a9bfef 100644 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt @@ -1,7 +1,10 @@ index.js(8,26): error TS7006: Parameter 'key' implicitly has an 'any' type. +index.js(9,3): error TS2322: Type '() => string | Set | undefined' is not assignable to type '() => string'. + Type 'string | Set | undefined' is not assignable to type 'string'. + Type 'undefined' is not assignable to type 'string'. -==== index.js (1 errors) ==== +==== index.js (2 errors) ==== /** @type {Map>} */ const cache = new Map() @@ -13,6 +16,10 @@ index.js(8,26): error TS7006: Parameter 'key' implicitly has an 'any' type. ~~~ !!! error TS7006: Parameter 'key' implicitly has an 'any' type. return () => { + ~~~~~~ +!!! error TS2322: Type '() => string | Set | undefined' is not assignable to type '() => string'. +!!! error TS2322: Type 'string | Set | undefined' is not assignable to type 'string'. +!!! error TS2322: Type 'undefined' is not assignable to type 'string'. return /** @type {string} */ (cache.get(key)) } } diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff index 80bc30a895..a50cf777e6 100644 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff @@ -4,9 +4,12 @@ - @@= skipped --1, +1 lines =@@ +index.js(8,26): error TS7006: Parameter 'key' implicitly has an 'any' type. ++index.js(9,3): error TS2322: Type '() => string | Set | undefined' is not assignable to type '() => string'. ++ Type 'string | Set | undefined' is not assignable to type 'string'. ++ Type 'undefined' is not assignable to type 'string'. + + -+==== index.js (1 errors) ==== ++==== index.js (2 errors) ==== + /** @type {Map>} */ + const cache = new Map() + @@ -18,6 +21,10 @@ + ~~~ +!!! error TS7006: Parameter 'key' implicitly has an 'any' type. + return () => { ++ ~~~~~~ ++!!! error TS2322: Type '() => string | Set | undefined' is not assignable to type '() => string'. ++!!! error TS2322: Type 'string | Set | undefined' is not assignable to type 'string'. ++!!! error TS2322: Type 'undefined' is not assignable to type 'string'. + return /** @type {string} */ (cache.get(key)) + } + } diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols index eff01c5ba3..abff9d1939 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols @@ -12,7 +12,9 @@ const json1 = require("./json.json"); // No error (bad) >json1 : Symbol(json1, Decl(user.js, 4, 5)) json1.b; // No error (OK since that's the type annotation) +>json1.b : Symbol(b, Decl(user.js, 3, 12)) >json1 : Symbol(json1, Decl(user.js, 4, 5)) +>b : Symbol(b, Decl(user.js, 3, 12)) const js0 = require("./js.js"); >js0 : Symbol(js0, Decl(user.js, 7, 5)) @@ -25,5 +27,7 @@ const js1 = require("./js.js"); // Error (good) >js1 : Symbol(js1, Decl(user.js, 11, 5)) js1.b; +>js1.b : Symbol(b, Decl(user.js, 10, 12)) >js1 : Symbol(js1, Decl(user.js, 11, 5)) +>b : Symbol(b, Decl(user.js, 10, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff index 6820008f4c..6142893186 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff @@ -17,9 +17,8 @@ ->"./json.json" : Symbol("/json", Decl(json.json, 0, 0)) json1.b; // No error (OK since that's the type annotation) -->json1.b : Symbol(b, Decl(user.js, 3, 12)) - >json1 : Symbol(json1, Decl(user.js, 4, 5)) -->b : Symbol(b, Decl(user.js, 3, 12)) + >json1.b : Symbol(b, Decl(user.js, 3, 12)) +@@= skipped -10, +8 lines =@@ const js0 = require("./js.js"); >js0 : Symbol(js0, Decl(user.js, 7, 5)) @@ -28,7 +27,7 @@ json0.b; // Error (good) >json0 : Symbol(json0, Decl(user.js, 0, 5)) -@@= skipped -19, +13 lines =@@ +@@= skipped -9, +7 lines =@@ /** @type {{ b: number }} */ const js1 = require("./js.js"); // Error (good) >js1 : Symbol(js1, Decl(user.js, 11, 5)) @@ -36,9 +35,9 @@ ->"./js.js" : Symbol("/js", Decl(js.js, 0, 0)) js1.b; -->js1.b : Symbol(b, Decl(user.js, 10, 12)) + >js1.b : Symbol(b, Decl(user.js, 10, 12)) >js1 : Symbol(js1, Decl(user.js, 11, 5)) -->b : Symbol(b, Decl(user.js, 10, 12)) + >b : Symbol(b, Decl(user.js, 10, 12)) -=== /json.json === -{ "a": 0 } diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt new file mode 100644 index 0000000000..9730b2402e --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt @@ -0,0 +1,24 @@ +a.js(6,12): error TS2304: Cannot find name 'A'. +a.js(13,12): error TS2304: Cannot find name 'B'. + + +==== a.js (2 errors) ==== + /** + * @typedef {object} A + * @property {number} [value] + */ + + /** @type {A} */ + ~ +!!! error TS2304: Cannot find name 'A'. + const a = { value: undefined }; // error + + /** + * @typedef {{ value?: number }} B + */ + + /** @type {B} */ + ~ +!!! error TS2304: Cannot find name 'B'. + const b = { value: undefined }; // error + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt.diff index 0732681a52..9af09cbf0b 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt.diff @@ -1,37 +1,39 @@ --- old.strictOptionalProperties3.errors.txt +++ new.strictOptionalProperties3.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -a.js(7,7): error TS2375: Type '{ value: undefined; }' is not assignable to type 'A' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. - Types of property 'value' are incompatible. - Type 'undefined' is not assignable to type 'number'. -a.js(14,7): error TS2375: Type '{ value: undefined; }' is not assignable to type 'B' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. - Types of property 'value' are incompatible. - Type 'undefined' is not assignable to type 'number'. -- -- --==== a.js (2 errors) ==== -- /** -- * @typedef {object} A -- * @property {number} [value] -- */ -- -- /** @type {A} */ -- const a = { value: undefined }; // error ++a.js(6,12): error TS2304: Cannot find name 'A'. ++a.js(13,12): error TS2304: Cannot find name 'B'. + + + ==== a.js (2 errors) ==== +@@= skipped -12, +8 lines =@@ + */ + + /** @type {A} */ ++ ~ ++!!! error TS2304: Cannot find name 'A'. + const a = { value: undefined }; // error - ~ -!!! error TS2375: Type '{ value: undefined; }' is not assignable to type 'A' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. -!!! error TS2375: Types of property 'value' are incompatible. -!!! error TS2375: Type 'undefined' is not assignable to type 'number'. -- -- /** -- * @typedef {{ value?: number }} B -- */ -- -- /** @type {B} */ -- const b = { value: undefined }; // error + + /** + * @typedef {{ value?: number }} B + */ + + /** @type {B} */ ++ ~ ++!!! error TS2304: Cannot find name 'B'. + const b = { value: undefined }; // error - ~ -!!! error TS2375: Type '{ value: undefined; }' is not assignable to type 'B' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. -!!! error TS2375: Types of property 'value' are incompatible. -!!! error TS2375: Type 'undefined' is not assignable to type 'number'. -- -@@= skipped --1, +1 lines =@@ -+ + diff --git a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt index 6746ce4fdd..013d0b80fd 100644 --- a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt @@ -1,3 +1,5 @@ +file1.js(2,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent'. + Index signature for type 'number' is missing in type 'C'. tile1.ts(2,30): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. tile1.ts(6,81): error TS2744: Type parameter defaults can only reference previously declared type parameters. tile1.ts(11,40): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. @@ -56,7 +58,10 @@ tile1.ts(24,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent ~~~~~ !!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'. !!! error TS2322: Index signature for type 'number' is missing in type 'C'. -==== file1.js (0 errors) ==== +==== file1.js (1 errors) ==== /** @type {ClassComponent} */ const test9 = new C(); + ~~~~~ +!!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'. +!!! error TS2322: Index signature for type 'number' is missing in type 'C'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt.diff index 208fa9f7ea..665395e001 100644 --- a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt.diff @@ -1,9 +1,6 @@ --- old.subclassThisTypeAssignable01.errors.txt +++ new.subclassThisTypeAssignable01.errors.txt -@@= skipped -0, +0 lines =@@ --file1.js(2,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent'. -- Index signature for type 'number' is missing in type 'C'. - tile1.ts(2,30): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. +@@= skipped -3, +3 lines =@@ tile1.ts(6,81): error TS2744: Type parameter defaults can only reference previously declared type parameters. tile1.ts(11,40): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. tile1.ts(21,2): error TS2416: Property 'view' in type 'C' is not assignable to the same property in base type 'ClassComponent'. @@ -19,7 +16,7 @@ Index signature for type 'number' is missing in type 'C'. tile1.ts(24,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent'. Index signature for type 'number' is missing in type 'C'. -@@= skipped -45, +43 lines =@@ +@@= skipped -42, +42 lines =@@ view(v: Vnode) { return 0; } ~~~~ !!! error TS2416: Property 'view' in type 'C' is not assignable to the same property in base type 'ClassComponent'. @@ -35,15 +32,3 @@ !!! error TS2416: Index signature for type 'number' is missing in type 'C'. } -@@= skipped -12, +12 lines =@@ - ~~~~~ - !!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'. - !!! error TS2322: Index signature for type 'number' is missing in type 'C'. --==== file1.js (1 errors) ==== -+==== file1.js (0 errors) ==== - /** @type {ClassComponent} */ - const test9 = new C(); -- ~~~~~ --!!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'. --!!! error TS2322: Index signature for type 'number' is missing in type 'C'. - diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt new file mode 100644 index 0000000000..d588dc34f3 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt @@ -0,0 +1,29 @@ +assertionTypePredicates2.js(19,17): error TS2304: Cannot find name 'A'. + + +==== assertionTypePredicates2.js (1 errors) ==== + /** + * @typedef {{ x: number }} A + */ + + /** + * @typedef { A & { y: number } } B + */ + + /** + * @param {A} a + * @returns { asserts a is B } + */ + const foo = (a) => { + if (/** @type { B } */ (a).y !== 0) throw TypeError(); + return undefined; + }; + + export const main = () => { + /** @type { A } */ + ~ +!!! error TS2304: Cannot find name 'A'. + const a = { x: 1 }; + foo(a); + }; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt.diff new file mode 100644 index 0000000000..7a4d4d655a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt.diff @@ -0,0 +1,34 @@ +--- old.assertionTypePredicates2.errors.txt ++++ new.assertionTypePredicates2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++assertionTypePredicates2.js(19,17): error TS2304: Cannot find name 'A'. ++ ++ ++==== assertionTypePredicates2.js (1 errors) ==== ++ /** ++ * @typedef {{ x: number }} A ++ */ ++ ++ /** ++ * @typedef { A & { y: number } } B ++ */ ++ ++ /** ++ * @param {A} a ++ * @returns { asserts a is B } ++ */ ++ const foo = (a) => { ++ if (/** @type { B } */ (a).y !== 0) throw TypeError(); ++ return undefined; ++ }; ++ ++ export const main = () => { ++ /** @type { A } */ ++ ~ ++!!! error TS2304: Cannot find name 'A'. ++ const a = { x: 1 }; ++ foo(a); ++ }; ++ diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt new file mode 100644 index 0000000000..83fb3ac952 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt @@ -0,0 +1,69 @@ +assertionsAndNonReturningFunctions.js(3,12): error TS2304: Cannot find name 'AssertFunc'. +assertionsAndNonReturningFunctions.js(46,9): error TS7027: Unreachable code detected. + + +==== assertionsAndNonReturningFunctions.js (2 errors) ==== + /** @typedef {(check: boolean) => asserts check} AssertFunc */ + + /** @type {AssertFunc} */ + ~~~~~~~~~~ +!!! error TS2304: Cannot find name 'AssertFunc'. + const assert = check => { + if (!check) throw new Error(); + } + + /** @type {(x: unknown) => asserts x is string } */ + function assertIsString(x) { + if (!(typeof x === "string")) throw new Error(); + } + + /** + * @param {boolean} check + * @returns {asserts check} + */ + function assert2(check) { + if (!check) throw new Error(); + } + + /** + * @returns {never} + */ + function fail() { + throw new Error(); + } + + /** + * @param {*} x + */ + function f1(x) { + if (!!true) { + assert(typeof x === "string"); + x.length; + } + if (!!true) { + assert2(typeof x === "string"); + x.length; + } + if (!!true) { + assertIsString(x); + x.length; + } + if (!!true) { + fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + } + + /** + * @param {boolean} b + */ + function f2(b) { + switch (b) { + case true: return 1; + case false: return 0; + } + b; // Unreachable + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt.diff index 991af43a91..efad814178 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt.diff @@ -1,74 +1,25 @@ --- old.assertionsAndNonReturningFunctions.errors.txt +++ new.assertionsAndNonReturningFunctions.errors.txt -@@= skipped -0, +-1 lines =@@ --assertionsAndNonReturningFunctions.js(46,9): error TS7027: Unreachable code detected. +@@= skipped -0, +0 lines =@@ ++assertionsAndNonReturningFunctions.js(3,12): error TS2304: Cannot find name 'AssertFunc'. + assertionsAndNonReturningFunctions.js(46,9): error TS7027: Unreachable code detected. -assertionsAndNonReturningFunctions.js(58,5): error TS7027: Unreachable code detected. -- -- --==== assertionsAndNonReturningFunctions.js (2 errors) ==== -- /** @typedef {(check: boolean) => asserts check} AssertFunc */ -- -- /** @type {AssertFunc} */ -- const assert = check => { -- if (!check) throw new Error(); -- } -- -- /** @type {(x: unknown) => asserts x is string } */ -- function assertIsString(x) { -- if (!(typeof x === "string")) throw new Error(); -- } -- -- /** -- * @param {boolean} check -- * @returns {asserts check} -- */ -- function assert2(check) { -- if (!check) throw new Error(); -- } -- -- /** -- * @returns {never} -- */ -- function fail() { -- throw new Error(); -- } -- -- /** -- * @param {*} x -- */ -- function f1(x) { -- if (!!true) { -- assert(typeof x === "string"); -- x.length; -- } -- if (!!true) { -- assert2(typeof x === "string"); -- x.length; -- } -- if (!!true) { -- assertIsString(x); -- x.length; -- } -- if (!!true) { -- fail(); -- x; // Unreachable -- ~~ --!!! error TS7027: Unreachable code detected. -- } -- } -- -- /** -- * @param {boolean} b -- */ -- function f2(b) { -- switch (b) { -- case true: return 1; -- case false: return 0; -- } -- b; // Unreachable + + + ==== assertionsAndNonReturningFunctions.js (2 errors) ==== + /** @typedef {(check: boolean) => asserts check} AssertFunc */ + + /** @type {AssertFunc} */ ++ ~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'AssertFunc'. + const assert = check => { + if (!check) throw new Error(); + } +@@= skipped -62, +64 lines =@@ + case false: return 0; + } + b; // Unreachable - ~~ -!!! error TS7027: Unreachable code detected. -- } -- -@@= skipped --1, +1 lines =@@ -+ + } + diff --git a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt new file mode 100644 index 0000000000..6dc5427f14 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt @@ -0,0 +1,50 @@ +file.js(2,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(6,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + +==== file.js (5 errors) ==== + // Error (good) + /** @type {function(): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const a = () => 0 + + // Error (good) + /** @type {function(): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const b = async () => 0 + + // No error (bad) + /** @type {function(): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const c = async () => { + return 0 + } + + // Error (good) + /** @type {function(): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const d = async () => { + return "" + } + + /** @type {function(function(): string): void} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const f = (p) => {} + + // Error (good) + f(async () => { + return 0 + }) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt.diff index ca701d2045..0f2415be05 100644 --- a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt.diff @@ -1,6 +1,6 @@ --- old.asyncArrowFunction_allowJs.errors.txt +++ new.asyncArrowFunction_allowJs.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -file.js(3,17): error TS2322: Type 'number' is not assignable to type 'string'. -file.js(6,24): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -file.js(7,23): error TS2322: Type 'number' is not assignable to type 'string'. @@ -9,50 +9,69 @@ -file.js(16,24): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -file.js(25,3): error TS2345: Argument of type '() => Promise' is not assignable to parameter of type '() => string'. - Type 'Promise' is not assignable to type 'string'. -- -- ++file.js(2,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(6,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + -==== file.js (7 errors) ==== -- // Error (good) -- /** @type {function(): string} */ -- const a = () => 0 ++==== file.js (5 errors) ==== + // Error (good) + /** @type {function(): string} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const a = () => 0 - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- -- // Error (good) -- /** @type {function(): string} */ + + // Error (good) + /** @type {function(): string} */ - ~~~~~~ -!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -- const b = async () => 0 ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const b = async () => 0 - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- -- // No error (bad) -- /** @type {function(): string} */ + + // No error (bad) + /** @type {function(): string} */ - ~~~~~~ -!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -- const c = async () => { -- return 0 ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const c = async () => { + return 0 - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- } -- -- // Error (good) -- /** @type {function(): string} */ + } + + // Error (good) + /** @type {function(): string} */ - ~~~~~~ -!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -- const d = async () => { -- return "" -- } -- -- /** @type {function(function(): string): void} */ -- const f = (p) => {} -- -- // Error (good) -- f(async () => { ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const d = async () => { + return "" + } + + /** @type {function(function(): string): void} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const f = (p) => {} + + // Error (good) + f(async () => { - ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '() => Promise' is not assignable to parameter of type '() => string'. -!!! error TS2345: Type 'Promise' is not assignable to type 'string'. -- return 0 -- }) -@@= skipped --1, +1 lines =@@ -+ + return 0 + }) diff --git a/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt new file mode 100644 index 0000000000..18d3c442d6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt @@ -0,0 +1,67 @@ +/a.js(21,14): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? +/a.js(27,12): error TS2304: Cannot find name 'T1'. +/a.js(40,12): error TS2304: Cannot find name 'T2'. +/a.js(45,12): error TS2304: Cannot find name 'T3'. + + +==== /types.d.ts (0 errors) ==== + declare class Thenable { then(): void; } + +==== /a.js (4 errors) ==== + /** + * @callback T1 + * @param {string} str + * @returns {string} + */ + + /** + * @callback T2 + * @param {string} str + * @returns {Promise} + */ + + /** + * @callback T3 + * @param {string} str + * @returns {Thenable} + */ + + /** + * @param {string} str + * @returns {string} + ~~~~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + */ + const f1 = async str => { + return str; + } + + /** @type {T1} */ + ~~ +!!! error TS2304: Cannot find name 'T1'. + const f2 = async str => { + return str; + } + + /** + * @param {string} str + * @returns {Promise} + */ + const f3 = async str => { + return str; + } + + /** @type {T2} */ + ~~ +!!! error TS2304: Cannot find name 'T2'. + const f4 = async str => { + return str; + } + + /** @type {T3} */ + ~~ +!!! error TS2304: Cannot find name 'T3'. + const f5 = async str => { + return str; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt.diff index 7b01d94509..febfcff46c 100644 --- a/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt.diff @@ -1,6 +1,6 @@ --- old.asyncFunctionDeclaration16_es5.errors.txt +++ new.asyncFunctionDeclaration16_es5.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(21,14): error TS1055: Type 'string' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -/a.js(27,12): error TS1065: The return type of an async function or method must be the global Promise type. -/a.js(45,12): error TS1065: The return type of an async function or method must be the global Promise type. @@ -8,71 +8,57 @@ - Construct signature return types 'Thenable' and 'PromiseLike' are incompatible. - The types returned by 'then(...)' are incompatible between these types. - Type 'void' is not assignable to type 'PromiseLike'. -- -- --==== /types.d.ts (0 errors) ==== -- declare class Thenable { then(): void; } -- ++/a.js(21,14): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? ++/a.js(27,12): error TS2304: Cannot find name 'T1'. ++/a.js(40,12): error TS2304: Cannot find name 'T2'. ++/a.js(45,12): error TS2304: Cannot find name 'T3'. + + + ==== /types.d.ts (0 errors) ==== + declare class Thenable { then(): void; } + -==== /a.js (3 errors) ==== -- /** -- * @callback T1 -- * @param {string} str -- * @returns {string} -- */ -- -- /** -- * @callback T2 -- * @param {string} str -- * @returns {Promise} -- */ -- -- /** -- * @callback T3 -- * @param {string} str -- * @returns {Thenable} -- */ -- -- /** -- * @param {string} str -- * @returns {string} -- ~~~~~~ ++==== /a.js (4 errors) ==== + /** + * @callback T1 + * @param {string} str +@@= skipped -32, +29 lines =@@ + * @param {string} str + * @returns {string} + ~~~~~~ -!!! error TS1055: Type 'string' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -- */ -- const f1 = async str => { -- return str; -- } -- -- /** @type {T1} */ -- ~~ ++!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + */ + const f1 = async str => { + return str; +@@= skipped -8, +8 lines =@@ + + /** @type {T1} */ + ~~ -!!! error TS1065: The return type of an async function or method must be the global Promise type. -!!! related TS1055 /a.js:4:14: Type 'string' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -- const f2 = async str => { -- return str; -- } -- -- /** -- * @param {string} str -- * @returns {Promise} -- */ -- const f3 = async str => { -- return str; -- } -- -- /** @type {T2} */ -- const f4 = async str => { -- return str; -- } -- -- /** @type {T3} */ -- ~~ ++!!! error TS2304: Cannot find name 'T1'. + const f2 = async str => { + return str; + } +@@= skipped -15, +14 lines =@@ + } + + /** @type {T2} */ ++ ~~ ++!!! error TS2304: Cannot find name 'T2'. + const f4 = async str => { + return str; + } + + /** @type {T3} */ + ~~ -!!! error TS1065: The return type of an async function or method must be the global Promise type. -!!! error TS1065: Type 'typeof Thenable' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -!!! error TS1065: Construct signature return types 'Thenable' and 'PromiseLike' are incompatible. -!!! error TS1065: The types returned by 'then(...)' are incompatible between these types. -!!! error TS1065: Type 'void' is not assignable to type 'PromiseLike'. -- const f5 = async str => { -- return str; -- } -- -@@= skipped --1, +1 lines =@@ -+ ++!!! error TS2304: Cannot find name 'T3'. + const f5 = async str => { + return str; + } diff --git a/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt new file mode 100644 index 0000000000..9b0c649c61 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt @@ -0,0 +1,20 @@ +callbackOnConstructor.js(12,12): error TS2304: Cannot find name 'ValueGetter_2'. + + +==== callbackOnConstructor.js (1 errors) ==== + export class Preferences { + assignability = "no" + /** + * @callback ValueGetter_2 + * @param {string} name + * @returns {boolean|number|string|undefined} + */ + constructor() {} + } + + + /** @type {ValueGetter_2} */ + ~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'ValueGetter_2'. + var ooscope2 = s => s.length > 0 + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt.diff new file mode 100644 index 0000000000..df85b5798e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.callbackOnConstructor.errors.txt ++++ new.callbackOnConstructor.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++callbackOnConstructor.js(12,12): error TS2304: Cannot find name 'ValueGetter_2'. ++ ++ ++==== callbackOnConstructor.js (1 errors) ==== ++ export class Preferences { ++ assignability = "no" ++ /** ++ * @callback ValueGetter_2 ++ * @param {string} name ++ * @returns {boolean|number|string|undefined} ++ */ ++ constructor() {} ++ } ++ ++ ++ /** @type {ValueGetter_2} */ ++ ~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'ValueGetter_2'. ++ var ooscope2 = s => s.length > 0 ++ diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt new file mode 100644 index 0000000000..1ef41942a9 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt @@ -0,0 +1,27 @@ +cb.js(7,12): error TS2304: Cannot find name 'Sid'. +cb.js(11,12): error TS2304: Cannot find name 'NoReturn'. + + +==== cb.js (2 errors) ==== + /** @callback Sid + * @param {string} s + * @returns {string} What were you expecting + */ + var x = 1 + + /** @type {Sid} smallId */ + ~~~ +!!! error TS2304: Cannot find name 'Sid'. + var sid = s => s + "!"; + + + /** @type {NoReturn} */ + ~~~~~~~~ +!!! error TS2304: Cannot find name 'NoReturn'. + var noreturn = obj => void obj.title + + /** + * @callback NoReturn + * @param {{ e: number, m: number, title: string }} s - Knee deep, shores, etc + */ + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt.diff new file mode 100644 index 0000000000..f7336c1648 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt.diff @@ -0,0 +1,32 @@ +--- old.callbackTag1.errors.txt ++++ new.callbackTag1.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++cb.js(7,12): error TS2304: Cannot find name 'Sid'. ++cb.js(11,12): error TS2304: Cannot find name 'NoReturn'. ++ ++ ++==== cb.js (2 errors) ==== ++ /** @callback Sid ++ * @param {string} s ++ * @returns {string} What were you expecting ++ */ ++ var x = 1 ++ ++ /** @type {Sid} smallId */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Sid'. ++ var sid = s => s + "!"; ++ ++ ++ /** @type {NoReturn} */ ++ ~~~~~~~~ ++!!! error TS2304: Cannot find name 'NoReturn'. ++ var noreturn = obj => void obj.title ++ ++ /** ++ * @callback NoReturn ++ * @param {{ e: number, m: number, title: string }} s - Knee deep, shores, etc ++ */ ++ diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt index 2dbccc172d..a4fdfaa642 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt @@ -1,7 +1,10 @@ +cb.js(8,12): error TS2304: Cannot find name 'Id'. cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'. +cb.js(22,12): error TS2304: Cannot find name 'SharedId'. +cb.js(25,12): error TS2304: Cannot find name 'Final'. -==== cb.js (1 errors) ==== +==== cb.js (4 errors) ==== /** @template T * @callback Id * @param {T} t @@ -10,6 +13,8 @@ cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'. var x = 1 /** @type {Id} I actually wanted to write `const "120"` */ + ~~ +!!! error TS2304: Cannot find name 'Id'. var one_twenty = s => "120"; /** @template S @@ -26,9 +31,13 @@ cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'. } } /** @type {SharedId} */ + ~~~~~~~~ +!!! error TS2304: Cannot find name 'SharedId'. var outside = n => n + 1; /** @type {Final<{ fantasy }, { heroes }>} */ + ~~~~~ +!!! error TS2304: Cannot find name 'Final'. var noreturn = (barts, tidus, noctis) => "cecil" /** diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt.diff index c58ffc7f0c..0ac90a5c99 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt.diff @@ -2,11 +2,27 @@ +++ new.callbackTag2.errors.txt @@= skipped -0, +0 lines =@@ -cb.js(18,29): error TS2304: Cannot find name 'S'. ++cb.js(8,12): error TS2304: Cannot find name 'Id'. +cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'. ++cb.js(22,12): error TS2304: Cannot find name 'SharedId'. ++cb.js(25,12): error TS2304: Cannot find name 'Final'. - ==== cb.js (1 errors) ==== -@@= skipped -19, +19 lines =@@ +-==== cb.js (1 errors) ==== ++==== cb.js (4 errors) ==== + /** @template T + * @callback Id + * @param {T} t +@@= skipped -9, +12 lines =@@ + var x = 1 + + /** @type {Id} I actually wanted to write `const "120"` */ ++ ~~ ++!!! error TS2304: Cannot find name 'Id'. + var one_twenty = s => "120"; + + /** @template S +@@= skipped -10, +12 lines =@@ class SharedClass { constructor() { /** @type {SharedId} */ @@ -18,3 +34,13 @@ } } /** @type {SharedId} */ ++ ~~~~~~~~ ++!!! error TS2304: Cannot find name 'SharedId'. + var outside = n => n + 1; + + /** @type {Final<{ fantasy }, { heroes }>} */ ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Final'. + var noreturn = (barts, tidus, noctis) => "cecil" + + /** diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt new file mode 100644 index 0000000000..0ea6446b4b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt @@ -0,0 +1,13 @@ +cb.js(4,12): error TS2304: Cannot find name 'Miracle'. + + +==== cb.js (1 errors) ==== + /** @callback Miracle + * @returns {string} What were you expecting + */ + /** @type {Miracle} smallId */ + ~~~~~~~ +!!! error TS2304: Cannot find name 'Miracle'. + var sid = () => "!"; + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt.diff new file mode 100644 index 0000000000..7ab5188958 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt.diff @@ -0,0 +1,18 @@ +--- old.callbackTag3.errors.txt ++++ new.callbackTag3.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++cb.js(4,12): error TS2304: Cannot find name 'Miracle'. ++ ++ ++==== cb.js (1 errors) ==== ++ /** @callback Miracle ++ * @returns {string} What were you expecting ++ */ ++ /** @type {Miracle} smallId */ ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'Miracle'. ++ var sid = () => "!"; ++ ++ diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt index e4e4f3b568..654e48ca41 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt @@ -1,9 +1,10 @@ +a.js(9,12): error TS2304: Cannot find name 'C'. a.js(10,22): error TS7006: Parameter 'a' implicitly has an 'any' type. a.js(10,25): error TS7006: Parameter 'b' implicitly has an 'any' type. a.js(11,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== /** * @callback C * @this {{ a: string, b: number }} @@ -13,6 +14,8 @@ a.js(11,5): error TS2683: 'this' implicitly has type 'any' because it does not h */ /** @type {C} */ + ~ +!!! error TS2304: Cannot find name 'C'. const cb = function (a, b) { ~ !!! error TS7006: Parameter 'a' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt.diff index 9977dcc3f9..0b07465530 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt.diff @@ -3,12 +3,13 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++a.js(9,12): error TS2304: Cannot find name 'C'. +a.js(10,22): error TS7006: Parameter 'a' implicitly has an 'any' type. +a.js(10,25): error TS7006: Parameter 'b' implicitly has an 'any' type. +a.js(11,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + + -+==== a.js (3 errors) ==== ++==== a.js (4 errors) ==== + /** + * @callback C + * @this {{ a: string, b: number }} @@ -18,6 +19,8 @@ + */ + + /** @type {C} */ ++ ~ ++!!! error TS2304: Cannot find name 'C'. + const cb = function (a, b) { + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt index b3b3740431..79b28e665e 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt @@ -1,4 +1,4 @@ -callbackTagVariadicType.js(9,13): error TS2554: Expected 0 arguments, but got 2. +callbackTagVariadicType.js(7,12): error TS2304: Cannot find name 'Foo'. ==== callbackTagVariadicType.js (1 errors) ==== @@ -9,8 +9,8 @@ callbackTagVariadicType.js(9,13): error TS2554: Expected 0 arguments, but got 2. */ /** @type {Foo} */ + ~~~ +!!! error TS2304: Cannot find name 'Foo'. export const x = () => 1 var res = x('a', 'b') - ~~~~~~~~ -!!! error TS2554: Expected 0 arguments, but got 2. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt.diff index 49adc28146..329423e0b5 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+callbackTagVariadicType.js(9,13): error TS2554: Expected 0 arguments, but got 2. ++callbackTagVariadicType.js(7,12): error TS2304: Cannot find name 'Foo'. + + +==== callbackTagVariadicType.js (1 errors) ==== @@ -14,8 +14,8 @@ + */ + + /** @type {Foo} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. + export const x = () => 1 + var res = x('a', 'b') -+ ~~~~~~~~ -+!!! error TS2554: Expected 0 arguments, but got 2. + diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt index ab240f6d40..c5ab204ed8 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt @@ -1,13 +1,18 @@ +returns.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. +returns.js(13,5): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. + Type 'boolean' is not assignable to type 'string | number'. returns.js(13,12): error TS2872: This kind of expression is always truthy. -==== returns.js (1 errors) ==== +==== returns.js (3 errors) ==== // @ts-check /** * @returns {string} This comment is not currently exposed */ function f() { return 5; + ~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. } /** @@ -15,6 +20,9 @@ returns.js(13,12): error TS2872: This kind of expression is always truthy. */ function f1() { return 5 || true; + ~~~~~~ +!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. ~ !!! error TS2872: This kind of expression is always truthy. } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt.diff deleted file mode 100644 index d4d9342407..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.checkJsdocReturnTag2.errors.txt -+++ new.checkJsdocReturnTag2.errors.txt -@@= skipped -0, +0 lines =@@ --returns.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. --returns.js(13,5): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. -- Type 'boolean' is not assignable to type 'string | number'. - returns.js(13,12): error TS2872: This kind of expression is always truthy. - - --==== returns.js (3 errors) ==== -+==== returns.js (1 errors) ==== - // @ts-check - /** - * @returns {string} This comment is not currently exposed - */ - function f() { - return 5; -- ~~~~~~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. - } - - /** -@@= skipped -19, +14 lines =@@ - */ - function f1() { - return 5 || true; -- ~~~~~~ --!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. --!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. - ~ - !!! error TS2872: This kind of expression is always truthy. - } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt new file mode 100644 index 0000000000..206a690a68 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt @@ -0,0 +1,38 @@ +/a.js(24,12): error TS2304: Cannot find name 'T2'. + + +==== /a.js (1 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 }); + const t3 = /** @satisfies {T1} */ ({}); + + /** @type {T2} */ + ~~ +!!! error TS2304: Cannot find name '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' }); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt.diff index ca71ca7073..17cf4face7 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt.diff @@ -1,52 +1,40 @@ --- old.checkJsdocSatisfiesTag1.errors.txt +++ new.checkJsdocSatisfiesTag1.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= 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(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(24,12): error TS2304: Cannot find name 'T2'. + + -==== /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 }); ++==== /a.js (1 errors) ==== + /** + * @typedef {Object} T1 + * @property {number} a +@@= skipped -25, +22 lines =@@ + + 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} */ ({}); + 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' }); + + /** @type {T2} */ ++ ~~ ++!!! error TS2304: Cannot find name 'T2'. + const t4 = /** @satisfies {T2} */ ({ a: "a" }); + + /** @type {(m: string) => string} */ +@@= skipped -16, +12 lines =@@ + 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'. -- -@@= skipped --1, +1 lines =@@ -+ + diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols index b2946f8e46..41e26adfcd 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols @@ -41,7 +41,9 @@ const t4 = /** @satisfies {T2} */ ({ a: "a" }); const t5 = /** @satisfies {T3} */((m) => m.substring(0)); >t5 : Symbol(t5, Decl(a.js, 27, 5)) >m : Symbol(m, Decl(a.js, 27, 35)) +>m.substring : Symbol(substring, Decl(lib.es5.d.ts, --, --)) >m : Symbol(m, Decl(a.js, 27, 35)) +>substring : Symbol(substring, Decl(lib.es5.d.ts, --, --)) const t6 = /** @satisfies {[number, number]} */ ([1, 2]); >t6 : Symbol(t6, Decl(a.js, 28, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff index 6e16092f24..d1e4e15083 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff @@ -5,8 +5,10 @@ >t5 : Symbol(t5, Decl(a.js, 27, 5)) >m : Symbol(m, Decl(a.js, 27, 35)) ->m.substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --)) ++>m.substring : Symbol(substring, Decl(lib.es5.d.ts, --, --)) >m : Symbol(m, Decl(a.js, 27, 35)) ->substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --)) ++>substring : Symbol(substring, Decl(lib.es5.d.ts, --, --)) const t6 = /** @satisfies {[number, number]} */ ([1, 2]); >t6 : Symbol(t6, Decl(a.js, 28, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt index ff2916a9e4..f41bb7633d 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt @@ -1,14 +1,11 @@ -/a.js(3,7): error TS7006: Parameter 's' implicitly has an 'any' type. /a.js(4,7): error TS7006: Parameter 's' implicitly has an 'any' type. /a.js(8,49): error TS7006: Parameter 'x' implicitly has an 'any' type. -==== /a.js (3 errors) ==== +==== /a.js (2 errors) ==== /** @type {{ f(s: string): void } & Record }} */ let obj = /** @satisfies {{ g(s: string): void } & Record} */ ({ f(s) { }, // "incorrect" implicit any on 's' - ~ -!!! error TS7006: Parameter 's' implicitly has an 'any' type. g(s) { } ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt.diff index 318b609d0d..73eaaa76a0 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt.diff @@ -1,21 +1,20 @@ --- old.checkJsdocSatisfiesTag3.errors.txt +++ new.checkJsdocSatisfiesTag3.errors.txt @@= skipped -0, +0 lines =@@ - /a.js(3,7): error TS7006: Parameter 's' implicitly has an 'any' type. +-/a.js(3,7): error TS7006: Parameter 's' implicitly has an 'any' type. +/a.js(4,7): error TS7006: Parameter 's' implicitly has an 'any' type. +/a.js(8,49): error TS7006: Parameter 'x' implicitly has an 'any' type. -==== /a.js (1 errors) ==== -+==== /a.js (3 errors) ==== ++==== /a.js (2 errors) ==== /** @type {{ f(s: string): void } & Record }} */ let obj = /** @satisfies {{ g(s: string): void } & Record} */ ({ f(s) { }, // "incorrect" implicit any on 's' ++ g(s) { } ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. - g(s) { } -+ ~ -+!!! error TS7006: Parameter 's' implicitly has an 'any' type. +- g(s) { } }); // This needs to not crash (outer node is not expression) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt index c38dd87402..3523f4ecbe 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt @@ -1,8 +1,10 @@ -0.js(10,1): error TS2322: Type 'string' is not assignable to type 'number'. -0.js(14,1): error TS2322: Type 'string' is not assignable to type 'number'. +0.js(20,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(24,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(28,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. -==== 0.js (2 errors) ==== +==== 0.js (4 errors) ==== // @ts-check /** @type {String} */ var S = "hello world"; @@ -13,28 +15,33 @@ /** @type {*} */ var anyT = 2; anyT = "hello"; - ~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. /** @type {?} */ var anyT1 = 2; anyT1 = "hi"; - ~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. /** @type {Function} */ const x = (a) => a + 1; x(1); /** @type {function} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const y = (a) => a + 1; y(1); /** @type {function (number)} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const x1 = (a) => a + 1; x1(0); /** @type {function (number): number} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const x2 = (a) => a + 1; x2(0); @@ -47,4 +54,7 @@ * @type {Object} */ var props = {}; + ~~~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. +!!! related TS6203 0.js:35:5: 'props' was also declared here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt.diff index 83c1f0f8bb..621cec769f 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt.diff @@ -2,36 +2,48 @@ +++ new.checkJsdocTypeTag1.errors.txt @@= skipped -0, +0 lines =@@ -0.js(24,12): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -+0.js(10,1): error TS2322: Type 'string' is not assignable to type 'number'. -+0.js(14,1): error TS2322: Type 'string' is not assignable to type 'number'. ++0.js(20,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(24,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(28,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. -==== 0.js (1 errors) ==== -+==== 0.js (2 errors) ==== ++==== 0.js (4 errors) ==== // @ts-check /** @type {String} */ var S = "hello world"; -@@= skipped -11, +12 lines =@@ - /** @type {*} */ - var anyT = 2; - anyT = "hello"; -+ ~~~~ -+!!! error TS2322: Type 'string' is not assignable to type 'number'. +@@= skipped -21, +24 lines =@@ + x(1); - /** @type {?} */ - var anyT1 = 2; - anyT1 = "hi"; -+ ~~~~~ -+!!! error TS2322: Type 'string' is not assignable to type 'number'. - - /** @type {Function} */ - const x = (a) => a + 1; -@@= skipped -14, +18 lines =@@ + /** @type {function} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const y = (a) => a + 1; y(1); /** @type {function (number)} */ - ~~~~~~~~~~~~~~~~~ -!!! error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const x1 = (a) => a + 1; x1(0); + /** @type {function (number): number} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x2 = (a) => a + 1; + x2(0); + +@@= skipped -22, +29 lines =@@ + * @type {Object} + */ + var props = {}; ++ ~~~~~ ++!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. ++!!! related TS6203 0.js:35:5: 'props' was also declared here. + diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt new file mode 100644 index 0000000000..76933dc06a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt @@ -0,0 +1,50 @@ +0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'String'. +0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'. +0.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(12,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(23,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + +==== 0.js (6 errors) ==== + // @ts-check + /** @type {String} */ + var S = true; + ~ +!!! error TS2322: Type 'boolean' is not assignable to type 'String'. + + /** @type {number} */ + var n = "hello"; + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + + /** @type {function (number)} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x1 = (a) => a + 1; + x1("string"); + + /** @type {function (number): number} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x2 = (a) => a + 1; + + /** @type {string} */ + var a; + a = x2(0); + + /** @type {function (number): number} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x3 = (a) => a.concat("hi"); + x3(0); + + /** @type {function (number): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x4 = (a) => a + 1; + x4(0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt.diff index f06ecf6e93..a26d98f387 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt.diff @@ -1,54 +1,71 @@ --- old.checkJsdocTypeTag2.errors.txt +++ new.checkJsdocTypeTag2.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'string'. --0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'. ++0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'String'. + 0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'. -0.js(8,12): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -0.js(10,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -0.js(17,1): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(20,21): error TS2339: Property 'concat' does not exist on type 'number'. -0.js(24,19): error TS2322: Type 'number' is not assignable to type 'string'. -- -- ++0.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(12,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(23,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + -==== 0.js (7 errors) ==== -- // @ts-check -- /** @type {String} */ -- var S = true; -- ~ ++==== 0.js (6 errors) ==== + // @ts-check + /** @type {String} */ + var S = true; + ~ -!!! error TS2322: Type 'boolean' is not assignable to type 'string'. -- -- /** @type {number} */ -- var n = "hello"; -- ~ --!!! error TS2322: Type 'string' is not assignable to type 'number'. -- -- /** @type {function (number)} */ ++!!! error TS2322: Type 'boolean' is not assignable to type 'String'. + + /** @type {number} */ + var n = "hello"; +@@= skipped -19, +18 lines =@@ + !!! error TS2322: Type 'string' is not assignable to type 'number'. + + /** @type {function (number)} */ - ~~~~~~~~~~~~~~~~~ -!!! error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -- const x1 = (a) => a + 1; -- x1("string"); ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x1 = (a) => a + 1; + x1("string"); - ~~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -- -- /** @type {function (number): number} */ -- const x2 = (a) => a + 1; -- -- /** @type {string} */ -- var a; -- a = x2(0); + + /** @type {function (number): number} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x2 = (a) => a + 1; + + /** @type {string} */ + var a; + a = x2(0); - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- -- /** @type {function (number): number} */ -- const x3 = (a) => a.concat("hi"); + + /** @type {function (number): number} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x3 = (a) => a.concat("hi"); - ~~~~~~ -!!! error TS2339: Property 'concat' does not exist on type 'number'. -- x3(0); -- -- /** @type {function (number): string} */ -- const x4 = (a) => a + 1; + x3(0); + + /** @type {function (number): string} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x4 = (a) => a + 1; - ~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- x4(0); -@@= skipped --1, +1 lines =@@ -+ + x4(0); diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt new file mode 100644 index 0000000000..e242e52f52 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt @@ -0,0 +1,18 @@ +test.js(7,12): error TS2304: Cannot find name 'B'. + + +==== t.d.ts (0 errors) ==== + type A = { a: T } + +==== test.js (1 errors) ==== + /** Also should error for jsdoc typedefs + * @template {string} U + * @typedef {{ b: U }} B + */ + /** @type {A} */ + var a; + /** @type {B} */ + ~ +!!! error TS2304: Cannot find name 'B'. + var b; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt.diff index ffefc22db0..bf4140ef7f 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt.diff @@ -1,26 +1,28 @@ --- old.checkJsdocTypeTag4.errors.txt +++ new.checkJsdocTypeTag4.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -test.js(5,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. -test.js(7,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. -- -- --==== t.d.ts (0 errors) ==== -- type A = { a: T } -- ++test.js(7,12): error TS2304: Cannot find name 'B'. + + + ==== t.d.ts (0 errors) ==== + type A = { a: T } + -==== test.js (2 errors) ==== -- /** Also should error for jsdoc typedefs -- * @template {string} U -- * @typedef {{ b: U }} B -- */ -- /** @type {A} */ ++==== test.js (1 errors) ==== + /** Also should error for jsdoc typedefs + * @template {string} U + * @typedef {{ b: U }} B + */ + /** @type {A} */ - ~~~~~~ -!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. -- var a; -- /** @type {B} */ + var a; + /** @type {B} */ - ~~~~~~ -!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. -- var b; -- -@@= skipped --1, +1 lines =@@ -+ ++ ~ ++!!! error TS2304: Cannot find name 'B'. + var b; + diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt new file mode 100644 index 0000000000..285e2ac7c4 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt @@ -0,0 +1,64 @@ +test.js(5,14): error TS2322: Type 'number' is not assignable to type 'string'. +test.js(7,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. + Type 'number' is not assignable to type 'string'. +test.js(12,14): error TS2322: Type 'number' is not assignable to type 'string'. +test.js(14,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. + Type 'number' is not assignable to type 'string'. +test.js(24,5): error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'. +test.js(34,5): error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. + Type '1' is not assignable to type '2 | 3'. + + +==== test.js (6 errors) ==== + // all 6 should error on return statement/expression + /** @type {(x: number) => string} */ + function h(x) { return x } + /** @type {(x: number) => string} */ + var f = x => x + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6502 test.js:4:12: The expected type comes from the return type of this signature. + /** @type {(x: number) => string} */ + var g = function (x) { return x } + ~ +!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + + /** @type {{ (x: number): string }} */ + function i(x) { return x } + /** @type {{ (x: number): string }} */ + var j = x => x + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6502 test.js:11:12: The expected type comes from the return type of this signature. + /** @type {{ (x: number): string }} */ + var k = function (x) { return x } + ~ +!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + + + /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ + /** @type {Argle} */ + function blargle(s) { + return 0; + } + + /** @type {0 | 1 | 2} - assignment should not error */ + var zeroonetwo = blargle('hi') + ~~~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'. + + /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ + + /** @type {Gioconda} */ + function monaLisa(sb) { + return typeof sb === 'string' ? 1 : 2; + } + + /** @type {2 | 3} - overloads are not supported, so there will be an error */ + var twothree = monaLisa(false); + ~~~~~~~~ +!!! error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. +!!! error TS2322: Type '1' is not assignable to type '2 | 3'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt.diff index ef88515543..aadaba2498 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt.diff @@ -1,69 +1,73 @@ --- old.checkJsdocTypeTag5.errors.txt +++ new.checkJsdocTypeTag5.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -test.js(3,17): error TS2322: Type 'number' is not assignable to type 'string'. --test.js(5,14): error TS2322: Type 'number' is not assignable to type 'string'. + test.js(5,14): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(7,24): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(10,17): error TS2322: Type 'number' is not assignable to type 'string'. --test.js(12,14): error TS2322: Type 'number' is not assignable to type 'string'. ++test.js(7,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. ++ Type 'number' is not assignable to type 'string'. + test.js(12,14): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(14,24): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(28,12): error TS8030: The type of a function declaration must match the function's signature. --test.js(34,5): error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. -- Type '1' is not assignable to type '2 | 3'. -- -- ++test.js(14,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. ++ Type 'number' is not assignable to type 'string'. ++test.js(24,5): error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'. + test.js(34,5): error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. + Type '1' is not assignable to type '2 | 3'. + + -==== test.js (8 errors) ==== -- // all 6 should error on return statement/expression -- /** @type {(x: number) => string} */ -- function h(x) { return x } ++==== test.js (6 errors) ==== + // all 6 should error on return statement/expression + /** @type {(x: number) => string} */ + function h(x) { return x } - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- /** @type {(x: number) => string} */ -- var f = x => x -- ~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. -- /** @type {(x: number) => string} */ -- var g = function (x) { return x } + /** @type {(x: number) => string} */ + var f = x => x + ~ + !!! error TS2322: Type 'number' is not assignable to type 'string'. ++!!! related TS6502 test.js:4:12: The expected type comes from the return type of this signature. + /** @type {(x: number) => string} */ + var g = function (x) { return x } - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- -- /** @type {{ (x: number): string }} */ -- function i(x) { return x } ++ ~ ++!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. ++!!! error TS2322: Type 'number' is not assignable to type 'string'. + + /** @type {{ (x: number): string }} */ + function i(x) { return x } - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- /** @type {{ (x: number): string }} */ -- var j = x => x -- ~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. -- /** @type {{ (x: number): string }} */ -- var k = function (x) { return x } + /** @type {{ (x: number): string }} */ + var j = x => x + ~ + !!! error TS2322: Type 'number' is not assignable to type 'string'. ++!!! related TS6502 test.js:11:12: The expected type comes from the return type of this signature. + /** @type {{ (x: number): string }} */ + var k = function (x) { return x } - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- -- -- /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ -- /** @type {Argle} */ -- function blargle(s) { -- return 0; -- } -- -- /** @type {0 | 1 | 2} - assignment should not error */ -- var zeroonetwo = blargle('hi') -- -- /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ -- -- /** @type {Gioconda} */ ++ ~ ++!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. ++!!! error TS2322: Type 'number' is not assignable to type 'string'. + + + /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ +@@= skipped -45, +45 lines =@@ + + /** @type {0 | 1 | 2} - assignment should not error */ + var zeroonetwo = blargle('hi') ++ ~~~~~~~~~~ ++!!! error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'. + + /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ + + /** @type {Gioconda} */ - ~~~~~~~~ -!!! error TS8030: The type of a function declaration must match the function's signature. -- function monaLisa(sb) { -- return typeof sb === 'string' ? 1 : 2; -- } -- -- /** @type {2 | 3} - overloads are not supported, so there will be an error */ -- var twothree = monaLisa(false); -- ~~~~~~~~ --!!! error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. --!!! error TS2322: Type '1' is not assignable to type '2 | 3'. -- -@@= skipped --1, +1 lines =@@ -+ + function monaLisa(sb) { + return typeof sb === 'string' ? 1 : 2; + } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt new file mode 100644 index 0000000000..34a62935d5 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt @@ -0,0 +1,52 @@ +test.js(7,5): error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. +test.js(27,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. + Target signature provides too few arguments. Expected 1 or more, but got 0. +test.js(30,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. + Target signature provides too few arguments. Expected 1 or more, but got 0. + + +==== test.js (3 errors) ==== + /** @type {number} */ + function f() { + return 1 + } + + /** @type {{ prop: string }} */ + var g = function (prop) { + ~ +!!! error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. + } + + /** @type {(a: number) => number} */ + function add1(a, b) { return a + b; } + + /** @type {(a: number, b: number) => number} */ + function add2(a, b) { return a + b; } + + // TODO: Should be an error since signature doesn't match. + /** @type {(a: number, b: number, c: number) => number} */ + function add3(a, b) { return a + b; } + + // Confirm initializers are compatible. + // They can't have more parameters than the type/context. + + /** @type {() => void} */ + function funcWithMoreParameters(more) {} // error + + /** @type {() => void} */ + const variableWithMoreParameters = function (more) {}; // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. + + /** @type {() => void} */ + const arrowWithMoreParameters = (more) => {}; // error + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. + + ({ + /** @type {() => void} */ + methodWithMoreParameters(more) {}, // error + }); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt.diff index dc81be50ce..13763ae1a4 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt.diff @@ -1,71 +1,50 @@ --- old.checkJsdocTypeTag6.errors.txt +++ new.checkJsdocTypeTag6.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -test.js(1,12): error TS8030: The type of a function declaration must match the function's signature. --test.js(7,5): error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. + test.js(7,5): error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. -test.js(10,12): error TS8030: The type of a function declaration must match the function's signature. -test.js(23,12): error TS8030: The type of a function declaration must match the function's signature. --test.js(27,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. -- Target signature provides too few arguments. Expected 1 or more, but got 0. --test.js(30,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. -- Target signature provides too few arguments. Expected 1 or more, but got 0. + test.js(27,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. + Target signature provides too few arguments. Expected 1 or more, but got 0. + test.js(30,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. + Target signature provides too few arguments. Expected 1 or more, but got 0. -test.js(34,3): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. - Target signature provides too few arguments. Expected 1 or more, but got 0. -- -- + + -==== test.js (7 errors) ==== -- /** @type {number} */ ++==== test.js (3 errors) ==== + /** @type {number} */ - ~~~~~~ -!!! error TS8030: The type of a function declaration must match the function's signature. -- function f() { -- return 1 -- } -- -- /** @type {{ prop: string }} */ -- var g = function (prop) { -- ~ --!!! error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. -- } -- -- /** @type {(a: number) => number} */ + function f() { + return 1 + } +@@= skipped -24, +17 lines =@@ + } + + /** @type {(a: number) => number} */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8030: The type of a function declaration must match the function's signature. -- function add1(a, b) { return a + b; } -- -- /** @type {(a: number, b: number) => number} */ -- function add2(a, b) { return a + b; } -- -- // TODO: Should be an error since signature doesn't match. -- /** @type {(a: number, b: number, c: number) => number} */ -- function add3(a, b) { return a + b; } -- -- // Confirm initializers are compatible. -- // They can't have more parameters than the type/context. -- -- /** @type {() => void} */ + function add1(a, b) { return a + b; } + + /** @type {(a: number, b: number) => number} */ +@@= skipped -15, +13 lines =@@ + // They can't have more parameters than the type/context. + + /** @type {() => void} */ - ~~~~~~~~~~ -!!! error TS8030: The type of a function declaration must match the function's signature. -- function funcWithMoreParameters(more) {} // error -- -- /** @type {() => void} */ -- const variableWithMoreParameters = function (more) {}; // error -- ~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. --!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. -- -- /** @type {() => void} */ -- const arrowWithMoreParameters = (more) => {}; // error -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. --!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. -- -- ({ -- /** @type {() => void} */ -- methodWithMoreParameters(more) {}, // error + function funcWithMoreParameters(more) {} // error + + /** @type {() => void} */ +@@= skipped -19, +17 lines =@@ + ({ + /** @type {() => void} */ + methodWithMoreParameters(more) {}, // error - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. -!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. -- }); -- -@@= skipped --1, +1 lines =@@ -+ + }); + diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt index 14b4f4d795..35c7d11f52 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt @@ -1,8 +1,7 @@ -0.js(19,1): error TS2322: Type '"string"' is not assignable to type 'undefined'. -0.js(21,1): error TS2322: Type 'undefined' is not assignable to type 'string'. +0.js(16,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -==== 0.js (2 errors) ==== +==== 0.js (1 errors) ==== // @ts-check var lol = "hello Lol" const obj = { @@ -19,15 +18,14 @@ /** @type {number} */ ['b' + 'ar1']: 42, /** @type {function(number): number} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. arrowFunc: (num) => num + 42 } obj.foo = 'string' - ~~~~~~~ -!!! error TS2322: Type '"string"' is not assignable to type 'undefined'. obj.lol obj.bar = undefined; - ~~~~~~~ -!!! error TS2322: Type 'undefined' is not assignable to type 'string'. var k = obj.method1(0); obj.bar1 = "42"; obj.arrowFunc(0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff index b1b2b146a2..7aa3c6a048 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff @@ -3,11 +3,10 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+0.js(19,1): error TS2322: Type '"string"' is not assignable to type 'undefined'. -+0.js(21,1): error TS2322: Type 'undefined' is not assignable to type 'string'. ++0.js(16,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + -+==== 0.js (2 errors) ==== ++==== 0.js (1 errors) ==== + // @ts-check + var lol = "hello Lol" + const obj = { @@ -24,15 +23,14 @@ + /** @type {number} */ + ['b' + 'ar1']: 42, + /** @type {function(number): number} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + arrowFunc: (num) => num + 42 + } + obj.foo = 'string' -+ ~~~~~~~ -+!!! error TS2322: Type '"string"' is not assignable to type 'undefined'. + obj.lol + obj.bar = undefined; -+ ~~~~~~~ -+!!! error TS2322: Type 'undefined' is not assignable to type 'string'. + var k = obj.method1(0); + obj.bar1 = "42"; + obj.arrowFunc(0); diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt new file mode 100644 index 0000000000..210047f7bf --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt @@ -0,0 +1,36 @@ +0.js(4,14): error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. +0.js(10,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(12,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + +==== 0.js (3 errors) ==== + // @ts-check + var lol; + const obj = { + /** @type {string|undefined} */ + ~~~~~~~~~~~~~~~~ +!!! error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. + bar: 42, + /** @type {function(number): number} */ + method1(n1) { + return "42"; + }, + /** @type {function(number): number} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + method2: (n1) => "lol", + /** @type {function(number): number} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + arrowFunc: (num="0") => num + 42, + /** @type {string} */ + lol + } + lol = "string" + /** @type {string} */ + var s = obj.method1(0); + + /** @type {string} */ + var s1 = obj.method2("0"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff index 015876ca90..b889b4f92c 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff @@ -1,6 +1,6 @@ --- old.checkJsdocTypeTagOnObjectProperty2.errors.txt +++ new.checkJsdocTypeTagOnObjectProperty2.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -0.js(5,3): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(8,7): error TS2322: Type 'string' is not assignable to type 'number'. -0.js(11,20): error TS2322: Type 'string' is not assignable to type 'number'. @@ -9,46 +9,56 @@ -0.js(19,5): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(22,5): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(22,22): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -- -- ++0.js(4,14): error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. ++0.js(10,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(12,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + -==== 0.js (8 errors) ==== -- // @ts-check -- var lol; -- const obj = { -- /** @type {string|undefined} */ -- bar: 42, ++==== 0.js (3 errors) ==== + // @ts-check + var lol; + const obj = { + /** @type {string|undefined} */ ++ ~~~~~~~~~~~~~~~~ ++!!! error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. + bar: 42, - ~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- /** @type {function(number): number} */ -- method1(n1) { -- return "42"; + /** @type {function(number): number} */ + method1(n1) { + return "42"; - ~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. -- }, -- /** @type {function(number): number} */ -- method2: (n1) => "lol", + }, + /** @type {function(number): number} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + method2: (n1) => "lol", - ~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. -- /** @type {function(number): number} */ -- arrowFunc: (num="0") => num + 42, + /** @type {function(number): number} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + arrowFunc: (num="0") => num + 42, - ~~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. -- /** @type {string} */ -- lol + /** @type {string} */ + lol - ~~~ -!!! error TS2322: Type 'undefined' is not assignable to type 'string'. -- } -- lol = "string" -- /** @type {string} */ -- var s = obj.method1(0); + } + lol = "string" + /** @type {string} */ + var s = obj.method1(0); - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- -- /** @type {string} */ -- var s1 = obj.method2("0"); + + /** @type {string} */ + var s1 = obj.method2("0"); - ~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - ~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt index a2ec89dadf..7ca331727c 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt @@ -1,7 +1,8 @@ 0.js(8,9): error TS2339: Property 'SomeName' does not exist on type '{}'. +0.js(10,12): error TS2503: Cannot find namespace 'exports'. -==== 0.js (1 errors) ==== +==== 0.js (2 errors) ==== // @ts-check var exports = {}; @@ -14,5 +15,7 @@ !!! error TS2339: Property 'SomeName' does not exist on type '{}'. /** @type {exports.SomeName} */ + ~~~~~~~ +!!! error TS2503: Cannot find namespace 'exports'. const myString = 'str'; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff index 948387c255..0874b01b9b 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff @@ -3,10 +3,15 @@ @@= skipped -0, +0 lines =@@ -0.js(10,20): error TS2694: Namespace 'exports' has no exported member 'SomeName'. +0.js(8,9): error TS2339: Property 'SomeName' does not exist on type '{}'. ++0.js(10,12): error TS2503: Cannot find namespace 'exports'. - ==== 0.js (1 errors) ==== -@@= skipped -9, +9 lines =@@ +-==== 0.js (1 errors) ==== ++==== 0.js (2 errors) ==== + // @ts-check + + var exports = {}; +@@= skipped -9, +10 lines =@@ * @typedef {string} */ exports.SomeName; @@ -16,5 +21,7 @@ /** @type {exports.SomeName} */ - ~~~~~~~~ -!!! error TS2694: Namespace 'exports' has no exported member 'SomeName'. ++ ~~~~~~~ ++!!! error TS2503: Cannot find namespace 'exports'. const myString = 'str'; diff --git a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt index 9e51e0e0f0..f2698865d7 100644 --- a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt @@ -1,7 +1,9 @@ bug24252.js(2,3): error TS2339: Property 'B' does not exist on type '{}'. +bug24252.js(8,9): error TS2322: Type 'string[]' is not assignable to type 'number[]'. + Type 'string' is not assignable to type 'number'. -==== bug24252.js (1 errors) ==== +==== bug24252.js (2 errors) ==== var A = {}; A.B = class { ~ @@ -12,6 +14,9 @@ bug24252.js(2,3): error TS2339: Property 'B' does not exist on type '{}'. /** @type {number[]} */ var y; y = x; + ~ +!!! error TS2322: Type 'string[]' is not assignable to type 'number[]'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. } }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt.diff index ca5f8336d5..9788eb2be5 100644 --- a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt.diff @@ -1,12 +1,13 @@ --- old.checkSpecialPropertyAssignments.errors.txt +++ new.checkSpecialPropertyAssignments.errors.txt @@= skipped -0, +0 lines =@@ --bug24252.js(8,9): error TS2322: Type 'string[]' is not assignable to type 'number[]'. -- Type 'string' is not assignable to type 'number'. +bug24252.js(2,3): error TS2339: Property 'B' does not exist on type '{}'. + bug24252.js(8,9): error TS2322: Type 'string[]' is not assignable to type 'number[]'. + Type 'string' is not assignable to type 'number'. - ==== bug24252.js (1 errors) ==== +-==== bug24252.js (1 errors) ==== ++==== bug24252.js (2 errors) ==== var A = {}; A.B = class { + ~ @@ -14,12 +15,3 @@ m() { /** @type {string[]} */ var x = []; - /** @type {number[]} */ - var y; - y = x; -- ~ --!!! error TS2322: Type 'string[]' is not assignable to type 'number[]'. --!!! error TS2322: Type 'string' is not assignable to type 'number'. - } - }; - diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt new file mode 100644 index 0000000000..d61f877f45 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt @@ -0,0 +1,40 @@ +constructorFunctionMethodTypeParameters.js(24,17): error TS2304: Cannot find name 'T'. + + +==== constructorFunctionMethodTypeParameters.js (1 errors) ==== + /** + * @template {string} T + * @param {T} t + */ + function Cls(t) { + this.t = t; + } + + /** + * @template {string} V + * @param {T} t + * @param {V} v + * @return {V} + */ + Cls.prototype.topLevelComment = function (t, v) { + return v + }; + + Cls.prototype.nestedComment = + /** + * @template {string} U + * @param {T} t + * @param {U} u + * @return {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function (t, u) { + return t + }; + + var c = new Cls('a'); + const s = c.topLevelComment('a', 'b'); + const t = c.nestedComment('a', 'b'); + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff new file mode 100644 index 0000000000..cfb4ecdbf1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff @@ -0,0 +1,45 @@ +--- old.constructorFunctionMethodTypeParameters.errors.txt ++++ new.constructorFunctionMethodTypeParameters.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++constructorFunctionMethodTypeParameters.js(24,17): error TS2304: Cannot find name 'T'. ++ ++ ++==== constructorFunctionMethodTypeParameters.js (1 errors) ==== ++ /** ++ * @template {string} T ++ * @param {T} t ++ */ ++ function Cls(t) { ++ this.t = t; ++ } ++ ++ /** ++ * @template {string} V ++ * @param {T} t ++ * @param {V} v ++ * @return {V} ++ */ ++ Cls.prototype.topLevelComment = function (t, v) { ++ return v ++ }; ++ ++ Cls.prototype.nestedComment = ++ /** ++ * @template {string} U ++ * @param {T} t ++ * @param {U} u ++ * @return {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ function (t, u) { ++ return t ++ }; ++ ++ var c = new Cls('a'); ++ const s = c.topLevelComment('a', 'b'); ++ const t = c.nestedComment('a', 'b'); ++ ++ diff --git a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt index 686855675a..b0cd9b62b0 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt @@ -1,7 +1,8 @@ +a.js(35,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. -==== a.js (1 errors) ==== +==== a.js (2 errors) ==== /** @enum {string} */ const Target = { START: "start", @@ -37,6 +38,8 @@ a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: s /** @type {(n: number) => number} */ var fun = f /** @type {Target} */ + ~~~~~~ +!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? var v = Target.START v = Target.UNKNOWN // error, can't find 'UNKNOWN' ~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt.diff index 5334a1f85a..465c18313d 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt.diff @@ -3,11 +3,12 @@ @@= skipped -0, +0 lines =@@ -a.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. -a.js(12,5): error TS2322: Type 'string' is not assignable to type 'number'. ++a.js(35,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. -==== a.js (3 errors) ==== -+==== a.js (1 errors) ==== ++==== a.js (2 errors) ==== /** @enum {string} */ const Target = { START: "start", @@ -27,3 +28,12 @@ OK: 1, /** @type {number} */ FINE: 2, +@@= skipped -42, +37 lines =@@ + /** @type {(n: number) => number} */ + var fun = f + /** @type {Target} */ ++ ~~~~~~ ++!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? + var v = Target.START + v = Target.UNKNOWN // error, can't find 'UNKNOWN' + ~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt b/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt new file mode 100644 index 0000000000..27bbcc93ad --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt @@ -0,0 +1,31 @@ +type.js(2,12): error TS2304: Cannot find name 'TE'. +type.js(4,29): error TS2694: Namespace '""mod1.js""' has no exported member 'TestEnum'. +value.js(2,12): error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'? + + +==== type.js (2 errors) ==== + /** @typedef {import("./mod1").TestEnum} TE */ + /** @type {TE} */ + ~~ +!!! error TS2304: Cannot find name 'TE'. + const test = 'add' + /** @type {import("./mod1").TestEnum} */ + ~~~~~~~~ +!!! error TS2694: Namespace '""mod1.js""' has no exported member 'TestEnum'. + const tost = 'remove' + +==== value.js (1 errors) ==== + import { TestEnum } from "./mod1" + /** @type {TestEnum} */ + ~~~~~~~~ +!!! error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'? + const tist = TestEnum.ADD + + +==== mod1.js (0 errors) ==== + /** @enum {string} */ + export const TestEnum = { + ADD: 'add', + REMOVE: 'remove' + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt.diff new file mode 100644 index 0000000000..db8895ac63 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt.diff @@ -0,0 +1,36 @@ +--- old.enumTagImported.errors.txt ++++ new.enumTagImported.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++type.js(2,12): error TS2304: Cannot find name 'TE'. ++type.js(4,29): error TS2694: Namespace '""mod1.js""' has no exported member 'TestEnum'. ++value.js(2,12): error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'? ++ ++ ++==== type.js (2 errors) ==== ++ /** @typedef {import("./mod1").TestEnum} TE */ ++ /** @type {TE} */ ++ ~~ ++!!! error TS2304: Cannot find name 'TE'. ++ const test = 'add' ++ /** @type {import("./mod1").TestEnum} */ ++ ~~~~~~~~ ++!!! error TS2694: Namespace '""mod1.js""' has no exported member 'TestEnum'. ++ const tost = 'remove' ++ ++==== value.js (1 errors) ==== ++ import { TestEnum } from "./mod1" ++ /** @type {TestEnum} */ ++ ~~~~~~~~ ++!!! error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'? ++ const tist = TestEnum.ADD ++ ++ ++==== mod1.js (0 errors) ==== ++ /** @enum {string} */ ++ export const TestEnum = { ++ ADD: 'add', ++ REMOVE: 'remove' ++ } ++ diff --git a/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt new file mode 100644 index 0000000000..5aebbf567d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt @@ -0,0 +1,16 @@ +bug27134.js(7,11): error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? + + +==== bug27134.js (1 errors) ==== + /** + * @enum {number} + */ + var foo = { }; + + /** + * @type {foo} + ~~~ +!!! error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? + */ + var s; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt.diff new file mode 100644 index 0000000000..732a57f4c7 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt.diff @@ -0,0 +1,21 @@ +--- old.enumTagUseBeforeDefCrash.errors.txt ++++ new.enumTagUseBeforeDefCrash.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++bug27134.js(7,11): error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? ++ ++ ++==== bug27134.js (1 errors) ==== ++ /** ++ * @enum {number} ++ */ ++ var foo = { }; ++ ++ /** ++ * @type {foo} ++ ~~~ ++!!! error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? ++ */ ++ var s; ++ diff --git a/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt new file mode 100644 index 0000000000..35cf4728a3 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt @@ -0,0 +1,56 @@ +foo.js(20,12): error TS2304: Cannot find name 'FunctionReturningPromise'. +foo.js(44,12): error TS2304: Cannot find name 'FunctionReturningNever'. + + +==== foo.js (2 errors) ==== + /** + * @callback FunctionReturningPromise + * @returns {Promise} + */ + + /** @type {FunctionReturningPromise} */ + function testPromise1() { + console.log("Nope"); + } + + /** @type {FunctionReturningPromise} */ + async function testPromise2() { + return "asd"; + } + + var testPromise3 = /** @type {FunctionReturningPromise} */ function() { + console.log("test") + } + + /** @type {FunctionReturningPromise} */ + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'FunctionReturningPromise'. + var testPromise4 = function() { + console.log("test") + } + + /** + * @callback FunctionReturningNever + * @returns {never} + */ + + /** @type {FunctionReturningNever} */ + function testNever1() { + + } + + /** @type {FunctionReturningNever} */ + async function testNever2() { + return "asd"; + } + + var testNever3 = /** @type {FunctionReturningNever} */ function() { + console.log("test") + } + + /** @type {FunctionReturningNever} */ + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'FunctionReturningNever'. + var testNever4 = function() { + console.log("test") + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt.diff index bf618fbdbf..a85247a036 100644 --- a/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt.diff @@ -1,6 +1,6 @@ --- old.errorOnFunctionReturnType.errors.txt +++ new.errorOnFunctionReturnType.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -foo.js(7,10): error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. -foo.js(11,12): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -foo.js(13,5): error TS2322: Type 'string' is not assignable to type 'number'. @@ -11,76 +11,78 @@ -foo.js(37,5): error TS2322: Type '"asd"' is not assignable to type 'never'. -foo.js(40,56): error TS2534: A function returning 'never' cannot have a reachable end point. -foo.js(45,18): error TS2534: A function returning 'never' cannot have a reachable end point. -- -- ++foo.js(20,12): error TS2304: Cannot find name 'FunctionReturningPromise'. ++foo.js(44,12): error TS2304: Cannot find name 'FunctionReturningNever'. + + -==== foo.js (10 errors) ==== -- /** -- * @callback FunctionReturningPromise -- * @returns {Promise} -- */ -- -- /** @type {FunctionReturningPromise} */ -- function testPromise1() { ++==== foo.js (2 errors) ==== + /** + * @callback FunctionReturningPromise + * @returns {Promise} +@@= skipped -17, +9 lines =@@ + + /** @type {FunctionReturningPromise} */ + function testPromise1() { - ~~~~~~~~~~~~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. -- console.log("Nope"); -- } -- -- /** @type {FunctionReturningPromise} */ + console.log("Nope"); + } + + /** @type {FunctionReturningPromise} */ - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -- async function testPromise2() { -- return "asd"; + async function testPromise2() { + return "asd"; - ~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. -- } -- -- var testPromise3 = /** @type {FunctionReturningPromise} */ function() { + } + + var testPromise3 = /** @type {FunctionReturningPromise} */ function() { - ~~~~~~~~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. -- console.log("test") -- } -- -- /** @type {FunctionReturningPromise} */ -- var testPromise4 = function() { + console.log("test") + } + + /** @type {FunctionReturningPromise} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'FunctionReturningPromise'. + var testPromise4 = function() { - ~~~~~~~~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. -- console.log("test") -- } -- -- /** -- * @callback FunctionReturningNever -- * @returns {never} -- */ -- -- /** @type {FunctionReturningNever} */ -- function testNever1() { + console.log("test") + } + +@@= skipped -34, +26 lines =@@ + + /** @type {FunctionReturningNever} */ + function testNever1() { - ~~~~~~~~~~ -!!! error TS2534: A function returning 'never' cannot have a reachable end point. -- -- } -- -- /** @type {FunctionReturningNever} */ + + } + + /** @type {FunctionReturningNever} */ - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1065: The return type of an async function or method must be the global Promise type. -!!! related TS1055 foo.js:27:14: Type 'never' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -- async function testNever2() { -- return "asd"; + async function testNever2() { + return "asd"; - ~~~~~~ -!!! error TS2322: Type '"asd"' is not assignable to type 'never'. -- } -- -- var testNever3 = /** @type {FunctionReturningNever} */ function() { + } + + var testNever3 = /** @type {FunctionReturningNever} */ function() { - ~~~~~~~~ -!!! error TS2534: A function returning 'never' cannot have a reachable end point. -- console.log("test") -- } -- -- /** @type {FunctionReturningNever} */ -- var testNever4 = function() { + console.log("test") + } + + /** @type {FunctionReturningNever} */ ++ ~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'FunctionReturningNever'. + var testNever4 = function() { - ~~~~~~~~ -!!! error TS2534: A function returning 'never' cannot have a reachable end point. -- console.log("test") -- } -@@= skipped --1, +1 lines =@@ -+ + console.log("test") + } diff --git a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt new file mode 100644 index 0000000000..3e7597d212 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt @@ -0,0 +1,19 @@ +use.js(3,12): error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'? + + +==== def.js (0 errors) ==== + /** @enum {number} */ + const MyEnum = { + a: 1, + b: 2 + }; + export default MyEnum; + +==== use.js (1 errors) ==== + import MyEnum from "./def"; + + /** @type {MyEnum} */ + ~~~~~~ +!!! error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'? + const v = MyEnum.b; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt.diff new file mode 100644 index 0000000000..a8138db37b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt.diff @@ -0,0 +1,24 @@ +--- old.exportedEnumTypeAndValue.errors.txt ++++ new.exportedEnumTypeAndValue.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++use.js(3,12): error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'? ++ ++ ++==== def.js (0 errors) ==== ++ /** @enum {number} */ ++ const MyEnum = { ++ a: 1, ++ b: 2 ++ }; ++ export default MyEnum; ++ ++==== use.js (1 errors) ==== ++ import MyEnum from "./def"; ++ ++ /** @type {MyEnum} */ ++ ~~~~~~ ++!!! error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'? ++ const v = MyEnum.b; ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt new file mode 100644 index 0000000000..049012688d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt @@ -0,0 +1,44 @@ +/a.js(5,15): error TS2304: Cannot find name 'Import'. +/a.js(12,15): error TS2552: Cannot find name 'Require'. Did you mean 'Required'? + + +==== /node_modules/@types/foo/package.json (0 errors) ==== + { + "name": "@types/foo", + "version": "1.0.0", + "exports": { + ".": { + "import": "./index.d.mts", + "require": "./index.d.cts" + } + } + } + +==== /node_modules/@types/foo/index.d.mts (0 errors) ==== + export declare const Import: "module"; + +==== /node_modules/@types/foo/index.d.cts (0 errors) ==== + export declare const Require: "script"; + +==== /a.js (2 errors) ==== + /** @import { Import } from 'foo' with { 'resolution-mode': 'import' } */ + /** @import { Require } from 'foo' with { 'resolution-mode': 'require' } */ + + /** + * @returns { Import } + ~~~~~~ +!!! error TS2304: Cannot find name 'Import'. + */ + export function f1() { + return 1; + } + + /** + * @returns { Require } + ~~~~~~~ +!!! error TS2552: Cannot find name 'Require'. Did you mean 'Required'? + */ + export function f2() { + return 1; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt.diff index ec2074c7cf..3dba612b3e 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt.diff @@ -1,49 +1,34 @@ --- old.importTag17.errors.txt +++ new.importTag17.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(8,5): error TS2322: Type '1' is not assignable to type '"module"'. -/a.js(15,5): error TS2322: Type '1' is not assignable to type '"script"'. -- -- --==== /node_modules/@types/foo/package.json (0 errors) ==== -- { -- "name": "@types/foo", -- "version": "1.0.0", -- "exports": { -- ".": { -- "import": "./index.d.mts", -- "require": "./index.d.cts" -- } -- } -- } -- --==== /node_modules/@types/foo/index.d.mts (0 errors) ==== -- export declare const Import: "module"; -- --==== /node_modules/@types/foo/index.d.cts (0 errors) ==== -- export declare const Require: "script"; -- --==== /a.js (2 errors) ==== -- /** @import { Import } from 'foo' with { 'resolution-mode': 'import' } */ -- /** @import { Require } from 'foo' with { 'resolution-mode': 'require' } */ -- -- /** -- * @returns { Import } -- */ -- export function f1() { -- return 1; ++/a.js(5,15): error TS2304: Cannot find name 'Import'. ++/a.js(12,15): error TS2552: Cannot find name 'Require'. Did you mean 'Required'? + + + ==== /node_modules/@types/foo/package.json (0 errors) ==== +@@= skipped -25, +25 lines =@@ + + /** + * @returns { Import } ++ ~~~~~~ ++!!! error TS2304: Cannot find name 'Import'. + */ + export function f1() { + return 1; - ~~~~~~ -!!! error TS2322: Type '1' is not assignable to type '"module"'. -- } -- -- /** -- * @returns { Require } -- */ -- export function f2() { -- return 1; + } + + /** + * @returns { Require } ++ ~~~~~~~ ++!!! error TS2552: Cannot find name 'Require'. Did you mean 'Required'? + */ + export function f2() { + return 1; - ~~~~~~ -!!! error TS2322: Type '1' is not assignable to type '"script"'. -- } -- -@@= skipped --1, +1 lines =@@ -+ + } + diff --git a/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt b/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt new file mode 100644 index 0000000000..ed3d68f55d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt @@ -0,0 +1,36 @@ +/a.js(5,17): error TS2304: Cannot find name 'T'. +/a.js(14,17): error TS2304: Cannot find name 'T'. + + +==== /a.js (2 errors) ==== + export class C { + /** + * @template T + * @this {T} + * @return {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + static a() { + return this; + } + + /** + * @template T + * @this {T} + * @return {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + b() { + return this; + } + } + + const a = C.a(); + a; // typeof C + + const c = new C(); + const b = c.b(); + b; // C + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt.diff new file mode 100644 index 0000000000..17d7c303d8 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt.diff @@ -0,0 +1,41 @@ +--- old.inferThis.errors.txt ++++ new.inferThis.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/a.js(5,17): error TS2304: Cannot find name 'T'. ++/a.js(14,17): error TS2304: Cannot find name 'T'. ++ ++ ++==== /a.js (2 errors) ==== ++ export class C { ++ /** ++ * @template T ++ * @this {T} ++ * @return {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ static a() { ++ return this; ++ } ++ ++ /** ++ * @template T ++ * @this {T} ++ * @return {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ b() { ++ return this; ++ } ++ } ++ ++ const a = C.a(); ++ a; // typeof C ++ ++ const c = new C(); ++ const b = c.b(); ++ b; // C ++ diff --git a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt new file mode 100644 index 0000000000..25253c5495 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt @@ -0,0 +1,22 @@ +instantiateTemplateTagTypeParameterOnVariableStatement.js(4,18): error TS2304: Cannot find name 'T'. +instantiateTemplateTagTypeParameterOnVariableStatement.js(4,24): error TS2304: Cannot find name 'T'. + + +==== instantiateTemplateTagTypeParameterOnVariableStatement.js (2 errors) ==== + /** + * @template T + * @param {T} a + * @returns {(b: T) => T} + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'T'. + */ + const seq = a => b => b; + + const text1 = "hello"; + const text2 = "world"; + + /** @type {string} */ + var text3 = seq(text1)(text2); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff new file mode 100644 index 0000000000..e1c790fbd6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff @@ -0,0 +1,27 @@ +--- old.instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt ++++ new.instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++instantiateTemplateTagTypeParameterOnVariableStatement.js(4,18): error TS2304: Cannot find name 'T'. ++instantiateTemplateTagTypeParameterOnVariableStatement.js(4,24): error TS2304: Cannot find name 'T'. ++ ++ ++==== instantiateTemplateTagTypeParameterOnVariableStatement.js (2 errors) ==== ++ /** ++ * @template T ++ * @param {T} a ++ * @returns {(b: T) => T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ const seq = a => b => b; ++ ++ const text1 = "hello"; ++ const text2 = "world"; ++ ++ /** @type {string} */ ++ var text3 = seq(text1)(text2); ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt index 6a70384f9a..e594ce84ed 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt @@ -1,3 +1,11 @@ +index.js(24,15): error TS2304: Cannot find name 'T'. +index.js(24,19): error TS2304: Cannot find name 'U'. +index.js(30,15): error TS2304: Cannot find name 'T'. +index.js(30,19): error TS2304: Cannot find name 'U'. +index.js(38,17): error TS2304: Cannot find name 'U'. +index.js(48,17): error TS2304: Cannot find name 'U'. +index.js(104,15): error TS2304: Cannot find name 'T'. +index.js(104,19): error TS2304: Cannot find name 'U'. index.js(138,14): error TS2339: Property 'p1' does not exist on type 'K'. index.js(139,14): error TS2339: Property 'p2' does not exist on type 'K'. index.js(143,21): error TS2339: Property 'p1' does not exist on type 'K'. @@ -6,7 +14,7 @@ index.js(165,14): error TS2339: Property 'another' does not exist on type 'N'. index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. -==== index.js (6 errors) ==== +==== index.js (14 errors) ==== export class A {} export class B { @@ -31,12 +39,20 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. export class E { /** * @type {T & U} + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'U'. */ field; // @readonly is currently unsupported, it seems - included here just in case that changes /** * @type {T & U} + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'U'. * @readonly */ readonlyField; @@ -45,6 +61,8 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. /** * @return {U} + ~ +!!! error TS2304: Cannot find name 'U'. */ get f1() { return /** @type {*} */(null); } @@ -55,6 +73,8 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. /** * @return {U} + ~ +!!! error TS2304: Cannot find name 'U'. */ get f2() { return /** @type {*} */(null); } @@ -111,6 +131,10 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. export class F { /** * @type {T & U} + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'U'. */ field; /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt.diff index 4389d4e7fc..2d5b2dce8d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt.diff @@ -3,6 +3,14 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++index.js(24,15): error TS2304: Cannot find name 'T'. ++index.js(24,19): error TS2304: Cannot find name 'U'. ++index.js(30,15): error TS2304: Cannot find name 'T'. ++index.js(30,19): error TS2304: Cannot find name 'U'. ++index.js(38,17): error TS2304: Cannot find name 'U'. ++index.js(48,17): error TS2304: Cannot find name 'U'. ++index.js(104,15): error TS2304: Cannot find name 'T'. ++index.js(104,19): error TS2304: Cannot find name 'U'. +index.js(138,14): error TS2339: Property 'p1' does not exist on type 'K'. +index.js(139,14): error TS2339: Property 'p2' does not exist on type 'K'. +index.js(143,21): error TS2339: Property 'p1' does not exist on type 'K'. @@ -11,7 +19,7 @@ +index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. + + -+==== index.js (6 errors) ==== ++==== index.js (14 errors) ==== + export class A {} + + export class B { @@ -36,12 +44,20 @@ + export class E { + /** + * @type {T & U} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + field; + + // @readonly is currently unsupported, it seems - included here just in case that changes + /** + * @type {T & U} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'U'. + * @readonly + */ + readonlyField; @@ -50,6 +66,8 @@ + + /** + * @return {U} ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + get f1() { return /** @type {*} */(null); } + @@ -60,6 +78,8 @@ + + /** + * @return {U} ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + get f2() { return /** @type {*} */(null); } + @@ -116,6 +136,10 @@ + export class F { + /** + * @type {T & U} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + field; + /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt new file mode 100644 index 0000000000..30d926baf6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt @@ -0,0 +1,54 @@ +index.js(34,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? + + +==== index.js (1 errors) ==== + /** @enum {string} */ + export const Target = { + START: "start", + MIDDLE: "middle", + END: "end", + /** @type {number} */ + OK_I_GUESS: 2 + } + /** @enum number */ + export const Second = { + OK: 1, + /** @type {number} */ + FINE: 2, + } + /** @enum {function(number): number} */ + export const Fs = { + ADD1: n => n + 1, + ID: n => n, + SUB1: n => n - 1 + } + + /** + * @param {Target} t + * @param {Second} s + * @param {Fs} f + */ + export function consume(t,s,f) { + /** @type {string} */ + var str = t + /** @type {number} */ + var num = s + /** @type {(n: number) => number} */ + var fun = f + /** @type {Target} */ + ~~~~~~ +!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? + var v = Target.START + v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums + } + /** @param {string} s */ + export function ff(s) { + // element access with arbitrary string is an error only with noImplicitAny + if (!Target[s]) { + return null + } + else { + return Target[s] + } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt.diff new file mode 100644 index 0000000000..450c9e1e45 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt.diff @@ -0,0 +1,59 @@ +--- old.jsDeclarationsEnumTag.errors.txt ++++ new.jsDeclarationsEnumTag.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++index.js(34,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? ++ ++ ++==== index.js (1 errors) ==== ++ /** @enum {string} */ ++ export const Target = { ++ START: "start", ++ MIDDLE: "middle", ++ END: "end", ++ /** @type {number} */ ++ OK_I_GUESS: 2 ++ } ++ /** @enum number */ ++ export const Second = { ++ OK: 1, ++ /** @type {number} */ ++ FINE: 2, ++ } ++ /** @enum {function(number): number} */ ++ export const Fs = { ++ ADD1: n => n + 1, ++ ID: n => n, ++ SUB1: n => n - 1 ++ } ++ ++ /** ++ * @param {Target} t ++ * @param {Second} s ++ * @param {Fs} f ++ */ ++ export function consume(t,s,f) { ++ /** @type {string} */ ++ var str = t ++ /** @type {number} */ ++ var num = s ++ /** @type {(n: number) => number} */ ++ var fun = f ++ /** @type {Target} */ ++ ~~~~~~ ++!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? ++ var v = Target.START ++ v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums ++ } ++ /** @param {string} s */ ++ export function ff(s) { ++ // element access with arbitrary string is an error only with noImplicitAny ++ if (!Target[s]) { ++ return null ++ } ++ else { ++ return Target[s] ++ } ++ } ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt index 6445eae929..e7ced6302d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt @@ -2,6 +2,8 @@ index.js(1,23): error TS2580: Cannot find name 'module'. Do you need to install index.js(3,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(4,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(12,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(19,13): error TS2304: Cannot find name 'T'. +index.js(19,17): error TS2304: Cannot find name 'U'. index.js(22,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(31,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(32,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -16,7 +18,7 @@ index.js(57,54): error TS2580: Cannot find name 'module'. Do you need to install index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== index.js (16 errors) ==== +==== index.js (18 errors) ==== Object.defineProperty(module.exports, "a", { value: function a() {} }); ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -44,6 +46,10 @@ index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install * @param {T} a * @param {U} b * @return {T & U} + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'U'. */ function e(a, b) { return /** @type {*} */(null); } Object.defineProperty(module.exports, "e", { value: e }); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff index 566f77664d..6d308ef2e8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff @@ -7,6 +7,8 @@ +index.js(3,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(4,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(12,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(19,13): error TS2304: Cannot find name 'T'. ++index.js(19,17): error TS2304: Cannot find name 'U'. +index.js(22,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(31,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(32,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -21,7 +23,7 @@ +index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== index.js (16 errors) ==== ++==== index.js (18 errors) ==== + Object.defineProperty(module.exports, "a", { value: function a() {} }); + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -49,6 +51,10 @@ + * @param {T} a + * @param {U} b + * @return {T & U} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + function e(a, b) { return /** @type {*} */(null); } + Object.defineProperty(module.exports, "e", { value: e }); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt index d61c510933..c7063441dd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt @@ -1,4 +1,5 @@ context.js(34,14): error TS2350: Only a void function can be called with the 'new' keyword. +context.js(42,18): error TS2304: Cannot find name 'State'. context.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. hook.js(10,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -28,7 +29,7 @@ timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install t ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== context.js (2 errors) ==== +==== context.js (3 errors) ==== /** * Imports * @@ -73,6 +74,8 @@ timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install t * @param {Input} input * @param {HookHandler=} handle * @returns {State} + ~~~~~ +!!! error TS2304: Cannot find name 'State'. */ construct(input, handle = () => void 0) { return input; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff index 908a49bb28..5c8cb56d67 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff @@ -4,6 +4,7 @@ - @@= skipped --1, +1 lines =@@ +context.js(34,14): error TS2350: Only a void function can be called with the 'new' keyword. ++context.js(42,18): error TS2304: Cannot find name 'State'. +context.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +hook.js(10,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -33,7 +34,7 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== context.js (2 errors) ==== ++==== context.js (3 errors) ==== + /** + * Imports + * @@ -78,6 +79,8 @@ + * @param {Input} input + * @param {HookHandler=} handle + * @returns {State} ++ ~~~~~ ++!!! error TS2304: Cannot find name 'State'. + */ + construct(input, handle = () => void 0) { + return input; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt new file mode 100644 index 0000000000..ffca90413b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt @@ -0,0 +1,67 @@ +index.js(20,13): error TS2304: Cannot find name 'T'. +index.js(20,17): error TS2304: Cannot find name 'U'. + + +==== index.js (2 errors) ==== + export function a() {} + + export function b() {} + b.cat = "cat"; + + export function c() {} + c.Cls = class {} + + /** + * @param {number} a + * @param {number} b + * @return {string} + */ + export function d(a, b) { return /** @type {*} */(null); } + + /** + * @template T,U + * @param {T} a + * @param {U} b + * @return {T & U} + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'U'. + */ + export function e(a, b) { return /** @type {*} */(null); } + + /** + * @template T + * @param {T} a + */ + export function f(a) { + return a; + } + f.self = f; + + /** + * @param {{x: string}} a + * @param {{y: typeof b}} b + */ + function g(a, b) { + return a.x && b.y(); + } + + export { g }; + + /** + * @param {{x: string}} a + * @param {{y: typeof b}} b + */ + function hh(a, b) { + return a.x && b.y(); + } + + export { hh as h }; + + export function i() {} + export { i as ii }; + + export { j as jj }; + export function j() {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt.diff new file mode 100644 index 0000000000..eea85ac69f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt.diff @@ -0,0 +1,72 @@ +--- old.jsDeclarationsFunctions.errors.txt ++++ new.jsDeclarationsFunctions.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++index.js(20,13): error TS2304: Cannot find name 'T'. ++index.js(20,17): error TS2304: Cannot find name 'U'. ++ ++ ++==== index.js (2 errors) ==== ++ export function a() {} ++ ++ export function b() {} ++ b.cat = "cat"; ++ ++ export function c() {} ++ c.Cls = class {} ++ ++ /** ++ * @param {number} a ++ * @param {number} b ++ * @return {string} ++ */ ++ export function d(a, b) { return /** @type {*} */(null); } ++ ++ /** ++ * @template T,U ++ * @param {T} a ++ * @param {U} b ++ * @return {T & U} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'U'. ++ */ ++ export function e(a, b) { return /** @type {*} */(null); } ++ ++ /** ++ * @template T ++ * @param {T} a ++ */ ++ export function f(a) { ++ return a; ++ } ++ f.self = f; ++ ++ /** ++ * @param {{x: string}} a ++ * @param {{y: typeof b}} b ++ */ ++ function g(a, b) { ++ return a.x && b.y(); ++ } ++ ++ export { g }; ++ ++ /** ++ * @param {{x: string}} a ++ * @param {{y: typeof b}} b ++ */ ++ function hh(a, b) { ++ return a.x && b.y(); ++ } ++ ++ export { hh as h }; ++ ++ export function i() {} ++ export { i as ii }; ++ ++ export { j as jj }; ++ export function j() {} ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt index bd77d1ff86..30396ea5ad 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt @@ -6,6 +6,8 @@ error TS2318: Cannot find global type 'String'. error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? error TS2552: Cannot find name 'Number'. Did you mean 'number'? error TS2552: Cannot find name 'Object'. Did you mean 'object'? +file.js(4,11): error TS2552: Cannot find name 'Object'. Did you mean 'object'? +file2.js(6,11): error TS2552: Cannot find name 'Object'. Did you mean 'object'? !!! error TS2318: Cannot find global type 'Array'. @@ -16,11 +18,13 @@ error TS2552: Cannot find name 'Object'. Did you mean 'object'? !!! error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? !!! error TS2552: Cannot find name 'Number'. Did you mean 'number'? !!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? -==== file.js (0 errors) ==== +==== file.js (1 errors) ==== /** * @namespace myTypes * @global * @type {Object} + ~~~~~~ +!!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? */ const myTypes = { // SOME PROPS HERE @@ -37,13 +41,15 @@ error TS2552: Cannot find name 'Object'. Did you mean 'object'? /** @typedef {myTypes.typeB|Function} myTypes.typeC */ export {myTypes}; -==== file2.js (0 errors) ==== +==== file2.js (1 errors) ==== import {myTypes} from './file.js'; /** * @namespace testFnTypes * @global * @type {Object} + ~~~~~~ +!!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? */ const testFnTypes = { // SOME PROPS HERE diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff index d201f4cac4..81694ea9fe 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff @@ -10,8 +10,11 @@ +error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? +error TS2552: Cannot find name 'Number'. Did you mean 'number'? +error TS2552: Cannot find name 'Object'. Did you mean 'object'? ++file.js(4,11): error TS2552: Cannot find name 'Object'. Did you mean 'object'? ++file2.js(6,11): error TS2552: Cannot find name 'Object'. Did you mean 'object'? +-==== file.js (0 errors) ==== +!!! error TS2318: Cannot find global type 'Array'. +!!! error TS2318: Cannot find global type 'Function'. +!!! error TS2318: Cannot find global type 'IArguments'. @@ -20,18 +23,29 @@ +!!! error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? +!!! error TS2552: Cannot find name 'Number'. Did you mean 'number'? +!!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? - ==== file.js (0 errors) ==== ++==== file.js (1 errors) ==== /** * @namespace myTypes -@@= skipped -21, +36 lines =@@ - /** @typedef {myTypes.typeB|Function} myTypes.typeC */ - + * @global + * @type {Object} ++ ~~~~~~ ++!!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? + */ + const myTypes = { + // SOME PROPS HERE +@@= skipped -23, +42 lines =@@ export {myTypes}; --==== file2.js (1 errors) ==== -+==== file2.js (0 errors) ==== + ==== file2.js (1 errors) ==== import {myTypes} from './file.js'; - ~~~~~~~ -!!! error TS18042: 'myTypes' is a type and cannot be imported in JavaScript files. Use 'import("./file.js").myTypes' in a JSDoc type annotation. /** * @namespace testFnTypes + * @global + * @type {Object} ++ ~~~~~~ ++!!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? + */ + const testFnTypes = { + // SOME PROPS HERE diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt index 058e5a6e7e..57ee4cf823 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt @@ -7,6 +7,7 @@ error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? error TS2552: Cannot find name 'Number'. Did you mean 'number'? error TS2552: Cannot find name 'Object'. Did you mean 'object'? file2.js(1,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +file2.js(6,11): error TS2552: Cannot find name 'Object'. Did you mean 'object'? file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -18,7 +19,7 @@ file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install !!! error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? !!! error TS2552: Cannot find name 'Number'. Did you mean 'number'? !!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? -==== file2.js (2 errors) ==== +==== file2.js (3 errors) ==== const {myTypes} = require('./file.js'); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -27,6 +28,8 @@ file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install * @namespace testFnTypes * @global * @type {Object} + ~~~~~~ +!!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? */ const testFnTypes = { // SOME PROPS HERE diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff index d7f17eb9af..69ec0a860b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff @@ -12,6 +12,7 @@ +error TS2552: Cannot find name 'Number'. Did you mean 'number'? +error TS2552: Cannot find name 'Object'. Did you mean 'object'? +file2.js(1,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++file2.js(6,11): error TS2552: Cannot find name 'Object'. Did you mean 'object'? +file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + @@ -23,7 +24,7 @@ +!!! error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? +!!! error TS2552: Cannot find name 'Number'. Did you mean 'number'? +!!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? -+==== file2.js (2 errors) ==== ++==== file2.js (3 errors) ==== + const {myTypes} = require('./file.js'); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -32,6 +33,8 @@ + * @namespace testFnTypes + * @global + * @type {Object} ++ ~~~~~~ ++!!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? + */ + const testFnTypes = { + // SOME PROPS HERE diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt new file mode 100644 index 0000000000..b27e1da0af --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt @@ -0,0 +1,14 @@ +file.js(2,29): error TS2694: Namespace '""mod1.js""' has no exported member 'Dotted'. + + +==== file.js (1 errors) ==== + import { dummy } from './mod1' + /** @type {import('./mod1').Dotted.Name} - should work */ + ~~~~~~ +!!! error TS2694: Namespace '""mod1.js""' has no exported member 'Dotted'. + var dot2 + +==== mod1.js (0 errors) ==== + /** @typedef {number} Dotted.Name */ + export var dummy = 1 + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt.diff new file mode 100644 index 0000000000..c7dccf174b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt.diff @@ -0,0 +1,19 @@ +--- old.jsDeclarationsImportNamespacedType.errors.txt ++++ new.jsDeclarationsImportNamespacedType.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++file.js(2,29): error TS2694: Namespace '""mod1.js""' has no exported member 'Dotted'. ++ ++ ++==== file.js (1 errors) ==== ++ import { dummy } from './mod1' ++ /** @type {import('./mod1').Dotted.Name} - should work */ ++ ~~~~~~ ++!!! error TS2694: Namespace '""mod1.js""' has no exported member 'Dotted'. ++ var dot2 ++ ++==== mod1.js (0 errors) ==== ++ /** @typedef {number} Dotted.Name */ ++ export var dummy = 1 ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt index 46cd155399..406d5be914 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt @@ -1,20 +1,26 @@ +folder/mod1.js(5,11): error TS2304: Cannot find name 'Item'. folder/mod1.js(8,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(1,27): error TS2306: File 'folder/mod1.js' is not a module. index.js(3,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== folder/mod1.js (1 errors) ==== +==== folder/mod1.js (2 errors) ==== /** * @typedef {{x: number}} Item */ /** * @type {Item}; + ~~~~ +!!! error TS2304: Cannot find name 'Item'. */ const x = {x: 12}; module.exports = x; ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== index.js (1 errors) ==== +==== index.js (2 errors) ==== /** @type {(typeof import("./folder/mod1"))[]} */ + ~~~~~~~~~~~~~~~ +!!! error TS2306: File 'folder/mod1.js' is not a module. const items = [{x: 12}]; module.exports = items; ~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff index 071cda2aad..25f9240c08 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff @@ -3,23 +3,29 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++folder/mod1.js(5,11): error TS2304: Cannot find name 'Item'. +folder/mod1.js(8,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(1,27): error TS2306: File 'folder/mod1.js' is not a module. +index.js(3,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== folder/mod1.js (1 errors) ==== ++==== folder/mod1.js (2 errors) ==== + /** + * @typedef {{x: number}} Item + */ + /** + * @type {Item}; ++ ~~~~ ++!!! error TS2304: Cannot find name 'Item'. + */ + const x = {x: 12}; + module.exports = x; + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+==== index.js (1 errors) ==== ++==== index.js (2 errors) ==== + /** @type {(typeof import("./folder/mod1"))[]} */ ++ ~~~~~~~~~~~~~~~ ++!!! error TS2306: File 'folder/mod1.js' is not a module. + const items = [{x: 12}]; + module.exports = items; + ~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt index e1cc71f4bb..945d7975b3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt @@ -8,7 +8,19 @@ error TS2318: Cannot find global type 'String'. error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? error TS2552: Cannot find name 'Number'. Did you mean 'number'? error TS2552: Cannot find name 'Object'. Did you mean 'object'? +index.js(2,12): error TS2304: Cannot find name 'String'. +index.js(3,12): error TS2304: Cannot find name 'Number'. +index.js(4,12): error TS2304: Cannot find name 'Boolean'. +index.js(5,12): error TS2304: Cannot find name 'Void'. +index.js(6,12): error TS2304: Cannot find name 'Undefined'. +index.js(7,12): error TS2304: Cannot find name 'Null'. +index.js(9,12): error TS2304: Cannot find name 'Function'. +index.js(10,12): error TS2304: Cannot find name 'function'. +index.js(11,12): error TS2304: Cannot find name 'array'. +index.js(12,12): error TS2304: Cannot find name 'promise'. index.js(12,33): error TS2583: Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later. +index.js(13,12): error TS2304: Cannot find name 'Object'. +index.js(30,12): error TS2304: Cannot find name 'event'. !!! error TS2318: Cannot find global type 'Array'. @@ -21,22 +33,44 @@ index.js(12,33): error TS2583: Cannot find name 'Promise'. Do you need to change !!! error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? !!! error TS2552: Cannot find name 'Number'. Did you mean 'number'? !!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? -==== index.js (1 errors) ==== +==== index.js (13 errors) ==== // these are recognized as TS concepts by the checker /** @type {String} */const a = ""; + ~~~~~~ +!!! error TS2304: Cannot find name 'String'. /** @type {Number} */const b = 0; + ~~~~~~ +!!! error TS2304: Cannot find name 'Number'. /** @type {Boolean} */const c = true; + ~~~~~~~ +!!! error TS2304: Cannot find name 'Boolean'. /** @type {Void} */const d = undefined; + ~~~~ +!!! error TS2304: Cannot find name 'Void'. /** @type {Undefined} */const e = undefined; + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'Undefined'. /** @type {Null} */const f = null; + ~~~~ +!!! error TS2304: Cannot find name 'Null'. /** @type {Function} */const g = () => void 0; + ~~~~~~~~ +!!! error TS2304: Cannot find name 'Function'. /** @type {function} */const h = () => void 0; + ~~~~~~~~ +!!! error TS2304: Cannot find name 'function'. /** @type {array} */const i = []; + ~~~~~ +!!! error TS2304: Cannot find name 'array'. /** @type {promise} */const j = Promise.resolve(0); + ~~~~~~~ +!!! error TS2304: Cannot find name 'promise'. ~~~~~~~ !!! error TS2583: Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later. /** @type {Object} */const k = {x: "x"}; + ~~~~~~ +!!! error TS2304: Cannot find name 'Object'. // these are not recognized as anything and should just be lookup failures @@ -53,4 +87,6 @@ index.js(12,33): error TS2583: Cannot find name 'Promise'. Do you need to change /** @type {integer} */const p = true; // or, in the case of `event` likely erroneously refers to the type of the global Event object - /** @type {event} */const q = undefined; \ No newline at end of file + /** @type {event} */const q = undefined; + ~~~~~ +!!! error TS2304: Cannot find name 'event'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt.diff index beeb3f33e3..b590dae2cb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt.diff @@ -13,7 +13,19 @@ +error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? +error TS2552: Cannot find name 'Number'. Did you mean 'number'? +error TS2552: Cannot find name 'Object'. Did you mean 'object'? ++index.js(2,12): error TS2304: Cannot find name 'String'. ++index.js(3,12): error TS2304: Cannot find name 'Number'. ++index.js(4,12): error TS2304: Cannot find name 'Boolean'. ++index.js(5,12): error TS2304: Cannot find name 'Void'. ++index.js(6,12): error TS2304: Cannot find name 'Undefined'. ++index.js(7,12): error TS2304: Cannot find name 'Null'. ++index.js(9,12): error TS2304: Cannot find name 'Function'. ++index.js(10,12): error TS2304: Cannot find name 'function'. ++index.js(11,12): error TS2304: Cannot find name 'array'. ++index.js(12,12): error TS2304: Cannot find name 'promise'. +index.js(12,33): error TS2583: Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later. ++index.js(13,12): error TS2304: Cannot find name 'Object'. ++index.js(30,12): error TS2304: Cannot find name 'event'. + + +!!! error TS2318: Cannot find global type 'Array'. @@ -26,22 +38,44 @@ +!!! error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? +!!! error TS2552: Cannot find name 'Number'. Did you mean 'number'? +!!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? -+==== index.js (1 errors) ==== ++==== index.js (13 errors) ==== + // these are recognized as TS concepts by the checker + /** @type {String} */const a = ""; ++ ~~~~~~ ++!!! error TS2304: Cannot find name 'String'. + /** @type {Number} */const b = 0; ++ ~~~~~~ ++!!! error TS2304: Cannot find name 'Number'. + /** @type {Boolean} */const c = true; ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'Boolean'. + /** @type {Void} */const d = undefined; ++ ~~~~ ++!!! error TS2304: Cannot find name 'Void'. + /** @type {Undefined} */const e = undefined; ++ ~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Undefined'. + /** @type {Null} */const f = null; ++ ~~~~ ++!!! error TS2304: Cannot find name 'Null'. + + /** @type {Function} */const g = () => void 0; ++ ~~~~~~~~ ++!!! error TS2304: Cannot find name 'Function'. + /** @type {function} */const h = () => void 0; ++ ~~~~~~~~ ++!!! error TS2304: Cannot find name 'function'. + /** @type {array} */const i = []; ++ ~~~~~ ++!!! error TS2304: Cannot find name 'array'. + /** @type {promise} */const j = Promise.resolve(0); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'promise'. + ~~~~~~~ +!!! error TS2583: Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later. + /** @type {Object} */const k = {x: "x"}; ++ ~~~~~~ ++!!! error TS2304: Cannot find name 'Object'. + + + // these are not recognized as anything and should just be lookup failures @@ -59,3 +93,5 @@ + + // or, in the case of `event` likely erroneously refers to the type of the global Event object + /** @type {event} */const q = undefined; ++ ~~~~~ ++!!! error TS2304: Cannot find name 'event'. diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols index acf811fc59..a2eca1270c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols @@ -4,38 +4,49 @@ // these are recognized as TS concepts by the checker /** @type {String} */const a = ""; >a : Symbol(a, Decl(index.js, 1, 26)) +>String : Symbol(String) /** @type {Number} */const b = 0; >b : Symbol(b, Decl(index.js, 2, 26)) +>Number : Symbol(Number) /** @type {Boolean} */const c = true; >c : Symbol(c, Decl(index.js, 3, 27)) +>Boolean : Symbol(Boolean) /** @type {Void} */const d = undefined; >d : Symbol(d, Decl(index.js, 4, 24)) +>Void : Symbol(Void) >undefined : Symbol(undefined) /** @type {Undefined} */const e = undefined; >e : Symbol(e, Decl(index.js, 5, 29)) +>Undefined : Symbol(Undefined) >undefined : Symbol(undefined) /** @type {Null} */const f = null; >f : Symbol(f, Decl(index.js, 6, 24)) +>Null : Symbol(Null) /** @type {Function} */const g = () => void 0; >g : Symbol(g, Decl(index.js, 8, 28)) +>Function : Symbol(Function) /** @type {function} */const h = () => void 0; >h : Symbol(h, Decl(index.js, 9, 28)) +>function : Symbol(function) /** @type {array} */const i = []; >i : Symbol(i, Decl(index.js, 10, 25)) +>array : Symbol(array) /** @type {promise} */const j = Promise.resolve(0); >j : Symbol(j, Decl(index.js, 11, 27)) +>promise : Symbol(promise) /** @type {Object} */const k = {x: "x"}; >k : Symbol(k, Decl(index.js, 12, 42)) +>Object : Symbol(Object) >x : Symbol(x, Decl(index.js, 12, 48)) @@ -44,25 +55,31 @@ // @ts-ignore /** @type {class} */const l = true; >l : Symbol(l, Decl(index.js, 18, 25)) +>class : Symbol(class) // @ts-ignore /** @type {bool} */const m = true; >m : Symbol(m, Decl(index.js, 20, 24)) +>bool : Symbol(bool) // @ts-ignore /** @type {int} */const n = true; >n : Symbol(n, Decl(index.js, 22, 23)) +>int : Symbol(int) // @ts-ignore /** @type {float} */const o = true; >o : Symbol(o, Decl(index.js, 24, 25)) +>float : Symbol(float) // @ts-ignore /** @type {integer} */const p = true; >p : Symbol(p, Decl(index.js, 26, 27)) +>integer : Symbol(integer) // or, in the case of `event` likely erroneously refers to the type of the global Event object /** @type {event} */const q = undefined; >q : Symbol(q, Decl(index.js, 29, 25)) +>event : Symbol(event) >undefined : Symbol(undefined) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols.diff index bade04d115..73a4c35705 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols.diff @@ -1,12 +1,87 @@ --- old.jsDeclarationsJSDocRedirectedLookups.symbols +++ new.jsDeclarationsJSDocRedirectedLookups.symbols -@@= skipped -32, +32 lines =@@ +@@= skipped -3, +3 lines =@@ + // these are recognized as TS concepts by the checker + /** @type {String} */const a = ""; + >a : Symbol(a, Decl(index.js, 1, 26)) ++>String : Symbol(String) + + /** @type {Number} */const b = 0; + >b : Symbol(b, Decl(index.js, 2, 26)) ++>Number : Symbol(Number) + + /** @type {Boolean} */const c = true; + >c : Symbol(c, Decl(index.js, 3, 27)) ++>Boolean : Symbol(Boolean) + + /** @type {Void} */const d = undefined; + >d : Symbol(d, Decl(index.js, 4, 24)) ++>Void : Symbol(Void) + >undefined : Symbol(undefined) + + /** @type {Undefined} */const e = undefined; + >e : Symbol(e, Decl(index.js, 5, 29)) ++>Undefined : Symbol(Undefined) + >undefined : Symbol(undefined) + + /** @type {Null} */const f = null; + >f : Symbol(f, Decl(index.js, 6, 24)) ++>Null : Symbol(Null) + + /** @type {Function} */const g = () => void 0; + >g : Symbol(g, Decl(index.js, 8, 28)) ++>Function : Symbol(Function) + + /** @type {function} */const h = () => void 0; + >h : Symbol(h, Decl(index.js, 9, 28)) ++>function : Symbol(function) + + /** @type {array} */const i = []; + >i : Symbol(i, Decl(index.js, 10, 25)) ++>array : Symbol(array) /** @type {promise} */const j = Promise.resolve(0); >j : Symbol(j, Decl(index.js, 11, 27)) ->Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ->resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ++>promise : Symbol(promise) /** @type {Object} */const k = {x: "x"}; >k : Symbol(k, Decl(index.js, 12, 42)) ++>Object : Symbol(Object) + >x : Symbol(x, Decl(index.js, 12, 48)) + + +@@= skipped -43, +51 lines =@@ + // @ts-ignore + /** @type {class} */const l = true; + >l : Symbol(l, Decl(index.js, 18, 25)) ++>class : Symbol(class) + + // @ts-ignore + /** @type {bool} */const m = true; + >m : Symbol(m, Decl(index.js, 20, 24)) ++>bool : Symbol(bool) + + // @ts-ignore + /** @type {int} */const n = true; + >n : Symbol(n, Decl(index.js, 22, 23)) ++>int : Symbol(int) + + // @ts-ignore + /** @type {float} */const o = true; + >o : Symbol(o, Decl(index.js, 24, 25)) ++>float : Symbol(float) + + // @ts-ignore + /** @type {integer} */const p = true; + >p : Symbol(p, Decl(index.js, 26, 27)) ++>integer : Symbol(integer) + + // or, in the case of `event` likely erroneously refers to the type of the global Event object + /** @type {event} */const q = undefined; + >q : Symbol(q, Decl(index.js, 29, 25)) ++>event : Symbol(event) + >undefined : Symbol(undefined) + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt new file mode 100644 index 0000000000..f79329d29a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt @@ -0,0 +1,26 @@ +file.js(12,14): error TS2314: Generic type 'T[]' requires 1 type argument(s). + + +==== file.js (1 errors) ==== + /** + * @param {Array=} y desc + */ + function x(y) { } + + // @ts-ignore + /** @param {function (Array)} func Invoked + */ + function y(func) { return; } + + /** + * @return {(Array.<> | null)} list of devices + ~~~~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + */ + function z() { return null ;} + + /** + * + * @return {?Promise} A promise + */ + function w() { return null; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff new file mode 100644 index 0000000000..75f8386020 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff @@ -0,0 +1,31 @@ +--- old.jsDeclarationsMissingTypeParameters.errors.txt ++++ new.jsDeclarationsMissingTypeParameters.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++file.js(12,14): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++ ++ ++==== file.js (1 errors) ==== ++ /** ++ * @param {Array=} y desc ++ */ ++ function x(y) { } ++ ++ // @ts-ignore ++ /** @param {function (Array)} func Invoked ++ */ ++ function y(func) { return; } ++ ++ /** ++ * @return {(Array.<> | null)} list of devices ++ ~~~~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). ++ */ ++ function z() { return null ;} ++ ++ /** ++ * ++ * @return {?Promise} A promise ++ */ ++ function w() { return null; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt new file mode 100644 index 0000000000..30a9f935a7 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt @@ -0,0 +1,19 @@ +index.js(9,11): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + +==== index.js (1 errors) ==== + /** + * @module A + */ + class A {} + + + /** + * Target element + * @type {module:A} + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + export let el = null; + + export default A; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff new file mode 100644 index 0000000000..0b455a33c0 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff @@ -0,0 +1,24 @@ +--- old.jsDeclarationsModuleReferenceHasEmit.errors.txt ++++ new.jsDeclarationsModuleReferenceHasEmit.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++index.js(9,11): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++ ++ ++==== index.js (1 errors) ==== ++ /** ++ * @module A ++ */ ++ class A {} ++ ++ ++ /** ++ * Target element ++ * @type {module:A} ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++ */ ++ export let el = null; ++ ++ export default A; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.errors.txt index 0c7935bdde..586eb15009 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.errors.txt @@ -6,6 +6,8 @@ error TS2318: Cannot find global type 'String'. error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? error TS2552: Cannot find name 'Number'. Did you mean 'number'? error TS2552: Cannot find name 'Object'. Did you mean 'object'? +file.js(7,19): error TS2583: Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later. +file.js(20,19): error TS2583: Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later. !!! error TS2318: Cannot find global type 'Array'. @@ -16,7 +18,7 @@ error TS2552: Cannot find name 'Object'. Did you mean 'object'? !!! error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? !!! error TS2552: Cannot find name 'Number'. Did you mean 'number'? !!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? -==== file.js (0 errors) ==== +==== file.js (2 errors) ==== class X { /** * Cancels the request, sending a cancellation to the other party @@ -24,6 +26,8 @@ error TS2552: Cannot find name 'Object'. Did you mean 'object'? * @param {string?} error.reason the error reason to send the cancellation with * @param {string?} error.code the error code to send the cancellation with * @returns {Promise.<*>} resolves when the event has been sent. + ~~~~~~~ +!!! error TS2583: Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later. */ async cancel({reason, code}) {} } @@ -37,6 +41,8 @@ error TS2552: Cannot find name 'Object'. Did you mean 'object'? * @param {string?} error.suberr.reason the error reason to send the cancellation with * @param {string?} error.suberr.code the error code to send the cancellation with * @returns {Promise.<*>} resolves when the event has been sent. + ~~~~~~~ +!!! error TS2583: Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later. */ async cancel({reason, suberr}) {} } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.errors.txt.diff index e68dc62789..5426a9dfc6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.errors.txt.diff @@ -11,6 +11,8 @@ +error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? +error TS2552: Cannot find name 'Number'. Did you mean 'number'? +error TS2552: Cannot find name 'Object'. Did you mean 'object'? ++file.js(7,19): error TS2583: Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later. ++file.js(20,19): error TS2583: Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later. + + +!!! error TS2318: Cannot find global type 'Array'. @@ -21,7 +23,7 @@ +!!! error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? +!!! error TS2552: Cannot find name 'Number'. Did you mean 'number'? +!!! error TS2552: Cannot find name 'Object'. Did you mean 'object'? -+==== file.js (0 errors) ==== ++==== file.js (2 errors) ==== + class X { + /** + * Cancels the request, sending a cancellation to the other party @@ -29,6 +31,8 @@ + * @param {string?} error.reason the error reason to send the cancellation with + * @param {string?} error.code the error code to send the cancellation with + * @returns {Promise.<*>} resolves when the event has been sent. ++ ~~~~~~~ ++!!! error TS2583: Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later. + */ + async cancel({reason, code}) {} + } @@ -42,6 +46,8 @@ + * @param {string?} error.suberr.reason the error reason to send the cancellation with + * @param {string?} error.suberr.code the error code to send the cancellation with + * @returns {Promise.<*>} resolves when the event has been sent. ++ ~~~~~~~ ++!!! error TS2583: Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later. + */ + async cancel({reason, suberr}) {} + } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt index 78de5015c3..34e3cae35a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt @@ -7,6 +7,8 @@ error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? error TS2552: Cannot find name 'Number'. Did you mean 'number'? error TS2552: Cannot find name 'Object'. Did you mean 'object'? base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +file.js(12,14): error TS2304: Cannot find name 'InstanceType'. +file.js(12,27): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? !!! error TS2318: Cannot find global type 'Array'. @@ -32,7 +34,7 @@ base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install t ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== file.js (0 errors) ==== +==== file.js (2 errors) ==== /** @typedef {import('./base')} BaseFactory */ /** * @callback BaseFactoryFactory @@ -45,6 +47,10 @@ base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install t * * @param {InstanceType} base * @returns {InstanceType} + ~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'InstanceType'. + ~~~~~~~~~~~ +!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? */ const test = (base) => { return base; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff index 34e721bae4..d6627e934d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff @@ -12,6 +12,8 @@ +error TS2552: Cannot find name 'Number'. Did you mean 'number'? +error TS2552: Cannot find name 'Object'. Did you mean 'object'? +base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++file.js(12,14): error TS2304: Cannot find name 'InstanceType'. ++file.js(12,27): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + + +!!! error TS2318: Cannot find global type 'Array'. @@ -37,7 +39,7 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== file.js (0 errors) ==== ++==== file.js (2 errors) ==== + /** @typedef {import('./base')} BaseFactory */ + /** + * @callback BaseFactoryFactory @@ -50,6 +52,10 @@ + * + * @param {InstanceType} base + * @returns {InstanceType} ++ ~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'InstanceType'. ++ ~~~~~~~~~~~ ++!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + */ + const test = (base) => { + return base; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt index 9fb2807855..7c5cad4363 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt @@ -7,6 +7,8 @@ error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? error TS2552: Cannot find name 'Number'. Did you mean 'number'? error TS2552: Cannot find name 'Object'. Did you mean 'object'? base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +file.js(6,14): error TS2304: Cannot find name 'InstanceType'. +file.js(6,27): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? !!! error TS2318: Cannot find global type 'Array'. @@ -32,13 +34,17 @@ base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install t ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== file.js (0 errors) ==== +==== file.js (2 errors) ==== /** @typedef {typeof import('./base')} BaseFactory */ /** * * @param {InstanceType} base * @returns {InstanceType} + ~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'InstanceType'. + ~~~~~~~~~~~ +!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? */ const test = (base) => { return base; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff index e17bb82ad6..1429993d0a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff @@ -12,6 +12,8 @@ +error TS2552: Cannot find name 'Number'. Did you mean 'number'? +error TS2552: Cannot find name 'Object'. Did you mean 'object'? +base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++file.js(6,14): error TS2304: Cannot find name 'InstanceType'. ++file.js(6,27): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + + +!!! error TS2318: Cannot find global type 'Array'. @@ -37,13 +39,17 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== file.js (0 errors) ==== ++==== file.js (2 errors) ==== + /** @typedef {typeof import('./base')} BaseFactory */ + + /** + * + * @param {InstanceType} base + * @returns {InstanceType} ++ ~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'InstanceType'. ++ ~~~~~~~~~~~ ++!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + */ + const test = (base) => { + return base; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt index 3dc32347aa..0925027326 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt @@ -2,6 +2,7 @@ jsDeclarationsReactComponents1.jsx(2,19): error TS2307: Cannot find module 'reac jsDeclarationsReactComponents1.jsx(3,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. jsDeclarationsReactComponents2.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. jsDeclarationsReactComponents3.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. +jsDeclarationsReactComponents3.jsx(3,73): error TS2503: Cannot find namespace 'JSX'. jsDeclarationsReactComponents4.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. jsDeclarationsReactComponents5.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. jsDeclarationsReactComponents5.jsx(2,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. @@ -55,12 +56,14 @@ jsDeclarationsReactComponents5.jsx(2,23): error TS2307: Cannot find module 'prop export default TabbedShowLayout; -==== jsDeclarationsReactComponents3.jsx (1 errors) ==== +==== jsDeclarationsReactComponents3.jsx (2 errors) ==== import React from "react"; ~~~~~~~ !!! error TS2307: Cannot find module 'react' or its corresponding type declarations. /** * @type {{defaultProps: {tabs: string}} & ((props?: {elem: string}) => JSX.Element)} + ~~~ +!!! error TS2503: Cannot find namespace 'JSX'. */ const TabbedShowLayout = () => { return ( diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt.diff index 17c105f385..ba62b06bd8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt.diff @@ -7,6 +7,7 @@ +jsDeclarationsReactComponents1.jsx(3,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. +jsDeclarationsReactComponents2.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. +jsDeclarationsReactComponents3.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. ++jsDeclarationsReactComponents3.jsx(3,73): error TS2503: Cannot find namespace 'JSX'. +jsDeclarationsReactComponents4.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. +jsDeclarationsReactComponents5.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. +jsDeclarationsReactComponents5.jsx(2,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. @@ -60,12 +61,14 @@ + + export default TabbedShowLayout; + -+==== jsDeclarationsReactComponents3.jsx (1 errors) ==== ++==== jsDeclarationsReactComponents3.jsx (2 errors) ==== + import React from "react"; + ~~~~~~~ +!!! error TS2307: Cannot find module 'react' or its corresponding type declarations. + /** + * @type {{defaultProps: {tabs: string}} & ((props?: {elem: string}) => JSX.Element)} ++ ~~~ ++!!! error TS2503: Cannot find namespace 'JSX'. + */ + const TabbedShowLayout = () => { + return ( diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols index ebe6a6891a..7c1a3b5659 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols @@ -63,9 +63,7 @@ const TabbedShowLayout = () => { }; TabbedShowLayout.defaultProps = { ->TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents2.jsx, 10, 2)) >TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents2.jsx, 4, 5)) ->defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents2.jsx, 10, 2)) tabs: "default value" >tabs : Symbol(tabs, Decl(jsDeclarationsReactComponents2.jsx, 12, 33)) @@ -96,9 +94,9 @@ const TabbedShowLayout = () => { }; TabbedShowLayout.defaultProps = { ->TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 10, 2)) +>TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) >TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents3.jsx, 4, 5)) ->defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 10, 2)) +>defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) tabs: "default value" >tabs : Symbol(tabs, Decl(jsDeclarationsReactComponents3.jsx, 12, 33)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff index 9ebf2c64cd..fd956083bf 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff @@ -74,13 +74,11 @@ ->TabbedShowLayout.defaultProps : Symbol(React.StatelessComponent.defaultProps, Decl(react16.d.ts, 410, 46)) ->TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents2.jsx, 4, 5), Decl(jsDeclarationsReactComponents2.jsx, 10, 2)) ->defaultProps : Symbol(React.StatelessComponent.defaultProps, Decl(react16.d.ts, 410, 46)) -+>TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents2.jsx, 10, 2)) +>TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents2.jsx, 4, 5)) -+>defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents2.jsx, 10, 2)) tabs: "default value" >tabs : Symbol(tabs, Decl(jsDeclarationsReactComponents2.jsx, 12, 33)) -@@= skipped -26, +23 lines =@@ +@@= skipped -26, +21 lines =@@ }; export default TabbedShowLayout; @@ -110,15 +108,12 @@ }; TabbedShowLayout.defaultProps = { -->TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) + >TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) ->TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents3.jsx, 4, 5), Decl(jsDeclarationsReactComponents3.jsx, 10, 2)) -->defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) -+>TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 10, 2)) +>TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents3.jsx, 4, 5)) -+>defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 10, 2)) + >defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) tabs: "default value" - >tabs : Symbol(tabs, Decl(jsDeclarationsReactComponents3.jsx, 12, 33)) @@= skipped -26, +23 lines =@@ }; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt new file mode 100644 index 0000000000..e15b2747c9 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt @@ -0,0 +1,38 @@ +index.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +index.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +index.js(22,12): error TS2315: Type 'Object' is not generic. + + +==== index.js (3 errors) ==== + /** @type {?} */ + export const a = null; + + /** @type {*} */ + export const b = null; + + /** @type {string?} */ + export const c = null; + + /** @type {string=} */ + export const d = null; + + /** @type {string!} */ + export const e = null; + + /** @type {function(string, number): object} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + export const f = null; + + /** @type {function(new: object, string, number)} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + export const g = null; + + /** @type {Object.} */ + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + export const h = null; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff new file mode 100644 index 0000000000..8d93f3c93b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff @@ -0,0 +1,43 @@ +--- old.jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt ++++ new.jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++index.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++index.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++index.js(22,12): error TS2315: Type 'Object' is not generic. ++ ++ ++==== index.js (3 errors) ==== ++ /** @type {?} */ ++ export const a = null; ++ ++ /** @type {*} */ ++ export const b = null; ++ ++ /** @type {string?} */ ++ export const c = null; ++ ++ /** @type {string=} */ ++ export const d = null; ++ ++ /** @type {string!} */ ++ export const e = null; ++ ++ /** @type {function(string, number): object} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ export const f = null; ++ ++ /** @type {function(new: object, string, number)} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ export const g = null; ++ ++ /** @type {Object.} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. ++ export const h = null; ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt index 45186dc6b4..153eb09137 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt @@ -1,3 +1,4 @@ +mixed.js(6,14): error TS2304: Cannot find name 'SomeType'. mixed.js(14,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -29,13 +30,15 @@ mixed.js(14,1): error TS2580: Cannot find name 'module'. Do you need to install * @returns {T} */ -==== mixed.js (1 errors) ==== +==== mixed.js (2 errors) ==== /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType */ /** * @param {number} x * @returns {SomeType} + ~~~~~~~~ +!!! error TS2304: Cannot find name 'SomeType'. */ function doTheThing(x) { return {x: ""+x}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt.diff index 4d6fadf8b9..a73ae0a0e9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt.diff @@ -3,6 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++mixed.js(6,14): error TS2304: Cannot find name 'SomeType'. +mixed.js(14,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + @@ -34,13 +35,15 @@ + * @returns {T} + */ + -+==== mixed.js (1 errors) ==== ++==== mixed.js (2 errors) ==== + /** + * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType + */ + /** + * @param {number} x + * @returns {SomeType} ++ ~~~~~~~~ ++!!! error TS2304: Cannot find name 'SomeType'. + */ + function doTheThing(x) { + return {x: ""+x}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt index a662678d78..149093ca66 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt @@ -2,9 +2,10 @@ LazySet.js(5,7): error TS2451: Cannot redeclare block-scoped variable 'LazySet'. LazySet.js(13,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(1,7): error TS2451: Cannot redeclare block-scoped variable 'LazySet'. index.js(1,17): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(3,12): error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? -==== index.js (2 errors) ==== +==== index.js (3 errors) ==== const LazySet = require("./LazySet"); ~~~~~~~ !!! error TS2451: Cannot redeclare block-scoped variable 'LazySet'. @@ -13,6 +14,8 @@ index.js(1,17): error TS2580: Cannot find name 'require'. Do you need to install !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @type {LazySet} */ + ~~~~~~~ +!!! error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? const stringSet = undefined; stringSet.addAll(stringSet); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff index abc353929c..3a0afd7ae6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff @@ -7,9 +7,10 @@ +LazySet.js(13,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(1,7): error TS2451: Cannot redeclare block-scoped variable 'LazySet'. +index.js(1,17): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(3,12): error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? + + -+==== index.js (2 errors) ==== ++==== index.js (3 errors) ==== + const LazySet = require("./LazySet"); + ~~~~~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'LazySet'. @@ -18,6 +19,8 @@ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + /** @type {LazySet} */ ++ ~~~~~~~ ++!!! error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? + const stringSet = undefined; + stringSet.addAll(stringSet); + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt new file mode 100644 index 0000000000..343381e725 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt @@ -0,0 +1,20 @@ +b.js(2,28): error TS2694: Namespace '""a.js""' has no exported member 'WithSymbol'. + + +==== a.js (0 errors) ==== + export const kSymbol = Symbol("my-symbol"); + + /** + * @typedef {{[kSymbol]: true}} WithSymbol + */ +==== b.js (1 errors) ==== + /** + * @returns {import('./a').WithSymbol} + ~~~~~~~~~~ +!!! error TS2694: Namespace '""a.js""' has no exported member 'WithSymbol'. + * @param {import('./a').WithSymbol} value + */ + export function b(value) { + return value; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff new file mode 100644 index 0000000000..030a120d9c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.jsDeclarationsUniqueSymbolUsage.errors.txt ++++ new.jsDeclarationsUniqueSymbolUsage.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++b.js(2,28): error TS2694: Namespace '""a.js""' has no exported member 'WithSymbol'. ++ ++ ++==== a.js (0 errors) ==== ++ export const kSymbol = Symbol("my-symbol"); ++ ++ /** ++ * @typedef {{[kSymbol]: true}} WithSymbol ++ */ ++==== b.js (1 errors) ==== ++ /** ++ * @returns {import('./a').WithSymbol} ++ ~~~~~~~~~~ ++!!! error TS2694: Namespace '""a.js""' has no exported member 'WithSymbol'. ++ * @param {import('./a').WithSymbol} value ++ */ ++ export function b(value) { ++ return value; ++ } ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt index bbc81a1df4..ee2829a829 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt @@ -1,20 +1,27 @@ +functions.js(3,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? functions.js(5,14): error TS7006: Parameter 'c' implicitly has an 'any' type. functions.js(9,23): error TS7006: Parameter 'n' implicitly has an 'any' type. +functions.js(13,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? functions.js(15,14): error TS7006: Parameter 'c' implicitly has an 'any' type. functions.js(21,17): error TS7006: Parameter 'n' implicitly has an 'any' type. functions.js(22,14): error TS2339: Property 'length' does not exist on type 'C'. +functions.js(30,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? functions.js(31,19): error TS7006: Parameter 'ab' implicitly has an 'any' type. functions.js(31,23): error TS7006: Parameter 'onetwo' implicitly has an 'any' type. functions.js(38,12): error TS7006: Parameter 'n' implicitly has an 'any' type. +functions.js(49,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type. functions.js(60,18): error TS7006: Parameter 'n' implicitly has an 'any' type. functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. -==== functions.js (11 errors) ==== +==== functions.js (15 errors) ==== /** * @param {function(this: string, number): number} c is just passing on through * @return {function(this: string, number): number} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function id1(c) { ~ @@ -29,6 +36,9 @@ functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[ /** * @param {function(new: { length: number }, number): number} c is just passing on through * @return {function(new: { length: number }, number): number} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function id2(c) { ~ @@ -52,6 +62,9 @@ functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[ z.length; /** @type {function ("a" | "b", 1 | 2): 3 | 4} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. var f = function (ab, onetwo) { return ab === "a" ? 3 : 4; } ~~ !!! error TS7006: Parameter 'ab' implicitly has an 'any' type. @@ -77,6 +90,8 @@ functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[ /** * @param {function(new: D, number)} dref * @return {D} + ~ +!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? */ var construct = function(dref) { return new dref(33); } ~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt.diff index 5f89e2ed65..202760ece8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt.diff @@ -3,24 +3,31 @@ @@= skipped -0, +0 lines =@@ -functions.js(65,14): error TS2345: Argument of type 'typeof E' is not assignable to parameter of type 'new (arg1: number) => { length: number; }'. - Property 'length' is missing in type 'E' but required in type '{ length: number; }'. ++functions.js(3,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(5,14): error TS7006: Parameter 'c' implicitly has an 'any' type. +functions.js(9,23): error TS7006: Parameter 'n' implicitly has an 'any' type. ++functions.js(13,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(15,14): error TS7006: Parameter 'c' implicitly has an 'any' type. +functions.js(21,17): error TS7006: Parameter 'n' implicitly has an 'any' type. +functions.js(22,14): error TS2339: Property 'length' does not exist on type 'C'. ++functions.js(30,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(31,19): error TS7006: Parameter 'ab' implicitly has an 'any' type. +functions.js(31,23): error TS7006: Parameter 'onetwo' implicitly has an 'any' type. +functions.js(38,12): error TS7006: Parameter 'n' implicitly has an 'any' type. ++functions.js(49,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? +functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type. +functions.js(60,18): error TS7006: Parameter 'n' implicitly has an 'any' type. +functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. -==== functions.js (1 errors) ==== -+==== functions.js (11 errors) ==== ++==== functions.js (15 errors) ==== /** * @param {function(this: string, number): number} c is just passing on through * @return {function(this: string, number): number} ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function id1(c) { + ~ @@ -35,6 +42,9 @@ /** * @param {function(new: { length: number }, number): number} c is just passing on through * @return {function(new: { length: number }, number): number} ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function id2(c) { + ~ @@ -53,9 +63,13 @@ } } -@@= skipped -33, +52 lines =@@ +@@= skipped -32, +61 lines =@@ + z.length; /** @type {function ("a" | "b", 1 | 2): 3 | 4} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. var f = function (ab, onetwo) { return ab === "a" ? 3 : 4; } + ~~ +!!! error TS7006: Parameter 'ab' implicitly has an 'any' type. @@ -64,7 +78,7 @@ /** -@@= skipped -7, +11 lines =@@ +@@= skipped -8, +15 lines =@@ * @param {number} n */ function D(n) { @@ -73,8 +87,12 @@ this.length = n; } -@@= skipped -13, +15 lines =@@ +@@= skipped -11, +13 lines =@@ + /** + * @param {function(new: D, number)} dref * @return {D} ++ ~ ++!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? */ var construct = function(dref) { return new dref(33); } + ~~~~ @@ -82,7 +100,7 @@ var z3 = construct(D); z3.length; -@@= skipped -9, +11 lines =@@ +@@= skipped -11, +15 lines =@@ * @param {number} n */ var E = function(n) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt new file mode 100644 index 0000000000..7b0d591cfa --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt @@ -0,0 +1,33 @@ +use.js(3,11): error TS2304: Cannot find name 'C'. +use.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + + +==== use.js (2 errors) ==== + /// + /** @typedef {import("./mod1")} C + * @type {C} */ + ~ +!!! error TS2304: Cannot find name 'C'. + var c; + c.chunk; + + const D = require("./mod1"); + /** @type {D} */ + ~ +!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + var d; + d.chunk; + +==== types.d.ts (0 errors) ==== + declare function require(name: string): any; + declare var exports: any; + declare var module: { exports: any }; +==== mod1.js (0 errors) ==== + /// + class Chunk { + constructor() { + this.chunk = 1; + } + } + module.exports = Chunk; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt.diff new file mode 100644 index 0000000000..eb5185c886 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt.diff @@ -0,0 +1,38 @@ +--- old.jsdocImportType.errors.txt ++++ new.jsdocImportType.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++use.js(3,11): error TS2304: Cannot find name 'C'. ++use.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? ++ ++ ++==== use.js (2 errors) ==== ++ /// ++ /** @typedef {import("./mod1")} C ++ * @type {C} */ ++ ~ ++!!! error TS2304: Cannot find name 'C'. ++ var c; ++ c.chunk; ++ ++ const D = require("./mod1"); ++ /** @type {D} */ ++ ~ ++!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? ++ var d; ++ d.chunk; ++ ++==== types.d.ts (0 errors) ==== ++ declare function require(name: string): any; ++ declare var exports: any; ++ declare var module: { exports: any }; ++==== mod1.js (0 errors) ==== ++ /// ++ class Chunk { ++ constructor() { ++ this.chunk = 1; ++ } ++ } ++ module.exports = Chunk; ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt new file mode 100644 index 0000000000..29447de0e6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt @@ -0,0 +1,32 @@ +use.js(3,11): error TS2304: Cannot find name 'C'. +use.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + + +==== use.js (2 errors) ==== + /// + /** @typedef {import("./mod1")} C + * @type {C} */ + ~ +!!! error TS2304: Cannot find name 'C'. + var c; + c.chunk; + + const D = require("./mod1"); + /** @type {D} */ + ~ +!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + var d; + d.chunk; + +==== types.d.ts (0 errors) ==== + declare function require(name: string): any; + declare var exports: any; + declare var module: { exports: any }; +==== mod1.js (0 errors) ==== + /// + module.exports = class Chunk { + constructor() { + this.chunk = 1; + } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt.diff new file mode 100644 index 0000000000..5fa6e7b4cf --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt.diff @@ -0,0 +1,37 @@ +--- old.jsdocImportType2.errors.txt ++++ new.jsdocImportType2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++use.js(3,11): error TS2304: Cannot find name 'C'. ++use.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? ++ ++ ++==== use.js (2 errors) ==== ++ /// ++ /** @typedef {import("./mod1")} C ++ * @type {C} */ ++ ~ ++!!! error TS2304: Cannot find name 'C'. ++ var c; ++ c.chunk; ++ ++ const D = require("./mod1"); ++ /** @type {D} */ ++ ~ ++!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? ++ var d; ++ d.chunk; ++ ++==== types.d.ts (0 errors) ==== ++ declare function require(name: string): any; ++ declare var exports: any; ++ declare var module: { exports: any }; ++==== mod1.js (0 errors) ==== ++ /// ++ module.exports = class Chunk { ++ constructor() { ++ this.chunk = 1; ++ } ++ } ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt new file mode 100644 index 0000000000..1ec8975f31 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt @@ -0,0 +1,12 @@ +a.js(1,26): error TS2694: Namespace '""b.js""' has no exported member 'FOO'. + + +==== b.js (0 errors) ==== + export const FOO = "foo"; + +==== a.js (1 errors) ==== + /** @type {import('./b').FOO} */ + ~~~ +!!! error TS2694: Namespace '""b.js""' has no exported member 'FOO'. + let x; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt.diff new file mode 100644 index 0000000000..37ab222036 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt.diff @@ -0,0 +1,17 @@ +--- old.jsdocImportTypeReferenceToStringLiteral.errors.txt ++++ new.jsdocImportTypeReferenceToStringLiteral.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++a.js(1,26): error TS2694: Namespace '""b.js""' has no exported member 'FOO'. ++ ++ ++==== b.js (0 errors) ==== ++ export const FOO = "foo"; ++ ++==== a.js (1 errors) ==== ++ /** @type {import('./b').FOO} */ ++ ~~~ ++!!! error TS2694: Namespace '""b.js""' has no exported member 'FOO'. ++ let x; ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt new file mode 100644 index 0000000000..04bc9753bc --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt @@ -0,0 +1,24 @@ +indices.js(1,12): error TS2315: Type 'Object' is not generic. +indices.js(3,12): error TS2315: Type 'Object' is not generic. +indices.js(5,12): error TS2315: Type 'Object' is not generic. + + +==== indices.js (3 errors) ==== + /** @type {Object.} */ + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + var o1; + /** @type {Object.} */ + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + var o2; + /** @type {Object.} */ + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + var o3; + /** @param {Object.} o */ + function f(o) { + o.foo = 1; // error + o.bar = false; // ok + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt.diff index 67f90c1063..ff93adcbe6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt.diff @@ -1,23 +1,31 @@ --- old.jsdocIndexSignature.errors.txt +++ new.jsdocIndexSignature.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -indices.js(9,5): error TS2322: Type 'number' is not assignable to type 'boolean'. -- -- ++indices.js(1,12): error TS2315: Type 'Object' is not generic. ++indices.js(3,12): error TS2315: Type 'Object' is not generic. ++indices.js(5,12): error TS2315: Type 'Object' is not generic. + + -==== indices.js (1 errors) ==== -- /** @type {Object.} */ -- var o1; -- /** @type {Object.} */ -- var o2; -- /** @type {Object.} */ -- var o3; -- /** @param {Object.} o */ -- function f(o) { -- o.foo = 1; // error ++==== indices.js (3 errors) ==== + /** @type {Object.} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. + var o1; + /** @type {Object.} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. + var o2; + /** @type {Object.} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. + var o3; + /** @param {Object.} o */ + function f(o) { + o.foo = 1; // error - ~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'boolean'. -- o.bar = false; // ok -- } -- -@@= skipped --1, +1 lines =@@ -+ + o.bar = false; // ok + } + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt index 9246cf7e70..c0a05d7652 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt @@ -1,8 +1,11 @@ +jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. -==== jsdocOuterTypeParameters1.js (1 errors) ==== +==== jsdocOuterTypeParameters1.js (2 errors) ==== /** @return {T} */ + ~ +!!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template {T} */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt.diff index 2c33e4dd18..a7781ae987 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +0 lines =@@ -error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. --jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. + jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. -jsdocOuterTypeParameters1.js(4,17): error TS2304: Cannot find name 'T'. -jsdocOuterTypeParameters1.js(4,19): error TS1069: Unexpected token. A type parameter name was expected without curly braces. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. @@ -12,10 +12,10 @@ -!!! error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -==== jsdocOuterTypeParameters1.js (4 errors) ==== -+==== jsdocOuterTypeParameters1.js (1 errors) ==== ++==== jsdocOuterTypeParameters1.js (2 errors) ==== /** @return {T} */ -- ~ --!!! error TS2304: Cannot find name 'T'. + ~ + !!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template {T} */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt index f48b72dc8a..f78e45da6b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt @@ -1,8 +1,11 @@ +jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. -==== jsdocOuterTypeParameters1.js (1 errors) ==== +==== jsdocOuterTypeParameters1.js (2 errors) ==== /** @return {T} */ + ~ +!!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template T */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt.diff index d1baa63090..837f743c5a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt.diff @@ -4,16 +4,17 @@ -error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -jsdocOuterTypeParameters1.js(1,14): error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. ++jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. -!!! error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. --==== jsdocOuterTypeParameters1.js (2 errors) ==== -+==== jsdocOuterTypeParameters1.js (1 errors) ==== + ==== jsdocOuterTypeParameters1.js (2 errors) ==== /** @return {T} */ -- ~ + ~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. ++!!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template T */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt index 5fc557919c..ff420a46d1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt @@ -1,9 +1,13 @@ +paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? paren.js(2,10): error TS7006: Parameter 's' implicitly has an 'any' type. paren.js(2,13): error TS7006: Parameter 'id' implicitly has an 'any' type. -==== paren.js (2 errors) ==== +==== paren.js (3 errors) ==== /** @type {function((string), function((string)): string): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. var x = (s, id) => id(s) ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt.diff index 4b661c13ec..8649a77e4f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt.diff @@ -3,12 +3,16 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +paren.js(2,10): error TS7006: Parameter 's' implicitly has an 'any' type. +paren.js(2,13): error TS7006: Parameter 'id' implicitly has an 'any' type. + + -+==== paren.js (2 errors) ==== ++==== paren.js (3 errors) ==== + /** @type {function((string), function((string)): string): string} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + var x = (s, id) => id(s) + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt index 8b239e96fe..89b948713c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt @@ -1,8 +1,12 @@ +paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? paren.js(2,9): error TS7006: Parameter 's' implicitly has an 'any' type. -==== paren.js (1 errors) ==== +==== paren.js (2 errors) ==== /** @type {function((string)): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. var x = s => s.toString() ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff index 493485caab..ee5d9700e8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff @@ -3,11 +3,15 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +paren.js(2,9): error TS7006: Parameter 's' implicitly has an 'any' type. + + -+==== paren.js (1 errors) ==== ++==== paren.js (2 errors) ==== + /** @type {function((string)): string} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + var x = s => s.toString() + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt new file mode 100644 index 0000000000..d6c7a99ac5 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt @@ -0,0 +1,11 @@ +jsdocPrivateName1.js(3,5): error TS2322: Type 'number' is not assignable to type 'boolean'. + + +==== jsdocPrivateName1.js (1 errors) ==== + class A { + /** @type {boolean} some number value */ + #foo = 3 // Error because not assignable to boolean + ~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'boolean'. + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt.diff deleted file mode 100644 index 2c8264ffb2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.jsdocPrivateName1.errors.txt -+++ new.jsdocPrivateName1.errors.txt -@@= skipped -0, +-1 lines =@@ --jsdocPrivateName1.js(3,5): error TS2322: Type 'number' is not assignable to type 'boolean'. -- -- --==== jsdocPrivateName1.js (1 errors) ==== -- class A { -- /** @type {boolean} some number value */ -- #foo = 3 // Error because not assignable to boolean -- ~~~~ --!!! error TS2322: Type 'number' is not assignable to type 'boolean'. -- } -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt index fa5f1759a3..c48ed5e68c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt @@ -1,12 +1,15 @@ +returns.js(5,5): error TS2322: Type 'number' is not assignable to type 'string'. returns.js(19,12): error TS2872: This kind of expression is always truthy. -==== returns.js (1 errors) ==== +==== returns.js (2 errors) ==== /** * @returns {string} This comment is not currently exposed */ function f() { return 5; + ~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. } /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt.diff index 3270f2608a..64decd8264 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt.diff @@ -3,15 +3,18 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++returns.js(5,5): error TS2322: Type 'number' is not assignable to type 'string'. +returns.js(19,12): error TS2872: This kind of expression is always truthy. + + -+==== returns.js (1 errors) ==== ++==== returns.js (2 errors) ==== + /** + * @returns {string} This comment is not currently exposed + */ + function f() { + return 5; ++ ~~~~~~ ++!!! error TS2322: Type 'number' is not assignable to type 'string'. + } + + /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt index 0ef255da33..4c08d9d07a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt @@ -2,13 +2,9 @@ jsdocSignatureOnReturnedFunction.js(7,13): error TS7006: Parameter 'a' implicitl jsdocSignatureOnReturnedFunction.js(7,16): error TS7006: Parameter 'b' implicitly has an 'any' type. jsdocSignatureOnReturnedFunction.js(18,22): error TS7006: Parameter 'a' implicitly has an 'any' type. jsdocSignatureOnReturnedFunction.js(18,25): error TS7006: Parameter 'b' implicitly has an 'any' type. -jsdocSignatureOnReturnedFunction.js(25,13): error TS7006: Parameter 'a' implicitly has an 'any' type. -jsdocSignatureOnReturnedFunction.js(25,16): error TS7006: Parameter 'b' implicitly has an 'any' type. -jsdocSignatureOnReturnedFunction.js(32,22): error TS7006: Parameter 'a' implicitly has an 'any' type. -jsdocSignatureOnReturnedFunction.js(32,25): error TS7006: Parameter 'b' implicitly has an 'any' type. -==== jsdocSignatureOnReturnedFunction.js (8 errors) ==== +==== jsdocSignatureOnReturnedFunction.js (4 errors) ==== function f1() { /** * @param {number} a @@ -42,10 +38,6 @@ jsdocSignatureOnReturnedFunction.js(32,25): error TS7006: Parameter 'b' implicit function f3() { /** @type {(a: number, b: number) => number} */ return (a, b) => { - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'b' implicitly has an 'any' type. return a + b; } } @@ -53,10 +45,6 @@ jsdocSignatureOnReturnedFunction.js(32,25): error TS7006: Parameter 'b' implicit function f4() { /** @type {(a: number, b: number) => number} */ return function (a, b){ - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'b' implicitly has an 'any' type. return a + b; } } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff index 2f6cc9d6fe..c02ee95b86 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff @@ -7,13 +7,9 @@ +jsdocSignatureOnReturnedFunction.js(7,16): error TS7006: Parameter 'b' implicitly has an 'any' type. +jsdocSignatureOnReturnedFunction.js(18,22): error TS7006: Parameter 'a' implicitly has an 'any' type. +jsdocSignatureOnReturnedFunction.js(18,25): error TS7006: Parameter 'b' implicitly has an 'any' type. -+jsdocSignatureOnReturnedFunction.js(25,13): error TS7006: Parameter 'a' implicitly has an 'any' type. -+jsdocSignatureOnReturnedFunction.js(25,16): error TS7006: Parameter 'b' implicitly has an 'any' type. -+jsdocSignatureOnReturnedFunction.js(32,22): error TS7006: Parameter 'a' implicitly has an 'any' type. -+jsdocSignatureOnReturnedFunction.js(32,25): error TS7006: Parameter 'b' implicitly has an 'any' type. + + -+==== jsdocSignatureOnReturnedFunction.js (8 errors) ==== ++==== jsdocSignatureOnReturnedFunction.js (4 errors) ==== + function f1() { + /** + * @param {number} a @@ -47,10 +43,6 @@ + function f3() { + /** @type {(a: number, b: number) => number} */ + return (a, b) => { -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. + return a + b; + } + } @@ -58,10 +50,6 @@ + function f4() { + /** @type {(a: number, b: number) => number} */ + return function (a, b){ -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. + return a + b; + } + } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols index 01a5bad5e6..9ed7e5c846 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols @@ -41,6 +41,9 @@ function f3() { >f3 : Symbol(f3, Decl(jsdocSignatureOnReturnedFunction.js, 20, 1)) /** @type {(a: number, b: number) => number} */ +>a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 23, 16)) +>b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 23, 26)) + return (a, b) => { >a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 24, 12)) >b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 24, 14)) @@ -55,6 +58,9 @@ function f4() { >f4 : Symbol(f4, Decl(jsdocSignatureOnReturnedFunction.js, 27, 1)) /** @type {(a: number, b: number) => number} */ +>a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 30, 16)) +>b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 30, 26)) + return function (a, b){ >a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 31, 21)) >b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 31, 23)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols.diff new file mode 100644 index 0000000000..9ecd04b0b1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols.diff @@ -0,0 +1,22 @@ +--- old.jsdocSignatureOnReturnedFunction.symbols ++++ new.jsdocSignatureOnReturnedFunction.symbols +@@= skipped -40, +40 lines =@@ + >f3 : Symbol(f3, Decl(jsdocSignatureOnReturnedFunction.js, 20, 1)) + + /** @type {(a: number, b: number) => number} */ ++>a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 23, 16)) ++>b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 23, 26)) ++ + return (a, b) => { + >a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 24, 12)) + >b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 24, 14)) +@@= skipped -14, +17 lines =@@ + >f4 : Symbol(f4, Decl(jsdocSignatureOnReturnedFunction.js, 27, 1)) + + /** @type {(a: number, b: number) => number} */ ++>a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 30, 16)) ++>b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 30, 26)) ++ + return function (a, b){ + >a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 31, 21)) + >b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 31, 23)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt index ec71f9db75..e81d98cf40 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt @@ -1,9 +1,10 @@ templateTagOnClasses.js(10,14): error TS2339: Property 'a' does not exist on type 'Foo'. +templateTagOnClasses.js(17,17): error TS2304: Cannot find name 'T'. templateTagOnClasses.js(25,3): error TS2339: Property 'a' does not exist on type 'Foo'. templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type 'Foo'. -==== templateTagOnClasses.js (3 errors) ==== +==== templateTagOnClasses.js (4 errors) ==== /** * @template T * @typedef {(t: T) => T} Id @@ -23,6 +24,8 @@ templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type * @param {Id} y * @param {Id2} alpha * @return {T} + ~ +!!! error TS2304: Cannot find name 'T'. */ foo(x, y, alpha) { return alpha(y(x)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt.diff index 1f3bad0a46..bd56e89154 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt.diff @@ -3,16 +3,17 @@ @@= skipped -0, +0 lines =@@ -templateTagOnClasses.js(25,1): error TS2322: Type 'boolean' is not assignable to type 'number'. +templateTagOnClasses.js(10,14): error TS2339: Property 'a' does not exist on type 'Foo'. ++templateTagOnClasses.js(17,17): error TS2304: Cannot find name 'T'. +templateTagOnClasses.js(25,3): error TS2339: Property 'a' does not exist on type 'Foo'. +templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type 'Foo'. -==== templateTagOnClasses.js (1 errors) ==== -+==== templateTagOnClasses.js (3 errors) ==== ++==== templateTagOnClasses.js (4 errors) ==== /** * @template T * @typedef {(t: T) => T} Id -@@= skipped -11, +13 lines =@@ +@@= skipped -11, +14 lines =@@ /** @param {T} x */ constructor (x) { this.a = x @@ -21,7 +22,16 @@ } /** * -@@= skipped -15, +17 lines =@@ +@@= skipped -7, +9 lines =@@ + * @param {Id} y + * @param {Id2} alpha + * @return {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + foo(x, y, alpha) { + return alpha(y(x)) +@@= skipped -8, +10 lines =@@ var f = new Foo(1) var g = new Foo(false) f.a = g.a diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt new file mode 100644 index 0000000000..96121d76bc --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt @@ -0,0 +1,38 @@ +templateTagWithNestedTypeLiteral.js(30,12): error TS2304: Cannot find name 'A'. + + +==== templateTagWithNestedTypeLiteral.js (1 errors) ==== + /** + * @param {T} t + * @template T + */ + function Zet(t) { + /** @type {T} */ + this.u + this.t = t + } + /** + * @param {T} v + * @param {object} o + * @param {T} o.nested + */ + Zet.prototype.add = function(v, o) { + this.u = v || o.nested + return this.u + } + var z = new Zet(1) + z.t = 2 + z.u = false + /** @type {number} */ + let answer = z.add(3, { nested: 4 }) + + // lookup in typedef should not crash the compiler, even when the type is unknown + /** + * @typedef {Object} A + * @property {T} value + */ + /** @type {A} */ + ~ +!!! error TS2304: Cannot find name 'A'. + const options = { value: null }; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff index 53983833c0..124ecba5f3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff @@ -1,46 +1,34 @@ --- old.jsdocTemplateConstructorFunction2.errors.txt +++ new.jsdocTemplateConstructorFunction2.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -templateTagWithNestedTypeLiteral.js(21,1): error TS2322: Type 'boolean' is not assignable to type 'number'. -templateTagWithNestedTypeLiteral.js(28,15): error TS2304: Cannot find name 'T'. -- -- ++templateTagWithNestedTypeLiteral.js(30,12): error TS2304: Cannot find name 'A'. + + -==== templateTagWithNestedTypeLiteral.js (2 errors) ==== -- /** -- * @param {T} t -- * @template T -- */ -- function Zet(t) { -- /** @type {T} */ -- this.u -- this.t = t -- } -- /** -- * @param {T} v -- * @param {object} o -- * @param {T} o.nested -- */ -- Zet.prototype.add = function(v, o) { -- this.u = v || o.nested -- return this.u -- } -- var z = new Zet(1) -- z.t = 2 -- z.u = false ++==== templateTagWithNestedTypeLiteral.js (1 errors) ==== + /** + * @param {T} t + * @template T +@@= skipped -23, +22 lines =@@ + var z = new Zet(1) + z.t = 2 + z.u = false - ~~~ -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. -- /** @type {number} */ -- let answer = z.add(3, { nested: 4 }) -- -- // lookup in typedef should not crash the compiler, even when the type is unknown -- /** -- * @typedef {Object} A -- * @property {T} value + /** @type {number} */ + let answer = z.add(3, { nested: 4 }) + +@@= skipped -9, +7 lines =@@ + /** + * @typedef {Object} A + * @property {T} value - ~ -!!! error TS2304: Cannot find name 'T'. -- */ -- /** @type {A} */ -- const options = { value: null }; -- -@@= skipped --1, +1 lines =@@ -+ + */ + /** @type {A} */ ++ ~ ++!!! error TS2304: Cannot find name 'A'. + const options = { value: null }; + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt index 9078b6efa4..b60487ba5b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt @@ -1,8 +1,9 @@ +forgot.js(13,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. Type 'void' is not assignable to type 'Animation'. -==== forgot.js (1 errors) ==== +==== forgot.js (2 errors) ==== /** * @param {T} a * @template T @@ -16,6 +17,9 @@ forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKey * @param {T} a * @template T * @returns {function(): T} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function g(a) { return () => a diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff index b06fd95851..daf552c939 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff @@ -2,11 +2,27 @@ +++ new.jsdocTemplateTag.errors.txt @@= skipped -0, +0 lines =@@ -forgot.js(23,1): error TS2322: Type '(keyframes: any[]) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. ++forgot.js(13,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. Type 'void' is not assignable to type 'Animation'. -@@= skipped -26, +26 lines =@@ +-==== forgot.js (1 errors) ==== ++==== forgot.js (2 errors) ==== + /** + * @param {T} a + * @template T +@@= skipped -15, +16 lines =@@ + * @param {T} a + * @template T + * @returns {function(): T} ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + */ + function g(a) { + return () => a +@@= skipped -11, +14 lines =@@ */ Element.prototype.animate = function(keyframes) {}; ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt new file mode 100644 index 0000000000..e74792dd0d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt @@ -0,0 +1,17 @@ +github17339.js(5,15): error TS2304: Cannot find name 'T'. + + +==== github17339.js (1 errors) ==== + var obj = { + /** + * @template T + * @param {T} a + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + x: function (a) { + return a; + }, + }; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt.diff new file mode 100644 index 0000000000..9255ac4171 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.jsdocTemplateTag2.errors.txt ++++ new.jsdocTemplateTag2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++github17339.js(5,15): error TS2304: Cannot find name 'T'. ++ ++ ++==== github17339.js (1 errors) ==== ++ var obj = { ++ /** ++ * @template T ++ * @param {T} a ++ * @returns {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ x: function (a) { ++ return a; ++ }, ++ }; ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt new file mode 100644 index 0000000000..ab9d0ecee6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt @@ -0,0 +1,39 @@ +a.js(11,13): error TS2304: Cannot find name 'W'. +a.js(11,17): error TS2304: Cannot find name 'X'. + + +==== a.js (2 errors) ==== + /** + * @template {{ a: number, b: string }} T,U A Comment + * @template {{ c: boolean }} V uh ... are comments even supported?? + * @template W + * @template X That last one had no comment + * @param {T} t + * @param {U} u + * @param {V} v + * @param {W} w + * @param {X} x + * @return {W | X} + ~ +!!! error TS2304: Cannot find name 'W'. + ~ +!!! error TS2304: Cannot find name 'X'. + */ + function f(t, u, v, w, x) { + if(t.a + t.b.length > u.a - u.b.length && v.c) { + return w; + } + return x; + } + + f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); + f({ a: 12 }, undefined, undefined, 101, 'nope'); + + /** + * @template {NoLongerAllowed} + * @template T preceding line's syntax is no longer allowed + * @param {T} x + */ + function g(x) { } + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt.diff index 050a812ed7..a0bc508469 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt.diff @@ -1,56 +1,55 @@ --- old.jsdocTemplateTag3.errors.txt +++ new.jsdocTemplateTag3.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -a.js(14,29): error TS2339: Property 'a' does not exist on type 'U'. -a.js(14,35): error TS2339: Property 'b' does not exist on type 'U'. -a.js(21,3): error TS2345: Argument of type '{ a: number; }' is not assignable to parameter of type '{ a: number; b: string; }'. - Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -a.js(24,15): error TS2304: Cannot find name 'NoLongerAllowed'. -a.js(25,2): error TS1069: Unexpected token. A type parameter name was expected without curly braces. -- -- ++a.js(11,13): error TS2304: Cannot find name 'W'. ++a.js(11,17): error TS2304: Cannot find name 'X'. + + -==== a.js (5 errors) ==== -- /** -- * @template {{ a: number, b: string }} T,U A Comment -- * @template {{ c: boolean }} V uh ... are comments even supported?? -- * @template W -- * @template X That last one had no comment -- * @param {T} t -- * @param {U} u -- * @param {V} v -- * @param {W} w -- * @param {X} x -- * @return {W | X} -- */ -- function f(t, u, v, w, x) { -- if(t.a + t.b.length > u.a - u.b.length && v.c) { ++==== a.js (2 errors) ==== + /** + * @template {{ a: number, b: string }} T,U A Comment + * @template {{ c: boolean }} V uh ... are comments even supported?? +@@= skipped -17, +13 lines =@@ + * @param {W} w + * @param {X} x + * @return {W | X} ++ ~ ++!!! error TS2304: Cannot find name 'W'. ++ ~ ++!!! error TS2304: Cannot find name 'X'. + */ + function f(t, u, v, w, x) { + if(t.a + t.b.length > u.a - u.b.length && v.c) { - ~ -!!! error TS2339: Property 'a' does not exist on type 'U'. - ~ -!!! error TS2339: Property 'b' does not exist on type 'U'. -- return w; -- } -- return x; -- } -- -- f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); -- f({ a: 12 }, undefined, undefined, 101, 'nope'); + return w; + } + return x; +@@= skipped -14, +14 lines =@@ + + f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); + f({ a: 12 }, undefined, undefined, 101, 'nope'); - ~~~~~~~~~~ -!!! error TS2345: Argument of type '{ a: number; }' is not assignable to parameter of type '{ a: number; b: string; }'. -!!! error TS2345: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -!!! related TS2728 a.js:2:28: 'b' is declared here. -- -- /** -- * @template {NoLongerAllowed} + + /** + * @template {NoLongerAllowed} - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'NoLongerAllowed'. -- * @template T preceding line's syntax is no longer allowed + * @template T preceding line's syntax is no longer allowed - ~ -!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. -- * @param {T} x -- */ -- function g(x) { } -- -- -@@= skipped --1, +1 lines =@@ -+ + * @param {T} x + */ + function g(x) { } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt index d8263a2b5a..a5e3e71137 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt @@ -1,16 +1,18 @@ a.js(9,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -a.js(17,5): error TS7023: 'get' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +a.js(15,18): error TS2304: Cannot find name 'V'. a.js(17,9): error TS7006: Parameter 'key' implicitly has an 'any' type. -a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => error; }'. +a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => V; }'. a.js(30,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. +a.js(36,18): error TS2304: Cannot find name 'V'. a.js(38,19): error TS7006: Parameter 'key' implicitly has an 'any' type. a.js(50,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. a.js(52,10): error TS2339: Property '_map' does not exist on type '{}'. a.js(55,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. +a.js(58,18): error TS2304: Cannot find name 'V'. a.js(60,9): error TS7006: Parameter 'key' implicitly has an 'any' type. -==== a.js (10 errors) ==== +==== a.js (12 errors) ==== /** * Should work for function declarations * @constructor @@ -28,15 +30,15 @@ a.js(60,9): error TS7006: Parameter 'key' implicitly has an 'any' type. /** * @param {K} key the key ok * @returns {V} the value ok + ~ +!!! error TS2304: Cannot find name 'V'. */ get(key) { - ~~~ -!!! error TS7023: 'get' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. ~~~ !!! error TS7006: Parameter 'key' implicitly has an 'any' type. return this._map[key + '']; ~~~~ -!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => error; }'. +!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => V; }'. } } @@ -57,6 +59,8 @@ a.js(60,9): error TS7006: Parameter 'key' implicitly has an 'any' type. /** * @param {K} key the key ok * @returns {V} the value ok + ~ +!!! error TS2304: Cannot find name 'V'. */ get: function(key) { ~~~ @@ -87,6 +91,8 @@ a.js(60,9): error TS7006: Parameter 'key' implicitly has an 'any' type. /** * @param {K} key the key ok * @returns {V} the value ok + ~ +!!! error TS2304: Cannot find name 'V'. */ get(key) { ~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff index 6d35d2b0c5..c45e597c1f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff @@ -4,18 +4,20 @@ - @@= skipped --1, +1 lines =@@ +a.js(9,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+a.js(17,5): error TS7023: 'get' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. ++a.js(15,18): error TS2304: Cannot find name 'V'. +a.js(17,9): error TS7006: Parameter 'key' implicitly has an 'any' type. -+a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => error; }'. ++a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => V; }'. +a.js(30,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. ++a.js(36,18): error TS2304: Cannot find name 'V'. +a.js(38,19): error TS7006: Parameter 'key' implicitly has an 'any' type. +a.js(50,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. +a.js(52,10): error TS2339: Property '_map' does not exist on type '{}'. +a.js(55,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. ++a.js(58,18): error TS2304: Cannot find name 'V'. +a.js(60,9): error TS7006: Parameter 'key' implicitly has an 'any' type. + + -+==== a.js (10 errors) ==== ++==== a.js (12 errors) ==== + /** + * Should work for function declarations + * @constructor @@ -33,15 +35,15 @@ + /** + * @param {K} key the key ok + * @returns {V} the value ok ++ ~ ++!!! error TS2304: Cannot find name 'V'. + */ + get(key) { -+ ~~~ -+!!! error TS7023: 'get' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. + ~~~ +!!! error TS7006: Parameter 'key' implicitly has an 'any' type. + return this._map[key + '']; + ~~~~ -+!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => error; }'. ++!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => V; }'. + } + } + @@ -62,6 +64,8 @@ + /** + * @param {K} key the key ok + * @returns {V} the value ok ++ ~ ++!!! error TS2304: Cannot find name 'V'. + */ + get: function(key) { + ~~~ @@ -92,6 +96,8 @@ + /** + * @param {K} key the key ok + * @returns {V} the value ok ++ ~ ++!!! error TS2304: Cannot find name 'V'. + */ + get(key) { + ~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt index da3c62e1ff..aa33de21b0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt @@ -1,18 +1,26 @@ +a.js(4,14): error TS2304: Cannot find name 'T'. a.js(6,13): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(16,14): error TS2304: Cannot find name 'T'. a.js(18,13): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(28,14): error TS2304: Cannot find name 'T'. a.js(30,13): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(39,14): error TS2304: Cannot find name 'T'. a.js(41,13): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(50,14): error TS2304: Cannot find name 'T'. a.js(52,13): error TS7006: Parameter 'obj' implicitly has an 'any' type. a.js(65,17): error TS7006: Parameter 'x' implicitly has an 'any' type. a.js(71,9): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(82,14): error TS2304: Cannot find name 'T'. a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. -==== a.js (8 errors) ==== +==== a.js (14 errors) ==== /** * @template const T * @param {T} x * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. */ function f1(x) { ~ @@ -27,6 +35,8 @@ a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. * @template const T, U * @param {T} x * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. */ function f2(x) { ~ @@ -41,6 +51,8 @@ a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. * @template const T * @param {T} x * @returns {T[]} + ~ +!!! error TS2304: Cannot find name 'T'. */ function f3(x) { ~ @@ -54,6 +66,8 @@ a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. * @template const T * @param {[T, T]} x * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. */ function f4(x) { ~ @@ -67,6 +81,8 @@ a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. * @template const T * @param {{ x: T, y: T}} obj * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. */ function f5(obj) { ~~~ @@ -105,6 +121,8 @@ a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. * @template {readonly unknown[]} const T * @param {T} args * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. */ function f6(...args) { ~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt.diff index fb8ce84e04..d908071c6a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt.diff @@ -3,21 +3,29 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++a.js(4,14): error TS2304: Cannot find name 'T'. +a.js(6,13): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(16,14): error TS2304: Cannot find name 'T'. +a.js(18,13): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(28,14): error TS2304: Cannot find name 'T'. +a.js(30,13): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(39,14): error TS2304: Cannot find name 'T'. +a.js(41,13): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(50,14): error TS2304: Cannot find name 'T'. +a.js(52,13): error TS7006: Parameter 'obj' implicitly has an 'any' type. +a.js(65,17): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(71,9): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(82,14): error TS2304: Cannot find name 'T'. +a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. + + -+==== a.js (8 errors) ==== ++==== a.js (14 errors) ==== + /** + * @template const T + * @param {T} x + * @returns {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function f1(x) { + ~ @@ -32,6 +40,8 @@ + * @template const T, U + * @param {T} x + * @returns {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function f2(x) { + ~ @@ -46,6 +56,8 @@ + * @template const T + * @param {T} x + * @returns {T[]} ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function f3(x) { + ~ @@ -59,6 +71,8 @@ + * @template const T + * @param {[T, T]} x + * @returns {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function f4(x) { + ~ @@ -72,6 +86,8 @@ + * @template const T + * @param {{ x: T, y: T}} obj + * @returns {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function f5(obj) { + ~~~ @@ -110,6 +126,8 @@ + * @template {readonly unknown[]} const T + * @param {T} args + * @returns {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function f6(...args) { + ~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt index f0d82db191..757a9d1ea0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt @@ -1,7 +1,8 @@ +a.js(14,14): error TS2304: Cannot find name 'T'. a.js(16,12): error TS7006: Parameter 'x' implicitly has an 'any' type. -==== a.js (1 errors) ==== +==== a.js (2 errors) ==== /** * @template const T * @typedef {[T]} X @@ -16,6 +17,8 @@ a.js(16,12): error TS7006: Parameter 'x' implicitly has an 'any' type. * @template private T * @param {T} x * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. */ function f(x) { ~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt.diff index e5d55a4558..41f184798f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt.diff @@ -3,11 +3,11 @@ @@= 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(12,14): error TS1273: 'private' modifier cannot appear on a type parameter ++a.js(14,14): error TS2304: Cannot find name 'T'. +a.js(16,12): error TS7006: Parameter 'x' implicitly has an 'any' type. --==== a.js (2 errors) ==== -+==== a.js (1 errors) ==== + ==== a.js (2 errors) ==== /** * @template const T - ~~~~~ @@ -15,7 +15,7 @@ * @typedef {[T]} X */ -@@= skipped -16, +13 lines =@@ +@@= skipped -16, +14 lines =@@ /** * @template private T @@ -23,6 +23,8 @@ -!!! error TS1273: 'private' modifier cannot appear on a type parameter * @param {T} x * @returns {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. */ function f(x) { + ~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt index 55ac7a5647..9116c9fae8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt @@ -1,20 +1,17 @@ -a.js(17,1): error TS2322: Type '{ x: string; }' is not assignable to type '{ x: number; }'. - Types of property 'x' are incompatible. - Type 'string' is not assignable to type 'number'. -a.js(18,1): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. - Types of property 'x' are incompatible. - Type 'number' is not assignable to type 'string'. +a.js(8,11): error TS2304: Cannot find name 'Covariant'. +a.js(13,11): error TS2304: Cannot find name 'Covariant'. +a.js(27,11): error TS2304: Cannot find name 'Contravariant'. a.js(29,33): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(32,11): error TS2304: Cannot find name 'Contravariant'. a.js(34,31): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(46,11): error TS2304: Cannot find name 'Invariant'. a.js(48,29): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(51,11): error TS2304: Cannot find name 'Invariant'. a.js(53,27): error TS7006: Parameter 'x' implicitly has an 'any' type. -a.js(56,1): error TS2322: Type '{ f: (x: any) => void; }' is not assignable to type '{ f: (x: any) => string; }'. - The types returned by 'f(...)' are incompatible between these types. - Type 'void' is not assignable to type 'string'. a.js(62,12): error TS7006: Parameter 'x' implicitly has an 'any' type. -==== a.js (8 errors) ==== +==== a.js (11 errors) ==== /** * @template out T * @typedef {Object} Covariant @@ -23,24 +20,20 @@ a.js(62,12): error TS7006: Parameter 'x' implicitly has an 'any' type. /** * @type {Covariant} + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'Covariant'. */ let super_covariant = { x: 1 }; /** * @type {Covariant} + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'Covariant'. */ let sub_covariant = { x: '' }; super_covariant = sub_covariant; - ~~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ x: string; }' is not assignable to type '{ x: number; }'. -!!! error TS2322: Types of property 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. sub_covariant = super_covariant; // Error - ~~~~~~~~~~~~~ -!!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. -!!! error TS2322: Types of property 'x' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. /** * @template in T @@ -50,6 +43,8 @@ a.js(62,12): error TS7006: Parameter 'x' implicitly has an 'any' type. /** * @type {Contravariant} + ~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'Contravariant'. */ let super_contravariant = { f: (x) => {} }; ~ @@ -57,6 +52,8 @@ a.js(62,12): error TS7006: Parameter 'x' implicitly has an 'any' type. /** * @type {Contravariant} + ~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'Contravariant'. */ let sub_contravariant = { f: (x) => {} }; ~ @@ -73,6 +70,8 @@ a.js(62,12): error TS7006: Parameter 'x' implicitly has an 'any' type. /** * @type {Invariant} + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'Invariant'. */ let super_invariant = { f: (x) => {} }; ~ @@ -80,6 +79,8 @@ a.js(62,12): error TS7006: Parameter 'x' implicitly has an 'any' type. /** * @type {Invariant} + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'Invariant'. */ let sub_invariant = { f: (x) => { return "" } }; ~ @@ -87,10 +88,6 @@ a.js(62,12): error TS7006: Parameter 'x' implicitly has an 'any' type. super_invariant = sub_invariant; // Error sub_invariant = super_invariant; // Error - ~~~~~~~~~~~~~ -!!! error TS2322: Type '{ f: (x: any) => void; }' is not assignable to type '{ f: (x: any) => string; }'. -!!! error TS2322: The types returned by 'f(...)' are incompatible between these types. -!!! error TS2322: Type 'void' is not assignable to type 'string'. /** * @template in T diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt.diff index 10de493639..55f994a923 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt.diff @@ -11,49 +11,57 @@ - 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'. -+a.js(17,1): error TS2322: Type '{ x: string; }' is not assignable to type '{ x: number; }'. -+ Types of property 'x' are incompatible. -+ Type 'string' is not assignable to type 'number'. -+a.js(18,1): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. -+ Types of property 'x' are incompatible. -+ Type 'number' 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(8,11): error TS2304: Cannot find name 'Covariant'. ++a.js(13,11): error TS2304: Cannot find name 'Covariant'. ++a.js(27,11): error TS2304: Cannot find name 'Contravariant'. +a.js(29,33): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(32,11): error TS2304: Cannot find name 'Contravariant'. +a.js(34,31): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(46,11): error TS2304: Cannot find name 'Invariant'. +a.js(48,29): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(51,11): error TS2304: Cannot find name 'Invariant'. +a.js(53,27): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(56,1): error TS2322: Type '{ f: (x: any) => void; }' is not assignable to type '{ f: (x: any) => 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 -+ Type 'void' is not assignable to type 'string'. +a.js(62,12): error TS7006: Parameter 'x' implicitly has an 'any' type. -==== a.js (5 errors) ==== -+==== a.js (8 errors) ==== ++==== a.js (11 errors) ==== /** * @template out T * @typedef {Object} Covariant -@@= skipped -30, +31 lines =@@ +@@= skipped -21, +19 lines =@@ + + /** + * @type {Covariant} ++ ~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Covariant'. + */ + let super_covariant = { x: 1 }; + + /** + * @type {Covariant} ++ ~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Covariant'. + */ let sub_covariant = { x: '' }; super_covariant = sub_covariant; -+ ~~~~~~~~~~~~~~~ -+!!! error TS2322: Type '{ x: string; }' is not assignable to type '{ x: number; }'. -+!!! error TS2322: Types of property 'x' are incompatible. -+!!! error TS2322: Type 'string' is not assignable to type 'number'. sub_covariant = super_covariant; // Error - ~~~~~~~~~~~~~ +- ~~~~~~~~~~~~~ -!!! error TS2322: Type 'Covariant' is not assignable to type 'Covariant'. -!!! error TS2322: Type 'unknown' is not assignable to type 'string'. -+!!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. -+!!! error TS2322: Types of property 'x' are incompatible. -+!!! error TS2322: Type 'number' is not assignable to type 'string'. /** * @template in T -@@= skipped -15, +20 lines =@@ +@@= skipped -22, +23 lines =@@ + + /** * @type {Contravariant} ++ ~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Contravariant'. */ let super_contravariant = { f: (x) => {} }; + ~ @@ -61,6 +69,8 @@ /** * @type {Contravariant} ++ ~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Contravariant'. */ let sub_contravariant = { f: (x) => {} }; + ~ @@ -73,8 +83,12 @@ sub_contravariant = super_contravariant; /** -@@= skipped -22, +23 lines =@@ +@@= skipped -22, +27 lines =@@ + + /** * @type {Invariant} ++ ~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Invariant'. */ let super_invariant = { f: (x) => {} }; + ~ @@ -82,6 +96,8 @@ /** * @type {Invariant} ++ ~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Invariant'. */ let sub_invariant = { f: (x) => { return "" } }; + ~ @@ -95,12 +111,10 @@ -!!! 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 '{ f: (x: any) => void; }' is not assignable to type '{ f: (x: any) => string; }'. - !!! error TS2322: The types returned by 'f(...)' are incompatible between these types. +-!!! 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 'void' is not assignable to type 'string'. /** * @template in T diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt new file mode 100644 index 0000000000..f2868a8933 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt @@ -0,0 +1,81 @@ +file.js(6,12): error TS2304: Cannot find name 'A'. +file.js(8,12): error TS2304: Cannot find name 'A'. +file.js(10,12): error TS2304: Cannot find name 'A'. +file.js(12,12): error TS2304: Cannot find name 'A'. + + +==== file.js (4 errors) ==== + /** + * @template {string | number} [T=string] - ok: defaults are permitted + * @typedef {[T]} A + */ + + /** @type {A} */ // ok, default for `T` in `A` is `string` + ~ +!!! error TS2304: Cannot find name 'A'. + const aDefault1 = [""]; + /** @type {A} */ // error: `number` is not assignable to string` + ~ +!!! error TS2304: Cannot find name 'A'. + const aDefault2 = [0]; + /** @type {A} */ // ok, `T` is provided for `A` + ~ +!!! error TS2304: Cannot find name 'A'. + const aString = [""]; + /** @type {A} */ // ok, `T` is provided for `A` + ~ +!!! error TS2304: Cannot find name 'A'. + const aNumber = [0]; + + /** + * @template T + * @template [U=T] - ok: default can reference earlier type parameter + * @typedef {[T, U]} B + */ + + /** + * @template {string | number} [T] - error: default requires an `=type` + * @typedef {[T]} C + */ + + /** + * @template {string | number} [T=] - error: default requires a `type` + * @typedef {[T]} D + */ + + /** + * @template {string | number} [T=string] + * @template U - error: Required type parameters cannot follow optional type parameters + * @typedef {[T, U]} E + */ + + /** + * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. + * @template [U=T] + * @typedef {[T, U]} G + */ + + /** + * @template T + * @template [U=T] - ok: default can reference earlier type parameter + * @param {T} a + * @param {U} b + */ + function f1(a, b) {} + + /** + * @template {string | number} [T=string] + * @template U - error: Required type parameters cannot follow optional type parameters + * @param {T} a + * @param {U} b + */ + function f2(a, b) {} + + /** + * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. + * @template [U=T] + * @param {T} a + * @param {U} b + */ + function f3(a, b) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt.diff index eec04653f1..e6a30db455 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt.diff @@ -1,6 +1,6 @@ --- old.jsdocTemplateTagDefault.errors.txt +++ new.jsdocTemplateTagDefault.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -file.js(9,20): error TS2322: Type 'number' is not assignable to type 'string'. -file.js(22,34): error TS1005: '=' expected. -file.js(27,35): error TS1110: Type expected. @@ -8,88 +8,85 @@ -file.js(38,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. -file.js(53,14): error TS2706: Required type parameters may not follow optional type parameters. -file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. -- -- ++file.js(6,12): error TS2304: Cannot find name 'A'. ++file.js(8,12): error TS2304: Cannot find name 'A'. ++file.js(10,12): error TS2304: Cannot find name 'A'. ++file.js(12,12): error TS2304: Cannot find name 'A'. + + -==== file.js (7 errors) ==== -- /** -- * @template {string | number} [T=string] - ok: defaults are permitted -- * @typedef {[T]} A -- */ -- -- /** @type {A} */ // ok, default for `T` in `A` is `string` -- const aDefault1 = [""]; -- /** @type {A} */ // error: `number` is not assignable to string` -- const aDefault2 = [0]; ++==== file.js (4 errors) ==== + /** + * @template {string | number} [T=string] - ok: defaults are permitted + * @typedef {[T]} A + */ + + /** @type {A} */ // ok, default for `T` in `A` is `string` ++ ~ ++!!! error TS2304: Cannot find name 'A'. + const aDefault1 = [""]; + /** @type {A} */ // error: `number` is not assignable to string` ++ ~ ++!!! error TS2304: Cannot find name 'A'. + const aDefault2 = [0]; - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- /** @type {A} */ // ok, `T` is provided for `A` -- const aString = [""]; -- /** @type {A} */ // ok, `T` is provided for `A` -- const aNumber = [0]; -- -- /** -- * @template T -- * @template [U=T] - ok: default can reference earlier type parameter -- * @typedef {[T, U]} B -- */ -- -- /** -- * @template {string | number} [T] - error: default requires an `=type` + /** @type {A} */ // ok, `T` is provided for `A` ++ ~ ++!!! error TS2304: Cannot find name 'A'. + const aString = [""]; + /** @type {A} */ // ok, `T` is provided for `A` ++ ~ ++!!! error TS2304: Cannot find name 'A'. + const aNumber = [0]; + + /** +@@= skipped -31, +34 lines =@@ + + /** + * @template {string | number} [T] - error: default requires an `=type` - ~ -!!! error TS1005: '=' expected. -- * @typedef {[T]} C -- */ -- -- /** -- * @template {string | number} [T=] - error: default requires a `type` + * @typedef {[T]} C + */ + + /** + * @template {string | number} [T=] - error: default requires a `type` - ~ -!!! error TS1110: Type expected. -- * @typedef {[T]} D -- */ -- -- /** -- * @template {string | number} [T=string] -- * @template U - error: Required type parameters cannot follow optional type parameters + * @typedef {[T]} D + */ + + /** + * @template {string | number} [T=string] + * @template U - error: Required type parameters cannot follow optional type parameters - ~ -!!! error TS2706: Required type parameters may not follow optional type parameters. -- * @typedef {[T, U]} E -- */ -- -- /** -- * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. + * @typedef {[T, U]} E + */ + + /** + * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. - ~ -!!! error TS2744: Type parameter defaults can only reference previously declared type parameters. -- * @template [U=T] -- * @typedef {[T, U]} G -- */ -- -- /** -- * @template T -- * @template [U=T] - ok: default can reference earlier type parameter -- * @param {T} a -- * @param {U} b -- */ -- function f1(a, b) {} -- -- /** -- * @template {string | number} [T=string] -- * @template U - error: Required type parameters cannot follow optional type parameters + * @template [U=T] + * @typedef {[T, U]} G + */ +@@= skipped -39, +31 lines =@@ + /** + * @template {string | number} [T=string] + * @template U - error: Required type parameters cannot follow optional type parameters - ~ -!!! error TS2706: Required type parameters may not follow optional type parameters. -- * @param {T} a -- * @param {U} b -- */ -- function f2(a, b) {} -- -- /** -- * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. + * @param {T} a + * @param {U} b + */ +@@= skipped -9, +7 lines =@@ + + /** + * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. - ~ -!!! error TS2744: Type parameter defaults can only reference previously declared type parameters. -- * @template [U=T] -- * @param {T} a -- * @param {U} b -- */ -- function f3(a, b) {} -- -@@= skipped --1, +1 lines =@@ -+ + * @template [U=T] + * @param {T} a + * @param {U} b diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt new file mode 100644 index 0000000000..39fe8a2b7a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt @@ -0,0 +1,16 @@ +file.js(9,12): error TS2304: Cannot find name 'Foo'. + + +==== file.js (1 errors) ==== + /** + * @template T + * @template {keyof T} K + * @typedef {T[K]} Foo + */ + + const x = { a: 1 }; + + /** @type {Foo} */ + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + const y = "a"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt.diff index 5d4aec8581..45d19e2253 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt.diff @@ -1,21 +1,17 @@ --- old.jsdocTemplateTagNameResolution.errors.txt +++ new.jsdocTemplateTagNameResolution.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -file.js(10,7): error TS2322: Type 'string' is not assignable to type 'number'. -- -- --==== file.js (1 errors) ==== -- /** -- * @template T -- * @template {keyof T} K -- * @typedef {T[K]} Foo -- */ -- -- const x = { a: 1 }; -- -- /** @type {Foo} */ -- const y = "a"; ++file.js(9,12): error TS2304: Cannot find name 'Foo'. + + + ==== file.js (1 errors) ==== +@@= skipped -10, +10 lines =@@ + const x = { a: 1 }; + + /** @type {Foo} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. + const y = "a"; - ~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt new file mode 100644 index 0000000000..94ee1d5f47 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt @@ -0,0 +1,50 @@ +/a.js(3,10): error TS2339: Property 'test' does not exist on type 'Foo'. +/a.js(13,10): error TS2339: Property 'test' does not exist on type 'Foo'. +/a.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + +==== /types.d.ts (0 errors) ==== + export interface Foo { + foo: () => void; + } + + export type M = (this: Foo) => void; + +==== /a.js (3 errors) ==== + /** @type {import('./types').M} */ + export const f1 = function() { + this.test(); + ~~~~ +!!! error TS2339: Property 'test' does not exist on type 'Foo'. + } + + /** @type {import('./types').M} */ + export function f2() { + this.test(); + } + + /** @type {(this: import('./types').Foo) => void} */ + export const f3 = function() { + this.test(); + ~~~~ +!!! error TS2339: Property 'test' does not exist on type 'Foo'. + } + + /** @type {(this: import('./types').Foo) => void} */ + export function f4() { + this.test(); + } + + /** @type {function(this: import('./types').Foo): void} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + export const f5 = function() { + this.test(); + } + + /** @type {function(this: import('./types').Foo): void} */ + export function f6() { + this.test(); + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt.diff index 953254940d..2531a30be7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt.diff @@ -1,63 +1,56 @@ --- old.jsdocThisType.errors.txt +++ new.jsdocThisType.errors.txt -@@= skipped -0, +-1 lines =@@ --/a.js(3,10): error TS2339: Property 'test' does not exist on type 'Foo'. +@@= skipped -0, +0 lines =@@ + /a.js(3,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(8,10): error TS2339: Property 'test' does not exist on type 'Foo'. --/a.js(13,10): error TS2339: Property 'test' does not exist on type 'Foo'. + /a.js(13,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(18,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(23,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(28,10): error TS2339: Property 'test' does not exist on type 'Foo'. -- -- --==== /types.d.ts (0 errors) ==== -- export interface Foo { -- foo: () => void; -- } -- -- export type M = (this: Foo) => void; -- ++/a.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + + ==== /types.d.ts (0 errors) ==== +@@= skipped -12, +9 lines =@@ + + export type M = (this: Foo) => void; + -==== /a.js (6 errors) ==== -- /** @type {import('./types').M} */ -- export const f1 = function() { -- this.test(); ++==== /a.js (3 errors) ==== + /** @type {import('./types').M} */ + export const f1 = function() { + this.test(); +@@= skipped -11, +11 lines =@@ + /** @type {import('./types').M} */ + export function f2() { + this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. -- } -- -- /** @type {import('./types').M} */ -- export function f2() { -- this.test(); + } + + /** @type {(this: import('./types').Foo) => void} */ +@@= skipped -14, +12 lines =@@ + /** @type {(this: import('./types').Foo) => void} */ + export function f4() { + this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. -- } -- -- /** @type {(this: import('./types').Foo) => void} */ -- export const f3 = function() { -- this.test(); + } + + /** @type {function(this: import('./types').Foo): void} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + export const f5 = function() { + this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. -- } -- -- /** @type {(this: import('./types').Foo) => void} */ -- export function f4() { -- this.test(); + } + + /** @type {function(this: import('./types').Foo): void} */ + export function f6() { + this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. -- } -- -- /** @type {function(this: import('./types').Foo): void} */ -- export const f5 = function() { -- this.test(); -- ~~~~ --!!! error TS2339: Property 'test' does not exist on type 'Foo'. -- } -- -- /** @type {function(this: import('./types').Foo): void} */ -- export function f6() { -- this.test(); -- ~~~~ --!!! error TS2339: Property 'test' does not exist on type 'Foo'. -- } -- -@@= skipped --1, +1 lines =@@ -+ + } + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols b/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols index 308da31e12..f9fd5bc328 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols @@ -19,6 +19,7 @@ export const f1 = function() { >f1 : Symbol(f1, Decl(a.js, 1, 12)) this.test(); +>this : Symbol(this, Decl(types.d.ts, 4, 17)) } /** @type {import('./types').M} */ @@ -33,6 +34,7 @@ export const f3 = function() { >f3 : Symbol(f3, Decl(a.js, 11, 12)) this.test(); +>this : Symbol(this, Decl(a.js, 10, 12)) } /** @type {(this: import('./types').Foo) => void} */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols.diff index c988aae3fa..9b62092c66 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols.diff @@ -9,15 +9,7 @@ } export type M = (this: Foo) => void; -@@= skipped -14, +14 lines =@@ - >f1 : Symbol(f1, Decl(a.js, 1, 12)) - - this.test(); -->this : Symbol(this, Decl(types.d.ts, 4, 17)) - } - - /** @type {import('./types').M} */ -@@= skipped -8, +7 lines =@@ +@@= skipped -22, +22 lines =@@ >f2 : Symbol(f2, Decl(a.js, 3, 1)) this.test(); @@ -25,15 +17,7 @@ } /** @type {(this: import('./types').Foo) => void} */ -@@= skipped -8, +7 lines =@@ - >f3 : Symbol(f3, Decl(a.js, 11, 12)) - - this.test(); -->this : Symbol(this, Decl(a.js, 10, 12)) - } - - /** @type {(this: import('./types').Foo) => void} */ -@@= skipped -8, +7 lines =@@ +@@= skipped -16, +15 lines =@@ >f4 : Symbol(f4, Decl(a.js, 13, 1)) this.test(); diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt new file mode 100644 index 0000000000..be8a7c7817 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt @@ -0,0 +1,17 @@ +index.js(1,12): error TS2304: Cannot find name 'AnyEffect'. +index.js(3,12): error TS2304: Cannot find name 'Third'. + + +==== dtsEquivalent.js (0 errors) ==== + /** @typedef {{[k: string]: any}} AnyEffect */ + /** @typedef {number} Third */ +==== index.js (2 errors) ==== + /** @type {AnyEffect} */ + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'AnyEffect'. + let b; + /** @type {Third} */ + ~~~~~ +!!! error TS2304: Cannot find name 'Third'. + let c; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt.diff new file mode 100644 index 0000000000..e03e9d76e5 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.jsdocTypeDefAtStartOfFile.errors.txt ++++ new.jsdocTypeDefAtStartOfFile.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++index.js(1,12): error TS2304: Cannot find name 'AnyEffect'. ++index.js(3,12): error TS2304: Cannot find name 'Third'. ++ ++ ++==== dtsEquivalent.js (0 errors) ==== ++ /** @typedef {{[k: string]: any}} AnyEffect */ ++ /** @typedef {number} Third */ ++==== index.js (2 errors) ==== ++ /** @type {AnyEffect} */ ++ ~~~~~~~~~ ++!!! error TS2304: Cannot find name 'AnyEffect'. ++ let b; ++ /** @type {Third} */ ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Third'. ++ let c; ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt index 4bd269ce21..4b1d9f2cb3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt @@ -1,12 +1,15 @@ bug27342.js(1,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +bug27342.js(3,11): error TS2304: Cannot find name 'exports'. -==== bug27342.js (1 errors) ==== +==== bug27342.js (2 errors) ==== module.exports = {} ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** * @type {exports} + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. */ var x diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt.diff index b63d4bf21d..262c292351 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt.diff @@ -4,14 +4,17 @@ - @@= skipped --1, +1 lines =@@ +bug27342.js(1,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++bug27342.js(3,11): error TS2304: Cannot find name 'exports'. + + -+==== bug27342.js (1 errors) ==== ++==== bug27342.js (2 errors) ==== + module.exports = {} + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** + * @type {exports} ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + */ + var x + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt index e7cbf8fc04..a7f7b62b4e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt @@ -1,8 +1,10 @@ jsdocTypeReferenceToImport.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. jsdocTypeReferenceToImport.js(2,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +jsdocTypeReferenceToImport.js(3,12): error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? +jsdocTypeReferenceToImport.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? -==== jsdocTypeReferenceToImport.js (2 errors) ==== +==== jsdocTypeReferenceToImport.js (4 errors) ==== const C = require('./ex').C; ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -10,11 +12,15 @@ jsdocTypeReferenceToImport.js(2,11): error TS2580: Cannot find name 'require'. D ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @type {C} c */ + ~ +!!! error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? var c = new C() c.start c.end /** @type {D} c */ + ~ +!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? var d = new D() d.start d.end diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt.diff index 63e4a4f2bd..6e5a04bd5a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt.diff @@ -5,9 +5,11 @@ @@= skipped --1, +1 lines =@@ +jsdocTypeReferenceToImport.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +jsdocTypeReferenceToImport.js(2,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++jsdocTypeReferenceToImport.js(3,12): error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? ++jsdocTypeReferenceToImport.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + + -+==== jsdocTypeReferenceToImport.js (2 errors) ==== ++==== jsdocTypeReferenceToImport.js (4 errors) ==== + const C = require('./ex').C; + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -15,11 +17,15 @@ + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @type {C} c */ ++ ~ ++!!! error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? + var c = new C() + c.start + c.end + + /** @type {D} c */ ++ ~ ++!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + var d = new D() + d.start + d.end diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt index 87c84ddade..a820680442 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt @@ -1,10 +1,13 @@ +jsdocTypeReferenceToMergedClass.js(2,12): error TS2503: Cannot find namespace 'Workspace'. jsdocTypeReferenceToMergedClass.js(6,11): error TS2339: Property 'Project' does not exist on type '{}'. jsdocTypeReferenceToMergedClass.js(7,11): error TS2339: Property 'Project' does not exist on type '{}'. -==== jsdocTypeReferenceToMergedClass.js (2 errors) ==== +==== jsdocTypeReferenceToMergedClass.js (3 errors) ==== var Workspace = {} /** @type {Workspace.Project} */ + ~~~~~~~~~ +!!! error TS2503: Cannot find namespace 'Workspace'. var p; p.isServiceProject() diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt.diff index 1f84bbb30a..4f06122ae6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt.diff @@ -3,13 +3,16 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++jsdocTypeReferenceToMergedClass.js(2,12): error TS2503: Cannot find namespace 'Workspace'. +jsdocTypeReferenceToMergedClass.js(6,11): error TS2339: Property 'Project' does not exist on type '{}'. +jsdocTypeReferenceToMergedClass.js(7,11): error TS2339: Property 'Project' does not exist on type '{}'. + + -+==== jsdocTypeReferenceToMergedClass.js (2 errors) ==== ++==== jsdocTypeReferenceToMergedClass.js (3 errors) ==== + var Workspace = {} + /** @type {Workspace.Project} */ ++ ~~~~~~~~~ ++!!! error TS2503: Cannot find namespace 'Workspace'. + var p; + p.isServiceProject() + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt index a69a4e86f4..8ef37b875d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt @@ -1,26 +1,17 @@ -b.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'any', but here has type 'string'. -b.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 's' must be of type 'any', but here has type 'string'. -b.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'any', but here has type 'number'. -b.ts(4,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'any', but here has type 'number'. -b.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'any', but here has type 'boolean'. -b.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'any', but here has type 'boolean'. -b.ts(7,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'V' must be of type 'any', but here has type 'void'. -b.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type 'any', but here has type 'void'. -b.ts(9,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'U' must be of type 'any', but here has type 'undefined'. -b.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'u' must be of type 'any', but here has type 'undefined'. -b.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Nl' must be of type 'any', but here has type 'null'. -b.ts(12,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'nl' must be of type 'any', but here has type 'null'. -b.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'A' must be of type 'any', but here has type 'any[]'. -b.ts(14,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'any[]'. -b.ts(15,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'P' must be of type 'any', but here has type 'Promise'. -b.ts(16,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'any', but here has type 'Promise'. -b.ts(17,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'nullable' must be of type 'any', but here has type 'number | null'. -b.ts(20,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Func' must be of type 'any', but here has type 'Function'. -b.ts(21,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type 'any', but here has type '(s: string) => number'. -b.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'ctor' must be of type 'any', but here has type 'new(s: string) => { s: string; }'. +a.js(19,12): error TS2304: Cannot find name 'Void'. +a.js(25,12): error TS2304: Cannot find name 'Undefined'. +a.js(31,12): error TS2304: Cannot find name 'Null'. +a.js(37,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +a.js(40,12): error TS2552: Cannot find name 'array'. Did you mean 'Array'? +a.js(43,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +a.js(46,12): error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? +b.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. +b.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. +b.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. +b.ts(18,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. -==== a.js (0 errors) ==== +==== a.js (7 errors) ==== /** @type {String} */ var S; @@ -40,33 +31,48 @@ b.ts(22,5): error TS2403: Subsequent variable declarations must have the same ty var b; /** @type {Void} */ + ~~~~ +!!! error TS2304: Cannot find name 'Void'. var V; /** @type {void} */ var v; /** @type {Undefined} */ + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'Undefined'. var U; /** @type {undefined} */ var u; /** @type {Null} */ + ~~~~ +!!! error TS2304: Cannot find name 'Null'. var Nl; /** @type {null} */ var nl; /** @type {Array} */ + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). var A; /** @type {array} */ + ~~~~~ +!!! error TS2552: Cannot find name 'array'. Did you mean 'Array'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Array' is declared here. var a; /** @type {Promise} */ + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). var P; /** @type {promise} */ + ~~~~~~~ +!!! error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? var p; /** @type {?number} */ @@ -87,87 +93,39 @@ b.ts(22,5): error TS2403: Subsequent variable declarations must have the same ty /** @type {new (s: string) => { s: string }} */ var ctor; -==== b.ts (20 errors) ==== +==== b.ts (4 errors) ==== var S: string; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'any', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. !!! related TS6203 a.js:2:5: 'S' was also declared here. var s: string; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 's' must be of type 'any', but here has type 'string'. -!!! related TS6203 a.js:5:5: 's' was also declared here. var N: number; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. !!! related TS6203 a.js:8:5: 'N' was also declared here. var n: number - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'any', but here has type 'number'. -!!! related TS6203 a.js:11:5: 'n' was also declared here. var B: boolean; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'any', but here has type 'boolean'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. !!! related TS6203 a.js:14:5: 'B' was also declared here. var b: boolean; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'any', but here has type 'boolean'. -!!! related TS6203 a.js:17:5: 'b' was also declared here. var V :void; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'V' must be of type 'any', but here has type 'void'. -!!! related TS6203 a.js:20:5: 'V' was also declared here. var v: void; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type 'any', but here has type 'void'. -!!! related TS6203 a.js:23:5: 'v' was also declared here. var U: undefined; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'U' must be of type 'any', but here has type 'undefined'. -!!! related TS6203 a.js:26:5: 'U' was also declared here. var u: undefined; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'u' must be of type 'any', but here has type 'undefined'. -!!! related TS6203 a.js:29:5: 'u' was also declared here. var Nl: null; - ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Nl' must be of type 'any', but here has type 'null'. -!!! related TS6203 a.js:32:5: 'Nl' was also declared here. var nl: null; - ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'nl' must be of type 'any', but here has type 'null'. -!!! related TS6203 a.js:35:5: 'nl' was also declared here. var A: any[]; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'A' must be of type 'any', but here has type 'any[]'. -!!! related TS6203 a.js:38:5: 'A' was also declared here. var a: any[]; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'any[]'. -!!! related TS6203 a.js:41:5: 'a' was also declared here. var P: Promise; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'P' must be of type 'any', but here has type 'Promise'. -!!! related TS6203 a.js:44:5: 'P' was also declared here. var p: Promise; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'any', but here has type 'Promise'. -!!! related TS6203 a.js:47:5: 'p' was also declared here. var nullable: number | null; - ~~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'nullable' must be of type 'any', but here has type 'number | null'. -!!! related TS6203 a.js:50:5: 'nullable' was also declared here. var Obj: any; + ~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. +!!! related TS6203 a.js:53:5: 'Obj' was also declared here. var obj: any; var Func: Function; - ~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Func' must be of type 'any', but here has type 'Function'. -!!! related TS6203 a.js:59:5: 'Func' was also declared here. var f: (s: string) => number; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type 'any', but here has type '(s: string) => number'. -!!! related TS6203 a.js:62:5: 'f' was also declared here. var ctor: new (s: string) => { s: string }; - ~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'ctor' must be of type 'any', but here has type 'new(s: string) => { s: string; }'. -!!! related TS6203 a.js:65:5: 'ctor' was also declared here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt.diff index 2dde3d1e1e..0a8f07906a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt.diff @@ -3,29 +3,20 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+b.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'any', but here has type 'string'. -+b.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 's' must be of type 'any', but here has type 'string'. -+b.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'any', but here has type 'number'. -+b.ts(4,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'any', but here has type 'number'. -+b.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'any', but here has type 'boolean'. -+b.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'any', but here has type 'boolean'. -+b.ts(7,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'V' must be of type 'any', but here has type 'void'. -+b.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type 'any', but here has type 'void'. -+b.ts(9,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'U' must be of type 'any', but here has type 'undefined'. -+b.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'u' must be of type 'any', but here has type 'undefined'. -+b.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Nl' must be of type 'any', but here has type 'null'. -+b.ts(12,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'nl' must be of type 'any', but here has type 'null'. -+b.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'A' must be of type 'any', but here has type 'any[]'. -+b.ts(14,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'any[]'. -+b.ts(15,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'P' must be of type 'any', but here has type 'Promise'. -+b.ts(16,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'any', but here has type 'Promise'. -+b.ts(17,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'nullable' must be of type 'any', but here has type 'number | null'. -+b.ts(20,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Func' must be of type 'any', but here has type 'Function'. -+b.ts(21,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type 'any', but here has type '(s: string) => number'. -+b.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'ctor' must be of type 'any', but here has type 'new(s: string) => { s: string; }'. ++a.js(19,12): error TS2304: Cannot find name 'Void'. ++a.js(25,12): error TS2304: Cannot find name 'Undefined'. ++a.js(31,12): error TS2304: Cannot find name 'Null'. ++a.js(37,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++a.js(40,12): error TS2552: Cannot find name 'array'. Did you mean 'Array'? ++a.js(43,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). ++a.js(46,12): error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? ++b.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. ++b.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. ++b.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. ++b.ts(18,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. + + -+==== a.js (0 errors) ==== ++==== a.js (7 errors) ==== + /** @type {String} */ + var S; + @@ -45,33 +36,48 @@ + var b; + + /** @type {Void} */ ++ ~~~~ ++!!! error TS2304: Cannot find name 'Void'. + var V; + + /** @type {void} */ + var v; + + /** @type {Undefined} */ ++ ~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Undefined'. + var U; + + /** @type {undefined} */ + var u; + + /** @type {Null} */ ++ ~~~~ ++!!! error TS2304: Cannot find name 'Null'. + var Nl; + + /** @type {null} */ + var nl; + + /** @type {Array} */ ++ ~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + var A; + + /** @type {array} */ ++ ~~~~~ ++!!! error TS2552: Cannot find name 'array'. Did you mean 'Array'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Array' is declared here. + var a; + + /** @type {Promise} */ ++ ~~~~~~~ ++!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + var P; + + /** @type {promise} */ ++ ~~~~~~~ ++!!! error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? + var p; + + /** @type {?number} */ @@ -92,87 +98,39 @@ + /** @type {new (s: string) => { s: string }} */ + var ctor; + -+==== b.ts (20 errors) ==== ++==== b.ts (4 errors) ==== + var S: string; + ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'any', but here has type 'string'. ++!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. +!!! related TS6203 a.js:2:5: 'S' was also declared here. + var s: string; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 's' must be of type 'any', but here has type 'string'. -+!!! related TS6203 a.js:5:5: 's' was also declared here. + var N: number; + ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'any', but here has type 'number'. ++!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. +!!! related TS6203 a.js:8:5: 'N' was also declared here. + var n: number -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'any', but here has type 'number'. -+!!! related TS6203 a.js:11:5: 'n' was also declared here. + var B: boolean; + ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'any', but here has type 'boolean'. ++!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. +!!! related TS6203 a.js:14:5: 'B' was also declared here. + var b: boolean; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'any', but here has type 'boolean'. -+!!! related TS6203 a.js:17:5: 'b' was also declared here. + var V :void; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'V' must be of type 'any', but here has type 'void'. -+!!! related TS6203 a.js:20:5: 'V' was also declared here. + var v: void; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type 'any', but here has type 'void'. -+!!! related TS6203 a.js:23:5: 'v' was also declared here. + var U: undefined; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'U' must be of type 'any', but here has type 'undefined'. -+!!! related TS6203 a.js:26:5: 'U' was also declared here. + var u: undefined; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'u' must be of type 'any', but here has type 'undefined'. -+!!! related TS6203 a.js:29:5: 'u' was also declared here. + var Nl: null; -+ ~~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Nl' must be of type 'any', but here has type 'null'. -+!!! related TS6203 a.js:32:5: 'Nl' was also declared here. + var nl: null; -+ ~~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'nl' must be of type 'any', but here has type 'null'. -+!!! related TS6203 a.js:35:5: 'nl' was also declared here. + var A: any[]; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'A' must be of type 'any', but here has type 'any[]'. -+!!! related TS6203 a.js:38:5: 'A' was also declared here. + var a: any[]; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'any[]'. -+!!! related TS6203 a.js:41:5: 'a' was also declared here. + var P: Promise; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'P' must be of type 'any', but here has type 'Promise'. -+!!! related TS6203 a.js:44:5: 'P' was also declared here. + var p: Promise; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'any', but here has type 'Promise'. -+!!! related TS6203 a.js:47:5: 'p' was also declared here. + var nullable: number | null; -+ ~~~~~~~~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'nullable' must be of type 'any', but here has type 'number | null'. -+!!! related TS6203 a.js:50:5: 'nullable' was also declared here. + var Obj: any; ++ ~~~ ++!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. ++!!! related TS6203 a.js:53:5: 'Obj' was also declared here. + var obj: any; + var Func: Function; -+ ~~~~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Func' must be of type 'any', but here has type 'Function'. -+!!! related TS6203 a.js:59:5: 'Func' was also declared here. + var f: (s: string) => number; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type 'any', but here has type '(s: string) => number'. -+!!! related TS6203 a.js:62:5: 'f' was also declared here. + var ctor: new (s: string) => { s: string }; -+ ~~~~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'ctor' must be of type 'any', but here has type 'new(s: string) => { s: string; }'. -+!!! related TS6203 a.js:65:5: 'ctor' was also declared here. + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt index 2cad807110..fe4c9bb317 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt @@ -1,16 +1,18 @@ b.js(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. b.js(4,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. -b.js(12,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. -b.js(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 's' must be of type 'any', but here has type 'string'. b.js(17,14): error TS2339: Property 'p' does not exist on type 'SomeBase'. b.js(23,14): error TS2339: Property 'x' does not exist on type 'SomeDerived'. b.js(28,14): error TS2339: Property 'q' does not exist on type 'SomeOther'. +b.js(66,38): error TS2454: Variable 'numOrStr' is used before being assigned. +b.js(67,2): error TS2322: Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. +b.js(67,8): error TS2454: Variable 'numOrStr' is used before being assigned. ==== a.ts (0 errors) ==== var W: string; -==== b.js (7 errors) ==== +==== b.js (8 errors) ==== // @ts-check var W = /** @type {string} */(/** @type {*} */ (4)); ~ @@ -29,13 +31,7 @@ b.js(28,14): error TS2339: Property 'q' does not exist on type 'SomeOther'. var s; var a = /** @type {*} */("" + 4); - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. -!!! related TS6203 b.js:7:5: 'a' was also declared here. var s = "" + /** @type {*} */(4); - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 's' must be of type 'any', but here has type 'string'. -!!! related TS6203 b.js:10:5: 's' was also declared here. class SomeBase { constructor() { @@ -95,7 +91,14 @@ b.js(28,14): error TS2339: Property 'q' does not exist on type 'SomeOther'. /** @type {string} */ var str; if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error + ~~~~~~~~ +!!! error TS2454: Variable 'numOrStr' is used before being assigned. str = numOrStr; // Error, no narrowing occurred + ~~~ +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~~~~~~~~ +!!! error TS2454: Variable 'numOrStr' is used before being assigned. } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt.diff index 0c9f47f025..a99fa40921 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt.diff @@ -15,24 +15,20 @@ - Type 'string | number' is not assignable to type 'number'. - Type 'string' is not assignable to type 'number'. -b.js(66,15): error TS1228: A type predicate is only allowed in return type position for functions and methods. --b.js(66,38): error TS2454: Variable 'numOrStr' is used before being assigned. --b.js(67,2): error TS2322: Type 'string | number' is not assignable to type 'string'. -- Type 'number' is not assignable to type 'string'. --b.js(67,8): error TS2454: Variable 'numOrStr' is used before being assigned. +b.js(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. +b.js(4,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. -+b.js(12,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. -+b.js(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 's' must be of type 'any', but here has type 'string'. +b.js(17,14): error TS2339: Property 'p' does not exist on type 'SomeBase'. +b.js(23,14): error TS2339: Property 'x' does not exist on type 'SomeDerived'. +b.js(28,14): error TS2339: Property 'q' does not exist on type 'SomeOther'. - - + b.js(66,38): error TS2454: Variable 'numOrStr' is used before being assigned. + b.js(67,2): error TS2322: Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. +@@= skipped -20, +11 lines =@@ ==== a.ts (0 errors) ==== var W: string; -==== b.js (10 errors) ==== -+==== b.js (7 errors) ==== ++==== b.js (8 errors) ==== // @ts-check var W = /** @type {string} */(/** @type {*} */ (4)); + ~ @@ -48,18 +44,7 @@ /** @type {*} */ var a; -@@= skipped -35, +28 lines =@@ - var s; - - var a = /** @type {*} */("" + 4); -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. -+!!! related TS6203 b.js:7:5: 'a' was also declared here. - var s = "" + /** @type {*} */(4); -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 's' must be of type 'any', but here has type 'string'. -+!!! related TS6203 b.js:10:5: 's' was also declared here. - +@@= skipped -20, +24 lines =@@ class SomeBase { constructor() { this.p = 42; @@ -83,7 +68,7 @@ } } -@@= skipped -33, +45 lines =@@ +@@= skipped -28, +34 lines =@@ someBase = /** @type {SomeBase} */(someDerived); someBase = /** @type {SomeBase} */(someBase); someBase = /** @type {SomeBase} */(someOther); // Error @@ -129,14 +114,6 @@ if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error - ~~~~~~~~~~~~~~~~~~ -!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. -- ~~~~~~~~ --!!! error TS2454: Variable 'numOrStr' is used before being assigned. + ~~~~~~~~ + !!! error TS2454: Variable 'numOrStr' is used before being assigned. str = numOrStr; // Error, no narrowing occurred -- ~~~ --!!! error TS2322: Type 'string | number' is not assignable to type 'string'. --!!! error TS2322: Type 'number' is not assignable to type 'string'. -- ~~~~~~~~ --!!! error TS2454: Variable 'numOrStr' is used before being assigned. - } - - diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt index 6d33f5168c..4b79a3d468 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt @@ -1,9 +1,13 @@ +a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. a.js(6,12): error TS7006: Parameter 's' implicitly has an 'any' type. -==== a.js (2 errors) ==== +==== a.js (3 errors) ==== /** @type {function(string): void} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const f = (value) => { ~~~~~ !!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt.diff index efbaae8b0e..186716f23c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt.diff @@ -3,12 +3,17 @@ @@= skipped -0, +0 lines =@@ -a.js(3,5): error TS2322: Type 'number' is not assignable to type 'string'. -a.js(7,5): error TS2322: Type 'number' is not assignable to type 'string'. ++a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. +a.js(6,12): error TS7006: Parameter 's' implicitly has an 'any' type. - ==== a.js (2 errors) ==== +-==== a.js (2 errors) ==== ++==== a.js (3 errors) ==== /** @type {function(string): void} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const f = (value) => { + ~~~~~ +!!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt index f6915b7f41..96a1ffda77 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt @@ -1,13 +1,16 @@ +a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. a.js(5,12): error TS7006: Parameter 's' implicitly has an 'any' type. a.js(8,12): error TS7006: Parameter 's' implicitly has an 'any' type. -a.js(11,1): error TS2554: Expected 1 arguments, but got 0. a.js(12,1): error TS2554: Expected 1 arguments, but got 0. a.js(13,1): error TS2554: Expected 1 arguments, but got 0. ==== a.js (6 errors) ==== /** @type {function(string): void} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const f = (value) => { ~~~~~ !!! error TS7006: Parameter 'value' implicitly has an 'any' type. @@ -24,9 +27,6 @@ a.js(13,1): error TS2554: Expected 1 arguments, but got 0. } f() // should error - ~ -!!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 a.js:2:12: An argument for 'value' was not provided. g() // should error ~ !!! error TS2554: Expected 1 arguments, but got 0. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff index 00ecef629a..f075ff78a8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff @@ -1,10 +1,11 @@ --- old.jsdocTypeTagRequiredParameters.errors.txt +++ new.jsdocTypeTagRequiredParameters.errors.txt @@= skipped -0, +0 lines =@@ +-a.js(11,1): error TS2554: Expected 1 arguments, but got 0. ++a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. +a.js(5,12): error TS7006: Parameter 's' implicitly has an 'any' type. +a.js(8,12): error TS7006: Parameter 's' implicitly has an 'any' type. - a.js(11,1): error TS2554: Expected 1 arguments, but got 0. a.js(12,1): error TS2554: Expected 1 arguments, but got 0. a.js(13,1): error TS2554: Expected 1 arguments, but got 0. @@ -12,6 +13,9 @@ -==== a.js (3 errors) ==== +==== a.js (6 errors) ==== /** @type {function(string): void} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const f = (value) => { + ~~~~~ +!!! error TS7006: Parameter 'value' implicitly has an 'any' type. @@ -28,10 +32,9 @@ } f() // should error - ~ - !!! error TS2554: Expected 1 arguments, but got 0. +- ~ +-!!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 a.js:1:21: An argument for '0' was not provided. -+!!! related TS6210 a.js:2:12: An argument for 'value' was not provided. g() // should error ~ !!! error TS2554: Expected 1 arguments, but got 0. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt new file mode 100644 index 0000000000..908bca4dda --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt @@ -0,0 +1,15 @@ +a.js(2,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + +==== a.js (1 errors) ==== + /** + * @type {function(boolean, string, ...*):void} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + */ + const foo = function (a, b, ...r) { }; + +==== b.ts (0 errors) ==== + foo(false, ''); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt.diff new file mode 100644 index 0000000000..a1c6c35172 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt.diff @@ -0,0 +1,20 @@ +--- old.jsdocVariadicType.errors.txt ++++ new.jsdocVariadicType.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++a.js(2,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++ ++ ++==== a.js (1 errors) ==== ++ /** ++ * @type {function(boolean, string, ...*):void} ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ */ ++ const foo = function (a, b, ...r) { }; ++ ++==== b.ts (0 errors) ==== ++ foo(false, ''); ++ diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt index ddded0d6da..5e2695e925 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt @@ -1,7 +1,8 @@ /a.js(14,9): error TS7006: Parameter 'value' implicitly has an 'any' type. +/a.js(17,12): error TS2315: Type 'Foo' is not generic. -==== /a.js (1 errors) ==== +==== /a.js (2 errors) ==== /** * @template T */ @@ -21,6 +22,8 @@ } /** @type {Foo} */ + ~~~~~~~~~~~ +!!! error TS2315: Type 'Foo' is not generic. let foo; foo = new Foo(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt.diff index d6d68c5bc2..7947c2582a 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt.diff @@ -4,9 +4,10 @@ - @@= skipped --1, +1 lines =@@ +/a.js(14,9): error TS7006: Parameter 'value' implicitly has an 'any' type. ++/a.js(17,12): error TS2315: Type 'Foo' is not generic. + + -+==== /a.js (1 errors) ==== ++==== /a.js (2 errors) ==== + /** + * @template T + */ @@ -26,6 +27,8 @@ + } + + /** @type {Foo} */ ++ ~~~~~~~~~~~ ++!!! error TS2315: Type 'Foo' is not generic. + let foo; + foo = new Foo(); + diff --git a/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt new file mode 100644 index 0000000000..ccc2bc954c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt @@ -0,0 +1,58 @@ +propertiesOfGenericConstructorFunctions.js(14,12): error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? + + +==== propertiesOfGenericConstructorFunctions.js (1 errors) ==== + /** + * @template {string} K + * @template V + * @param {string} ik + * @param {V} iv + */ + function Multimap(ik, iv) { + /** @type {{ [s: string]: V }} */ + this._map = {}; + // without type annotation + this._map2 = { [ik]: iv }; + }; + + /** @type {Multimap<"a" | "b", number>} with type annotation */ + ~~~~~~~~ +!!! error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? + const map = new Multimap("a", 1); + // without type annotation + const map2 = new Multimap("m", 2); + + /** @type {number} */ + var n = map._map['hi'] + /** @type {number} */ + var n = map._map2['hi'] + /** @type {number} */ + var n = map2._map['hi'] + /** @type {number} */ + var n = map._map2['hi'] + + /** + * @class + * @template T + * @param {T} t + */ + function Cp(t) { + this.x = 1 + this.y = t + } + Cp.prototype = { + m1() { return this.x }, + m2() { this.z = this.x + 1; return this.y } + } + var cp = new Cp(1) + + /** @type {number} */ + var n = cp.x + /** @type {number} */ + var n = cp.y + /** @type {number} */ + var n = cp.m1() + /** @type {number} */ + var n = cp.m2() + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff new file mode 100644 index 0000000000..e410109eb6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff @@ -0,0 +1,63 @@ +--- old.propertiesOfGenericConstructorFunctions.errors.txt ++++ new.propertiesOfGenericConstructorFunctions.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++propertiesOfGenericConstructorFunctions.js(14,12): error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? ++ ++ ++==== propertiesOfGenericConstructorFunctions.js (1 errors) ==== ++ /** ++ * @template {string} K ++ * @template V ++ * @param {string} ik ++ * @param {V} iv ++ */ ++ function Multimap(ik, iv) { ++ /** @type {{ [s: string]: V }} */ ++ this._map = {}; ++ // without type annotation ++ this._map2 = { [ik]: iv }; ++ }; ++ ++ /** @type {Multimap<"a" | "b", number>} with type annotation */ ++ ~~~~~~~~ ++!!! error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? ++ const map = new Multimap("a", 1); ++ // without type annotation ++ const map2 = new Multimap("m", 2); ++ ++ /** @type {number} */ ++ var n = map._map['hi'] ++ /** @type {number} */ ++ var n = map._map2['hi'] ++ /** @type {number} */ ++ var n = map2._map['hi'] ++ /** @type {number} */ ++ var n = map._map2['hi'] ++ ++ /** ++ * @class ++ * @template T ++ * @param {T} t ++ */ ++ function Cp(t) { ++ this.x = 1 ++ this.y = t ++ } ++ Cp.prototype = { ++ m1() { return this.x }, ++ m2() { this.z = this.x + 1; return this.y } ++ } ++ var cp = new Cp(1) ++ ++ /** @type {number} */ ++ var n = cp.x ++ /** @type {number} */ ++ var n = cp.y ++ /** @type {number} */ ++ var n = cp.m1() ++ /** @type {number} */ ++ var n = cp.m2() ++ ++ diff --git a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt new file mode 100644 index 0000000000..16c899bde3 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt @@ -0,0 +1,38 @@ +propertyAssignmentUseParentType2.js(2,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. + Types of property 'nuo' are incompatible. + Type 'number' is not assignable to type '789'. +propertyAssignmentUseParentType2.js(6,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. + Types of property 'nuo' are incompatible. + Type 'number' is not assignable to type '789'. +propertyAssignmentUseParentType2.js(11,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. + Types of property 'nuo' are incompatible. + Type 'number' is not assignable to type '789'. + + +==== propertyAssignmentUseParentType2.js (3 errors) ==== + /** @type {{ (): boolean; nuo: 789 }} */ + export const inlined = () => true + ~~~~~~~ +!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. +!!! error TS2322: Types of property 'nuo' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type '789'. + inlined.nuo = 789 + + /** @type {{ (): boolean; nuo: 789 }} */ + export const duplicated = () => true + ~~~~~~~~~~ +!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. +!!! error TS2322: Types of property 'nuo' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type '789'. + /** @type {789} */ + duplicated.nuo = 789 + + /** @type {{ (): boolean; nuo: 789 }} */ + export const conflictingDuplicated = () => true + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. +!!! error TS2322: Types of property 'nuo' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type '789'. + /** @type {1000} */ + conflictingDuplicated.nuo = 789 + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt.diff index 4d69dc31f4..242581f4dc 100644 --- a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt.diff @@ -1,29 +1,46 @@ --- old.propertyAssignmentUseParentType2.errors.txt +++ new.propertyAssignmentUseParentType2.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -propertyAssignmentUseParentType2.js(11,14): error TS2322: Type '{ (): boolean; nuo: 1000; }' is not assignable to type '{ (): boolean; nuo: 789; }'. -- Types of property 'nuo' are incompatible. ++propertyAssignmentUseParentType2.js(2,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. + Types of property 'nuo' are incompatible. - Type '1000' is not assignable to type '789'. -- -- ++ Type 'number' is not assignable to type '789'. ++propertyAssignmentUseParentType2.js(6,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. ++ Types of property 'nuo' are incompatible. ++ Type 'number' is not assignable to type '789'. ++propertyAssignmentUseParentType2.js(11,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. ++ Types of property 'nuo' are incompatible. ++ Type 'number' is not assignable to type '789'. + + -==== propertyAssignmentUseParentType2.js (1 errors) ==== -- /** @type {{ (): boolean; nuo: 789 }} */ -- export const inlined = () => true -- inlined.nuo = 789 -- -- /** @type {{ (): boolean; nuo: 789 }} */ -- export const duplicated = () => true -- /** @type {789} */ -- duplicated.nuo = 789 -- -- /** @type {{ (): boolean; nuo: 789 }} */ -- export const conflictingDuplicated = () => true -- ~~~~~~~~~~~~~~~~~~~~~ ++==== propertyAssignmentUseParentType2.js (3 errors) ==== + /** @type {{ (): boolean; nuo: 789 }} */ + export const inlined = () => true ++ ~~~~~~~ ++!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. ++!!! error TS2322: Types of property 'nuo' are incompatible. ++!!! error TS2322: Type 'number' is not assignable to type '789'. + inlined.nuo = 789 + + /** @type {{ (): boolean; nuo: 789 }} */ + export const duplicated = () => true ++ ~~~~~~~~~~ ++!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. ++!!! error TS2322: Types of property 'nuo' are incompatible. ++!!! error TS2322: Type 'number' is not assignable to type '789'. + /** @type {789} */ + duplicated.nuo = 789 + + /** @type {{ (): boolean; nuo: 789 }} */ + export const conflictingDuplicated = () => true + ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ (): boolean; nuo: 1000; }' is not assignable to type '{ (): boolean; nuo: 789; }'. --!!! error TS2322: Types of property 'nuo' are incompatible. ++!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. + !!! error TS2322: Types of property 'nuo' are incompatible. -!!! error TS2322: Type '1000' is not assignable to type '789'. -- /** @type {1000} */ -- conflictingDuplicated.nuo = 789 -- -@@= skipped --1, +1 lines =@@ -+ ++!!! error TS2322: Type 'number' is not assignable to type '789'. + /** @type {1000} */ + conflictingDuplicated.nuo = 789 + diff --git a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols index dfe5811ad4..f0708a96c2 100644 --- a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols +++ b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols @@ -6,9 +6,9 @@ export const inlined = () => true >inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12)) inlined.nuo = 789 ->inlined.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 1, 33)) +>inlined.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) >inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12)) ->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 1, 33)) +>nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) /** @type {{ (): boolean; nuo: 789 }} */ export const duplicated = () => true @@ -16,9 +16,9 @@ export const duplicated = () => true /** @type {789} */ duplicated.nuo = 789 ->duplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 5, 36)) +>duplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) >duplicated : Symbol(duplicated, Decl(propertyAssignmentUseParentType2.js, 5, 12)) ->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 5, 36)) +>nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) /** @type {{ (): boolean; nuo: 789 }} */ export const conflictingDuplicated = () => true @@ -26,7 +26,7 @@ export const conflictingDuplicated = () => true /** @type {1000} */ conflictingDuplicated.nuo = 789 ->conflictingDuplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 10, 47)) +>conflictingDuplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) >conflictingDuplicated : Symbol(conflictingDuplicated, Decl(propertyAssignmentUseParentType2.js, 10, 12)) ->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 10, 47)) +>nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) diff --git a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols.diff b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols.diff index 4060d524e3..4bc4b1c28b 100644 --- a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols.diff @@ -8,12 +8,10 @@ +>inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12)) inlined.nuo = 789 -->inlined.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) + >inlined.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) ->inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12), Decl(propertyAssignmentUseParentType2.js, 1, 33)) -->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) -+>inlined.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 1, 33)) +>inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12)) -+>nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 1, 33)) + >nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) /** @type {{ (): boolean; nuo: 789 }} */ export const duplicated = () => true @@ -22,12 +20,10 @@ /** @type {789} */ duplicated.nuo = 789 -->duplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) + >duplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) ->duplicated : Symbol(duplicated, Decl(propertyAssignmentUseParentType2.js, 5, 12), Decl(propertyAssignmentUseParentType2.js, 5, 36)) -->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) -+>duplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 5, 36)) +>duplicated : Symbol(duplicated, Decl(propertyAssignmentUseParentType2.js, 5, 12)) -+>nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 5, 36)) + >nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) /** @type {{ (): boolean; nuo: 789 }} */ export const conflictingDuplicated = () => true @@ -36,10 +32,8 @@ /** @type {1000} */ conflictingDuplicated.nuo = 789 -->conflictingDuplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) + >conflictingDuplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) ->conflictingDuplicated : Symbol(conflictingDuplicated, Decl(propertyAssignmentUseParentType2.js, 10, 12), Decl(propertyAssignmentUseParentType2.js, 10, 47)) -->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) -+>conflictingDuplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 10, 47)) +>conflictingDuplicated : Symbol(conflictingDuplicated, Decl(propertyAssignmentUseParentType2.js, 10, 12)) -+>nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 10, 47)) + >nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt index 2ac8d5ec6b..29eab95b99 100644 --- a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt @@ -1,3 +1,5 @@ +other.js(2,11): error TS2503: Cannot find namespace 'Ns'. +other.js(7,11): error TS2503: Cannot find namespace 'Ns'. prototypePropertyAssignmentMergeAcrossFiles2.js(2,4): error TS2339: Property 'One' does not exist on type '{}'. prototypePropertyAssignmentMergeAcrossFiles2.js(3,4): error TS2339: Property 'Two' does not exist on type '{}'. prototypePropertyAssignmentMergeAcrossFiles2.js(5,4): error TS2339: Property 'One' does not exist on type '{}'. @@ -23,14 +25,18 @@ prototypePropertyAssignmentMergeAcrossFiles2.js(8,4): error TS2339: Property 'Tw !!! error TS2339: Property 'Two' does not exist on type '{}'. } -==== other.js (0 errors) ==== +==== other.js (2 errors) ==== /** * @type {Ns.One} + ~~ +!!! error TS2503: Cannot find namespace 'Ns'. */ var one; one.wat; /** * @type {Ns.Two} + ~~ +!!! error TS2503: Cannot find namespace 'Ns'. */ var two; two.wat; diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt.diff index bf58b928b2..3249e91f43 100644 --- a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt.diff @@ -3,6 +3,8 @@ @@= skipped -0, +0 lines =@@ -other.js(5,5): error TS2339: Property 'wat' does not exist on type 'One'. -other.js(10,5): error TS2339: Property 'wat' does not exist on type 'Two'. ++other.js(2,11): error TS2503: Cannot find namespace 'Ns'. ++other.js(7,11): error TS2503: Cannot find namespace 'Ns'. +prototypePropertyAssignmentMergeAcrossFiles2.js(2,4): error TS2339: Property 'One' does not exist on type '{}'. +prototypePropertyAssignmentMergeAcrossFiles2.js(3,4): error TS2339: Property 'Two' does not exist on type '{}'. +prototypePropertyAssignmentMergeAcrossFiles2.js(5,4): error TS2339: Property 'One' does not exist on type '{}'. @@ -29,10 +31,11 @@ +!!! error TS2339: Property 'Two' does not exist on type '{}'. } --==== other.js (2 errors) ==== -+==== other.js (0 errors) ==== + ==== other.js (2 errors) ==== /** * @type {Ns.One} ++ ~~ ++!!! error TS2503: Cannot find namespace 'Ns'. */ var one; one.wat; @@ -40,6 +43,8 @@ -!!! error TS2339: Property 'wat' does not exist on type 'One'. /** * @type {Ns.Two} ++ ~~ ++!!! error TS2503: Cannot find namespace 'Ns'. */ var two; two.wat; diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt new file mode 100644 index 0000000000..e4777e89a7 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt @@ -0,0 +1,21 @@ +prototypePropertyAssignmentMergedTypeReference.js(7,22): error TS2749: 'f' refers to a value, but is being used as a type here. Did you mean 'typeof f'? +prototypePropertyAssignmentMergedTypeReference.js(8,5): error TS2322: Type '() => number' is not assignable to type 'new() => f'. + Type '() => number' provides no match for the signature 'new(): f'. + + +==== prototypePropertyAssignmentMergedTypeReference.js (2 errors) ==== + var f = function() { + return 12; + }; + + f.prototype.a = "a"; + + /** @type {new () => f} */ + ~ +!!! error TS2749: 'f' refers to a value, but is being used as a type here. Did you mean 'typeof f'? + var x = f; + ~ +!!! error TS2322: Type '() => number' is not assignable to type 'new() => f'. +!!! error TS2322: Type '() => number' provides no match for the signature 'new(): f'. + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt.diff new file mode 100644 index 0000000000..dd008ecfc0 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt.diff @@ -0,0 +1,26 @@ +--- old.prototypePropertyAssignmentMergedTypeReference.errors.txt ++++ new.prototypePropertyAssignmentMergedTypeReference.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++prototypePropertyAssignmentMergedTypeReference.js(7,22): error TS2749: 'f' refers to a value, but is being used as a type here. Did you mean 'typeof f'? ++prototypePropertyAssignmentMergedTypeReference.js(8,5): error TS2322: Type '() => number' is not assignable to type 'new() => f'. ++ Type '() => number' provides no match for the signature 'new(): f'. ++ ++ ++==== prototypePropertyAssignmentMergedTypeReference.js (2 errors) ==== ++ var f = function() { ++ return 12; ++ }; ++ ++ f.prototype.a = "a"; ++ ++ /** @type {new () => f} */ ++ ~ ++!!! error TS2749: 'f' refers to a value, but is being used as a type here. Did you mean 'typeof f'? ++ var x = f; ++ ~ ++!!! error TS2322: Type '() => number' is not assignable to type 'new() => f'. ++!!! error TS2322: Type '() => number' provides no match for the signature 'new(): f'. ++ ++ diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt new file mode 100644 index 0000000000..e20923d91c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt @@ -0,0 +1,33 @@ +bug39372.js(24,12): error TS2552: Cannot find name 'XMLObject'. Did you mean 'Object'? + + +==== bug39372.js (1 errors) ==== + /** @typedef {ReadonlyArray} JsonArray */ + /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ + /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ + + /** + * @template T + * @typedef {{ + $A: { + [K in keyof T]?: XMLObject[] + }, + $O: { + [K in keyof T]?: { + $$?: Record + } & (T[K] extends string ? {$:string} : XMLObject) + }, + $$?: Record, + } & { + [K in keyof T]?: ( + T[K] extends string ? string + : XMLObject + ) + }} XMLObject */ + + /** @type {XMLObject<{foo:string}>} */ + ~~~~~~~~~ +!!! error TS2552: Cannot find name 'XMLObject'. Did you mean 'Object'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Object' is declared here. + const p = {}; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt.diff index 84778a0c58..d41efdc475 100644 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt.diff @@ -1,39 +1,21 @@ --- old.recursiveTypeReferences2.errors.txt +++ new.recursiveTypeReferences2.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -bug39372.js(25,7): error TS2322: Type '{}' is not assignable to type 'XMLObject<{ foo: string; }>'. - Type '{}' is missing the following properties from type '{ $A: { foo?: XMLObject[]; }; $O: { foo?: { $$?: Record; } & { $: string; }; }; $$?: Record; }': $A, $O -- -- --==== bug39372.js (1 errors) ==== -- /** @typedef {ReadonlyArray} JsonArray */ -- /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ -- /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ -- -- /** -- * @template T -- * @typedef {{ -- $A: { -- [K in keyof T]?: XMLObject[] -- }, -- $O: { -- [K in keyof T]?: { -- $$?: Record -- } & (T[K] extends string ? {$:string} : XMLObject) -- }, -- $$?: Record, -- } & { -- [K in keyof T]?: ( -- T[K] extends string ? string -- : XMLObject -- ) -- }} XMLObject */ -- -- /** @type {XMLObject<{foo:string}>} */ -- const p = {}; ++bug39372.js(24,12): error TS2552: Cannot find name 'XMLObject'. Did you mean 'Object'? + + + ==== bug39372.js (1 errors) ==== +@@= skipped -26, +25 lines =@@ + }} XMLObject */ + + /** @type {XMLObject<{foo:string}>} */ ++ ~~~~~~~~~ ++!!! error TS2552: Cannot find name 'XMLObject'. Did you mean 'Object'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Object' is declared here. + const p = {}; - ~ -!!! error TS2322: Type '{}' is not assignable to type 'XMLObject<{ foo: string; }>'. -!!! error TS2322: Type '{}' is missing the following properties from type '{ $A: { foo?: XMLObject[]; }; $O: { foo?: { $$?: Record; } & { $: string; }; }; $$?: Record; }': $A, $O -- -@@= skipped --1, +1 lines =@@ -+ + diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt index 051bb37540..679e8990ef 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt @@ -1,8 +1,10 @@ +templateInsideCallback.js(15,11): error TS2304: Cannot find name 'Call'. +templateInsideCallback.js(15,16): error TS2304: Cannot find name 'T'. templateInsideCallback.js(17,18): error TS7006: Parameter 'x' implicitly has an 'any' type. templateInsideCallback.js(47,18): error TS7006: Parameter 'array' implicitly has an 'any' type. -==== templateInsideCallback.js (2 errors) ==== +==== templateInsideCallback.js (4 errors) ==== /** * @typedef Oops * @template T @@ -18,6 +20,10 @@ templateInsideCallback.js(47,18): error TS7006: Parameter 'array' implicitly has /** * @template T * @type {Call} + ~~~~ +!!! error TS2304: Cannot find name 'Call'. + ~ +!!! error TS2304: Cannot find name 'T'. */ const identity = x => x; ~ diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt.diff index 657c13c744..c819993af9 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt.diff @@ -6,6 +6,8 @@ -templateInsideCallback.js(9,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -templateInsideCallback.js(10,12): error TS2304: Cannot find name 'T'. -templateInsideCallback.js(15,11): error TS2315: Type 'Call' is not generic. ++templateInsideCallback.js(15,11): error TS2304: Cannot find name 'Call'. ++templateInsideCallback.js(15,16): error TS2304: Cannot find name 'T'. templateInsideCallback.js(17,18): error TS7006: Parameter 'x' implicitly has an 'any' type. -templateInsideCallback.js(23,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -templateInsideCallback.js(30,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag @@ -21,7 +23,7 @@ -!!! related TS7012 templateInsideCallback.js:29:5: This overload implicitly returns the type 'any' because it lacks a return type annotation. -!!! related TS7012 templateInsideCallback.js:37:5: This overload implicitly returns the type 'any' because it lacks a return type annotation. -==== templateInsideCallback.js (11 errors) ==== -+==== templateInsideCallback.js (2 errors) ==== ++==== templateInsideCallback.js (4 errors) ==== /** * @typedef Oops - ~~~~ @@ -29,7 +31,7 @@ * @template T * @property {T} a * @property {T} b -@@= skipped -27, +11 lines =@@ +@@= skipped -27, +13 lines =@@ /** * @callback Call * @template T @@ -45,10 +47,14 @@ * @type {Call} - ~~~~~~~ -!!! error TS2315: Type 'Call' is not generic. ++ ~~~~ ++!!! error TS2304: Cannot find name 'Call'. ++ ~ ++!!! error TS2304: Cannot find name 'T'. */ const identity = x => x; ~ -@@= skipped -22, +16 lines =@@ +@@= skipped -22, +20 lines =@@ * @property {Object} oh * @property {number} oh.no * @template T diff --git a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt new file mode 100644 index 0000000000..0961be452d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt @@ -0,0 +1,61 @@ +thisTypeOfConstructorFunctions.js(15,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface. +thisTypeOfConstructorFunctions.js(38,12): error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? +thisTypeOfConstructorFunctions.js(41,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? +thisTypeOfConstructorFunctions.js(43,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? + + +==== thisTypeOfConstructorFunctions.js (4 errors) ==== + /** + * @class + * @template T + * @param {T} t + */ + function Cp(t) { + /** @type {this} */ + this.dit = this + this.y = t + /** @return {this} */ + this.m3 = () => this + } + + Cp.prototype = { + /** @return {this} */ + ~~~~ +!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. + m4() { + this.z = this.y; return this + } + } + + /** + * @class + * @template T + * @param {T} t + */ + function Cpp(t) { + this.y = t + } + /** @return {this} */ + Cpp.prototype.m2 = function () { + this.z = this.y; return this + } + + var cp = new Cp(1) + var cpp = new Cpp(2) + cp.dit + + /** @type {Cpp} */ + ~~~ +!!! error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? + var cppn = cpp.m2() + + /** @type {Cp} */ + ~~ +!!! error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? + var cpn = cp.m3() + /** @type {Cp} */ + ~~ +!!! error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? + var cpn = cp.m4() + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff new file mode 100644 index 0000000000..ad89e66e54 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff @@ -0,0 +1,66 @@ +--- old.thisTypeOfConstructorFunctions.errors.txt ++++ new.thisTypeOfConstructorFunctions.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++thisTypeOfConstructorFunctions.js(15,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface. ++thisTypeOfConstructorFunctions.js(38,12): error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? ++thisTypeOfConstructorFunctions.js(41,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? ++thisTypeOfConstructorFunctions.js(43,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? ++ ++ ++==== thisTypeOfConstructorFunctions.js (4 errors) ==== ++ /** ++ * @class ++ * @template T ++ * @param {T} t ++ */ ++ function Cp(t) { ++ /** @type {this} */ ++ this.dit = this ++ this.y = t ++ /** @return {this} */ ++ this.m3 = () => this ++ } ++ ++ Cp.prototype = { ++ /** @return {this} */ ++ ~~~~ ++!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. ++ m4() { ++ this.z = this.y; return this ++ } ++ } ++ ++ /** ++ * @class ++ * @template T ++ * @param {T} t ++ */ ++ function Cpp(t) { ++ this.y = t ++ } ++ /** @return {this} */ ++ Cpp.prototype.m2 = function () { ++ this.z = this.y; return this ++ } ++ ++ var cp = new Cp(1) ++ var cpp = new Cpp(2) ++ cp.dit ++ ++ /** @type {Cpp} */ ++ ~~~ ++!!! error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? ++ var cppn = cpp.m2() ++ ++ /** @type {Cp} */ ++ ~~ ++!!! error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? ++ var cpn = cp.m3() ++ /** @type {Cp} */ ++ ~~ ++!!! error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? ++ var cpn = cp.m4() ++ ++ diff --git a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt deleted file mode 100644 index 8f168eb7af..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt +++ /dev/null @@ -1,36 +0,0 @@ -bug25926.js(4,14): error TS2339: Property 'b' does not exist on type '{ a: () => void; }'. -bug25926.js(4,18): error TS7006: Parameter 'n' implicitly has an 'any' type. -bug25926.js(11,14): error TS2339: Property 'e' does not exist on type '{ d: () => void; }'. -bug25926.js(11,23): error TS2339: Property 'f' does not exist on type '{ d: () => void; }'. -bug25926.js(11,27): error TS7006: Parameter 'm' implicitly has an 'any' type. -bug25926.js(11,37): error TS2339: Property 'g' does not exist on type '{ d: () => void; }'. - - -==== bug25926.js (6 errors) ==== - /** @type {{ a(): void; b?(n: number): number; }} */ - const o1 = { - a() { - this.b = n => n; - ~ -!!! error TS2339: Property 'b' does not exist on type '{ a: () => void; }'. - ~ -!!! error TS7006: Parameter 'n' implicitly has an 'any' type. - } - }; - - /** @type {{ d(): void; e?(n: number): number; f?(n: number): number; g?: number }} */ - const o2 = { - d() { - this.e = this.f = m => this.g || m; - ~ -!!! error TS2339: Property 'e' does not exist on type '{ d: () => void; }'. - ~ -!!! error TS2339: Property 'f' does not exist on type '{ d: () => void; }'. - ~ -!!! error TS7006: Parameter 'm' implicitly has an 'any' type. - ~ -!!! error TS2339: Property 'g' does not exist on type '{ d: () => void; }'. - } - }; - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt.diff deleted file mode 100644 index 14976ac8da..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- old.typeFromContextualThisType.errors.txt -+++ new.typeFromContextualThisType.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+bug25926.js(4,14): error TS2339: Property 'b' does not exist on type '{ a: () => void; }'. -+bug25926.js(4,18): error TS7006: Parameter 'n' implicitly has an 'any' type. -+bug25926.js(11,14): error TS2339: Property 'e' does not exist on type '{ d: () => void; }'. -+bug25926.js(11,23): error TS2339: Property 'f' does not exist on type '{ d: () => void; }'. -+bug25926.js(11,27): error TS7006: Parameter 'm' implicitly has an 'any' type. -+bug25926.js(11,37): error TS2339: Property 'g' does not exist on type '{ d: () => void; }'. -+ -+ -+==== bug25926.js (6 errors) ==== -+ /** @type {{ a(): void; b?(n: number): number; }} */ -+ const o1 = { -+ a() { -+ this.b = n => n; -+ ~ -+!!! error TS2339: Property 'b' does not exist on type '{ a: () => void; }'. -+ ~ -+!!! error TS7006: Parameter 'n' implicitly has an 'any' type. -+ } -+ }; -+ -+ /** @type {{ d(): void; e?(n: number): number; f?(n: number): number; g?: number }} */ -+ const o2 = { -+ d() { -+ this.e = this.f = m => this.g || m; -+ ~ -+!!! error TS2339: Property 'e' does not exist on type '{ d: () => void; }'. -+ ~ -+!!! error TS2339: Property 'f' does not exist on type '{ d: () => void; }'. -+ ~ -+!!! error TS7006: Parameter 'm' implicitly has an 'any' type. -+ ~ -+!!! error TS2339: Property 'g' does not exist on type '{ d: () => void; }'. -+ } -+ }; -+ -+ diff --git a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols index 65c25f84b3..4400ed3a9c 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols @@ -9,7 +9,9 @@ const o1 = { >a : Symbol(a, Decl(bug25926.js, 1, 12)) this.b = n => n; ->this : Symbol((Anonymous type), Decl(bug25926.js, 1, 10)) +>this.b : Symbol(b, Decl(bug25926.js, 0, 23)) +>this : Symbol((Anonymous type), 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)) } @@ -23,10 +25,16 @@ const o2 = { >d : Symbol(d, Decl(bug25926.js, 8, 12)) this.e = this.f = m => this.g || m; ->this : Symbol((Anonymous type), Decl(bug25926.js, 8, 10)) ->this : Symbol((Anonymous type), Decl(bug25926.js, 8, 10)) +>this.e : Symbol(e, Decl(bug25926.js, 7, 23)) +>this : Symbol((Anonymous type), Decl(bug25926.js, 7, 11)) +>e : Symbol(e, Decl(bug25926.js, 7, 23)) +>this.f : Symbol(f, Decl(bug25926.js, 7, 46)) +>this : Symbol((Anonymous type), Decl(bug25926.js, 7, 11)) +>f : Symbol(f, Decl(bug25926.js, 7, 46)) >m : Symbol(m, Decl(bug25926.js, 10, 25)) ->this : Symbol((Anonymous type), Decl(bug25926.js, 8, 10)) +>this.g : Symbol(g, Decl(bug25926.js, 7, 69)) +>this : Symbol((Anonymous type), 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 0a94aae360..f39477cc81 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols.diff @@ -1,33 +1,33 @@ --- old.typeFromContextualThisType.symbols +++ new.typeFromContextualThisType.symbols -@@= skipped -8, +8 lines =@@ - >a : Symbol(a, Decl(bug25926.js, 1, 12)) +@@= skipped -9, +9 lines =@@ this.b = n => n; -->this.b : Symbol(b, Decl(bug25926.js, 0, 23)) + >this.b : Symbol(b, Decl(bug25926.js, 0, 23)) ->this : Symbol(__type, Decl(bug25926.js, 0, 11)) ->b : Symbol(b, Decl(bug25926.js, 2, 9)) -+>this : Symbol((Anonymous type), Decl(bug25926.js, 1, 10)) ++>this : Symbol((Anonymous type), 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, +14 lines =@@ - >d : Symbol(d, Decl(bug25926.js, 8, 12)) +@@= skipped -16, +16 lines =@@ this.e = this.f = m => this.g || m; -->this.e : Symbol(e, Decl(bug25926.js, 7, 23)) + >this.e : Symbol(e, Decl(bug25926.js, 7, 23)) ->this : Symbol(__type, Decl(bug25926.js, 7, 11)) ->e : Symbol(e, Decl(bug25926.js, 9, 9)) -->this.f : Symbol(f, Decl(bug25926.js, 7, 46)) ++>this : Symbol((Anonymous type), 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)) ->f : Symbol(f, Decl(bug25926.js, 10, 16)) -+>this : Symbol((Anonymous type), Decl(bug25926.js, 8, 10)) -+>this : Symbol((Anonymous type), Decl(bug25926.js, 8, 10)) ++>this : Symbol((Anonymous type), 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.g : Symbol(g, Decl(bug25926.js, 7, 69)) ->this : Symbol(__type, Decl(bug25926.js, 7, 11)) -->g : Symbol(g, Decl(bug25926.js, 7, 69)) -+>this : Symbol((Anonymous type), Decl(bug25926.js, 8, 10)) ++>this : Symbol((Anonymous type), 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/typeFromJSInitializer.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt index 2e2365b572..ecf3829086 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt @@ -1,17 +1,15 @@ a.js(7,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -a.js(22,5): error TS7034: Variable 'n' implicitly has type 'any' in some locations where its type cannot be determined. -a.js(25,26): error TS7005: Variable 'n' implicitly has an 'any' type. a.js(27,5): error TS2322: Type 'undefined' is not assignable to type 'null'. a.js(29,5): error TS2322: Type '1' is not assignable to type 'null'. a.js(30,5): error TS2322: Type 'true' is not assignable to type 'null'. a.js(31,5): error TS2322: Type '{}' is not assignable to type 'null'. a.js(32,5): error TS2322: Type '"ok"' is not assignable to type 'null'. +a.js(37,5): error TS2322: Type 'string' is not assignable to type 'number'. a.js(40,12): error TS2345: Argument of type '1' is not assignable to parameter of type 'never'. a.js(41,12): error TS2345: Argument of type '"ok"' is not assignable to parameter of type 'never'. -a.js(56,17): error TS7006: Parameter 'v' implicitly has an 'any' type. -==== a.js (11 errors) ==== +==== a.js (9 errors) ==== function A () { // should get any on this-assignments in constructor this.unknown = null @@ -36,13 +34,9 @@ a.js(56,17): error TS7006: Parameter 'v' implicitly has an 'any' type. /** @type {number | undefined} */ var n; - ~ -!!! error TS7034: Variable 'n' implicitly has type 'any' in some locations where its type cannot be determined. // should get any on parameter initialisers function f(a = null, b = n, l = []) { - ~ -!!! error TS7005: Variable 'n' implicitly has an 'any' type. // a should be null in strict mode a = undefined ~ @@ -65,6 +59,8 @@ a.js(56,17): error TS7006: Parameter 'v' implicitly has an 'any' type. b = 1 b = undefined b = 'error' + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. // l should be any[] l.push(1) @@ -88,8 +84,6 @@ a.js(56,17): error TS7006: Parameter 'v' implicitly has an 'any' type. /** @type {(v: unknown) => v is undefined} */ const isUndef = v => v === undefined; - ~ -!!! error TS7006: Parameter 'v' implicitly has an 'any' type. const e = [1, undefined]; // should be undefined[] diff --git a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt.diff index 14aff1f6cf..627d899f5b 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt.diff @@ -6,21 +6,18 @@ -a.js(5,5): error TS7008: Member 'empty' implicitly has an 'any[]' type. -a.js(25,29): error TS7006: Parameter 'l' implicitly has an 'any[]' type. +a.js(7,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -+a.js(22,5): error TS7034: Variable 'n' implicitly has type 'any' in some locations where its type cannot be determined. -+a.js(25,26): error TS7005: Variable 'n' implicitly has an 'any' type. a.js(27,5): error TS2322: Type 'undefined' is not assignable to type 'null'. a.js(29,5): error TS2322: Type '1' is not assignable to type 'null'. a.js(30,5): error TS2322: Type 'true' is not assignable to type 'null'. a.js(31,5): error TS2322: Type '{}' is not assignable to type 'null'. a.js(32,5): error TS2322: Type '"ok"' is not assignable to type 'null'. --a.js(37,5): error TS2322: Type 'string' is not assignable to type 'number'. + a.js(37,5): error TS2322: Type 'string' is not assignable to type 'number'. +a.js(40,12): error TS2345: Argument of type '1' is not assignable to parameter of type 'never'. +a.js(41,12): error TS2345: Argument of type '"ok"' is not assignable to parameter of type 'never'. -+a.js(56,17): error TS7006: Parameter 'v' implicitly has an 'any' type. -==== a.js (10 errors) ==== -+==== a.js (11 errors) ==== ++==== a.js (9 errors) ==== function A () { // should get any on this-assignments in constructor this.unknown = null @@ -39,28 +36,16 @@ a.unknown = 1 a.unknown = true a.unknown = {} -@@= skipped -38, +35 lines =@@ - - /** @type {number | undefined} */ - var n; -+ ~ -+!!! error TS7034: Variable 'n' implicitly has type 'any' in some locations where its type cannot be determined. +@@= skipped -41, +36 lines =@@ // should get any on parameter initialisers function f(a = null, b = n, l = []) { - ~~~~~~ -!!! error TS7006: Parameter 'l' implicitly has an 'any[]' type. -+ ~ -+!!! error TS7005: Variable 'n' implicitly has an 'any' type. // a should be null in strict mode a = undefined ~ -@@= skipped -27, +29 lines =@@ - b = 1 - b = undefined - b = 'error' -- ~ --!!! error TS2322: Type 'string' is not assignable to type 'number'. +@@= skipped -29, +27 lines =@@ // l should be any[] l.push(1) @@ -72,12 +57,3 @@ } // should get any on variable initialisers -@@= skipped -21, +23 lines =@@ - - /** @type {(v: unknown) => v is undefined} */ - const isUndef = v => v === undefined; -+ ~ -+!!! error TS7006: Parameter 'v' implicitly has an 'any' type. - const e = [1, undefined]; - - // should be undefined[] diff --git a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt index 7fc773fa28..58532b712f 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt @@ -1,21 +1,16 @@ -a.js(2,5): error TS7034: Variable 'n' implicitly has type 'any' in some locations where its type cannot be determined. a.js(5,12): error TS7006: Parameter 'a' implicitly has an 'any' type. -a.js(5,26): error TS7005: Variable 'n' implicitly has an 'any' type. a.js(5,29): error TS7006: Parameter 'l' implicitly has an 'any[]' type. +a.js(17,5): error TS2322: Type 'string' is not assignable to type 'number'. -==== a.js (4 errors) ==== +==== a.js (3 errors) ==== /** @type {number | undefined} */ var n; - ~ -!!! error TS7034: Variable 'n' implicitly has type 'any' in some locations where its type cannot be determined. // should get any on parameter initialisers function f(a = null, b = n, l = []) { ~~~~~~~~ !!! error TS7006: Parameter 'a' implicitly has an 'any' type. - ~ -!!! error TS7005: Variable 'n' implicitly has an 'any' type. ~~~~~~ !!! error TS7006: Parameter 'l' implicitly has an 'any[]' type. // a should be any @@ -30,6 +25,8 @@ a.js(5,29): error TS7006: Parameter 'l' implicitly has an 'any[]' type. b = 1 b = undefined b = 'error' + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. // l should be any[] l.push(1) diff --git a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt.diff deleted file mode 100644 index 9ddc1879de..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.typeFromJSInitializer4.errors.txt -+++ new.typeFromJSInitializer4.errors.txt -@@= skipped -0, +0 lines =@@ -+a.js(2,5): error TS7034: Variable 'n' implicitly has type 'any' in some locations where its type cannot be determined. - a.js(5,12): error TS7006: Parameter 'a' implicitly has an 'any' type. -+a.js(5,26): error TS7005: Variable 'n' implicitly has an 'any' type. - a.js(5,29): error TS7006: Parameter 'l' implicitly has an 'any[]' type. --a.js(17,5): error TS2322: Type 'string' is not assignable to type 'number'. - - --==== a.js (3 errors) ==== -+==== a.js (4 errors) ==== - /** @type {number | undefined} */ - var n; -+ ~ -+!!! error TS7034: Variable 'n' implicitly has type 'any' in some locations where its type cannot be determined. - - // should get any on parameter initialisers - function f(a = null, b = n, l = []) { - ~~~~~~~~ - !!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ ~ -+!!! error TS7005: Variable 'n' implicitly has an 'any' type. - ~~~~~~ - !!! error TS7006: Parameter 'l' implicitly has an 'any[]' type. - // a should be any -@@= skipped -24, +29 lines =@@ - b = 1 - b = undefined - b = 'error' -- ~ --!!! error TS2322: Type 'string' is not assignable to type 'number'. - - // l should be any[] - l.push(1) diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt index d28e42f23f..33c8a74b73 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt @@ -1,7 +1,9 @@ a.js(4,7): error TS2339: Property 'Inner' does not exist on type '{ new(): O; prototype: O; }'. +a.js(8,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? +a.js(11,12): error TS2503: Cannot find namespace 'Outer'. -==== a.js (1 errors) ==== +==== a.js (3 errors) ==== var Outer = class O { m(x, y) { } } @@ -12,9 +14,13 @@ a.js(4,7): error TS2339: Property 'Inner' does not exist on type '{ new(): O; pr } /** @type {Outer} */ + ~~~~~ +!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? var si si.m /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var oi oi.n diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt.diff index 9af3d522c6..cd8b2b3af9 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt.diff @@ -4,9 +4,11 @@ - @@= skipped --1, +1 lines =@@ +a.js(4,7): error TS2339: Property 'Inner' does not exist on type '{ new(): O; prototype: O; }'. ++a.js(8,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? ++a.js(11,12): error TS2503: Cannot find namespace 'Outer'. + + -+==== a.js (1 errors) ==== ++==== a.js (3 errors) ==== + var Outer = class O { + m(x, y) { } + } @@ -17,9 +19,13 @@ + + } + /** @type {Outer} */ ++ ~~~~~ ++!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? + var si + si.m + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var oi + oi.n + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt index acd5c2aa80..c1d1639e56 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt @@ -6,6 +6,7 @@ error TS2318: Cannot find global type 'String'. error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? error TS2552: Cannot find name 'Number'. Did you mean 'number'? error TS2552: Cannot find name 'Object'. Did you mean 'object'? +main.js(4,12): error TS2503: Cannot find namespace 'Outer'. someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. @@ -55,11 +56,13 @@ someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. }; return Application; })(); -==== main.js (0 errors) ==== +==== main.js (1 errors) ==== var app = new Outer.app.Application(); var inner = new Outer.app.Inner(); inner.y; /** @type {Outer.app.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var x; x.y; Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt.diff index 84f3b1bf95..c382bcbaee 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt.diff @@ -11,6 +11,7 @@ +error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? +error TS2552: Cannot find name 'Number'. Did you mean 'number'? +error TS2552: Cannot find name 'Object'. Did you mean 'object'? ++main.js(4,12): error TS2503: Cannot find namespace 'Outer'. +someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. + + @@ -60,11 +61,13 @@ + }; + return Application; + })(); -+==== main.js (0 errors) ==== ++==== main.js (1 errors) ==== + var app = new Outer.app.Application(); + var inner = new Outer.app.Inner(); + inner.y; + /** @type {Outer.app.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var x; + x.y; + Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt index 9726ce6c15..4c083f927a 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt @@ -1,3 +1,4 @@ +main.js(4,12): error TS2503: Cannot find namespace 'Outer'. someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. @@ -39,11 +40,13 @@ someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. }; return Application; })(); -==== main.js (0 errors) ==== +==== main.js (1 errors) ==== var app = new Outer.app.Application(); var inner = new Outer.app.Inner(); inner.y; /** @type {Outer.app.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var x; x.y; Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt.diff index 2e5bbae387..86f508d4ff 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt.diff @@ -3,6 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++main.js(4,12): error TS2503: Cannot find namespace 'Outer'. +someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. + + @@ -44,11 +45,13 @@ + }; + return Application; + })(); -+==== main.js (0 errors) ==== ++==== main.js (1 errors) ==== + var app = new Outer.app.Application(); + var inner = new Outer.app.Inner(); + inner.y; + /** @type {Outer.app.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var x; + x.y; + Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt index dc608b527e..aa43d4abec 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt @@ -1,3 +1,4 @@ +use.js(1,12): error TS2503: Cannot find namespace 'Outer'. use.js(5,22): error TS2339: Property 'Inner' does not exist on type '{}'. work.js(1,7): error TS2339: Property 'Inner' does not exist on type '{}'. work.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. @@ -17,8 +18,10 @@ work.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. m() { } } -==== use.js (1 errors) ==== +==== use.js (2 errors) ==== /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var inner inner.x inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt.diff index 1b358dcf1a..709710d9f3 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt.diff @@ -3,6 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++use.js(1,12): error TS2503: Cannot find namespace 'Outer'. +use.js(5,22): error TS2339: Property 'Inner' does not exist on type '{}'. +work.js(1,7): error TS2339: Property 'Inner' does not exist on type '{}'. +work.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. @@ -22,8 +23,10 @@ + m() { } + } + -+==== use.js (1 errors) ==== ++==== use.js (2 errors) ==== + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var inner + inner.x + inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt index 9a82edb3d4..fb4921e205 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt @@ -1,9 +1,10 @@ a.js(3,7): error TS2339: Property 'Inner' does not exist on type '{}'. a.js(5,14): error TS2339: Property 'x' does not exist on type 'Inner'. +a.js(10,12): error TS2503: Cannot find namespace 'Outer'. a.js(14,22): error TS2339: Property 'Inner' does not exist on type '{}'. -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== var Outer = {}; Outer.Inner = class { @@ -18,6 +19,8 @@ a.js(14,22): error TS2339: Property 'Inner' does not exist on type '{}'. } /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var inner inner.x inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt.diff index c885063aab..5079f95655 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt.diff @@ -5,10 +5,11 @@ @@= skipped --1, +1 lines =@@ +a.js(3,7): error TS2339: Property 'Inner' does not exist on type '{}'. +a.js(5,14): error TS2339: Property 'x' does not exist on type 'Inner'. ++a.js(10,12): error TS2503: Cannot find namespace 'Outer'. +a.js(14,22): error TS2339: Property 'Inner' does not exist on type '{}'. + + -+==== a.js (3 errors) ==== ++==== a.js (4 errors) ==== + var Outer = {}; + + Outer.Inner = class { @@ -23,6 +24,8 @@ + } + + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var inner + inner.x + inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt index 05184f45d8..c54db8a4a9 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt @@ -1,9 +1,10 @@ a.js(3,7): error TS2339: Property 'Inner' does not exist on type '{}'. a.js(4,7): error TS2339: Property 'Inner' does not exist on type '{}'. +a.js(9,12): error TS2503: Cannot find namespace 'Outer'. a.js(13,22): error TS2339: Property 'Inner' does not exist on type '{}'. -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== var Outer = {}; Outer.Inner = function () {} @@ -17,6 +18,8 @@ a.js(13,22): error TS2339: Property 'Inner' does not exist on type '{}'. } /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var inner inner.x inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt.diff index d6e59f438d..4e3e2fba37 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt.diff @@ -5,10 +5,11 @@ @@= skipped --1, +1 lines =@@ +a.js(3,7): error TS2339: Property 'Inner' does not exist on type '{}'. +a.js(4,7): error TS2339: Property 'Inner' does not exist on type '{}'. ++a.js(9,12): error TS2503: Cannot find namespace 'Outer'. +a.js(13,22): error TS2339: Property 'Inner' does not exist on type '{}'. + + -+==== a.js (3 errors) ==== ++==== a.js (4 errors) ==== + var Outer = {}; + + Outer.Inner = function () {} @@ -22,6 +23,8 @@ + } + + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var inner + inner.x + inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt index 477e317e0e..8cb50e996a 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt @@ -1,7 +1,9 @@ a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. +a.js(9,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? +a.js(12,12): error TS2503: Cannot find namespace 'Outer'. -==== a.js (1 errors) ==== +==== a.js (3 errors) ==== function Outer() { this.y = 2 } @@ -13,9 +15,13 @@ a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. } } /** @type {Outer} */ + ~~~~~ +!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? var ok ok.y /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var oc oc.x \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt.diff index 4fb290638b..cca49f15f0 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt.diff @@ -4,9 +4,11 @@ - @@= skipped --1, +1 lines =@@ +a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. ++a.js(9,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? ++a.js(12,12): error TS2503: Cannot find namespace 'Outer'. + + -+==== a.js (1 errors) ==== ++==== a.js (3 errors) ==== + function Outer() { + this.y = 2 + } @@ -18,9 +20,13 @@ + } + } + /** @type {Outer} */ ++ ~~~~~ ++!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? + var ok + ok.y + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var oc + oc.x + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt index d4e17911fb..4de02a5a06 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt @@ -1,9 +1,10 @@ def.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. usage.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. usage.js(5,19): error TS2339: Property 'Inner' does not exist on type '{}'. +usage.js(7,12): error TS2503: Cannot find namespace 'Outer'. -==== usage.js (2 errors) ==== +==== usage.js (3 errors) ==== // note that usage is first in the compilation Outer.Inner.Message = function() { ~~~~~ @@ -15,6 +16,8 @@ usage.js(5,19): error TS2339: Property 'Inner' does not exist on type '{}'. !!! error TS2339: Property 'Inner' does not exist on type '{}'. y.name /** @type {Outer.Inner} should be instance type, not static type */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var x; x.name diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt.diff index 794b24d9de..3a0a45820f 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt.diff @@ -6,9 +6,10 @@ +def.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. +usage.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. +usage.js(5,19): error TS2339: Property 'Inner' does not exist on type '{}'. ++usage.js(7,12): error TS2503: Cannot find namespace 'Outer'. + + -+==== usage.js (2 errors) ==== ++==== usage.js (3 errors) ==== + // note that usage is first in the compilation + Outer.Inner.Message = function() { + ~~~~~ @@ -20,6 +21,8 @@ +!!! error TS2339: Property 'Inner' does not exist on type '{}'. + y.name + /** @type {Outer.Inner} should be instance type, not static type */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var x; + x.name + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt index e9e2972b40..f02f8f9f4d 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt @@ -1,8 +1,10 @@ a.js(4,7): error TS2339: Property 'Inner' does not exist on type '() => void'. a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. +a.js(9,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? +a.js(12,12): error TS2503: Cannot find namespace 'Outer'. -==== a.js (2 errors) ==== +==== a.js (4 errors) ==== var Outer = function O() { this.y = 2 } @@ -16,9 +18,13 @@ a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. } } /** @type {Outer} */ + ~~~~~ +!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? var ja ja.y /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var da da.x \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt.diff index f2a1bb765e..4531ff7bdf 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt.diff @@ -5,9 +5,11 @@ @@= skipped --1, +1 lines =@@ +a.js(4,7): error TS2339: Property 'Inner' does not exist on type '() => void'. +a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. ++a.js(9,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? ++a.js(12,12): error TS2503: Cannot find namespace 'Outer'. + + -+==== a.js (2 errors) ==== ++==== a.js (4 errors) ==== + var Outer = function O() { + this.y = 2 + } @@ -21,9 +23,13 @@ + } + } + /** @type {Outer} */ ++ ~~~~~ ++!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? + var ja + ja.y + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var da + da.x + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt index 91587b0f27..3b644b682e 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt @@ -1,13 +1,15 @@ a.js(1,7): error TS2339: Property 'Inner' does not exist on type '{}'. a.js(4,14): error TS2339: Property 'y' does not exist on type 'Inner'. +a.js(8,12): error TS2503: Cannot find namespace 'Outer'. a.js(11,23): error TS2339: Property 'Inner' does not exist on type '{}'. +b.js(1,12): error TS2503: Cannot find namespace 'Outer'. b.js(4,19): error TS2339: Property 'Inner' does not exist on type '{}'. ==== def.js (0 errors) ==== var Outer = {}; -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== Outer.Inner = class { ~~~~~ !!! error TS2339: Property 'Inner' does not exist on type '{}'. @@ -20,6 +22,8 @@ b.js(4,19): error TS2339: Property 'Inner' does not exist on type '{}'. } /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var local local.y var inner = new Outer.Inner() @@ -27,8 +31,10 @@ b.js(4,19): error TS2339: Property 'Inner' does not exist on type '{}'. !!! error TS2339: Property 'Inner' does not exist on type '{}'. inner.y -==== b.js (1 errors) ==== +==== b.js (2 errors) ==== /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var x x.y var z = new Outer.Inner() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt.diff index ac91c9aa73..1160915612 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt.diff @@ -5,14 +5,16 @@ @@= skipped --1, +1 lines =@@ +a.js(1,7): error TS2339: Property 'Inner' does not exist on type '{}'. +a.js(4,14): error TS2339: Property 'y' does not exist on type 'Inner'. ++a.js(8,12): error TS2503: Cannot find namespace 'Outer'. +a.js(11,23): error TS2339: Property 'Inner' does not exist on type '{}'. ++b.js(1,12): error TS2503: Cannot find namespace 'Outer'. +b.js(4,19): error TS2339: Property 'Inner' does not exist on type '{}'. + + +==== def.js (0 errors) ==== + var Outer = {}; + -+==== a.js (3 errors) ==== ++==== a.js (4 errors) ==== + Outer.Inner = class { + ~~~~~ +!!! error TS2339: Property 'Inner' does not exist on type '{}'. @@ -25,6 +27,8 @@ + } + + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var local + local.y + var inner = new Outer.Inner() @@ -32,8 +36,10 @@ +!!! error TS2339: Property 'Inner' does not exist on type '{}'. + inner.y + -+==== b.js (1 errors) ==== ++==== b.js (2 errors) ==== + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var x + x.y + var z = new Outer.Inner() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt new file mode 100644 index 0000000000..9e6a8111a7 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt @@ -0,0 +1,14 @@ +typeFromPropertyAssignment40.js(5,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? + + +==== typeFromPropertyAssignment40.js (1 errors) ==== + function Outer() { + var self = this + self.y = 2 + } + /** @type {Outer} */ + ~~~~~ +!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? + var ok + ok.y + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt.diff new file mode 100644 index 0000000000..c0e369b6ff --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt.diff @@ -0,0 +1,19 @@ +--- old.typeFromPropertyAssignment40.errors.txt ++++ new.typeFromPropertyAssignment40.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++typeFromPropertyAssignment40.js(5,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? ++ ++ ++==== typeFromPropertyAssignment40.js (1 errors) ==== ++ function Outer() { ++ var self = this ++ self.y = 2 ++ } ++ /** @type {Outer} */ ++ ~~~~~ ++!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? ++ var ok ++ ok.y ++ diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt index 2718f63de1..aa5afa7a03 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt @@ -6,6 +6,7 @@ error TS2318: Cannot find global type 'String'. error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? error TS2552: Cannot find name 'Number'. Did you mean 'number'? error TS2552: Cannot find name 'Object'. Did you mean 'object'? +b.js(3,12): error TS2503: Cannot find namespace 'MC'. !!! error TS2318: Cannot find global type 'Array'. @@ -23,9 +24,11 @@ error TS2552: Cannot find name 'Object'. Did you mean 'object'? } MyClass.bar -==== b.js (0 errors) ==== +==== b.js (1 errors) ==== import MC from './a' MC.bar /** @type {MC.bar} */ + ~~ +!!! error TS2503: Cannot find namespace 'MC'. var x \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt.diff index 221fb2bac2..37b290ccf7 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt.diff @@ -11,6 +11,7 @@ +error TS2552: Cannot find name 'Boolean'. Did you mean 'boolean'? +error TS2552: Cannot find name 'Number'. Did you mean 'number'? +error TS2552: Cannot find name 'Object'. Did you mean 'object'? ++b.js(3,12): error TS2503: Cannot find namespace 'MC'. + + +!!! error TS2318: Cannot find global type 'Array'. @@ -28,9 +29,11 @@ + } + MyClass.bar + -+==== b.js (0 errors) ==== ++==== b.js (1 errors) ==== + import MC from './a' + MC.bar + /** @type {MC.bar} */ ++ ~~ ++!!! error TS2503: Cannot find namespace 'MC'. + var x + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt index 594bf0fd6f..c10ea07ed6 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt @@ -3,9 +3,10 @@ index.js(2,8): error TS2339: Property 'Object' does not exist on type '{}'. index.js(2,37): error TS2339: Property 'Item' does not exist on type '{}'. index.js(4,11): error TS2339: Property 'Object' does not exist on type '{}'. index.js(4,41): error TS2339: Property 'Object' does not exist on type '{}'. +index.js(6,12): error TS2503: Cannot find namespace 'Workspace'. -==== index.js (5 errors) ==== +==== index.js (6 errors) ==== First.Item = class I {} ~~~~ !!! error TS2339: Property 'Item' does not exist on type '{}'. @@ -22,6 +23,8 @@ index.js(4,41): error TS2339: Property 'Object' does not exist on type '{}'. !!! error TS2339: Property 'Object' does not exist on type '{}'. /** @type {Workspace.Object} */ + ~~~~~~~~~ +!!! error TS2503: Cannot find namespace 'Workspace'. var am; ==== roots.js (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt.diff index 79eee8a1cf..1369c11c34 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt.diff @@ -8,9 +8,10 @@ +index.js(2,37): error TS2339: Property 'Item' does not exist on type '{}'. +index.js(4,11): error TS2339: Property 'Object' does not exist on type '{}'. +index.js(4,41): error TS2339: Property 'Object' does not exist on type '{}'. ++index.js(6,12): error TS2503: Cannot find namespace 'Workspace'. + + -+==== index.js (5 errors) ==== ++==== index.js (6 errors) ==== + First.Item = class I {} + ~~~~ +!!! error TS2339: Property 'Item' does not exist on type '{}'. @@ -27,6 +28,8 @@ +!!! error TS2339: Property 'Object' does not exist on type '{}'. + + /** @type {Workspace.Object} */ ++ ~~~~~~~~~ ++!!! error TS2503: Cannot find namespace 'Workspace'. + var am; + +==== roots.js (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt index 65166b0f35..06d9f8dff5 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt @@ -1,7 +1,7 @@ bug26885.js(2,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -bug26885.js(10,5): error TS7023: 'get' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. bug26885.js(10,9): error TS7006: Parameter 'key' implicitly has an 'any' type. -bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => error; }'. +bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => number; }'. +bug26885.js(15,12): error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? bug26885.js(16,13): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. @@ -18,17 +18,17 @@ bug26885.js(16,13): error TS7009: 'new' expression, whose target lacks a constru * @returns {number} the value ok */ get(key) { - ~~~ -!!! error TS7023: 'get' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. ~~~ !!! error TS7006: Parameter 'key' implicitly has an 'any' type. return this._map[key + '']; ~~~~ -!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => error; }'. +!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => number; }'. } } /** @type {Multimap3} */ + ~~~~~~~~~ +!!! error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? const map = new Multimap3(); ~~~~~~~~~~~~~~~ !!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt.diff index 4966a150ce..777a15a0d2 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt.diff @@ -4,9 +4,9 @@ -bug26885.js(11,16): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. - No index signature with a parameter of type 'string' was found on type '{}'. +bug26885.js(2,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+bug26885.js(10,5): error TS7023: 'get' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +bug26885.js(10,9): error TS7006: Parameter 'key' implicitly has an 'any' type. -+bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => error; }'. ++bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => number; }'. ++bug26885.js(15,12): error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? +bug26885.js(16,13): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. @@ -23,8 +23,6 @@ * @returns {number} the value ok */ get(key) { -+ ~~~ -+!!! error TS7023: 'get' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. + ~~~ +!!! error TS7006: Parameter 'key' implicitly has an 'any' type. return this._map[key + '']; @@ -32,11 +30,13 @@ -!!! error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. -!!! error TS7053: No index signature with a parameter of type 'string' was found on type '{}'. + ~~~~ -+!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => error; }'. ++!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => number; }'. } } /** @type {Multimap3} */ ++ ~~~~~~~~~ ++!!! error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? const map = new Multimap3(); + ~~~~~~~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt b/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt new file mode 100644 index 0000000000..b8f89f9c63 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt @@ -0,0 +1,11 @@ +a.js(3,12): error TS2503: Cannot find namespace 'ns'. + + +==== a.js (1 errors) ==== + // #22973 + var ns = (function() {})(); + /** @type {ns.NotFound} */ + ~~ +!!! error TS2503: Cannot find namespace 'ns'. + var crash; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt.diff index 5710e50dc9..9db1564091 100644 --- a/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt.diff @@ -1,16 +1,17 @@ --- old.typeLookupInIIFE.errors.txt +++ new.typeLookupInIIFE.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -a.js(3,15): error TS2694: Namespace 'ns' has no exported member 'NotFound'. -- -- --==== a.js (1 errors) ==== -- // #22973 -- var ns = (function() {})(); -- /** @type {ns.NotFound} */ ++a.js(3,12): error TS2503: Cannot find namespace 'ns'. + + + ==== a.js (1 errors) ==== + // #22973 + var ns = (function() {})(); + /** @type {ns.NotFound} */ - ~~~~~~~~ -!!! error TS2694: Namespace 'ns' has no exported member 'NotFound'. -- var crash; -- -@@= skipped --1, +1 lines =@@ -+ ++ ~~ ++!!! error TS2503: Cannot find namespace 'ns'. + var crash; + diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt new file mode 100644 index 0000000000..de325584fa --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt @@ -0,0 +1,14 @@ +typeTagNoErasure.js(3,12): error TS2304: Cannot find name 'Test'. + + +==== typeTagNoErasure.js (1 errors) ==== + /** @template T @typedef {(data: T1) => T1} Test */ + + /** @type {Test} */ + ~~~~ +!!! error TS2304: Cannot find name 'Test'. + const test = dibbity => dibbity + + test(1) // ok, T=1 + test('hi') // error, T=number + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt.diff index 67ef76739b..dad0be3c83 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt.diff @@ -1,19 +1,20 @@ --- old.typeTagNoErasure.errors.txt +++ new.typeTagNoErasure.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -typeTagNoErasure.js(7,6): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -- -- --==== typeTagNoErasure.js (1 errors) ==== -- /** @template T @typedef {(data: T1) => T1} Test */ -- -- /** @type {Test} */ -- const test = dibbity => dibbity -- -- test(1) // ok, T=1 -- test('hi') // error, T=number ++typeTagNoErasure.js(3,12): error TS2304: Cannot find name 'Test'. + + + ==== typeTagNoErasure.js (1 errors) ==== + /** @template T @typedef {(data: T1) => T1} Test */ + + /** @type {Test} */ ++ ~~~~ ++!!! error TS2304: Cannot find name 'Test'. + const test = dibbity => dibbity + + test(1) // ok, T=1 + test('hi') // error, T=number - ~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -- -@@= skipped --1, +1 lines =@@ -+ + diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt new file mode 100644 index 0000000000..dbe7d7c99d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt @@ -0,0 +1,22 @@ +typeTagOnFunctionReferencesGeneric.js(11,11): error TS2304: Cannot find name 'IFn'. + + +==== typeTagOnFunctionReferencesGeneric.js (1 errors) ==== + /** + * @typedef {(m : T) => T} IFn + */ + + /**@type {IFn}*/ + export function inJs(l) { + return l; + } + inJs(1); // lints error. Why? + + /**@type {IFn}*/ + ~~~ +!!! error TS2304: Cannot find name 'IFn'. + const inJsArrow = (j) => { + return j; + } + inJsArrow(2); // no error gets linted as expected + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt.diff new file mode 100644 index 0000000000..5d13f650bc --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt.diff @@ -0,0 +1,27 @@ +--- old.typeTagOnFunctionReferencesGeneric.errors.txt ++++ new.typeTagOnFunctionReferencesGeneric.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++typeTagOnFunctionReferencesGeneric.js(11,11): error TS2304: Cannot find name 'IFn'. ++ ++ ++==== typeTagOnFunctionReferencesGeneric.js (1 errors) ==== ++ /** ++ * @typedef {(m : T) => T} IFn ++ */ ++ ++ /**@type {IFn}*/ ++ export function inJs(l) { ++ return l; ++ } ++ inJs(1); // lints error. Why? ++ ++ /**@type {IFn}*/ ++ ~~~ ++!!! error TS2304: Cannot find name 'IFn'. ++ const inJsArrow = (j) => { ++ return j; ++ } ++ inJsArrow(2); // no error gets linted as expected ++ diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt index 0477d0beb9..41a0394ca8 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt @@ -1,4 +1,7 @@ mod3.js(6,1): error TS2304: Cannot find name 'exports'. +use.js(1,19): error TS2306: File 'mod1.js' is not a module. +use.js(3,29): error TS2694: Namespace '""mod2.js""' has no exported member 'Both'. +use.js(5,19): error TS2306: File 'mod3.js' is not a module. ==== commonjs.d.ts (0 errors) ==== @@ -35,12 +38,18 @@ mod3.js(6,1): error TS2304: Cannot find name 'exports'. this.p = 1 } -==== use.js (0 errors) ==== +==== use.js (3 errors) ==== /** @type {import('./mod1').Both} */ + ~~~~~~~~ +!!! error TS2306: File 'mod1.js' is not a module. var both1 = { type: 'a', x: 1 }; /** @type {import('./mod2').Both} */ + ~~~~ +!!! error TS2694: Namespace '""mod2.js""' has no exported member 'Both'. var both2 = both1; /** @type {import('./mod3').Both} */ + ~~~~~~~~ +!!! error TS2306: File 'mod3.js' is not a module. var both3 = both2; diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff index 47b8f2f3bc..7667415996 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff @@ -4,6 +4,9 @@ - @@= skipped --1, +1 lines =@@ +mod3.js(6,1): error TS2304: Cannot find name 'exports'. ++use.js(1,19): error TS2306: File 'mod1.js' is not a module. ++use.js(3,29): error TS2694: Namespace '""mod2.js""' has no exported member 'Both'. ++use.js(5,19): error TS2306: File 'mod3.js' is not a module. + + +==== commonjs.d.ts (0 errors) ==== @@ -40,12 +43,18 @@ + this.p = 1 + } + -+==== use.js (0 errors) ==== ++==== use.js (3 errors) ==== + /** @type {import('./mod1').Both} */ ++ ~~~~~~~~ ++!!! error TS2306: File 'mod1.js' is not a module. + var both1 = { type: 'a', x: 1 }; + /** @type {import('./mod2').Both} */ ++ ~~~~ ++!!! error TS2694: Namespace '""mod2.js""' has no exported member 'Both'. + var both2 = both1; + /** @type {import('./mod3').Both} */ ++ ~~~~~~~~ ++!!! error TS2306: File 'mod3.js' is not a module. + var both3 = both2; + + diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt index bdbed02782..98a50caafd 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt @@ -1,13 +1,19 @@ use.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +use.js(2,19): error TS2307: Cannot find module './mod1.js' or its corresponding type declarations. +use.js(4,12): error TS2503: Cannot find namespace 'mod'. -==== use.js (1 errors) ==== +==== use.js (3 errors) ==== var mod = require('./mod1.js'); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @type {import("./mod1.js").Baz} */ + ~~~~~~~~~~~ +!!! error TS2307: Cannot find module './mod1.js' or its corresponding type declarations. var b; /** @type {mod.Baz} */ + ~~~ +!!! error TS2503: Cannot find namespace 'mod'. var bb; var bbb = new mod.Baz(); diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt.diff index ecc36a9d6a..5b880ebdd3 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt.diff @@ -6,16 +6,22 @@ -mod1.js(9,23): error TS2300: Duplicate identifier 'Baz'. -mod1.js(11,5): error TS2300: Duplicate identifier 'Baz'. +use.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++use.js(2,19): error TS2307: Cannot find module './mod1.js' or its corresponding type declarations. ++use.js(4,12): error TS2503: Cannot find namespace 'mod'. -==== use.js (0 errors) ==== -+==== use.js (1 errors) ==== ++==== use.js (3 errors) ==== var mod = require('./mod1.js'); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @type {import("./mod1.js").Baz} */ ++ ~~~~~~~~~~~ ++!!! error TS2307: Cannot find module './mod1.js' or its corresponding type declarations. var b; /** @type {mod.Baz} */ ++ ~~~ ++!!! error TS2503: Cannot find namespace 'mod'. var bb; var bbb = new mod.Baz(); diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt index 222260e5aa..f8e5a8a165 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt @@ -1,7 +1,10 @@ +a.js(9,12): error TS2304: Cannot find name 'Everything'. +a.js(12,12): error TS2304: Cannot find name 'Everything'. +a.js(15,12): error TS2304: Cannot find name 'Everything'. test.ts(1,23): error TS2304: Cannot find name 'Everything'. -==== a.js (0 errors) ==== +==== a.js (3 errors) ==== /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? @@ -11,12 +14,18 @@ test.ts(1,23): error TS2304: Cannot find name 'Everything'. */ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ + ~~~~~~~~~~ +!!! error TS2304: Cannot find name 'Everything'. var tuvwx; /** @type {Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>} */ + ~~~~~~~~~~ +!!! error TS2304: Cannot find name 'Everything'. var wrong; /** @type {Everything<{ a: number }>} */ + ~~~~~~~~~~ +!!! error TS2304: Cannot find name 'Everything'. var insufficient; ==== test.ts (1 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt.diff index dff9383d64..1e2c000cb7 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt.diff @@ -6,15 +6,23 @@ -a.js(15,12): error TS2314: Generic type 'Everything' requires 5 type argument(s). -test.ts(1,34): error TS2344: Type '{ a: number; }' does not satisfy the constraint '{ a: number; b: string; }'. - Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. ++a.js(9,12): error TS2304: Cannot find name 'Everything'. ++a.js(12,12): error TS2304: Cannot find name 'Everything'. ++a.js(15,12): error TS2304: Cannot find name 'Everything'. +test.ts(1,23): error TS2304: Cannot find name 'Everything'. -==== a.js (2 errors) ==== -+==== a.js (0 errors) ==== ++==== a.js (3 errors) ==== /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? -@@= skipped -17, +13 lines =@@ +@@= skipped -14, +13 lines =@@ + */ + + /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ ++ ~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Everything'. var tuvwx; /** @type {Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>} */ @@ -22,11 +30,15 @@ -!!! error TS2344: Type '{ a: number; }' does not satisfy the constraint '{ a: number; b: string; }'. -!!! error TS2344: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -!!! related TS2728 a.js:2:28: 'b' is declared here. ++ ~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Everything'. var wrong; /** @type {Everything<{ a: number }>} */ - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2314: Generic type 'Everything' requires 5 type argument(s). ++ ~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Everything'. var insufficient; ==== test.ts (1 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt new file mode 100644 index 0000000000..12655bf398 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt @@ -0,0 +1,13 @@ +typedefOnSemicolonClassElement.js(4,14): error TS2304: Cannot find name 'A'. + + +==== typedefOnSemicolonClassElement.js (1 errors) ==== + export class Preferences { + /** @typedef {string} A */ + ; + /** @type {A} */ + ~ +!!! error TS2304: Cannot find name 'A'. + a = 'ok' + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt.diff new file mode 100644 index 0000000000..e517e57756 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt.diff @@ -0,0 +1,18 @@ +--- old.typedefOnSemicolonClassElement.errors.txt ++++ new.typedefOnSemicolonClassElement.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++typedefOnSemicolonClassElement.js(4,14): error TS2304: Cannot find name 'A'. ++ ++ ++==== typedefOnSemicolonClassElement.js (1 errors) ==== ++ export class Preferences { ++ /** @typedef {string} A */ ++ ; ++ /** @type {A} */ ++ ~ ++!!! error TS2304: Cannot find name 'A'. ++ a = 'ok' ++ } ++ diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt index 696bd4aaa3..fa7e4dd7ee 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt @@ -18,9 +18,10 @@ typedefOnStatements.js(71,43): error TS7006: Parameter 'n' implicitly has an 'an typedefOnStatements.js(71,45): error TS7006: Parameter 'o' implicitly has an 'any' type. typedefOnStatements.js(71,47): error TS7006: Parameter 'p' implicitly has an 'any' type. typedefOnStatements.js(71,49): error TS7006: Parameter 'q' implicitly has an 'any' type. +typedefOnStatements.js(73,16): error TS2304: Cannot find name 'Alpha'. -==== typedefOnStatements.js (20 errors) ==== +==== typedefOnStatements.js (21 errors) ==== /** @typedef {{a: string}} A */ ; /** @typedef {{ b: string }} B */ @@ -134,6 +135,8 @@ typedefOnStatements.js(71,49): error TS7006: Parameter 'q' implicitly has an 'an !!! error TS7006: Parameter 'q' implicitly has an 'any' type. console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) /** @type {Alpha} */ + ~~~~~ +!!! error TS2304: Cannot find name 'Alpha'. var alpha = { alpha: "aleph" } /** @typedef {{ alpha: string }} Alpha */ return diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt.diff index 0c269f295f..752f44351d 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt.diff @@ -22,14 +22,15 @@ +typedefOnStatements.js(71,45): error TS7006: Parameter 'o' implicitly has an 'any' type. +typedefOnStatements.js(71,47): error TS7006: Parameter 'p' implicitly has an 'any' type. +typedefOnStatements.js(71,49): error TS7006: Parameter 'q' implicitly has an 'any' type. ++typedefOnStatements.js(73,16): error TS2304: Cannot find name 'Alpha'. -==== typedefOnStatements.js (4 errors) ==== -+==== typedefOnStatements.js (20 errors) ==== ++==== typedefOnStatements.js (21 errors) ==== /** @typedef {{a: string}} A */ ; /** @typedef {{ b: string }} B */ -@@= skipped -41, +57 lines =@@ +@@= skipped -41, +58 lines =@@ !!! error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. /** @typedef {{ m: string }} M */ with (name) { @@ -78,4 +79,8 @@ +!!! error TS7006: Parameter 'q' implicitly has an 'any' type. console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) /** @type {Alpha} */ ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Alpha'. var alpha = { alpha: "aleph" } + /** @typedef {{ alpha: string }} Alpha */ + return diff --git a/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt new file mode 100644 index 0000000000..90065b5b9c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt @@ -0,0 +1,27 @@ +typedefScope1.js(3,16): error TS2304: Cannot find name 'B'. +typedefScope1.js(9,16): error TS2304: Cannot find name 'B'. +typedefScope1.js(13,12): error TS2304: Cannot find name 'B'. + + +==== typedefScope1.js (3 errors) ==== + function B1() { + /** @typedef {number} B */ + /** @type {B} */ + ~ +!!! error TS2304: Cannot find name 'B'. + var ok1 = 0; + } + + function B2() { + /** @typedef {string} B */ + /** @type {B} */ + ~ +!!! error TS2304: Cannot find name 'B'. + var ok2 = 'hi'; + } + + /** @type {B} */ + ~ +!!! error TS2304: Cannot find name 'B'. + var notOK = 0; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt.diff index e138e63ed9..4ecf22eef8 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt.diff @@ -1,26 +1,26 @@ --- old.typedefScope1.errors.txt +++ new.typedefScope1.errors.txt -@@= skipped -0, +-1 lines =@@ --typedefScope1.js(13,12): error TS2304: Cannot find name 'B'. -- -- +@@= skipped -0, +0 lines =@@ ++typedefScope1.js(3,16): error TS2304: Cannot find name 'B'. ++typedefScope1.js(9,16): error TS2304: Cannot find name 'B'. + typedefScope1.js(13,12): error TS2304: Cannot find name 'B'. + + -==== typedefScope1.js (1 errors) ==== -- function B1() { -- /** @typedef {number} B */ -- /** @type {B} */ -- var ok1 = 0; -- } -- -- function B2() { -- /** @typedef {string} B */ -- /** @type {B} */ -- var ok2 = 'hi'; -- } -- -- /** @type {B} */ -- ~ --!!! error TS2304: Cannot find name 'B'. -- var notOK = 0; -- -@@= skipped --1, +1 lines =@@ -+ ++==== typedefScope1.js (3 errors) ==== + function B1() { + /** @typedef {number} B */ + /** @type {B} */ ++ ~ ++!!! error TS2304: Cannot find name 'B'. + var ok1 = 0; + } + + function B2() { + /** @typedef {string} B */ + /** @type {B} */ ++ ~ ++!!! error TS2304: Cannot find name 'B'. + var ok2 = 'hi'; + } + diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt index b2014ce27d..01da705943 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt @@ -1,4 +1,4 @@ -typedefTagExtraneousProperty.js(8,3): error TS2339: Property 'ignoreMe' does not exist on type '{ bye: string; }'. +typedefTagExtraneousProperty.js(5,12): error TS2304: Cannot find name 'Mmap'. ==== typedefTagExtraneousProperty.js (1 errors) ==== @@ -7,10 +7,10 @@ typedefTagExtraneousProperty.js(8,3): error TS2339: Property 'ignoreMe' does not */ /** @type {Mmap} */ + ~~~~ +!!! error TS2304: Cannot find name 'Mmap'. var y = { bye: "no" }; y y.ignoreMe = "ok but just because of the index signature" - ~~~~~~~~ -!!! error TS2339: Property 'ignoreMe' does not exist on type '{ bye: string; }'. y['hi'] = "yes" \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt.diff index 676cf65d09..b638cc4c9e 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+typedefTagExtraneousProperty.js(8,3): error TS2339: Property 'ignoreMe' does not exist on type '{ bye: string; }'. ++typedefTagExtraneousProperty.js(5,12): error TS2304: Cannot find name 'Mmap'. + + +==== typedefTagExtraneousProperty.js (1 errors) ==== @@ -12,10 +12,10 @@ + */ + + /** @type {Mmap} */ ++ ~~~~ ++!!! error TS2304: Cannot find name 'Mmap'. + var y = { bye: "no" }; + y + y.ignoreMe = "ok but just because of the index signature" -+ ~~~~~~~~ -+!!! error TS2339: Property 'ignoreMe' does not exist on type '{ bye: string; }'. + y['hi'] = "yes" + diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt new file mode 100644 index 0000000000..a0183ea0d0 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt @@ -0,0 +1,52 @@ +a.js(9,12): error TS2304: Cannot find name 'App'. +a.js(26,12): error TS2304: Cannot find name 'Opp'. +a.js(35,12): error TS2304: Cannot find name 'Upp'. + + +==== a.js (3 errors) ==== + /** @typedef {Object} App + * @property {string} name + * @property {Object} icons + * @property {string} icons.image32 + * @property {string} icons.image64 + */ + var ex; + + /** @type {App} */ + ~~~ +!!! error TS2304: Cannot find name 'App'. + const app = { + name: 'name', + icons: { + image32: 'x.png', + image64: 'y.png', + } + } + + /** @typedef {Object} Opp + * @property {string} name + * @property {Object} oops + * @property {string} horrible + * @type {string} idea + */ + var intercessor = 1 + + /** @type {Opp} */ + ~~~ +!!! error TS2304: Cannot find name 'Opp'. + var mistake; + + /** @typedef {Object} Upp + * @property {string} name + * @property {Object} not + * @property {string} nested + */ + + /** @type {Upp} */ + ~~~ +!!! error TS2304: Cannot find name 'Upp'. + var sala = { name: 'uppsala', not: 0, nested: "ok" }; + sala.name + sala.not + sala.nested + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt.diff new file mode 100644 index 0000000000..d9198a6693 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt.diff @@ -0,0 +1,57 @@ +--- old.typedefTagNested.errors.txt ++++ new.typedefTagNested.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++a.js(9,12): error TS2304: Cannot find name 'App'. ++a.js(26,12): error TS2304: Cannot find name 'Opp'. ++a.js(35,12): error TS2304: Cannot find name 'Upp'. ++ ++ ++==== a.js (3 errors) ==== ++ /** @typedef {Object} App ++ * @property {string} name ++ * @property {Object} icons ++ * @property {string} icons.image32 ++ * @property {string} icons.image64 ++ */ ++ var ex; ++ ++ /** @type {App} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'App'. ++ const app = { ++ name: 'name', ++ icons: { ++ image32: 'x.png', ++ image64: 'y.png', ++ } ++ } ++ ++ /** @typedef {Object} Opp ++ * @property {string} name ++ * @property {Object} oops ++ * @property {string} horrible ++ * @type {string} idea ++ */ ++ var intercessor = 1 ++ ++ /** @type {Opp} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Opp'. ++ var mistake; ++ ++ /** @typedef {Object} Upp ++ * @property {string} name ++ * @property {Object} not ++ * @property {string} nested ++ */ ++ ++ /** @type {Upp} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Upp'. ++ var sala = { name: 'uppsala', not: 0, nested: "ok" }; ++ sala.name ++ sala.not ++ sala.nested ++ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols index d170655538..e198bfe33c 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols @@ -55,17 +55,11 @@ var sala = { name: 'uppsala', not: 0, nested: "ok" }; >nested : Symbol(nested, Decl(a.js, 35, 37)) sala.name ->sala.name : Symbol(name, Decl(a.js, 35, 12)) >sala : Symbol(sala, Decl(a.js, 35, 3)) ->name : Symbol(name, Decl(a.js, 35, 12)) sala.not ->sala.not : Symbol(not, Decl(a.js, 35, 29)) >sala : Symbol(sala, Decl(a.js, 35, 3)) ->not : Symbol(not, Decl(a.js, 35, 29)) sala.nested ->sala.nested : Symbol(nested, Decl(a.js, 35, 37)) >sala : Symbol(sala, Decl(a.js, 35, 3)) ->nested : Symbol(nested, Decl(a.js, 35, 37)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff index f3c78345d8..2e6e626701 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff @@ -5,22 +5,16 @@ sala.name ->sala.name : Symbol(name, Decl(a.js, 29, 3)) -+>sala.name : Symbol(name, Decl(a.js, 35, 12)) >sala : Symbol(sala, Decl(a.js, 35, 3)) ->name : Symbol(name, Decl(a.js, 29, 3)) -+>name : Symbol(name, Decl(a.js, 35, 12)) sala.not ->sala.not : Symbol(not, Decl(a.js, 30, 3)) -+>sala.not : Symbol(not, Decl(a.js, 35, 29)) >sala : Symbol(sala, Decl(a.js, 35, 3)) ->not : Symbol(not, Decl(a.js, 30, 3)) -+>not : Symbol(not, Decl(a.js, 35, 29)) sala.nested ->sala.nested : Symbol(nested, Decl(a.js, 31, 3)) -+>sala.nested : Symbol(nested, Decl(a.js, 35, 37)) >sala : Symbol(sala, Decl(a.js, 35, 3)) ->nested : Symbol(nested, Decl(a.js, 31, 3)) -+>nested : Symbol(nested, Decl(a.js, 35, 37)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt new file mode 100644 index 0000000000..7bc19b1ced --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt @@ -0,0 +1,40 @@ +github20832.js(6,13): error TS2304: Cannot find name 'T'. +github20832.js(12,11): error TS2304: Cannot find name 'T'. +github20832.js(26,12): error TS2304: Cannot find name 'Cb'. + + +==== github20832.js (3 errors) ==== + // #20832 + /** @typedef {U} T - should be "error, can't find type named 'U' */ + /** + * @template U + * @param {U} x + * @return {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function f(x) { + return x; + } + + /** @type T - should be fine, since T will be any */ + ~ +!!! error TS2304: Cannot find name 'T'. + const x = 3; + + /** + * @callback Cb + * @param {V} firstParam + */ + /** + * @template V + * @param {V} vvvvv + */ + function g(vvvvv) { + } + + /** @type {Cb} */ + ~~ +!!! error TS2304: Cannot find name 'Cb'. + const cb = x => {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt.diff index 0f73f88c40..714b7f1060 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt.diff @@ -1,42 +1,48 @@ --- old.typedefTagTypeResolution.errors.txt +++ new.typedefTagTypeResolution.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -github20832.js(2,15): error TS2304: Cannot find name 'U'. -github20832.js(17,12): error TS2304: Cannot find name 'V'. -- -- ++github20832.js(6,13): error TS2304: Cannot find name 'T'. ++github20832.js(12,11): error TS2304: Cannot find name 'T'. ++github20832.js(26,12): error TS2304: Cannot find name 'Cb'. + + -==== github20832.js (2 errors) ==== -- // #20832 -- /** @typedef {U} T - should be "error, can't find type named 'U' */ ++==== github20832.js (3 errors) ==== + // #20832 + /** @typedef {U} T - should be "error, can't find type named 'U' */ - ~ -!!! error TS2304: Cannot find name 'U'. -- /** -- * @template U -- * @param {U} x -- * @return {T} -- */ -- function f(x) { -- return x; -- } -- -- /** @type T - should be fine, since T will be any */ -- const x = 3; -- -- /** -- * @callback Cb -- * @param {V} firstParam + /** + * @template U + * @param {U} x + * @return {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function f(x) { + return x; + } + + /** @type T - should be fine, since T will be any */ ++ ~ ++!!! error TS2304: Cannot find name 'T'. + const x = 3; + + /** + * @callback Cb + * @param {V} firstParam - ~ -!!! error TS2304: Cannot find name 'V'. -- */ -- /** -- * @template V -- * @param {V} vvvvv -- */ -- function g(vvvvv) { -- } -- -- /** @type {Cb} */ -- const cb = x => {} -- -@@= skipped --1, +1 lines =@@ -+ + */ + /** + * @template V +@@= skipped -32, +33 lines =@@ + } + + /** @type {Cb} */ ++ ~~ ++!!! error TS2304: Cannot find name 'Cb'. + const cb = x => {} + From b15e970f590fe08af44aaf061906d9c66441e122 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 12 Mar 2025 09:41:30 -0700 Subject: [PATCH 04/25] Basic param support Written mostly by AI, without reference to the original source. So it's going to need some cleanup. --- internal/parser/jsdoc.go | 22 +- .../amdLikeInputDeclarationEmit.errors.txt | 5 +- ...mdLikeInputDeclarationEmit.errors.txt.diff | 5 +- .../amdLikeInputDeclarationEmit.symbols | 2 + .../amdLikeInputDeclarationEmit.symbols.diff | 4 +- .../arrowFunctionJSDocAnnotation.errors.txt | 24 -- ...rowFunctionJSDocAnnotation.errors.txt.diff | 29 --- ...yTypedParametersOptionalInJSDoc.errors.txt | 11 +- ...dParametersOptionalInJSDoc.errors.txt.diff | 17 +- ...nferenceFromAnnotatedFunctionJs.errors.txt | 17 +- ...nceFromAnnotatedFunctionJs.errors.txt.diff | 17 +- ...ithAnnotatedOptionalParameterJs.errors.txt | 17 +- ...notatedOptionalParameterJs.errors.txt.diff | 17 +- ...peNode4(strictnullchecks=false).errors.txt | 16 +- ...e4(strictnullchecks=false).errors.txt.diff | 14 +- ...ypeNode4(strictnullchecks=true).errors.txt | 16 +- ...de4(strictnullchecks=true).errors.txt.diff | 14 +- ...onEmitObjectLiteralAccessorsJs1.errors.txt | 59 ----- ...tObjectLiteralAccessorsJs1.errors.txt.diff | 64 ----- ...xpandoFunctionContextualTypesJs.errors.txt | 5 +- ...oFunctionContextualTypesJs.errors.txt.diff | 5 +- ...larationEmitDoesNotRenameImport.errors.txt | 5 +- ...ionEmitDoesNotRenameImport.errors.txt.diff | 5 +- ...tUseNodeModulesPathWithoutError.errors.txt | 6 +- ...odeModulesPathWithoutError.errors.txt.diff | 6 +- ...eCompilationRestParamJsDocFunction.symbols | 12 +- ...ilationRestParamJsDocFunction.symbols.diff | 12 +- .../jsFileFunctionOverloads.errors.txt | 8 +- .../jsFileFunctionOverloads.errors.txt.diff | 8 +- .../compiler/jsFileFunctionOverloads.symbols | 2 + .../jsFileFunctionOverloads.symbols.diff | 2 + .../jsFileFunctionOverloads2.errors.txt | 8 +- .../jsFileFunctionOverloads2.errors.txt.diff | 8 +- .../compiler/jsFileFunctionOverloads2.symbols | 2 + .../jsFileFunctionOverloads2.symbols.diff | 2 + .../jsFileImportPreservedWhenUsed.errors.txt | 12 +- ...ileImportPreservedWhenUsed.errors.txt.diff | 12 +- .../compiler/jsFileMethodOverloads.errors.txt | 8 +- .../jsFileMethodOverloads.errors.txt.diff | 8 +- .../jsFileMethodOverloads2.errors.txt | 8 +- .../jsFileMethodOverloads2.errors.txt.diff | 8 +- .../jsFileMethodOverloads3.errors.txt | 27 -- .../jsFileMethodOverloads3.errors.txt.diff | 50 ++-- ...ocArrayObjectPromiseImplicitAny.errors.txt | 8 +- ...ayObjectPromiseImplicitAny.errors.txt.diff | 8 +- ...ArrayObjectPromiseNoImplicitAny.errors.txt | 17 +- ...ObjectPromiseNoImplicitAny.errors.txt.diff | 45 +--- .../jsdocClassMissingTypeArguments.errors.txt | 12 - ...cClassMissingTypeArguments.errors.txt.diff | 25 +- ...ctionClassPropertiesDeclaration.errors.txt | 8 +- ...ClassPropertiesDeclaration.errors.txt.diff | 8 +- ...ocParamTagOnPropertyInitializer.errors.txt | 11 - ...amTagOnPropertyInitializer.errors.txt.diff | 16 -- ...jsdocParamTagOnPropertyInitializer.symbols | 2 + ...ParamTagOnPropertyInitializer.symbols.diff | 2 + .../jsdocPropertyTagInvalid.errors.txt | 18 ++ .../jsdocPropertyTagInvalid.errors.txt.diff | 34 ++- ...sdocResolveNameFailureInTypedef.errors.txt | 15 ++ ...esolveNameFailureInTypedef.errors.txt.diff | 31 +-- .../compiler/jsdocRestParameter.errors.txt | 5 +- .../jsdocRestParameter.errors.txt.diff | 11 +- .../jsdocRestParameter_es6.errors.txt | 11 - .../jsdocRestParameter_es6.errors.txt.diff | 16 -- .../compiler/jsdocTypeCast.errors.txt | 29 +++ .../compiler/jsdocTypeCast.errors.txt.diff | 47 ++-- ...eNongenericInstantiationAttempt.errors.txt | 76 ++++++ ...enericInstantiationAttempt.errors.txt.diff | 144 +++++----- ...efBeforeParenthesizedExpression.errors.txt | 26 ++ ...oreParenthesizedExpression.errors.txt.diff | 31 +++ ...sizedJSDocCastAtReturnStatement.errors.txt | 5 +- ...JSDocCastAtReturnStatement.errors.txt.diff | 5 +- .../compiler/topLevelBlockExpando.errors.txt | 47 ++++ .../topLevelBlockExpando.errors.txt.diff | 52 ++++ .../assertionTypePredicates2.errors.txt | 5 +- .../assertionTypePredicates2.errors.txt.diff | 5 +- ...ertionsAndNonReturningFunctions.errors.txt | 5 +- ...nsAndNonReturningFunctions.errors.txt.diff | 13 +- .../callbackCrossModule.errors.txt | 5 +- .../callbackCrossModule.errors.txt.diff | 5 +- .../callbackTagNestedParameter.errors.txt | 23 ++ ...callbackTagNestedParameter.errors.txt.diff | 28 ++ .../checkJsdocTypedefInParamTag1.errors.txt | 55 ++++ ...eckJsdocTypedefInParamTag1.errors.txt.diff | 60 +++++ ...assCanExtendConstructorFunction.errors.txt | 17 +- ...nExtendConstructorFunction.errors.txt.diff | 23 +- ...ommonJSImportClassTypeReference.errors.txt | 6 +- ...JSImportClassTypeReference.errors.txt.diff | 6 +- ...JSImportExportedClassExpression.errors.txt | 6 +- ...ortExportedClassExpression.errors.txt.diff | 6 +- ...SImportNestedClassTypeReference.errors.txt | 6 +- ...rtNestedClassTypeReference.errors.txt.diff | 6 +- ...torFunctionMethodTypeParameters.errors.txt | 11 +- ...nctionMethodTypeParameters.errors.txt.diff | 11 +- .../constructorFunctionsStrict.errors.txt | 8 +- ...constructorFunctionsStrict.errors.txt.diff | 11 +- .../submodule/conformance/enumTag.errors.txt | 11 +- .../conformance/enumTag.errors.txt.diff | 22 +- .../conformance/extendsTag5.errors.txt | 51 ++++ .../conformance/extendsTag5.errors.txt.diff | 84 +++--- .../genericSetterInClassTypeJsDoc.errors.txt | 29 +++ ...ericSetterInClassTypeJsDoc.errors.txt.diff | 34 +++ .../conformance/importTag1.errors.txt | 20 ++ .../conformance/importTag1.errors.txt.diff | 25 ++ .../importTag15(module=es2015).errors.txt | 15 ++ ...importTag15(module=es2015).errors.txt.diff | 30 ++- .../importTag15(module=esnext).errors.txt | 15 ++ ...importTag15(module=esnext).errors.txt.diff | 30 ++- .../conformance/importTag16.errors.txt | 21 ++ .../conformance/importTag16.errors.txt.diff | 26 ++ .../conformance/importTag18.errors.txt | 20 ++ .../conformance/importTag18.errors.txt.diff | 25 ++ .../conformance/importTag19.errors.txt | 19 ++ .../conformance/importTag19.errors.txt.diff | 24 ++ .../conformance/importTag2.errors.txt | 20 ++ .../conformance/importTag2.errors.txt.diff | 25 ++ .../conformance/importTag20.errors.txt | 20 ++ .../conformance/importTag20.errors.txt.diff | 25 ++ .../conformance/importTag3.errors.txt | 20 ++ .../conformance/importTag3.errors.txt.diff | 25 ++ .../conformance/importTag4.errors.txt | 24 ++ .../conformance/importTag4.errors.txt.diff | 48 ++-- .../conformance/importTag5.errors.txt | 20 ++ .../conformance/importTag5.errors.txt.diff | 25 ++ .../conformance/importTag6.errors.txt | 30 +++ .../conformance/importTag6.errors.txt.diff | 35 +++ .../conformance/importTag7.errors.txt | 29 +++ .../conformance/importTag7.errors.txt.diff | 34 +++ .../conformance/importTag8.errors.txt | 29 +++ .../conformance/importTag8.errors.txt.diff | 34 +++ .../conformance/importTag9.errors.txt | 29 +++ .../conformance/importTag9.errors.txt.diff | 34 +++ ...ypeParameterOnVariableStatement.errors.txt | 5 +- ...rameterOnVariableStatement.errors.txt.diff | 5 +- ...ImplementsGenericsSerialization.errors.txt | 28 ++ ...mentsGenericsSerialization.errors.txt.diff | 33 +++ .../jsDeclarationsClassMethod.errors.txt | 8 +- .../jsDeclarationsClassMethod.errors.txt.diff | 8 +- .../jsDeclarationsClasses.errors.txt | 26 +- .../jsDeclarationsClasses.errors.txt.diff | 26 +- .../jsDeclarationsEnumTag.errors.txt | 11 +- .../jsDeclarationsEnumTag.errors.txt.diff | 11 +- ...rationsExportDefinePropertyEmit.errors.txt | 17 +- ...nsExportDefinePropertyEmit.errors.txt.diff | 17 +- ...clarationsExportDefinePropertyEmit.symbols | 8 + ...tionsExportDefinePropertyEmit.symbols.diff | 24 +- ...ctionClassesCjsExportAssignment.errors.txt | 13 +- ...ClassesCjsExportAssignment.errors.txt.diff | 13 +- ...DeclarationsFunctionLikeClasses.errors.txt | 5 +- ...rationsFunctionLikeClasses.errors.txt.diff | 5 +- ...eclarationsFunctionLikeClasses2.errors.txt | 5 +- ...ationsFunctionLikeClasses2.errors.txt.diff | 5 +- .../jsDeclarationsFunctions.errors.txt | 11 +- .../jsDeclarationsFunctions.errors.txt.diff | 11 +- .../jsDeclarationsFunctions.symbols | 8 + .../jsDeclarationsFunctions.symbols.diff | 26 -- .../jsDeclarationsFunctionsCjs.errors.txt | 8 +- ...jsDeclarationsFunctionsCjs.errors.txt.diff | 8 +- .../jsDeclarationsFunctionsCjs.symbols | 8 + .../jsDeclarationsFunctionsCjs.symbols.diff | 22 +- ...portAliasExposedWithinNamespace.errors.txt | 5 +- ...liasExposedWithinNamespace.errors.txt.diff | 17 +- ...tAliasExposedWithinNamespaceCjs.errors.txt | 5 +- ...sExposedWithinNamespaceCjs.errors.txt.diff | 5 +- .../jsDeclarationsMissingGenerics.errors.txt | 17 ++ ...eclarationsMissingGenerics.errors.txt.diff | 22 ++ ...ameterTagReusesInputNodeInEmit1.errors.txt | 5 +- ...rTagReusesInputNodeInEmit1.errors.txt.diff | 5 +- ...ameterTagReusesInputNodeInEmit2.errors.txt | 5 +- ...rTagReusesInputNodeInEmit2.errors.txt.diff | 5 +- ...nsReusesExistingTypeAnnotations.errors.txt | 129 --------- ...sesExistingTypeAnnotations.errors.txt.diff | 134 ---------- ...sDeclarationsTypedefAndImportTypes.symbols | 2 + ...arationsTypedefAndImportTypes.symbols.diff | 2 + ...DeclarationsTypedefAndLatebound.errors.txt | 5 +- ...rationsTypedefAndLatebound.errors.txt.diff | 5 +- .../jsDeclarationsTypedefFunction.errors.txt | 21 ++ ...eclarationsTypedefFunction.errors.txt.diff | 26 ++ ...edefPropertyAndExportAssignment.errors.txt | 8 +- ...ropertyAndExportAssignment.errors.txt.diff | 8 +- ...jsDeclarationsUniqueSymbolUsage.errors.txt | 5 +- ...larationsUniqueSymbolUsage.errors.txt.diff | 5 +- ...onstructorFunctionTypeReference.errors.txt | 6 +- ...uctorFunctionTypeReference.errors.txt.diff | 6 +- .../conformance/jsdocFunctionType.errors.txt | 11 +- .../jsdocFunctionType.errors.txt.diff | 33 +-- ...ImportTypeReferenceToClassAlias.errors.txt | 5 +- ...tTypeReferenceToClassAlias.errors.txt.diff | 5 +- ...rtTypeReferenceToCommonjsModule.errors.txt | 17 ++ ...eReferenceToCommonjsModule.errors.txt.diff | 22 ++ ...ocImportTypeReferenceToESModule.errors.txt | 14 + ...ortTypeReferenceToESModule.errors.txt.diff | 19 ++ .../jsdocIndexSignature.errors.txt | 5 +- .../jsdocIndexSignature.errors.txt.diff | 5 +- .../jsdocParamTagTypeLiteral.errors.txt | 93 ------- .../jsdocParamTagTypeLiteral.errors.txt.diff | 142 +++++----- .../jsdocParseBackquotedParamName.errors.txt | 23 -- ...ocParseBackquotedParamName.errors.txt.diff | 38 +-- .../jsdocParseMatchingBackticks.errors.txt | 36 --- ...sdocParseMatchingBackticks.errors.txt.diff | 41 --- .../jsdocParseStarEquals.errors.txt | 5 +- .../jsdocParseStarEquals.errors.txt.diff | 5 +- ...docPostfixEqualsAddsOptionality.errors.txt | 5 +- ...stfixEqualsAddsOptionality.errors.txt.diff | 5 +- .../jsdocPrefixPostfixParsing.errors.txt | 20 +- .../jsdocPrefixPostfixParsing.errors.txt.diff | 21 +- ...sdocSignatureOnReturnedFunction.errors.txt | 51 ---- ...ignatureOnReturnedFunction.errors.txt.diff | 56 ---- .../conformance/jsdocTemplateClass.errors.txt | 17 +- .../jsdocTemplateClass.errors.txt.diff | 25 +- ...sdocTemplateConstructorFunction.errors.txt | 31 +++ ...emplateConstructorFunction.errors.txt.diff | 50 ++-- ...docTemplateConstructorFunction2.errors.txt | 5 +- ...mplateConstructorFunction2.errors.txt.diff | 10 +- .../conformance/jsdocTemplateTag.errors.txt | 8 +- .../jsdocTemplateTag.errors.txt.diff | 16 +- .../conformance/jsdocTemplateTag2.errors.txt | 5 +- .../jsdocTemplateTag2.errors.txt.diff | 5 +- .../conformance/jsdocTemplateTag3.errors.txt | 20 +- .../jsdocTemplateTag3.errors.txt.diff | 29 ++- .../conformance/jsdocTemplateTag5.errors.txt | 22 +- .../jsdocTemplateTag5.errors.txt.diff | 22 +- .../conformance/jsdocTemplateTag6.errors.txt | 56 ++-- .../jsdocTemplateTag6.errors.txt.diff | 56 ++-- .../conformance/jsdocTemplateTag6.symbols | 3 + .../jsdocTemplateTag6.symbols.diff | 13 +- .../conformance/jsdocTemplateTag7.errors.txt | 6 +- .../jsdocTemplateTag7.errors.txt.diff | 8 +- .../conformance/jsdocTemplateTag8.errors.txt | 6 +- .../jsdocTemplateTag8.errors.txt.diff | 6 +- .../jsdocTemplateTagDefault.errors.txt | 20 +- .../jsdocTemplateTagDefault.errors.txt.diff | 36 ++- .../jsdocTypeReferenceToValue.errors.txt | 11 + .../jsdocTypeReferenceToValue.errors.txt.diff | 16 ++ .../moduleExportAssignment7.errors.txt | 44 +++- .../moduleExportAssignment7.errors.txt.diff | 61 ++++- ...ExportsElementAccessAssignment2.errors.txt | 29 --- ...tsElementAccessAssignment2.errors.txt.diff | 34 --- .../conformance/overloadTag1.errors.txt | 50 ++++ .../conformance/overloadTag1.errors.txt.diff | 79 +++--- .../conformance/overloadTag2.errors.txt | 5 +- .../conformance/overloadTag2.errors.txt.diff | 16 +- .../conformance/overloadTag3.errors.txt | 6 +- .../conformance/overloadTag3.errors.txt.diff | 6 +- ...TagBracketsAddOptionalUndefined.errors.txt | 18 +- ...acketsAddOptionalUndefined.errors.txt.diff | 18 +- .../paramTagTypeResolution2.errors.txt | 22 ++ .../paramTagTypeResolution2.errors.txt.diff | 27 ++ .../conformance/paramTagWrapping.errors.txt | 11 +- .../paramTagWrapping.errors.txt.diff | 23 +- ...esOfGenericConstructorFunctions.errors.txt | 8 +- ...enericConstructorFunctions.errors.txt.diff | 8 +- .../conformance/returnTagTypeGuard.errors.txt | 12 +- .../returnTagTypeGuard.errors.txt.diff | 12 +- .../conformance/returnTagTypeGuard.symbols | 2 + .../returnTagTypeGuard.symbols.diff | 8 +- .../templateInsideCallback.errors.txt | 6 +- .../templateInsideCallback.errors.txt.diff | 16 +- .../templateInsideCallback.symbols | 2 + .../templateInsideCallback.symbols.diff | 2 + .../submodule/conformance/thisTag1.errors.txt | 5 +- .../conformance/thisTag1.errors.txt.diff | 5 +- .../submodule/conformance/thisTag1.symbols | 2 + .../conformance/thisTag1.symbols.diff | 2 + .../thisTypeOfConstructorFunctions.errors.txt | 8 +- ...TypeOfConstructorFunctions.errors.txt.diff | 8 +- .../typeFromParamTagForFunction.errors.txt | 42 ++- ...ypeFromParamTagForFunction.errors.txt.diff | 40 ++- .../typeFromPropertyAssignment35.errors.txt | 5 +- ...peFromPropertyAssignment35.errors.txt.diff | 5 +- .../typeFromPropertyAssignment6.errors.txt | 5 +- ...ypeFromPropertyAssignment6.errors.txt.diff | 5 +- .../typeFromPrototypeAssignment3.errors.txt | 9 +- ...peFromPrototypeAssignment3.errors.txt.diff | 12 +- .../typedefOnStatements.errors.txt | 102 ++++---- .../typedefOnStatements.errors.txt.diff | 122 +++++---- .../typedefTagTypeResolution.errors.txt | 8 +- .../typedefTagTypeResolution.errors.txt.diff | 12 +- .../conformance/typedefTagWrapping.errors.txt | 148 +++++++++++ .../typedefTagWrapping.errors.txt.diff | 246 +++++++++--------- .../varRequireFromJavascript.errors.txt | 6 +- .../varRequireFromJavascript.errors.txt.diff | 6 +- .../varRequireFromTypescript.errors.txt | 12 +- .../varRequireFromTypescript.errors.txt.diff | 12 +- 283 files changed, 3693 insertions(+), 2358 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/compiler/arrowFunctionJSDocAnnotation.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/arrowFunctionJSDocAnnotation.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/importTag1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag1.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag16.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag16.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/importTag18.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag18.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/importTag19.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag19.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/importTag2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag2.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/importTag20.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag20.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/importTag3.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag3.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/importTag4.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag5.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag5.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/importTag6.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag6.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/importTag7.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag7.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/importTag8.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag8.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/importTag9.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag9.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocParamTagTypeLiteral.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocParseMatchingBackticks.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocParseMatchingBackticks.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment2.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index 329e31900e..ebf9498853 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -130,9 +130,16 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { ret.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), ret.Expression) } case ast.KindJSDocParameterTag: - // TODO + if fun, ok := getFunctionLikeHost(host); ok { + jsparam := tag.AsJSDocParameterTag() + if param, ok := findMatchingParameter(fun, jsparam); ok { + if param.Type() == nil { + param.AsParameterDeclaration().Type = p.makeNewType(jsparam.TypeExpression) + } + } + } case ast.KindJSDocReturnTag: - if fun, ok := p.getFunctionLikeHost(host); ok { + if fun, ok := getFunctionLikeHost(host); ok { if fun.Type() == nil { fun.FunctionLikeData().Type = p.makeNewType(tag.AsJSDocReturnTag().TypeExpression) } @@ -142,7 +149,16 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { } } -func (p *Parser) getFunctionLikeHost(host *ast.Node) (*ast.Node, bool) { +func findMatchingParameter(fun *ast.Node, jsparam *ast.JSDocParameterTag) (*ast.Node, bool) { + for _, parameter := range fun.Parameters() { + if parameter.Name().Kind == ast.KindIdentifier && parameter.Name().Text() == jsparam.Name().Text() { + return parameter, true + } + } + return nil, false +} + +func getFunctionLikeHost(host *ast.Node) (*ast.Node, bool) { fun := host if host.Kind == ast.KindVariableStatement && host.AsVariableStatement().DeclarationList != nil { // NOTE: This takes the first decl but in Strada it applied to every decl diff --git a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt index d0ffdf581a..2519b84308 100644 --- a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt @@ -1,4 +1,3 @@ -ExtendedClass.js(9,37): error TS2339: Property 'extends' does not exist on type 'unknown'. ExtendedClass.js(17,12): error TS2339: Property 'exports' does not exist on type '{}'. ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type '{}'. @@ -12,7 +11,7 @@ ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type } export = BaseClass; } -==== ExtendedClass.js (3 errors) ==== +==== ExtendedClass.js (2 errors) ==== define("lib/ExtendedClass", ["deps/BaseClass"], /** * {typeof import("deps/BaseClass")} @@ -22,8 +21,6 @@ ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type (BaseClass) => { const ExtendedClass = BaseClass.extends({ - ~~~~~~~ -!!! error TS2339: Property 'extends' does not exist on type 'unknown'. f: function() { return "something"; } diff --git a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt.diff index 80e58473c2..5215064b30 100644 --- a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt.diff @@ -3,7 +3,6 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+ExtendedClass.js(9,37): error TS2339: Property 'extends' does not exist on type 'unknown'. +ExtendedClass.js(17,12): error TS2339: Property 'exports' does not exist on type '{}'. +ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type '{}'. + @@ -17,7 +16,7 @@ + } + export = BaseClass; + } -+==== ExtendedClass.js (3 errors) ==== ++==== ExtendedClass.js (2 errors) ==== + define("lib/ExtendedClass", ["deps/BaseClass"], + /** + * {typeof import("deps/BaseClass")} @@ -27,8 +26,6 @@ + (BaseClass) => { + + const ExtendedClass = BaseClass.extends({ -+ ~~~~~~~ -+!!! error TS2339: Property 'extends' does not exist on type 'unknown'. + f: function() { + return "something"; + } diff --git a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols index 2ea9dc696a..f76120be75 100644 --- a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols +++ b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols @@ -42,7 +42,9 @@ define("lib/ExtendedClass", ["deps/BaseClass"], const ExtendedClass = BaseClass.extends({ >ExtendedClass : Symbol(ExtendedClass, Decl(ExtendedClass.js, 8, 9)) +>BaseClass.extends : Symbol(extends, Decl(BaseClass.d.ts, 1, 21)) >BaseClass : Symbol(BaseClass, Decl(ExtendedClass.js, 6, 1)) +>extends : Symbol(extends, Decl(BaseClass.d.ts, 1, 21)) f: function() { >f : Symbol(f, Decl(ExtendedClass.js, 8, 45)) diff --git a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols.diff b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols.diff index d3b6c4eb67..0397def26c 100644 --- a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols.diff @@ -14,12 +14,14 @@ const ExtendedClass = BaseClass.extends({ >ExtendedClass : Symbol(ExtendedClass, Decl(ExtendedClass.js, 8, 9)) ->BaseClass.extends : Symbol(BaseClass.extends, Decl(BaseClass.d.ts, 1, 21)) ++>BaseClass.extends : Symbol(extends, Decl(BaseClass.d.ts, 1, 21)) >BaseClass : Symbol(BaseClass, Decl(ExtendedClass.js, 6, 1)) ->extends : Symbol(BaseClass.extends, Decl(BaseClass.d.ts, 1, 21)) ++>extends : Symbol(extends, Decl(BaseClass.d.ts, 1, 21)) f: function() { >f : Symbol(f, Decl(ExtendedClass.js, 8, 45)) -@@= skipped -16, +14 lines =@@ +@@= skipped -16, +16 lines =@@ >module : Symbol(module, Decl(ExtendedClass.js, 15, 9)) module.exports = ExtendedClass diff --git a/testdata/baselines/reference/submodule/compiler/arrowFunctionJSDocAnnotation.errors.txt b/testdata/baselines/reference/submodule/compiler/arrowFunctionJSDocAnnotation.errors.txt deleted file mode 100644 index e68ce05996..0000000000 --- a/testdata/baselines/reference/submodule/compiler/arrowFunctionJSDocAnnotation.errors.txt +++ /dev/null @@ -1,24 +0,0 @@ -index.js(4,19): error TS7006: Parameter 'v' implicitly has an 'any' type. -index.js(13,5): error TS7006: Parameter 'param' implicitly has an 'any' type. - - -==== index.js (2 errors) ==== - /** - * @param {any} v - */ - function identity(v) { - ~ -!!! error TS7006: Parameter 'v' implicitly has an 'any' type. - return v; - } - - const x = identity( - /** - * @param {number} param - * @returns {number=} - */ - param => param - ~~~~~ -!!! error TS7006: Parameter 'param' implicitly has an 'any' type. - ); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/arrowFunctionJSDocAnnotation.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/arrowFunctionJSDocAnnotation.errors.txt.diff deleted file mode 100644 index ba394c12dd..0000000000 --- a/testdata/baselines/reference/submodule/compiler/arrowFunctionJSDocAnnotation.errors.txt.diff +++ /dev/null @@ -1,29 +0,0 @@ ---- old.arrowFunctionJSDocAnnotation.errors.txt -+++ new.arrowFunctionJSDocAnnotation.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(4,19): error TS7006: Parameter 'v' implicitly has an 'any' type. -+index.js(13,5): error TS7006: Parameter 'param' implicitly has an 'any' type. -+ -+ -+==== index.js (2 errors) ==== -+ /** -+ * @param {any} v -+ */ -+ function identity(v) { -+ ~ -+!!! error TS7006: Parameter 'v' implicitly has an 'any' type. -+ return v; -+ } -+ -+ const x = identity( -+ /** -+ * @param {number} param -+ * @returns {number=} -+ */ -+ param => param -+ ~~~~~ -+!!! error TS7006: Parameter 'param' implicitly has an 'any' type. -+ ); -+ diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt index e5fd968e1f..055bd4c5f4 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt @@ -1,22 +1,19 @@ -index.js(5,20): error TS7006: Parameter 'num' implicitly has an 'any' type. index.js(11,12): error TS2304: Cannot find name 'Fn'. index.js(16,17): error TS7006: Parameter 'a' implicitly has an 'any' type. index.js(16,20): error TS7006: Parameter 'b' implicitly has an 'any' type. index.js(18,5): error TS2554: Expected 2 arguments, but got 1. index.js(22,12): error TS2304: Cannot find name 'Fn'. index.js(27,17): error TS7006: Parameter 'a' implicitly has an 'any' type. -index.js(27,20): error TS7006: Parameter 'b' implicitly has an 'any' type. index.js(29,5): error TS2554: Expected 2 arguments, but got 1. +index.js(30,14): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. -==== index.js (9 errors) ==== +==== index.js (8 errors) ==== /** * * @param {number} num */ function acceptNum(num) {} - ~~~ -!!! error TS7006: Parameter 'num' implicitly has an 'any' type. /** * @typedef {(a: string, b: number) => void} Fn @@ -52,13 +49,13 @@ index.js(29,5): error TS2554: Expected 2 arguments, but got 1. function self(a, b) { ~ !!! error TS7006: Parameter 'a' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'b' implicitly has an 'any' type. acceptNum(b); // error self(""); ~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 index.js:27:20: An argument for 'b' was not provided. self("", undefined); + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff index 5582f904d8..a29b985432 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff @@ -5,29 +5,22 @@ - Type 'undefined' is not assignable to type 'number'. -index.js(28,15): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. - Type 'undefined' is not assignable to type 'number'. -+index.js(5,20): error TS7006: Parameter 'num' implicitly has an 'any' type. +index.js(11,12): error TS2304: Cannot find name 'Fn'. +index.js(16,17): error TS7006: Parameter 'a' implicitly has an 'any' type. +index.js(16,20): error TS7006: Parameter 'b' implicitly has an 'any' type. +index.js(18,5): error TS2554: Expected 2 arguments, but got 1. +index.js(22,12): error TS2304: Cannot find name 'Fn'. +index.js(27,17): error TS7006: Parameter 'a' implicitly has an 'any' type. -+index.js(27,20): error TS7006: Parameter 'b' implicitly has an 'any' type. +index.js(29,5): error TS2554: Expected 2 arguments, but got 1. ++index.js(30,14): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. -==== index.js (2 errors) ==== -+==== index.js (9 errors) ==== ++==== index.js (8 errors) ==== /** * * @param {number} num - */ - function acceptNum(num) {} -+ ~~~ -+!!! error TS7006: Parameter 'num' implicitly has an 'any' type. - - /** - * @typedef {(a: string, b: number) => void} Fn +@@= skipped -15, +19 lines =@@ */ /** @type {Fn} */ @@ -63,8 +56,6 @@ function self(a, b) { + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. acceptNum(b); // error - ~ -!!! error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. @@ -74,5 +65,7 @@ +!!! error TS2554: Expected 2 arguments, but got 1. +!!! related TS6210 index.js:27:20: An argument for 'b' was not provided. self("", undefined); ++ ~~~~~~~~~ ++!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. }; diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt index 503ab646db..8e04300497 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt @@ -1,11 +1,12 @@ +index.js(10,12): error TS2304: Cannot find name 'Funcs'. +index.js(10,18): error TS2304: Cannot find name 'A'. +index.js(10,21): error TS2304: Cannot find name 'B'. index.js(11,15): error TS2304: Cannot find name 'A'. index.js(11,18): error TS2304: Cannot find name 'B'. -index.js(13,14): error TS7006: Parameter 'fns' implicitly has an 'any' type. index.js(14,3): error TS2322: Type 'null' is not assignable to type '[A, B]'. -index.js(21,8): error TS7006: Parameter 'a' implicitly has an 'any' type. -==== index.js (5 errors) ==== +==== index.js (6 errors) ==== /** * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs * @template A @@ -16,6 +17,12 @@ index.js(21,8): error TS7006: Parameter 'a' implicitly has an 'any' type. * @template A * @template {Record} B * @param {Funcs} fns + ~~~~~ +!!! error TS2304: Cannot find name 'Funcs'. + ~ +!!! error TS2304: Cannot find name 'A'. + ~ +!!! error TS2304: Cannot find name 'B'. * @returns {[A, B]} ~ !!! error TS2304: Cannot find name 'A'. @@ -23,8 +30,6 @@ index.js(21,8): error TS7006: Parameter 'a' implicitly has an 'any' type. !!! error TS2304: Cannot find name 'B'. */ function foo(fns) { - ~~~ -!!! error TS7006: Parameter 'fns' implicitly has an 'any' type. return /** @type {any} */ (null); ~~~~~~ !!! error TS2322: Type 'null' is not assignable to type '[A, B]'. @@ -35,8 +40,6 @@ index.js(21,8): error TS7006: Parameter 'a' implicitly has an 'any' type. fn: /** @param {string} a */ (a) => {}, - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. thing: "asd", }, }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff index 6eaa271945..f28a121e26 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff @@ -3,14 +3,15 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++index.js(10,12): error TS2304: Cannot find name 'Funcs'. ++index.js(10,18): error TS2304: Cannot find name 'A'. ++index.js(10,21): error TS2304: Cannot find name 'B'. +index.js(11,15): error TS2304: Cannot find name 'A'. +index.js(11,18): error TS2304: Cannot find name 'B'. -+index.js(13,14): error TS7006: Parameter 'fns' implicitly has an 'any' type. +index.js(14,3): error TS2322: Type 'null' is not assignable to type '[A, B]'. -+index.js(21,8): error TS7006: Parameter 'a' implicitly has an 'any' type. + + -+==== index.js (5 errors) ==== ++==== index.js (6 errors) ==== + /** + * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs + * @template A @@ -21,6 +22,12 @@ + * @template A + * @template {Record} B + * @param {Funcs} fns ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Funcs'. ++ ~ ++!!! error TS2304: Cannot find name 'A'. ++ ~ ++!!! error TS2304: Cannot find name 'B'. + * @returns {[A, B]} + ~ +!!! error TS2304: Cannot find name 'A'. @@ -28,8 +35,6 @@ +!!! error TS2304: Cannot find name 'B'. + */ + function foo(fns) { -+ ~~~ -+!!! error TS7006: Parameter 'fns' implicitly has an 'any' type. + return /** @type {any} */ (null); + ~~~~~~ +!!! error TS2322: Type 'null' is not assignable to type '[A, B]'. @@ -40,8 +45,6 @@ + fn: + /** @param {string} a */ + (a) => {}, -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. + thing: "asd", + }, + }); diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt index 24a9382d3e..5b60d82bdc 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt @@ -1,21 +1,18 @@ +index.js(3,20): error TS2304: Cannot find name 'T'. index.js(4,14): error TS2304: Cannot find name 'T'. -index.js(6,17): error TS7006: Parameter 'predicate' implicitly has an 'any' type. -index.js(14,4): error TS7006: Parameter 'pose' implicitly has an 'any' type. -index.js(22,4): error TS7006: Parameter 'pose' implicitly has an 'any' type. -index.js(22,10): error TS7006: Parameter '_' implicitly has an 'any' type. -==== index.js (5 errors) ==== +==== index.js (2 errors) ==== /** * @template T * @param {(value: T, index: number) => boolean} predicate + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {T} ~ !!! error TS2304: Cannot find name 'T'. */ function filter(predicate) { - ~~~~~~~~~ -!!! error TS7006: Parameter 'predicate' implicitly has an 'any' type. return /** @type {any} */ (null); } @@ -24,8 +21,6 @@ index.js(22,10): error TS7006: Parameter '_' implicitly has an 'any' type. * @param {number} [pose] */ (pose) => true - ~~~~ -!!! error TS7006: Parameter 'pose' implicitly has an 'any' type. ); const b = filter( @@ -34,9 +29,5 @@ index.js(22,10): error TS7006: Parameter '_' implicitly has an 'any' type. * @param {number} [_] */ (pose, _) => true - ~~~~ -!!! error TS7006: Parameter 'pose' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter '_' implicitly has an 'any' type. ); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff index d9a7efdec2..677f461f62 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff @@ -3,24 +3,21 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++index.js(3,20): error TS2304: Cannot find name 'T'. +index.js(4,14): error TS2304: Cannot find name 'T'. -+index.js(6,17): error TS7006: Parameter 'predicate' implicitly has an 'any' type. -+index.js(14,4): error TS7006: Parameter 'pose' implicitly has an 'any' type. -+index.js(22,4): error TS7006: Parameter 'pose' implicitly has an 'any' type. -+index.js(22,10): error TS7006: Parameter '_' implicitly has an 'any' type. + + -+==== index.js (5 errors) ==== ++==== index.js (2 errors) ==== + /** + * @template T + * @param {(value: T, index: number) => boolean} predicate ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function filter(predicate) { -+ ~~~~~~~~~ -+!!! error TS7006: Parameter 'predicate' implicitly has an 'any' type. + return /** @type {any} */ (null); + } + @@ -29,8 +26,6 @@ + * @param {number} [pose] + */ + (pose) => true -+ ~~~~ -+!!! error TS7006: Parameter 'pose' implicitly has an 'any' type. + ); + + const b = filter( @@ -39,9 +34,5 @@ + * @param {number} [_] + */ + (pose, _) => true -+ ~~~~ -+!!! error TS7006: Parameter 'pose' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter '_' implicitly has an 'any' type. + ); + diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt index 12832c191f..fc6d3f4047 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt @@ -1,10 +1,8 @@ input.js(5,7): error TS7005: Variable 'something' implicitly has an 'any' type. -input.js(13,77): error TS7006: Parameter 'req' implicitly has an 'any' type. -input.js(21,64): error TS7006: Parameter 'req' implicitly has an 'any' type. -input.js(37,88): error TS7006: Parameter 'b' implicitly has an 'any' type. +input.js(34,12): error TS2304: Cannot find name 'P'. -==== input.js (4 errors) ==== +==== input.js (2 errors) ==== /** * @typedef {{ } & { name?: string }} P */ @@ -20,8 +18,6 @@ input.js(37,88): error TS7006: Parameter 'b' implicitly has an 'any' type. /** @param {number} req */ export function fnWithRequiredDefaultParam(p = /** @type {P} */(something), req) {} - ~~~ -!!! error TS7006: Parameter 'req' implicitly has an 'any' type. export class C { field = /** @type {P} */(something); @@ -30,8 +26,6 @@ input.js(37,88): error TS7006: Parameter 'b' implicitly has an 'any' type. method(p = /** @type {P} */(something)) {} /** @param {number} req */ methodWithRequiredDefault(p = /** @type {P} */(something), req) {} - ~~~ -!!! error TS7006: Parameter 'req' implicitly has an 'any' type. constructor(ctorField = /** @type {P} */(something)) {} @@ -45,8 +39,8 @@ input.js(37,88): error TS7006: Parameter 'b' implicitly has an 'any' type. /** * * @param {P} x + ~ +!!! error TS2304: Cannot find name 'P'. * @param {number} b */ - export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {} - ~ -!!! error TS7006: Parameter 'b' implicitly has an 'any' type. \ No newline at end of file + export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt.diff index 1f774adc3e..f2c1bd9afe 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt.diff @@ -4,12 +4,10 @@ - @@= skipped --1, +1 lines =@@ +input.js(5,7): error TS7005: Variable 'something' implicitly has an 'any' type. -+input.js(13,77): error TS7006: Parameter 'req' implicitly has an 'any' type. -+input.js(21,64): error TS7006: Parameter 'req' implicitly has an 'any' type. -+input.js(37,88): error TS7006: Parameter 'b' implicitly has an 'any' type. ++input.js(34,12): error TS2304: Cannot find name 'P'. + + -+==== input.js (4 errors) ==== ++==== input.js (2 errors) ==== + /** + * @typedef {{ } & { name?: string }} P + */ @@ -25,8 +23,6 @@ + + /** @param {number} req */ + export function fnWithRequiredDefaultParam(p = /** @type {P} */(something), req) {} -+ ~~~ -+!!! error TS7006: Parameter 'req' implicitly has an 'any' type. + + export class C { + field = /** @type {P} */(something); @@ -35,8 +31,6 @@ + method(p = /** @type {P} */(something)) {} + /** @param {number} req */ + methodWithRequiredDefault(p = /** @type {P} */(something), req) {} -+ ~~~ -+!!! error TS7006: Parameter 'req' implicitly has an 'any' type. + + constructor(ctorField = /** @type {P} */(something)) {} + @@ -50,8 +44,8 @@ + /** + * + * @param {P} x ++ ~ ++!!! error TS2304: Cannot find name 'P'. + * @param {number} b + */ + export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {} -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt index 16b7800eb5..99a767b07b 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt @@ -1,9 +1,7 @@ -input.js(13,77): error TS7006: Parameter 'req' implicitly has an 'any' type. -input.js(21,64): error TS7006: Parameter 'req' implicitly has an 'any' type. -input.js(37,88): error TS7006: Parameter 'b' implicitly has an 'any' type. +input.js(34,12): error TS2304: Cannot find name 'P'. -==== input.js (3 errors) ==== +==== input.js (1 errors) ==== /** * @typedef {{ } & { name?: string }} P */ @@ -17,8 +15,6 @@ input.js(37,88): error TS7006: Parameter 'b' implicitly has an 'any' type. /** @param {number} req */ export function fnWithRequiredDefaultParam(p = /** @type {P} */(something), req) {} - ~~~ -!!! error TS7006: Parameter 'req' implicitly has an 'any' type. export class C { field = /** @type {P} */(something); @@ -27,8 +23,6 @@ input.js(37,88): error TS7006: Parameter 'b' implicitly has an 'any' type. method(p = /** @type {P} */(something)) {} /** @param {number} req */ methodWithRequiredDefault(p = /** @type {P} */(something), req) {} - ~~~ -!!! error TS7006: Parameter 'req' implicitly has an 'any' type. constructor(ctorField = /** @type {P} */(something)) {} @@ -42,8 +36,8 @@ input.js(37,88): error TS7006: Parameter 'b' implicitly has an 'any' type. /** * * @param {P} x + ~ +!!! error TS2304: Cannot find name 'P'. * @param {number} b */ - export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {} - ~ -!!! error TS7006: Parameter 'b' implicitly has an 'any' type. \ No newline at end of file + export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt.diff index 44bdfc61d2..1077ec5cce 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt.diff @@ -3,12 +3,10 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+input.js(13,77): error TS7006: Parameter 'req' implicitly has an 'any' type. -+input.js(21,64): error TS7006: Parameter 'req' implicitly has an 'any' type. -+input.js(37,88): error TS7006: Parameter 'b' implicitly has an 'any' type. ++input.js(34,12): error TS2304: Cannot find name 'P'. + + -+==== input.js (3 errors) ==== ++==== input.js (1 errors) ==== + /** + * @typedef {{ } & { name?: string }} P + */ @@ -22,8 +20,6 @@ + + /** @param {number} req */ + export function fnWithRequiredDefaultParam(p = /** @type {P} */(something), req) {} -+ ~~~ -+!!! error TS7006: Parameter 'req' implicitly has an 'any' type. + + export class C { + field = /** @type {P} */(something); @@ -32,8 +28,6 @@ + method(p = /** @type {P} */(something)) {} + /** @param {number} req */ + methodWithRequiredDefault(p = /** @type {P} */(something), req) {} -+ ~~~ -+!!! error TS7006: Parameter 'req' implicitly has an 'any' type. + + constructor(ctorField = /** @type {P} */(something)) {} + @@ -47,8 +41,8 @@ + /** + * + * @param {P} x ++ ~ ++!!! error TS2304: Cannot find name 'P'. + * @param {number} b + */ + export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {} -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt deleted file mode 100644 index 8be1ee55b1..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt +++ /dev/null @@ -1,59 +0,0 @@ -index.js(48,7): error TS7032: Property 'x' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -index.js(48,9): error TS7006: Parameter 'a' implicitly has an 'any' type. - - -==== index.js (2 errors) ==== - // same type accessors - export const obj1 = { - /** - * my awesome getter (first in source order) - * @returns {string} - */ - get x() { - return ""; - }, - /** - * my awesome setter (second in source order) - * @param {string} a - */ - set x(a) {}, - }; - - // divergent accessors - export const obj2 = { - /** - * my awesome getter - * @returns {string} - */ - get x() { - return ""; - }, - /** - * my awesome setter - * @param {number} a - */ - set x(a) {}, - }; - - export const obj3 = { - /** - * my awesome getter - * @returns {string} - */ - get x() { - return ""; - }, - }; - - export const obj4 = { - /** - * my awesome setter - * @param {number} a - */ - set x(a) {}, - ~ -!!! error TS7032: Property 'x' implicitly has type 'any', because its set accessor lacks a parameter type annotation. - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. - }; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt.diff deleted file mode 100644 index 970edf2a77..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt.diff +++ /dev/null @@ -1,64 +0,0 @@ ---- old.declarationEmitObjectLiteralAccessorsJs1.errors.txt -+++ new.declarationEmitObjectLiteralAccessorsJs1.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(48,7): error TS7032: Property 'x' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+index.js(48,9): error TS7006: Parameter 'a' implicitly has an 'any' type. -+ -+ -+==== index.js (2 errors) ==== -+ // same type accessors -+ export const obj1 = { -+ /** -+ * my awesome getter (first in source order) -+ * @returns {string} -+ */ -+ get x() { -+ return ""; -+ }, -+ /** -+ * my awesome setter (second in source order) -+ * @param {string} a -+ */ -+ set x(a) {}, -+ }; -+ -+ // divergent accessors -+ export const obj2 = { -+ /** -+ * my awesome getter -+ * @returns {string} -+ */ -+ get x() { -+ return ""; -+ }, -+ /** -+ * my awesome setter -+ * @param {number} a -+ */ -+ set x(a) {}, -+ }; -+ -+ export const obj3 = { -+ /** -+ * my awesome getter -+ * @returns {string} -+ */ -+ get x() { -+ return ""; -+ }, -+ }; -+ -+ export const obj4 = { -+ /** -+ * my awesome setter -+ * @param {number} a -+ */ -+ set x(a) {}, -+ ~ -+!!! error TS7032: Property 'x' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ }; -+ diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt index eed8f74228..321561cda1 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt @@ -2,11 +2,12 @@ input.js(8,12): error TS2304: Cannot find name 'StatelessComponent'. input.js(8,31): error TS2304: Cannot find name 'MyComponentProps'. input.js(26,12): error TS2304: Cannot find name 'StatelessComponent'. input.js(26,31): error TS2304: Cannot find name 'MyComponentProps'. +input.js(32,21): error TS2304: Cannot find name 'MyComponentProps'. input.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== input.js (6 errors) ==== +==== input.js (7 errors) ==== /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ /** @@ -47,6 +48,8 @@ input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install /** * * @param {{ props: MyComponentProps }} p + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'MyComponentProps'. */ function expectLiteral(p) {} diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff index 3cb0e358ae..d5c5d0e6f3 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff @@ -7,11 +7,12 @@ +input.js(8,31): error TS2304: Cannot find name 'MyComponentProps'. +input.js(26,12): error TS2304: Cannot find name 'StatelessComponent'. +input.js(26,31): error TS2304: Cannot find name 'MyComponentProps'. ++input.js(32,21): error TS2304: Cannot find name 'MyComponentProps'. +input.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== input.js (6 errors) ==== ++==== input.js (7 errors) ==== + /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ + + /** @@ -52,6 +53,8 @@ + /** + * + * @param {{ props: MyComponentProps }} p ++ ~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'MyComponentProps'. + */ + function expectLiteral(p) {} + diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt index d4e3e8cb73..d62abe17e0 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt @@ -1,3 +1,4 @@ +index.js(10,16): error TS2304: Cannot find name 'Options'. index.js(15,18): error TS2339: Property 'test' does not exist on type 'X'. @@ -9,7 +10,7 @@ index.js(15,18): error TS2339: Property 'test' does not exist on type 'X'. /** @module Test */ class Test {} export default Test; -==== index.js (1 errors) ==== +==== index.js (2 errors) ==== import Test from './test/Test.js' /** @@ -20,6 +21,8 @@ index.js(15,18): error TS2339: Property 'test' does not exist on type 'X'. class X extends Test { /** * @param {Options} options + ~~~~~~~ +!!! error TS2304: Cannot find name 'Options'. */ constructor(options) { super(); diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt.diff index 2d7908b73d..976dd454b2 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt.diff @@ -3,6 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++index.js(10,16): error TS2304: Cannot find name 'Options'. +index.js(15,18): error TS2339: Property 'test' does not exist on type 'X'. + + @@ -14,7 +15,7 @@ + /** @module Test */ + class Test {} + export default Test; -+==== index.js (1 errors) ==== ++==== index.js (2 errors) ==== + import Test from './test/Test.js' + + /** @@ -25,6 +26,8 @@ + class X extends Test { + /** + * @param {Options} options ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'Options'. + */ + constructor(options) { + super(); diff --git a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt index 4fabc2c738..d4686d7290 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt @@ -1,4 +1,4 @@ -index.js(9,49): error TS7006: Parameter 'init' implicitly has an 'any' type. +index.js(7,16): error TS2552: Cannot find name 'LionRequestInit'. Did you mean 'RequestInit'? ==== package.json (0 errors) ==== @@ -35,10 +35,10 @@ index.js(9,49): error TS7006: Parameter 'init' implicitly has an 'any' type. export class NewAjax { /** * @param {LionRequestInit} [init] + ~~~~~~~~~~~~~~~ +!!! error TS2552: Cannot find name 'LionRequestInit'. Did you mean 'RequestInit'? */ case5_unexpectedlyResolvesPathToNodeModules(init) {} - ~~~~ -!!! error TS7006: Parameter 'init' implicitly has an 'any' type. } /** diff --git a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt.diff index 34acefb524..d0c0b64602 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+index.js(9,49): error TS7006: Parameter 'init' implicitly has an 'any' type. ++index.js(7,16): error TS2552: Cannot find name 'LionRequestInit'. Did you mean 'RequestInit'? + + +==== package.json (0 errors) ==== @@ -40,10 +40,10 @@ + export class NewAjax { + /** + * @param {LionRequestInit} [init] ++ ~~~~~~~~~~~~~~~ ++!!! error TS2552: Cannot find name 'LionRequestInit'. Did you mean 'RequestInit'? + */ + case5_unexpectedlyResolvesPathToNodeModules(init) {} -+ ~~~~ -+!!! error TS7006: Parameter 'init' implicitly has an 'any' type. + } + + /** diff --git a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols index 2dfc1c07a7..fa45eaf1c0 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols @@ -19,37 +19,45 @@ function apply(func, thisArg, ...args) { var length = args.length; >length : Symbol(length, Decl(_apply.js, 11, 7)) ->args.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >args : Symbol(args, Decl(_apply.js, 10, 29)) ->length : Symbol(length, Decl(lib.es5.d.ts, --, --)) switch (length) { >length : Symbol(length, Decl(_apply.js, 11, 7)) case 0: return func.call(thisArg); +>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) +>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) case 1: return func.call(thisArg, args[0]); +>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) +>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) case 2: return func.call(thisArg, args[0], args[1]); +>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) +>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) case 3: return func.call(thisArg, args[0], args[1], args[2]); +>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) +>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) } return func.apply(thisArg, args); +>func.apply : Symbol(apply, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) +>apply : Symbol(apply, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff index 528cc70ef5..f17b70333f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff @@ -5,39 +5,45 @@ var length = args.length; >length : Symbol(length, Decl(_apply.js, 11, 7)) ->args.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) -+>args.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >args : Symbol(args, Decl(_apply.js, 10, 29)) ->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) -+>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) switch (length) { >length : Symbol(length, Decl(_apply.js, 11, 7)) case 0: return func.call(thisArg); ->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) case 1: return func.call(thisArg, args[0]); ->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) case 2: return func.call(thisArg, args[0], args[1]); ->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) case 3: return func.call(thisArg, args[0], args[1], args[2]); ->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) @@ -45,8 +51,10 @@ } return func.apply(thisArg, args); ->func.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) ++>func.apply : Symbol(apply, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) ++>apply : Symbol(apply, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt index 3cafaf3dce..5948c8878c 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt @@ -1,7 +1,9 @@ +jsFileFunctionOverloads.js(26,12): error TS2304: Cannot find name 'T'. jsFileFunctionOverloads.js(27,14): error TS2304: Cannot find name 'T'. +jsFileFunctionOverloads.js(54,44): error TS2461: Type 'unknown' is not an array type. -==== jsFileFunctionOverloads.js (1 errors) ==== +==== jsFileFunctionOverloads.js (3 errors) ==== /** * @overload * @param {number} x @@ -28,6 +30,8 @@ jsFileFunctionOverloads.js(27,14): error TS2304: Cannot find name 'T'. /** * @template T * @param {T} x + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {T} ~ !!! error TS2304: Cannot find name 'T'. @@ -58,6 +62,8 @@ jsFileFunctionOverloads.js(27,14): error TS2304: Cannot find name 'T'. const result = []; for (let i = 0; i < array.length; i += 1) { result.push(.../** @type {unknown[]} */(iterable(array[i]))); + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2461: Type 'unknown' is not an array type. } return result; } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt.diff index b730ce7f31..2484aabb20 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt.diff @@ -3,10 +3,12 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++jsFileFunctionOverloads.js(26,12): error TS2304: Cannot find name 'T'. +jsFileFunctionOverloads.js(27,14): error TS2304: Cannot find name 'T'. ++jsFileFunctionOverloads.js(54,44): error TS2461: Type 'unknown' is not an array type. + + -+==== jsFileFunctionOverloads.js (1 errors) ==== ++==== jsFileFunctionOverloads.js (3 errors) ==== + /** + * @overload + * @param {number} x @@ -33,6 +35,8 @@ + /** + * @template T + * @param {T} x ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. @@ -63,6 +67,8 @@ + const result = []; + for (let i = 0; i < array.length; i += 1) { + result.push(.../** @type {unknown[]} */(iterable(array[i]))); ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2461: Type 'unknown' is not an array type. + } + return result; + } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols index c34e289aaa..06d3e43822 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols @@ -70,7 +70,9 @@ function flatMap(array, iterable = identity) { for (let i = 0; i < array.length; i += 1) { >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) +>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(jsFileFunctionOverloads.js, 49, 17)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff index c8c88cff47..f653c587e3 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff @@ -5,8 +5,10 @@ >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) ->array.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(jsFileFunctionOverloads.js, 49, 17)) ->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt index b3d9fa5b12..af369198c2 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt @@ -1,7 +1,9 @@ +jsFileFunctionOverloads2.js(24,12): error TS2304: Cannot find name 'T'. jsFileFunctionOverloads2.js(25,14): error TS2304: Cannot find name 'T'. +jsFileFunctionOverloads2.js(49,44): error TS2461: Type 'unknown' is not an array type. -==== jsFileFunctionOverloads2.js (1 errors) ==== +==== jsFileFunctionOverloads2.js (3 errors) ==== // Also works if all @overload tags are combined in one comment. /** * @overload @@ -26,6 +28,8 @@ jsFileFunctionOverloads2.js(25,14): error TS2304: Cannot find name 'T'. /** * @template T * @param {T} x + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {T} ~ !!! error TS2304: Cannot find name 'T'. @@ -53,6 +57,8 @@ jsFileFunctionOverloads2.js(25,14): error TS2304: Cannot find name 'T'. const result = []; for (let i = 0; i < array.length; i += 1) { result.push(.../** @type {unknown[]} */(iterable(array[i]))); + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2461: Type 'unknown' is not an array type. } return result; } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt.diff index dfafcbf209..391e00632b 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt.diff @@ -3,10 +3,12 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++jsFileFunctionOverloads2.js(24,12): error TS2304: Cannot find name 'T'. +jsFileFunctionOverloads2.js(25,14): error TS2304: Cannot find name 'T'. ++jsFileFunctionOverloads2.js(49,44): error TS2461: Type 'unknown' is not an array type. + + -+==== jsFileFunctionOverloads2.js (1 errors) ==== ++==== jsFileFunctionOverloads2.js (3 errors) ==== + // Also works if all @overload tags are combined in one comment. + /** + * @overload @@ -31,6 +33,8 @@ + /** + * @template T + * @param {T} x ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. @@ -58,6 +62,8 @@ + const result = []; + for (let i = 0; i < array.length; i += 1) { + result.push(.../** @type {unknown[]} */(iterable(array[i]))); ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2461: Type 'unknown' is not an array type. + } + return result; + } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols index ad011c6104..226798dfdc 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols @@ -65,7 +65,9 @@ function flatMap(array, iterable = identity) { for (let i = 0; i < array.length; i += 1) { >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) +>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(jsFileFunctionOverloads2.js, 44, 17)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff index 397b980305..3a61f98336 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff @@ -5,8 +5,10 @@ >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) ->array.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(jsFileFunctionOverloads2.js, 44, 17)) ->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); diff --git a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt index 195fc4054f..afd42d87b7 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt @@ -1,5 +1,5 @@ -index.js(9,10): error TS7006: Parameter 'obj' implicitly has an 'any' type. -index.js(9,15): error TS7006: Parameter 'vm' implicitly has an 'any' type. +index.js(11,12): error TS2339: Property 'objects' does not exist on type 'object'. +index.js(13,26): error TS2698: Spread types may only be created from object types. ==== dash.d.ts (0 errors) ==== @@ -22,14 +22,14 @@ index.js(9,15): error TS7006: Parameter 'vm' implicitly has an 'any' type. * @param {object} vm */ test(obj, vm) { - ~~~ -!!! error TS7006: Parameter 'obj' implicitly has an 'any' type. - ~~ -!!! error TS7006: Parameter 'vm' implicitly has an 'any' type. let index = 0; vm.objects = _.mapValues( + ~~~~~~~ +!!! error TS2339: Property 'objects' does not exist on type 'object'. obj, object => ({ ...object, [INDEX_FIELD]: index++ }), + ~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. ); } } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt.diff index 689954c6eb..0cace8ce94 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt.diff @@ -3,8 +3,8 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+index.js(9,10): error TS7006: Parameter 'obj' implicitly has an 'any' type. -+index.js(9,15): error TS7006: Parameter 'vm' implicitly has an 'any' type. ++index.js(11,12): error TS2339: Property 'objects' does not exist on type 'object'. ++index.js(13,26): error TS2698: Spread types may only be created from object types. + + +==== dash.d.ts (0 errors) ==== @@ -27,14 +27,14 @@ + * @param {object} vm + */ + test(obj, vm) { -+ ~~~ -+!!! error TS7006: Parameter 'obj' implicitly has an 'any' type. -+ ~~ -+!!! error TS7006: Parameter 'vm' implicitly has an 'any' type. + let index = 0; + vm.objects = _.mapValues( ++ ~~~~~~~ ++!!! error TS2339: Property 'objects' does not exist on type 'object'. + obj, + object => ({ ...object, [INDEX_FIELD]: index++ }), ++ ~~~~~~~~~ ++!!! error TS2698: Spread types may only be created from object types. + ); + } + } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt index 942187b6f0..e8e15bef0a 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt @@ -1,16 +1,20 @@ +jsFileMethodOverloads.js(6,14): error TS2304: Cannot find name 'T'. jsFileMethodOverloads.js(9,10): error TS2339: Property 'value' does not exist on type 'Example'. jsFileMethodOverloads.js(26,24): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads.js(40,18): error TS2304: Cannot find name 'T'. jsFileMethodOverloads.js(44,25): error TS2339: Property 'value' does not exist on type 'Example'. jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist on type 'Example'. -==== jsFileMethodOverloads.js (4 errors) ==== +==== jsFileMethodOverloads.js (6 errors) ==== /** * @template T */ class Example { /** * @param {T} value + ~ +!!! error TS2304: Cannot find name 'T'. */ constructor(value) { this.value = value; @@ -49,6 +53,8 @@ jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist o */ /** * @param {(y: T) => unknown} [fn] + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {unknown} */ transform(fn) { diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt.diff index c7ba1d7958..41769012b0 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt.diff @@ -3,19 +3,23 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++jsFileMethodOverloads.js(6,14): error TS2304: Cannot find name 'T'. +jsFileMethodOverloads.js(9,10): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads.js(26,24): error TS2339: Property 'value' does not exist on type 'Example'. ++jsFileMethodOverloads.js(40,18): error TS2304: Cannot find name 'T'. +jsFileMethodOverloads.js(44,25): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist on type 'Example'. + + -+==== jsFileMethodOverloads.js (4 errors) ==== ++==== jsFileMethodOverloads.js (6 errors) ==== + /** + * @template T + */ + class Example { + /** + * @param {T} value ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + constructor(value) { + this.value = value; @@ -54,6 +58,8 @@ + */ + /** + * @param {(y: T) => unknown} [fn] ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @returns {unknown} + */ + transform(fn) { diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt index 4e6cf1d02b..c4db6be524 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt @@ -1,10 +1,12 @@ +jsFileMethodOverloads2.js(7,14): error TS2304: Cannot find name 'T'. jsFileMethodOverloads2.js(10,10): error TS2339: Property 'value' does not exist on type 'Example'. jsFileMethodOverloads2.js(25,24): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads2.js(37,18): error TS2304: Cannot find name 'T'. jsFileMethodOverloads2.js(41,25): error TS2339: Property 'value' does not exist on type 'Example'. jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist on type 'Example'. -==== jsFileMethodOverloads2.js (4 errors) ==== +==== jsFileMethodOverloads2.js (6 errors) ==== // Also works if all @overload tags are combined in one comment. /** * @template T @@ -12,6 +14,8 @@ jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist class Example { /** * @param {T} value + ~ +!!! error TS2304: Cannot find name 'T'. */ constructor(value) { this.value = value; @@ -46,6 +50,8 @@ jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist * @returns {T} * * @param {(y: T) => unknown} [fn] + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {unknown} */ transform(fn) { diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt.diff index 4b61d6f32c..61e2b924d4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt.diff @@ -3,13 +3,15 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++jsFileMethodOverloads2.js(7,14): error TS2304: Cannot find name 'T'. +jsFileMethodOverloads2.js(10,10): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads2.js(25,24): error TS2339: Property 'value' does not exist on type 'Example'. ++jsFileMethodOverloads2.js(37,18): error TS2304: Cannot find name 'T'. +jsFileMethodOverloads2.js(41,25): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist on type 'Example'. + + -+==== jsFileMethodOverloads2.js (4 errors) ==== ++==== jsFileMethodOverloads2.js (6 errors) ==== + // Also works if all @overload tags are combined in one comment. + /** + * @template T @@ -17,6 +19,8 @@ + class Example { + /** + * @param {T} value ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + constructor(value) { + this.value = value; @@ -51,6 +55,8 @@ + * @returns {T} + * + * @param {(y: T) => unknown} [fn] ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @returns {unknown} + */ + transform(fn) { diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.errors.txt deleted file mode 100644 index a97d142c96..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -/a.js(15,13): error TS7006: Parameter 'x' implicitly has an 'any' type. - - -==== /a.js (1 errors) ==== - /** - * @overload - * @param {number} x - */ - - /** - * @overload - * @param {string} x - */ - - /** - * @param {string | number} x - * @returns {string | number} - */ - function id(x) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - return x; - } - - export let a = id(123); - export let b = id("hello"); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.errors.txt.diff index 376d4dab51..2021e5deba 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.errors.txt.diff @@ -1,33 +1,35 @@ --- old.jsFileMethodOverloads3.errors.txt +++ new.jsFileMethodOverloads3.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -/a.js(2,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. -/a.js(7,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. -+/a.js(15,13): error TS7006: Parameter 'x' implicitly has an 'any' type. - - +- +- -==== /a.js (2 errors) ==== -+==== /a.js (1 errors) ==== - /** - * @overload +- /** +- * @overload - ~~~~~~~~ -!!! error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. - * @param {number} x - */ - - /** - * @overload +- * @param {number} x +- */ +- +- /** +- * @overload - ~~~~~~~~ -!!! error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. - * @param {string} x - */ - -@@= skipped -21, +16 lines =@@ - * @returns {string | number} - */ - function id(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - return x; - } - +- * @param {string} x +- */ +- +- /** +- * @param {string | number} x +- * @returns {string | number} +- */ +- function id(x) { +- return x; +- } +- +- export let a = id(123); +- export let b = id("hello"); +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt index 0e15ed6e44..1d9b3df6af 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt @@ -1,12 +1,14 @@ jsdocArrayObjectPromiseImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). jsdocArrayObjectPromiseImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). jsdocArrayObjectPromiseImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). jsdocArrayObjectPromiseImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). jsdocArrayObjectPromiseImplicitAny.js(30,18): error TS2322: Type 'number' is not assignable to type '() => Object'. jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. -==== jsdocArrayObjectPromiseImplicitAny.js (6 errors) ==== +==== jsdocArrayObjectPromiseImplicitAny.js (8 errors) ==== /** @type {Array} */ ~~~~~ !!! error TS2314: Generic type 'T[]' requires 1 type argument(s). @@ -17,6 +19,8 @@ jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not /** * @param {Array} arr + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). * @return {Array} ~~~~~ !!! error TS2314: Generic type 'T[]' requires 1 type argument(s). @@ -35,6 +39,8 @@ jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not /** * @param {Promise} pr + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). * @return {Promise} ~~~~~~~ !!! error TS2314: Generic type 'Promise' requires 1 type argument(s). diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff index 571362dfb3..64a04b64c4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff @@ -4,14 +4,16 @@ - @@= skipped --1, +1 lines =@@ +jsdocArrayObjectPromiseImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++jsdocArrayObjectPromiseImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). ++jsdocArrayObjectPromiseImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(30,18): error TS2322: Type 'number' is not assignable to type '() => Object'. +jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. + + -+==== jsdocArrayObjectPromiseImplicitAny.js (6 errors) ==== ++==== jsdocArrayObjectPromiseImplicitAny.js (8 errors) ==== + /** @type {Array} */ + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). @@ -22,6 +24,8 @@ + + /** + * @param {Array} arr ++ ~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + * @return {Array} + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). @@ -40,6 +44,8 @@ + + /** + * @param {Promise} pr ++ ~~~~~~~ ++!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + * @return {Promise} + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt index 36bd088c1d..c88b521e45 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt @@ -1,15 +1,14 @@ jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(11,28): error TS7006: Parameter 'arr' implicitly has an 'any' type. jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(25,30): error TS7006: Parameter 'pr' implicitly has an 'any' type. jsdocArrayObjectPromiseNoImplicitAny.js(30,21): error TS2322: Type 'number' is not assignable to type '() => Object'. jsdocArrayObjectPromiseNoImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. -jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' implicitly has an 'any' type. -==== jsdocArrayObjectPromiseNoImplicitAny.js (9 errors) ==== +==== jsdocArrayObjectPromiseNoImplicitAny.js (8 errors) ==== /** @type {Array} */ ~~~~~ !!! error TS2314: Generic type 'T[]' requires 1 type argument(s). @@ -20,13 +19,13 @@ jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' im /** * @param {Array} arr + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). * @return {Array} ~~~~~ !!! error TS2314: Generic type 'T[]' requires 1 type argument(s). */ function returnNotAnyArray(arr) { - ~~~ -!!! error TS7006: Parameter 'arr' implicitly has an 'any' type. return arr; } @@ -40,13 +39,13 @@ jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' im /** * @param {Promise} pr + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). * @return {Promise} ~~~~~~~ !!! error TS2314: Generic type 'Promise' requires 1 type argument(s). */ function returnNotAnyPromise(pr) { - ~~ -!!! error TS7006: Parameter 'pr' implicitly has an 'any' type. return pr; } @@ -65,8 +64,6 @@ jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' im * @return {Object} */ function returnNotAnyObject(obj) { - ~~~ -!!! error TS7006: Parameter 'obj' implicitly has an 'any' type. return obj; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff index e6c7da425b..8907da0eca 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff @@ -5,19 +5,17 @@ -jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'Array' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'Array' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+jsdocArrayObjectPromiseNoImplicitAny.js(11,28): error TS7006: Parameter 'arr' implicitly has an 'any' type. jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). --jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). + jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). -+jsdocArrayObjectPromiseNoImplicitAny.js(25,30): error TS7006: Parameter 'pr' implicitly has an 'any' type. jsdocArrayObjectPromiseNoImplicitAny.js(30,21): error TS2322: Type 'number' is not assignable to type '() => Object'. +jsdocArrayObjectPromiseNoImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. -+jsdocArrayObjectPromiseNoImplicitAny.js(39,29): error TS7006: Parameter 'obj' implicitly has an 'any' type. -==== jsdocArrayObjectPromiseNoImplicitAny.js (7 errors) ==== -+==== jsdocArrayObjectPromiseNoImplicitAny.js (9 errors) ==== ++==== jsdocArrayObjectPromiseNoImplicitAny.js (8 errors) ==== /** @type {Array} */ ~~~~~ -!!! error TS2314: Generic type 'Array' requires 1 type argument(s). @@ -25,40 +23,20 @@ var notAnyArray = [5]; /** @type {Array} */ -@@= skipped -17, +19 lines =@@ - +@@= skipped -18, +19 lines =@@ /** * @param {Array} arr -- ~~~~~ + ~~~~~ -!!! error TS2314: Generic type 'Array' requires 1 type argument(s). ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). * @return {Array} ~~~~~ -!!! error TS2314: Generic type 'Array' requires 1 type argument(s). +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). */ function returnNotAnyArray(arr) { -+ ~~~ -+!!! error TS7006: Parameter 'arr' implicitly has an 'any' type. return arr; - } - -@@= skipped -20, +20 lines =@@ - - /** - * @param {Promise} pr -- ~~~~~~~ --!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). - * @return {Promise} - ~~~~~~~ - !!! error TS2314: Generic type 'Promise' requires 1 type argument(s). - */ - function returnNotAnyPromise(pr) { -+ ~~ -+!!! error TS7006: Parameter 'pr' implicitly has an 'any' type. - return pr; - } - -@@= skipped -16, +16 lines =@@ +@@= skipped -35, +35 lines =@@ !!! error TS2322: Type 'number' is not assignable to type '() => Object'. /** @type {Object} */ @@ -67,12 +45,3 @@ var paramedObject = {valueOf: 1}; /** -@@= skipped -7, +9 lines =@@ - * @return {Object} - */ - function returnNotAnyObject(obj) { -+ ~~~ -+!!! error TS7006: Parameter 'obj' implicitly has an 'any' type. - return obj; - } - diff --git a/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt deleted file mode 100644 index 6e095e3bd3..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -/a.js(5,12): error TS7006: Parameter 'p' implicitly has an 'any' type. - - -==== /a.js (1 errors) ==== - /** @template T */ - class C {} - - /** @param {C} p */ - function f(p) {} - ~ -!!! error TS7006: Parameter 'p' implicitly has an 'any' type. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt.diff index e9a65b7987..13944e2fbd 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt.diff @@ -1,18 +1,17 @@ --- old.jsdocClassMissingTypeArguments.errors.txt +++ new.jsdocClassMissingTypeArguments.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -/a.js(4,13): error TS2314: Generic type 'C' requires 1 type argument(s). -+/a.js(5,12): error TS7006: Parameter 'p' implicitly has an 'any' type. - - - ==== /a.js (1 errors) ==== -@@= skipped -5, +5 lines =@@ - class C {} - - /** @param {C} p */ +- +- +-==== /a.js (1 errors) ==== +- /** @template T */ +- class C {} +- +- /** @param {C} p */ - ~ -!!! error TS2314: Generic type 'C' requires 1 type argument(s). - function f(p) {} -+ ~ -+!!! error TS7006: Parameter 'p' implicitly has an 'any' type. - +- function f(p) {} +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.errors.txt index 1164ca5f46..eef47833f9 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.errors.txt @@ -1,21 +1,15 @@ -/a.js(5,21): error TS7006: Parameter 'x' implicitly has an 'any' type. -/a.js(5,24): error TS7006: Parameter 'y' implicitly has an 'any' type. /a.js(6,11): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. /a.js(7,16): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. /a.js(9,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. /a.js(10,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -==== /a.js (6 errors) ==== +==== /a.js (4 errors) ==== /** * @param {number | undefined} x * @param {number | undefined} y */ export function Foo(x, y) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'y' implicitly has an 'any' type. if (!(this instanceof Foo)) { ~~~~ !!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. diff --git a/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.errors.txt.diff index abf3798c4f..85984deafb 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.errors.txt.diff @@ -3,24 +3,18 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+/a.js(5,21): error TS7006: Parameter 'x' implicitly has an 'any' type. -+/a.js(5,24): error TS7006: Parameter 'y' implicitly has an 'any' type. +/a.js(6,11): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. +/a.js(7,16): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. +/a.js(9,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. +/a.js(10,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + + -+==== /a.js (6 errors) ==== ++==== /a.js (4 errors) ==== + /** + * @param {number | undefined} x + * @param {number | undefined} y + */ + export function Foo(x, y) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'y' implicitly has an 'any' type. + if (!(this instanceof Foo)) { + ~~~~ +!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.errors.txt deleted file mode 100644 index e65be0d9ba..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -/a.js(3,9): error TS7006: Parameter 'x' implicitly has an 'any' type. - - -==== /a.js (1 errors) ==== - class Foo { - /**@param {string} x */ - m = x => x.toLowerCase(); - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.errors.txt.diff deleted file mode 100644 index 314d1d1969..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.jsdocParamTagOnPropertyInitializer.errors.txt -+++ new.jsdocParamTagOnPropertyInitializer.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/a.js(3,9): error TS7006: Parameter 'x' implicitly has an 'any' type. -+ -+ -+==== /a.js (1 errors) ==== -+ class Foo { -+ /**@param {string} x */ -+ m = x => x.toLowerCase(); -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ } -+ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols index 45e5696a1a..8e62ab992a 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols @@ -8,6 +8,8 @@ class Foo { m = x => x.toLowerCase(); >m : Symbol(m, Decl(a.js, 0, 11)) >x : Symbol(x, Decl(a.js, 2, 7)) +>x.toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(a.js, 2, 7)) +>toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --)) } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff index 9d7a20e19d..da85b80884 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff @@ -8,7 +8,9 @@ +>m : Symbol(m, Decl(a.js, 0, 11)) >x : Symbol(x, Decl(a.js, 2, 7)) ->x.toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) ++>x.toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(a.js, 2, 7)) ->toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) ++>toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --)) } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt new file mode 100644 index 0000000000..2d8bfd5235 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt @@ -0,0 +1,18 @@ +/a.js(6,13): error TS2304: Cannot find name 'MyType'. + + +==== /a.js (1 errors) ==== + /** + * @typedef MyType + * @property {sting} [x] + */ + + /** @param {MyType} p */ + ~~~~~~ +!!! error TS2304: Cannot find name 'MyType'. + export function f(p) { } + +==== /b.js (0 errors) ==== + import { f } from "./a.js" + f({ x: 42 }) + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt.diff index f7b8894087..587a061b2f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt.diff @@ -1,23 +1,21 @@ --- old.jsdocPropertyTagInvalid.errors.txt +++ new.jsdocPropertyTagInvalid.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(3,15): error TS2552: Cannot find name 'sting'. Did you mean 'string'? -- -- --==== /a.js (1 errors) ==== -- /** -- * @typedef MyType -- * @property {sting} [x] ++/a.js(6,13): error TS2304: Cannot find name 'MyType'. + + + ==== /a.js (1 errors) ==== + /** + * @typedef MyType + * @property {sting} [x] - ~~~~~ -!!! error TS2552: Cannot find name 'sting'. Did you mean 'string'? -- */ -- -- /** @param {MyType} p */ -- export function f(p) { } -- --==== /b.js (0 errors) ==== -- import { f } from "./a.js" -- f({ x: 42 }) -- -@@= skipped --1, +1 lines =@@ -+ + */ + + /** @param {MyType} p */ ++ ~~~~~~ ++!!! error TS2304: Cannot find name 'MyType'. + export function f(p) { } + + ==== /b.js (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt new file mode 100644 index 0000000000..6c3a675c1e --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt @@ -0,0 +1,15 @@ +/a.js(2,12): error TS2304: Cannot find name 'Ty'. + + +==== /a.js (1 errors) ==== + /** + * @param {Ty} x + ~~ +!!! error TS2304: Cannot find name 'Ty'. + */ + function f(x) {} + + /** + * @typedef {CantResolveThis} Ty + */ + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt.diff index 4b568dd738..77654e6eef 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt.diff @@ -1,20 +1,21 @@ --- old.jsdocResolveNameFailureInTypedef.errors.txt +++ new.jsdocResolveNameFailureInTypedef.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(7,14): error TS2304: Cannot find name 'CantResolveThis'. -- -- --==== /a.js (1 errors) ==== -- /** -- * @param {Ty} x -- */ -- function f(x) {} -- -- /** -- * @typedef {CantResolveThis} Ty ++/a.js(2,12): error TS2304: Cannot find name 'Ty'. + + + ==== /a.js (1 errors) ==== + /** + * @param {Ty} x ++ ~~ ++!!! error TS2304: Cannot find name 'Ty'. + */ + function f(x) {} + + /** + * @typedef {CantResolveThis} Ty - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'CantResolveThis'. -- */ -- -@@= skipped --1, +1 lines =@@ -+ + */ + diff --git a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.errors.txt index 9d767c9949..40e75b1fda 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.errors.txt @@ -1,13 +1,10 @@ -/a.js(2,12): error TS7006: Parameter 'a' implicitly has an 'any' type. /a.js(8,6): error TS2554: Expected 1 arguments, but got 2. /a.js(9,6): error TS2554: Expected 1 arguments, but got 2. -==== /a.js (3 errors) ==== +==== /a.js (2 errors) ==== /** @param {...number} a */ function f(a) { - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. a; // number | undefined // Ideally this would be a number. But currently checker.ts has only one `argumentsSymbol`, so it's `any`. arguments[0]; diff --git a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.errors.txt.diff index 63d4ee2cb2..29c8d2b01c 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.errors.txt.diff @@ -3,19 +3,12 @@ @@= skipped -0, +0 lines =@@ -/a.js(7,3): error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'number'. -/a.js(8,6): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -+/a.js(2,12): error TS7006: Parameter 'a' implicitly has an 'any' type. +/a.js(8,6): error TS2554: Expected 1 arguments, but got 2. +/a.js(9,6): error TS2554: Expected 1 arguments, but got 2. --==== /a.js (2 errors) ==== -+==== /a.js (3 errors) ==== - /** @param {...number} a */ - function f(a) { -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. - a; // number | undefined - // Ideally this would be a number. But currently checker.ts has only one `argumentsSymbol`, so it's `any`. + ==== /a.js (2 errors) ==== +@@= skipped -9, +9 lines =@@ arguments[0]; } f([1, 2]); // Error diff --git a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.errors.txt deleted file mode 100644 index 1b9bff4e55..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -/a.js(2,12): error TS7019: Rest parameter 'a' implicitly has an 'any[]' type. - - -==== /a.js (1 errors) ==== - /** @param {...number} a */ - function f(...a) { - ~~~~ -!!! error TS7019: Rest parameter 'a' implicitly has an 'any[]' type. - a; // number[] - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.errors.txt.diff deleted file mode 100644 index 79fa219903..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.jsdocRestParameter_es6.errors.txt -+++ new.jsdocRestParameter_es6.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/a.js(2,12): error TS7019: Rest parameter 'a' implicitly has an 'any[]' type. -+ -+ -+==== /a.js (1 errors) ==== -+ /** @param {...number} a */ -+ function f(...a) { -+ ~~~~ -+!!! error TS7019: Rest parameter 'a' implicitly has an 'any[]' type. -+ a; // number[] -+ } -+ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt new file mode 100644 index 0000000000..e7d78345b9 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt @@ -0,0 +1,29 @@ +jsdocTypeCast.js(6,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. +jsdocTypeCast.js(10,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. +jsdocTypeCast.js(14,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. + + +==== jsdocTypeCast.js (3 errors) ==== + /** + * @param {string} x + */ + function f(x) { + /** @type {'a' | 'b'} */ + let a = (x); // Error + ~ +!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. + a; + + /** @type {'a' | 'b'} */ + let b = (((x))); // Error + ~ +!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. + b; + + /** @type {'a' | 'b'} */ + let c = /** @type {'a' | 'b'} */ (x); // Ok + ~ +!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. + c; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt.diff index 0d143fd995..df8b910a28 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt.diff @@ -1,31 +1,22 @@ --- old.jsdocTypeCast.errors.txt +++ new.jsdocTypeCast.errors.txt -@@= skipped -0, +-1 lines =@@ --jsdocTypeCast.js(6,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. --jsdocTypeCast.js(10,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. -- -- +@@= skipped -0, +0 lines =@@ + jsdocTypeCast.js(6,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. + jsdocTypeCast.js(10,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. ++jsdocTypeCast.js(14,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. + + -==== jsdocTypeCast.js (2 errors) ==== -- /** -- * @param {string} x -- */ -- function f(x) { -- /** @type {'a' | 'b'} */ -- let a = (x); // Error -- ~ --!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. -- a; -- -- /** @type {'a' | 'b'} */ -- let b = (((x))); // Error -- ~ --!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. -- b; -- -- /** @type {'a' | 'b'} */ -- let c = /** @type {'a' | 'b'} */ (x); // Ok -- c; -- } -- -@@= skipped --1, +1 lines =@@ -+ ++==== jsdocTypeCast.js (3 errors) ==== + /** + * @param {string} x + */ +@@= skipped -20, +21 lines =@@ + + /** @type {'a' | 'b'} */ + let c = /** @type {'a' | 'b'} */ (x); // Ok ++ ~ ++!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. + c; + } + diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt new file mode 100644 index 0000000000..ee345c568c --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt @@ -0,0 +1,76 @@ +index8.js(4,12): error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? +index8.js(4,15): error TS2304: Cannot find name 'T'. + + +==== index.js (0 errors) ==== + /** + * @param {(m: Boolean) => string} somebody + */ + function sayHello(somebody) { + return 'Hello ' + somebody; + } + +==== index2.js (0 errors) ==== + /** + * @param {(m: Void) => string} somebody + */ + function sayHello2(somebody) { + return 'Hello ' + somebody; + } + + +==== index3.js (0 errors) ==== + /** + * @param {(m: Undefined) => string} somebody + */ + function sayHello3(somebody) { + return 'Hello ' + somebody; + } + + +==== index4.js (0 errors) ==== + /** + * @param {(m: Function) => string} somebody + */ + function sayHello4(somebody) { + return 'Hello ' + somebody; + } + + +==== index5.js (0 errors) ==== + /** + * @param {(m: String) => string} somebody + */ + function sayHello5(somebody) { + return 'Hello ' + somebody; + } + + +==== index6.js (0 errors) ==== + /** + * @param {(m: Number) => string} somebody + */ + function sayHello6(somebody) { + return 'Hello ' + somebody; + } + + +==== index7.js (0 errors) ==== + /** + * @param {(m: Object) => string} somebody + */ + function sayHello7(somebody) { + return 'Hello ' + somebody; + } + +==== index8.js (2 errors) ==== + function fn() {} + + /** + * @param {fn} somebody + ~~ +!!! error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function sayHello8(somebody) { } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff index 0632a01195..8e19d6b491 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff @@ -1,6 +1,6 @@ --- old.jsdocTypeNongenericInstantiationAttempt.errors.txt +++ new.jsdocTypeNongenericInstantiationAttempt.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -index.js(2,19): error TS2315: Type 'Boolean' is not generic. -index2.js(2,19): error TS2315: Type 'Void' is not generic. -index3.js(2,19): error TS2315: Type 'Undefined' is not generic. @@ -8,92 +8,100 @@ -index5.js(2,19): error TS2315: Type 'String' is not generic. -index6.js(2,19): error TS2315: Type 'Number' is not generic. -index7.js(2,19): error TS2315: Type 'Object' is not generic. --index8.js(4,15): error TS2304: Cannot find name 'T'. -- -- ++index8.js(4,12): error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? + index8.js(4,15): error TS2304: Cannot find name 'T'. + + -==== index.js (1 errors) ==== -- /** -- * @param {(m: Boolean) => string} somebody ++==== index.js (0 errors) ==== + /** + * @param {(m: Boolean) => string} somebody - ~~~~~~~~~~ -!!! error TS2315: Type 'Boolean' is not generic. -- */ -- function sayHello(somebody) { -- return 'Hello ' + somebody; -- } -- + */ + function sayHello(somebody) { + return 'Hello ' + somebody; + } + -==== index2.js (1 errors) ==== -- /** -- * @param {(m: Void) => string} somebody ++==== index2.js (0 errors) ==== + /** + * @param {(m: Void) => string} somebody - ~~~~~~~ -!!! error TS2315: Type 'Void' is not generic. -- */ -- function sayHello2(somebody) { -- return 'Hello ' + somebody; -- } -- -- + */ + function sayHello2(somebody) { + return 'Hello ' + somebody; + } + + -==== index3.js (1 errors) ==== -- /** -- * @param {(m: Undefined) => string} somebody ++==== index3.js (0 errors) ==== + /** + * @param {(m: Undefined) => string} somebody - ~~~~~~~~~~~~ -!!! error TS2315: Type 'Undefined' is not generic. -- */ -- function sayHello3(somebody) { -- return 'Hello ' + somebody; -- } -- -- + */ + function sayHello3(somebody) { + return 'Hello ' + somebody; + } + + -==== index4.js (1 errors) ==== -- /** -- * @param {(m: Function) => string} somebody ++==== index4.js (0 errors) ==== + /** + * @param {(m: Function) => string} somebody - ~~~~~~~~~~~ -!!! error TS2315: Type 'Function' is not generic. -- */ -- function sayHello4(somebody) { -- return 'Hello ' + somebody; -- } -- -- + */ + function sayHello4(somebody) { + return 'Hello ' + somebody; + } + + -==== index5.js (1 errors) ==== -- /** -- * @param {(m: String) => string} somebody ++==== index5.js (0 errors) ==== + /** + * @param {(m: String) => string} somebody - ~~~~~~~~~ -!!! error TS2315: Type 'String' is not generic. -- */ -- function sayHello5(somebody) { -- return 'Hello ' + somebody; -- } -- -- + */ + function sayHello5(somebody) { + return 'Hello ' + somebody; + } + + -==== index6.js (1 errors) ==== -- /** -- * @param {(m: Number) => string} somebody ++==== index6.js (0 errors) ==== + /** + * @param {(m: Number) => string} somebody - ~~~~~~~~~ -!!! error TS2315: Type 'Number' is not generic. -- */ -- function sayHello6(somebody) { -- return 'Hello ' + somebody; -- } -- -- + */ + function sayHello6(somebody) { + return 'Hello ' + somebody; + } + + -==== index7.js (1 errors) ==== -- /** -- * @param {(m: Object) => string} somebody ++==== index7.js (0 errors) ==== + /** + * @param {(m: Object) => string} somebody - ~~~~~~~~~ -!!! error TS2315: Type 'Object' is not generic. -- */ -- function sayHello7(somebody) { -- return 'Hello ' + somebody; -- } -- + */ + function sayHello7(somebody) { + return 'Hello ' + somebody; + } + -==== index8.js (1 errors) ==== -- function fn() {} -- -- /** -- * @param {fn} somebody -- ~ --!!! error TS2304: Cannot find name 'T'. -- */ -- function sayHello8(somebody) { } -@@= skipped --1, +1 lines =@@ -+ ++==== index8.js (2 errors) ==== + function fn() {} + + /** + * @param {fn} somebody ++ ~~ ++!!! error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? + ~ + !!! error TS2304: Cannot find name 'T'. + */ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt new file mode 100644 index 0000000000..1760973e82 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt @@ -0,0 +1,26 @@ +test.js(13,14): error TS2304: Cannot find name 'NotADuplicateIdentifier'. +test.js(14,14): error TS2304: Cannot find name 'AlsoNotADuplicate'. + + +==== test.js (2 errors) ==== + // @ts-check + /** @typedef {number} NotADuplicateIdentifier */ + + (2 * 2); + + /** @typedef {number} AlsoNotADuplicate */ + + (2 * 2) + 1; + + + /** + * + * @param a {NotADuplicateIdentifier} + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'NotADuplicateIdentifier'. + * @param b {AlsoNotADuplicate} + ~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'AlsoNotADuplicate'. + */ + function makeSureTypedefsAreStillRecognized(a, b) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt.diff new file mode 100644 index 0000000000..4c1cfab958 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt.diff @@ -0,0 +1,31 @@ +--- old.jsdocTypedefBeforeParenthesizedExpression.errors.txt ++++ new.jsdocTypedefBeforeParenthesizedExpression.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++test.js(13,14): error TS2304: Cannot find name 'NotADuplicateIdentifier'. ++test.js(14,14): error TS2304: Cannot find name 'AlsoNotADuplicate'. ++ ++ ++==== test.js (2 errors) ==== ++ // @ts-check ++ /** @typedef {number} NotADuplicateIdentifier */ ++ ++ (2 * 2); ++ ++ /** @typedef {number} AlsoNotADuplicate */ ++ ++ (2 * 2) + 1; ++ ++ ++ /** ++ * ++ * @param a {NotADuplicateIdentifier} ++ ~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'NotADuplicateIdentifier'. ++ * @param b {AlsoNotADuplicate} ++ ~~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'AlsoNotADuplicate'. ++ */ ++ function makeSureTypedefsAreStillRecognized(a, b) {} ++ diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt index dbf4a9bfef..d65872e460 100644 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt @@ -1,10 +1,9 @@ -index.js(8,26): error TS7006: Parameter 'key' implicitly has an 'any' type. index.js(9,3): error TS2322: Type '() => string | Set | undefined' is not assignable to type '() => string'. Type 'string | Set | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== /** @type {Map>} */ const cache = new Map() @@ -13,8 +12,6 @@ index.js(9,3): error TS2322: Type '() => string | Set | undefined' is no * @returns {() => string} */ const getStringGetter = (key) => { - ~~~ -!!! error TS7006: Parameter 'key' implicitly has an 'any' type. return () => { ~~~~~~ !!! error TS2322: Type '() => string | Set | undefined' is not assignable to type '() => string'. diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff index a50cf777e6..bb0fcf5910 100644 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff @@ -3,13 +3,12 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+index.js(8,26): error TS7006: Parameter 'key' implicitly has an 'any' type. +index.js(9,3): error TS2322: Type '() => string | Set | undefined' is not assignable to type '() => string'. + Type 'string | Set | undefined' is not assignable to type 'string'. + Type 'undefined' is not assignable to type 'string'. + + -+==== index.js (2 errors) ==== ++==== index.js (1 errors) ==== + /** @type {Map>} */ + const cache = new Map() + @@ -18,8 +17,6 @@ + * @returns {() => string} + */ + const getStringGetter = (key) => { -+ ~~~ -+!!! error TS7006: Parameter 'key' implicitly has an 'any' type. + return () => { + ~~~~~~ +!!! error TS2322: Type '() => string | Set | undefined' is not assignable to type '() => string'. diff --git a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt new file mode 100644 index 0000000000..101171f1ce --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt @@ -0,0 +1,47 @@ +check.js(9,12): error TS2304: Cannot find name 'Human'. + + +==== check.ts (0 errors) ==== + // https://github.com/microsoft/TypeScript/issues/31972 + interface Person { + first: string; + last: string; + } + + { + const dice = () => Math.floor(Math.random() * 6); + dice.first = 'Rando'; + dice.last = 'Calrissian'; + const diceP: Person = dice; + } + +==== check.js (1 errors) ==== + // Creates a type { first:string, last: string } + /** + * @typedef {Object} Human - creates a new type named 'SpecialType' + * @property {string} first - a string property of SpecialType + * @property {string} last - a number property of SpecialType + */ + + /** + * @param {Human} param used as a validation tool + ~~~~~ +!!! error TS2304: Cannot find name 'Human'. + */ + function doHumanThings(param) {} + + const dice1 = () => Math.floor(Math.random() * 6); + // dice1.first = 'Rando'; + dice1.last = 'Calrissian'; + + // doHumanThings(dice) + + // but inside a block... you can't call a human + { + const dice2 = () => Math.floor(Math.random() * 6); + dice2.first = 'Rando'; + dice2.last = 'Calrissian'; + + doHumanThings(dice2) + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt.diff new file mode 100644 index 0000000000..5eeb6e5256 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt.diff @@ -0,0 +1,52 @@ +--- old.topLevelBlockExpando.errors.txt ++++ new.topLevelBlockExpando.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++check.js(9,12): error TS2304: Cannot find name 'Human'. ++ ++ ++==== check.ts (0 errors) ==== ++ // https://github.com/microsoft/TypeScript/issues/31972 ++ interface Person { ++ first: string; ++ last: string; ++ } ++ ++ { ++ const dice = () => Math.floor(Math.random() * 6); ++ dice.first = 'Rando'; ++ dice.last = 'Calrissian'; ++ const diceP: Person = dice; ++ } ++ ++==== check.js (1 errors) ==== ++ // Creates a type { first:string, last: string } ++ /** ++ * @typedef {Object} Human - creates a new type named 'SpecialType' ++ * @property {string} first - a string property of SpecialType ++ * @property {string} last - a number property of SpecialType ++ */ ++ ++ /** ++ * @param {Human} param used as a validation tool ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Human'. ++ */ ++ function doHumanThings(param) {} ++ ++ const dice1 = () => Math.floor(Math.random() * 6); ++ // dice1.first = 'Rando'; ++ dice1.last = 'Calrissian'; ++ ++ // doHumanThings(dice) ++ ++ // but inside a block... you can't call a human ++ { ++ const dice2 = () => Math.floor(Math.random() * 6); ++ dice2.first = 'Rando'; ++ dice2.last = 'Calrissian'; ++ ++ doHumanThings(dice2) ++ } ++ diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt index d588dc34f3..9c78b8a6ae 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt @@ -1,7 +1,8 @@ +assertionTypePredicates2.js(10,12): error TS2304: Cannot find name 'A'. assertionTypePredicates2.js(19,17): error TS2304: Cannot find name 'A'. -==== assertionTypePredicates2.js (1 errors) ==== +==== assertionTypePredicates2.js (2 errors) ==== /** * @typedef {{ x: number }} A */ @@ -12,6 +13,8 @@ assertionTypePredicates2.js(19,17): error TS2304: Cannot find name 'A'. /** * @param {A} a + ~ +!!! error TS2304: Cannot find name 'A'. * @returns { asserts a is B } */ const foo = (a) => { diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt.diff index 7a4d4d655a..bb838e0309 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt.diff @@ -3,10 +3,11 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++assertionTypePredicates2.js(10,12): error TS2304: Cannot find name 'A'. +assertionTypePredicates2.js(19,17): error TS2304: Cannot find name 'A'. + + -+==== assertionTypePredicates2.js (1 errors) ==== ++==== assertionTypePredicates2.js (2 errors) ==== + /** + * @typedef {{ x: number }} A + */ @@ -17,6 +18,8 @@ + + /** + * @param {A} a ++ ~ ++!!! error TS2304: Cannot find name 'A'. + * @returns { asserts a is B } + */ + const foo = (a) => { diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt index 83fb3ac952..9597a4dd6e 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt @@ -1,8 +1,9 @@ assertionsAndNonReturningFunctions.js(3,12): error TS2304: Cannot find name 'AssertFunc'. assertionsAndNonReturningFunctions.js(46,9): error TS7027: Unreachable code detected. +assertionsAndNonReturningFunctions.js(58,5): error TS7027: Unreachable code detected. -==== assertionsAndNonReturningFunctions.js (2 errors) ==== +==== assertionsAndNonReturningFunctions.js (3 errors) ==== /** @typedef {(check: boolean) => asserts check} AssertFunc */ /** @type {AssertFunc} */ @@ -65,5 +66,7 @@ assertionsAndNonReturningFunctions.js(46,9): error TS7027: Unreachable code dete case false: return 0; } b; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt.diff index efad814178..061385a2b6 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt.diff @@ -3,10 +3,11 @@ @@= skipped -0, +0 lines =@@ +assertionsAndNonReturningFunctions.js(3,12): error TS2304: Cannot find name 'AssertFunc'. assertionsAndNonReturningFunctions.js(46,9): error TS7027: Unreachable code detected. --assertionsAndNonReturningFunctions.js(58,5): error TS7027: Unreachable code detected. + assertionsAndNonReturningFunctions.js(58,5): error TS7027: Unreachable code detected. - ==== assertionsAndNonReturningFunctions.js (2 errors) ==== +-==== assertionsAndNonReturningFunctions.js (2 errors) ==== ++==== assertionsAndNonReturningFunctions.js (3 errors) ==== /** @typedef {(check: boolean) => asserts check} AssertFunc */ /** @type {AssertFunc} */ @@ -15,11 +16,3 @@ const assert = check => { if (!check) throw new Error(); } -@@= skipped -62, +64 lines =@@ - case false: return 0; - } - b; // Unreachable -- ~~ --!!! error TS7027: Unreachable code detected. - } - diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt index 2994a55aa7..dbbbe1f34c 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt @@ -1,4 +1,5 @@ mod1.js(5,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +use.js(1,20): error TS2306: File 'mod1.js' is not a module. ==== mod1.js (1 errors) ==== @@ -13,8 +14,10 @@ mod1.js(5,1): error TS2580: Cannot find name 'module'. Do you need to install ty this.p = 1 } -==== use.js (0 errors) ==== +==== use.js (1 errors) ==== /** @param {import('./mod1').Con} k */ + ~~~~~~~~ +!!! error TS2306: File 'mod1.js' is not a module. function f(k) { if (1 === 2 - 1) { // I guess basic math works! diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt.diff index ac9047c074..fc24b46f5c 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt.diff @@ -4,6 +4,7 @@ - @@= skipped --1, +1 lines =@@ +mod1.js(5,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++use.js(1,20): error TS2306: File 'mod1.js' is not a module. + + +==== mod1.js (1 errors) ==== @@ -18,8 +19,10 @@ + this.p = 1 + } + -+==== use.js (0 errors) ==== ++==== use.js (1 errors) ==== + /** @param {import('./mod1').Con} k */ ++ ~~~~~~~~ ++!!! error TS2306: File 'mod1.js' is not a module. + function f(k) { + if (1 === 2 - 1) { + // I guess basic math works! diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt new file mode 100644 index 0000000000..fa694a91df --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt @@ -0,0 +1,23 @@ +cb_nested.js(11,12): error TS2304: Cannot find name 'WorksWithPeopleCallback'. + + +==== cb_nested.js (1 errors) ==== + /** + * @callback WorksWithPeopleCallback + * @param {Object} person + * @param {string} person.name + * @param {number} [person.age] + * @returns {void} + */ + + /** + * For each person, calls your callback. + * @param {WorksWithPeopleCallback} callback + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'WorksWithPeopleCallback'. + * @returns {void} + */ + function eachPerson(callback) { + callback({ name: "Empty" }); + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt.diff new file mode 100644 index 0000000000..f6ca9c7ec2 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt.diff @@ -0,0 +1,28 @@ +--- old.callbackTagNestedParameter.errors.txt ++++ new.callbackTagNestedParameter.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++cb_nested.js(11,12): error TS2304: Cannot find name 'WorksWithPeopleCallback'. ++ ++ ++==== cb_nested.js (1 errors) ==== ++ /** ++ * @callback WorksWithPeopleCallback ++ * @param {Object} person ++ * @param {string} person.name ++ * @param {number} [person.age] ++ * @returns {void} ++ */ ++ ++ /** ++ * For each person, calls your callback. ++ * @param {WorksWithPeopleCallback} callback ++ ~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'WorksWithPeopleCallback'. ++ * @returns {void} ++ */ ++ function eachPerson(callback) { ++ callback({ name: "Empty" }); ++ } ++ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt new file mode 100644 index 0000000000..6667ba8172 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt @@ -0,0 +1,55 @@ +0.js(9,12): error TS2304: Cannot find name 'Opts'. +0.js(22,12): error TS2304: Cannot find name 'AnotherOpts'. +0.js(37,12): error TS2304: Cannot find name 'Opts1'. + + +==== 0.js (3 errors) ==== + // @ts-check + /** + * @typedef {Object} Opts + * @property {string} x + * @property {string=} y + * @property {string} [z] + * @property {string} [w="hi"] + * + * @param {Opts} opts + ~~~~ +!!! error TS2304: Cannot find name 'Opts'. + */ + function foo(opts) { + opts.x; + } + + foo({x: 'abc'}); + + /** + * @typedef {Object} AnotherOpts + * @property anotherX {string} + * @property anotherY {string=} + * + * @param {AnotherOpts} opts + ~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'AnotherOpts'. + */ + function foo1(opts) { + opts.anotherX; + } + + foo1({anotherX: "world"}); + + /** + * @typedef {object} Opts1 + * @property {string} x + * @property {string=} y + * @property {string} [z] + * @property {string} [w="hi"] + * + * @param {Opts1} opts + ~~~~~ +!!! error TS2304: Cannot find name 'Opts1'. + */ + function foo2(opts) { + opts.x; + } + foo2({x: 'abc'}); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff new file mode 100644 index 0000000000..79407aac3d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff @@ -0,0 +1,60 @@ +--- old.checkJsdocTypedefInParamTag1.errors.txt ++++ new.checkJsdocTypedefInParamTag1.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++0.js(9,12): error TS2304: Cannot find name 'Opts'. ++0.js(22,12): error TS2304: Cannot find name 'AnotherOpts'. ++0.js(37,12): error TS2304: Cannot find name 'Opts1'. ++ ++ ++==== 0.js (3 errors) ==== ++ // @ts-check ++ /** ++ * @typedef {Object} Opts ++ * @property {string} x ++ * @property {string=} y ++ * @property {string} [z] ++ * @property {string} [w="hi"] ++ * ++ * @param {Opts} opts ++ ~~~~ ++!!! error TS2304: Cannot find name 'Opts'. ++ */ ++ function foo(opts) { ++ opts.x; ++ } ++ ++ foo({x: 'abc'}); ++ ++ /** ++ * @typedef {Object} AnotherOpts ++ * @property anotherX {string} ++ * @property anotherY {string=} ++ * ++ * @param {AnotherOpts} opts ++ ~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'AnotherOpts'. ++ */ ++ function foo1(opts) { ++ opts.anotherX; ++ } ++ ++ foo1({anotherX: "world"}); ++ ++ /** ++ * @typedef {object} Opts1 ++ * @property {string} x ++ * @property {string=} y ++ * @property {string} [z] ++ * @property {string} [w="hi"] ++ * ++ * @param {Opts1} opts ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Opts1'. ++ */ ++ function foo2(opts) { ++ opts.x; ++ } ++ foo2({x: 'abc'}); ++ diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt index 212636b13a..9168ba5e40 100644 --- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt @@ -1,15 +1,16 @@ -first.js(21,19): error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. +first.js(21,19): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. first.js(24,14): error TS2339: Property 'foonly' does not exist on type 'Sql'. first.js(44,4): error TS2339: Property 'numberOxen' does not exist on type 'Sql'. first.js(44,20): error TS2339: Property 'foonly' does not exist on type 'Sql'. first.js(47,24): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. -generic.js(9,23): error TS2507: Type '(flavour: any) => void' is not a constructor function type. +generic.js(3,12): error TS2304: Cannot find name 'T'. +generic.js(9,23): error TS2507: Type '(flavour: T) => void' is not a constructor function type. generic.js(11,21): error TS2339: Property 'flavour' does not exist on type 'Chowder'. generic.js(17,27): error TS2554: Expected 0 arguments, but got 1. generic.js(18,9): error TS2339: Property 'flavour' does not exist on type 'Chowder'. generic.js(20,32): error TS2554: Expected 0 arguments, but got 1. second.ts(8,25): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. -second.ts(14,25): error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. +second.ts(14,25): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Conestoga'. @@ -36,7 +37,7 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con // ok class Sql extends Wagon { ~~~~~ -!!! error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. +!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. constructor() { super(); // error: not enough arguments this.foonly = 12 @@ -92,7 +93,7 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con // ok class Conestoga extends Wagon { ~~~~~ -!!! error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. +!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. constructor(public drunkOO: true) { // error: wrong type super('nope'); @@ -108,10 +109,12 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con ~~~~~~~~~~ !!! error TS2339: Property 'numberOxen' does not exist on type 'Conestoga'. -==== generic.js (5 errors) ==== +==== generic.js (6 errors) ==== /** * @template T * @param {T} flavour + ~ +!!! error TS2304: Cannot find name 'T'. */ function Soup(flavour) { this.flavour = flavour @@ -119,7 +122,7 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con /** @extends {Soup<{ claim: "ignorant" | "malicious" }>} */ class Chowder extends Soup { ~~~~ -!!! error TS2507: Type '(flavour: any) => void' is not a constructor function type. +!!! error TS2507: Type '(flavour: T) => void' is not a constructor function type. log() { return this.flavour ~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt.diff index 183cf7367f..857faf1608 100644 --- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt.diff @@ -5,14 +5,15 @@ -first.js(31,5): error TS2416: Property 'load' in type 'Sql' is not assignable to the same property in base type 'Wagon'. - Type '(files: string[], format: "csv" | "json" | "xmlolololol") => void' is not assignable to type '(supplies?: any[]) => void'. - Target signature provides too few arguments. Expected 2 or more, but got 1. -+first.js(21,19): error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. ++first.js(21,19): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. +first.js(24,14): error TS2339: Property 'foonly' does not exist on type 'Sql'. +first.js(44,4): error TS2339: Property 'numberOxen' does not exist on type 'Sql'. +first.js(44,20): error TS2339: Property 'foonly' does not exist on type 'Sql'. first.js(47,24): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. -generic.js(19,19): error TS2554: Expected 1 arguments, but got 0. -generic.js(20,32): error TS2345: Argument of type 'number' is not assignable to parameter of type '{ claim: "ignorant" | "malicious"; }'. -+generic.js(9,23): error TS2507: Type '(flavour: any) => void' is not a constructor function type. ++generic.js(3,12): error TS2304: Cannot find name 'T'. ++generic.js(9,23): error TS2507: Type '(flavour: T) => void' is not a constructor function type. +generic.js(11,21): error TS2339: Property 'flavour' does not exist on type 'Chowder'. +generic.js(17,27): error TS2554: Expected 0 arguments, but got 1. +generic.js(18,9): error TS2339: Property 'flavour' does not exist on type 'Chowder'. @@ -25,7 +26,7 @@ - Type 'Wagon[]' is not assignable to type '(typeof Wagon)[]'. - Property 'circle' is missing in type 'Wagon' but required in type 'typeof Wagon'. -second.ts(17,15): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -+second.ts(14,25): error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. ++second.ts(14,25): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. +second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Conestoga'. @@ -34,12 +35,12 @@ /** * @constructor * @param {number} numberOxen -@@= skipped -36, +34 lines =@@ +@@= skipped -36, +35 lines =@@ } // ok class Sql extends Wagon { + ~~~~~ -+!!! error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. ++!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. constructor() { super(); // error: not enough arguments - ~~~~~ @@ -86,7 +87,7 @@ -!!! error TS2417: Property 'circle' is missing in type 'Wagon' but required in type 'typeof Wagon'. -!!! related TS2728 first.js:9:1: 'circle' is declared here. + ~~~~~ -+!!! error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. ++!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. constructor(public drunkOO: true) { // error: wrong type super('nope'); @@ -103,16 +104,20 @@ +!!! error TS2339: Property 'numberOxen' does not exist on type 'Conestoga'. -==== generic.js (2 errors) ==== -+==== generic.js (5 errors) ==== ++==== generic.js (6 errors) ==== /** * @template T * @param {T} flavour -@@= skipped -11, +13 lines =@@ ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function Soup(flavour) { + this.flavour = flavour } /** @extends {Soup<{ claim: "ignorant" | "malicious" }>} */ class Chowder extends Soup { + ~~~~ -+!!! error TS2507: Type '(flavour: any) => void' is not a constructor function type. ++!!! error TS2507: Type '(flavour: T) => void' is not a constructor function type. log() { return this.flavour + ~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt index 0cafdc45f5..04d5cfd894 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt @@ -1,6 +1,6 @@ main.js(1,9): error TS2451: Cannot redeclare block-scoped variable 'K'. main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -main.js(3,12): error TS7006: Parameter 'k' implicitly has an 'any' type. +main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? mod1.js(1,7): error TS2451: Cannot redeclare block-scoped variable 'K'. mod1.js(6,1): error TS2304: Cannot find name 'exports'. @@ -13,9 +13,9 @@ mod1.js(6,1): error TS2304: Cannot find name 'exports'. ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @param {K} k */ + ~ +!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? function f(k) { - ~ -!!! error TS7006: Parameter 'k' implicitly has an 'any' type. k.values() } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt.diff index b612cb10b5..d2f2ce6611 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt.diff @@ -5,7 +5,7 @@ @@= skipped --1, +1 lines =@@ +main.js(1,9): error TS2451: Cannot redeclare block-scoped variable 'K'. +main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+main.js(3,12): error TS7006: Parameter 'k' implicitly has an 'any' type. ++main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? +mod1.js(1,7): error TS2451: Cannot redeclare block-scoped variable 'K'. +mod1.js(6,1): error TS2304: Cannot find name 'exports'. + @@ -18,9 +18,9 @@ + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @param {K} k */ ++ ~ ++!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? + function f(k) { -+ ~ -+!!! error TS7006: Parameter 'k' implicitly has an 'any' type. + k.values() + } + diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt index 4b5091844a..eb50cc5891 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt @@ -1,5 +1,5 @@ main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -main.js(3,12): error TS7006: Parameter 'k' implicitly has an 'any' type. +main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? mod1.js(1,1): error TS2304: Cannot find name 'exports'. @@ -8,9 +8,9 @@ mod1.js(1,1): error TS2304: Cannot find name 'exports'. ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @param {K} k */ + ~ +!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? function f(k) { - ~ -!!! error TS7006: Parameter 'k' implicitly has an 'any' type. k.values() } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt.diff index f68ab74193..bf8c296755 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt.diff @@ -4,7 +4,7 @@ - @@= skipped --1, +1 lines =@@ +main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+main.js(3,12): error TS7006: Parameter 'k' implicitly has an 'any' type. ++main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? +mod1.js(1,1): error TS2304: Cannot find name 'exports'. + + @@ -13,9 +13,9 @@ + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @param {K} k */ ++ ~ ++!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? + function f(k) { -+ ~ -+!!! error TS7006: Parameter 'k' implicitly has an 'any' type. + k.values() + } + diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt index f073a561ff..0444e83a7f 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt @@ -1,5 +1,5 @@ main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -main.js(3,12): error TS7006: Parameter 'k' implicitly has an 'any' type. +main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? mod1.js(2,4): error TS2339: Property 'K' does not exist on type '{}'. mod1.js(4,23): error TS2339: Property 'K' does not exist on type '{}'. mod1.js(7,1): error TS2304: Cannot find name 'exports'. @@ -11,9 +11,9 @@ mod1.js(7,16): error TS2339: Property 'K' does not exist on type '{}'. ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @param {K} k */ + ~ +!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? function f(k) { - ~ -!!! error TS7006: Parameter 'k' implicitly has an 'any' type. k.values() } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt.diff index 0503956afc..89b004e1e7 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt.diff @@ -4,7 +4,7 @@ - @@= skipped --1, +1 lines =@@ +main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+main.js(3,12): error TS7006: Parameter 'k' implicitly has an 'any' type. ++main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? +mod1.js(2,4): error TS2339: Property 'K' does not exist on type '{}'. +mod1.js(4,23): error TS2339: Property 'K' does not exist on type '{}'. +mod1.js(7,1): error TS2304: Cannot find name 'exports'. @@ -16,9 +16,9 @@ + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @param {K} k */ ++ ~ ++!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? + function f(k) { -+ ~ -+!!! error TS7006: Parameter 'k' implicitly has an 'any' type. + k.values() + } + diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt index d61f877f45..40c3397a77 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt @@ -1,10 +1,15 @@ +constructorFunctionMethodTypeParameters.js(3,12): error TS2304: Cannot find name 'T'. +constructorFunctionMethodTypeParameters.js(22,16): error TS2304: Cannot find name 'T'. +constructorFunctionMethodTypeParameters.js(23,16): error TS2304: Cannot find name 'U'. constructorFunctionMethodTypeParameters.js(24,17): error TS2304: Cannot find name 'T'. -==== constructorFunctionMethodTypeParameters.js (1 errors) ==== +==== constructorFunctionMethodTypeParameters.js (4 errors) ==== /** * @template {string} T * @param {T} t + ~ +!!! error TS2304: Cannot find name 'T'. */ function Cls(t) { this.t = t; @@ -24,7 +29,11 @@ constructorFunctionMethodTypeParameters.js(24,17): error TS2304: Cannot find nam /** * @template {string} U * @param {T} t + ~ +!!! error TS2304: Cannot find name 'T'. * @param {U} u + ~ +!!! error TS2304: Cannot find name 'U'. * @return {T} ~ !!! error TS2304: Cannot find name 'T'. diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff index cfb4ecdbf1..a5192ef807 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff @@ -3,13 +3,18 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++constructorFunctionMethodTypeParameters.js(3,12): error TS2304: Cannot find name 'T'. ++constructorFunctionMethodTypeParameters.js(22,16): error TS2304: Cannot find name 'T'. ++constructorFunctionMethodTypeParameters.js(23,16): error TS2304: Cannot find name 'U'. +constructorFunctionMethodTypeParameters.js(24,17): error TS2304: Cannot find name 'T'. + + -+==== constructorFunctionMethodTypeParameters.js (1 errors) ==== ++==== constructorFunctionMethodTypeParameters.js (4 errors) ==== + /** + * @template {string} T + * @param {T} t ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function Cls(t) { + this.t = t; @@ -29,7 +34,11 @@ + /** + * @template {string} U + * @param {T} t ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @param {U} u ++ ~ ++!!! error TS2304: Cannot find name 'U'. + * @return {T} + ~ +!!! error TS2304: Cannot find name 'T'. diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.errors.txt b/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.errors.txt index 7aa952a2a5..0744aa6348 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.errors.txt @@ -1,15 +1,11 @@ -a.js(2,12): error TS7006: Parameter 'x' implicitly has an 'any' type. a.js(8,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -a.js(13,12): error TS7006: Parameter 'x' implicitly has an 'any' type. a.js(15,16): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. a.js(20,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -==== a.js (5 errors) ==== +==== a.js (3 errors) ==== /** @param {number} x */ function C(x) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. this.x = x } C.prototype.m = function() { @@ -23,8 +19,6 @@ a.js(20,9): error TS7009: 'new' expression, whose target lacks a construct signa /** @param {number} x */ function A(x) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. if (!(this instanceof A)) { return new A(x) ~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.errors.txt.diff index 466a2b3581..b3511b4a8d 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.errors.txt.diff @@ -2,22 +2,17 @@ +++ new.constructorFunctionsStrict.errors.txt @@= skipped -0, +0 lines =@@ -a.js(9,1): error TS2322: Type 'undefined' is not assignable to type 'number'. -+a.js(2,12): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(8,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -+a.js(13,12): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(15,16): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. +a.js(20,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -==== a.js (1 errors) ==== -+==== a.js (5 errors) ==== ++==== a.js (3 errors) ==== /** @param {number} x */ function C(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. this.x = x - } - C.prototype.m = function() { +@@= skipped -9, +11 lines =@@ this.y = 12 } var c = new C(1) @@ -30,8 +25,6 @@ /** @param {number} x */ function A(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. if (!(this instanceof A)) { return new A(x) + ~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt index b0cd9b62b0..800958af53 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt @@ -1,8 +1,11 @@ +a.js(24,13): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? +a.js(25,12): error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? +a.js(26,12): error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? a.js(35,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. -==== a.js (2 errors) ==== +==== a.js (5 errors) ==== /** @enum {string} */ const Target = { START: "start", @@ -27,8 +30,14 @@ a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: s } /** @param {Target} t + ~~~~~~ +!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? * @param {Second} s + ~~~~~~ +!!! error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? * @param {Fs} f + ~~ +!!! error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? */ function consume(t,s,f) { /** @type {string} */ diff --git a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt.diff index 465c18313d..62b9f20755 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt.diff @@ -3,12 +3,15 @@ @@= skipped -0, +0 lines =@@ -a.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. -a.js(12,5): error TS2322: Type 'string' is not assignable to type 'number'. ++a.js(24,13): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? ++a.js(25,12): error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? ++a.js(26,12): error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? +a.js(35,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. -==== a.js (3 errors) ==== -+==== a.js (2 errors) ==== ++==== a.js (5 errors) ==== /** @enum {string} */ const Target = { START: "start", @@ -28,7 +31,22 @@ OK: 1, /** @type {number} */ FINE: 2, -@@= skipped -42, +37 lines =@@ +@@= skipped -31, +29 lines =@@ + } + + /** @param {Target} t ++ ~~~~~~ ++!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? + * @param {Second} s ++ ~~~~~~ ++!!! error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? + * @param {Fs} f ++ ~~ ++!!! error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? + */ + function consume(t,s,f) { + /** @type {string} */ +@@= skipped -11, +17 lines =@@ /** @type {(n: number) => number} */ var fun = f /** @type {Target} */ diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt new file mode 100644 index 0000000000..56965bed27 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt @@ -0,0 +1,51 @@ +/a.js(13,15): error TS2304: Cannot find name 'T'. + + +==== /a.js (1 errors) ==== + /** + * @typedef {{ + * a: number | string; + * b: boolean | string[]; + * }} Foo + */ + + /** + * @template {Foo} T + */ + class A { + /** + * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. + */ + constructor(a) { + return a + } + } + + /** + * @extends {A<{ + * a: string, + * b: string[] + * }>} + */ + class B extends A {} + + /** + * @extends {A<{ + * a: string, + * b: string + * }>} + */ + class C extends A {} + + /** + * @extends {A<{a: string, b: string[]}>} + */ + class D extends A {} + + /** + * @extends {A<{a: string, b: string}>} + */ + class E extends A {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt.diff index 536d568237..b4e6231a88 100644 --- a/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt.diff @@ -1,70 +1,54 @@ --- old.extendsTag5.errors.txt +++ new.extendsTag5.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(29,16): error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. - Types of property 'b' are incompatible. - Type 'string' is not assignable to type 'boolean | string[]'. -/a.js(42,16): error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. - Types of property 'b' are incompatible. - Type 'string' is not assignable to type 'boolean | string[]'. -- -- ++/a.js(13,15): error TS2304: Cannot find name 'T'. + + -==== /a.js (2 errors) ==== -- /** -- * @typedef {{ -- * a: number | string; -- * b: boolean | string[]; -- * }} Foo -- */ -- -- /** -- * @template {Foo} T -- */ -- class A { -- /** -- * @param {T} a -- */ -- constructor(a) { -- return a -- } -- } -- -- /** -- * @extends {A<{ -- * a: string, -- * b: string[] -- * }>} -- */ -- class B extends A {} -- -- /** -- * @extends {A<{ ++==== /a.js (1 errors) ==== + /** + * @typedef {{ + * a: number | string; +@@= skipped -19, +14 lines =@@ + class A { + /** + * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + constructor(a) { + return a +@@= skipped -16, +18 lines =@@ + + /** + * @extends {A<{ - ~ -- * a: string, + * a: string, - ~~~~~~~~~~~~~~~~~ -- * b: string + * b: string - ~~~~~~~~~~~~~~~~ -- * }>} + * }>} - ~~~~ -!!! error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. -!!! error TS2344: Types of property 'b' are incompatible. -!!! error TS2344: Type 'string' is not assignable to type 'boolean | string[]'. -- */ -- class C extends A {} -- -- /** -- * @extends {A<{a: string, b: string[]}>} -- */ -- class D extends A {} -- -- /** -- * @extends {A<{a: string, b: string}>} + */ + class C extends A {} + +@@= skipped -20, +13 lines =@@ + + /** + * @extends {A<{a: string, b: string}>} - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. -!!! error TS2344: Types of property 'b' are incompatible. -!!! error TS2344: Type 'string' is not assignable to type 'boolean | string[]'. -- */ -- class E extends A {} -- -@@= skipped --1, +1 lines =@@ -+ + */ + class E extends A {} + diff --git a/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt b/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt new file mode 100644 index 0000000000..e84a7edd68 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt @@ -0,0 +1,29 @@ +genericSetterInClassTypeJsDoc.js(7,17): error TS2304: Cannot find name 'T'. + + +==== genericSetterInClassTypeJsDoc.js (1 errors) ==== + /** + * @template T + */ + class Box { + #value; + + /** @param {T} initialValue */ + ~ +!!! error TS2304: Cannot find name 'T'. + constructor(initialValue) { + this.#value = initialValue; + } + + /** @type {T} */ + get value() { + return this.#value; + } + + set value(value) { + this.#value = value; + } + } + + new Box(3).value = 3; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt.diff new file mode 100644 index 0000000000..535e78bd35 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt.diff @@ -0,0 +1,34 @@ +--- old.genericSetterInClassTypeJsDoc.errors.txt ++++ new.genericSetterInClassTypeJsDoc.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++genericSetterInClassTypeJsDoc.js(7,17): error TS2304: Cannot find name 'T'. ++ ++ ++==== genericSetterInClassTypeJsDoc.js (1 errors) ==== ++ /** ++ * @template T ++ */ ++ class Box { ++ #value; ++ ++ /** @param {T} initialValue */ ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ constructor(initialValue) { ++ this.#value = initialValue; ++ } ++ ++ /** @type {T} */ ++ get value() { ++ return this.#value; ++ } ++ ++ set value(value) { ++ this.#value = value; ++ } ++ } ++ ++ new Box(3).value = 3; ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt new file mode 100644 index 0000000000..bfac61ad4a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt @@ -0,0 +1,20 @@ +/foo.js(6,13): error TS2304: Cannot find name 'Foo'. + + +==== /types.ts (0 errors) ==== + export interface Foo { + a: number; + } + +==== /foo.js (1 errors) ==== + /** + * @import { Foo } from "./types" + */ + + /** + * @param { Foo } foo + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + function f(foo) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt.diff new file mode 100644 index 0000000000..045636af04 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.importTag1.errors.txt ++++ new.importTag1.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(6,13): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface Foo { ++ a: number; ++ } ++ ++==== /foo.js (1 errors) ==== ++ /** ++ * @import { Foo } from "./types" ++ */ ++ ++ /** ++ * @param { Foo } foo ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ */ ++ function f(foo) {} ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt b/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt new file mode 100644 index 0000000000..021e5864c6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt @@ -0,0 +1,15 @@ +1.js(4,13): error TS2304: Cannot find name 'I'. + + +==== 0.ts (0 errors) ==== + export interface I { } + +==== 1.js (1 errors) ==== + /** @import { I } from './0' with { type: "json" } */ + /** @import * as foo from './0' with { type: "json" } */ + + /** @param {I} a */ + ~ +!!! error TS2304: Cannot find name 'I'. + function f(a) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt.diff index fe54c81fd5..619cb1400c 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt.diff @@ -1,23 +1,25 @@ --- old.importTag15(module=es2015).errors.txt +++ new.importTag15(module=es2015).errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -1.js(1,30): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.js(2,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -- -- --==== 0.ts (0 errors) ==== -- export interface I { } -- ++1.js(4,13): error TS2304: Cannot find name 'I'. + + + ==== 0.ts (0 errors) ==== + export interface I { } + -==== 1.js (2 errors) ==== -- /** @import { I } from './0' with { type: "json" } */ ++==== 1.js (1 errors) ==== + /** @import { I } from './0' with { type: "json" } */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -- /** @import * as foo from './0' with { type: "json" } */ + /** @import * as foo from './0' with { type: "json" } */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -- -- /** @param {I} a */ -- function f(a) {} -- -@@= skipped --1, +1 lines =@@ -+ + + /** @param {I} a */ ++ ~ ++!!! error TS2304: Cannot find name 'I'. + function f(a) {} + diff --git a/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt b/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt new file mode 100644 index 0000000000..021e5864c6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt @@ -0,0 +1,15 @@ +1.js(4,13): error TS2304: Cannot find name 'I'. + + +==== 0.ts (0 errors) ==== + export interface I { } + +==== 1.js (1 errors) ==== + /** @import { I } from './0' with { type: "json" } */ + /** @import * as foo from './0' with { type: "json" } */ + + /** @param {I} a */ + ~ +!!! error TS2304: Cannot find name 'I'. + function f(a) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt.diff index 89c48b23da..3f390debf8 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt.diff @@ -1,23 +1,25 @@ --- old.importTag15(module=esnext).errors.txt +++ new.importTag15(module=esnext).errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -1.js(1,30): error TS2857: Import attributes cannot be used with type-only imports or exports. -1.js(2,33): error TS2857: Import attributes cannot be used with type-only imports or exports. -- -- --==== 0.ts (0 errors) ==== -- export interface I { } -- ++1.js(4,13): error TS2304: Cannot find name 'I'. + + + ==== 0.ts (0 errors) ==== + export interface I { } + -==== 1.js (2 errors) ==== -- /** @import { I } from './0' with { type: "json" } */ ++==== 1.js (1 errors) ==== + /** @import { I } from './0' with { type: "json" } */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2857: Import attributes cannot be used with type-only imports or exports. -- /** @import * as foo from './0' with { type: "json" } */ + /** @import * as foo from './0' with { type: "json" } */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2857: Import attributes cannot be used with type-only imports or exports. -- -- /** @param {I} a */ -- function f(a) {} -- -@@= skipped --1, +1 lines =@@ -+ + + /** @param {I} a */ ++ ~ ++!!! error TS2304: Cannot find name 'I'. + function f(a) {} + diff --git a/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt new file mode 100644 index 0000000000..152fcdec23 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt @@ -0,0 +1,21 @@ +b.js(4,12): error TS2304: Cannot find name 'Foo'. +b.js(5,12): error TS2304: Cannot find name 'I'. + + +==== a.ts (0 errors) ==== + export default interface Foo {} + export interface I {} + +==== b.js (2 errors) ==== + /** @import Foo, { I } from "./a" */ + + /** + * @param {Foo} a + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + * @param {I} b + ~ +!!! error TS2304: Cannot find name 'I'. + */ + export function foo(a, b) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt.diff new file mode 100644 index 0000000000..a2ed8030b1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt.diff @@ -0,0 +1,26 @@ +--- old.importTag16.errors.txt ++++ new.importTag16.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++b.js(4,12): error TS2304: Cannot find name 'Foo'. ++b.js(5,12): error TS2304: Cannot find name 'I'. ++ ++ ++==== a.ts (0 errors) ==== ++ export default interface Foo {} ++ export interface I {} ++ ++==== b.js (2 errors) ==== ++ /** @import Foo, { I } from "./a" */ ++ ++ /** ++ * @param {Foo} a ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ * @param {I} b ++ ~ ++!!! error TS2304: Cannot find name 'I'. ++ */ ++ export function foo(a, b) {} ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt new file mode 100644 index 0000000000..843e5470b9 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt @@ -0,0 +1,20 @@ +b.js(8,12): error TS2304: Cannot find name 'Foo'. + + +==== a.ts (0 errors) ==== + export interface Foo {} + +==== b.js (1 errors) ==== + /** + * @import { + * Foo + * } from "./a" + */ + + /** + * @param {Foo} a + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + export function foo(a) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt.diff new file mode 100644 index 0000000000..8895183edb --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.importTag18.errors.txt ++++ new.importTag18.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++b.js(8,12): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== a.ts (0 errors) ==== ++ export interface Foo {} ++ ++==== b.js (1 errors) ==== ++ /** ++ * @import { ++ * Foo ++ * } from "./a" ++ */ ++ ++ /** ++ * @param {Foo} a ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ */ ++ export function foo(a) {} ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt new file mode 100644 index 0000000000..1adc07dfbe --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt @@ -0,0 +1,19 @@ +b.js(7,12): error TS2304: Cannot find name 'Foo'. + + +==== a.ts (0 errors) ==== + export interface Foo {} + +==== b.js (1 errors) ==== + /** + * @import { Foo } + * from "./a" + */ + + /** + * @param {Foo} a + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + export function foo(a) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt.diff new file mode 100644 index 0000000000..8839708644 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt.diff @@ -0,0 +1,24 @@ +--- old.importTag19.errors.txt ++++ new.importTag19.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++b.js(7,12): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== a.ts (0 errors) ==== ++ export interface Foo {} ++ ++==== b.js (1 errors) ==== ++ /** ++ * @import { Foo } ++ * from "./a" ++ */ ++ ++ /** ++ * @param {Foo} a ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ */ ++ export function foo(a) {} ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt new file mode 100644 index 0000000000..75e50ed132 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt @@ -0,0 +1,20 @@ +/foo.js(6,13): error TS2503: Cannot find namespace 'types'. + + +==== /types.ts (0 errors) ==== + export interface Foo { + a: number; + } + +==== /foo.js (1 errors) ==== + /** + * @import * as types from "./types" + */ + + /** + * @param { types.Foo } foo + ~~~~~ +!!! error TS2503: Cannot find namespace 'types'. + */ + export function f(foo) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt.diff new file mode 100644 index 0000000000..68b2074596 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.importTag2.errors.txt ++++ new.importTag2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(6,13): error TS2503: Cannot find namespace 'types'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface Foo { ++ a: number; ++ } ++ ++==== /foo.js (1 errors) ==== ++ /** ++ * @import * as types from "./types" ++ */ ++ ++ /** ++ * @param { types.Foo } foo ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'types'. ++ */ ++ export function f(foo) {} ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt new file mode 100644 index 0000000000..2ec34959d1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt @@ -0,0 +1,20 @@ +b.js(8,12): error TS2304: Cannot find name 'Foo'. + + +==== a.ts (0 errors) ==== + export interface Foo {} + +==== b.js (1 errors) ==== + /** + * @import + * { Foo + * } from './a' + */ + + /** + * @param {Foo} a + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + export function foo(a) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt.diff new file mode 100644 index 0000000000..3001e176c7 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.importTag20.errors.txt ++++ new.importTag20.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++b.js(8,12): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== a.ts (0 errors) ==== ++ export interface Foo {} ++ ++==== b.js (1 errors) ==== ++ /** ++ * @import ++ * { Foo ++ * } from './a' ++ */ ++ ++ /** ++ * @param {Foo} a ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ */ ++ export function foo(a) {} ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt new file mode 100644 index 0000000000..74ccb4534f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt @@ -0,0 +1,20 @@ +/foo.js(6,13): error TS2304: Cannot find name 'Foo'. + + +==== /types.ts (0 errors) ==== + export default interface Foo { + a: number; + } + +==== /foo.js (1 errors) ==== + /** + * @import Foo from "./types" + */ + + /** + * @param { Foo } foo + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + export function f(foo) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt.diff new file mode 100644 index 0000000000..31d34ac710 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.importTag3.errors.txt ++++ new.importTag3.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(6,13): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export default interface Foo { ++ a: number; ++ } ++ ++==== /foo.js (1 errors) ==== ++ /** ++ * @import Foo from "./types" ++ */ ++ ++ /** ++ * @param { Foo } foo ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ */ ++ export function f(foo) {} ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt new file mode 100644 index 0000000000..23e58203fa --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt @@ -0,0 +1,24 @@ +/foo.js(10,13): error TS2304: Cannot find name 'Foo'. + + +==== /types.ts (0 errors) ==== + export interface Foo { + a: number; + } + +==== /foo.js (1 errors) ==== + /** + * @import { Foo } from "./types" + */ + + /** + * @import { Foo } from "./types" + */ + + /** + * @param { Foo } foo + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + function f(foo) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt.diff index 816497509b..8f00ca389e 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt.diff @@ -1,32 +1,34 @@ --- old.importTag4.errors.txt +++ new.importTag4.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/foo.js(2,14): error TS2300: Duplicate identifier 'Foo'. -/foo.js(6,14): error TS2300: Duplicate identifier 'Foo'. -- -- --==== /types.ts (0 errors) ==== -- export interface Foo { -- a: number; -- } -- ++/foo.js(10,13): error TS2304: Cannot find name 'Foo'. + + + ==== /types.ts (0 errors) ==== +@@= skipped -6, +5 lines =@@ + a: number; + } + -==== /foo.js (2 errors) ==== -- /** -- * @import { Foo } from "./types" ++==== /foo.js (1 errors) ==== + /** + * @import { Foo } from "./types" - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -- */ -- -- /** -- * @import { Foo } from "./types" + */ + + /** + * @import { Foo } from "./types" - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -- */ -- -- /** -- * @param { Foo } foo -- */ -- function f(foo) {} -- -@@= skipped --1, +1 lines =@@ -+ + */ + + /** + * @param { Foo } foo ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. + */ + function f(foo) {} + diff --git a/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt new file mode 100644 index 0000000000..bfac61ad4a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt @@ -0,0 +1,20 @@ +/foo.js(6,13): error TS2304: Cannot find name 'Foo'. + + +==== /types.ts (0 errors) ==== + export interface Foo { + a: number; + } + +==== /foo.js (1 errors) ==== + /** + * @import { Foo } from "./types" + */ + + /** + * @param { Foo } foo + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + function f(foo) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt.diff new file mode 100644 index 0000000000..25bcd83984 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.importTag5.errors.txt ++++ new.importTag5.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(6,13): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface Foo { ++ a: number; ++ } ++ ++==== /foo.js (1 errors) ==== ++ /** ++ * @import { Foo } from "./types" ++ */ ++ ++ /** ++ * @param { Foo } foo ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ */ ++ function f(foo) {} ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt new file mode 100644 index 0000000000..6a1ec95ceb --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt @@ -0,0 +1,30 @@ +/foo.js(9,13): error TS2304: Cannot find name 'A'. +/foo.js(10,13): error TS2304: Cannot find name 'B'. + + +==== /types.ts (0 errors) ==== + export interface A { + a: number; + } + export interface B { + a: number; + } + +==== /foo.js (2 errors) ==== + /** + * @import { + * A, + * B, + * } from "./types" + */ + + /** + * @param { A } a + ~ +!!! error TS2304: Cannot find name 'A'. + * @param { B } b + ~ +!!! error TS2304: Cannot find name 'B'. + */ + function f(a, b) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt.diff new file mode 100644 index 0000000000..51eb4dfd60 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt.diff @@ -0,0 +1,35 @@ +--- old.importTag6.errors.txt ++++ new.importTag6.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(9,13): error TS2304: Cannot find name 'A'. ++/foo.js(10,13): error TS2304: Cannot find name 'B'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface A { ++ a: number; ++ } ++ export interface B { ++ a: number; ++ } ++ ++==== /foo.js (2 errors) ==== ++ /** ++ * @import { ++ * A, ++ * B, ++ * } from "./types" ++ */ ++ ++ /** ++ * @param { A } a ++ ~ ++!!! error TS2304: Cannot find name 'A'. ++ * @param { B } b ++ ~ ++!!! error TS2304: Cannot find name 'B'. ++ */ ++ function f(a, b) {} ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt new file mode 100644 index 0000000000..90936c1814 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt @@ -0,0 +1,29 @@ +/foo.js(8,13): error TS2304: Cannot find name 'A'. +/foo.js(9,13): error TS2304: Cannot find name 'B'. + + +==== /types.ts (0 errors) ==== + export interface A { + a: number; + } + export interface B { + a: number; + } + +==== /foo.js (2 errors) ==== + /** + * @import { + * A, + * B } from "./types" + */ + + /** + * @param { A } a + ~ +!!! error TS2304: Cannot find name 'A'. + * @param { B } b + ~ +!!! error TS2304: Cannot find name 'B'. + */ + function f(a, b) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt.diff new file mode 100644 index 0000000000..7e454e8a8a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt.diff @@ -0,0 +1,34 @@ +--- old.importTag7.errors.txt ++++ new.importTag7.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(8,13): error TS2304: Cannot find name 'A'. ++/foo.js(9,13): error TS2304: Cannot find name 'B'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface A { ++ a: number; ++ } ++ export interface B { ++ a: number; ++ } ++ ++==== /foo.js (2 errors) ==== ++ /** ++ * @import { ++ * A, ++ * B } from "./types" ++ */ ++ ++ /** ++ * @param { A } a ++ ~ ++!!! error TS2304: Cannot find name 'A'. ++ * @param { B } b ++ ~ ++!!! error TS2304: Cannot find name 'B'. ++ */ ++ function f(a, b) {} ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt new file mode 100644 index 0000000000..dadfa9424e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt @@ -0,0 +1,29 @@ +/foo.js(8,13): error TS2304: Cannot find name 'A'. +/foo.js(9,13): error TS2304: Cannot find name 'B'. + + +==== /types.ts (0 errors) ==== + export interface A { + a: number; + } + export interface B { + a: number; + } + +==== /foo.js (2 errors) ==== + /** + * @import + * { A, B } + * from "./types" + */ + + /** + * @param { A } a + ~ +!!! error TS2304: Cannot find name 'A'. + * @param { B } b + ~ +!!! error TS2304: Cannot find name 'B'. + */ + function f(a, b) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt.diff new file mode 100644 index 0000000000..9bb7bbb81c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt.diff @@ -0,0 +1,34 @@ +--- old.importTag8.errors.txt ++++ new.importTag8.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(8,13): error TS2304: Cannot find name 'A'. ++/foo.js(9,13): error TS2304: Cannot find name 'B'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface A { ++ a: number; ++ } ++ export interface B { ++ a: number; ++ } ++ ++==== /foo.js (2 errors) ==== ++ /** ++ * @import ++ * { A, B } ++ * from "./types" ++ */ ++ ++ /** ++ * @param { A } a ++ ~ ++!!! error TS2304: Cannot find name 'A'. ++ * @param { B } b ++ ~ ++!!! error TS2304: Cannot find name 'B'. ++ */ ++ function f(a, b) {} ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt new file mode 100644 index 0000000000..44b7a7c5ba --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt @@ -0,0 +1,29 @@ +/foo.js(8,13): error TS2503: Cannot find namespace 'types'. +/foo.js(9,13): error TS2503: Cannot find namespace 'types'. + + +==== /types.ts (0 errors) ==== + export interface A { + a: number; + } + export interface B { + a: number; + } + +==== /foo.js (2 errors) ==== + /** + * @import + * * as types + * from "./types" + */ + + /** + * @param { types.A } a + ~~~~~ +!!! error TS2503: Cannot find namespace 'types'. + * @param { types.B } b + ~~~~~ +!!! error TS2503: Cannot find namespace 'types'. + */ + function f(a, b) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt.diff new file mode 100644 index 0000000000..047a55a6c9 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt.diff @@ -0,0 +1,34 @@ +--- old.importTag9.errors.txt ++++ new.importTag9.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(8,13): error TS2503: Cannot find namespace 'types'. ++/foo.js(9,13): error TS2503: Cannot find namespace 'types'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface A { ++ a: number; ++ } ++ export interface B { ++ a: number; ++ } ++ ++==== /foo.js (2 errors) ==== ++ /** ++ * @import ++ * * as types ++ * from "./types" ++ */ ++ ++ /** ++ * @param { types.A } a ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'types'. ++ * @param { types.B } b ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'types'. ++ */ ++ function f(a, b) {} ++ diff --git a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt index 25253c5495..bd258156de 100644 --- a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt @@ -1,11 +1,14 @@ +instantiateTemplateTagTypeParameterOnVariableStatement.js(3,12): error TS2304: Cannot find name 'T'. instantiateTemplateTagTypeParameterOnVariableStatement.js(4,18): error TS2304: Cannot find name 'T'. instantiateTemplateTagTypeParameterOnVariableStatement.js(4,24): error TS2304: Cannot find name 'T'. -==== instantiateTemplateTagTypeParameterOnVariableStatement.js (2 errors) ==== +==== instantiateTemplateTagTypeParameterOnVariableStatement.js (3 errors) ==== /** * @template T * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {(b: T) => T} ~ !!! error TS2304: Cannot find name 'T'. diff --git a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff index e1c790fbd6..b2e4887db6 100644 --- a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff @@ -3,14 +3,17 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++instantiateTemplateTagTypeParameterOnVariableStatement.js(3,12): error TS2304: Cannot find name 'T'. +instantiateTemplateTagTypeParameterOnVariableStatement.js(4,18): error TS2304: Cannot find name 'T'. +instantiateTemplateTagTypeParameterOnVariableStatement.js(4,24): error TS2304: Cannot find name 'T'. + + -+==== instantiateTemplateTagTypeParameterOnVariableStatement.js (2 errors) ==== ++==== instantiateTemplateTagTypeParameterOnVariableStatement.js (3 errors) ==== + /** + * @template T + * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @returns {(b: T) => T} + ~ +!!! error TS2304: Cannot find name 'T'. diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt new file mode 100644 index 0000000000..1e562e728e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt @@ -0,0 +1,28 @@ +lib.js(7,16): error TS2304: Cannot find name 'T'. + + +==== interface.ts (0 errors) ==== + export interface Encoder { + encode(value: T): Uint8Array + } +==== lib.js (1 errors) ==== + /** + * @template T + * @implements {IEncoder} + */ + export class Encoder { + /** + * @param {T} value + ~ +!!! error TS2304: Cannot find name 'T'. + */ + encode(value) { + return new Uint8Array(0) + } + } + + + /** + * @template T + * @typedef {import('./interface').Encoder} IEncoder + */ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt.diff new file mode 100644 index 0000000000..bc7b9eeb6f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt.diff @@ -0,0 +1,33 @@ +--- old.jsDeclarationsClassImplementsGenericsSerialization.errors.txt ++++ new.jsDeclarationsClassImplementsGenericsSerialization.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++lib.js(7,16): error TS2304: Cannot find name 'T'. ++ ++ ++==== interface.ts (0 errors) ==== ++ export interface Encoder { ++ encode(value: T): Uint8Array ++ } ++==== lib.js (1 errors) ==== ++ /** ++ * @template T ++ * @implements {IEncoder} ++ */ ++ export class Encoder { ++ /** ++ * @param {T} value ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ encode(value) { ++ return new Uint8Array(0) ++ } ++ } ++ ++ ++ /** ++ * @template T ++ * @typedef {import('./interface').Encoder} IEncoder ++ */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt index 383ab32e6b..f434cfbbae 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt @@ -4,8 +4,6 @@ jsDeclarationsClassMethod.js(19,33): error TS7006: Parameter 'x' implicitly has jsDeclarationsClassMethod.js(19,36): error TS7006: Parameter 'y' implicitly has an 'any' type. jsDeclarationsClassMethod.js(29,27): error TS7006: Parameter 'x' implicitly has an 'any' type. jsDeclarationsClassMethod.js(29,30): error TS7006: Parameter 'y' implicitly has an 'any' type. -jsDeclarationsClassMethod.js(40,13): error TS7006: Parameter 'x' implicitly has an 'any' type. -jsDeclarationsClassMethod.js(40,16): error TS7006: Parameter 'y' implicitly has an 'any' type. jsDeclarationsClassMethod.js(51,14): error TS2551: Property 'method2' does not exist on type 'C2'. Did you mean 'method1'? jsDeclarationsClassMethod.js(51,34): error TS7006: Parameter 'x' implicitly has an 'any' type. jsDeclarationsClassMethod.js(51,37): error TS7006: Parameter 'y' implicitly has an 'any' type. @@ -14,7 +12,7 @@ jsDeclarationsClassMethod.js(61,27): error TS7006: Parameter 'x' implicitly has jsDeclarationsClassMethod.js(61,30): error TS7006: Parameter 'y' implicitly has an 'any' type. -==== jsDeclarationsClassMethod.js (14 errors) ==== +==== jsDeclarationsClassMethod.js (12 errors) ==== function C1() { /** * A comment prop @@ -67,10 +65,6 @@ jsDeclarationsClassMethod.js(61,30): error TS7006: Parameter 'y' implicitly has * @returns {number} */ method1(x, y) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'y' implicitly has an 'any' type. return x + y; } } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt.diff index 77c9112289..ec2d8c04b0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.errors.txt.diff @@ -9,8 +9,6 @@ +jsDeclarationsClassMethod.js(19,36): error TS7006: Parameter 'y' implicitly has an 'any' type. +jsDeclarationsClassMethod.js(29,27): error TS7006: Parameter 'x' implicitly has an 'any' type. +jsDeclarationsClassMethod.js(29,30): error TS7006: Parameter 'y' implicitly has an 'any' type. -+jsDeclarationsClassMethod.js(40,13): error TS7006: Parameter 'x' implicitly has an 'any' type. -+jsDeclarationsClassMethod.js(40,16): error TS7006: Parameter 'y' implicitly has an 'any' type. +jsDeclarationsClassMethod.js(51,14): error TS2551: Property 'method2' does not exist on type 'C2'. Did you mean 'method1'? +jsDeclarationsClassMethod.js(51,34): error TS7006: Parameter 'x' implicitly has an 'any' type. +jsDeclarationsClassMethod.js(51,37): error TS7006: Parameter 'y' implicitly has an 'any' type. @@ -19,7 +17,7 @@ +jsDeclarationsClassMethod.js(61,30): error TS7006: Parameter 'y' implicitly has an 'any' type. + + -+==== jsDeclarationsClassMethod.js (14 errors) ==== ++==== jsDeclarationsClassMethod.js (12 errors) ==== + function C1() { + /** + * A comment prop @@ -72,10 +70,6 @@ + * @returns {number} + */ + method1(x, y) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'y' implicitly has an 'any' type. + return x + y; + } + } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt index e594ce84ed..72f8243285 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt @@ -3,18 +3,26 @@ index.js(24,19): error TS2304: Cannot find name 'U'. index.js(30,15): error TS2304: Cannot find name 'T'. index.js(30,19): error TS2304: Cannot find name 'U'. index.js(38,17): error TS2304: Cannot find name 'U'. +index.js(43,16): error TS2304: Cannot find name 'U'. index.js(48,17): error TS2304: Cannot find name 'U'. +index.js(53,16): error TS2304: Cannot find name 'U'. +index.js(58,16): error TS2304: Cannot find name 'T'. +index.js(59,16): error TS2304: Cannot find name 'U'. index.js(104,15): error TS2304: Cannot find name 'T'. index.js(104,19): error TS2304: Cannot find name 'U'. +index.js(108,16): error TS2304: Cannot find name 'T'. +index.js(109,16): error TS2304: Cannot find name 'U'. index.js(138,14): error TS2339: Property 'p1' does not exist on type 'K'. index.js(139,14): error TS2339: Property 'p2' does not exist on type 'K'. index.js(143,21): error TS2339: Property 'p1' does not exist on type 'K'. index.js(151,14): error TS2339: Property 'prop' does not exist on type 'M'. +index.js(161,16): error TS2304: Cannot find name 'T'. index.js(165,14): error TS2339: Property 'another' does not exist on type 'N'. +index.js(175,16): error TS2304: Cannot find name 'U'. index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. -==== index.js (14 errors) ==== +==== index.js (22 errors) ==== export class A {} export class B { @@ -68,6 +76,8 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. /** * @param {U} _p + ~ +!!! error TS2304: Cannot find name 'U'. */ set f1(_p) {} @@ -80,12 +90,18 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. /** * @param {U} _p + ~ +!!! error TS2304: Cannot find name 'U'. */ set f3(_p) {} /** * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. * @param {U} b + ~ +!!! error TS2304: Cannot find name 'U'. */ constructor(a, b) {} @@ -139,7 +155,11 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. field; /** * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. * @param {U} b + ~ +!!! error TS2304: Cannot find name 'U'. */ constructor(a, b) {} @@ -200,6 +220,8 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. export class N extends L { /** * @param {T} param + ~ +!!! error TS2304: Cannot find name 'T'. */ constructor(param) { super(); @@ -216,6 +238,8 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. export class O extends N { /** * @param {U} param + ~ +!!! error TS2304: Cannot find name 'U'. */ constructor(param) { super(param); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt.diff index 2d5b2dce8d..8c15452462 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt.diff @@ -8,18 +8,26 @@ +index.js(30,15): error TS2304: Cannot find name 'T'. +index.js(30,19): error TS2304: Cannot find name 'U'. +index.js(38,17): error TS2304: Cannot find name 'U'. ++index.js(43,16): error TS2304: Cannot find name 'U'. +index.js(48,17): error TS2304: Cannot find name 'U'. ++index.js(53,16): error TS2304: Cannot find name 'U'. ++index.js(58,16): error TS2304: Cannot find name 'T'. ++index.js(59,16): error TS2304: Cannot find name 'U'. +index.js(104,15): error TS2304: Cannot find name 'T'. +index.js(104,19): error TS2304: Cannot find name 'U'. ++index.js(108,16): error TS2304: Cannot find name 'T'. ++index.js(109,16): error TS2304: Cannot find name 'U'. +index.js(138,14): error TS2339: Property 'p1' does not exist on type 'K'. +index.js(139,14): error TS2339: Property 'p2' does not exist on type 'K'. +index.js(143,21): error TS2339: Property 'p1' does not exist on type 'K'. +index.js(151,14): error TS2339: Property 'prop' does not exist on type 'M'. ++index.js(161,16): error TS2304: Cannot find name 'T'. +index.js(165,14): error TS2339: Property 'another' does not exist on type 'N'. ++index.js(175,16): error TS2304: Cannot find name 'U'. +index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. + + -+==== index.js (14 errors) ==== ++==== index.js (22 errors) ==== + export class A {} + + export class B { @@ -73,6 +81,8 @@ + + /** + * @param {U} _p ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + set f1(_p) {} + @@ -85,12 +95,18 @@ + + /** + * @param {U} _p ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + set f3(_p) {} + + /** + * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @param {U} b ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + constructor(a, b) {} + @@ -144,7 +160,11 @@ + field; + /** + * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @param {U} b ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + constructor(a, b) {} + @@ -205,6 +225,8 @@ + export class N extends L { + /** + * @param {T} param ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + constructor(param) { + super(); @@ -221,6 +243,8 @@ + export class O extends N { + /** + * @param {U} param ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + constructor(param) { + super(param); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt index 30d926baf6..7312ed2c66 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt @@ -1,7 +1,10 @@ +index.js(23,12): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? +index.js(24,12): error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? +index.js(25,12): error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? index.js(34,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? -==== index.js (1 errors) ==== +==== index.js (4 errors) ==== /** @enum {string} */ export const Target = { START: "start", @@ -25,8 +28,14 @@ index.js(34,16): error TS2749: 'Target' refers to a value, but is being used as /** * @param {Target} t + ~~~~~~ +!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? * @param {Second} s + ~~~~~~ +!!! error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? * @param {Fs} f + ~~ +!!! error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? */ export function consume(t,s,f) { /** @type {string} */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt.diff index 450c9e1e45..0926175c08 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt.diff @@ -3,10 +3,13 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++index.js(23,12): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? ++index.js(24,12): error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? ++index.js(25,12): error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? +index.js(34,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? + + -+==== index.js (1 errors) ==== ++==== index.js (4 errors) ==== + /** @enum {string} */ + export const Target = { + START: "start", @@ -30,8 +33,14 @@ + + /** + * @param {Target} t ++ ~~~~~~ ++!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? + * @param {Second} s ++ ~~~~~~ ++!!! error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? + * @param {Fs} f ++ ~~ ++!!! error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? + */ + export function consume(t,s,f) { + /** @type {string} */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt index e7ced6302d..8bfacb8e9c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt @@ -2,13 +2,18 @@ index.js(1,23): error TS2580: Cannot find name 'module'. Do you need to install index.js(3,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(4,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(12,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(17,12): error TS2304: Cannot find name 'T'. +index.js(18,12): error TS2304: Cannot find name 'U'. index.js(19,13): error TS2304: Cannot find name 'T'. index.js(19,17): error TS2304: Cannot find name 'U'. index.js(22,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(26,12): error TS2304: Cannot find name 'T'. index.js(31,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(32,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(32,58): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(36,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(41,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(46,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(51,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(53,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(54,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -18,7 +23,7 @@ index.js(57,54): error TS2580: Cannot find name 'module'. Do you need to install index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== index.js (18 errors) ==== +==== index.js (23 errors) ==== Object.defineProperty(module.exports, "a", { value: function a() {} }); ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -44,7 +49,11 @@ index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install /** * @template T,U * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. * @param {U} b + ~ +!!! error TS2304: Cannot find name 'U'. * @return {T & U} ~ !!! error TS2304: Cannot find name 'T'. @@ -59,6 +68,8 @@ index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install /** * @template T * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. */ function f(a) { return a; @@ -75,6 +86,8 @@ index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. */ function g(a, b) { return a.x && b.y(); @@ -87,6 +100,8 @@ index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. */ function hh(a, b) { return a.x && b.y(); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff index 6d308ef2e8..8bbf3a1050 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff @@ -7,13 +7,18 @@ +index.js(3,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(4,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(12,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(17,12): error TS2304: Cannot find name 'T'. ++index.js(18,12): error TS2304: Cannot find name 'U'. +index.js(19,13): error TS2304: Cannot find name 'T'. +index.js(19,17): error TS2304: Cannot find name 'U'. +index.js(22,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(26,12): error TS2304: Cannot find name 'T'. +index.js(31,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(32,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(32,58): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(36,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(41,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(46,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(51,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(53,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(54,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -23,7 +28,7 @@ +index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== index.js (18 errors) ==== ++==== index.js (23 errors) ==== + Object.defineProperty(module.exports, "a", { value: function a() {} }); + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -49,7 +54,11 @@ + /** + * @template T,U + * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @param {U} b ++ ~ ++!!! error TS2304: Cannot find name 'U'. + * @return {T & U} + ~ +!!! error TS2304: Cannot find name 'T'. @@ -64,6 +73,8 @@ + /** + * @template T + * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function f(a) { + return a; @@ -80,6 +91,8 @@ + /** + * @param {{x: string}} a + * @param {{y: typeof module.exports.b}} b ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + function g(a, b) { + return a.x && b.y(); @@ -92,6 +105,8 @@ + /** + * @param {{x: string}} a + * @param {{y: typeof module.exports.b}} b ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + function hh(a, b) { + return a.x && b.y(); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols index 2af33397b3..c042f1a5a8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols @@ -91,8 +91,12 @@ function g(a, b) { >b : Symbol(b, Decl(index.js, 37, 13)) return a.x && b.y(); +>a.x : Symbol(x, Decl(index.js, 34, 12)) >a : Symbol(a, Decl(index.js, 37, 11)) +>x : Symbol(x, Decl(index.js, 34, 12)) +>b.y : Symbol(y, Decl(index.js, 35, 12)) >b : Symbol(b, Decl(index.js, 37, 13)) +>y : Symbol(y, Decl(index.js, 35, 12)) } Object.defineProperty(module.exports, "g", { value: g }); >Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) @@ -112,8 +116,12 @@ function hh(a, b) { >b : Symbol(b, Decl(index.js, 47, 14)) return a.x && b.y(); +>a.x : Symbol(x, Decl(index.js, 44, 12)) >a : Symbol(a, Decl(index.js, 47, 12)) +>x : Symbol(x, Decl(index.js, 44, 12)) +>b.y : Symbol(y, Decl(index.js, 45, 12)) >b : Symbol(b, Decl(index.js, 47, 14)) +>y : Symbol(y, Decl(index.js, 45, 12)) } Object.defineProperty(module.exports, "h", { value: hh }); >Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols.diff index a83909aa88..a07682c725 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols.diff @@ -113,16 +113,8 @@ /** * @param {{x: string}} a -@@= skipped -37, +22 lines =@@ - >b : Symbol(b, Decl(index.js, 37, 13)) - - return a.x && b.y(); -->a.x : Symbol(x, Decl(index.js, 34, 12)) - >a : Symbol(a, Decl(index.js, 37, 11)) -->x : Symbol(x, Decl(index.js, 34, 12)) -->b.y : Symbol(y, Decl(index.js, 35, 12)) - >b : Symbol(b, Decl(index.js, 37, 13)) -->y : Symbol(y, Decl(index.js, 35, 12)) +@@= skipped -45, +30 lines =@@ + >y : Symbol(y, Decl(index.js, 35, 12)) } Object.defineProperty(module.exports, "g", { value: g }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) @@ -137,16 +129,8 @@ >value : Symbol(value, Decl(index.js, 40, 44)) >g : Symbol(g, Decl(index.js, 31, 77)) -@@= skipped -29, +21 lines =@@ - >b : Symbol(b, Decl(index.js, 47, 14)) - - return a.x && b.y(); -->a.x : Symbol(x, Decl(index.js, 44, 12)) - >a : Symbol(a, Decl(index.js, 47, 12)) -->x : Symbol(x, Decl(index.js, 44, 12)) -->b.y : Symbol(y, Decl(index.js, 45, 12)) - >b : Symbol(b, Decl(index.js, 47, 14)) -->y : Symbol(y, Decl(index.js, 45, 12)) +@@= skipped -29, +25 lines =@@ + >y : Symbol(y, Decl(index.js, 45, 12)) } Object.defineProperty(module.exports, "h", { value: hh }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt index c7063441dd..0d818efd34 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt @@ -1,6 +1,9 @@ +context.js(29,12): error TS2304: Cannot find name 'Input'. context.js(34,14): error TS2350: Only a void function can be called with the 'new' keyword. +context.js(40,16): error TS2304: Cannot find name 'Input'. context.js(42,18): error TS2304: Cannot find name 'State'. context.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +hook.js(5,12): error TS2304: Cannot find name 'HookHandler'. hook.js(10,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -15,12 +18,14 @@ timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install t module.exports = Timer; ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== hook.js (1 errors) ==== +==== hook.js (2 errors) ==== /** * @typedef {(arg: import("./context")) => void} HookHandler */ /** * @param {HookHandler} handle + ~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'HookHandler'. */ function Hook(handle) { this.handle = handle; @@ -29,7 +34,7 @@ timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install t ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== context.js (3 errors) ==== +==== context.js (5 errors) ==== /** * Imports * @@ -59,6 +64,8 @@ timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install t * * @class * @param {Input} input + ~~~~~ +!!! error TS2304: Cannot find name 'Input'. */ function Context(input) { @@ -72,6 +79,8 @@ timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install t Context.prototype = { /** * @param {Input} input + ~~~~~ +!!! error TS2304: Cannot find name 'Input'. * @param {HookHandler=} handle * @returns {State} ~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff index 5c8cb56d67..29d8810e77 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff @@ -3,9 +3,12 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++context.js(29,12): error TS2304: Cannot find name 'Input'. +context.js(34,14): error TS2350: Only a void function can be called with the 'new' keyword. ++context.js(40,16): error TS2304: Cannot find name 'Input'. +context.js(42,18): error TS2304: Cannot find name 'State'. +context.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++hook.js(5,12): error TS2304: Cannot find name 'HookHandler'. +hook.js(10,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + @@ -20,12 +23,14 @@ + module.exports = Timer; + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+==== hook.js (1 errors) ==== ++==== hook.js (2 errors) ==== + /** + * @typedef {(arg: import("./context")) => void} HookHandler + */ + /** + * @param {HookHandler} handle ++ ~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'HookHandler'. + */ + function Hook(handle) { + this.handle = handle; @@ -34,7 +39,7 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== context.js (3 errors) ==== ++==== context.js (5 errors) ==== + /** + * Imports + * @@ -64,6 +69,8 @@ + * + * @class + * @param {Input} input ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Input'. + */ + + function Context(input) { @@ -77,6 +84,8 @@ + Context.prototype = { + /** + * @param {Input} input ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Input'. + * @param {HookHandler=} handle + * @returns {State} + ~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt index 4257e9ac23..cd9c5cdf28 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt @@ -1,3 +1,4 @@ +referencer.js(4,12): error TS2749: 'Point' refers to a value, but is being used as a type here. Did you mean 'typeof Point'? source.js(7,16): error TS2350: Only a void function can be called with the 'new' keyword. @@ -16,11 +17,13 @@ source.js(7,16): error TS2350: Only a void function can be called with the 'new' this.y = y; } -==== referencer.js (0 errors) ==== +==== referencer.js (1 errors) ==== import {Point} from "./source"; /** * @param {Point} p + ~~~~~ +!!! error TS2749: 'Point' refers to a value, but is being used as a type here. Did you mean 'typeof Point'? */ export function magnitude(p) { return Math.sqrt(p.x ** 2 + p.y ** 2); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt.diff index 3ea0bd366c..142d50e852 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt.diff @@ -3,6 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++referencer.js(4,12): error TS2749: 'Point' refers to a value, but is being used as a type here. Did you mean 'typeof Point'? +source.js(7,16): error TS2350: Only a void function can be called with the 'new' keyword. + + @@ -21,11 +22,13 @@ + this.y = y; + } + -+==== referencer.js (0 errors) ==== ++==== referencer.js (1 errors) ==== + import {Point} from "./source"; + + /** + * @param {Point} p ++ ~~~~~ ++!!! error TS2749: 'Point' refers to a value, but is being used as a type here. Did you mean 'typeof Point'? + */ + export function magnitude(p) { + return Math.sqrt(p.x ** 2 + p.y ** 2); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt index 3aedf38175..ab252908a8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt @@ -1,8 +1,9 @@ referencer.js(3,23): error TS2350: Only a void function can be called with the 'new' keyword. +source.js(13,16): error TS2749: 'Vec' refers to a value, but is being used as a type here. Did you mean 'typeof Vec'? source.js(40,16): error TS2350: Only a void function can be called with the 'new' keyword. -==== source.js (1 errors) ==== +==== source.js (2 errors) ==== /** * @param {number} len */ @@ -16,6 +17,8 @@ source.js(40,16): error TS2350: Only a void function can be called with the 'new Vec.prototype = { /** * @param {Vec} other + ~~~ +!!! error TS2749: 'Vec' refers to a value, but is being used as a type here. Did you mean 'typeof Vec'? */ dot(other) { if (other.storage.length !== this.storage.length) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt.diff index 88d60fa3dd..123f6c5506 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt.diff @@ -4,10 +4,11 @@ - @@= skipped --1, +1 lines =@@ +referencer.js(3,23): error TS2350: Only a void function can be called with the 'new' keyword. ++source.js(13,16): error TS2749: 'Vec' refers to a value, but is being used as a type here. Did you mean 'typeof Vec'? +source.js(40,16): error TS2350: Only a void function can be called with the 'new' keyword. + + -+==== source.js (1 errors) ==== ++==== source.js (2 errors) ==== + /** + * @param {number} len + */ @@ -21,6 +22,8 @@ + Vec.prototype = { + /** + * @param {Vec} other ++ ~~~ ++!!! error TS2749: 'Vec' refers to a value, but is being used as a type here. Did you mean 'typeof Vec'? + */ + dot(other) { + if (other.storage.length !== this.storage.length) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt index ffca90413b..89beafd9ee 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt @@ -1,8 +1,11 @@ +index.js(18,12): error TS2304: Cannot find name 'T'. +index.js(19,12): error TS2304: Cannot find name 'U'. index.js(20,13): error TS2304: Cannot find name 'T'. index.js(20,17): error TS2304: Cannot find name 'U'. +index.js(26,12): error TS2304: Cannot find name 'T'. -==== index.js (2 errors) ==== +==== index.js (5 errors) ==== export function a() {} export function b() {} @@ -21,7 +24,11 @@ index.js(20,17): error TS2304: Cannot find name 'U'. /** * @template T,U * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. * @param {U} b + ~ +!!! error TS2304: Cannot find name 'U'. * @return {T & U} ~ !!! error TS2304: Cannot find name 'T'. @@ -33,6 +40,8 @@ index.js(20,17): error TS2304: Cannot find name 'U'. /** * @template T * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. */ export function f(a) { return a; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt.diff index eea85ac69f..c4025181cd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt.diff @@ -3,11 +3,14 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++index.js(18,12): error TS2304: Cannot find name 'T'. ++index.js(19,12): error TS2304: Cannot find name 'U'. +index.js(20,13): error TS2304: Cannot find name 'T'. +index.js(20,17): error TS2304: Cannot find name 'U'. ++index.js(26,12): error TS2304: Cannot find name 'T'. + + -+==== index.js (2 errors) ==== ++==== index.js (5 errors) ==== + export function a() {} + + export function b() {} @@ -26,7 +29,11 @@ + /** + * @template T,U + * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @param {U} b ++ ~ ++!!! error TS2304: Cannot find name 'U'. + * @return {T & U} + ~ +!!! error TS2304: Cannot find name 'T'. @@ -38,6 +45,8 @@ + /** + * @template T + * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + export function f(a) { + return a; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols index 4722a46367..7c366d06b6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols @@ -68,8 +68,12 @@ function g(a, b) { >b : Symbol(b, Decl(index.js, 36, 13)) return a.x && b.y(); +>a.x : Symbol(x, Decl(index.js, 33, 12)) >a : Symbol(a, Decl(index.js, 36, 11)) +>x : Symbol(x, Decl(index.js, 33, 12)) +>b.y : Symbol(y, Decl(index.js, 34, 12)) >b : Symbol(b, Decl(index.js, 36, 13)) +>y : Symbol(y, Decl(index.js, 34, 12)) } export { g }; @@ -85,8 +89,12 @@ function hh(a, b) { >b : Symbol(b, Decl(index.js, 46, 14)) return a.x && b.y(); +>a.x : Symbol(x, Decl(index.js, 43, 12)) >a : Symbol(a, Decl(index.js, 46, 12)) +>x : Symbol(x, Decl(index.js, 43, 12)) +>b.y : Symbol(y, Decl(index.js, 44, 12)) >b : Symbol(b, Decl(index.js, 46, 14)) +>y : Symbol(y, Decl(index.js, 44, 12)) } export { hh as h }; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols.diff index 2035423afc..7b851080df 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols.diff @@ -52,29 +52,3 @@ /** * @param {{x: string}} a -@@= skipped -22, +22 lines =@@ - >b : Symbol(b, Decl(index.js, 36, 13)) - - return a.x && b.y(); -->a.x : Symbol(x, Decl(index.js, 33, 12)) - >a : Symbol(a, Decl(index.js, 36, 11)) -->x : Symbol(x, Decl(index.js, 33, 12)) -->b.y : Symbol(y, Decl(index.js, 34, 12)) - >b : Symbol(b, Decl(index.js, 36, 13)) -->y : Symbol(y, Decl(index.js, 34, 12)) - } - - export { g }; -@@= skipped -21, +17 lines =@@ - >b : Symbol(b, Decl(index.js, 46, 14)) - - return a.x && b.y(); -->a.x : Symbol(x, Decl(index.js, 43, 12)) - >a : Symbol(a, Decl(index.js, 46, 12)) -->x : Symbol(x, Decl(index.js, 43, 12)) -->b.y : Symbol(y, Decl(index.js, 44, 12)) - >b : Symbol(b, Decl(index.js, 46, 14)) -->y : Symbol(y, Decl(index.js, 44, 12)) - } - - export { hh as h }; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt index 11aee39fcc..263140ef38 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt @@ -8,7 +8,9 @@ index.js(22,1): error TS2580: Cannot find name 'module'. Do you need to install index.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(31,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(31,25): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(35,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(41,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(45,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(51,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(53,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(54,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -18,7 +20,7 @@ index.js(57,21): error TS2580: Cannot find name 'module'. Do you need to install index.js(58,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== index.js (18 errors) ==== +==== index.js (20 errors) ==== module.exports.a = function a() {} ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -74,6 +76,8 @@ index.js(58,1): error TS2580: Cannot find name 'module'. Do you need to install /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. */ function g(a, b) { return a.x && b.y(); @@ -86,6 +90,8 @@ index.js(58,1): error TS2580: Cannot find name 'module'. Do you need to install /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. */ function hh(a, b) { return a.x && b.y(); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff index a627695439..1d33520fdf 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff @@ -13,7 +13,9 @@ +index.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(31,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(31,25): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(35,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(41,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(45,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(51,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(53,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(54,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -23,7 +25,7 @@ +index.js(58,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== index.js (18 errors) ==== ++==== index.js (20 errors) ==== + module.exports.a = function a() {} + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -79,6 +81,8 @@ + /** + * @param {{x: string}} a + * @param {{y: typeof module.exports.b}} b ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + function g(a, b) { + return a.x && b.y(); @@ -91,6 +95,8 @@ + /** + * @param {{x: string}} a + * @param {{y: typeof module.exports.b}} b ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + function hh(a, b) { + return a.x && b.y(); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols index 23c01b990e..2d71c847d6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols @@ -58,8 +58,12 @@ function g(a, b) { >b : Symbol(b, Decl(index.js, 36, 13)) return a.x && b.y(); +>a.x : Symbol(x, Decl(index.js, 33, 12)) >a : Symbol(a, Decl(index.js, 36, 11)) +>x : Symbol(x, Decl(index.js, 33, 12)) +>b.y : Symbol(y, Decl(index.js, 34, 12)) >b : Symbol(b, Decl(index.js, 36, 13)) +>y : Symbol(y, Decl(index.js, 34, 12)) } module.exports.g = g; @@ -75,8 +79,12 @@ function hh(a, b) { >b : Symbol(b, Decl(index.js, 46, 14)) return a.x && b.y(); +>a.x : Symbol(x, Decl(index.js, 43, 12)) >a : Symbol(a, Decl(index.js, 46, 12)) +>x : Symbol(x, Decl(index.js, 43, 12)) +>b.y : Symbol(y, Decl(index.js, 44, 12)) >b : Symbol(b, Decl(index.js, 46, 14)) +>y : Symbol(y, Decl(index.js, 44, 12)) } module.exports.h = hh; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols.diff index 15a1c0b4c3..495b153c83 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols.diff @@ -102,16 +102,7 @@ /** * @param {{x: string}} a -@@= skipped -23, +11 lines =@@ - >b : Symbol(b, Decl(index.js, 36, 13)) - - return a.x && b.y(); -->a.x : Symbol(x, Decl(index.js, 33, 12)) - >a : Symbol(a, Decl(index.js, 36, 11)) -->x : Symbol(x, Decl(index.js, 33, 12)) -->b.y : Symbol(y, Decl(index.js, 34, 12)) - >b : Symbol(b, Decl(index.js, 36, 13)) -->y : Symbol(y, Decl(index.js, 34, 12)) +@@= skipped -32, +20 lines =@@ } module.exports.g = g; @@ -123,16 +114,7 @@ >g : Symbol(g, Decl(index.js, 30, 41)) /** -@@= skipped -26, +17 lines =@@ - >b : Symbol(b, Decl(index.js, 46, 14)) - - return a.x && b.y(); -->a.x : Symbol(x, Decl(index.js, 43, 12)) - >a : Symbol(a, Decl(index.js, 46, 12)) -->x : Symbol(x, Decl(index.js, 43, 12)) -->b.y : Symbol(y, Decl(index.js, 44, 12)) - >b : Symbol(b, Decl(index.js, 46, 14)) -->y : Symbol(y, Decl(index.js, 44, 12)) +@@= skipped -26, +21 lines =@@ } module.exports.h = hh; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt index 4906a757dc..46462e31e8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt @@ -1,5 +1,6 @@ file.js(4,11): error TS2315: Type 'Object' is not generic. file2.js(6,11): error TS2315: Type 'Object' is not generic. +file2.js(17,12): error TS2503: Cannot find namespace 'testFnTypes'. ==== file.js (1 errors) ==== @@ -25,7 +26,7 @@ file2.js(6,11): error TS2315: Type 'Object' is not generic. /** @typedef {myTypes.typeB|Function} myTypes.typeC */ export {myTypes}; -==== file2.js (1 errors) ==== +==== file2.js (2 errors) ==== import {myTypes} from './file.js'; /** @@ -45,6 +46,8 @@ file2.js(6,11): error TS2315: Type 'Object' is not generic. * @function testFn * @description A test function. * @param {testFnTypes.input} input - Input. + ~~~~~~~~~~~ +!!! error TS2503: Cannot find namespace 'testFnTypes'. * @returns {number|null} Result. */ function testFn(input) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff index 15699979b3..e5e5da07a4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff @@ -4,6 +4,7 @@ -file2.js(1,9): error TS18042: 'myTypes' is a type and cannot be imported in JavaScript files. Use 'import("./file.js").myTypes' in a JSDoc type annotation. +file.js(4,11): error TS2315: Type 'Object' is not generic. +file2.js(6,11): error TS2315: Type 'Object' is not generic. ++file2.js(17,12): error TS2503: Cannot find namespace 'testFnTypes'. -==== file.js (0 errors) ==== @@ -17,9 +18,12 @@ */ const myTypes = { // SOME PROPS HERE -@@= skipped -23, +26 lines =@@ +@@= skipped -21, +25 lines =@@ + /** @typedef {myTypes.typeB|Function} myTypes.typeC */ + export {myTypes}; - ==== file2.js (1 errors) ==== +-==== file2.js (1 errors) ==== ++==== file2.js (2 errors) ==== import {myTypes} from './file.js'; - ~~~~~~~ -!!! error TS18042: 'myTypes' is a type and cannot be imported in JavaScript files. Use 'import("./file.js").myTypes' in a JSDoc type annotation. @@ -33,3 +37,12 @@ */ const testFnTypes = { // SOME PROPS HERE +@@= skipped -20, +20 lines =@@ + * @function testFn + * @description A test function. + * @param {testFnTypes.input} input - Input. ++ ~~~~~~~~~~~ ++!!! error TS2503: Cannot find namespace 'testFnTypes'. + * @returns {number|null} Result. + */ + function testFn(input) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt index cda390301f..59f5a69936 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt @@ -1,9 +1,10 @@ file2.js(1,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. file2.js(6,11): error TS2315: Type 'Object' is not generic. +file2.js(17,12): error TS2503: Cannot find namespace 'testFnTypes'. file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== file2.js (3 errors) ==== +==== file2.js (4 errors) ==== const {myTypes} = require('./file.js'); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -25,6 +26,8 @@ file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install * @function testFn * @description A test function. * @param {testFnTypes.input} input - Input. + ~~~~~~~~~~~ +!!! error TS2503: Cannot find namespace 'testFnTypes'. * @returns {number|null} Result. */ function testFn(input) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff index cb14649208..5b87602da7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff @@ -5,10 +5,11 @@ @@= skipped --1, +1 lines =@@ +file2.js(1,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +file2.js(6,11): error TS2315: Type 'Object' is not generic. ++file2.js(17,12): error TS2503: Cannot find namespace 'testFnTypes'. +file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== file2.js (3 errors) ==== ++==== file2.js (4 errors) ==== + const {myTypes} = require('./file.js'); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -30,6 +31,8 @@ + * @function testFn + * @description A test function. + * @param {testFnTypes.input} input - Input. ++ ~~~~~~~~~~~ ++!!! error TS2503: Cannot find namespace 'testFnTypes'. + * @returns {number|null} Result. + */ + function testFn(input) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt new file mode 100644 index 0000000000..d4557d9119 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt @@ -0,0 +1,17 @@ +file.js(2,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +file.js(6,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). + + +==== file.js (2 errors) ==== + /** + * @param {Array} x + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + */ + function x(x) {} + /** + * @param {Promise} x + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + */ + function y(x) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt.diff new file mode 100644 index 0000000000..83d2307f9d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.jsDeclarationsMissingGenerics.errors.txt ++++ new.jsDeclarationsMissingGenerics.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++file.js(2,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++file.js(6,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). ++ ++ ++==== file.js (2 errors) ==== ++ /** ++ * @param {Array} x ++ ~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). ++ */ ++ function x(x) {} ++ /** ++ * @param {Promise} x ++ ~~~~~~~ ++!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). ++ */ ++ function y(x) {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt index 7b331f95d3..4b3c334f6b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt @@ -1,4 +1,5 @@ base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +file.js(11,25): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? file.js(12,27): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? @@ -17,7 +18,7 @@ file.js(12,27): error TS2749: 'BaseFactory' refers to a value, but is being used ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== file.js (1 errors) ==== +==== file.js (2 errors) ==== /** @typedef {import('./base')} BaseFactory */ /** * @callback BaseFactoryFactory @@ -29,6 +30,8 @@ file.js(12,27): error TS2749: 'BaseFactory' refers to a value, but is being used /** * * @param {InstanceType} base + ~~~~~~~~~~~ +!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? * @returns {InstanceType} ~~~~~~~~~~~ !!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff index ac502d15f6..3b51d431a2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff @@ -4,6 +4,7 @@ - @@= skipped --1, +1 lines =@@ +base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++file.js(11,25): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? +file.js(12,27): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + + @@ -22,7 +23,7 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== file.js (1 errors) ==== ++==== file.js (2 errors) ==== + /** @typedef {import('./base')} BaseFactory */ + /** + * @callback BaseFactoryFactory @@ -34,6 +35,8 @@ + /** + * + * @param {InstanceType} base ++ ~~~~~~~~~~~ ++!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + * @returns {InstanceType} + ~~~~~~~~~~~ +!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt index 9a14774f33..25954ffbb3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt @@ -1,4 +1,5 @@ base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +file.js(5,25): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? file.js(6,27): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? @@ -17,12 +18,14 @@ file.js(6,27): error TS2749: 'BaseFactory' refers to a value, but is being used ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== file.js (1 errors) ==== +==== file.js (2 errors) ==== /** @typedef {typeof import('./base')} BaseFactory */ /** * * @param {InstanceType} base + ~~~~~~~~~~~ +!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? * @returns {InstanceType} ~~~~~~~~~~~ !!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff index 77aff6fe37..9353abbb7d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff @@ -4,6 +4,7 @@ - @@= skipped --1, +1 lines =@@ +base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++file.js(5,25): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? +file.js(6,27): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + + @@ -22,12 +23,14 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== file.js (1 errors) ==== ++==== file.js (2 errors) ==== + /** @typedef {typeof import('./base')} BaseFactory */ + + /** + * + * @param {InstanceType} base ++ ~~~~~~~~~~~ ++!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + * @returns {InstanceType} + ~~~~~~~~~~~ +!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt deleted file mode 100644 index 53d61cac2b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt +++ /dev/null @@ -1,129 +0,0 @@ -index.js(83,9): error TS7032: Property 'p1' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -index.js(83,12): error TS7006: Parameter 'value' implicitly has an 'any' type. -index.js(88,9): error TS7032: Property 'p2' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -index.js(88,12): error TS7006: Parameter 'value' implicitly has an 'any' type. -index.js(93,9): error TS7032: Property 'p3' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -index.js(93,12): error TS7006: Parameter 'value' implicitly has an 'any' type. -index.js(98,9): error TS7032: Property 'p4' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -index.js(98,12): error TS7006: Parameter 'value' implicitly has an 'any' type. - - -==== index.js (8 errors) ==== - class С1 { - /** @type {string=} */ - p1 = undefined; - - /** @type {string | undefined} */ - p2 = undefined; - - /** @type {?string} */ - p3 = null; - - /** @type {string | null} */ - p4 = null; - } - - class С2 { - /** @type {string=} */ - get p1() { - return undefined; - } - - /** @type {string | undefined} */ - get p2() { - return undefined; - } - - /** @type {?string} */ - get p3() { - return null; - } - - /** @type {string | null} */ - get p4() { - return null; - } - } - - - class С3 { - /** @type {string=} */ - get p1() { - return undefined; - } - - /** @param {string=} value */ - set p1(value) { - this.p1 = value; - } - - /** @type {string | undefined} */ - get p2() { - return undefined; - } - - /** @param {string | undefined} value */ - set p2(value) { - this.p2 = value; - } - - /** @type {?string} */ - get p3() { - return null; - } - - /** @param {?string} value */ - set p3(value) { - this.p3 = value; - } - - /** @type {string | null} */ - get p4() { - return null; - } - - /** @param {string | null} value */ - set p4(value) { - this.p4 = value; - } - } - - - class С4 { - /** @param {string=} value */ - set p1(value) { - ~~ -!!! error TS7032: Property 'p1' implicitly has type 'any', because its set accessor lacks a parameter type annotation. - ~~~~~ -!!! error TS7006: Parameter 'value' implicitly has an 'any' type. - this.p1 = value; - } - - /** @param {string | undefined} value */ - set p2(value) { - ~~ -!!! error TS7032: Property 'p2' implicitly has type 'any', because its set accessor lacks a parameter type annotation. - ~~~~~ -!!! error TS7006: Parameter 'value' implicitly has an 'any' type. - this.p2 = value; - } - - /** @param {?string} value */ - set p3(value) { - ~~ -!!! error TS7032: Property 'p3' implicitly has type 'any', because its set accessor lacks a parameter type annotation. - ~~~~~ -!!! error TS7006: Parameter 'value' implicitly has an 'any' type. - this.p3 = value; - } - - /** @param {string | null} value */ - set p4(value) { - ~~ -!!! error TS7032: Property 'p4' implicitly has type 'any', because its set accessor lacks a parameter type annotation. - ~~~~~ -!!! error TS7006: Parameter 'value' implicitly has an 'any' type. - this.p4 = value; - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt.diff deleted file mode 100644 index fdadf3dc09..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.jsDeclarationsReusesExistingTypeAnnotations.errors.txt -+++ new.jsDeclarationsReusesExistingTypeAnnotations.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(83,9): error TS7032: Property 'p1' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+index.js(83,12): error TS7006: Parameter 'value' implicitly has an 'any' type. -+index.js(88,9): error TS7032: Property 'p2' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+index.js(88,12): error TS7006: Parameter 'value' implicitly has an 'any' type. -+index.js(93,9): error TS7032: Property 'p3' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+index.js(93,12): error TS7006: Parameter 'value' implicitly has an 'any' type. -+index.js(98,9): error TS7032: Property 'p4' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+index.js(98,12): error TS7006: Parameter 'value' implicitly has an 'any' type. -+ -+ -+==== index.js (8 errors) ==== -+ class С1 { -+ /** @type {string=} */ -+ p1 = undefined; -+ -+ /** @type {string | undefined} */ -+ p2 = undefined; -+ -+ /** @type {?string} */ -+ p3 = null; -+ -+ /** @type {string | null} */ -+ p4 = null; -+ } -+ -+ class С2 { -+ /** @type {string=} */ -+ get p1() { -+ return undefined; -+ } -+ -+ /** @type {string | undefined} */ -+ get p2() { -+ return undefined; -+ } -+ -+ /** @type {?string} */ -+ get p3() { -+ return null; -+ } -+ -+ /** @type {string | null} */ -+ get p4() { -+ return null; -+ } -+ } -+ -+ -+ class С3 { -+ /** @type {string=} */ -+ get p1() { -+ return undefined; -+ } -+ -+ /** @param {string=} value */ -+ set p1(value) { -+ this.p1 = value; -+ } -+ -+ /** @type {string | undefined} */ -+ get p2() { -+ return undefined; -+ } -+ -+ /** @param {string | undefined} value */ -+ set p2(value) { -+ this.p2 = value; -+ } -+ -+ /** @type {?string} */ -+ get p3() { -+ return null; -+ } -+ -+ /** @param {?string} value */ -+ set p3(value) { -+ this.p3 = value; -+ } -+ -+ /** @type {string | null} */ -+ get p4() { -+ return null; -+ } -+ -+ /** @param {string | null} value */ -+ set p4(value) { -+ this.p4 = value; -+ } -+ } -+ -+ -+ class С4 { -+ /** @param {string=} value */ -+ set p1(value) { -+ ~~ -+!!! error TS7032: Property 'p1' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+ ~~~~~ -+!!! error TS7006: Parameter 'value' implicitly has an 'any' type. -+ this.p1 = value; -+ } -+ -+ /** @param {string | undefined} value */ -+ set p2(value) { -+ ~~ -+!!! error TS7032: Property 'p2' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+ ~~~~~ -+!!! error TS7006: Parameter 'value' implicitly has an 'any' type. -+ this.p2 = value; -+ } -+ -+ /** @param {?string} value */ -+ set p3(value) { -+ ~~ -+!!! error TS7032: Property 'p3' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+ ~~~~~ -+!!! error TS7006: Parameter 'value' implicitly has an 'any' type. -+ this.p3 = value; -+ } -+ -+ /** @param {string | null} value */ -+ set p4(value) { -+ ~~ -+!!! error TS7032: Property 'p4' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+ ~~~~~ -+!!! error TS7006: Parameter 'value' implicitly has an 'any' type. -+ this.p4 = value; -+ } -+ } -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols index 4f556a9e04..c7958eb3b6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols @@ -35,7 +35,9 @@ class Wrap { this.connItem = c.item; >this : Symbol(Wrap, Decl(usage.js, 0, 0)) +>c.item : Symbol(item, Decl(conn.js, 5, 20)) >c : Symbol(c, Decl(usage.js, 8, 16)) +>item : Symbol(item, Decl(conn.js, 5, 20)) /** @type {import("./conn").Whatever} */ this.another = ""; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff index a1525e8dbc..47d306356e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff @@ -27,8 +27,10 @@ >this : Symbol(Wrap, Decl(usage.js, 0, 0)) ->connItem : Symbol(Wrap.connItem, Decl(usage.js, 8, 20)) ->c.item : Symbol(Conn.item, Decl(conn.js, 5, 20)) ++>c.item : Symbol(item, Decl(conn.js, 5, 20)) >c : Symbol(c, Decl(usage.js, 8, 16)) ->item : Symbol(Conn.item, Decl(conn.js, 5, 20)) ++>item : Symbol(item, Decl(conn.js, 5, 20)) /** @type {import("./conn").Whatever} */ this.another = ""; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt index 149093ca66..6680a9938d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt @@ -1,4 +1,5 @@ LazySet.js(5,7): error TS2451: Cannot redeclare block-scoped variable 'LazySet'. +LazySet.js(7,16): error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? LazySet.js(13,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(1,7): error TS2451: Cannot redeclare block-scoped variable 'LazySet'. index.js(1,17): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -20,7 +21,7 @@ index.js(3,12): error TS2749: 'LazySet' refers to a value, but is being used as stringSet.addAll(stringSet); -==== LazySet.js (2 errors) ==== +==== LazySet.js (3 errors) ==== // Comment out this JSDoc, and note that the errors index.js go away. /** * @typedef {Object} SomeObject @@ -31,6 +32,8 @@ index.js(3,12): error TS2749: 'LazySet' refers to a value, but is being used as !!! related TS6203 index.js:1:7: 'LazySet' was also declared here. /** * @param {LazySet} iterable + ~~~~~~~ +!!! error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? */ addAll(iterable) {} [Symbol.iterator]() {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff index 3a0afd7ae6..ca7d752e92 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff @@ -4,6 +4,7 @@ - @@= skipped --1, +1 lines =@@ +LazySet.js(5,7): error TS2451: Cannot redeclare block-scoped variable 'LazySet'. ++LazySet.js(7,16): error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? +LazySet.js(13,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(1,7): error TS2451: Cannot redeclare block-scoped variable 'LazySet'. +index.js(1,17): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -25,7 +26,7 @@ + stringSet.addAll(stringSet); + + -+==== LazySet.js (2 errors) ==== ++==== LazySet.js (3 errors) ==== + // Comment out this JSDoc, and note that the errors index.js go away. + /** + * @typedef {Object} SomeObject @@ -36,6 +37,8 @@ +!!! related TS6203 index.js:1:7: 'LazySet' was also declared here. + /** + * @param {LazySet} iterable ++ ~~~~~~~ ++!!! error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? + */ + addAll(iterable) {} + [Symbol.iterator]() {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt new file mode 100644 index 0000000000..a3e60af524 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt @@ -0,0 +1,21 @@ +foo.js(10,12): error TS2304: Cannot find name 'ResolveRejectMap'. + + +==== foo.js (1 errors) ==== + /** + * @typedef {{ + * [id: string]: [Function, Function]; + * }} ResolveRejectMap + */ + + let id = 0 + + /** + * @param {ResolveRejectMap} handlers + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'ResolveRejectMap'. + * @returns {Promise} + */ + const send = handlers => new Promise((resolve, reject) => { + handlers[++id] = [resolve, reject] + }) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt.diff new file mode 100644 index 0000000000..7767b47ca0 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt.diff @@ -0,0 +1,26 @@ +--- old.jsDeclarationsTypedefFunction.errors.txt ++++ new.jsDeclarationsTypedefFunction.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++foo.js(10,12): error TS2304: Cannot find name 'ResolveRejectMap'. ++ ++ ++==== foo.js (1 errors) ==== ++ /** ++ * @typedef {{ ++ * [id: string]: [Function, Function]; ++ * }} ResolveRejectMap ++ */ ++ ++ let id = 0 ++ ++ /** ++ * @param {ResolveRejectMap} handlers ++ ~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'ResolveRejectMap'. ++ * @returns {Promise} ++ */ ++ const send = handlers => new Promise((resolve, reject) => { ++ handlers[++id] = [resolve, reject] ++ }) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt index 871a4cb6f7..a28a1bb62e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt @@ -1,8 +1,10 @@ index.js(1,39): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(15,16): error TS2304: Cannot find name 'TaskGroup'. +index.js(16,16): error TS2304: Cannot find name 'TaskNode'. index.js(21,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== index.js (2 errors) ==== +==== index.js (4 errors) ==== const {taskGroups, taskNameToGroup} = require('./module.js'); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -20,7 +22,11 @@ index.js(21,1): error TS2580: Cannot find name 'module'. Do you need to install class MainThreadTasks { /** * @param {TaskGroup} x + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'TaskGroup'. * @param {TaskNode} y + ~~~~~~~~ +!!! error TS2304: Cannot find name 'TaskNode'. */ constructor(x, y){} } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff index 5b098b29d9..12ec6eec81 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff @@ -4,10 +4,12 @@ - @@= skipped --1, +1 lines =@@ +index.js(1,39): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(15,16): error TS2304: Cannot find name 'TaskGroup'. ++index.js(16,16): error TS2304: Cannot find name 'TaskNode'. +index.js(21,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== index.js (2 errors) ==== ++==== index.js (4 errors) ==== + const {taskGroups, taskNameToGroup} = require('./module.js'); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -25,7 +27,11 @@ + class MainThreadTasks { + /** + * @param {TaskGroup} x ++ ~~~~~~~~~ ++!!! error TS2304: Cannot find name 'TaskGroup'. + * @param {TaskNode} y ++ ~~~~~~~~ ++!!! error TS2304: Cannot find name 'TaskNode'. + */ + constructor(x, y){} + } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt index 343381e725..2bf699351c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt @@ -1,4 +1,5 @@ b.js(2,28): error TS2694: Namespace '""a.js""' has no exported member 'WithSymbol'. +b.js(3,26): error TS2694: Namespace '""a.js""' has no exported member 'WithSymbol'. ==== a.js (0 errors) ==== @@ -7,12 +8,14 @@ b.js(2,28): error TS2694: Namespace '""a.js""' has no exported member 'WithSymbo /** * @typedef {{[kSymbol]: true}} WithSymbol */ -==== b.js (1 errors) ==== +==== b.js (2 errors) ==== /** * @returns {import('./a').WithSymbol} ~~~~~~~~~~ !!! error TS2694: Namespace '""a.js""' has no exported member 'WithSymbol'. * @param {import('./a').WithSymbol} value + ~~~~~~~~~~ +!!! error TS2694: Namespace '""a.js""' has no exported member 'WithSymbol'. */ export function b(value) { return value; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff index 030a120d9c..5d8ef7cf66 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff @@ -4,6 +4,7 @@ - @@= skipped --1, +1 lines =@@ +b.js(2,28): error TS2694: Namespace '""a.js""' has no exported member 'WithSymbol'. ++b.js(3,26): error TS2694: Namespace '""a.js""' has no exported member 'WithSymbol'. + + +==== a.js (0 errors) ==== @@ -12,12 +13,14 @@ + /** + * @typedef {{[kSymbol]: true}} WithSymbol + */ -+==== b.js (1 errors) ==== ++==== b.js (2 errors) ==== + /** + * @returns {import('./a').WithSymbol} + ~~~~~~~~~~ +!!! error TS2694: Namespace '""a.js""' has no exported member 'WithSymbol'. + * @param {import('./a').WithSymbol} value ++ ~~~~~~~~~~ ++!!! error TS2694: Namespace '""a.js""' has no exported member 'WithSymbol'. + */ + export function b(value) { + return value; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt index fe2d62bae0..0ecef16650 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt @@ -1,4 +1,4 @@ -jsdocConstructorFunctionTypeReference.js(10,36): error TS7006: Parameter 'state' implicitly has an 'any' type. +jsdocConstructorFunctionTypeReference.js(8,12): error TS2749: 'Validator' refers to a value, but is being used as a type here. Did you mean 'typeof Validator'? ==== jsdocConstructorFunctionTypeReference.js (1 errors) ==== @@ -10,10 +10,10 @@ jsdocConstructorFunctionTypeReference.js(10,36): error TS7006: Parameter 'state' /** * @param {Validator} state + ~~~~~~~~~ +!!! error TS2749: 'Validator' refers to a value, but is being used as a type here. Did you mean 'typeof Validator'? */ var validateRegExpFlags = function(state) { - ~~~~~ -!!! error TS7006: Parameter 'state' implicitly has an 'any' type. return state.flags }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt.diff index cb035fb3cc..c21b318347 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+jsdocConstructorFunctionTypeReference.js(10,36): error TS7006: Parameter 'state' implicitly has an 'any' type. ++jsdocConstructorFunctionTypeReference.js(8,12): error TS2749: 'Validator' refers to a value, but is being used as a type here. Did you mean 'typeof Validator'? + + +==== jsdocConstructorFunctionTypeReference.js (1 errors) ==== @@ -15,10 +15,10 @@ + + /** + * @param {Validator} state ++ ~~~~~~~~~ ++!!! error TS2749: 'Validator' refers to a value, but is being used as a type here. Did you mean 'typeof Validator'? + */ + var validateRegExpFlags = function(state) { -+ ~~~~~ -+!!! error TS7006: Parameter 'state' implicitly has an 'any' type. + return state.flags + }; + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt index ee2829a829..47d91d1ee9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt @@ -3,19 +3,16 @@ functions.js(5,14): error TS7006: Parameter 'c' implicitly has an 'any' type. functions.js(9,23): error TS7006: Parameter 'n' implicitly has an 'any' type. functions.js(13,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? functions.js(15,14): error TS7006: Parameter 'c' implicitly has an 'any' type. -functions.js(21,17): error TS7006: Parameter 'n' implicitly has an 'any' type. functions.js(22,14): error TS2339: Property 'length' does not exist on type 'C'. functions.js(30,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? functions.js(31,19): error TS7006: Parameter 'ab' implicitly has an 'any' type. functions.js(31,23): error TS7006: Parameter 'onetwo' implicitly has an 'any' type. -functions.js(38,12): error TS7006: Parameter 'n' implicitly has an 'any' type. functions.js(49,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type. -functions.js(60,18): error TS7006: Parameter 'n' implicitly has an 'any' type. functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. -==== functions.js (15 errors) ==== +==== functions.js (12 errors) ==== /** * @param {function(this: string, number): number} c is just passing on through * @return {function(this: string, number): number} @@ -49,8 +46,6 @@ functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[ class C { /** @param {number} n */ constructor(n) { - ~ -!!! error TS7006: Parameter 'n' implicitly has an 'any' type. this.length = n; ~~~~~~ !!! error TS2339: Property 'length' does not exist on type 'C'. @@ -77,8 +72,6 @@ functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[ * @param {number} n */ function D(n) { - ~ -!!! error TS7006: Parameter 'n' implicitly has an 'any' type. this.length = n; } @@ -105,8 +98,6 @@ functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[ * @param {number} n */ var E = function(n) { - ~ -!!! error TS7006: Parameter 'n' implicitly has an 'any' type. this.not_length_on_purpose = n; }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt.diff index 202760ece8..4dfb3b025c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt.diff @@ -8,20 +8,17 @@ +functions.js(9,23): error TS7006: Parameter 'n' implicitly has an 'any' type. +functions.js(13,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(15,14): error TS7006: Parameter 'c' implicitly has an 'any' type. -+functions.js(21,17): error TS7006: Parameter 'n' implicitly has an 'any' type. +functions.js(22,14): error TS2339: Property 'length' does not exist on type 'C'. +functions.js(30,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(31,19): error TS7006: Parameter 'ab' implicitly has an 'any' type. +functions.js(31,23): error TS7006: Parameter 'onetwo' implicitly has an 'any' type. -+functions.js(38,12): error TS7006: Parameter 'n' implicitly has an 'any' type. +functions.js(49,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? +functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type. -+functions.js(60,18): error TS7006: Parameter 'n' implicitly has an 'any' type. +functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. -==== functions.js (1 errors) ==== -+==== functions.js (15 errors) ==== ++==== functions.js (12 errors) ==== /** * @param {function(this: string, number): number} c is just passing on through * @return {function(this: string, number): number} @@ -52,18 +49,16 @@ return c } - class C { +@@= skipped -24, +46 lines =@@ /** @param {number} n */ constructor(n) { -+ ~ -+!!! error TS7006: Parameter 'n' implicitly has an 'any' type. this.length = n; + ~~~~~~ +!!! error TS2339: Property 'length' does not exist on type 'C'. } } -@@= skipped -32, +61 lines =@@ +@@= skipped -8, +10 lines =@@ z.length; /** @type {function ("a" | "b", 1 | 2): 3 | 4} */ @@ -78,16 +73,7 @@ /** -@@= skipped -8, +15 lines =@@ - * @param {number} n - */ - function D(n) { -+ ~ -+!!! error TS7006: Parameter 'n' implicitly has an 'any' type. - this.length = n; - } - -@@= skipped -11, +13 lines =@@ +@@= skipped -19, +26 lines =@@ /** * @param {function(new: D, number)} dref * @return {D} @@ -100,14 +86,7 @@ var z3 = construct(D); z3.length; -@@= skipped -11, +15 lines =@@ - * @param {number} n - */ - var E = function(n) { -+ ~ -+!!! error TS7006: Parameter 'n' implicitly has an 'any' type. - this.not_length_on_purpose = n; - }; +@@= skipped -16, +20 lines =@@ var y3 = id2(E); @@ -118,7 +97,7 @@ // Repro from #39229 -@@= skipped -16, +14 lines =@@ +@@= skipped -11, +7 lines =@@ * @type {(...args: [string, string] | [number, string, string]) => void} */ function foo(...args) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt index 679391ceef..1eb51ea255 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt @@ -1,4 +1,5 @@ mod1.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +test.js(2,13): error TS2304: Cannot find name 'X'. ==== mod1.js (1 errors) ==== @@ -9,9 +10,11 @@ mod1.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install ty ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== test.js (0 errors) ==== +==== test.js (1 errors) ==== /** @typedef {import('./mod1').C} X */ /** @param {X} c */ + ~ +!!! error TS2304: Cannot find name 'X'. function demo(c) { c.s } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt.diff index e55e44a227..e8d4895fbb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt.diff @@ -4,6 +4,7 @@ - @@= skipped --1, +1 lines =@@ +mod1.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++test.js(2,13): error TS2304: Cannot find name 'X'. + + +==== mod1.js (1 errors) ==== @@ -14,9 +15,11 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== test.js (0 errors) ==== ++==== test.js (1 errors) ==== + /** @typedef {import('./mod1').C} X */ + /** @param {X} c */ ++ ~ ++!!! error TS2304: Cannot find name 'X'. + function demo(c) { + c.s + } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt new file mode 100644 index 0000000000..7cfc65e1df --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt @@ -0,0 +1,17 @@ +test.js(1,13): error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? + + +==== ex.d.ts (0 errors) ==== + declare var config: { + fix: boolean + } + export = config; + +==== test.js (1 errors) ==== + /** @param {import('./ex')} a */ + ~~~~~~~~~~~~~~ +!!! error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? + function demo(a) { + a.fix + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt.diff new file mode 100644 index 0000000000..3f2fae2ebd --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.jsdocImportTypeReferenceToCommonjsModule.errors.txt ++++ new.jsdocImportTypeReferenceToCommonjsModule.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++test.js(1,13): error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? ++ ++ ++==== ex.d.ts (0 errors) ==== ++ declare var config: { ++ fix: boolean ++ } ++ export = config; ++ ++==== test.js (1 errors) ==== ++ /** @param {import('./ex')} a */ ++ ~~~~~~~~~~~~~~ ++!!! error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? ++ function demo(a) { ++ a.fix ++ } ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt new file mode 100644 index 0000000000..b5f2e2a2bf --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt @@ -0,0 +1,14 @@ +test.js(1,13): error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? + + +==== ex.d.ts (0 errors) ==== + export var config: {} + +==== test.js (1 errors) ==== + /** @param {import('./ex')} a */ + ~~~~~~~~~~~~~~ +!!! error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? + function demo(a) { + a.config + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt.diff new file mode 100644 index 0000000000..def5d93263 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt.diff @@ -0,0 +1,19 @@ +--- old.jsdocImportTypeReferenceToESModule.errors.txt ++++ new.jsdocImportTypeReferenceToESModule.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++test.js(1,13): error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? ++ ++ ++==== ex.d.ts (0 errors) ==== ++ export var config: {} ++ ++==== test.js (1 errors) ==== ++ /** @param {import('./ex')} a */ ++ ~~~~~~~~~~~~~~ ++!!! error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? ++ function demo(a) { ++ a.config ++ } ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt index 04bc9753bc..9e8c9aa105 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt @@ -1,9 +1,10 @@ indices.js(1,12): error TS2315: Type 'Object' is not generic. indices.js(3,12): error TS2315: Type 'Object' is not generic. indices.js(5,12): error TS2315: Type 'Object' is not generic. +indices.js(7,13): error TS2315: Type 'Object' is not generic. -==== indices.js (3 errors) ==== +==== indices.js (4 errors) ==== /** @type {Object.} */ ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2315: Type 'Object' is not generic. @@ -17,6 +18,8 @@ indices.js(5,12): error TS2315: Type 'Object' is not generic. !!! error TS2315: Type 'Object' is not generic. var o3; /** @param {Object.} o */ + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. function f(o) { o.foo = 1; // error o.bar = false; // ok diff --git a/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt.diff index ff93adcbe6..b0dd51963b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt.diff @@ -5,10 +5,11 @@ +indices.js(1,12): error TS2315: Type 'Object' is not generic. +indices.js(3,12): error TS2315: Type 'Object' is not generic. +indices.js(5,12): error TS2315: Type 'Object' is not generic. ++indices.js(7,13): error TS2315: Type 'Object' is not generic. -==== indices.js (1 errors) ==== -+==== indices.js (3 errors) ==== ++==== indices.js (4 errors) ==== /** @type {Object.} */ + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. @@ -22,6 +23,8 @@ +!!! error TS2315: Type 'Object' is not generic. var o3; /** @param {Object.} o */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. function f(o) { o.foo = 1; // error - ~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParamTagTypeLiteral.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParamTagTypeLiteral.errors.txt deleted file mode 100644 index 45327cca41..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocParamTagTypeLiteral.errors.txt +++ /dev/null @@ -1,93 +0,0 @@ -0.js(5,17): error TS7006: Parameter 'notSpecial' implicitly has an 'any' type. -0.js(17,15): error TS7006: Parameter 'opts1' implicitly has an 'any' type. -0.js(28,52): error TS7006: Parameter 'opts2' implicitly has an 'any' type. -0.js(38,15): error TS7006: Parameter 'opts3' implicitly has an 'any' type. -0.js(50,15): error TS7006: Parameter 'opts4' implicitly has an 'any' type. -0.js(66,15): error TS7006: Parameter 'opts5' implicitly has an 'any' type. - - -==== 0.js (6 errors) ==== - /** - * @param {Object} notSpecial - * @param {string} unrelated - not actually related because it's not notSpecial.unrelated - */ - function normal(notSpecial) { - ~~~~~~~~~~ -!!! error TS7006: Parameter 'notSpecial' implicitly has an 'any' type. - notSpecial; // should just be 'Object' - } - normal(12); - - /** - * @param {Object} opts1 doc1 - * @param {string} opts1.x doc2 - * @param {string=} opts1.y doc3 - * @param {string} [opts1.z] doc4 - * @param {string} [opts1.w="hi"] doc5 - */ - function foo1(opts1) { - ~~~~~ -!!! error TS7006: Parameter 'opts1' implicitly has an 'any' type. - opts1.x; - } - - foo1({x: 'abc'}); - - /** - * @param {Object[]} opts2 - * @param {string} opts2[].anotherX - * @param {string=} opts2[].anotherY - */ - function foo2(/** @param opts2 bad idea theatre! */opts2) { - ~~~~~ -!!! error TS7006: Parameter 'opts2' implicitly has an 'any' type. - opts2[0].anotherX; - } - - foo2([{anotherX: "world"}]); - - /** - * @param {object} opts3 - * @param {string} opts3.x - */ - function foo3(opts3) { - ~~~~~ -!!! error TS7006: Parameter 'opts3' implicitly has an 'any' type. - opts3.x; - } - foo3({x: 'abc'}); - - /** - * @param {object[]} opts4 - * @param {string} opts4[].x - * @param {string=} opts4[].y - * @param {string} [opts4[].z] - * @param {string} [opts4[].w="hi"] - */ - function foo4(opts4) { - ~~~~~ -!!! error TS7006: Parameter 'opts4' implicitly has an 'any' type. - opts4[0].x; - } - - foo4([{ x: 'hi' }]); - - /** - * @param {object[]} opts5 - Let's test out some multiple nesting levels - * @param {string} opts5[].help - (This one is just normal) - * @param {object} opts5[].what - Look at us go! Here's the first nest! - * @param {string} opts5[].what.a - (Another normal one) - * @param {Object[]} opts5[].what.bad - Now we're nesting inside a nested type - * @param {string} opts5[].what.bad[].idea - I don't think you can get back out of this level... - * @param {boolean} opts5[].what.bad[].oh - Oh ... that's how you do it. - * @param {number} opts5[].unnest - Here we are almost all the way back at the beginning. - */ - function foo5(opts5) { - ~~~~~ -!!! error TS7006: Parameter 'opts5' implicitly has an 'any' type. - opts5[0].what.bad[0].idea; - opts5[0].unnest; - } - - foo5([{ help: "help", what: { a: 'a', bad: [{ idea: 'idea', oh: false }] }, unnest: 1 }]); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParamTagTypeLiteral.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocParamTagTypeLiteral.errors.txt.diff index 7b5acb674f..c9460f74db 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParamTagTypeLiteral.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocParamTagTypeLiteral.errors.txt.diff @@ -1,71 +1,83 @@ --- old.jsdocParamTagTypeLiteral.errors.txt +++ new.jsdocParamTagTypeLiteral.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -0.js(3,20): error TS8024: JSDoc '@param' tag has name 'unrelated', but there is no parameter with that name. -+0.js(5,17): error TS7006: Parameter 'notSpecial' implicitly has an 'any' type. -+0.js(17,15): error TS7006: Parameter 'opts1' implicitly has an 'any' type. -+0.js(28,52): error TS7006: Parameter 'opts2' implicitly has an 'any' type. -+0.js(38,15): error TS7006: Parameter 'opts3' implicitly has an 'any' type. -+0.js(50,15): error TS7006: Parameter 'opts4' implicitly has an 'any' type. -+0.js(66,15): error TS7006: Parameter 'opts5' implicitly has an 'any' type. - - +- +- -==== 0.js (1 errors) ==== -+==== 0.js (6 errors) ==== - /** - * @param {Object} notSpecial - * @param {string} unrelated - not actually related because it's not notSpecial.unrelated +- /** +- * @param {Object} notSpecial +- * @param {string} unrelated - not actually related because it's not notSpecial.unrelated - ~~~~~~~~~ -!!! error TS8024: JSDoc '@param' tag has name 'unrelated', but there is no parameter with that name. - */ - function normal(notSpecial) { -+ ~~~~~~~~~~ -+!!! error TS7006: Parameter 'notSpecial' implicitly has an 'any' type. - notSpecial; // should just be 'Object' - } - normal(12); -@@= skipped -20, +25 lines =@@ - * @param {string} [opts1.w="hi"] doc5 - */ - function foo1(opts1) { -+ ~~~~~ -+!!! error TS7006: Parameter 'opts1' implicitly has an 'any' type. - opts1.x; - } - -@@= skipped -11, +13 lines =@@ - * @param {string=} opts2[].anotherY - */ - function foo2(/** @param opts2 bad idea theatre! */opts2) { -+ ~~~~~ -+!!! error TS7006: Parameter 'opts2' implicitly has an 'any' type. - opts2[0].anotherX; - } - -@@= skipped -10, +12 lines =@@ - * @param {string} opts3.x - */ - function foo3(opts3) { -+ ~~~~~ -+!!! error TS7006: Parameter 'opts3' implicitly has an 'any' type. - opts3.x; - } - foo3({x: 'abc'}); -@@= skipped -12, +14 lines =@@ - * @param {string} [opts4[].w="hi"] - */ - function foo4(opts4) { -+ ~~~~~ -+!!! error TS7006: Parameter 'opts4' implicitly has an 'any' type. - opts4[0].x; - } - -@@= skipped -16, +18 lines =@@ - * @param {number} opts5[].unnest - Here we are almost all the way back at the beginning. - */ - function foo5(opts5) { -+ ~~~~~ -+!!! error TS7006: Parameter 'opts5' implicitly has an 'any' type. - opts5[0].what.bad[0].idea; - opts5[0].unnest; - } +- */ +- function normal(notSpecial) { +- notSpecial; // should just be 'Object' +- } +- normal(12); +- +- /** +- * @param {Object} opts1 doc1 +- * @param {string} opts1.x doc2 +- * @param {string=} opts1.y doc3 +- * @param {string} [opts1.z] doc4 +- * @param {string} [opts1.w="hi"] doc5 +- */ +- function foo1(opts1) { +- opts1.x; +- } +- +- foo1({x: 'abc'}); +- +- /** +- * @param {Object[]} opts2 +- * @param {string} opts2[].anotherX +- * @param {string=} opts2[].anotherY +- */ +- function foo2(/** @param opts2 bad idea theatre! */opts2) { +- opts2[0].anotherX; +- } +- +- foo2([{anotherX: "world"}]); +- +- /** +- * @param {object} opts3 +- * @param {string} opts3.x +- */ +- function foo3(opts3) { +- opts3.x; +- } +- foo3({x: 'abc'}); +- +- /** +- * @param {object[]} opts4 +- * @param {string} opts4[].x +- * @param {string=} opts4[].y +- * @param {string} [opts4[].z] +- * @param {string} [opts4[].w="hi"] +- */ +- function foo4(opts4) { +- opts4[0].x; +- } +- +- foo4([{ x: 'hi' }]); +- +- /** +- * @param {object[]} opts5 - Let's test out some multiple nesting levels +- * @param {string} opts5[].help - (This one is just normal) +- * @param {object} opts5[].what - Look at us go! Here's the first nest! +- * @param {string} opts5[].what.a - (Another normal one) +- * @param {Object[]} opts5[].what.bad - Now we're nesting inside a nested type +- * @param {string} opts5[].what.bad[].idea - I don't think you can get back out of this level... +- * @param {boolean} opts5[].what.bad[].oh - Oh ... that's how you do it. +- * @param {number} opts5[].unnest - Here we are almost all the way back at the beginning. +- */ +- function foo5(opts5) { +- opts5[0].what.bad[0].idea; +- opts5[0].unnest; +- } +- +- foo5([{ help: "help", what: { a: 'a', bad: [{ idea: 'idea', oh: false }] }, unnest: 1 }]); +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.errors.txt deleted file mode 100644 index a6fc714600..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -a.js(5,12): error TS7006: Parameter 'args' implicitly has an 'any' type. -a.js(5,18): error TS7006: Parameter 'bwarg' implicitly has an 'any' type. - - -==== a.js (2 errors) ==== - /** - * @param {string=} `args` - * @param `bwarg` {?number?} - */ - function f(args, bwarg) { - ~~~~ -!!! error TS7006: Parameter 'args' implicitly has an 'any' type. - ~~~~~ -!!! error TS7006: Parameter 'bwarg' implicitly has an 'any' type. - } - -==== ts.ts (0 errors) ==== - /** - * @param `arg` - this is fine - */ - function g(arg: string) { - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.errors.txt.diff index e6e876adcc..fedfeb44ac 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.errors.txt.diff @@ -1,23 +1,25 @@ --- old.jsdocParseBackquotedParamName.errors.txt +++ new.jsdocParseBackquotedParamName.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -a.js(5,18): error TS1016: A required parameter cannot follow an optional parameter. -+a.js(5,12): error TS7006: Parameter 'args' implicitly has an 'any' type. -+a.js(5,18): error TS7006: Parameter 'bwarg' implicitly has an 'any' type. - - +- +- -==== a.js (1 errors) ==== -+==== a.js (2 errors) ==== - /** - * @param {string=} `args` - * @param `bwarg` {?number?} - */ - function f(args, bwarg) { -+ ~~~~ -+!!! error TS7006: Parameter 'args' implicitly has an 'any' type. - ~~~~~ +- /** +- * @param {string=} `args` +- * @param `bwarg` {?number?} +- */ +- function f(args, bwarg) { +- ~~~~~ -!!! error TS1016: A required parameter cannot follow an optional parameter. -+!!! error TS7006: Parameter 'bwarg' implicitly has an 'any' type. - } - - ==== ts.ts (0 errors) ==== +- } +- +-==== ts.ts (0 errors) ==== +- /** +- * @param `arg` - this is fine +- */ +- function g(arg: string) { +- } +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseMatchingBackticks.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseMatchingBackticks.errors.txt deleted file mode 100644 index 84afda44f4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseMatchingBackticks.errors.txt +++ /dev/null @@ -1,36 +0,0 @@ -jsdocParseMatchingBackticks.js(12,19): error TS7006: Parameter 'x' implicitly has an 'any' type. -jsdocParseMatchingBackticks.js(12,22): error TS7006: Parameter 'y' implicitly has an 'any' type. -jsdocParseMatchingBackticks.js(12,25): error TS7006: Parameter 'z' implicitly has an 'any' type. -jsdocParseMatchingBackticks.js(12,28): error TS7006: Parameter 'alpha' implicitly has an 'any' type. -jsdocParseMatchingBackticks.js(12,35): error TS7006: Parameter 'beta' implicitly has an 'any' type. -jsdocParseMatchingBackticks.js(12,41): error TS7006: Parameter 'gamma' implicitly has an 'any' type. - - -==== jsdocParseMatchingBackticks.js (6 errors) ==== - /** - * `@param` initial at-param is OK in title comment - * @param {string} x hi there `@param` - * @param {string} y hi there `@ * param - * this is the margin - * so we'll drop everything before it - `@param` @param {string} z hello??? - * `@param` @param {string} alpha hello??? - * `@ * param` @param {string} beta hello??? - * @param {string} gamma - */ - export function f(x, y, z, alpha, beta, gamma) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'y' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'z' implicitly has an 'any' type. - ~~~~~ -!!! error TS7006: Parameter 'alpha' implicitly has an 'any' type. - ~~~~ -!!! error TS7006: Parameter 'beta' implicitly has an 'any' type. - ~~~~~ -!!! error TS7006: Parameter 'gamma' implicitly has an 'any' type. - return x + y + z + alpha + beta + gamma - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseMatchingBackticks.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocParseMatchingBackticks.errors.txt.diff deleted file mode 100644 index 3b910ca7a9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseMatchingBackticks.errors.txt.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- old.jsdocParseMatchingBackticks.errors.txt -+++ new.jsdocParseMatchingBackticks.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+jsdocParseMatchingBackticks.js(12,19): error TS7006: Parameter 'x' implicitly has an 'any' type. -+jsdocParseMatchingBackticks.js(12,22): error TS7006: Parameter 'y' implicitly has an 'any' type. -+jsdocParseMatchingBackticks.js(12,25): error TS7006: Parameter 'z' implicitly has an 'any' type. -+jsdocParseMatchingBackticks.js(12,28): error TS7006: Parameter 'alpha' implicitly has an 'any' type. -+jsdocParseMatchingBackticks.js(12,35): error TS7006: Parameter 'beta' implicitly has an 'any' type. -+jsdocParseMatchingBackticks.js(12,41): error TS7006: Parameter 'gamma' implicitly has an 'any' type. -+ -+ -+==== jsdocParseMatchingBackticks.js (6 errors) ==== -+ /** -+ * `@param` initial at-param is OK in title comment -+ * @param {string} x hi there `@param` -+ * @param {string} y hi there `@ * param -+ * this is the margin -+ * so we'll drop everything before it -+ `@param` @param {string} z hello??? -+ * `@param` @param {string} alpha hello??? -+ * `@ * param` @param {string} beta hello??? -+ * @param {string} gamma -+ */ -+ export function f(x, y, z, alpha, beta, gamma) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'y' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'z' implicitly has an 'any' type. -+ ~~~~~ -+!!! error TS7006: Parameter 'alpha' implicitly has an 'any' type. -+ ~~~~ -+!!! error TS7006: Parameter 'beta' implicitly has an 'any' type. -+ ~~~~~ -+!!! error TS7006: Parameter 'gamma' implicitly has an 'any' type. -+ return x + y + z + alpha + beta + gamma -+ } -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt index 0f3224b30b..41b724802d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt @@ -1,13 +1,10 @@ -a.js(3,12): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. a.js(12,14): error TS7006: Parameter 'f' implicitly has an 'any' type. -==== a.js (2 errors) ==== +==== a.js (1 errors) ==== /** @param {...*=} args @return {*=} */ function f(...args) { - ~~~~~~~ -!!! error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. return null } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt.diff index 57d4c13aa4..da88bb7750 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt.diff @@ -3,16 +3,13 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+a.js(3,12): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. +a.js(12,14): error TS7006: Parameter 'f' implicitly has an 'any' type. + + -+==== a.js (2 errors) ==== ++==== a.js (1 errors) ==== + /** @param {...*=} args + @return {*=} */ + function f(...args) { -+ ~~~~~~~ -+!!! error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. + return null + } + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt index e810256bc6..cad84a8210 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt @@ -1,14 +1,11 @@ -a.js(2,12): error TS7006: Parameter 'a' implicitly has an 'any' type. a.js(7,1): error TS2554: Expected 1 arguments, but got 0. a.js(13,12): error TS7006: Parameter 'a' implicitly has an 'any' type. a.js(18,1): error TS2554: Expected 1 arguments, but got 0. -==== a.js (4 errors) ==== +==== a.js (3 errors) ==== /** @param {number=} a */ function f(a) { - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. a = 1 a = null // should not be allowed a = undefined diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt.diff index 0121bc4eb3..2a00907542 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt.diff @@ -3,18 +3,15 @@ @@= skipped -0, +0 lines =@@ -a.js(4,5): error TS2322: Type 'null' is not assignable to type 'number | undefined'. -a.js(8,3): error TS2345: Argument of type 'null' is not assignable to parameter of type 'number | undefined'. -+a.js(2,12): error TS7006: Parameter 'a' implicitly has an 'any' type. +a.js(7,1): error TS2554: Expected 1 arguments, but got 0. +a.js(13,12): error TS7006: Parameter 'a' implicitly has an 'any' type. +a.js(18,1): error TS2554: Expected 1 arguments, but got 0. -==== a.js (2 errors) ==== -+==== a.js (4 errors) ==== ++==== a.js (3 errors) ==== /** @param {number=} a */ function f(a) { -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. a = 1 a = null // should not be allowed - ~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt index 20fd08e846..eb8c66517a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt @@ -1,21 +1,15 @@ prefixPostfix.js(18,12): error TS7006: Parameter 'x' implicitly has an 'any' type. -prefixPostfix.js(18,15): error TS7006: Parameter 'y' implicitly has an 'any' type. prefixPostfix.js(18,18): error TS7006: Parameter 'z' implicitly has an 'any' type. prefixPostfix.js(18,21): error TS7006: Parameter 'a' implicitly has an 'any' type. -prefixPostfix.js(18,24): error TS7006: Parameter 'b' implicitly has an 'any' type. prefixPostfix.js(18,27): error TS7006: Parameter 'c' implicitly has an 'any' type. -prefixPostfix.js(18,30): error TS7006: Parameter 'e' implicitly has an 'any' type. prefixPostfix.js(18,33): error TS7006: Parameter 'f' implicitly has an 'any' type. prefixPostfix.js(18,36): error TS7006: Parameter 'g' implicitly has an 'any' type. prefixPostfix.js(18,39): error TS7006: Parameter 'h' implicitly has an 'any' type. -prefixPostfix.js(18,42): error TS7006: Parameter 'i' implicitly has an 'any' type. prefixPostfix.js(18,45): error TS7006: Parameter 'j' implicitly has an 'any' type. prefixPostfix.js(18,48): error TS7006: Parameter 'k' implicitly has an 'any' type. -prefixPostfix.js(18,51): error TS7006: Parameter 'l' implicitly has an 'any' type. -prefixPostfix.js(18,54): error TS7006: Parameter 'm' implicitly has an 'any' type. -==== prefixPostfix.js (15 errors) ==== +==== prefixPostfix.js (9 errors) ==== /** * @param {number![]} x - number[] * @param {!number[]} y - number[] @@ -36,33 +30,21 @@ prefixPostfix.js(18,54): error TS7006: Parameter 'm' implicitly has an 'any' typ function f(x, y, z, a, b, c, e, f, g, h, i, j, k, l, m) { ~ !!! error TS7006: Parameter 'x' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ !!! error TS7006: Parameter 'z' implicitly has an 'any' type. ~ !!! error TS7006: Parameter 'a' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'b' implicitly has an 'any' type. ~ !!! error TS7006: Parameter 'c' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'e' implicitly has an 'any' type. ~ !!! error TS7006: Parameter 'f' implicitly has an 'any' type. ~ !!! error TS7006: Parameter 'g' implicitly has an 'any' type. ~ !!! error TS7006: Parameter 'h' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'i' implicitly has an 'any' type. ~ !!! error TS7006: Parameter 'j' implicitly has an 'any' type. ~ !!! error TS7006: Parameter 'k' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'l' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'm' implicitly has an 'any' type. } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt.diff index 6369772a84..9c29384ad3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt.diff @@ -13,24 +13,18 @@ -prefixPostfix.js(14,21): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. -prefixPostfix.js(14,21): error TS1005: '}' expected. +prefixPostfix.js(18,12): error TS7006: Parameter 'x' implicitly has an 'any' type. -+prefixPostfix.js(18,15): error TS7006: Parameter 'y' implicitly has an 'any' type. +prefixPostfix.js(18,18): error TS7006: Parameter 'z' implicitly has an 'any' type. prefixPostfix.js(18,21): error TS7006: Parameter 'a' implicitly has an 'any' type. -+prefixPostfix.js(18,24): error TS7006: Parameter 'b' implicitly has an 'any' type. +prefixPostfix.js(18,27): error TS7006: Parameter 'c' implicitly has an 'any' type. -+prefixPostfix.js(18,30): error TS7006: Parameter 'e' implicitly has an 'any' type. +prefixPostfix.js(18,33): error TS7006: Parameter 'f' implicitly has an 'any' type. +prefixPostfix.js(18,36): error TS7006: Parameter 'g' implicitly has an 'any' type. prefixPostfix.js(18,39): error TS7006: Parameter 'h' implicitly has an 'any' type. -+prefixPostfix.js(18,42): error TS7006: Parameter 'i' implicitly has an 'any' type. +prefixPostfix.js(18,45): error TS7006: Parameter 'j' implicitly has an 'any' type. prefixPostfix.js(18,48): error TS7006: Parameter 'k' implicitly has an 'any' type. -+prefixPostfix.js(18,51): error TS7006: Parameter 'l' implicitly has an 'any' type. -+prefixPostfix.js(18,54): error TS7006: Parameter 'm' implicitly has an 'any' type. -==== prefixPostfix.js (14 errors) ==== -+==== prefixPostfix.js (15 errors) ==== ++==== prefixPostfix.js (9 errors) ==== /** * @param {number![]} x - number[] * @param {!number[]} y - number[] @@ -73,33 +67,20 @@ function f(x, y, z, a, b, c, e, f, g, h, i, j, k, l, m) { + ~ +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'y' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. ~ !!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'c' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'e' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'f' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'g' implicitly has an 'any' type. ~ !!! error TS7006: Parameter 'h' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'i' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'j' implicitly has an 'any' type. ~ !!! error TS7006: Parameter 'k' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'l' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'm' implicitly has an 'any' type. } - diff --git a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt deleted file mode 100644 index 4c08d9d07a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt +++ /dev/null @@ -1,51 +0,0 @@ -jsdocSignatureOnReturnedFunction.js(7,13): error TS7006: Parameter 'a' implicitly has an 'any' type. -jsdocSignatureOnReturnedFunction.js(7,16): error TS7006: Parameter 'b' implicitly has an 'any' type. -jsdocSignatureOnReturnedFunction.js(18,22): error TS7006: Parameter 'a' implicitly has an 'any' type. -jsdocSignatureOnReturnedFunction.js(18,25): error TS7006: Parameter 'b' implicitly has an 'any' type. - - -==== jsdocSignatureOnReturnedFunction.js (4 errors) ==== - function f1() { - /** - * @param {number} a - * @param {number} b - * @returns {number} - */ - return (a, b) => { - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'b' implicitly has an 'any' type. - return a + b; - } - } - - function f2() { - /** - * @param {number} a - * @param {number} b - * @returns {number} - */ - return function (a, b){ - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'b' implicitly has an 'any' type. - return a + b; - } - } - - function f3() { - /** @type {(a: number, b: number) => number} */ - return (a, b) => { - return a + b; - } - } - - function f4() { - /** @type {(a: number, b: number) => number} */ - return function (a, b){ - return a + b; - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff deleted file mode 100644 index c02ee95b86..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff +++ /dev/null @@ -1,56 +0,0 @@ ---- old.jsdocSignatureOnReturnedFunction.errors.txt -+++ new.jsdocSignatureOnReturnedFunction.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+jsdocSignatureOnReturnedFunction.js(7,13): error TS7006: Parameter 'a' implicitly has an 'any' type. -+jsdocSignatureOnReturnedFunction.js(7,16): error TS7006: Parameter 'b' implicitly has an 'any' type. -+jsdocSignatureOnReturnedFunction.js(18,22): error TS7006: Parameter 'a' implicitly has an 'any' type. -+jsdocSignatureOnReturnedFunction.js(18,25): error TS7006: Parameter 'b' implicitly has an 'any' type. -+ -+ -+==== jsdocSignatureOnReturnedFunction.js (4 errors) ==== -+ function f1() { -+ /** -+ * @param {number} a -+ * @param {number} b -+ * @returns {number} -+ */ -+ return (a, b) => { -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. -+ return a + b; -+ } -+ } -+ -+ function f2() { -+ /** -+ * @param {number} a -+ * @param {number} b -+ * @returns {number} -+ */ -+ return function (a, b){ -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. -+ return a + b; -+ } -+ } -+ -+ function f3() { -+ /** @type {(a: number, b: number) => number} */ -+ return (a, b) => { -+ return a + b; -+ } -+ } -+ -+ function f4() { -+ /** @type {(a: number, b: number) => number} */ -+ return function (a, b){ -+ return a + b; -+ } -+ } -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt index e81d98cf40..81b519724a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt @@ -1,10 +1,15 @@ +templateTagOnClasses.js(8,17): error TS2304: Cannot find name 'T'. templateTagOnClasses.js(10,14): error TS2339: Property 'a' does not exist on type 'Foo'. +templateTagOnClasses.js(14,16): error TS2304: Cannot find name 'T'. +templateTagOnClasses.js(15,16): error TS2304: Cannot find name 'Id'. +templateTagOnClasses.js(15,19): error TS2304: Cannot find name 'T'. +templateTagOnClasses.js(16,16): error TS2304: Cannot find name 'Id2'. templateTagOnClasses.js(17,17): error TS2304: Cannot find name 'T'. templateTagOnClasses.js(25,3): error TS2339: Property 'a' does not exist on type 'Foo'. templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type 'Foo'. -==== templateTagOnClasses.js (4 errors) ==== +==== templateTagOnClasses.js (9 errors) ==== /** * @template T * @typedef {(t: T) => T} Id @@ -13,6 +18,8 @@ templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type class Foo { /** @typedef {(t: T) => T} Id2 */ /** @param {T} x */ + ~ +!!! error TS2304: Cannot find name 'T'. constructor (x) { this.a = x ~ @@ -21,8 +28,16 @@ templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type /** * * @param {T} x + ~ +!!! error TS2304: Cannot find name 'T'. * @param {Id} y + ~~ +!!! error TS2304: Cannot find name 'Id'. + ~ +!!! error TS2304: Cannot find name 'T'. * @param {Id2} alpha + ~~~ +!!! error TS2304: Cannot find name 'Id2'. * @return {T} ~ !!! error TS2304: Cannot find name 'T'. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt.diff index bd56e89154..0aad856fe8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt.diff @@ -2,19 +2,28 @@ +++ new.jsdocTemplateClass.errors.txt @@= skipped -0, +0 lines =@@ -templateTagOnClasses.js(25,1): error TS2322: Type 'boolean' is not assignable to type 'number'. ++templateTagOnClasses.js(8,17): error TS2304: Cannot find name 'T'. +templateTagOnClasses.js(10,14): error TS2339: Property 'a' does not exist on type 'Foo'. ++templateTagOnClasses.js(14,16): error TS2304: Cannot find name 'T'. ++templateTagOnClasses.js(15,16): error TS2304: Cannot find name 'Id'. ++templateTagOnClasses.js(15,19): error TS2304: Cannot find name 'T'. ++templateTagOnClasses.js(16,16): error TS2304: Cannot find name 'Id2'. +templateTagOnClasses.js(17,17): error TS2304: Cannot find name 'T'. +templateTagOnClasses.js(25,3): error TS2339: Property 'a' does not exist on type 'Foo'. +templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type 'Foo'. -==== templateTagOnClasses.js (1 errors) ==== -+==== templateTagOnClasses.js (4 errors) ==== ++==== templateTagOnClasses.js (9 errors) ==== /** * @template T * @typedef {(t: T) => T} Id -@@= skipped -11, +14 lines =@@ +@@= skipped -9, +17 lines =@@ + class Foo { + /** @typedef {(t: T) => T} Id2 */ /** @param {T} x */ ++ ~ ++!!! error TS2304: Cannot find name 'T'. constructor (x) { this.a = x + ~ @@ -22,16 +31,24 @@ } /** * -@@= skipped -7, +9 lines =@@ + * @param {T} x ++ ~ ++!!! error TS2304: Cannot find name 'T'. * @param {Id} y ++ ~~ ++!!! error TS2304: Cannot find name 'Id'. ++ ~ ++!!! error TS2304: Cannot find name 'T'. * @param {Id2} alpha ++ ~~~ ++!!! error TS2304: Cannot find name 'Id2'. * @return {T} + ~ +!!! error TS2304: Cannot find name 'T'. */ foo(x, y, alpha) { return alpha(y(x)) -@@= skipped -8, +10 lines =@@ +@@= skipped -17, +31 lines =@@ var f = new Foo(1) var g = new Foo(false) f.a = g.a diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt new file mode 100644 index 0000000000..d143e9dbe1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt @@ -0,0 +1,31 @@ +templateTagOnConstructorFunctions.js(6,12): error TS2304: Cannot find name 'T'. + + +==== templateTagOnConstructorFunctions.js (1 errors) ==== + /** + * @template U + * @typedef {(u: U) => U} Id + */ + /** + * @param {T} t + ~ +!!! error TS2304: Cannot find name 'T'. + * @template T + */ + function Zet(t) { + /** @type {T} */ + this.u + this.t = t + } + /** + * @param {T} v + * @param {Id} id + */ + Zet.prototype.add = function(v, id) { + this.u = v || this.t + return id(this.u) + } + var z = new Zet(1) + z.t = 2 + z.u = false + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt.diff index d0e17268a9..b0c893adcf 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt.diff @@ -1,36 +1,24 @@ --- old.jsdocTemplateConstructorFunction.errors.txt +++ new.jsdocTemplateConstructorFunction.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -templateTagOnConstructorFunctions.js(24,1): error TS2322: Type 'boolean' is not assignable to type 'number'. -- -- --==== templateTagOnConstructorFunctions.js (1 errors) ==== -- /** -- * @template U -- * @typedef {(u: U) => U} Id -- */ -- /** -- * @param {T} t -- * @template T -- */ -- function Zet(t) { -- /** @type {T} */ -- this.u -- this.t = t -- } -- /** -- * @param {T} v -- * @param {Id} id -- */ -- Zet.prototype.add = function(v, id) { -- this.u = v || this.t -- return id(this.u) -- } -- var z = new Zet(1) -- z.t = 2 -- z.u = false ++templateTagOnConstructorFunctions.js(6,12): error TS2304: Cannot find name 'T'. + + + ==== templateTagOnConstructorFunctions.js (1 errors) ==== +@@= skipped -7, +7 lines =@@ + */ + /** + * @param {T} t ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @template T + */ + function Zet(t) { +@@= skipped -18, +20 lines =@@ + var z = new Zet(1) + z.t = 2 + z.u = false - ~~~ -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. -- -@@= skipped --1, +1 lines =@@ -+ + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt index 96121d76bc..3de300722c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt @@ -1,9 +1,12 @@ +templateTagWithNestedTypeLiteral.js(2,12): error TS2304: Cannot find name 'T'. templateTagWithNestedTypeLiteral.js(30,12): error TS2304: Cannot find name 'A'. -==== templateTagWithNestedTypeLiteral.js (1 errors) ==== +==== templateTagWithNestedTypeLiteral.js (2 errors) ==== /** * @param {T} t + ~ +!!! error TS2304: Cannot find name 'T'. * @template T */ function Zet(t) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff index 124ecba5f3..b5ef0f8d74 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff @@ -3,15 +3,19 @@ @@= skipped -0, +0 lines =@@ -templateTagWithNestedTypeLiteral.js(21,1): error TS2322: Type 'boolean' is not assignable to type 'number'. -templateTagWithNestedTypeLiteral.js(28,15): error TS2304: Cannot find name 'T'. ++templateTagWithNestedTypeLiteral.js(2,12): error TS2304: Cannot find name 'T'. +templateTagWithNestedTypeLiteral.js(30,12): error TS2304: Cannot find name 'A'. --==== templateTagWithNestedTypeLiteral.js (2 errors) ==== -+==== templateTagWithNestedTypeLiteral.js (1 errors) ==== + ==== templateTagWithNestedTypeLiteral.js (2 errors) ==== /** * @param {T} t ++ ~ ++!!! error TS2304: Cannot find name 'T'. * @template T -@@= skipped -23, +22 lines =@@ + */ + function Zet(t) { +@@= skipped -23, +25 lines =@@ var z = new Zet(1) z.t = 2 z.u = false diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt index b60487ba5b..21a9fab8a3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt @@ -1,11 +1,15 @@ +forgot.js(2,12): error TS2304: Cannot find name 'T'. +forgot.js(11,12): error TS2304: Cannot find name 'T'. forgot.js(13,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. Type 'void' is not assignable to type 'Animation'. -==== forgot.js (2 errors) ==== +==== forgot.js (4 errors) ==== /** * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. * @template T */ function f(a) { @@ -15,6 +19,8 @@ forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKey /** * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. * @template T * @returns {function(): T} ~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff index daf552c939..e5cc7d533a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff @@ -2,18 +2,28 @@ +++ new.jsdocTemplateTag.errors.txt @@= skipped -0, +0 lines =@@ -forgot.js(23,1): error TS2322: Type '(keyframes: any[]) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. ++forgot.js(2,12): error TS2304: Cannot find name 'T'. ++forgot.js(11,12): error TS2304: Cannot find name 'T'. +forgot.js(13,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. Type 'void' is not assignable to type 'Animation'. -==== forgot.js (1 errors) ==== -+==== forgot.js (2 errors) ==== ++==== forgot.js (4 errors) ==== /** * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. * @template T -@@= skipped -15, +16 lines =@@ + */ + function f(a) { +@@= skipped -13, +18 lines =@@ + + /** * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. * @template T * @returns {function(): T} + ~~~~~~~~ @@ -22,7 +32,7 @@ */ function g(a) { return () => a -@@= skipped -11, +14 lines =@@ +@@= skipped -13, +18 lines =@@ */ Element.prototype.animate = function(keyframes) {}; ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt index e74792dd0d..5513f1c711 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt @@ -1,11 +1,14 @@ +github17339.js(4,13): error TS2304: Cannot find name 'T'. github17339.js(5,15): error TS2304: Cannot find name 'T'. -==== github17339.js (1 errors) ==== +==== github17339.js (2 errors) ==== var obj = { /** * @template T * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {T} ~ !!! error TS2304: Cannot find name 'T'. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt.diff index 9255ac4171..00574f819b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt.diff @@ -3,14 +3,17 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++github17339.js(4,13): error TS2304: Cannot find name 'T'. +github17339.js(5,15): error TS2304: Cannot find name 'T'. + + -+==== github17339.js (1 errors) ==== ++==== github17339.js (2 errors) ==== + var obj = { + /** + * @template T + * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt index ab9d0ecee6..65c5b3e1df 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt @@ -1,18 +1,34 @@ +a.js(6,12): error TS2304: Cannot find name 'T'. +a.js(7,12): error TS2304: Cannot find name 'U'. +a.js(8,12): error TS2304: Cannot find name 'V'. +a.js(9,12): error TS2304: Cannot find name 'W'. +a.js(10,12): error TS2304: Cannot find name 'X'. a.js(11,13): error TS2304: Cannot find name 'W'. a.js(11,17): error TS2304: Cannot find name 'X'. +a.js(26,12): error TS2304: Cannot find name 'T'. -==== a.js (2 errors) ==== +==== a.js (8 errors) ==== /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? * @template W * @template X That last one had no comment * @param {T} t + ~ +!!! error TS2304: Cannot find name 'T'. * @param {U} u + ~ +!!! error TS2304: Cannot find name 'U'. * @param {V} v + ~ +!!! error TS2304: Cannot find name 'V'. * @param {W} w + ~ +!!! error TS2304: Cannot find name 'W'. * @param {X} x + ~ +!!! error TS2304: Cannot find name 'X'. * @return {W | X} ~ !!! error TS2304: Cannot find name 'W'. @@ -33,6 +49,8 @@ a.js(11,17): error TS2304: Cannot find name 'X'. * @template {NoLongerAllowed} * @template T preceding line's syntax is no longer allowed * @param {T} x + ~ +!!! error TS2304: Cannot find name 'T'. */ function g(x) { } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt.diff index a0bc508469..92fa4d9c45 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt.diff @@ -7,18 +7,38 @@ - Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -a.js(24,15): error TS2304: Cannot find name 'NoLongerAllowed'. -a.js(25,2): error TS1069: Unexpected token. A type parameter name was expected without curly braces. ++a.js(6,12): error TS2304: Cannot find name 'T'. ++a.js(7,12): error TS2304: Cannot find name 'U'. ++a.js(8,12): error TS2304: Cannot find name 'V'. ++a.js(9,12): error TS2304: Cannot find name 'W'. ++a.js(10,12): error TS2304: Cannot find name 'X'. +a.js(11,13): error TS2304: Cannot find name 'W'. +a.js(11,17): error TS2304: Cannot find name 'X'. ++a.js(26,12): error TS2304: Cannot find name 'T'. -==== a.js (5 errors) ==== -+==== a.js (2 errors) ==== ++==== a.js (8 errors) ==== /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? -@@= skipped -17, +13 lines =@@ + * @template W + * @template X That last one had no comment + * @param {T} t ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @param {U} u ++ ~ ++!!! error TS2304: Cannot find name 'U'. + * @param {V} v ++ ~ ++!!! error TS2304: Cannot find name 'V'. * @param {W} w ++ ~ ++!!! error TS2304: Cannot find name 'W'. * @param {X} x ++ ~ ++!!! error TS2304: Cannot find name 'X'. * @return {W | X} + ~ +!!! error TS2304: Cannot find name 'W'. @@ -34,7 +54,7 @@ return w; } return x; -@@= skipped -14, +14 lines =@@ +@@= skipped -31, +43 lines =@@ f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); f({ a: 12 }, undefined, undefined, 101, 'nope'); @@ -51,5 +71,8 @@ - ~ -!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. * @param {T} x ++ ~ ++!!! error TS2304: Cannot find name 'T'. */ function g(x) { } + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt index a5e3e71137..3327c8ae09 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt @@ -1,15 +1,15 @@ a.js(9,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. +a.js(14,16): error TS2304: Cannot find name 'K'. a.js(15,18): error TS2304: Cannot find name 'V'. -a.js(17,9): error TS7006: Parameter 'key' implicitly has an 'any' type. -a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => V; }'. +a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. a.js(30,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. +a.js(35,16): error TS2304: Cannot find name 'K'. a.js(36,18): error TS2304: Cannot find name 'V'. -a.js(38,19): error TS7006: Parameter 'key' implicitly has an 'any' type. a.js(50,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. a.js(52,10): error TS2339: Property '_map' does not exist on type '{}'. a.js(55,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. +a.js(57,16): error TS2304: Cannot find name 'K'. a.js(58,18): error TS2304: Cannot find name 'V'. -a.js(60,9): error TS7006: Parameter 'key' implicitly has an 'any' type. ==== a.js (12 errors) ==== @@ -29,16 +29,16 @@ a.js(60,9): error TS7006: Parameter 'key' implicitly has an 'any' type. Multimap.prototype = { /** * @param {K} key the key ok + ~ +!!! error TS2304: Cannot find name 'K'. * @returns {V} the value ok ~ !!! error TS2304: Cannot find name 'V'. */ get(key) { - ~~~ -!!! error TS7006: Parameter 'key' implicitly has an 'any' type. return this._map[key + '']; ~~~~ -!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => V; }'. +!!! error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. } } @@ -58,13 +58,13 @@ a.js(60,9): error TS7006: Parameter 'key' implicitly has an 'any' type. Multimap2.prototype = { /** * @param {K} key the key ok + ~ +!!! error TS2304: Cannot find name 'K'. * @returns {V} the value ok ~ !!! error TS2304: Cannot find name 'V'. */ get: function(key) { - ~~~ -!!! error TS7006: Parameter 'key' implicitly has an 'any' type. return this._map[key + '']; } } @@ -90,13 +90,13 @@ a.js(60,9): error TS7006: Parameter 'key' implicitly has an 'any' type. !!! error TS2339: Property 'Multimap3' does not exist on type '{}'. /** * @param {K} key the key ok + ~ +!!! error TS2304: Cannot find name 'K'. * @returns {V} the value ok ~ !!! error TS2304: Cannot find name 'V'. */ get(key) { - ~~~ -!!! error TS7006: Parameter 'key' implicitly has an 'any' type. return this._map[key + '']; } } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff index c45e597c1f..06a4860016 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff @@ -4,17 +4,17 @@ - @@= skipped --1, +1 lines =@@ +a.js(9,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. ++a.js(14,16): error TS2304: Cannot find name 'K'. +a.js(15,18): error TS2304: Cannot find name 'V'. -+a.js(17,9): error TS7006: Parameter 'key' implicitly has an 'any' type. -+a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => V; }'. ++a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. +a.js(30,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. ++a.js(35,16): error TS2304: Cannot find name 'K'. +a.js(36,18): error TS2304: Cannot find name 'V'. -+a.js(38,19): error TS7006: Parameter 'key' implicitly has an 'any' type. +a.js(50,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. +a.js(52,10): error TS2339: Property '_map' does not exist on type '{}'. +a.js(55,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. ++a.js(57,16): error TS2304: Cannot find name 'K'. +a.js(58,18): error TS2304: Cannot find name 'V'. -+a.js(60,9): error TS7006: Parameter 'key' implicitly has an 'any' type. + + +==== a.js (12 errors) ==== @@ -34,16 +34,16 @@ + Multimap.prototype = { + /** + * @param {K} key the key ok ++ ~ ++!!! error TS2304: Cannot find name 'K'. + * @returns {V} the value ok + ~ +!!! error TS2304: Cannot find name 'V'. + */ + get(key) { -+ ~~~ -+!!! error TS7006: Parameter 'key' implicitly has an 'any' type. + return this._map[key + '']; + ~~~~ -+!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => V; }'. ++!!! error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. + } + } + @@ -63,13 +63,13 @@ + Multimap2.prototype = { + /** + * @param {K} key the key ok ++ ~ ++!!! error TS2304: Cannot find name 'K'. + * @returns {V} the value ok + ~ +!!! error TS2304: Cannot find name 'V'. + */ + get: function(key) { -+ ~~~ -+!!! error TS7006: Parameter 'key' implicitly has an 'any' type. + return this._map[key + '']; + } + } @@ -95,13 +95,13 @@ +!!! error TS2339: Property 'Multimap3' does not exist on type '{}'. + /** + * @param {K} key the key ok ++ ~ ++!!! error TS2304: Cannot find name 'K'. + * @returns {V} the value ok + ~ +!!! error TS2304: Cannot find name 'V'. + */ + get(key) { -+ ~~~ -+!!! error TS7006: Parameter 'key' implicitly has an 'any' type. + return this._map[key + '']; + } + } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt index aa33de21b0..eb19fe5905 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt @@ -1,30 +1,32 @@ +a.js(3,12): error TS2304: Cannot find name 'T'. a.js(4,14): error TS2304: Cannot find name 'T'. -a.js(6,13): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(15,12): error TS2304: Cannot find name 'T'. a.js(16,14): error TS2304: Cannot find name 'T'. -a.js(18,13): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(27,12): error TS2304: Cannot find name 'T'. a.js(28,14): error TS2304: Cannot find name 'T'. -a.js(30,13): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(38,13): error TS2304: Cannot find name 'T'. +a.js(38,16): error TS2304: Cannot find name 'T'. a.js(39,14): error TS2304: Cannot find name 'T'. -a.js(41,13): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(49,17): error TS2304: Cannot find name 'T'. +a.js(49,23): error TS2304: Cannot find name 'T'. a.js(50,14): error TS2304: Cannot find name 'T'. -a.js(52,13): error TS7006: Parameter 'obj' implicitly has an 'any' type. -a.js(65,17): error TS7006: Parameter 'x' implicitly has an 'any' type. -a.js(71,9): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(63,16): error TS2304: Cannot find name 'T'. +a.js(69,16): error TS2304: Cannot find name 'U'. +a.js(81,12): error TS2304: Cannot find name 'T'. a.js(82,14): error TS2304: Cannot find name 'T'. -a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. -==== a.js (14 errors) ==== +==== a.js (16 errors) ==== /** * @template const T * @param {T} x + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {T} ~ !!! error TS2304: Cannot find name 'T'. */ function f1(x) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. return x; } const t1 = f1("a"); @@ -34,13 +36,13 @@ a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. /** * @template const T, U * @param {T} x + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {T} ~ !!! error TS2304: Cannot find name 'T'. */ function f2(x) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. return x; }; const t4 = f2('a'); @@ -50,13 +52,13 @@ a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. /** * @template const T * @param {T} x + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {T[]} ~ !!! error TS2304: Cannot find name 'T'. */ function f3(x) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. return [x]; } const t7 = f3("hello"); @@ -65,13 +67,15 @@ a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. /** * @template const T * @param {[T, T]} x + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {T} ~ !!! error TS2304: Cannot find name 'T'. */ function f4(x) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. return x[0]; } const t9 = f4([[1, "x"], [2, "y"]]); @@ -80,13 +84,15 @@ a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. /** * @template const T * @param {{ x: T, y: T}} obj + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {T} ~ !!! error TS2304: Cannot find name 'T'. */ function f5(obj) { - ~~~ -!!! error TS7006: Parameter 'obj' implicitly has an 'any' type. return obj.x; } const t11 = f5({ x: [1, "x"], y: [2, "y"] }); @@ -98,18 +104,18 @@ a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. class C { /** * @param {T} x + ~ +!!! error TS2304: Cannot find name 'T'. */ constructor(x) {} - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. /** * @template const U * @param {U} x + ~ +!!! error TS2304: Cannot find name 'U'. */ foo(x) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. return x; } } @@ -120,13 +126,13 @@ a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. /** * @template {readonly unknown[]} const T * @param {T} args + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {T} ~ !!! error TS2304: Cannot find name 'T'. */ function f6(...args) { - ~~~~~~~ -!!! error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. return args; } const t15 = f6(1, 'b', { a: 1, b: 'x' }); diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt.diff index d908071c6a..48001aa0bf 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt.diff @@ -3,33 +3,35 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++a.js(3,12): error TS2304: Cannot find name 'T'. +a.js(4,14): error TS2304: Cannot find name 'T'. -+a.js(6,13): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(15,12): error TS2304: Cannot find name 'T'. +a.js(16,14): error TS2304: Cannot find name 'T'. -+a.js(18,13): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(27,12): error TS2304: Cannot find name 'T'. +a.js(28,14): error TS2304: Cannot find name 'T'. -+a.js(30,13): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(38,13): error TS2304: Cannot find name 'T'. ++a.js(38,16): error TS2304: Cannot find name 'T'. +a.js(39,14): error TS2304: Cannot find name 'T'. -+a.js(41,13): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(49,17): error TS2304: Cannot find name 'T'. ++a.js(49,23): error TS2304: Cannot find name 'T'. +a.js(50,14): error TS2304: Cannot find name 'T'. -+a.js(52,13): error TS7006: Parameter 'obj' implicitly has an 'any' type. -+a.js(65,17): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(71,9): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(63,16): error TS2304: Cannot find name 'T'. ++a.js(69,16): error TS2304: Cannot find name 'U'. ++a.js(81,12): error TS2304: Cannot find name 'T'. +a.js(82,14): error TS2304: Cannot find name 'T'. -+a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. + + -+==== a.js (14 errors) ==== ++==== a.js (16 errors) ==== + /** + * @template const T + * @param {T} x ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function f1(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. + return x; + } + const t1 = f1("a"); @@ -39,13 +41,13 @@ + /** + * @template const T, U + * @param {T} x ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function f2(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. + return x; + }; + const t4 = f2('a'); @@ -55,13 +57,13 @@ + /** + * @template const T + * @param {T} x ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @returns {T[]} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function f3(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. + return [x]; + } + const t7 = f3("hello"); @@ -70,13 +72,15 @@ + /** + * @template const T + * @param {[T, T]} x ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function f4(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. + return x[0]; + } + const t9 = f4([[1, "x"], [2, "y"]]); @@ -85,13 +89,15 @@ + /** + * @template const T + * @param {{ x: T, y: T}} obj ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function f5(obj) { -+ ~~~ -+!!! error TS7006: Parameter 'obj' implicitly has an 'any' type. + return obj.x; + } + const t11 = f5({ x: [1, "x"], y: [2, "y"] }); @@ -103,18 +109,18 @@ + class C { + /** + * @param {T} x ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + constructor(x) {} -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. + + /** + * @template const U + * @param {U} x ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + foo(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. + return x; + } + } @@ -125,13 +131,13 @@ + /** + * @template {readonly unknown[]} const T + * @param {T} args ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function f6(...args) { -+ ~~~~~~~ -+!!! error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. + return args; + } + const t15 = f6(1, 'b', { a: 1, b: 'x' }); diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols index e885cba37e..9bedd14ef2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols @@ -89,6 +89,7 @@ function f4(x) { return x[0]; >x : Symbol(x, Decl(a.js, 40, 12)) +>0 : Symbol("0") } const t9 = f4([[1, "x"], [2, "y"]]); >t9 : Symbol(t9, Decl(a.js, 43, 5)) @@ -112,7 +113,9 @@ function f5(obj) { >obj : Symbol(obj, Decl(a.js, 51, 12)) return obj.x; +>obj.x : Symbol(x, Decl(a.js, 48, 12)) >obj : Symbol(obj, Decl(a.js, 51, 12)) +>x : Symbol(x, Decl(a.js, 48, 12)) } const t11 = f5({ x: [1, "x"], y: [2, "y"] }); >t11 : Symbol(t11, Decl(a.js, 54, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols.diff index 78d72ec4b2..340d0c1f60 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols.diff @@ -5,20 +5,11 @@ return x[0]; >x : Symbol(x, Decl(a.js, 40, 12)) ->0 : Symbol(0) ++>0 : Symbol("0") } const t9 = f4([[1, "x"], [2, "y"]]); >t9 : Symbol(t9, Decl(a.js, 43, 5)) -@@= skipped -24, +23 lines =@@ - >obj : Symbol(obj, Decl(a.js, 51, 12)) - - return obj.x; -->obj.x : Symbol(x, Decl(a.js, 48, 12)) - >obj : Symbol(obj, Decl(a.js, 51, 12)) -->x : Symbol(x, Decl(a.js, 48, 12)) - } - const t11 = f5({ x: [1, "x"], y: [2, "y"] }); - >t11 : Symbol(t11, Decl(a.js, 54, 5)) -@@= skipped -37, +35 lines =@@ +@@= skipped -61, +61 lines =@@ * @param {U} x */ foo(x) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt index 757a9d1ea0..8521be0860 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt @@ -1,5 +1,5 @@ +a.js(13,12): error TS2304: Cannot find name 'T'. a.js(14,14): error TS2304: Cannot find name 'T'. -a.js(16,12): error TS7006: Parameter 'x' implicitly has an 'any' type. ==== a.js (2 errors) ==== @@ -16,13 +16,13 @@ a.js(16,12): error TS7006: Parameter 'x' implicitly has an 'any' type. /** * @template private T * @param {T} x + ~ +!!! error TS2304: Cannot find name 'T'. * @returns {T} ~ !!! error TS2304: Cannot find name 'T'. */ function f(x) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. return x; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt.diff index 41f184798f..e47ca4a1bb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt.diff @@ -3,8 +3,8 @@ @@= 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(12,14): error TS1273: 'private' modifier cannot appear on a type parameter ++a.js(13,12): error TS2304: Cannot find name 'T'. +a.js(14,14): error TS2304: Cannot find name 'T'. -+a.js(16,12): error TS7006: Parameter 'x' implicitly has an 'any' type. ==== a.js (2 errors) ==== @@ -22,13 +22,11 @@ - ~~~~~~~ -!!! error TS1273: 'private' modifier cannot appear on a type parameter * @param {T} x ++ ~ ++!!! error TS2304: Cannot find name 'T'. * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. */ function f(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. return x; - } - diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt index 9116c9fae8..ca0f96dde5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt @@ -8,7 +8,7 @@ a.js(46,11): error TS2304: Cannot find name 'Invariant'. a.js(48,29): error TS7006: Parameter 'x' implicitly has an 'any' type. a.js(51,11): error TS2304: Cannot find name 'Invariant'. a.js(53,27): error TS7006: Parameter 'x' implicitly has an 'any' type. -a.js(62,12): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(60,12): error TS2304: Cannot find name 'T'. ==== a.js (11 errors) ==== @@ -92,8 +92,8 @@ a.js(62,12): error TS7006: Parameter 'x' implicitly has an 'any' type. /** * @template in T * @param {T} x + ~ +!!! error TS2304: Cannot find name 'T'. */ function f(x) {} - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt.diff index 55f994a923..7e7d2a8170 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt.diff @@ -24,7 +24,7 @@ +a.js(48,29): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(51,11): error TS2304: Cannot find name 'Invariant'. +a.js(53,27): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(62,12): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(60,12): error TS2304: Cannot find name 'T'. -==== a.js (5 errors) ==== @@ -121,8 +121,8 @@ - ~~ -!!! error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias * @param {T} x ++ ~ ++!!! error TS2304: Cannot find name 'T'. */ function f(x) {} -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt index f2868a8933..ba699fddc5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt @@ -2,9 +2,15 @@ file.js(6,12): error TS2304: Cannot find name 'A'. file.js(8,12): error TS2304: Cannot find name 'A'. file.js(10,12): error TS2304: Cannot find name 'A'. file.js(12,12): error TS2304: Cannot find name 'A'. +file.js(46,12): error TS2304: Cannot find name 'T'. +file.js(47,12): error TS2304: Cannot find name 'U'. +file.js(54,12): error TS2304: Cannot find name 'T'. +file.js(55,12): error TS2304: Cannot find name 'U'. +file.js(62,12): error TS2304: Cannot find name 'T'. +file.js(63,12): error TS2304: Cannot find name 'U'. -==== file.js (4 errors) ==== +==== file.js (10 errors) ==== /** * @template {string | number} [T=string] - ok: defaults are permitted * @typedef {[T]} A @@ -59,7 +65,11 @@ file.js(12,12): error TS2304: Cannot find name 'A'. * @template T * @template [U=T] - ok: default can reference earlier type parameter * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. * @param {U} b + ~ +!!! error TS2304: Cannot find name 'U'. */ function f1(a, b) {} @@ -67,7 +77,11 @@ file.js(12,12): error TS2304: Cannot find name 'A'. * @template {string | number} [T=string] * @template U - error: Required type parameters cannot follow optional type parameters * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. * @param {U} b + ~ +!!! error TS2304: Cannot find name 'U'. */ function f2(a, b) {} @@ -75,7 +89,11 @@ file.js(12,12): error TS2304: Cannot find name 'A'. * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. * @template [U=T] * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. * @param {U} b + ~ +!!! error TS2304: Cannot find name 'U'. */ function f3(a, b) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt.diff index e6a30db455..9353dab363 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt.diff @@ -12,10 +12,16 @@ +file.js(8,12): error TS2304: Cannot find name 'A'. +file.js(10,12): error TS2304: Cannot find name 'A'. +file.js(12,12): error TS2304: Cannot find name 'A'. ++file.js(46,12): error TS2304: Cannot find name 'T'. ++file.js(47,12): error TS2304: Cannot find name 'U'. ++file.js(54,12): error TS2304: Cannot find name 'T'. ++file.js(55,12): error TS2304: Cannot find name 'U'. ++file.js(62,12): error TS2304: Cannot find name 'T'. ++file.js(63,12): error TS2304: Cannot find name 'U'. -==== file.js (7 errors) ==== -+==== file.js (4 errors) ==== ++==== file.js (10 errors) ==== /** * @template {string | number} [T=string] - ok: defaults are permitted * @typedef {[T]} A @@ -41,7 +47,7 @@ const aNumber = [0]; /** -@@= skipped -31, +34 lines =@@ +@@= skipped -31, +40 lines =@@ /** * @template {string | number} [T] - error: default requires an `=type` @@ -72,16 +78,31 @@ * @template [U=T] * @typedef {[T, U]} G */ -@@= skipped -39, +31 lines =@@ +@@= skipped -32, +24 lines =@@ + * @template T + * @template [U=T] - ok: default can reference earlier type parameter + * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @param {U} b ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + function f1(a, b) {} + /** * @template {string | number} [T=string] * @template U - error: Required type parameters cannot follow optional type parameters - ~ -!!! error TS2706: Required type parameters may not follow optional type parameters. * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. * @param {U} b ++ ~ ++!!! error TS2304: Cannot find name 'U'. */ -@@= skipped -9, +7 lines =@@ + function f2(a, b) {} /** * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. @@ -89,4 +110,11 @@ -!!! error TS2744: Type parameter defaults can only reference previously declared type parameters. * @template [U=T] * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. * @param {U} b ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + function f3(a, b) {} + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt new file mode 100644 index 0000000000..bee4d86738 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt @@ -0,0 +1,11 @@ +foo.js(1,13): error TS2749: 'Image' refers to a value, but is being used as a type here. Did you mean 'typeof Image'? + + +==== foo.js (1 errors) ==== + /** @param {Image} image */ + ~~~~~ +!!! error TS2749: 'Image' refers to a value, but is being used as a type here. Did you mean 'typeof Image'? + function process(image) { + return new image(1, 1) + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt.diff new file mode 100644 index 0000000000..9ea73f0fd7 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt.diff @@ -0,0 +1,16 @@ +--- old.jsdocTypeReferenceToValue.errors.txt ++++ new.jsdocTypeReferenceToValue.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++foo.js(1,13): error TS2749: 'Image' refers to a value, but is being used as a type here. Did you mean 'typeof Image'? ++ ++ ++==== foo.js (1 errors) ==== ++ /** @param {Image} image */ ++ ~~~~~ ++!!! error TS2749: 'Image' refers to a value, but is being used as a type here. Did you mean 'typeof Image'? ++ function process(image) { ++ return new image(1, 1) ++ } ++ diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt index 54d6efa7f4..3404f81511 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt @@ -12,6 +12,20 @@ index.ts(17,22): error TS2306: File 'mod.js' is not a module. index.ts(18,22): error TS2306: File 'mod.js' is not a module. index.ts(19,22): error TS2306: File 'mod.js' is not a module. index.ts(20,22): error TS2306: File 'mod.js' is not a module. +main.js(2,19): error TS2306: File 'mod.js' is not a module. +main.js(3,19): error TS2306: File 'mod.js' is not a module. +main.js(4,19): error TS2306: File 'mod.js' is not a module. +main.js(5,19): error TS2306: File 'mod.js' is not a module. +main.js(6,19): error TS2306: File 'mod.js' is not a module. +main.js(7,19): error TS2306: File 'mod.js' is not a module. +main.js(8,19): error TS2306: File 'mod.js' is not a module. +main.js(15,26): error TS2306: File 'mod.js' is not a module. +main.js(16,26): error TS2306: File 'mod.js' is not a module. +main.js(17,26): error TS2306: File 'mod.js' is not a module. +main.js(18,26): error TS2306: File 'mod.js' is not a module. +main.js(19,26): error TS2306: File 'mod.js' is not a module. +main.js(20,26): error TS2306: File 'mod.js' is not a module. +main.js(21,26): error TS2306: File 'mod.js' is not a module. mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -31,15 +45,29 @@ mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install typ baz() { return 5 }, literal: "", } -==== main.js (0 errors) ==== +==== main.js (14 errors) ==== /** * @param {import("./mod").Thing} a + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. * @param {import("./mod").AnotherThing} b + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. * @param {import("./mod").foo} c + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. * @param {import("./mod").qux} d + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. * @param {import("./mod").baz} e + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. * @param {import("./mod").buz} f + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. * @param {import("./mod").literal} g + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. */ function jstypes(a, b, c, d, e, f, g) { return a.x + b.y + c() + d() + e() + f() + g.length @@ -47,12 +75,26 @@ mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install typ /** * @param {typeof import("./mod").Thing} a + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. * @param {typeof import("./mod").AnotherThing} b + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. * @param {typeof import("./mod").foo} c + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. * @param {typeof import("./mod").qux} d + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. * @param {typeof import("./mod").baz} e + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. * @param {typeof import("./mod").buz} f + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. * @param {typeof import("./mod").literal} g + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. */ function jsvalues(a, b, c, d, e, f, g) { return a.length + b.length + c() + d() + e() + f() + g.length diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff index 82e12872ff..5ca6b7c131 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff @@ -23,6 +23,20 @@ +index.ts(18,22): error TS2306: File 'mod.js' is not a module. +index.ts(19,22): error TS2306: File 'mod.js' is not a module. +index.ts(20,22): error TS2306: File 'mod.js' is not a module. ++main.js(2,19): error TS2306: File 'mod.js' is not a module. ++main.js(3,19): error TS2306: File 'mod.js' is not a module. ++main.js(4,19): error TS2306: File 'mod.js' is not a module. ++main.js(5,19): error TS2306: File 'mod.js' is not a module. ++main.js(6,19): error TS2306: File 'mod.js' is not a module. ++main.js(7,19): error TS2306: File 'mod.js' is not a module. ++main.js(8,19): error TS2306: File 'mod.js' is not a module. ++main.js(15,26): error TS2306: File 'mod.js' is not a module. ++main.js(16,26): error TS2306: File 'mod.js' is not a module. ++main.js(17,26): error TS2306: File 'mod.js' is not a module. ++main.js(18,26): error TS2306: File 'mod.js' is not a module. ++main.js(19,26): error TS2306: File 'mod.js' is not a module. ++main.js(20,26): error TS2306: File 'mod.js' is not a module. ++main.js(21,26): error TS2306: File 'mod.js' is not a module. +mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -39,22 +53,63 @@ Thing, AnotherThing, foo, -@@= skipped -21, +30 lines =@@ +@@= skipped -21, +44 lines =@@ baz() { return 5 }, literal: "", } -==== main.js (1 errors) ==== -+==== main.js (0 errors) ==== ++==== main.js (14 errors) ==== /** * @param {import("./mod").Thing} a ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. * @param {import("./mod").AnotherThing} b -@@= skipped -21, +21 lines =@@ ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. + * @param {import("./mod").foo} c ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. + * @param {import("./mod").qux} d ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. + * @param {import("./mod").baz} e ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. + * @param {import("./mod").buz} f ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. + * @param {import("./mod").literal} g ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. + */ + function jstypes(a, b, c, d, e, f, g) { + return a.x + b.y + c() + d() + e() + f() + g.length +@@= skipped -16, +30 lines =@@ + + /** + * @param {typeof import("./mod").Thing} a ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. + * @param {typeof import("./mod").AnotherThing} b ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. + * @param {typeof import("./mod").foo} c ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. * @param {typeof import("./mod").qux} d ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. * @param {typeof import("./mod").baz} e ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. * @param {typeof import("./mod").buz} f - ~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'buz'. ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. * @param {typeof import("./mod").literal} g ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. */ function jsvalues(a, b, c, d, e, f, g) { return a.length + b.length + c() + d() + e() + f() + g.length diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment2.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment2.errors.txt deleted file mode 100644 index 1472224b4d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment2.errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -file1.js(9,12): error TS7006: Parameter 'type' implicitly has an 'any' type. -file1.js(9,18): error TS7006: Parameter 'ctor' implicitly has an 'any' type. -file1.js(9,24): error TS7006: Parameter 'exports' implicitly has an 'any' type. - - -==== file1.js (3 errors) ==== - // this file _should_ be a global file - var GlobalThing = { x: 12 }; - - /** - * @param {*} type - * @param {*} ctor - * @param {*} exports - */ - function f(type, ctor, exports) { - ~~~~ -!!! error TS7006: Parameter 'type' implicitly has an 'any' type. - ~~~~ -!!! error TS7006: Parameter 'ctor' implicitly has an 'any' type. - ~~~~~~~ -!!! error TS7006: Parameter 'exports' implicitly has an 'any' type. - if (typeof exports !== "undefined") { - exports["AST_" + type] = ctor; - } - } - -==== ref.js (0 errors) ==== - GlobalThing.x - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment2.errors.txt.diff deleted file mode 100644 index c114c2ddd7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment2.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.moduleExportsElementAccessAssignment2.errors.txt -+++ new.moduleExportsElementAccessAssignment2.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+file1.js(9,12): error TS7006: Parameter 'type' implicitly has an 'any' type. -+file1.js(9,18): error TS7006: Parameter 'ctor' implicitly has an 'any' type. -+file1.js(9,24): error TS7006: Parameter 'exports' implicitly has an 'any' type. -+ -+ -+==== file1.js (3 errors) ==== -+ // this file _should_ be a global file -+ var GlobalThing = { x: 12 }; -+ -+ /** -+ * @param {*} type -+ * @param {*} ctor -+ * @param {*} exports -+ */ -+ function f(type, ctor, exports) { -+ ~~~~ -+!!! error TS7006: Parameter 'type' implicitly has an 'any' type. -+ ~~~~ -+!!! error TS7006: Parameter 'ctor' implicitly has an 'any' type. -+ ~~~~~~~ -+!!! error TS7006: Parameter 'exports' implicitly has an 'any' type. -+ if (typeof exports !== "undefined") { -+ exports["AST_" + type] = ctor; -+ } -+ } -+ -+==== ref.js (0 errors) ==== -+ GlobalThing.x -+ diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt new file mode 100644 index 0000000000..c9b3fb4a96 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt @@ -0,0 +1,50 @@ +overloadTag1.js(26,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. + + +==== overloadTag1.js (1 errors) ==== + /** + * @overload + * @param {number} a + * @param {number} b + * @returns {number} + * + * @overload + * @param {string} a + * @param {boolean} b + * @returns {string} + * + * @param {string | number} a + * @param {string | number} b + * @returns {string | number} + */ + export function overloaded(a,b) { + if (typeof a === "string" && typeof b === "string") { + return a + b; + } else if (typeof a === "number" && typeof b === "number") { + return a + b; + } + throw new Error("Invalid arguments"); + } + var o1 = overloaded(1,2) + var o2 = overloaded("zero", "one") + var o3 = overloaded("a",false) + ~~~~~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. + + /** + * @overload + * @param {number} a + * @param {number} b + * @returns {number} + * + * @overload + * @param {string} a + * @param {boolean} b + * @returns {string} + */ + export function uncheckedInternally(a, b) { + return a + b; + } + uncheckedInternally(1,2) + uncheckedInternally("zero", "one") + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt.diff index ada3f5d3c0..1b93fe96e9 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt.diff @@ -1,6 +1,6 @@ --- old.overloadTag1.errors.txt +++ new.overloadTag1.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -overloadTag1.js(7,5): error TS2394: This overload signature is not compatible with its implementation signature. -overloadTag1.js(25,10): error TS2769: No overload matches this call. - Overload 1 of 2, '(a: number, b: number): number', gave the following error. @@ -12,67 +12,48 @@ - Argument of type 'string' is not assignable to parameter of type 'number'. - Overload 2 of 2, '(a: string, b: boolean): string', gave the following error. - Argument of type 'string' is not assignable to parameter of type 'boolean'. -- -- ++overloadTag1.js(26,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. + + -==== overloadTag1.js (3 errors) ==== -- /** -- * @overload -- * @param {number} a -- * @param {number} b -- * @returns {number} -- * -- * @overload ++==== overloadTag1.js (1 errors) ==== + /** + * @overload + * @param {number} a +@@= skipped -18, +8 lines =@@ + * @returns {number} + * + * @overload - ~~~~~~~~ -!!! error TS2394: This overload signature is not compatible with its implementation signature. -!!! related TS2750 overloadTag1.js:16:17: The implementation signature is declared here. -- * @param {string} a -- * @param {boolean} b -- * @returns {string} -- * -- * @param {string | number} a -- * @param {string | number} b -- * @returns {string | number} -- */ -- export function overloaded(a,b) { -- if (typeof a === "string" && typeof b === "string") { -- return a + b; -- } else if (typeof a === "number" && typeof b === "number") { -- return a + b; -- } -- throw new Error("Invalid arguments"); -- } -- var o1 = overloaded(1,2) -- var o2 = overloaded("zero", "one") + * @param {string} a + * @param {boolean} b + * @returns {string} +@@= skipped -21, +18 lines =@@ + } + var o1 = overloaded(1,2) + var o2 = overloaded("zero", "one") - ~~~~~~~~~~ -!!! error TS2769: No overload matches this call. -!!! error TS2769: Overload 1 of 2, '(a: number, b: number): number', gave the following error. -!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'number'. -!!! error TS2769: Overload 2 of 2, '(a: string, b: boolean): string', gave the following error. -!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'boolean'. -- var o3 = overloaded("a",false) -- -- /** -- * @overload -- * @param {number} a -- * @param {number} b -- * @returns {number} -- * -- * @overload -- * @param {string} a -- * @param {boolean} b -- * @returns {string} -- */ -- export function uncheckedInternally(a, b) { -- return a + b; -- } -- uncheckedInternally(1,2) -- uncheckedInternally("zero", "one") + var o3 = overloaded("a",false) ++ ~~~~~ ++!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. + + /** + * @overload +@@= skipped -24, +20 lines =@@ + } + uncheckedInternally(1,2) + uncheckedInternally("zero", "one") - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2769: No overload matches this call. -!!! error TS2769: Overload 1 of 2, '(a: number, b: number): number', gave the following error. -!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'number'. -!!! error TS2769: Overload 2 of 2, '(a: string, b: boolean): string', gave the following error. -!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'boolean'. -- -@@= skipped --1, +1 lines =@@ -+ + diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt index 3588aacd02..eb5e2e1931 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt @@ -1,11 +1,10 @@ -overloadTag2.js(25,17): error TS7006: Parameter 'a' implicitly has an 'any' type. overloadTag2.js(25,20): error TS7006: Parameter 'b' implicitly has an 'any' type. overloadTag2.js(30,9): error TS2554: Expected 2 arguments, but got 0. overloadTag2.js(31,9): error TS2554: Expected 2 arguments, but got 1. overloadTag2.js(32,9): error TS2554: Expected 2 arguments, but got 1. -==== overloadTag2.js (5 errors) ==== +==== overloadTag2.js (4 errors) ==== export class Foo { #a = true ? 1 : "1" #b @@ -31,8 +30,6 @@ overloadTag2.js(32,9): error TS2554: Expected 2 arguments, but got 1. * @param {number | string} a */ constructor(a, b) { - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. ~ !!! error TS7006: Parameter 'b' implicitly has an 'any' type. this.#a = a diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt.diff index 0941eb1298..0699fa71da 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/overloadTag2.errors.txt.diff @@ -2,7 +2,6 @@ +++ new.overloadTag2.errors.txt @@= skipped -0, +0 lines =@@ -overloadTag2.js(14,9): error TS2394: This overload signature is not compatible with its implementation signature. -+overloadTag2.js(25,17): error TS7006: Parameter 'a' implicitly has an 'any' type. overloadTag2.js(25,20): error TS7006: Parameter 'b' implicitly has an 'any' type. -overloadTag2.js(30,9): error TS2554: Expected 1-2 arguments, but got 0. +overloadTag2.js(30,9): error TS2554: Expected 2 arguments, but got 0. @@ -11,11 +10,11 @@ -==== overloadTag2.js (3 errors) ==== -+==== overloadTag2.js (5 errors) ==== ++==== overloadTag2.js (4 errors) ==== export class Foo { #a = true ? 1 : "1" #b -@@= skipped -17, +19 lines =@@ +@@= skipped -17, +18 lines =@@ /** * @constructor * @overload @@ -25,16 +24,7 @@ * @param {number} a */ /** -@@= skipped -14, +11 lines =@@ - * @param {number | string} a - */ - constructor(a, b) { -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. - ~ - !!! error TS7006: Parameter 'b' implicitly has an 'any' type. - this.#a = a -@@= skipped -8, +10 lines =@@ +@@= skipped -22, +19 lines =@@ } var a = new Foo() ~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt index 5e2695e925..bc5d4f4c38 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt @@ -1,4 +1,4 @@ -/a.js(14,9): error TS7006: Parameter 'value' implicitly has an 'any' type. +/a.js(12,16): error TS2304: Cannot find name 'T'. /a.js(17,12): error TS2315: Type 'Foo' is not generic. @@ -15,10 +15,10 @@ /** * @param {T} value + ~ +!!! error TS2304: Cannot find name 'T'. */ bar(value) { } - ~~~~~ -!!! error TS7006: Parameter 'value' implicitly has an 'any' type. } /** @type {Foo} */ diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt.diff index 7947c2582a..d917bac74a 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+/a.js(14,9): error TS7006: Parameter 'value' implicitly has an 'any' type. ++/a.js(12,16): error TS2304: Cannot find name 'T'. +/a.js(17,12): error TS2315: Type 'Foo' is not generic. + + @@ -20,10 +20,10 @@ + + /** + * @param {T} value ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + bar(value) { } -+ ~~~~~ -+!!! error TS7006: Parameter 'value' implicitly has an 'any' type. + } + + /** @type {Foo} */ diff --git a/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt b/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt index e49c5e7f6f..ebf1ebdf77 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt @@ -1,7 +1,7 @@ -a.js(6,12): error TS7006: Parameter 'p' implicitly has an 'any' type. -a.js(6,15): error TS7006: Parameter 'q' implicitly has an 'any' type. -a.js(6,18): error TS7006: Parameter 'r' implicitly has an 'any' type. +a.js(7,5): error TS2322: Type 'undefined' is not assignable to type 'number'. +a.js(11,5): error TS2322: Type 'undefined' is not assignable to type 'number'. a.js(13,1): error TS2554: Expected 3 arguments, but got 0. +a.js(14,3): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. ==== a.js (4 errors) ==== @@ -11,22 +11,22 @@ a.js(13,1): error TS2554: Expected 3 arguments, but got 0. * @param {number} [r=101] */ function f(p, q, r) { - ~ -!!! error TS7006: Parameter 'p' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'q' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'r' implicitly has an 'any' type. p = undefined + ~ +!!! error TS2322: Type 'undefined' is not assignable to type 'number'. q = undefined // note that, unlike TS, JSDOC [r=101] retains | undefined because // there's no code emitted to get rid of it. r = undefined + ~ +!!! error TS2322: Type 'undefined' is not assignable to type 'number'. } f() ~ !!! error TS2554: Expected 3 arguments, but got 0. !!! related TS6210 a.js:6:12: An argument for 'p' was not provided. f(undefined, undefined, undefined) + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. f(1, 2, 3) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt.diff index 63eb03d883..6ecd7d7846 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt.diff @@ -3,10 +3,10 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+a.js(6,12): error TS7006: Parameter 'p' implicitly has an 'any' type. -+a.js(6,15): error TS7006: Parameter 'q' implicitly has an 'any' type. -+a.js(6,18): error TS7006: Parameter 'r' implicitly has an 'any' type. ++a.js(7,5): error TS2322: Type 'undefined' is not assignable to type 'number'. ++a.js(11,5): error TS2322: Type 'undefined' is not assignable to type 'number'. +a.js(13,1): error TS2554: Expected 3 arguments, but got 0. ++a.js(14,3): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. + + +==== a.js (4 errors) ==== @@ -16,22 +16,22 @@ + * @param {number} [r=101] + */ + function f(p, q, r) { -+ ~ -+!!! error TS7006: Parameter 'p' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'q' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'r' implicitly has an 'any' type. + p = undefined ++ ~ ++!!! error TS2322: Type 'undefined' is not assignable to type 'number'. + q = undefined + // note that, unlike TS, JSDOC [r=101] retains | undefined because + // there's no code emitted to get rid of it. + r = undefined ++ ~ ++!!! error TS2322: Type 'undefined' is not assignable to type 'number'. + } + f() + ~ +!!! error TS2554: Expected 3 arguments, but got 0. +!!! related TS6210 a.js:6:12: An argument for 'p' was not provided. + f(undefined, undefined, undefined) ++ ~~~~~~~~~ ++!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. + f(1, 2, 3) + diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt new file mode 100644 index 0000000000..ff7b951d2a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt @@ -0,0 +1,22 @@ +38572.js(3,12): error TS2304: Cannot find name 'T'. +38572.js(4,25): error TS2304: Cannot find name 'T'. +38572.js(4,37): error TS2304: Cannot find name 'T'. + + +==== 38572.js (3 errors) ==== + /** + * @template T + * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. + * @param {{[K in keyof T]: (value: T[K]) => void }} b + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function f(a, b) { + } + + f({ x: 42 }, { x(param) { param.toFixed() } }); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt.diff new file mode 100644 index 0000000000..74550d5f7d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt.diff @@ -0,0 +1,27 @@ +--- old.paramTagTypeResolution2.errors.txt ++++ new.paramTagTypeResolution2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++38572.js(3,12): error TS2304: Cannot find name 'T'. ++38572.js(4,25): error TS2304: Cannot find name 'T'. ++38572.js(4,37): error TS2304: Cannot find name 'T'. ++ ++ ++==== 38572.js (3 errors) ==== ++ /** ++ * @template T ++ * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ * @param {{[K in keyof T]: (value: T[K]) => void }} b ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ function f(a, b) { ++ } ++ ++ f({ x: 42 }, { x(param) { param.toFixed() } }); ++ diff --git a/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt b/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt index a888f24270..bc43cc7750 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt @@ -1,12 +1,9 @@ bad.js(9,14): error TS7006: Parameter 'x' implicitly has an 'any' type. bad.js(9,17): error TS7006: Parameter 'y' implicitly has an 'any' type. bad.js(9,20): error TS7006: Parameter 'z' implicitly has an 'any' type. -good.js(9,15): error TS7006: Parameter 'x' implicitly has an 'any' type. -good.js(9,18): error TS7006: Parameter 'y' implicitly has an 'any' type. -good.js(9,21): error TS7006: Parameter 'z' implicitly has an 'any' type. -==== good.js (3 errors) ==== +==== good.js (0 errors) ==== /** * @param * {number} x Arg x. @@ -16,12 +13,6 @@ good.js(9,21): error TS7006: Parameter 'z' implicitly has an 'any' type. * Arg z. */ function good(x, y, z) { - ~ -!!! error TS7006: Parameter 'x' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'y' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'z' implicitly has an 'any' type. } good(1, 2, 3) diff --git a/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt.diff index a631931505..394556c036 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt.diff @@ -9,28 +9,7 @@ bad.js(9,14): error TS7006: Parameter 'x' implicitly has an 'any' type. bad.js(9,17): error TS7006: Parameter 'y' implicitly has an 'any' type. bad.js(9,20): error TS7006: Parameter 'z' implicitly has an 'any' type. -+good.js(9,15): error TS7006: Parameter 'x' implicitly has an 'any' type. -+good.js(9,18): error TS7006: Parameter 'y' implicitly has an 'any' type. -+good.js(9,21): error TS7006: Parameter 'z' implicitly has an 'any' type. - - --==== good.js (0 errors) ==== -+==== good.js (3 errors) ==== - /** - * @param - * {number} x Arg x. -@@= skipped -17, +15 lines =@@ - * Arg z. - */ - function good(x, y, z) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'y' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'z' implicitly has an 'any' type. - } - +@@= skipped -22, +17 lines =@@ good(1, 2, 3) diff --git a/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt index ccc2bc954c..e1b7ef763b 100644 --- a/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt @@ -1,12 +1,16 @@ +propertiesOfGenericConstructorFunctions.js(5,12): error TS2304: Cannot find name 'V'. propertiesOfGenericConstructorFunctions.js(14,12): error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? +propertiesOfGenericConstructorFunctions.js(31,12): error TS2304: Cannot find name 'T'. -==== propertiesOfGenericConstructorFunctions.js (1 errors) ==== +==== propertiesOfGenericConstructorFunctions.js (3 errors) ==== /** * @template {string} K * @template V * @param {string} ik * @param {V} iv + ~ +!!! error TS2304: Cannot find name 'V'. */ function Multimap(ik, iv) { /** @type {{ [s: string]: V }} */ @@ -35,6 +39,8 @@ propertiesOfGenericConstructorFunctions.js(14,12): error TS2749: 'Multimap' refe * @class * @template T * @param {T} t + ~ +!!! error TS2304: Cannot find name 'T'. */ function Cp(t) { this.x = 1 diff --git a/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff index e410109eb6..2faa77c5b5 100644 --- a/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff @@ -3,15 +3,19 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++propertiesOfGenericConstructorFunctions.js(5,12): error TS2304: Cannot find name 'V'. +propertiesOfGenericConstructorFunctions.js(14,12): error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? ++propertiesOfGenericConstructorFunctions.js(31,12): error TS2304: Cannot find name 'T'. + + -+==== propertiesOfGenericConstructorFunctions.js (1 errors) ==== ++==== propertiesOfGenericConstructorFunctions.js (3 errors) ==== + /** + * @template {string} K + * @template V + * @param {string} ik + * @param {V} iv ++ ~ ++!!! error TS2304: Cannot find name 'V'. + */ + function Multimap(ik, iv) { + /** @type {{ [s: string]: V }} */ @@ -40,6 +44,8 @@ + * @class + * @template T + * @param {T} t ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function Cp(t) { + this.x = 1 diff --git a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt index 3b7364ece6..acce525d87 100644 --- a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt @@ -1,8 +1,12 @@ bug25127.js(3,14): error TS2339: Property 'c' does not exist on type 'Entry'. bug25127.js(15,14): error TS2339: Property 'd' does not exist on type 'Group'. +bug25127.js(27,41): error TS2339: Property 'c' does not exist on type 'Entry | Group'. + Property 'c' does not exist on type 'Entry'. +bug25127.js(27,51): error TS2339: Property 'd' does not exist on type 'Entry | Group'. + Property 'd' does not exist on type 'Entry'. -==== bug25127.js (2 errors) ==== +==== bug25127.js (4 errors) ==== class Entry { constructor() { this.c = 1 @@ -34,6 +38,12 @@ bug25127.js(15,14): error TS2339: Property 'd' does not exist on type 'Group'. /** @param {Entry | Group} chunk */ function f(chunk) { let x = chunk.isInit(chunk) ? chunk.c : chunk.d + ~ +!!! error TS2339: Property 'c' does not exist on type 'Entry | Group'. +!!! error TS2339: Property 'c' does not exist on type 'Entry'. + ~ +!!! error TS2339: Property 'd' does not exist on type 'Entry | Group'. +!!! error TS2339: Property 'd' does not exist on type 'Entry'. return x } diff --git a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt.diff index 99e9a0c170..dc9eb530ec 100644 --- a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt.diff @@ -5,9 +5,13 @@ @@= skipped --1, +1 lines =@@ +bug25127.js(3,14): error TS2339: Property 'c' does not exist on type 'Entry'. +bug25127.js(15,14): error TS2339: Property 'd' does not exist on type 'Group'. ++bug25127.js(27,41): error TS2339: Property 'c' does not exist on type 'Entry | Group'. ++ Property 'c' does not exist on type 'Entry'. ++bug25127.js(27,51): error TS2339: Property 'd' does not exist on type 'Entry | Group'. ++ Property 'd' does not exist on type 'Entry'. + + -+==== bug25127.js (2 errors) ==== ++==== bug25127.js (4 errors) ==== + class Entry { + constructor() { + this.c = 1 @@ -39,6 +43,12 @@ + /** @param {Entry | Group} chunk */ + function f(chunk) { + let x = chunk.isInit(chunk) ? chunk.c : chunk.d ++ ~ ++!!! error TS2339: Property 'c' does not exist on type 'Entry | Group'. ++!!! error TS2339: Property 'c' does not exist on type 'Entry'. ++ ~ ++!!! error TS2339: Property 'd' does not exist on type 'Entry | Group'. ++!!! error TS2339: Property 'd' does not exist on type 'Entry'. + return x + } + diff --git a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols index 15303022d0..62dda0ebe8 100644 --- a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols +++ b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols @@ -44,7 +44,9 @@ function f(chunk) { let x = chunk.isInit(chunk) ? chunk.c : chunk.d >x : Symbol(x, Decl(bug25127.js, 26, 7)) +>chunk.isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) +>isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) diff --git a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols.diff b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols.diff index 954ef40c70..1d4c21c5a9 100644 --- a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols.diff @@ -36,13 +36,9 @@ >x : Symbol(x, Decl(bug25127.js, 20, 11)) return false -@@= skipped -22, +20 lines =@@ - - let x = chunk.isInit(chunk) ? chunk.c : chunk.d - >x : Symbol(x, Decl(bug25127.js, 26, 7)) -->chunk.isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) +@@= skipped -26, +24 lines =@@ >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) -->isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) + >isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) ->chunk.c : Symbol(Entry.c, Decl(bug25127.js, 1, 19)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt index 679e8990ef..f56291bbf5 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt @@ -1,7 +1,7 @@ templateInsideCallback.js(15,11): error TS2304: Cannot find name 'Call'. templateInsideCallback.js(15,16): error TS2304: Cannot find name 'T'. templateInsideCallback.js(17,18): error TS7006: Parameter 'x' implicitly has an 'any' type. -templateInsideCallback.js(47,18): error TS7006: Parameter 'array' implicitly has an 'any' type. +templateInsideCallback.js(51,44): error TS2461: Type 'unknown' is not an array type. ==== templateInsideCallback.js (4 errors) ==== @@ -58,12 +58,12 @@ templateInsideCallback.js(47,18): error TS7006: Parameter 'array' implicitly has * @returns {unknown[]} */ function flatMap(array, iterable = identity) { - ~~~~~ -!!! error TS7006: Parameter 'array' implicitly has an 'any' type. /** @type {unknown[]} */ const result = []; for (let i = 0; i < array.length; i += 1) { result.push(.../** @type {unknown[]} */(iterable(array[i]))); + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2461: Type 'unknown' is not an array type. } return result; } diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt.diff index c819993af9..d3812ab9f7 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt.diff @@ -15,7 +15,7 @@ -templateInsideCallback.js(33,16): error TS2304: Cannot find name 'T'. -templateInsideCallback.js(38,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -templateInsideCallback.js(39,12): error TS2304: Cannot find name 'T'. -+templateInsideCallback.js(47,18): error TS7006: Parameter 'array' implicitly has an 'any' type. ++templateInsideCallback.js(51,44): error TS2461: Type 'unknown' is not an array type. -!!! error TS-1: Pre-emit (11) and post-emit (13) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! @@ -89,12 +89,12 @@ * @returns {T[]} */ /** -@@= skipped -27, +17 lines =@@ - * @returns {unknown[]} - */ - function flatMap(array, iterable = identity) { -+ ~~~~~ -+!!! error TS7006: Parameter 'array' implicitly has an 'any' type. - /** @type {unknown[]} */ +@@= skipped -31, +21 lines =@@ const result = []; for (let i = 0; i < array.length; i += 1) { + result.push(.../** @type {unknown[]} */(iterable(array[i]))); ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2461: Type 'unknown' is not an array type. + } + return result; + } diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols index b387bc8c65..15ac0e4570 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols @@ -63,7 +63,9 @@ function flatMap(array, iterable = identity) { for (let i = 0; i < array.length; i += 1) { >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) +>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(templateInsideCallback.js, 46, 17)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff index 5534d73105..5e0b33b705 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff @@ -5,8 +5,10 @@ >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) ->array.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(templateInsideCallback.js, 46, 17)) ->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); diff --git a/testdata/baselines/reference/submodule/conformance/thisTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/thisTag1.errors.txt index 7614b6986c..97c3329beb 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/thisTag1.errors.txt @@ -1,15 +1,12 @@ -a.js(5,12): error TS7006: Parameter 's' implicitly has an 'any' type. a.js(6,12): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -==== a.js (2 errors) ==== +==== a.js (1 errors) ==== /** @this {{ n: number }} Mount Holyoke Preparatory School * @param {string} s * @return {number} */ function f(s) { - ~ -!!! error TS7006: Parameter 's' implicitly has an 'any' type. return this.n + s.length ~~~~ !!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. diff --git a/testdata/baselines/reference/submodule/conformance/thisTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/thisTag1.errors.txt.diff index fee1ebf83c..4138103bfc 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/thisTag1.errors.txt.diff @@ -3,18 +3,15 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+a.js(5,12): error TS7006: Parameter 's' implicitly has an 'any' type. +a.js(6,12): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + + -+==== a.js (2 errors) ==== ++==== a.js (1 errors) ==== + /** @this {{ n: number }} Mount Holyoke Preparatory School + * @param {string} s + * @return {number} + */ + function f(s) { -+ ~ -+!!! error TS7006: Parameter 's' implicitly has an 'any' type. + return this.n + s.length + ~~~~ +!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. diff --git a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols index 13f51a6f5c..123d62d3cd 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols +++ b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols @@ -10,7 +10,9 @@ function f(s) { >s : Symbol(s, Decl(a.js, 4, 11)) return this.n + s.length +>s.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(a.js, 4, 11)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) } const o = { diff --git a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff index 50e7f941ca..2c28611217 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff @@ -8,8 +8,10 @@ ->this : Symbol(this) ->n : Symbol(n, Decl(a.js, 0, 12)) ->s.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ++>s.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(a.js, 4, 11)) ->length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) } const o = { diff --git a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt index 0961be452d..a72a92450c 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt @@ -1,14 +1,18 @@ +thisTypeOfConstructorFunctions.js(4,12): error TS2304: Cannot find name 'T'. thisTypeOfConstructorFunctions.js(15,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface. +thisTypeOfConstructorFunctions.js(24,12): error TS2304: Cannot find name 'T'. thisTypeOfConstructorFunctions.js(38,12): error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? thisTypeOfConstructorFunctions.js(41,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? thisTypeOfConstructorFunctions.js(43,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? -==== thisTypeOfConstructorFunctions.js (4 errors) ==== +==== thisTypeOfConstructorFunctions.js (6 errors) ==== /** * @class * @template T * @param {T} t + ~ +!!! error TS2304: Cannot find name 'T'. */ function Cp(t) { /** @type {this} */ @@ -31,6 +35,8 @@ thisTypeOfConstructorFunctions.js(43,12): error TS2749: 'Cp' refers to a value, * @class * @template T * @param {T} t + ~ +!!! error TS2304: Cannot find name 'T'. */ function Cpp(t) { this.y = t diff --git a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff index ad89e66e54..792d116821 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff @@ -3,17 +3,21 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++thisTypeOfConstructorFunctions.js(4,12): error TS2304: Cannot find name 'T'. +thisTypeOfConstructorFunctions.js(15,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface. ++thisTypeOfConstructorFunctions.js(24,12): error TS2304: Cannot find name 'T'. +thisTypeOfConstructorFunctions.js(38,12): error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? +thisTypeOfConstructorFunctions.js(41,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? +thisTypeOfConstructorFunctions.js(43,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? + + -+==== thisTypeOfConstructorFunctions.js (4 errors) ==== ++==== thisTypeOfConstructorFunctions.js (6 errors) ==== + /** + * @class + * @template T + * @param {T} t ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function Cp(t) { + /** @type {this} */ @@ -36,6 +40,8 @@ + * @class + * @template T + * @param {T} t ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function Cpp(t) { + this.y = t diff --git a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt index acff5629e9..631f5be936 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt @@ -1,6 +1,14 @@ +a.js(3,13): error TS2749: 'A' refers to a value, but is being used as a type here. Did you mean 'typeof A'? b-ext.js(3,14): error TS2339: Property 'x' does not exist on type 'B'. +b.js(3,13): error TS2749: 'B' refers to a value, but is being used as a type here. Did you mean 'typeof B'? +c.js(3,13): error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? +d.js(3,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? e-ext.js(3,14): error TS2339: Property 'x' does not exist on type 'E'. +e.js(3,13): error TS2749: 'E' refers to a value, but is being used as a type here. Did you mean 'typeof E'? +f.js(5,13): error TS2749: 'F' refers to a value, but is being used as a type here. Did you mean 'typeof F'? +g.js(5,13): error TS2749: 'G' refers to a value, but is being used as a type here. Did you mean 'typeof G'? h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. +h.js(8,19): error TS2339: Property 'x' does not exist on type 'H'. ==== node.d.ts (0 errors) ==== @@ -12,10 +20,12 @@ h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. this.x = 1; }; -==== a.js (0 errors) ==== +==== a.js (1 errors) ==== const { A } = require("./a-ext"); /** @param {A} p */ + ~ +!!! error TS2749: 'A' refers to a value, but is being used as a type here. Did you mean 'typeof A'? function a(p) { p.x; } ==== b-ext.js (1 errors) ==== @@ -27,10 +37,12 @@ h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. } }; -==== b.js (0 errors) ==== +==== b.js (1 errors) ==== const { B } = require("./b-ext"); /** @param {B} p */ + ~ +!!! error TS2749: 'B' refers to a value, but is being used as a type here. Did you mean 'typeof B'? function b(p) { p.x; } ==== c-ext.js (0 errors) ==== @@ -38,10 +50,12 @@ h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. this.x = 1; } -==== c.js (0 errors) ==== +==== c.js (1 errors) ==== const { C } = require("./c-ext"); /** @param {C} p */ + ~ +!!! error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? function c(p) { p.x; } ==== d-ext.js (0 errors) ==== @@ -49,10 +63,12 @@ h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. this.x = 1; }; -==== d.js (0 errors) ==== +==== d.js (1 errors) ==== const { D } = require("./d-ext"); /** @param {D} p */ + ~ +!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? function d(p) { p.x; } ==== e-ext.js (1 errors) ==== @@ -64,29 +80,35 @@ h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. } } -==== e.js (0 errors) ==== +==== e.js (1 errors) ==== const { E } = require("./e-ext"); /** @param {E} p */ + ~ +!!! error TS2749: 'E' refers to a value, but is being used as a type here. Did you mean 'typeof E'? function e(p) { p.x; } -==== f.js (0 errors) ==== +==== f.js (1 errors) ==== var F = function () { this.x = 1; }; /** @param {F} p */ + ~ +!!! error TS2749: 'F' refers to a value, but is being used as a type here. Did you mean 'typeof F'? function f(p) { p.x; } -==== g.js (0 errors) ==== +==== g.js (1 errors) ==== function G() { this.x = 1; } /** @param {G} p */ + ~ +!!! error TS2749: 'G' refers to a value, but is being used as a type here. Did you mean 'typeof G'? function g(p) { p.x; } -==== h.js (1 errors) ==== +==== h.js (2 errors) ==== class H { constructor() { this.x = 1; @@ -96,4 +118,6 @@ h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. } /** @param {H} p */ - function h(p) { p.x; } \ No newline at end of file + function h(p) { p.x; } + ~ +!!! error TS2339: Property 'x' does not exist on type 'H'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt.diff index 9b8e49178a..1f35e42090 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt.diff @@ -3,9 +3,17 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++a.js(3,13): error TS2749: 'A' refers to a value, but is being used as a type here. Did you mean 'typeof A'? +b-ext.js(3,14): error TS2339: Property 'x' does not exist on type 'B'. ++b.js(3,13): error TS2749: 'B' refers to a value, but is being used as a type here. Did you mean 'typeof B'? ++c.js(3,13): error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? ++d.js(3,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? +e-ext.js(3,14): error TS2339: Property 'x' does not exist on type 'E'. ++e.js(3,13): error TS2749: 'E' refers to a value, but is being used as a type here. Did you mean 'typeof E'? ++f.js(5,13): error TS2749: 'F' refers to a value, but is being used as a type here. Did you mean 'typeof F'? ++g.js(5,13): error TS2749: 'G' refers to a value, but is being used as a type here. Did you mean 'typeof G'? +h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. ++h.js(8,19): error TS2339: Property 'x' does not exist on type 'H'. + + +==== node.d.ts (0 errors) ==== @@ -17,10 +25,12 @@ + this.x = 1; + }; + -+==== a.js (0 errors) ==== ++==== a.js (1 errors) ==== + const { A } = require("./a-ext"); + + /** @param {A} p */ ++ ~ ++!!! error TS2749: 'A' refers to a value, but is being used as a type here. Did you mean 'typeof A'? + function a(p) { p.x; } + +==== b-ext.js (1 errors) ==== @@ -32,10 +42,12 @@ + } + }; + -+==== b.js (0 errors) ==== ++==== b.js (1 errors) ==== + const { B } = require("./b-ext"); + + /** @param {B} p */ ++ ~ ++!!! error TS2749: 'B' refers to a value, but is being used as a type here. Did you mean 'typeof B'? + function b(p) { p.x; } + +==== c-ext.js (0 errors) ==== @@ -43,10 +55,12 @@ + this.x = 1; + } + -+==== c.js (0 errors) ==== ++==== c.js (1 errors) ==== + const { C } = require("./c-ext"); + + /** @param {C} p */ ++ ~ ++!!! error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? + function c(p) { p.x; } + +==== d-ext.js (0 errors) ==== @@ -54,10 +68,12 @@ + this.x = 1; + }; + -+==== d.js (0 errors) ==== ++==== d.js (1 errors) ==== + const { D } = require("./d-ext"); + + /** @param {D} p */ ++ ~ ++!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + function d(p) { p.x; } + +==== e-ext.js (1 errors) ==== @@ -69,29 +85,35 @@ + } + } + -+==== e.js (0 errors) ==== ++==== e.js (1 errors) ==== + const { E } = require("./e-ext"); + + /** @param {E} p */ ++ ~ ++!!! error TS2749: 'E' refers to a value, but is being used as a type here. Did you mean 'typeof E'? + function e(p) { p.x; } + -+==== f.js (0 errors) ==== ++==== f.js (1 errors) ==== + var F = function () { + this.x = 1; + }; + + /** @param {F} p */ ++ ~ ++!!! error TS2749: 'F' refers to a value, but is being used as a type here. Did you mean 'typeof F'? + function f(p) { p.x; } + -+==== g.js (0 errors) ==== ++==== g.js (1 errors) ==== + function G() { + this.x = 1; + } + + /** @param {G} p */ ++ ~ ++!!! error TS2749: 'G' refers to a value, but is being used as a type here. Did you mean 'typeof G'? + function g(p) { p.x; } + -+==== h.js (1 errors) ==== ++==== h.js (2 errors) ==== + class H { + constructor() { + this.x = 1; @@ -102,3 +124,5 @@ + + /** @param {H} p */ + function h(p) { p.x; } ++ ~ ++!!! error TS2339: Property 'x' does not exist on type 'H'. diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt index 08e085ad62..13dca3e156 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt @@ -1,3 +1,4 @@ +bug26877.js(1,13): error TS2503: Cannot find namespace 'Emu'. bug26877.js(4,23): error TS2339: Property 'D' does not exist on type '{}'. bug26877.js(5,19): error TS2339: Property 'D' does not exist on type '{}'. bug26877.js(7,5): error TS2339: Property 'D' does not exist on type '{}'. @@ -5,8 +6,10 @@ bug26877.js(9,14): error TS2339: Property '_model' does not exist on type 'D'. second.js(3,5): error TS2339: Property 'D' does not exist on type '{}'. -==== bug26877.js (4 errors) ==== +==== bug26877.js (5 errors) ==== /** @param {Emu.D} x */ + ~~~ +!!! error TS2503: Cannot find namespace 'Emu'. function ollKorrect(x) { x._model const y = new Emu.D() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt.diff index 128ce049a7..4a037f26e0 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt.diff @@ -3,6 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++bug26877.js(1,13): error TS2503: Cannot find namespace 'Emu'. +bug26877.js(4,23): error TS2339: Property 'D' does not exist on type '{}'. +bug26877.js(5,19): error TS2339: Property 'D' does not exist on type '{}'. +bug26877.js(7,5): error TS2339: Property 'D' does not exist on type '{}'. @@ -10,8 +11,10 @@ +second.js(3,5): error TS2339: Property 'D' does not exist on type '{}'. + + -+==== bug26877.js (4 errors) ==== ++==== bug26877.js (5 errors) ==== + /** @param {Emu.D} x */ ++ ~~~ ++!!! error TS2503: Cannot find namespace 'Emu'. + function ollKorrect(x) { + x._model + const y = new Emu.D() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt index e6753d0c88..fdeba97c97 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt @@ -1,6 +1,7 @@ a.js(1,7): error TS2339: Property 'Inner' does not exist on type '{ new(): Outer; prototype: Outer; }'. a.js(5,7): error TS2339: Property 'i' does not exist on type '{ new(): Outer; prototype: Outer; }'. b.js(1,18): error TS2339: Property 'i' does not exist on type '{ new(): Outer; prototype: Outer; }'. +b.js(3,13): error TS2702: 'Outer' only refers to a type, but is being used as a namespace here. ==== def.js (0 errors) ==== @@ -17,12 +18,14 @@ b.js(1,18): error TS2339: Property 'i' does not exist on type '{ new(): Outer; p ~ !!! error TS2339: Property 'i' does not exist on type '{ new(): Outer; prototype: Outer; }'. -==== b.js (1 errors) ==== +==== b.js (2 errors) ==== var msgs = Outer.i.messages() ~ !!! error TS2339: Property 'i' does not exist on type '{ new(): Outer; prototype: Outer; }'. /** @param {Outer.Inner} inner */ + ~~~~~ +!!! error TS2702: 'Outer' only refers to a type, but is being used as a namespace here. function x(inner) { } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt.diff index 82bdc9dc6f..f780f34b09 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt.diff @@ -6,6 +6,7 @@ +a.js(1,7): error TS2339: Property 'Inner' does not exist on type '{ new(): Outer; prototype: Outer; }'. +a.js(5,7): error TS2339: Property 'i' does not exist on type '{ new(): Outer; prototype: Outer; }'. +b.js(1,18): error TS2339: Property 'i' does not exist on type '{ new(): Outer; prototype: Outer; }'. ++b.js(3,13): error TS2702: 'Outer' only refers to a type, but is being used as a namespace here. + + +==== def.js (0 errors) ==== @@ -22,12 +23,14 @@ + ~ +!!! error TS2339: Property 'i' does not exist on type '{ new(): Outer; prototype: Outer; }'. + -+==== b.js (1 errors) ==== ++==== b.js (2 errors) ==== + var msgs = Outer.i.messages() + ~ +!!! error TS2339: Property 'i' does not exist on type '{ new(): Outer; prototype: Outer; }'. + + /** @param {Outer.Inner} inner */ ++ ~~~~~ ++!!! error TS2702: 'Outer' only refers to a type, but is being used as a namespace here. + function x(inner) { + } + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt index 06d9f8dff5..03f06755e4 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt @@ -1,11 +1,10 @@ bug26885.js(2,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -bug26885.js(10,9): error TS7006: Parameter 'key' implicitly has an 'any' type. -bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => number; }'. +bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: string) => number; }'. bug26885.js(15,12): error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? bug26885.js(16,13): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -==== bug26885.js (5 errors) ==== +==== bug26885.js (4 errors) ==== function Multimap3() { this._map = {}; ~~~~ @@ -18,11 +17,9 @@ bug26885.js(16,13): error TS7009: 'new' expression, whose target lacks a constru * @returns {number} the value ok */ get(key) { - ~~~ -!!! error TS7006: Parameter 'key' implicitly has an 'any' type. return this._map[key + '']; ~~~~ -!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => number; }'. +!!! error TS2339: Property '_map' does not exist on type '{ get: (key: string) => number; }'. } } diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt.diff index 777a15a0d2..1244d23302 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt.diff @@ -4,14 +4,13 @@ -bug26885.js(11,16): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. - No index signature with a parameter of type 'string' was found on type '{}'. +bug26885.js(2,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+bug26885.js(10,9): error TS7006: Parameter 'key' implicitly has an 'any' type. -+bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => number; }'. ++bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: string) => number; }'. +bug26885.js(15,12): error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? +bug26885.js(16,13): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -==== bug26885.js (1 errors) ==== -+==== bug26885.js (5 errors) ==== ++==== bug26885.js (4 errors) ==== function Multimap3() { this._map = {}; + ~~~~ @@ -19,18 +18,15 @@ }; Multimap3.prototype = { -@@= skipped -12, +17 lines =@@ - * @returns {number} the value ok +@@= skipped -13, +17 lines =@@ */ get(key) { -+ ~~~ -+!!! error TS7006: Parameter 'key' implicitly has an 'any' type. return this._map[key + '']; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. -!!! error TS7053: No index signature with a parameter of type 'string' was found on type '{}'. + ~~~~ -+!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => number; }'. ++!!! error TS2339: Property '_map' does not exist on type '{ get: (key: string) => number; }'. } } diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt index fa7e4dd7ee..192157c956 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt @@ -1,23 +1,23 @@ typedefOnStatements.js(26,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. typedefOnStatements.js(31,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. typedefOnStatements.js(33,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. -typedefOnStatements.js(71,17): error TS7006: Parameter 'a' implicitly has an 'any' type. -typedefOnStatements.js(71,19): error TS7006: Parameter 'b' implicitly has an 'any' type. -typedefOnStatements.js(71,21): error TS7006: Parameter 'c' implicitly has an 'any' type. -typedefOnStatements.js(71,23): error TS7006: Parameter 'd' implicitly has an 'any' type. -typedefOnStatements.js(71,25): error TS7006: Parameter 'e' implicitly has an 'any' type. -typedefOnStatements.js(71,27): error TS7006: Parameter 'f' implicitly has an 'any' type. -typedefOnStatements.js(71,29): error TS7006: Parameter 'g' implicitly has an 'any' type. -typedefOnStatements.js(71,31): error TS7006: Parameter 'h' implicitly has an 'any' type. -typedefOnStatements.js(71,33): error TS7006: Parameter 'i' implicitly has an 'any' type. -typedefOnStatements.js(71,35): error TS7006: Parameter 'j' implicitly has an 'any' type. -typedefOnStatements.js(71,37): error TS7006: Parameter 'k' implicitly has an 'any' type. -typedefOnStatements.js(71,39): error TS7006: Parameter 'l' implicitly has an 'any' type. -typedefOnStatements.js(71,41): error TS7006: Parameter 'm' implicitly has an 'any' type. -typedefOnStatements.js(71,43): error TS7006: Parameter 'n' implicitly has an 'any' type. -typedefOnStatements.js(71,45): error TS7006: Parameter 'o' implicitly has an 'any' type. -typedefOnStatements.js(71,47): error TS7006: Parameter 'p' implicitly has an 'any' type. -typedefOnStatements.js(71,49): error TS7006: Parameter 'q' implicitly has an 'any' type. +typedefOnStatements.js(53,12): error TS2304: Cannot find name 'A'. +typedefOnStatements.js(54,12): error TS2304: Cannot find name 'B'. +typedefOnStatements.js(55,12): error TS2304: Cannot find name 'C'. +typedefOnStatements.js(56,12): error TS2304: Cannot find name 'D'. +typedefOnStatements.js(57,12): error TS2304: Cannot find name 'E'. +typedefOnStatements.js(58,12): error TS2304: Cannot find name 'F'. +typedefOnStatements.js(59,12): error TS2304: Cannot find name 'G'. +typedefOnStatements.js(60,12): error TS2304: Cannot find name 'H'. +typedefOnStatements.js(61,12): error TS2304: Cannot find name 'I'. +typedefOnStatements.js(62,12): error TS2304: Cannot find name 'J'. +typedefOnStatements.js(63,12): error TS2304: Cannot find name 'K'. +typedefOnStatements.js(64,12): error TS2304: Cannot find name 'L'. +typedefOnStatements.js(65,12): error TS2304: Cannot find name 'M'. +typedefOnStatements.js(66,12): error TS2304: Cannot find name 'N'. +typedefOnStatements.js(67,12): error TS2304: Cannot find name 'O'. +typedefOnStatements.js(68,12): error TS2304: Cannot find name 'P'. +typedefOnStatements.js(69,12): error TS2304: Cannot find name 'Q'. typedefOnStatements.js(73,16): error TS2304: Cannot find name 'Alpha'. @@ -81,58 +81,58 @@ typedefOnStatements.js(73,16): error TS2304: Cannot find name 'Alpha'. /** * @param {A} a + ~ +!!! error TS2304: Cannot find name 'A'. * @param {B} b + ~ +!!! error TS2304: Cannot find name 'B'. * @param {C} c + ~ +!!! error TS2304: Cannot find name 'C'. * @param {D} d + ~ +!!! error TS2304: Cannot find name 'D'. * @param {E} e + ~ +!!! error TS2304: Cannot find name 'E'. * @param {F} f + ~ +!!! error TS2304: Cannot find name 'F'. * @param {G} g + ~ +!!! error TS2304: Cannot find name 'G'. * @param {H} h + ~ +!!! error TS2304: Cannot find name 'H'. * @param {I} i + ~ +!!! error TS2304: Cannot find name 'I'. * @param {J} j + ~ +!!! error TS2304: Cannot find name 'J'. * @param {K} k + ~ +!!! error TS2304: Cannot find name 'K'. * @param {L} l + ~ +!!! error TS2304: Cannot find name 'L'. * @param {M} m + ~ +!!! error TS2304: Cannot find name 'M'. * @param {N} n + ~ +!!! error TS2304: Cannot find name 'N'. * @param {O} o + ~ +!!! error TS2304: Cannot find name 'O'. * @param {P} p + ~ +!!! error TS2304: Cannot find name 'P'. * @param {Q} q + ~ +!!! error TS2304: Cannot find name 'Q'. */ function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'b' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'c' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'd' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'e' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'f' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'g' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'h' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'i' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'j' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'k' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'l' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'm' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'n' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'o' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'p' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'q' implicitly has an 'any' type. console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) /** @type {Alpha} */ ~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt.diff index 752f44351d..0355405c06 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt.diff @@ -5,23 +5,23 @@ typedefOnStatements.js(31,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. -typedefOnStatements.js(33,1): error TS1101: 'with' statements are not allowed in strict mode. typedefOnStatements.js(33,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. -+typedefOnStatements.js(71,17): error TS7006: Parameter 'a' implicitly has an 'any' type. -+typedefOnStatements.js(71,19): error TS7006: Parameter 'b' implicitly has an 'any' type. -+typedefOnStatements.js(71,21): error TS7006: Parameter 'c' implicitly has an 'any' type. -+typedefOnStatements.js(71,23): error TS7006: Parameter 'd' implicitly has an 'any' type. -+typedefOnStatements.js(71,25): error TS7006: Parameter 'e' implicitly has an 'any' type. -+typedefOnStatements.js(71,27): error TS7006: Parameter 'f' implicitly has an 'any' type. -+typedefOnStatements.js(71,29): error TS7006: Parameter 'g' implicitly has an 'any' type. -+typedefOnStatements.js(71,31): error TS7006: Parameter 'h' implicitly has an 'any' type. -+typedefOnStatements.js(71,33): error TS7006: Parameter 'i' implicitly has an 'any' type. -+typedefOnStatements.js(71,35): error TS7006: Parameter 'j' implicitly has an 'any' type. -+typedefOnStatements.js(71,37): error TS7006: Parameter 'k' implicitly has an 'any' type. -+typedefOnStatements.js(71,39): error TS7006: Parameter 'l' implicitly has an 'any' type. -+typedefOnStatements.js(71,41): error TS7006: Parameter 'm' implicitly has an 'any' type. -+typedefOnStatements.js(71,43): error TS7006: Parameter 'n' implicitly has an 'any' type. -+typedefOnStatements.js(71,45): error TS7006: Parameter 'o' implicitly has an 'any' type. -+typedefOnStatements.js(71,47): error TS7006: Parameter 'p' implicitly has an 'any' type. -+typedefOnStatements.js(71,49): error TS7006: Parameter 'q' implicitly has an 'any' type. ++typedefOnStatements.js(53,12): error TS2304: Cannot find name 'A'. ++typedefOnStatements.js(54,12): error TS2304: Cannot find name 'B'. ++typedefOnStatements.js(55,12): error TS2304: Cannot find name 'C'. ++typedefOnStatements.js(56,12): error TS2304: Cannot find name 'D'. ++typedefOnStatements.js(57,12): error TS2304: Cannot find name 'E'. ++typedefOnStatements.js(58,12): error TS2304: Cannot find name 'F'. ++typedefOnStatements.js(59,12): error TS2304: Cannot find name 'G'. ++typedefOnStatements.js(60,12): error TS2304: Cannot find name 'H'. ++typedefOnStatements.js(61,12): error TS2304: Cannot find name 'I'. ++typedefOnStatements.js(62,12): error TS2304: Cannot find name 'J'. ++typedefOnStatements.js(63,12): error TS2304: Cannot find name 'K'. ++typedefOnStatements.js(64,12): error TS2304: Cannot find name 'L'. ++typedefOnStatements.js(65,12): error TS2304: Cannot find name 'M'. ++typedefOnStatements.js(66,12): error TS2304: Cannot find name 'N'. ++typedefOnStatements.js(67,12): error TS2304: Cannot find name 'O'. ++typedefOnStatements.js(68,12): error TS2304: Cannot find name 'P'. ++typedefOnStatements.js(69,12): error TS2304: Cannot find name 'Q'. +typedefOnStatements.js(73,16): error TS2304: Cannot find name 'Alpha'. @@ -39,44 +39,62 @@ ~~~~~~~~~~~ !!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. } -@@= skipped -42, +40 lines =@@ +@@= skipped -24, +22 lines =@@ + + /** + * @param {A} a ++ ~ ++!!! error TS2304: Cannot find name 'A'. + * @param {B} b ++ ~ ++!!! error TS2304: Cannot find name 'B'. + * @param {C} c ++ ~ ++!!! error TS2304: Cannot find name 'C'. + * @param {D} d ++ ~ ++!!! error TS2304: Cannot find name 'D'. + * @param {E} e ++ ~ ++!!! error TS2304: Cannot find name 'E'. + * @param {F} f ++ ~ ++!!! error TS2304: Cannot find name 'F'. + * @param {G} g ++ ~ ++!!! error TS2304: Cannot find name 'G'. + * @param {H} h ++ ~ ++!!! error TS2304: Cannot find name 'H'. + * @param {I} i ++ ~ ++!!! error TS2304: Cannot find name 'I'. + * @param {J} j ++ ~ ++!!! error TS2304: Cannot find name 'J'. + * @param {K} k ++ ~ ++!!! error TS2304: Cannot find name 'K'. + * @param {L} l ++ ~ ++!!! error TS2304: Cannot find name 'L'. + * @param {M} m ++ ~ ++!!! error TS2304: Cannot find name 'M'. + * @param {N} n ++ ~ ++!!! error TS2304: Cannot find name 'N'. + * @param {O} o ++ ~ ++!!! error TS2304: Cannot find name 'O'. + * @param {P} p ++ ~ ++!!! error TS2304: Cannot find name 'P'. * @param {Q} q ++ ~ ++!!! error TS2304: Cannot find name 'Q'. */ function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'c' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'd' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'e' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'f' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'g' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'h' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'i' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'j' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'k' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'l' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'm' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'n' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'o' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'p' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'q' implicitly has an 'any' type. console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) /** @type {Alpha} */ + ~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt index 7bc19b1ced..2c0ea264b2 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt @@ -1,14 +1,18 @@ +github20832.js(5,12): error TS2304: Cannot find name 'U'. github20832.js(6,13): error TS2304: Cannot find name 'T'. github20832.js(12,11): error TS2304: Cannot find name 'T'. +github20832.js(21,12): error TS2304: Cannot find name 'V'. github20832.js(26,12): error TS2304: Cannot find name 'Cb'. -==== github20832.js (3 errors) ==== +==== github20832.js (5 errors) ==== // #20832 /** @typedef {U} T - should be "error, can't find type named 'U' */ /** * @template U * @param {U} x + ~ +!!! error TS2304: Cannot find name 'U'. * @return {T} ~ !!! error TS2304: Cannot find name 'T'. @@ -29,6 +33,8 @@ github20832.js(26,12): error TS2304: Cannot find name 'Cb'. /** * @template V * @param {V} vvvvv + ~ +!!! error TS2304: Cannot find name 'V'. */ function g(vvvvv) { } diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt.diff index 714b7f1060..4078d8fc97 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt.diff @@ -3,13 +3,15 @@ @@= skipped -0, +0 lines =@@ -github20832.js(2,15): error TS2304: Cannot find name 'U'. -github20832.js(17,12): error TS2304: Cannot find name 'V'. ++github20832.js(5,12): error TS2304: Cannot find name 'U'. +github20832.js(6,13): error TS2304: Cannot find name 'T'. +github20832.js(12,11): error TS2304: Cannot find name 'T'. ++github20832.js(21,12): error TS2304: Cannot find name 'V'. +github20832.js(26,12): error TS2304: Cannot find name 'Cb'. -==== github20832.js (2 errors) ==== -+==== github20832.js (3 errors) ==== ++==== github20832.js (5 errors) ==== // #20832 /** @typedef {U} T - should be "error, can't find type named 'U' */ - ~ @@ -17,6 +19,8 @@ /** * @template U * @param {U} x ++ ~ ++!!! error TS2304: Cannot find name 'U'. * @return {T} + ~ +!!! error TS2304: Cannot find name 'T'. @@ -38,7 +42,11 @@ */ /** * @template V -@@= skipped -32, +33 lines =@@ + * @param {V} vvvvv ++ ~ ++!!! error TS2304: Cannot find name 'V'. + */ + function g(vvvvv) { } /** @type {Cb} */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt new file mode 100644 index 0000000000..9b800efef5 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt @@ -0,0 +1,148 @@ +mod1.js(9,12): error TS2304: Cannot find name 'Type1'. +mod2.js(11,12): error TS2304: Cannot find name 'Type2'. +mod3.js(10,12): error TS2304: Cannot find name 'StringOrNumber1'. +mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. +mod5.js(14,12): error TS2304: Cannot find name 'Type5'. +mod6.js(12,12): error TS2304: Cannot find name 'Type6'. + + +==== mod1.js (1 errors) ==== + /** + * @typedef {function(string): boolean} + * Type1 + */ + + /** + * Tries to use a type whose name is on a different + * line than the typedef tag. + * @param {Type1} func The function to call. + ~~~~~ +!!! error TS2304: Cannot find name 'Type1'. + * @param {string} arg The argument to call it with. + * @returns {boolean} The return. + */ + function callIt(func, arg) { + return func(arg); + } + +==== mod2.js (1 errors) ==== + /** + * @typedef {{ + * num: number, + * str: string, + * boo: boolean + * }} Type2 + */ + + /** + * Makes use of a type with a multiline type expression. + * @param {Type2} obj The object. + ~~~~~ +!!! error TS2304: Cannot find name 'Type2'. + * @returns {string|number} The return. + */ + function check(obj) { + return obj.boo ? obj.num : obj.str; + } + +==== mod3.js (1 errors) ==== + /** + * A function whose signature is very long. + * + * @typedef {function(boolean, string, number): + * (string|number)} StringOrNumber1 + */ + + /** + * Makes use of a function type with a long signature. + * @param {StringOrNumber1} func The function. + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'StringOrNumber1'. + * @param {boolean} bool The condition. + * @param {string} str The string. + * @param {number} num The number. + * @returns {string|number} The return. + */ + function use1(func, bool, str, num) { + return func(bool, str, num) + } + +==== mod4.js (1 errors) ==== + /** + * A function whose signature is very long. + * + * @typedef {function(boolean, string, + * number): + * (string|number)} StringOrNumber2 + */ + + /** + * Makes use of a function type with a long signature. + * @param {StringOrNumber2} func The function. + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'StringOrNumber2'. + * @param {boolean} bool The condition. + * @param {string} str The string. + * @param {number} num The number. + * @returns {string|number} The return. + */ + function use2(func, bool, str, num) { + return func(bool, str, num) + } + +==== mod5.js (1 errors) ==== + /** + * @typedef {{ + * num: + * number, + * str: + * string, + * boo: + * boolean + * }} Type5 + */ + + /** + * Makes use of a type with a multiline type expression. + * @param {Type5} obj The object. + ~~~~~ +!!! error TS2304: Cannot find name 'Type5'. + * @returns {string|number} The return. + */ + function check5(obj) { + return obj.boo ? obj.num : obj.str; + } + +==== mod6.js (1 errors) ==== + /** + * @typedef {{ + * foo: + * *, + * bar: + * * + * }} Type6 + */ + + /** + * Makes use of a type with a multiline type expression. + * @param {Type6} obj The object. + ~~~~~ +!!! error TS2304: Cannot find name 'Type6'. + * @returns {*} The return. + */ + function check6(obj) { + return obj.foo; + } + + +==== mod7.js (0 errors) ==== + /** + Multiline type expressions in comments without leading * are not supported. + @typedef {{ + foo: + *, + bar: + * + }} Type7 + */ + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt.diff index 128f3065bf..c76ce01fcb 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt.diff @@ -1,141 +1,135 @@ --- old.typedefTagWrapping.errors.txt +++ new.typedefTagWrapping.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -mod7.js(5,7): error TS1110: Type expected. -mod7.js(8,4): error TS1110: Type expected. -- -- ++mod1.js(9,12): error TS2304: Cannot find name 'Type1'. ++mod2.js(11,12): error TS2304: Cannot find name 'Type2'. ++mod3.js(10,12): error TS2304: Cannot find name 'StringOrNumber1'. ++mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. ++mod5.js(14,12): error TS2304: Cannot find name 'Type5'. ++mod6.js(12,12): error TS2304: Cannot find name 'Type6'. + + -==== mod1.js (0 errors) ==== -- /** -- * @typedef {function(string): boolean} -- * Type1 -- */ -- -- /** -- * Tries to use a type whose name is on a different -- * line than the typedef tag. -- * @param {Type1} func The function to call. -- * @param {string} arg The argument to call it with. -- * @returns {boolean} The return. -- */ -- function callIt(func, arg) { -- return func(arg); -- } -- ++==== mod1.js (1 errors) ==== + /** + * @typedef {function(string): boolean} + * Type1 +@@= skipped -11, +15 lines =@@ + * Tries to use a type whose name is on a different + * line than the typedef tag. + * @param {Type1} func The function to call. ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Type1'. + * @param {string} arg The argument to call it with. + * @returns {boolean} The return. + */ +@@= skipped -7, +9 lines =@@ + return func(arg); + } + -==== mod2.js (0 errors) ==== -- /** -- * @typedef {{ -- * num: number, -- * str: string, -- * boo: boolean -- * }} Type2 -- */ -- -- /** -- * Makes use of a type with a multiline type expression. -- * @param {Type2} obj The object. -- * @returns {string|number} The return. -- */ -- function check(obj) { -- return obj.boo ? obj.num : obj.str; -- } -- ++==== mod2.js (1 errors) ==== + /** + * @typedef {{ + * num: number, +@@= skipped -12, +12 lines =@@ + /** + * Makes use of a type with a multiline type expression. + * @param {Type2} obj The object. ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Type2'. + * @returns {string|number} The return. + */ + function check(obj) { + return obj.boo ? obj.num : obj.str; + } + -==== mod3.js (0 errors) ==== -- /** -- * A function whose signature is very long. -- * -- * @typedef {function(boolean, string, number): -- * (string|number)} StringOrNumber1 -- */ -- -- /** -- * Makes use of a function type with a long signature. -- * @param {StringOrNumber1} func The function. -- * @param {boolean} bool The condition. -- * @param {string} str The string. -- * @param {number} num The number. -- * @returns {string|number} The return. -- */ -- function use1(func, bool, str, num) { -- return func(bool, str, num) -- } -- ++==== mod3.js (1 errors) ==== + /** + * A function whose signature is very long. + * +@@= skipped -17, +19 lines =@@ + /** + * Makes use of a function type with a long signature. + * @param {StringOrNumber1} func The function. ++ ~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'StringOrNumber1'. + * @param {boolean} bool The condition. + * @param {string} str The string. + * @param {number} num The number. +@@= skipped -9, +11 lines =@@ + return func(bool, str, num) + } + -==== mod4.js (0 errors) ==== -- /** -- * A function whose signature is very long. -- * -- * @typedef {function(boolean, string, -- * number): -- * (string|number)} StringOrNumber2 -- */ -- -- /** -- * Makes use of a function type with a long signature. -- * @param {StringOrNumber2} func The function. -- * @param {boolean} bool The condition. -- * @param {string} str The string. -- * @param {number} num The number. -- * @returns {string|number} The return. -- */ -- function use2(func, bool, str, num) { -- return func(bool, str, num) -- } -- ++==== mod4.js (1 errors) ==== + /** + * A function whose signature is very long. + * +@@= skipped -12, +12 lines =@@ + /** + * Makes use of a function type with a long signature. + * @param {StringOrNumber2} func The function. ++ ~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'StringOrNumber2'. + * @param {boolean} bool The condition. + * @param {string} str The string. + * @param {number} num The number. +@@= skipped -9, +11 lines =@@ + return func(bool, str, num) + } + -==== mod5.js (0 errors) ==== -- /** -- * @typedef {{ -- * num: -- * number, -- * str: -- * string, -- * boo: -- * boolean -- * }} Type5 -- */ -- -- /** -- * Makes use of a type with a multiline type expression. -- * @param {Type5} obj The object. -- * @returns {string|number} The return. -- */ -- function check5(obj) { -- return obj.boo ? obj.num : obj.str; -- } -- ++==== mod5.js (1 errors) ==== + /** + * @typedef {{ + * num: +@@= skipped -15, +15 lines =@@ + /** + * Makes use of a type with a multiline type expression. + * @param {Type5} obj The object. ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Type5'. + * @returns {string|number} The return. + */ + function check5(obj) { + return obj.boo ? obj.num : obj.str; + } + -==== mod6.js (0 errors) ==== -- /** -- * @typedef {{ -- * foo: -- * *, -- * bar: -- * * -- * }} Type6 -- */ -- -- /** -- * Makes use of a type with a multiline type expression. -- * @param {Type6} obj The object. -- * @returns {*} The return. -- */ -- function check6(obj) { -- return obj.foo; -- } -- -- ++==== mod6.js (1 errors) ==== + /** + * @typedef {{ + * foo: +@@= skipped -19, +21 lines =@@ + /** + * Makes use of a type with a multiline type expression. + * @param {Type6} obj The object. ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Type6'. + * @returns {*} The return. + */ + function check6(obj) { +@@= skipped -7, +9 lines =@@ + } + + -==== mod7.js (2 errors) ==== -- /** -- Multiline type expressions in comments without leading * are not supported. -- @typedef {{ -- foo: -- *, ++==== mod7.js (0 errors) ==== + /** + Multiline type expressions in comments without leading * are not supported. + @typedef {{ + foo: + *, - ~ -!!! error TS1110: Type expected. -- bar: -- * -- }} Type7 + bar: + * + }} Type7 - ~ -!!! error TS1110: Type expected. -- */ -- -@@= skipped --1, +1 lines =@@ -+ + */ + diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt index f9cda79166..d8c96807f4 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt @@ -1,5 +1,5 @@ use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -use.js(12,12): error TS7006: Parameter 'wrap' implicitly has an 'any' type. +use.js(10,12): error TS2503: Cannot find namespace 'ex'. ==== use.js (2 errors) ==== @@ -15,10 +15,10 @@ use.js(12,12): error TS7006: Parameter 'wrap' implicitly has an 'any' type. // types work /** * @param {ex.Crunch} wrap + ~~ +!!! error TS2503: Cannot find namespace 'ex'. */ function f(wrap) { - ~~~~ -!!! error TS7006: Parameter 'wrap' implicitly has an 'any' type. wrap.n } diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt.diff index d51bf398ed..69e845ec0f 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt.diff @@ -4,7 +4,7 @@ - @@= skipped --1, +1 lines =@@ +use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+use.js(12,12): error TS7006: Parameter 'wrap' implicitly has an 'any' type. ++use.js(10,12): error TS2503: Cannot find namespace 'ex'. + + +==== use.js (2 errors) ==== @@ -20,10 +20,10 @@ + // types work + /** + * @param {ex.Crunch} wrap ++ ~~ ++!!! error TS2503: Cannot find namespace 'ex'. + */ + function f(wrap) { -+ ~~~~ -+!!! error TS7006: Parameter 'wrap' implicitly has an 'any' type. + wrap.n + } + diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt b/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt index 81d62d2302..f53556abb1 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt @@ -1,6 +1,6 @@ use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -use.js(13,12): error TS7006: Parameter 'greatest' implicitly has an 'any' type. -use.js(13,22): error TS7006: Parameter 'wrap' implicitly has an 'any' type. +use.js(10,12): error TS2503: Cannot find namespace 'ex'. +use.js(11,12): error TS2503: Cannot find namespace 'ex'. ==== use.js (3 errors) ==== @@ -16,13 +16,13 @@ use.js(13,22): error TS7006: Parameter 'wrap' implicitly has an 'any' type. // types work /** * @param {ex.Greatest} greatest + ~~ +!!! error TS2503: Cannot find namespace 'ex'. * @param {ex.Crunch} wrap + ~~ +!!! error TS2503: Cannot find namespace 'ex'. */ function f(greatest, wrap) { - ~~~~~~~~ -!!! error TS7006: Parameter 'greatest' implicitly has an 'any' type. - ~~~~ -!!! error TS7006: Parameter 'wrap' implicitly has an 'any' type. greatest.day wrap.n } diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt.diff index 45e3dbced7..26a8cc3d72 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt.diff @@ -4,8 +4,8 @@ - @@= skipped --1, +1 lines =@@ +use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+use.js(13,12): error TS7006: Parameter 'greatest' implicitly has an 'any' type. -+use.js(13,22): error TS7006: Parameter 'wrap' implicitly has an 'any' type. ++use.js(10,12): error TS2503: Cannot find namespace 'ex'. ++use.js(11,12): error TS2503: Cannot find namespace 'ex'. + + +==== use.js (3 errors) ==== @@ -21,13 +21,13 @@ + // types work + /** + * @param {ex.Greatest} greatest ++ ~~ ++!!! error TS2503: Cannot find namespace 'ex'. + * @param {ex.Crunch} wrap ++ ~~ ++!!! error TS2503: Cannot find namespace 'ex'. + */ + function f(greatest, wrap) { -+ ~~~~~~~~ -+!!! error TS7006: Parameter 'greatest' implicitly has an 'any' type. -+ ~~~~ -+!!! error TS7006: Parameter 'wrap' implicitly has an 'any' type. + greatest.day + wrap.n + } From b6e920b92b29aa6cb297b0357f4406a9a7076656 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 13 Mar 2025 08:04:02 -0700 Subject: [PATCH 05/25] Completely unfinished typedef, need to push to sync to laptop It builds! But panics on tests! --- internal/ast/ast.go | 51 +++++++++++++++++++++++++ internal/ast/kind.go | 1 + internal/ast/kind_stringer_generated.go | 15 ++++---- internal/parser/jsdoc.go | 15 +++++++- internal/parser/parser.go | 8 +++- 5 files changed, 81 insertions(+), 9 deletions(-) diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 58b3ae5b69..6dc6382f26 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -394,6 +394,8 @@ func (n *Node) TypeParameterList() *NodeList { return n.AsInterfaceDeclaration().TypeParameters case KindTypeAliasDeclaration: return n.AsTypeAliasDeclaration().TypeParameters + case KindJSTypeAliasDeclaration: + return n.AsJSTypeAliasDeclaration().TypeParameters default: funcLike := n.FunctionLikeData() if funcLike != nil { @@ -479,6 +481,8 @@ func (n *Node) Type() *Node { return n.AsSatisfiesExpression().Type case KindTypeAliasDeclaration: return n.AsTypeAliasDeclaration().Type + case KindJSTypeAliasDeclaration: + return n.AsJSTypeAliasDeclaration().Type case KindNamedTupleMember: return n.AsNamedTupleMember().Type case KindOptionalType: @@ -1056,6 +1060,10 @@ func (n *Node) AsTypeAliasDeclaration() *TypeAliasDeclaration { return n.data.(*TypeAliasDeclaration) } +func (n *Node) AsJSTypeAliasDeclaration() *JSTypeAliasDeclaration { + return n.data.(*JSTypeAliasDeclaration) +} + func (n *Node) AsJsxAttribute() *JsxAttribute { return n.data.(*JsxAttribute) } @@ -3274,6 +3282,49 @@ func IsTypeAliasDeclaration(node *Node) bool { return node.Kind == KindTypeAliasDeclaration } +type JSTypeAliasDeclaration struct { + StatementBase + DeclarationBase + ExportableBase + ModifiersBase + LocalsContainerBase + name *IdentifierNode // IdentifierNode + TypeParameters *NodeList // NodeList[*TypeParameterDeclarationNode]. Optional + Type *TypeNode // TypeNode +} + +func (f *NodeFactory) NewJSTypeAliasDeclaration(modifiers *ModifierList, name *IdentifierNode, typeParameters *NodeList, typeNode *TypeNode) *Node { + data := &JSTypeAliasDeclaration{} + data.modifiers = modifiers + data.name = name + data.TypeParameters = typeParameters + data.Type = typeNode + return newNode(KindJSTypeAliasDeclaration, data, f.hooks) +} + +func (f *NodeFactory) UpdateJSTypeAliasDeclaration(node *JSTypeAliasDeclaration, modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, typeNode *TypeNode) *Node { + if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || typeNode != node.Type { + return updateNode(f.NewJSTypeAliasDeclaration(modifiers, name, typeParameters, typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSTypeAliasDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visitNodeList(v, node.TypeParameters) || visit(v, node.Type) +} + +func (node *JSTypeAliasDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSTypeAliasDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitNode(node.Type)) +} + +func (node *JSTypeAliasDeclaration) Clone(f *NodeFactory) *Node { + return cloneNode(f.NewJSTypeAliasDeclaration(node.Modifiers(), node.Name(), node.TypeParameters, node.Type), node.AsNode(), f.hooks) +} +func (node *JSTypeAliasDeclaration) Name() *DeclarationName { return node.name } +func IsJSTypeAliasDeclaration(node *Node) bool { + return node.Kind == KindJSTypeAliasDeclaration +} + // EnumMember type EnumMember struct { diff --git a/internal/ast/kind.go b/internal/ast/kind.go index 34de8e1ba6..097b43f286 100644 --- a/internal/ast/kind.go +++ b/internal/ast/kind.go @@ -379,6 +379,7 @@ const ( KindSyntaxList // Synthesized JS nodes KindJSTypeExpression + KindJSTypeAliasDeclaration // Transformation nodes KindNotEmittedStatement KindPartiallyEmittedExpression diff --git a/internal/ast/kind_stringer_generated.go b/internal/ast/kind_stringer_generated.go index 3b80a4afe5..8bc7fc9b37 100644 --- a/internal/ast/kind_stringer_generated.go +++ b/internal/ast/kind_stringer_generated.go @@ -354,16 +354,17 @@ func _() { _ = x[KindJSDocImportTag-343] _ = x[KindSyntaxList-344] _ = x[KindJSTypeExpression-345] - _ = x[KindNotEmittedStatement-346] - _ = x[KindPartiallyEmittedExpression-347] - _ = x[KindCommaListExpression-348] - _ = x[KindSyntheticReferenceExpression-349] - _ = x[KindCount-350] + _ = x[KindJSTypeAliasDeclaration-346] + _ = x[KindNotEmittedStatement-347] + _ = x[KindPartiallyEmittedExpression-348] + _ = x[KindCommaListExpression-349] + _ = x[KindSyntheticReferenceExpression-350] + _ = x[KindCount-351] } -const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindBundleKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocMemberNameKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeExpressionKindNotEmittedStatementKindPartiallyEmittedExpressionKindCommaListExpressionKindSyntheticReferenceExpressionKindCount" +const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindBundleKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocMemberNameKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeExpressionKindJSTypeAliasDeclarationKindNotEmittedStatementKindPartiallyEmittedExpressionKindCommaListExpressionKindSyntheticReferenceExpressionKindCount" -var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3141, 3165, 3182, 3195, 3208, 3229, 3252, 3271, 3292, 3323, 3338, 3353, 3368, 3385, 3407, 3425, 3442, 3459, 3475, 3494, 3507, 3522, 3535, 3548, 3564, 3576, 3589, 3609, 3628, 3641, 3662, 3674, 3690, 3711, 3725, 3740, 3760, 3783, 3810, 3824, 3848, 3871, 3889, 3915, 3942, 3970, 3997, 4015, 4032, 4060, 4087, 4114, 4136, 4153, 4173, 4193, 4211, 4230, 4255, 4281, 4301, 4326, 4348, 4367, 4384, 4403, 4424, 4455, 4471, 4492, 4508, 4531, 4554, 4570, 4595, 4604, 4622, 4643, 4666, 4681, 4696, 4714, 4730, 4748, 4766, 4787, 4805, 4824, 4841, 4860, 4880, 4898, 4914, 4935, 4958, 4985, 5008, 5028, 5052, 5076, 5095, 5116, 5131, 5144, 5174, 5201, 5222, 5238, 5257, 5273, 5292, 5312, 5333, 5349, 5368, 5387, 5409, 5436, 5450, 5475, 5496, 5517, 5532, 5554, 5576, 5592, 5609, 5631, 5648, 5669, 5683, 5700, 5718, 5733, 5753, 5772, 5794, 5825, 5845, 5859, 5873, 5883, 5906, 5928, 5947, 5963, 5984, 6008, 6029, 6050, 6059, 6072, 6092, 6110, 6123, 6140, 6158, 6170, 6190, 6212, 6234, 6252, 6271, 6292, 6312, 6332, 6352, 6372, 6393, 6411, 6427, 6443, 6463, 6482, 6497, 6517, 6538, 6556, 6570, 6590, 6613, 6643, 6666, 6698, 6707} +var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3141, 3165, 3182, 3195, 3208, 3229, 3252, 3271, 3292, 3323, 3338, 3353, 3368, 3385, 3407, 3425, 3442, 3459, 3475, 3494, 3507, 3522, 3535, 3548, 3564, 3576, 3589, 3609, 3628, 3641, 3662, 3674, 3690, 3711, 3725, 3740, 3760, 3783, 3810, 3824, 3848, 3871, 3889, 3915, 3942, 3970, 3997, 4015, 4032, 4060, 4087, 4114, 4136, 4153, 4173, 4193, 4211, 4230, 4255, 4281, 4301, 4326, 4348, 4367, 4384, 4403, 4424, 4455, 4471, 4492, 4508, 4531, 4554, 4570, 4595, 4604, 4622, 4643, 4666, 4681, 4696, 4714, 4730, 4748, 4766, 4787, 4805, 4824, 4841, 4860, 4880, 4898, 4914, 4935, 4958, 4985, 5008, 5028, 5052, 5076, 5095, 5116, 5131, 5144, 5174, 5201, 5222, 5238, 5257, 5273, 5292, 5312, 5333, 5349, 5368, 5387, 5409, 5436, 5450, 5475, 5496, 5517, 5532, 5554, 5576, 5592, 5609, 5631, 5648, 5669, 5683, 5700, 5718, 5733, 5753, 5772, 5794, 5825, 5845, 5859, 5873, 5883, 5906, 5928, 5947, 5963, 5984, 6008, 6029, 6050, 6059, 6072, 6092, 6110, 6123, 6140, 6158, 6170, 6190, 6212, 6234, 6252, 6271, 6292, 6312, 6332, 6352, 6372, 6393, 6411, 6427, 6443, 6463, 6482, 6497, 6517, 6538, 6556, 6570, 6590, 6616, 6639, 6669, 6692, 6724, 6733} func (i Kind) String() string { if i < 0 || i >= Kind(len(_Kind_index)-1) { diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index f90e31cfe1..dba36c49a4 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -100,12 +100,25 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { continue } for _, tag := range j.AsJSDoc().Tags.Nodes { + switch tag.Kind { + case ast.KindJSDocTypedefTag: + // TODO: Maybe save an Original pointer + // TODO: Look for neighbouring template tags to fill in typeparameters + // TODO: Figure out the mechanism for putting statements into a container node list + export := p.factory.NewModifier(ast.KindExportKeyword) + export.Loc = core.NewTextRange(p.nodePos(), p.nodePos()) + export.Flags = ast.NodeFlagsSynthesized + nodes := p.nodeSlicePool.NewSlice(1) + nodes[0] = export + modifiers := p.newModifierList(export.Loc, nodes) + jstype := p.factory.NewJSTypeAliasDeclaration(modifiers, tag.AsJSDocTypedefTag().Name(), nil /*typeParameters*/, tag.AsJSDocTypedefTag().TypeExpression) + p.reparseList = append(p.reparseList, jstype) + } if !isLast { // TODO: @overload and unattached tags support goes here continue } switch tag.Kind { - // TODO: All/most of these need to apply to param/return et amici as well case ast.KindJSDocTypeTag: if host.Kind == ast.KindVariableStatement && host.AsVariableStatement().DeclarationList != nil { // TODO: Could still clone the node and mark it synthetic diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 977305a150..db1946ccef 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -75,6 +75,7 @@ type Parser struct { jsdocCommentsSpace []string jsdocCommentRangesSpace []ast.CommentRange jsdocTagCommentsSpace []string + reparseList []*ast.Node } var parserPool = sync.Pool{ @@ -441,7 +442,12 @@ func (p *Parser) parseListIndex(kind ParsingContext, parseElement func(p *Parser list := make([]*ast.Node, 0, 16) for i := 0; !p.isListTerminator(kind); i++ { if p.isListElement(kind, false /*inErrorRecovery*/) { - list = append(list, parseElement(p, i)) + elt := parseElement(p, i) + if len(p.reparseList) > 0 { + list = append(list, p.reparseList...) + p.reparseList = nil + } + list = append(list, elt) continue } if p.abortParsingListOrMoveToNextToken(kind) { From 24efd00f6d98a38ab94444b589e1628e0ef0e766 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 14 Mar 2025 09:43:55 -0700 Subject: [PATCH 06/25] finish adding @typedef --- internal/ast/ast.go | 7 + internal/ast/utilities.go | 4 +- internal/binder/binder.go | 12 +- internal/binder/nameresolver.go | 2 +- internal/checker/checker.go | 31 ++- internal/checker/flow.go | 1 + internal/checker/grammarchecks.go | 5 +- internal/checker/utilities.go | 10 +- internal/printer/printer.go | 18 ++ internal/printer/utilities.go | 2 + .../tsbaseline/type_symbol_baseline.go | 2 +- .../checkJsTypeDefNoUnusedLocalMarked.symbols | 2 + ...kJsTypeDefNoUnusedLocalMarked.symbols.diff | 6 +- ...allyTypedParametersOptionalInJSDoc.symbols | 3 + ...ypedParametersOptionalInJSDoc.symbols.diff | 12 ++ ...lyInferenceFromAnnotatedFunctionJs.symbols | 11 ++ ...erenceFromAnnotatedFunctionJs.symbols.diff | 20 ++ .../expandoFunctionContextualTypesJs.symbols | 4 + ...andoFunctionContextualTypesJs.symbols.diff | 17 +- ...DeclarationEmitDoesNotRenameImport.symbols | 2 + ...rationEmitDoesNotRenameImport.symbols.diff | 11 +- ...sNotUseNodeModulesPathWithoutError.symbols | 2 + ...seNodeModulesPathWithoutError.symbols.diff | 9 +- .../compiler/jsEnumCrossFileExport.errors.txt | 6 +- .../jsEnumCrossFileExport.errors.txt.diff | 6 +- .../compiler/jsEnumCrossFileExport.symbols | 1 - .../jsEnumCrossFileExport.symbols.diff | 1 - .../jsdocImportTypeResolution.symbols | 2 + .../jsdocImportTypeResolution.symbols.diff | 11 ++ .../compiler/jsdocPropertyTagInvalid.symbols | 2 + .../jsdocPropertyTagInvalid.symbols.diff | 11 ++ .../misspelledJsDocTypedefTags.symbols | 7 + .../misspelledJsDocTypedefTags.symbols.diff | 10 +- .../strictOptionalProperties3.symbols | 2 + .../strictOptionalProperties3.symbols.diff | 11 ++ ...metTypeConstraintInJSDocImportCall.symbols | 4 +- ...peConstraintInJSDocImportCall.symbols.diff | 16 ++ .../assertionTypePredicates2.symbols | 5 + .../assertionTypePredicates2.symbols.diff | 18 +- ...assertionsAndNonReturningFunctions.symbols | 2 + ...tionsAndNonReturningFunctions.symbols.diff | 11 +- .../checkJsdocSatisfiesTag1.symbols | 2 + .../checkJsdocSatisfiesTag1.symbols.diff | 11 +- .../checkJsdocSatisfiesTag2.symbols | 2 + .../checkJsdocSatisfiesTag2.symbols.diff | 11 ++ .../checkJsdocSatisfiesTag5.symbols | 2 + .../checkJsdocSatisfiesTag5.symbols.diff | 11 ++ .../checkJsdocSatisfiesTag8.symbols | 1 + .../checkJsdocSatisfiesTag8.symbols.diff | 10 + .../conformance/checkJsdocTypeTag4.symbols | 3 + .../checkJsdocTypeTag4.symbols.diff | 12 ++ .../conformance/checkJsdocTypeTag5.symbols | 4 + .../checkJsdocTypeTag5.symbols.diff | 20 ++ .../conformance/checkJsdocTypeTag7.symbols | 3 + .../checkJsdocTypeTag7.symbols.diff | 12 +- ...checkJsdocTypedefOnlySourceFile.errors.txt | 5 +- ...JsdocTypedefOnlySourceFile.errors.txt.diff | 8 +- .../contextualTypedSpecialAssignment.symbols | 5 + ...textualTypedSpecialAssignment.symbols.diff | 14 +- .../submodule/conformance/extendsTag5.symbols | 4 + .../conformance/extendsTag5.symbols.diff | 14 ++ .../importingExportingTypes.symbols | 1 + .../importingExportingTypes.symbols.diff | 5 +- ...FunctionClassesCjsExportAssignment.symbols | 10 + ...ionClassesCjsExportAssignment.symbols.diff | 35 +++- ...sImportAliasExposedWithinNamespace.symbols | 11 ++ ...rtAliasExposedWithinNamespace.symbols.diff | 30 ++- ...portAliasExposedWithinNamespaceCjs.symbols | 2 + ...liasExposedWithinNamespaceCjs.symbols.diff | 9 +- ...jsDeclarationsImportTypeBundled.errors.txt | 5 +- ...larationsImportTypeBundled.errors.txt.diff | 5 +- .../jsDeclarationsImportTypeBundled.symbols | 2 + ...DeclarationsImportTypeBundled.symbols.diff | 11 +- .../jsDeclarationsTypeAliases.symbols | 4 + .../jsDeclarationsTypeAliases.symbols.diff | 13 +- ...clarationsTypedefAndImportTypes.errors.txt | 5 +- ...tionsTypedefAndImportTypes.errors.txt.diff | 5 +- ...sDeclarationsTypedefAndImportTypes.symbols | 2 - ...arationsTypedefAndImportTypes.symbols.diff | 2 - ...DeclarationsTypedefAndLatebound.errors.txt | 15 +- ...rationsTypedefAndLatebound.errors.txt.diff | 15 +- .../jsDeclarationsTypedefAndLatebound.symbols | 4 +- ...clarationsTypedefAndLatebound.symbols.diff | 14 +- .../jsDeclarationsTypedefFunction.symbols | 4 + ...jsDeclarationsTypedefFunction.symbols.diff | 13 ++ ...TypedefPropertyAndExportAssignment.symbols | 10 + ...efPropertyAndExportAssignment.symbols.diff | 23 ++- .../conformance/jsdocTemplateClass.symbols | 8 + .../jsdocTemplateClass.symbols.diff | 23 ++- .../jsdocTemplateConstructorFunction.symbols | 4 + ...ocTemplateConstructorFunction.symbols.diff | 13 +- .../jsdocTemplateConstructorFunction2.symbols | 2 + ...cTemplateConstructorFunction2.symbols.diff | 8 + .../conformance/jsdocTemplateTag7.symbols | 2 + .../jsdocTemplateTag7.symbols.diff | 11 ++ .../conformance/jsdocTemplateTag8.symbols | 9 + .../jsdocTemplateTag8.symbols.diff | 32 ++++ .../jsdocTemplateTagDefault.symbols | 15 ++ .../jsdocTemplateTagDefault.symbols.diff | 53 ++++++ .../jsdocTemplateTagNameResolution.symbols | 3 + ...sdocTemplateTagNameResolution.symbols.diff | 12 ++ .../moduleExportAssignment7.errors.txt | 168 ++++++++--------- .../moduleExportAssignment7.errors.txt.diff | 176 +++++++++--------- .../noAssertForUnparseableTypedefs.symbols | 2 + ...oAssertForUnparseableTypedefs.symbols.diff | 11 ++ .../recursiveTypeReferences2.symbols | 44 +++++ .../recursiveTypeReferences2.symbols.diff | 72 +++++++ .../submodule/conformance/thisTag3.symbols | 3 + .../conformance/thisTag3.symbols.diff | 12 +- .../conformance/typeTagNoErasure.symbols | 5 + .../conformance/typeTagNoErasure.symbols.diff | 14 ++ ...typeTagOnFunctionReferencesGeneric.symbols | 5 + ...agOnFunctionReferencesGeneric.symbols.diff | 14 ++ .../conformance/typedefCrossModule.errors.txt | 12 +- .../typedefCrossModule.errors.txt.diff | 12 +- .../conformance/typedefCrossModule.symbols | 26 ++- .../typedefCrossModule.symbols.diff | 38 +++- .../typedefCrossModule5.errors.txt | 39 ---- .../typedefCrossModule5.errors.txt.diff | 74 ++++---- .../conformance/typedefInnerNamepaths.symbols | 2 + .../typedefInnerNamepaths.symbols.diff | 11 ++ .../typedefMultipleTypeParameters.symbols | 11 ++ ...typedefMultipleTypeParameters.symbols.diff | 20 +- .../conformance/typedefOnStatements.symbols | 35 ++++ .../typedefOnStatements.symbols.diff | 101 +++++++++- .../typedefTagExtraneousProperty.symbols | 2 + .../typedefTagExtraneousProperty.symbols.diff | 9 +- .../conformance/typedefTagNested.symbols | 2 + .../conformance/typedefTagNested.symbols.diff | 11 +- .../typedefTagTypeResolution.symbols | 2 + .../typedefTagTypeResolution.symbols.diff | 11 ++ .../conformance/typedefTagWrapping.symbols | 22 +++ .../typedefTagWrapping.symbols.diff | 77 +++++++- 133 files changed, 1580 insertions(+), 386 deletions(-) create mode 100644 testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/extendsTag5.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefCrossModule5.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 6dc6382f26..0493ab81fc 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -3046,6 +3046,7 @@ type ClassLikeBase struct { DeclarationBase ExportableBase ModifiersBase + LocalsContainerBase name *IdentifierNode // IdentifierNode TypeParameters *NodeList // NodeList[*TypeParameterDeclarationNode]. Optional HeritageClauses *NodeList // NodeList[*HeritageClauseNode]. Optional @@ -3282,6 +3283,10 @@ func IsTypeAliasDeclaration(node *Node) bool { return node.Kind == KindTypeAliasDeclaration } +func IsEitherTypeAliasDeclaration(node *Node) bool { + return node.Kind == KindTypeAliasDeclaration || node.Kind == KindJSTypeAliasDeclaration +} + type JSTypeAliasDeclaration struct { StatementBase DeclarationBase @@ -3320,7 +3325,9 @@ func (node *JSTypeAliasDeclaration) VisitEachChild(v *NodeVisitor) *Node { func (node *JSTypeAliasDeclaration) Clone(f *NodeFactory) *Node { return cloneNode(f.NewJSTypeAliasDeclaration(node.Modifiers(), node.Name(), node.TypeParameters, node.Type), node.AsNode(), f.hooks) } + func (node *JSTypeAliasDeclaration) Name() *DeclarationName { return node.name } + func IsJSTypeAliasDeclaration(node *Node) bool { return node.Kind == KindJSTypeAliasDeclaration } diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index 4b7c524423..35610c3660 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -623,6 +623,7 @@ func isDeclarationStatementKind(kind Kind) bool { KindClassDeclaration, KindInterfaceDeclaration, KindTypeAliasDeclaration, + KindJSTypeAliasDeclaration, KindEnumDeclaration, KindModuleDeclaration, KindImportDeclaration, @@ -2013,6 +2014,7 @@ func GetMeaningFromDeclaration(node *Node) SemanticMeaning { case KindTypeParameter, KindInterfaceDeclaration, KindTypeAliasDeclaration, + KindJSTypeAliasDeclaration, KindTypeLiteral: return SemanticMeaningType case KindEnumMember, KindClassDeclaration: @@ -2140,7 +2142,7 @@ func getModuleInstanceStateCached(node *Node, ancestors []*Node, visited map[Nod func getModuleInstanceStateWorker(node *Node, ancestors []*Node, visited map[NodeId]ModuleInstanceState) ModuleInstanceState { // A module is uninstantiated if it contains only switch node.Kind { - case KindInterfaceDeclaration, KindTypeAliasDeclaration: + case KindInterfaceDeclaration, KindTypeAliasDeclaration, KindJSTypeAliasDeclaration: return ModuleInstanceStateNonInstantiated case KindEnumDeclaration: if IsEnumConst(node) { diff --git a/internal/binder/binder.go b/internal/binder/binder.go index 57133eb2a2..e1e424c0eb 100644 --- a/internal/binder/binder.go +++ b/internal/binder/binder.go @@ -436,7 +436,7 @@ func (b *Binder) declareSymbolAndAddToSymbolTable(node *ast.Node, symbolFlags as case ast.KindFunctionType, ast.KindConstructorType, ast.KindCallSignature, ast.KindConstructSignature, ast.KindJSDocSignature, ast.KindIndexSignature, ast.KindMethodDeclaration, ast.KindMethodSignature, ast.KindConstructor, ast.KindGetAccessor, ast.KindSetAccessor, ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindArrowFunction, - ast.KindClassStaticBlockDeclaration, ast.KindTypeAliasDeclaration, ast.KindMappedType: + ast.KindClassStaticBlockDeclaration, ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration, ast.KindMappedType: return b.declareSymbol(ast.GetLocals(b.container), nil /*parent*/, node, symbolFlags, symbolExcludes) } panic("Unhandled case in declareSymbolAndAddToSymbolTable") @@ -669,7 +669,7 @@ func (b *Binder) bind(node *ast.Node) bool { b.bindClassLikeDeclaration(node) case ast.KindInterfaceDeclaration: b.bindBlockScopedDeclaration(node, ast.SymbolFlagsInterface, ast.SymbolFlagsInterfaceExcludes) - case ast.KindTypeAliasDeclaration: + case ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration: b.bindBlockScopedDeclaration(node, ast.SymbolFlagsTypeAlias, ast.SymbolFlagsTypeAliasExcludes) case ast.KindEnumDeclaration: b.bindEnumDeclaration(node) @@ -1388,7 +1388,7 @@ func (b *Binder) bindContainer(node *ast.Node, containerFlags ContainerFlags) { b.blockScopeContainer = node if containerFlags&ContainerFlagsHasLocals != 0 { // localsContainer := node - // localsContainer.LocalsContainerData().locals = make(SymbolTable) + // localsContainer.LocalsContainerData().locals = make(ast.SymbolTable) b.addToContainerChain(node) } } else if containerFlags&ContainerFlagsIsBlockScopedContainer != 0 { @@ -1690,7 +1690,7 @@ func (b *Binder) isExecutableStatement(s *ast.Node) bool { func (b *Binder) isPurelyTypeDeclaration(s *ast.Node) bool { switch s.Kind { - case ast.KindInterfaceDeclaration, ast.KindTypeAliasDeclaration: + case ast.KindInterfaceDeclaration, ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration: return true case ast.KindModuleDeclaration: return ast.GetModuleInstanceState(s) != ast.ModuleInstanceStateInstantiated @@ -2487,7 +2487,7 @@ func GetContainerFlags(node *ast.Node) ContainerFlags { return ContainerFlagsIsContainer case ast.KindInterfaceDeclaration: return ContainerFlagsIsContainer | ContainerFlagsIsInterface - case ast.KindModuleDeclaration, ast.KindTypeAliasDeclaration, ast.KindMappedType, ast.KindIndexSignature: + case ast.KindModuleDeclaration, ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration, ast.KindMappedType, ast.KindIndexSignature: return ContainerFlagsIsContainer | ContainerFlagsHasLocals case ast.KindSourceFile: return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals @@ -2799,7 +2799,7 @@ func GetErrorRangeForNode(sourceFile *ast.SourceFile, node *ast.Node) core.TextR // This list is a work in progress. Add missing node kinds to improve their error spans case ast.KindVariableDeclaration, ast.KindBindingElement, ast.KindClassDeclaration, ast.KindClassExpression, ast.KindInterfaceDeclaration, ast.KindModuleDeclaration, ast.KindEnumDeclaration, ast.KindEnumMember, ast.KindFunctionDeclaration, ast.KindFunctionExpression, - ast.KindMethodDeclaration, ast.KindGetAccessor, ast.KindSetAccessor, ast.KindTypeAliasDeclaration, ast.KindPropertyDeclaration, + ast.KindMethodDeclaration, ast.KindGetAccessor, ast.KindSetAccessor, ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration, ast.KindPropertyDeclaration, ast.KindPropertySignature, ast.KindNamespaceImport: errorNode = ast.GetNameOfDeclaration(node) case ast.KindArrowFunction: diff --git a/internal/binder/nameresolver.go b/internal/binder/nameresolver.go index 6a04053de7..f22dcf7963 100644 --- a/internal/binder/nameresolver.go +++ b/internal/binder/nameresolver.go @@ -491,7 +491,7 @@ func isSelfReferenceLocation(node *ast.Node, lastLocation *ast.Node) bool { case ast.KindParameter: return lastLocation != nil && lastLocation == node.AsParameterDeclaration().Name() case ast.KindFunctionDeclaration, ast.KindClassDeclaration, ast.KindInterfaceDeclaration, ast.KindEnumDeclaration, - ast.KindTypeAliasDeclaration, ast.KindModuleDeclaration: // For `namespace N { N; }` + ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration, ast.KindModuleDeclaration: // For `namespace N { N; }` return true } return false diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 9e4395ed79..7655d14e15 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -2166,7 +2166,7 @@ func (c *Checker) checkSourceElementWorker(node *ast.Node) { c.checkClassDeclaration(node) case ast.KindInterfaceDeclaration: c.checkInterfaceDeclaration(node) - case ast.KindTypeAliasDeclaration: + case ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration: c.checkTypeAliasDeclaration(node) case ast.KindEnumDeclaration: c.checkEnumDeclaration(node) @@ -2329,12 +2329,12 @@ func (c *Checker) checkTypeParameter(node *ast.Node) { } func (c *Checker) checkTypeParameterDeferred(node *ast.Node) { - if ast.IsInterfaceDeclaration(node.Parent) || ast.IsClassLike(node.Parent) || ast.IsTypeAliasDeclaration(node.Parent) { + if ast.IsInterfaceDeclaration(node.Parent) || ast.IsClassLike(node.Parent) || ast.IsTypeAliasDeclaration(node.Parent) || ast.IsJSTypeAliasDeclaration(node.Parent) { typeParameter := c.getDeclaredTypeOfTypeParameter(c.getSymbolOfDeclaration(node)) modifiers := c.getTypeParameterModifiers(typeParameter) & (ast.ModifierFlagsIn | ast.ModifierFlagsOut) if modifiers != 0 { symbol := c.getSymbolOfDeclaration(node.Parent) - if ast.IsTypeAliasDeclaration(node.Parent) && c.getDeclaredTypeOfSymbol(symbol).objectFlags&(ObjectFlagsAnonymous|ObjectFlagsMapped) == 0 { + if (ast.IsTypeAliasDeclaration(node.Parent) || ast.IsJSTypeAliasDeclaration(node.Parent)) && c.getDeclaredTypeOfSymbol(symbol).objectFlags&(ObjectFlagsAnonymous|ObjectFlagsMapped) == 0 { c.error(node, diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types) } else if modifiers == ast.ModifierFlagsIn || modifiers == ast.ModifierFlagsOut { source := c.createMarkerType(symbol, typeParameter, core.IfElse(modifiers == ast.ModifierFlagsOut, c.markerSubTypeForCheck, c.markerSuperTypeForCheck)) @@ -6308,10 +6308,15 @@ func (c *Checker) checkTypeAliasDeclaration(node *ast.Node) { c.checkTypeNameIsReserved(node.Name(), diagnostics.Type_alias_name_cannot_be_0) c.checkExportsOnMergedDeclarations(node) - typeNode := node.AsTypeAliasDeclaration().Type + var typeNode *ast.Node + if node.Kind == ast.KindTypeAliasDeclaration { + typeNode = node.AsTypeAliasDeclaration().Type + } else if node.Kind == ast.KindJSTypeAliasDeclaration { + typeNode = node.AsJSTypeAliasDeclaration().Type + } typeParameters := node.TypeParameters() c.checkTypeParameters(typeParameters) - if typeNode.Kind == ast.KindIntrinsicKeyword { + if typeNode != nil && typeNode.Kind == ast.KindIntrinsicKeyword { if !(len(typeParameters) == 0 && node.Name().Text() == "BuiltinIteratorReturn" || len(typeParameters) == 1 && intrinsicTypeKinds[node.Name().Text()] != IntrinsicTypeKindUnknown) { c.error(typeNode, diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types) @@ -6325,6 +6330,9 @@ func (c *Checker) checkTypeAliasDeclaration(node *ast.Node) { func (c *Checker) checkTypeNameIsReserved(name *ast.Node, message *diagnostics.Message) { // TS 1.0 spec (April 2014): 3.6.1 // The predefined type keywords are reserved and cannot be used as names of user defined types. + if name == nil { // TODO: Check when this happens + return + } switch name.Text() { case "any", "unknown", "never", "number", "bigint", "boolean", "string", "symbol", "void", "object", "undefined": c.error(name, message, name.Text()) @@ -6396,7 +6404,7 @@ func (c *Checker) checkUnusedIdentifiers(potentiallyUnusedIdentifiers []*ast.Nod } c.checkUnusedTypeParameters(node) case ast.KindMethodSignature, ast.KindCallSignature, ast.KindConstructSignature, ast.KindFunctionType, ast.KindConstructorType, - ast.KindTypeAliasDeclaration, ast.KindInterfaceDeclaration: + ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration, ast.KindInterfaceDeclaration: c.checkUnusedTypeParameters(node) case ast.KindInferType: c.checkUnusedInferTypeParameter(node) @@ -10444,7 +10452,7 @@ func (c *Checker) parameterInitializerContainsUndefined(declaration *ast.Node) b func (c *Checker) isInAmbientOrTypeNode(node *ast.Node) bool { return node.Flags&ast.NodeFlagsAmbient != 0 || ast.FindAncestor(node, func(n *ast.Node) bool { - return ast.IsInterfaceDeclaration(n) || ast.IsTypeAliasDeclaration(n) || ast.IsTypeLiteralNode(n) + return ast.IsInterfaceDeclaration(n) || ast.IsTypeAliasDeclaration(n) || ast.IsJSTypeAliasDeclaration(n) || ast.IsTypeLiteralNode(n) }) != nil } @@ -20279,6 +20287,9 @@ func (c *Checker) couldContainTypeVariablesWorker(t *Type) bool { func (c *Checker) isNonGenericTopLevelType(t *Type) bool { if t.alias != nil && len(t.alias.typeArguments) == 0 { declaration := ast.GetDeclarationOfKind(t.alias.symbol, ast.KindTypeAliasDeclaration) + if declaration == nil { + declaration = ast.GetDeclarationOfKind(t.alias.symbol, ast.KindJSTypeAliasDeclaration) + } return declaration != nil && ast.FindAncestorOrQuit(declaration.Parent, func(n *ast.Node) ast.FindAncestorResult { switch n.Kind { case ast.KindSourceFile: @@ -21246,7 +21257,7 @@ func (c *Checker) isResolvedByTypeAlias(node *ast.Node) bool { case ast.KindParenthesizedType, ast.KindNamedTupleMember, ast.KindTypeReference, ast.KindUnionType, ast.KindIntersectionType, ast.KindIndexedAccessType, ast.KindConditionalType, ast.KindTypeOperator, ast.KindArrayType, ast.KindTupleType: return c.isResolvedByTypeAlias(parent) - case ast.KindTypeAliasDeclaration: + case ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration: return true } return false @@ -21744,7 +21755,7 @@ func (c *Checker) getOuterTypeParameters(node *ast.Node, includeThisTypes bool) switch kind { case ast.KindClassDeclaration, ast.KindClassExpression, ast.KindInterfaceDeclaration, ast.KindCallSignature, ast.KindConstructSignature, ast.KindMethodSignature, ast.KindFunctionType, ast.KindConstructorType, ast.KindFunctionDeclaration, - ast.KindMethodDeclaration, ast.KindFunctionExpression, ast.KindArrowFunction, ast.KindTypeAliasDeclaration, ast.KindMappedType, + ast.KindMethodDeclaration, ast.KindFunctionExpression, ast.KindArrowFunction, ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration, ast.KindMappedType, ast.KindConditionalType: outerTypeParameters := c.getOuterTypeParameters(node, includeThisTypes) if (kind == ast.KindFunctionExpression || kind == ast.KindArrowFunction || ast.IsObjectLiteralMethod(node)) && c.isContextSensitive(node) { @@ -21823,7 +21834,7 @@ func (c *Checker) getDeclaredTypeOfTypeAlias(symbol *ast.Symbol) *Type { if !c.pushTypeResolution(symbol, TypeSystemPropertyNameDeclaredType) { return c.errorType } - declaration := core.Find(symbol.Declarations, ast.IsTypeAliasDeclaration) + declaration := core.Find(symbol.Declarations, ast.IsEitherTypeAliasDeclaration) typeNode := declaration.AsTypeAliasDeclaration().Type t := c.getTypeFromTypeNode(typeNode) if c.popTypeResolution() { diff --git a/internal/checker/flow.go b/internal/checker/flow.go index 2c0b570ee7..cf2bff62d7 100644 --- a/internal/checker/flow.go +++ b/internal/checker/flow.go @@ -2667,6 +2667,7 @@ func (c *Checker) markNodeAssignmentsWorker(node *ast.Node) bool { return false case ast.KindInterfaceDeclaration, ast.KindTypeAliasDeclaration, + ast.KindJSTypeAliasDeclaration, ast.KindEnumDeclaration: return false } diff --git a/internal/checker/grammarchecks.go b/internal/checker/grammarchecks.go index 9c0de302c5..3ff08138fb 100644 --- a/internal/checker/grammarchecks.go +++ b/internal/checker/grammarchecks.go @@ -400,7 +400,7 @@ func (c *Checker) checkGrammarModifiers(node *ast.Node /*Union[HasModifiers, Has return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "export", "abstract") } else if flags&ast.ModifierFlagsAsync != 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "export", "async") - } else if ast.IsClassLike(node.Parent) { + } else if ast.IsClassLike(node.Parent) && !ast.IsJSTypeAliasDeclaration(node) { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_cannot_appear_on_class_elements_of_this_kind, "export") } else if node.Kind == ast.KindParameter { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_cannot_appear_on_a_parameter, "export") @@ -604,7 +604,8 @@ func (c *Checker) findFirstIllegalModifier(node *ast.Node) *ast.Node { ast.KindFunctionExpression, ast.KindArrowFunction, ast.KindParameter, - ast.KindTypeParameter: + ast.KindTypeParameter, + ast.KindJSTypeAliasDeclaration: return nil case ast.KindClassStaticBlockDeclaration, ast.KindPropertyAssignment, diff --git a/internal/checker/utilities.go b/internal/checker/utilities.go index 4d939af194..f1ec4d8b3e 100644 --- a/internal/checker/utilities.go +++ b/internal/checker/utilities.go @@ -371,7 +371,7 @@ func isShorthandPropertyNameUseSite(useSite *ast.Node) bool { func isTypeDeclaration(node *ast.Node) bool { switch node.Kind { - case ast.KindTypeParameter, ast.KindClassDeclaration, ast.KindInterfaceDeclaration, ast.KindTypeAliasDeclaration, ast.KindEnumDeclaration: + case ast.KindTypeParameter, ast.KindClassDeclaration, ast.KindInterfaceDeclaration, ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration, ast.KindEnumDeclaration: return true case ast.KindImportClause: return node.AsImportClause().IsTypeOnly @@ -398,7 +398,7 @@ func canHaveSymbol(node *ast.Node) bool { ast.KindNamespaceImport, ast.KindNewExpression, ast.KindNoSubstitutionTemplateLiteral, ast.KindNumericLiteral, ast.KindObjectLiteralExpression, ast.KindParameter, ast.KindPropertyAccessExpression, ast.KindPropertyAssignment, ast.KindPropertyDeclaration, ast.KindPropertySignature, ast.KindSetAccessor, ast.KindShorthandPropertyAssignment, ast.KindSourceFile, ast.KindSpreadAssignment, ast.KindStringLiteral, - ast.KindTypeAliasDeclaration, ast.KindTypeLiteral, ast.KindTypeParameter, ast.KindVariableDeclaration: + ast.KindTypeAliasDeclaration, ast.KindTypeLiteral, ast.KindTypeParameter, ast.KindVariableDeclaration, ast.KindJSTypeAliasDeclaration: return true } return false @@ -412,7 +412,7 @@ func canHaveLocals(node *ast.Node) bool { ast.KindFunctionExpression, ast.KindFunctionType, ast.KindGetAccessor, ast.KindIndexSignature, ast.KindJSDocCallbackTag, ast.KindJSDocSignature, ast.KindJSDocTypedefTag, ast.KindMappedType, ast.KindMethodDeclaration, ast.KindMethodSignature, ast.KindModuleDeclaration, ast.KindSetAccessor, ast.KindSourceFile, - ast.KindTypeAliasDeclaration: + ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration: return true } return false @@ -529,7 +529,7 @@ func parsePseudoBigInt(stringValue string) string { } func isTypeAlias(node *ast.Node) bool { - return ast.IsTypeAliasDeclaration(node) + return ast.IsEitherTypeAliasDeclaration(node) } func hasOnlyExpressionInitializer(node *ast.Node) bool { @@ -1575,7 +1575,7 @@ func (c *Checker) isMutableLocalVariableDeclaration(declaration *ast.Node) bool func isInAmbientOrTypeNode(node *ast.Node) bool { return node.Flags&ast.NodeFlagsAmbient != 0 || ast.FindAncestor(node, func(n *ast.Node) bool { - return ast.IsInterfaceDeclaration(n) || ast.IsTypeAliasDeclaration(n) || ast.IsTypeLiteralNode(n) + return ast.IsInterfaceDeclaration(n) || ast.IsTypeAliasDeclaration(n) || ast.IsJSTypeAliasDeclaration(n) || ast.IsTypeLiteralNode(n) }) != nil } diff --git a/internal/printer/printer.go b/internal/printer/printer.go index fea150b71c..b1b26d35a0 100644 --- a/internal/printer/printer.go +++ b/internal/printer/printer.go @@ -685,6 +685,7 @@ func (p *Printer) shouldAllowTrailingComma(node *ast.Node, list *ast.NodeList) b ast.KindGetAccessor, ast.KindSetAccessor, ast.KindTypeAliasDeclaration, + ast.KindJSTypeAliasDeclaration, ast.KindFunctionType, ast.KindConstructorType, ast.KindCallSignature, @@ -3319,6 +3320,21 @@ func (p *Printer) emitTypeAliasDeclaration(node *ast.TypeAliasDeclaration) { p.exitNode(node.AsNode()) } +func (p *Printer) emitJSTypeAliasDeclaration(node *ast.JSTypeAliasDeclaration) { + p.enterNode(node.AsNode()) + p.emitModifierList(node.AsNode(), node.Modifiers(), false /*allowDecorators*/) + p.writeKeyword("jstype") + p.writeSpace() + p.emitBindingIdentifier(node.Name().AsIdentifier()) + p.emitTypeParameters(node.AsNode(), node.TypeParameters) + p.writeSpace() + p.writePunctuation("=") + p.writeSpace() + p.emitTypeNodeOutsideExtends(node.Type) + p.writeTrailingSemicolon() + p.exitNode(node.AsNode()) +} + func (p *Printer) emitEnumDeclaration(node *ast.EnumDeclaration) { p.enterNode(node.AsNode()) p.emitModifierList(node.AsNode(), node.Modifiers(), false /*allowDecorators*/) @@ -3706,6 +3722,8 @@ func (p *Printer) emitStatement(node *ast.Statement) { p.emitInterfaceDeclaration(node.AsInterfaceDeclaration()) case ast.KindTypeAliasDeclaration: p.emitTypeAliasDeclaration(node.AsTypeAliasDeclaration()) + case ast.KindJSTypeAliasDeclaration: + p.emitJSTypeAliasDeclaration(node.AsJSTypeAliasDeclaration()) case ast.KindEnumDeclaration: p.emitEnumDeclaration(node.AsEnumDeclaration()) case ast.KindModuleDeclaration: diff --git a/internal/printer/utilities.go b/internal/printer/utilities.go index b22f717e6f..297c36fe5d 100644 --- a/internal/printer/utilities.go +++ b/internal/printer/utilities.go @@ -454,6 +454,8 @@ func getContainingNodeArray(node *ast.Node) *ast.NodeList { return parent.AsInterfaceDeclaration().TypeParameters case ast.IsTypeAliasDeclaration(parent): return parent.AsTypeAliasDeclaration().TypeParameters + case ast.IsJSTypeAliasDeclaration(parent): + return parent.AsJSTypeAliasDeclaration().TypeParameters // case ast.IsJSDocTemplateTag(parent): // return parent.AsJSDocTemplateTag().TypeParameters case ast.IsInferTypeNode(parent): diff --git a/internal/testutil/tsbaseline/type_symbol_baseline.go b/internal/testutil/tsbaseline/type_symbol_baseline.go index 2467ac6c88..fb3cba86ef 100644 --- a/internal/testutil/tsbaseline/type_symbol_baseline.go +++ b/internal/testutil/tsbaseline/type_symbol_baseline.go @@ -290,7 +290,7 @@ func (walker *typeWriterWalker) writeTypeOrSymbol(node *ast.Node, isSymbolWalk b if ast.IsPartOfTypeNode(node) || ast.IsIdentifier(node) && (ast.GetMeaningFromDeclaration(node)&ast.SemanticMeaningValue) == 0 && - !(ast.IsTypeAliasDeclaration(node.Parent) && node == node.Parent.Name()) { + !(ast.IsEitherTypeAliasDeclaration(node.Parent) && node == node.Parent.Name()) { return nil } diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols index 5eb7764d5b..7d77ac61c1 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols @@ -22,6 +22,8 @@ export = Foo; /** @typedef {typeof import("./file")} Foo */ /** @typedef {(foo: Foo) => string} FooFun */ +>foo : Symbol(foo, Decl(something.js, 2, 15)) +>Foo : Symbol(Foo) module.exports = /** @type {FooFun} */(void 0); >module : Symbol(module, Decl(file.ts, 5, 7)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff index f3ed430fc8..d6f1070c6a 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff @@ -9,8 +9,12 @@ } declare global { -@@= skipped -19, +19 lines =@@ +@@= skipped -17, +17 lines =@@ + /** @typedef {typeof import("./file")} Foo */ + /** @typedef {(foo: Foo) => string} FooFun */ ++>foo : Symbol(foo, Decl(something.js, 2, 15)) ++>Foo : Symbol(Foo) module.exports = /** @type {FooFun} */(void 0); ->module.exports : Symbol(module.exports, Decl(something.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols index d269ac573e..0f44c6a207 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols @@ -11,6 +11,9 @@ function acceptNum(num) {} /** * @typedef {(a: string, b: number) => void} Fn +>a : Symbol(a, Decl(index.js, 7, 14)) +>b : Symbol(b, Decl(index.js, 7, 24)) + */ /** @type {Fn} */ diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols.diff b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols.diff new file mode 100644 index 0000000000..fdc1613862 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols.diff @@ -0,0 +1,12 @@ +--- old.contextuallyTypedParametersOptionalInJSDoc.symbols ++++ new.contextuallyTypedParametersOptionalInJSDoc.symbols +@@= skipped -10, +10 lines =@@ + + /** + * @typedef {(a: string, b: number) => void} Fn ++>a : Symbol(a, Decl(index.js, 7, 14)) ++>b : Symbol(b, Decl(index.js, 7, 24)) ++ + */ + + /** @type {Fn} */ diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols index 447299b80a..02ea1aa643 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols @@ -3,6 +3,17 @@ === index.js === /** * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs +>K : Symbol(K, Decl(index.js, 1, 16)) +>B : Symbol(B) +>fn : Symbol(fn, Decl(index.js, 1, 32)) +>a : Symbol(a, Decl(index.js, 1, 38)) +>A : Symbol(A) +>b : Symbol(b, Decl(index.js, 1, 43)) +>B : Symbol(B) +>thing : Symbol(thing, Decl(index.js, 1, 58)) +>B : Symbol(B) +>K : Symbol(K, Decl(index.js, 1, 16)) + * @template A * @template {Record} B */ diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff new file mode 100644 index 0000000000..4d2498d9e1 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff @@ -0,0 +1,20 @@ +--- old.contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols ++++ new.contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols +@@= skipped -2, +2 lines =@@ + === index.js === + /** + * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs ++>K : Symbol(K, Decl(index.js, 1, 16)) ++>B : Symbol(B) ++>fn : Symbol(fn, Decl(index.js, 1, 32)) ++>a : Symbol(a, Decl(index.js, 1, 38)) ++>A : Symbol(A) ++>b : Symbol(b, Decl(index.js, 1, 43)) ++>B : Symbol(B) ++>thing : Symbol(thing, Decl(index.js, 1, 58)) ++>B : Symbol(B) ++>K : Symbol(K, Decl(index.js, 1, 16)) ++ + * @template A + * @template {Record} B + */ diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols index 12c77658c2..87f6849fb7 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols @@ -2,10 +2,14 @@ === input.js === /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ +>color : Symbol(color, Decl(input.js, 0, 15)) /** * @template P * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ +>defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23)) +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) +>P : Symbol(P) /** * @type {StatelessComponent} diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff index fc209accdd..35201bad83 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff @@ -1,6 +1,19 @@ --- old.expandoFunctionContextualTypesJs.symbols +++ new.expandoFunctionContextualTypesJs.symbols -@@= skipped -10, +10 lines =@@ +@@= skipped -1, +1 lines =@@ + + === input.js === + /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ ++>color : Symbol(color, Decl(input.js, 0, 15)) + + /** + * @template P + * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ ++>defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23)) ++>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) ++>P : Symbol(P) + + /** * @type {StatelessComponent} */ const MyComponent = () => /* @type {any} */(null); @@ -15,7 +28,7 @@ color: "red" >color : Symbol(color, Decl(input.js, 11, 28)) -@@= skipped -13, +11 lines =@@ +@@= skipped -22, +24 lines =@@ }; const MyComponent2 = () => null; diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols index 6beb97fe7a..7e036a0b6a 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols @@ -23,6 +23,8 @@ import Test from './test/Test.js' /** * @typedef {Object} Options * @property {typeof import("./Test.js").default} [test] +>default : Symbol(default, Decl(Test.js, 1, 13)) + */ class X extends Test { diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff index f3923b5792..f0271ba9a4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff @@ -1,6 +1,15 @@ --- old.jsDeclarationEmitDoesNotRenameImport.symbols +++ new.jsDeclarationEmitDoesNotRenameImport.symbols -@@= skipped -38, +38 lines =@@ +@@= skipped -22, +22 lines =@@ + /** + * @typedef {Object} Options + * @property {typeof import("./Test.js").default} [test] ++>default : Symbol(default, Decl(Test.js, 1, 13)) ++ + */ + + class X extends Test { +@@= skipped -16, +18 lines =@@ >super : Symbol(Test, Decl(Test.js, 0, 0)) if (options.test) { diff --git a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols index 720799fe65..735cd9e75e 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols @@ -16,6 +16,8 @@ export interface LionRequestInit { === index.js === /** * @typedef {import('@lion/ajax').LionRequestInit} LionRequestInit +>LionRequestInit : Symbol(LionRequestInit, Decl(index.d.ts, 0, 0)) + */ export class NewAjax { diff --git a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols.diff index 481d6e020e..22c27784e1 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols.diff @@ -9,7 +9,14 @@ >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) } === index.js === -@@= skipped -15, +15 lines =@@ + /** + * @typedef {import('@lion/ajax').LionRequestInit} LionRequestInit ++>LionRequestInit : Symbol(LionRequestInit, Decl(index.d.ts, 0, 0)) ++ + */ + + export class NewAjax { +@@= skipped -15, +17 lines =@@ * @param {LionRequestInit} [init] */ case5_unexpectedlyResolvesPathToNodeModules(init) {} diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt index da0169af5a..18863ef803 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt @@ -2,7 +2,7 @@ enumDef.js(2,6): error TS2339: Property 'UserMetrics' does not exist on type '{} enumDef.js(4,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'. enumDef.js(16,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'. index.js(2,7): error TS2339: Property 'Cls' does not exist on type '{}'. -index.js(8,26): error TS2339: Property 'UserMetrics' does not exist on type '{}'. +index.js(8,21): error TS2304: Cannot find name 'Host'. index.js(13,11): error TS2503: Cannot find namespace 'Host'. index.js(18,11): error TS2503: Cannot find namespace 'Host'. @@ -43,8 +43,8 @@ index.js(18,11): error TS2503: Cannot find namespace 'Host'. method(p) {} usage() { this.method(Host.UserMetrics.Action.WindowDocked); - ~~~~~~~~~~~ -!!! error TS2339: Property 'UserMetrics' does not exist on type '{}'. + ~~~~ +!!! error TS2304: Cannot find name 'Host'. } } diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt.diff index 69bc939bd6..455e085a23 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt.diff @@ -7,7 +7,7 @@ +enumDef.js(4,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'. +enumDef.js(16,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'. +index.js(2,7): error TS2339: Property 'Cls' does not exist on type '{}'. -+index.js(8,26): error TS2339: Property 'UserMetrics' does not exist on type '{}'. ++index.js(8,21): error TS2304: Cannot find name 'Host'. +index.js(13,11): error TS2503: Cannot find namespace 'Host'. +index.js(18,11): error TS2503: Cannot find namespace 'Host'. + @@ -48,8 +48,8 @@ + method(p) {} + usage() { + this.method(Host.UserMetrics.Action.WindowDocked); -+ ~~~~~~~~~~~ -+!!! error TS2339: Property 'UserMetrics' does not exist on type '{}'. ++ ~~~~ ++!!! error TS2304: Cannot find name 'Host'. + } + } + diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols index 90f61ad2c3..0c7b90f5c3 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols @@ -57,7 +57,6 @@ Other.Cls = class { >this.method : Symbol(method, Decl(index.js, 1, 19)) >this : Symbol(Cls, Decl(index.js, 1, 11)) >method : Symbol(method, Decl(index.js, 1, 19)) ->Host : Symbol(Host, Decl(enumDef.js, 0, 3)) } } diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff index 9afcfcb679..45f10f6995 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff @@ -74,7 +74,6 @@ ->Action : Symbol(Host.UserMetrics.Action, Decl(enumDef.js, 1, 22), Decl(enumDef.js, 3, 17), Decl(enumDef.js, 2, 4)) ->WindowDocked : Symbol(WindowDocked, Decl(enumDef.js, 3, 27)) +>method : Symbol(method, Decl(index.js, 1, 19)) -+>Host : Symbol(Host, Decl(enumDef.js, 0, 3)) } } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols index 460e4edd9d..d915577cf7 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols @@ -9,6 +9,8 @@ export class MyClass { /** * @typedef {Object} options * @property {import("./module").MyClass} option +>MyClass : Symbol(MyClass, Decl(module.js, 0, 0)) + */ /** @type {options} */ let v; diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols.diff new file mode 100644 index 0000000000..1844e275a7 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols.diff @@ -0,0 +1,11 @@ +--- old.jsdocImportTypeResolution.symbols ++++ new.jsdocImportTypeResolution.symbols +@@= skipped -8, +8 lines =@@ + /** + * @typedef {Object} options + * @property {import("./module").MyClass} option ++>MyClass : Symbol(MyClass, Decl(module.js, 0, 0)) ++ + */ + /** @type {options} */ + let v; diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols index 6e1d52ce2c..3fa31ac817 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols @@ -4,6 +4,8 @@ /** * @typedef MyType * @property {sting} [x] +>sting : Symbol(sting) + */ /** @param {MyType} p */ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff new file mode 100644 index 0000000000..0ef450803a --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff @@ -0,0 +1,11 @@ +--- old.jsdocPropertyTagInvalid.symbols ++++ new.jsdocPropertyTagInvalid.symbols +@@= skipped -3, +3 lines =@@ + /** + * @typedef MyType + * @property {sting} [x] ++>sting : Symbol(sting) ++ + */ + + /** @param {MyType} p */ diff --git a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols index 8966879565..e62fc831b9 100644 --- a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols +++ b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols @@ -2,10 +2,17 @@ === a.js === /** @typedef {{ endTime: number, screenshots: number}} A.*/ +>endTime : Symbol(endTime, Decl(a.js, 0, 15)) +>screenshots : Symbol(screenshots, Decl(a.js, 0, 32)) + Animation.AnimationModel.ScreenshotCapture.Request; >Animation : Symbol(Animation, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) /** @typedef {{ endTime: number, screenshots: !B.}} */ +>endTime : Symbol(endTime, Decl(a.js, 3, 15)) +>screenshots : Symbol(screenshots, Decl(a.js, 3, 32)) +>B : Symbol(B) + Animation.AnimationModel.ScreenshotCapture.Request; >Animation : Symbol(Animation, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols.diff b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols.diff index f0f580cc36..8f9abaee28 100644 --- a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols.diff @@ -1,13 +1,21 @@ --- old.misspelledJsDocTypedefTags.symbols +++ new.misspelledJsDocTypedefTags.symbols -@@= skipped -2, +2 lines =@@ +@@= skipped -1, +1 lines =@@ + === a.js === /** @typedef {{ endTime: number, screenshots: number}} A.*/ ++>endTime : Symbol(endTime, Decl(a.js, 0, 15)) ++>screenshots : Symbol(screenshots, Decl(a.js, 0, 32)) ++ Animation.AnimationModel.ScreenshotCapture.Request; ->Animation : Symbol(Animation, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(a.js, 1, 51)) +>Animation : Symbol(Animation, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) /** @typedef {{ endTime: number, screenshots: !B.}} */ ++>endTime : Symbol(endTime, Decl(a.js, 3, 15)) ++>screenshots : Symbol(screenshots, Decl(a.js, 3, 32)) ++>B : Symbol(B) ++ Animation.AnimationModel.ScreenshotCapture.Request; ->Animation : Symbol(Animation, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(a.js, 1, 51)) +>Animation : Symbol(Animation, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols index 955e08e186..ba44e726eb 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols @@ -14,6 +14,8 @@ const a = { value: undefined }; // error /** * @typedef {{ value?: number }} B +>value : Symbol(value, Decl(a.js, 9, 14)) + */ /** @type {B} */ diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols.diff b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols.diff new file mode 100644 index 0000000000..ea8ef43ced --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols.diff @@ -0,0 +1,11 @@ +--- old.strictOptionalProperties3.symbols ++++ new.strictOptionalProperties3.symbols +@@= skipped -13, +13 lines =@@ + + /** + * @typedef {{ value?: number }} B ++>value : Symbol(value, Decl(a.js, 9, 14)) ++ + */ + + /** @type {B} */ diff --git a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols index 3261aa97e0..92068f8345 100644 --- a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols +++ b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols @@ -1,10 +1,12 @@ //// [tests/cases/compiler/unmetTypeConstraintInJSDocImportCall.ts] //// === file1.js === - /** * @template {string} T * @typedef {{ foo: T }} Foo +>foo : Symbol(foo, Decl(file1.js, 2, 14)) +>T : Symbol(T) + */ export default {}; diff --git a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols.diff b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols.diff new file mode 100644 index 0000000000..a14c8a2cce --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols.diff @@ -0,0 +1,16 @@ +--- old.unmetTypeConstraintInJSDocImportCall.symbols ++++ new.unmetTypeConstraintInJSDocImportCall.symbols +@@= skipped -0, +0 lines =@@ + //// [tests/cases/compiler/unmetTypeConstraintInJSDocImportCall.ts] //// + + === file1.js === +- + /** + * @template {string} T + * @typedef {{ foo: T }} Foo ++>foo : Symbol(foo, Decl(file1.js, 2, 14)) ++>T : Symbol(T) ++ + */ + + export default {}; diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols index 3030bb1d97..15b3336e72 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols @@ -3,10 +3,15 @@ === assertionTypePredicates2.js === /** * @typedef {{ x: number }} A +>x : Symbol(x, Decl(assertionTypePredicates2.js, 1, 14)) + */ /** * @typedef { A & { y: number } } B +>A : Symbol(A) +>y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) + */ /** diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff index a27b754ac7..3336b72a38 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff @@ -1,6 +1,22 @@ --- old.assertionTypePredicates2.symbols +++ new.assertionTypePredicates2.symbols -@@= skipped -17, +17 lines =@@ +@@= skipped -2, +2 lines =@@ + === assertionTypePredicates2.js === + /** + * @typedef {{ x: number }} A ++>x : Symbol(x, Decl(assertionTypePredicates2.js, 1, 14)) ++ + */ + + /** + * @typedef { A & { y: number } } B ++>A : Symbol(A) ++>y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) ++ + */ + + /** +@@= skipped -15, +20 lines =@@ >a : Symbol(a, Decl(assertionTypePredicates2.js, 12, 13)) if (/** @type { B } */ (a).y !== 0) throw TypeError(); diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols index 4e28ee1edd..50cde52438 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols @@ -2,6 +2,8 @@ === assertionsAndNonReturningFunctions.js === /** @typedef {(check: boolean) => asserts check} AssertFunc */ +>check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 0, 15)) +>check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 0, 15)) /** @type {AssertFunc} */ const assert = check => { diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff index 50d5a23cbb..6e77437041 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff @@ -1,6 +1,15 @@ --- old.assertionsAndNonReturningFunctions.symbols +++ new.assertionsAndNonReturningFunctions.symbols -@@= skipped -58, +58 lines =@@ +@@= skipped -1, +1 lines =@@ + + === assertionsAndNonReturningFunctions.js === + /** @typedef {(check: boolean) => asserts check} AssertFunc */ ++>check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 0, 15)) ++>check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 0, 15)) + + /** @type {AssertFunc} */ + const assert = check => { +@@= skipped -57, +59 lines =@@ >x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) x.length; diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols index 41e26adfcd..6d630c1741 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols @@ -13,6 +13,8 @@ /** * @typedef {(x: string) => string} T3 +>x : Symbol(x, Decl(a.js, 11, 14)) + */ /** diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff index d1e4e15083..f794869a16 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff @@ -1,6 +1,15 @@ --- old.checkJsdocSatisfiesTag1.symbols +++ new.checkJsdocSatisfiesTag1.symbols -@@= skipped -40, +40 lines =@@ +@@= skipped -12, +12 lines =@@ + + /** + * @typedef {(x: string) => string} T3 ++>x : Symbol(x, Decl(a.js, 11, 14)) ++ + */ + + /** +@@= skipped -28, +30 lines =@@ const t5 = /** @satisfies {T3} */((m) => m.substring(0)); >t5 : Symbol(t5, Decl(a.js, 27, 5)) >m : Symbol(m, Decl(a.js, 27, 35)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols index c40b2a537b..18be0a482f 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols @@ -2,6 +2,8 @@ === /a.js === /** @typedef {Object. boolean>} Predicates */ +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>n : Symbol(n, Decl(a.js, 0, 31)) const p = /** @satisfies {Predicates} */ ({ >p : Symbol(p, Decl(a.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols.diff new file mode 100644 index 0000000000..9da3a96d3b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols.diff @@ -0,0 +1,11 @@ +--- old.checkJsdocSatisfiesTag2.symbols ++++ new.checkJsdocSatisfiesTag2.symbols +@@= skipped -1, +1 lines =@@ + + === /a.js === + /** @typedef {Object. boolean>} Predicates */ ++>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>n : Symbol(n, Decl(a.js, 0, 31)) + + const p = /** @satisfies {Predicates} */ ({ + >p : Symbol(p, Decl(a.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols index 93b511fee3..10a0d373c8 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols @@ -2,6 +2,8 @@ === /a.js === /** @typedef {{ move(distance: number): void }} Movable */ +>move : Symbol(move, Decl(a.js, 0, 15)) +>distance : Symbol(distance, Decl(a.js, 0, 21)) const car = /** @satisfies {Movable & Record} */ ({ >car : Symbol(car, Decl(a.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols.diff new file mode 100644 index 0000000000..9e24738eab --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols.diff @@ -0,0 +1,11 @@ +--- old.checkJsdocSatisfiesTag5.symbols ++++ new.checkJsdocSatisfiesTag5.symbols +@@= skipped -1, +1 lines =@@ + + === /a.js === + /** @typedef {{ move(distance: number): void }} Movable */ ++>move : Symbol(move, Decl(a.js, 0, 15)) ++>distance : Symbol(distance, Decl(a.js, 0, 21)) + + const car = /** @satisfies {Movable & Record} */ ({ + >car : Symbol(car, Decl(a.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols index 1f6e6afdbe..8c372d319a 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols @@ -2,6 +2,7 @@ === /a.js === /** @typedef {Object.} Facts */ +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) // Should be able to detect a failure here const x = /** @satisfies {Facts} */ ({ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols.diff new file mode 100644 index 0000000000..9d362ca9db --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols.diff @@ -0,0 +1,10 @@ +--- old.checkJsdocSatisfiesTag8.symbols ++++ new.checkJsdocSatisfiesTag8.symbols +@@= skipped -1, +1 lines =@@ + + === /a.js === + /** @typedef {Object.} Facts */ ++>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + + // Should be able to detect a failure here + const x = /** @satisfies {Facts} */ ({ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols index 3916d709ab..73bc7d93b2 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols @@ -11,6 +11,9 @@ type A = { a: T } /** Also should error for jsdoc typedefs * @template {string} U * @typedef {{ b: U }} B +>b : Symbol(b, Decl(test.js, 2, 14)) +>U : Symbol(U) + */ /** @type {A} */ var a; diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols.diff new file mode 100644 index 0000000000..6713369d09 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols.diff @@ -0,0 +1,12 @@ +--- old.checkJsdocTypeTag4.symbols ++++ new.checkJsdocTypeTag4.symbols +@@= skipped -10, +10 lines =@@ + /** Also should error for jsdoc typedefs + * @template {string} U + * @typedef {{ b: U }} B ++>b : Symbol(b, Decl(test.js, 2, 14)) ++>U : Symbol(U) ++ + */ + /** @type {A} */ + var a; diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols index f6b32107aa..261c84c85b 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols @@ -40,6 +40,8 @@ var k = function (x) { return x } /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ +>x : Symbol(x, Decl(test.js, 16, 15)) + /** @type {Argle} */ function blargle(s) { >blargle : Symbol(blargle, Decl(test.js, 13, 33)) @@ -54,6 +56,8 @@ var zeroonetwo = blargle('hi') >blargle : Symbol(blargle, Decl(test.js, 13, 33)) /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ +>s : Symbol(s, Decl(test.js, 25, 16)) +>b : Symbol(b, Decl(test.js, 25, 36)) /** @type {Gioconda} */ function monaLisa(sb) { diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff new file mode 100644 index 0000000000..f94d15324d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff @@ -0,0 +1,20 @@ +--- old.checkJsdocTypeTag5.symbols ++++ new.checkJsdocTypeTag5.symbols +@@= skipped -39, +39 lines =@@ + + + /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ ++>x : Symbol(x, Decl(test.js, 16, 15)) ++ + /** @type {Argle} */ + function blargle(s) { + >blargle : Symbol(blargle, Decl(test.js, 13, 33)) +@@= skipped -14, +16 lines =@@ + >blargle : Symbol(blargle, Decl(test.js, 13, 33)) + + /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ ++>s : Symbol(s, Decl(test.js, 25, 16)) ++>b : Symbol(b, Decl(test.js, 25, 36)) + + /** @type {Gioconda} */ + function monaLisa(sb) { diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols index 7cc5d38702..9868a91ea5 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols @@ -3,6 +3,9 @@ === test.js === /** * @typedef {(a: string, b: number) => void} Foo +>a : Symbol(a, Decl(test.js, 1, 14)) +>b : Symbol(b, Decl(test.js, 1, 24)) + */ class C { diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols.diff index 4748e16f44..2c9439a9d9 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols.diff @@ -1,6 +1,16 @@ --- old.checkJsdocTypeTag7.symbols +++ new.checkJsdocTypeTag7.symbols -@@= skipped -9, +9 lines =@@ +@@= skipped -2, +2 lines =@@ + === test.js === + /** + * @typedef {(a: string, b: number) => void} Foo ++>a : Symbol(a, Decl(test.js, 1, 14)) ++>b : Symbol(b, Decl(test.js, 1, 24)) ++ + */ + + class C { +@@= skipped -7, +10 lines =@@ /** @type {Foo} */ foo(a, b) {} diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt index 7ca331727c..7cb22b9170 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt @@ -1,11 +1,14 @@ +0.js(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. 0.js(8,9): error TS2339: Property 'SomeName' does not exist on type '{}'. 0.js(10,12): error TS2503: Cannot find namespace 'exports'. -==== 0.js (2 errors) ==== +==== 0.js (3 errors) ==== // @ts-check var exports = {}; + ~~~~~~~ +!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. /** * @typedef {string} diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff index 0874b01b9b..363f19a91b 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff @@ -2,16 +2,20 @@ +++ new.checkJsdocTypedefOnlySourceFile.errors.txt @@= skipped -0, +0 lines =@@ -0.js(10,20): error TS2694: Namespace 'exports' has no exported member 'SomeName'. ++0.js(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. +0.js(8,9): error TS2339: Property 'SomeName' does not exist on type '{}'. +0.js(10,12): error TS2503: Cannot find namespace 'exports'. -==== 0.js (1 errors) ==== -+==== 0.js (2 errors) ==== ++==== 0.js (3 errors) ==== // @ts-check var exports = {}; -@@= skipped -9, +10 lines =@@ ++ ~~~~~~~ ++!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. + + /** * @typedef {string} */ exports.SomeName; diff --git a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols index cb6013b96f..e0ec9b3331 100644 --- a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols @@ -3,7 +3,12 @@ === test.js === /** @typedef {{ status: 'done' +>status : Symbol(status, Decl(test.js, 0, 15)) + m(n: number): void +>m : Symbol(m, Decl(test.js, 1, 18)) +>n : Symbol(n, Decl(test.js, 2, 6)) + }} DoneStatus */ // property assignment diff --git a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols.diff index 593b1bee8f..2ec796dbe0 100644 --- a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols.diff @@ -1,6 +1,16 @@ --- old.contextualTypedSpecialAssignment.symbols +++ new.contextualTypedSpecialAssignment.symbols -@@= skipped -7, +7 lines =@@ +@@= skipped -2, +2 lines =@@ + === test.js === + /** @typedef {{ + status: 'done' ++>status : Symbol(status, Decl(test.js, 0, 15)) ++ + m(n: number): void ++>m : Symbol(m, Decl(test.js, 1, 18)) ++>n : Symbol(n, Decl(test.js, 2, 6)) ++ + }} DoneStatus */ // property assignment var ns = {} @@ -16,7 +26,7 @@ status: 'done', >status : Symbol(status, Decl(test.js, 8, 8)) -@@= skipped -17, +15 lines =@@ +@@= skipped -22, +25 lines =@@ } ns.x = { diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols b/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols index 252ac152b9..56c1dbebd0 100644 --- a/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols +++ b/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols @@ -4,7 +4,11 @@ /** * @typedef {{ * a: number | string; +>a : Symbol(a, Decl(a.js, 1, 14)) + * b: boolean | string[]; +>b : Symbol(b, Decl(a.js, 2, 25)) + * }} Foo */ diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols.diff b/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols.diff new file mode 100644 index 0000000000..55fc2ac800 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols.diff @@ -0,0 +1,14 @@ +--- old.extendsTag5.symbols ++++ new.extendsTag5.symbols +@@= skipped -3, +3 lines =@@ + /** + * @typedef {{ + * a: number | string; ++>a : Symbol(a, Decl(a.js, 1, 14)) ++ + * b: boolean | string[]; ++>b : Symbol(b, Decl(a.js, 2, 25)) ++ + * }} Foo + */ + diff --git a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols index a4a47e30e7..3cdc6da6e7 100644 --- a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols +++ b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols @@ -26,6 +26,7 @@ import { writeFile, WriteFileOptions, WriteFileOptions as OtherName } from "fs"; >OtherName : Symbol(OtherName, Decl(index.js, 0, 37)) /** @typedef {{ x: any }} JSDocType */ +>x : Symbol(x, Decl(index.js, 2, 15)) export { JSDocType }; >JSDocType : Symbol(JSDocType, Decl(index.js, 4, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff index 5f1a636aa1..543ceb9cb7 100644 --- a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff @@ -1,7 +1,10 @@ --- old.importingExportingTypes.symbols +++ new.importingExportingTypes.symbols -@@= skipped -27, +27 lines =@@ +@@= skipped -25, +25 lines =@@ + >OtherName : Symbol(OtherName, Decl(index.js, 0, 37)) + /** @typedef {{ x: any }} JSDocType */ ++>x : Symbol(x, Decl(index.js, 2, 15)) export { JSDocType }; ->JSDocType : Symbol(JSDocType, Decl(index.js, 4, 8), Decl(index.js, 2, 4)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols index f27ae66370..e6f2038355 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols @@ -17,6 +17,8 @@ module.exports = Timer; === hook.js === /** * @typedef {(arg: import("./context")) => void} HookHandler +>arg : Symbol(arg, Decl(hook.js, 1, 14)) + */ /** * @param {HookHandler} handle @@ -45,7 +47,11 @@ module.exports = Hook; * * @typedef {Object} Input * @prop {Timer} timer +>Timer : Symbol(Timer) + * @prop {Hook} hook +>Hook : Symbol(Hook) + */ /** @@ -53,7 +59,11 @@ module.exports = Hook; * * @typedef {Object} State * @prop {Timer} timer +>Timer : Symbol(Timer) + * @prop {Hook} hook +>Hook : Symbol(Hook) + */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff index 02b65ce5ed..54527982ea 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff @@ -16,7 +16,14 @@ >Timer : Symbol(Timer, Decl(timer.js, 0, 0)) === hook.js === -@@= skipped -23, +17 lines =@@ + /** + * @typedef {(arg: import("./context")) => void} HookHandler ++>arg : Symbol(arg, Decl(hook.js, 1, 14)) ++ + */ + /** + * @param {HookHandler} handle +@@= skipped -23, +19 lines =@@ >handle : Symbol(handle, Decl(hook.js, 6, 14)) this.handle = handle; @@ -32,7 +39,31 @@ >Hook : Symbol(Hook, Decl(hook.js, 0, 0)) === context.js === -@@= skipped -44, +38 lines =@@ +@@= skipped -25, +19 lines =@@ + * + * @typedef {Object} Input + * @prop {Timer} timer ++>Timer : Symbol(Timer) ++ + * @prop {Hook} hook ++>Hook : Symbol(Hook) ++ + */ + + /** +@@= skipped -8, +12 lines =@@ + * + * @typedef {Object} State + * @prop {Timer} timer ++>Timer : Symbol(Timer) ++ + * @prop {Hook} hook ++>Hook : Symbol(Hook) ++ + */ + + /** +@@= skipped -11, +15 lines =@@ */ function Context(input) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols index 87592a7b6d..bf07a2414f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols @@ -13,14 +13,23 @@ const myTypes = { }; /** @typedef {string|RegExp|Array} myTypes.typeA */ +>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) /** * @typedef myTypes.typeB * @property {myTypes.typeA} prop1 - Prop 1. +>myTypes : Symbol(myTypes) +>typeA : Symbol(typeA) + * @property {string} prop2 - Prop 2. */ /** @typedef {myTypes.typeB|Function} myTypes.typeC */ +>myTypes : Symbol(myTypes) +>typeB : Symbol(typeB) +>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) export {myTypes}; >myTypes : Symbol(myTypes, Decl(file.js, 19, 8)) @@ -41,6 +50,8 @@ const testFnTypes = { }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ +>myTypes : Symbol(myTypes) +>typeC : Symbol(typeC) /** * @function testFn diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff index 899803d93f..592365622d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff @@ -9,8 +9,25 @@ // SOME PROPS HERE }; -@@= skipped -16, +16 lines =@@ + + /** @typedef {string|RegExp|Array} myTypes.typeA */ ++>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ++>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ++>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + + /** + * @typedef myTypes.typeB + * @property {myTypes.typeA} prop1 - Prop 1. ++>myTypes : Symbol(myTypes) ++>typeA : Symbol(typeA) ++ + * @property {string} prop2 - Prop 2. + */ + /** @typedef {myTypes.typeB|Function} myTypes.typeC */ ++>myTypes : Symbol(myTypes) ++>typeB : Symbol(typeB) ++>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) export {myTypes}; ->myTypes : Symbol(myTypes, Decl(file.js, 19, 8), Decl(file.js, 9, 50), Decl(file.js, 12, 12), Decl(file.js, 17, 38)) @@ -18,7 +35,7 @@ === file2.js === import {myTypes} from './file.js'; -@@= skipped -12, +12 lines =@@ +@@= skipped -28, +37 lines =@@ * @type {Object} */ const testFnTypes = { @@ -27,7 +44,14 @@ // SOME PROPS HERE }; -@@= skipped -30, +30 lines =@@ + + /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ++>myTypes : Symbol(myTypes) ++>typeC : Symbol(typeC) + + /** + * @function testFn +@@= skipped -30, +32 lines =@@ export {testFn, testFnTypes}; >testFn : Symbol(testFn, Decl(file2.js, 27, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols index af5a591be3..c4007470cd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols @@ -16,6 +16,8 @@ const testFnTypes = { }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ +>myTypes : Symbol(myTypes) +>typeC : Symbol(typeC) /** * @function testFn diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff index e980ea1876..39f50edfe5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff @@ -18,7 +18,14 @@ // SOME PROPS HERE }; -@@= skipped -29, +29 lines =@@ + + /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ++>myTypes : Symbol(myTypes) ++>typeC : Symbol(typeC) + + /** + * @function testFn +@@= skipped -29, +31 lines =@@ } module.exports = {testFn, testFnTypes}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt index 406d5be914..16ceee1f85 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt @@ -1,6 +1,5 @@ folder/mod1.js(5,11): error TS2304: Cannot find name 'Item'. folder/mod1.js(8,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -index.js(1,27): error TS2306: File 'folder/mod1.js' is not a module. index.js(3,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -17,10 +16,8 @@ index.js(3,1): error TS2580: Cannot find name 'module'. Do you need to install t module.exports = x; ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== /** @type {(typeof import("./folder/mod1"))[]} */ - ~~~~~~~~~~~~~~~ -!!! error TS2306: File 'folder/mod1.js' is not a module. const items = [{x: 12}]; module.exports = items; ~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff index 25f9240c08..e2caeaacf5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff @@ -5,7 +5,6 @@ @@= skipped --1, +1 lines =@@ +folder/mod1.js(5,11): error TS2304: Cannot find name 'Item'. +folder/mod1.js(8,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+index.js(1,27): error TS2306: File 'folder/mod1.js' is not a module. +index.js(3,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + @@ -22,10 +21,8 @@ + module.exports = x; + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+==== index.js (2 errors) ==== ++==== index.js (1 errors) ==== + /** @type {(typeof import("./folder/mod1"))[]} */ -+ ~~~~~~~~~~~~~~~ -+!!! error TS2306: File 'folder/mod1.js' is not a module. + const items = [{x: 12}]; + module.exports = items; + ~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols index da7ddca71e..84fead8e32 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols @@ -3,6 +3,8 @@ === folder/mod1.js === /** * @typedef {{x: number}} Item +>x : Symbol(x, Decl(mod1.js, 1, 14)) + */ /** * @type {Item}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff index 4b85a14daa..dce5d2e782 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff @@ -1,6 +1,15 @@ --- old.jsDeclarationsImportTypeBundled.symbols +++ new.jsDeclarationsImportTypeBundled.symbols -@@= skipped -11, +11 lines =@@ +@@= skipped -2, +2 lines =@@ + === folder/mod1.js === + /** + * @typedef {{x: number}} Item ++>x : Symbol(x, Decl(mod1.js, 1, 14)) ++ + */ + /** + * @type {Item}; +@@= skipped -9, +11 lines =@@ >x : Symbol(x, Decl(mod1.js, 6, 11)) module.exports = x; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols index db15a82914..d2fa51821d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols @@ -32,6 +32,10 @@ export {}; // flag file as module === mixed.js === /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType +>x : Symbol(x, Decl(mixed.js, 1, 14)) +>LocalThing : Symbol(LocalThing, Decl(mixed.js, 16, 2)) +>ExportedThing : Symbol(ExportedThing, Decl(mixed.js, 9, 1)) + */ /** * @param {number} x diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff index deb9304353..a9f2e25ef6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff @@ -1,6 +1,17 @@ --- old.jsDeclarationsTypeAliases.symbols +++ new.jsDeclarationsTypeAliases.symbols -@@= skipped -48, +48 lines =@@ +@@= skipped -31, +31 lines =@@ + === mixed.js === + /** + * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType ++>x : Symbol(x, Decl(mixed.js, 1, 14)) ++>LocalThing : Symbol(LocalThing, Decl(mixed.js, 16, 2)) ++>ExportedThing : Symbol(ExportedThing, Decl(mixed.js, 9, 1)) ++ + */ + /** + * @param {number} x +@@= skipped -17, +21 lines =@@ >ExportedThing : Symbol(ExportedThing, Decl(mixed.js, 9, 1)) z = "ok" diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt index c077de5eb6..bb5abdfa34 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt @@ -1,4 +1,5 @@ conn.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +usage.js(7,16): error TS2304: Cannot find name 'Conn'. usage.js(10,14): error TS2339: Property 'connItem' does not exist on type 'Wrap'. usage.js(12,14): error TS2339: Property 'another' does not exist on type 'Wrap'. usage.js(16,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -19,7 +20,7 @@ usage.js(16,1): error TS2580: Cannot find name 'module'. Do you need to install ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== usage.js (3 errors) ==== +==== usage.js (4 errors) ==== /** * @typedef {import("./conn")} Conn */ @@ -27,6 +28,8 @@ usage.js(16,1): error TS2580: Cannot find name 'module'. Do you need to install class Wrap { /** * @param {Conn} c + ~~~~ +!!! error TS2304: Cannot find name 'Conn'. */ constructor(c) { this.connItem = c.item; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff index 4e172cc4ee..add040f1db 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff @@ -4,6 +4,7 @@ - @@= skipped --1, +1 lines =@@ +conn.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++usage.js(7,16): error TS2304: Cannot find name 'Conn'. +usage.js(10,14): error TS2339: Property 'connItem' does not exist on type 'Wrap'. +usage.js(12,14): error TS2339: Property 'another' does not exist on type 'Wrap'. +usage.js(16,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -24,7 +25,7 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== usage.js (3 errors) ==== ++==== usage.js (4 errors) ==== + /** + * @typedef {import("./conn")} Conn + */ @@ -32,6 +33,8 @@ + class Wrap { + /** + * @param {Conn} c ++ ~~~~ ++!!! error TS2304: Cannot find name 'Conn'. + */ + constructor(c) { + this.connItem = c.item; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols index c7958eb3b6..4f556a9e04 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols @@ -35,9 +35,7 @@ class Wrap { this.connItem = c.item; >this : Symbol(Wrap, Decl(usage.js, 0, 0)) ->c.item : Symbol(item, Decl(conn.js, 5, 20)) >c : Symbol(c, Decl(usage.js, 8, 16)) ->item : Symbol(item, Decl(conn.js, 5, 20)) /** @type {import("./conn").Whatever} */ this.another = ""; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff index 47d306356e..a1525e8dbc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff @@ -27,10 +27,8 @@ >this : Symbol(Wrap, Decl(usage.js, 0, 0)) ->connItem : Symbol(Wrap.connItem, Decl(usage.js, 8, 20)) ->c.item : Symbol(Conn.item, Decl(conn.js, 5, 20)) -+>c.item : Symbol(item, Decl(conn.js, 5, 20)) >c : Symbol(c, Decl(usage.js, 8, 16)) ->item : Symbol(Conn.item, Decl(conn.js, 5, 20)) -+>item : Symbol(item, Decl(conn.js, 5, 20)) /** @type {import("./conn").Whatever} */ this.another = ""; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt index 6680a9938d..48fc6a2824 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt @@ -1,16 +1,10 @@ -LazySet.js(5,7): error TS2451: Cannot redeclare block-scoped variable 'LazySet'. -LazySet.js(7,16): error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? LazySet.js(13,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -index.js(1,7): error TS2451: Cannot redeclare block-scoped variable 'LazySet'. index.js(1,17): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(3,12): error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? -==== index.js (3 errors) ==== +==== index.js (2 errors) ==== const LazySet = require("./LazySet"); - ~~~~~~~ -!!! error TS2451: Cannot redeclare block-scoped variable 'LazySet'. -!!! related TS6203 LazySet.js:5:7: 'LazySet' was also declared here. ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -21,19 +15,14 @@ index.js(3,12): error TS2749: 'LazySet' refers to a value, but is being used as stringSet.addAll(stringSet); -==== LazySet.js (3 errors) ==== +==== LazySet.js (1 errors) ==== // Comment out this JSDoc, and note that the errors index.js go away. /** * @typedef {Object} SomeObject */ class LazySet { - ~~~~~~~ -!!! error TS2451: Cannot redeclare block-scoped variable 'LazySet'. -!!! related TS6203 index.js:1:7: 'LazySet' was also declared here. /** * @param {LazySet} iterable - ~~~~~~~ -!!! error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? */ addAll(iterable) {} [Symbol.iterator]() {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff index ca7d752e92..e8f0b635bd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff @@ -3,19 +3,13 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+LazySet.js(5,7): error TS2451: Cannot redeclare block-scoped variable 'LazySet'. -+LazySet.js(7,16): error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? +LazySet.js(13,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+index.js(1,7): error TS2451: Cannot redeclare block-scoped variable 'LazySet'. +index.js(1,17): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(3,12): error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? + + -+==== index.js (3 errors) ==== ++==== index.js (2 errors) ==== + const LazySet = require("./LazySet"); -+ ~~~~~~~ -+!!! error TS2451: Cannot redeclare block-scoped variable 'LazySet'. -+!!! related TS6203 LazySet.js:5:7: 'LazySet' was also declared here. + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + @@ -26,19 +20,14 @@ + stringSet.addAll(stringSet); + + -+==== LazySet.js (3 errors) ==== ++==== LazySet.js (1 errors) ==== + // Comment out this JSDoc, and note that the errors index.js go away. + /** + * @typedef {Object} SomeObject + */ + class LazySet { -+ ~~~~~~~ -+!!! error TS2451: Cannot redeclare block-scoped variable 'LazySet'. -+!!! related TS6203 index.js:1:7: 'LazySet' was also declared here. + /** + * @param {LazySet} iterable -+ ~~~~~~~ -+!!! error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? + */ + addAll(iterable) {} + [Symbol.iterator]() {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols index e450a3836b..9028164243 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols @@ -18,6 +18,8 @@ stringSet.addAll(stringSet); // Comment out this JSDoc, and note that the errors index.js go away. /** * @typedef {Object} SomeObject +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + */ class LazySet { >LazySet : Symbol(LazySet, Decl(LazySet.js, 0, 0)) @@ -37,5 +39,5 @@ class LazySet { } module.exports = LazySet; ->LazySet : Symbol(LazySet, Decl(index.js, 0, 5)) +>LazySet : Symbol(LazySet, Decl(LazySet.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff index 0fd3b215f7..78bddf8bcf 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff @@ -19,7 +19,16 @@ >stringSet : Symbol(stringSet, Decl(index.js, 3, 5)) -@@= skipped -18, +16 lines =@@ +@@= skipped -10, +8 lines =@@ + // Comment out this JSDoc, and note that the errors index.js go away. + /** + * @typedef {Object} SomeObject ++>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++ + */ + class LazySet { + >LazySet : Symbol(LazySet, Decl(LazySet.js, 0, 0)) +@@= skipped -8, +10 lines =@@ * @param {LazySet} iterable */ addAll(iterable) {} @@ -41,6 +50,5 @@ ->module.exports : Symbol(module.exports, Decl(LazySet.js, 0, 0)) ->module : Symbol(export=, Decl(LazySet.js, 10, 1)) ->exports : Symbol(export=, Decl(LazySet.js, 10, 1)) -->LazySet : Symbol(LazySet, Decl(LazySet.js, 0, 0)) -+>LazySet : Symbol(LazySet, Decl(index.js, 0, 5)) + >LazySet : Symbol(LazySet, Decl(LazySet.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols index 3db734f68d..986a4941e4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols @@ -4,6 +4,10 @@ /** * @typedef {{ * [id: string]: [Function, Function]; +>id : Symbol(id, Decl(foo.js, 2, 6)) +>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) + * }} ResolveRejectMap */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols.diff new file mode 100644 index 0000000000..348578b5a4 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols.diff @@ -0,0 +1,13 @@ +--- old.jsDeclarationsTypedefFunction.symbols ++++ new.jsDeclarationsTypedefFunction.symbols +@@= skipped -3, +3 lines =@@ + /** + * @typedef {{ + * [id: string]: [Function, Function]; ++>id : Symbol(id, Decl(foo.js, 2, 6)) ++>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) ++>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) ++ + * }} ResolveRejectMap + */ + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols index e18f140418..124611b867 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols @@ -10,11 +10,21 @@ const {taskGroups, taskNameToGroup} = require('./module.js'); /** * @typedef TaskNode * @prop {TaskNode[]} children +>TaskNode : Symbol(TaskNode) + * @prop {TaskNode|undefined} parent +>TaskNode : Symbol(TaskNode) + * @prop {TaskGroup} group +>TaskGroup : Symbol(TaskGroup) + */ /** @typedef {{timers: Map}} PriorTaskData */ +>timers : Symbol(timers, Decl(index.js, 11, 15)) +>Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>TaskNode : Symbol(TaskNode) + class MainThreadTasks { >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff index c196b877bd..2a6bb3e4ad 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff @@ -9,7 +9,28 @@ /** @typedef {import('./module.js').TaskGroup} TaskGroup */ -@@= skipped -26, +24 lines =@@ + /** + * @typedef TaskNode + * @prop {TaskNode[]} children ++>TaskNode : Symbol(TaskNode) ++ + * @prop {TaskNode|undefined} parent ++>TaskNode : Symbol(TaskNode) ++ + * @prop {TaskGroup} group ++>TaskGroup : Symbol(TaskGroup) ++ + */ + + /** @typedef {{timers: Map}} PriorTaskData */ ++>timers : Symbol(timers, Decl(index.js, 11, 15)) ++>Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ++>TaskNode : Symbol(TaskNode) ++ + class MainThreadTasks { + >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) + +@@= skipped -26, +34 lines =@@ } module.exports = MainThreadTasks; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols index 7d58faf926..bad5d6e2f2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols @@ -4,12 +4,20 @@ /** * @template T * @typedef {(t: T) => T} Id +>t : Symbol(t, Decl(templateTagOnClasses.js, 2, 14)) +>T : Symbol(T) +>T : Symbol(T) + */ /** @template T */ class Foo { >Foo : Symbol(Foo, Decl(templateTagOnClasses.js, 0, 0)) /** @typedef {(t: T) => T} Id2 */ +>t : Symbol(t, Decl(templateTagOnClasses.js, 6, 19)) +>T : Symbol(T) +>T : Symbol(T) + /** @param {T} x */ constructor (x) { >x : Symbol(x, Decl(templateTagOnClasses.js, 8, 17)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff index 9cdeba9d93..108cc9a934 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff @@ -1,6 +1,25 @@ --- old.jsdocTemplateClass.symbols +++ new.jsdocTemplateClass.symbols -@@= skipped -14, +14 lines =@@ +@@= skipped -3, +3 lines =@@ + /** + * @template T + * @typedef {(t: T) => T} Id ++>t : Symbol(t, Decl(templateTagOnClasses.js, 2, 14)) ++>T : Symbol(T) ++>T : Symbol(T) ++ + */ + /** @template T */ + class Foo { + >Foo : Symbol(Foo, Decl(templateTagOnClasses.js, 0, 0)) + + /** @typedef {(t: T) => T} Id2 */ ++>t : Symbol(t, Decl(templateTagOnClasses.js, 6, 19)) ++>T : Symbol(T) ++>T : Symbol(T) ++ + /** @param {T} x */ + constructor (x) { >x : Symbol(x, Decl(templateTagOnClasses.js, 8, 17)) this.a = x @@ -10,7 +29,7 @@ >x : Symbol(x, Decl(templateTagOnClasses.js, 8, 17)) } /** -@@= skipped -13, +11 lines =@@ +@@= skipped -24, +30 lines =@@ * @return {T} */ foo(x, y, alpha) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols index 1506ef41bc..46eca8fe8f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols @@ -4,6 +4,10 @@ /** * @template U * @typedef {(u: U) => U} Id +>u : Symbol(u, Decl(templateTagOnConstructorFunctions.js, 2, 14)) +>U : Symbol(U) +>U : Symbol(U) + */ /** * @param {T} t diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff index f5ca3a221d..c828738a3a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff @@ -1,6 +1,17 @@ --- old.jsdocTemplateConstructorFunction.symbols +++ new.jsdocTemplateConstructorFunction.symbols -@@= skipped -14, +14 lines =@@ +@@= skipped -3, +3 lines =@@ + /** + * @template U + * @typedef {(u: U) => U} Id ++>u : Symbol(u, Decl(templateTagOnConstructorFunctions.js, 2, 14)) ++>U : Symbol(U) ++>U : Symbol(U) ++ + */ + /** + * @param {T} t +@@= skipped -11, +15 lines =@@ /** @type {T} */ this.u diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols index 96c138e344..37652f67ec 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols @@ -52,6 +52,8 @@ let answer = z.add(3, { nested: 4 }) /** * @typedef {Object} A * @property {T} value +>T : Symbol(T) + */ /** @type {A} */ const options = { value: null }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols.diff index 8e6b8db528..46273a26b7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols.diff @@ -69,3 +69,11 @@ >nested : Symbol(nested, Decl(templateTagWithNestedTypeLiteral.js, 22, 23)) // lookup in typedef should not crash the compiler, even when the type is unknown + /** + * @typedef {Object} A + * @property {T} value ++>T : Symbol(T) ++ + */ + /** @type {A} */ + const options = { value: null }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols index 2d734a70fb..3f1baaa218 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols @@ -4,6 +4,8 @@ /** * @template const T * @typedef {[T]} X +>T : Symbol(T) + */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff new file mode 100644 index 0000000000..6c68548995 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff @@ -0,0 +1,11 @@ +--- old.jsdocTemplateTag7.symbols ++++ new.jsdocTemplateTag7.symbols +@@= skipped -3, +3 lines =@@ + /** + * @template const T + * @typedef {[T]} X ++>T : Symbol(T) ++ + */ + + /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols index 5b6d103ed0..534446e1ab 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols @@ -5,6 +5,8 @@ * @template out T * @typedef {Object} Covariant * @property {T} x +>T : Symbol(T) + */ /** @@ -33,6 +35,9 @@ sub_covariant = super_covariant; // Error * @template in T * @typedef {Object} Contravariant * @property {(x: T) => void} f +>x : Symbol(x, Decl(a.js, 22, 15)) +>T : Symbol(T) + */ /** @@ -63,6 +68,10 @@ sub_contravariant = super_contravariant; * @template in out T * @typedef {Object} Invariant * @property {(x: T) => T} f +>x : Symbol(x, Decl(a.js, 41, 15)) +>T : Symbol(T) +>T : Symbol(T) + */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols.diff new file mode 100644 index 0000000000..29b2b01e24 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols.diff @@ -0,0 +1,32 @@ +--- old.jsdocTemplateTag8.symbols ++++ new.jsdocTemplateTag8.symbols +@@= skipped -4, +4 lines =@@ + * @template out T + * @typedef {Object} Covariant + * @property {T} x ++>T : Symbol(T) ++ + */ + + /** +@@= skipped -28, +30 lines =@@ + * @template in T + * @typedef {Object} Contravariant + * @property {(x: T) => void} f ++>x : Symbol(x, Decl(a.js, 22, 15)) ++>T : Symbol(T) ++ + */ + + /** +@@= skipped -30, +33 lines =@@ + * @template in out T + * @typedef {Object} Invariant + * @property {(x: T) => T} f ++>x : Symbol(x, Decl(a.js, 41, 15)) ++>T : Symbol(T) ++>T : Symbol(T) ++ + */ + + /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols index 98d9cea415..12687d3c15 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols @@ -4,6 +4,8 @@ /** * @template {string | number} [T=string] - ok: defaults are permitted * @typedef {[T]} A +>T : Symbol(T) + */ /** @type {A} */ // ok, default for `T` in `A` is `string` @@ -26,28 +28,41 @@ const aNumber = [0]; * @template T * @template [U=T] - ok: default can reference earlier type parameter * @typedef {[T, U]} B +>T : Symbol(T) +>U : Symbol(U) + */ /** * @template {string | number} [T] - error: default requires an `=type` * @typedef {[T]} C +>T : Symbol(T) + */ /** * @template {string | number} [T=] - error: default requires a `type` * @typedef {[T]} D +>T : Symbol(T) + */ /** * @template {string | number} [T=string] * @template U - error: Required type parameters cannot follow optional type parameters * @typedef {[T, U]} E +>T : Symbol(T) +>U : Symbol(U) + */ /** * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. * @template [U=T] * @typedef {[T, U]} G +>T : Symbol(T) +>U : Symbol(U) + */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff new file mode 100644 index 0000000000..0e2a36680b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff @@ -0,0 +1,53 @@ +--- old.jsdocTemplateTagDefault.symbols ++++ new.jsdocTemplateTagDefault.symbols +@@= skipped -3, +3 lines =@@ + /** + * @template {string | number} [T=string] - ok: defaults are permitted + * @typedef {[T]} A ++>T : Symbol(T) ++ + */ + + /** @type {A} */ // ok, default for `T` in `A` is `string` +@@= skipped -22, +24 lines =@@ + * @template T + * @template [U=T] - ok: default can reference earlier type parameter + * @typedef {[T, U]} B ++>T : Symbol(T) ++>U : Symbol(U) ++ + */ + + /** + * @template {string | number} [T] - error: default requires an `=type` + * @typedef {[T]} C ++>T : Symbol(T) ++ + */ + + /** + * @template {string | number} [T=] - error: default requires a `type` + * @typedef {[T]} D ++>T : Symbol(T) ++ + */ + + /** + * @template {string | number} [T=string] + * @template U - error: Required type parameters cannot follow optional type parameters + * @typedef {[T, U]} E ++>T : Symbol(T) ++>U : Symbol(U) ++ + */ + + /** + * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. + * @template [U=T] + * @typedef {[T, U]} G ++>T : Symbol(T) ++>U : Symbol(U) ++ + */ + + /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols index e1f0a0b044..a65a7c4a62 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols @@ -5,6 +5,9 @@ * @template T * @template {keyof T} K * @typedef {T[K]} Foo +>T : Symbol(T) +>K : Symbol(K) + */ const x = { a: 1 }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols.diff new file mode 100644 index 0000000000..2e9a386cb4 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols.diff @@ -0,0 +1,12 @@ +--- old.jsdocTemplateTagNameResolution.symbols ++++ new.jsdocTemplateTagNameResolution.symbols +@@= skipped -4, +4 lines =@@ + * @template T + * @template {keyof T} K + * @typedef {T[K]} Foo ++>T : Symbol(T) ++>K : Symbol(K) ++ + */ + + const x = { a: 1 }; diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt index 3404f81511..7eb2acf3dd 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt @@ -1,31 +1,31 @@ -index.ts(2,15): error TS2306: File 'mod.js' is not a module. -index.ts(3,15): error TS2306: File 'mod.js' is not a module. -index.ts(4,15): error TS2306: File 'mod.js' is not a module. -index.ts(5,15): error TS2306: File 'mod.js' is not a module. -index.ts(6,15): error TS2306: File 'mod.js' is not a module. -index.ts(7,15): error TS2306: File 'mod.js' is not a module. -index.ts(8,15): error TS2306: File 'mod.js' is not a module. -index.ts(14,22): error TS2306: File 'mod.js' is not a module. -index.ts(15,22): error TS2306: File 'mod.js' is not a module. -index.ts(16,22): error TS2306: File 'mod.js' is not a module. -index.ts(17,22): error TS2306: File 'mod.js' is not a module. -index.ts(18,22): error TS2306: File 'mod.js' is not a module. -index.ts(19,22): error TS2306: File 'mod.js' is not a module. -index.ts(20,22): error TS2306: File 'mod.js' is not a module. -main.js(2,19): error TS2306: File 'mod.js' is not a module. -main.js(3,19): error TS2306: File 'mod.js' is not a module. -main.js(4,19): error TS2306: File 'mod.js' is not a module. -main.js(5,19): error TS2306: File 'mod.js' is not a module. -main.js(6,19): error TS2306: File 'mod.js' is not a module. -main.js(7,19): error TS2306: File 'mod.js' is not a module. -main.js(8,19): error TS2306: File 'mod.js' is not a module. -main.js(15,26): error TS2306: File 'mod.js' is not a module. -main.js(16,26): error TS2306: File 'mod.js' is not a module. -main.js(17,26): error TS2306: File 'mod.js' is not a module. -main.js(18,26): error TS2306: File 'mod.js' is not a module. -main.js(19,26): error TS2306: File 'mod.js' is not a module. -main.js(20,26): error TS2306: File 'mod.js' is not a module. -main.js(21,26): error TS2306: File 'mod.js' is not a module. +index.ts(2,24): error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. +index.ts(3,24): error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. +index.ts(4,24): error TS2694: Namespace '""mod.js""' has no exported member 'foo'. +index.ts(5,24): error TS2694: Namespace '""mod.js""' has no exported member 'qux'. +index.ts(6,24): error TS2694: Namespace '""mod.js""' has no exported member 'baz'. +index.ts(7,24): error TS2694: Namespace '""mod.js""' has no exported member 'buz'. +index.ts(8,24): error TS2694: Namespace '""mod.js""' has no exported member 'literal'. +index.ts(14,31): error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. +index.ts(15,31): error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. +index.ts(16,31): error TS2694: Namespace '""mod.js""' has no exported member 'foo'. +index.ts(17,31): error TS2694: Namespace '""mod.js""' has no exported member 'qux'. +index.ts(18,31): error TS2694: Namespace '""mod.js""' has no exported member 'baz'. +index.ts(19,31): error TS2694: Namespace '""mod.js""' has no exported member 'buz'. +index.ts(20,31): error TS2694: Namespace '""mod.js""' has no exported member 'literal'. +main.js(2,28): error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. +main.js(3,28): error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. +main.js(4,28): error TS2694: Namespace '""mod.js""' has no exported member 'foo'. +main.js(5,28): error TS2694: Namespace '""mod.js""' has no exported member 'qux'. +main.js(6,28): error TS2694: Namespace '""mod.js""' has no exported member 'baz'. +main.js(7,28): error TS2694: Namespace '""mod.js""' has no exported member 'buz'. +main.js(8,28): error TS2694: Namespace '""mod.js""' has no exported member 'literal'. +main.js(15,35): error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. +main.js(16,35): error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. +main.js(17,35): error TS2694: Namespace '""mod.js""' has no exported member 'foo'. +main.js(18,35): error TS2694: Namespace '""mod.js""' has no exported member 'qux'. +main.js(19,35): error TS2694: Namespace '""mod.js""' has no exported member 'baz'. +main.js(20,35): error TS2694: Namespace '""mod.js""' has no exported member 'buz'. +main.js(21,35): error TS2694: Namespace '""mod.js""' has no exported member 'literal'. mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -48,26 +48,26 @@ mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install typ ==== main.js (14 errors) ==== /** * @param {import("./mod").Thing} a - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. * @param {import("./mod").AnotherThing} b - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~~~~~~~~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. * @param {import("./mod").foo} c - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'foo'. * @param {import("./mod").qux} d - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'qux'. * @param {import("./mod").baz} e - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'baz'. * @param {import("./mod").buz} f - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'buz'. * @param {import("./mod").literal} g - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~~~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'literal'. */ function jstypes(a, b, c, d, e, f, g) { return a.x + b.y + c() + d() + e() + f() + g.length @@ -75,26 +75,26 @@ mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install typ /** * @param {typeof import("./mod").Thing} a - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. * @param {typeof import("./mod").AnotherThing} b - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~~~~~~~~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. * @param {typeof import("./mod").foo} c - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'foo'. * @param {typeof import("./mod").qux} d - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'qux'. * @param {typeof import("./mod").baz} e - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'baz'. * @param {typeof import("./mod").buz} f - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'buz'. * @param {typeof import("./mod").literal} g - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~~~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'literal'. */ function jsvalues(a, b, c, d, e, f, g) { return a.length + b.length + c() + d() + e() + f() + g.length @@ -103,52 +103,52 @@ mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install typ ==== index.ts (14 errors) ==== function types( a: import('./mod').Thing, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. b: import('./mod').AnotherThing, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~~~~~~~~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. c: import('./mod').foo, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'foo'. d: import('./mod').qux, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'qux'. e: import('./mod').baz, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'baz'. f: import('./mod').buz, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'buz'. g: import('./mod').literal, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~~~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'literal'. ) { return a.x + b.y + c() + d() + e() + f() + g.length } function values( a: typeof import('./mod').Thing, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. b: typeof import('./mod').AnotherThing, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~~~~~~~~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. c: typeof import('./mod').foo, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'foo'. d: typeof import('./mod').qux, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'qux'. e: typeof import('./mod').baz, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'baz'. f: typeof import('./mod').buz, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'buz'. g: typeof import('./mod').literal, - ~~~~~~~ -!!! error TS2306: File 'mod.js' is not a module. + ~~~~~~~ +!!! error TS2694: Namespace '""mod.js""' has no exported member 'literal'. ) { return a.length + b.length + c() + d() + e() + f() + g.length } diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff index 5ca6b7c131..885816d0c6 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff @@ -9,34 +9,34 @@ -index.ts(8,24): error TS2694: Namespace '"mod".export=' has no exported member 'literal'. -index.ts(19,31): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. -main.js(20,35): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. -+index.ts(2,15): error TS2306: File 'mod.js' is not a module. -+index.ts(3,15): error TS2306: File 'mod.js' is not a module. -+index.ts(4,15): error TS2306: File 'mod.js' is not a module. -+index.ts(5,15): error TS2306: File 'mod.js' is not a module. -+index.ts(6,15): error TS2306: File 'mod.js' is not a module. -+index.ts(7,15): error TS2306: File 'mod.js' is not a module. -+index.ts(8,15): error TS2306: File 'mod.js' is not a module. -+index.ts(14,22): error TS2306: File 'mod.js' is not a module. -+index.ts(15,22): error TS2306: File 'mod.js' is not a module. -+index.ts(16,22): error TS2306: File 'mod.js' is not a module. -+index.ts(17,22): error TS2306: File 'mod.js' is not a module. -+index.ts(18,22): error TS2306: File 'mod.js' is not a module. -+index.ts(19,22): error TS2306: File 'mod.js' is not a module. -+index.ts(20,22): error TS2306: File 'mod.js' is not a module. -+main.js(2,19): error TS2306: File 'mod.js' is not a module. -+main.js(3,19): error TS2306: File 'mod.js' is not a module. -+main.js(4,19): error TS2306: File 'mod.js' is not a module. -+main.js(5,19): error TS2306: File 'mod.js' is not a module. -+main.js(6,19): error TS2306: File 'mod.js' is not a module. -+main.js(7,19): error TS2306: File 'mod.js' is not a module. -+main.js(8,19): error TS2306: File 'mod.js' is not a module. -+main.js(15,26): error TS2306: File 'mod.js' is not a module. -+main.js(16,26): error TS2306: File 'mod.js' is not a module. -+main.js(17,26): error TS2306: File 'mod.js' is not a module. -+main.js(18,26): error TS2306: File 'mod.js' is not a module. -+main.js(19,26): error TS2306: File 'mod.js' is not a module. -+main.js(20,26): error TS2306: File 'mod.js' is not a module. -+main.js(21,26): error TS2306: File 'mod.js' is not a module. ++index.ts(2,24): error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. ++index.ts(3,24): error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. ++index.ts(4,24): error TS2694: Namespace '""mod.js""' has no exported member 'foo'. ++index.ts(5,24): error TS2694: Namespace '""mod.js""' has no exported member 'qux'. ++index.ts(6,24): error TS2694: Namespace '""mod.js""' has no exported member 'baz'. ++index.ts(7,24): error TS2694: Namespace '""mod.js""' has no exported member 'buz'. ++index.ts(8,24): error TS2694: Namespace '""mod.js""' has no exported member 'literal'. ++index.ts(14,31): error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. ++index.ts(15,31): error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. ++index.ts(16,31): error TS2694: Namespace '""mod.js""' has no exported member 'foo'. ++index.ts(17,31): error TS2694: Namespace '""mod.js""' has no exported member 'qux'. ++index.ts(18,31): error TS2694: Namespace '""mod.js""' has no exported member 'baz'. ++index.ts(19,31): error TS2694: Namespace '""mod.js""' has no exported member 'buz'. ++index.ts(20,31): error TS2694: Namespace '""mod.js""' has no exported member 'literal'. ++main.js(2,28): error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. ++main.js(3,28): error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. ++main.js(4,28): error TS2694: Namespace '""mod.js""' has no exported member 'foo'. ++main.js(5,28): error TS2694: Namespace '""mod.js""' has no exported member 'qux'. ++main.js(6,28): error TS2694: Namespace '""mod.js""' has no exported member 'baz'. ++main.js(7,28): error TS2694: Namespace '""mod.js""' has no exported member 'buz'. ++main.js(8,28): error TS2694: Namespace '""mod.js""' has no exported member 'literal'. ++main.js(15,35): error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. ++main.js(16,35): error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. ++main.js(17,35): error TS2694: Namespace '""mod.js""' has no exported member 'foo'. ++main.js(18,35): error TS2694: Namespace '""mod.js""' has no exported member 'qux'. ++main.js(19,35): error TS2694: Namespace '""mod.js""' has no exported member 'baz'. ++main.js(20,35): error TS2694: Namespace '""mod.js""' has no exported member 'buz'. ++main.js(21,35): error TS2694: Namespace '""mod.js""' has no exported member 'literal'. +mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -61,26 +61,26 @@ +==== main.js (14 errors) ==== /** * @param {import("./mod").Thing} a -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. * @param {import("./mod").AnotherThing} b -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~~~~~~~~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. * @param {import("./mod").foo} c -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'foo'. * @param {import("./mod").qux} d -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'qux'. * @param {import("./mod").baz} e -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'baz'. * @param {import("./mod").buz} f -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'buz'. * @param {import("./mod").literal} g -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~~~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'literal'. */ function jstypes(a, b, c, d, e, f, g) { return a.x + b.y + c() + d() + e() + f() + g.length @@ -88,28 +88,27 @@ /** * @param {typeof import("./mod").Thing} a -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. * @param {typeof import("./mod").AnotherThing} b -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~~~~~~~~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. * @param {typeof import("./mod").foo} c -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'foo'. * @param {typeof import("./mod").qux} d -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'qux'. * @param {typeof import("./mod").baz} e -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'baz'. * @param {typeof import("./mod").buz} f -- ~~~ + ~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'buz'. -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'buz'. * @param {typeof import("./mod").literal} g -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~~~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'literal'. */ function jsvalues(a, b, c, d, e, f, g) { return a.length + b.length + c() + d() + e() + f() + g.length @@ -119,66 +118,59 @@ +==== index.ts (14 errors) ==== function types( a: import('./mod').Thing, -- ~~~~~ + ~~~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'Thing'. -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. b: import('./mod').AnotherThing, -- ~~~~~~~~~~~~ + ~~~~~~~~~~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'AnotherThing'. -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. c: import('./mod').foo, -- ~~~ + ~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'foo'. -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'foo'. d: import('./mod').qux, -- ~~~ + ~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'qux'. -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'qux'. e: import('./mod').baz, -- ~~~ + ~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'baz'. -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'baz'. f: import('./mod').buz, -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'buz'. g: import('./mod').literal, -- ~~~~~~~ + ~~~~~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'literal'. -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'literal'. ) { return a.x + b.y + c() + d() + e() + f() + g.length } function values( a: typeof import('./mod').Thing, -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'Thing'. b: typeof import('./mod').AnotherThing, -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~~~~~~~~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'AnotherThing'. c: typeof import('./mod').foo, -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'foo'. d: typeof import('./mod').qux, -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'qux'. e: typeof import('./mod').baz, -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'baz'. f: typeof import('./mod').buz, -- ~~~ + ~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'buz'. -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'buz'. g: typeof import('./mod').literal, -+ ~~~~~~~ -+!!! error TS2306: File 'mod.js' is not a module. ++ ~~~~~~~ ++!!! error TS2694: Namespace '""mod.js""' has no exported member 'literal'. ) { return a.length + b.length + c() + d() + e() + f() + g.length } diff --git a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols index 9d67f80a46..401d9b6dfd 100644 --- a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols +++ b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols @@ -2,6 +2,8 @@ === bug26693.js === /** @typedef {module:locale} hi */ +>module : Symbol(module) + import { nope } from 'nope'; >nope : Symbol(nope, Decl(bug26693.js, 1, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols.diff b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols.diff new file mode 100644 index 0000000000..c4024f08b9 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols.diff @@ -0,0 +1,11 @@ +--- old.noAssertForUnparseableTypedefs.symbols ++++ new.noAssertForUnparseableTypedefs.symbols +@@= skipped -1, +1 lines =@@ + + === bug26693.js === + /** @typedef {module:locale} hi */ ++>module : Symbol(module) ++ + import { nope } from 'nope'; + >nope : Symbol(nope, Decl(bug26693.js, 1, 8)) + diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols index d95f892db4..ad8ecb807c 100644 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols @@ -2,25 +2,69 @@ === bug39372.js === /** @typedef {ReadonlyArray} JsonArray */ +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --)) +>Json : Symbol(Json) + /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ +>key : Symbol(key, Decl(bug39372.js, 1, 26)) +>Json : Symbol(Json) + /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ +>JsonRecord : Symbol(JsonRecord) +>JsonArray : Symbol(JsonArray) /** * @template T * @typedef {{ $A: { +>$A : Symbol($A, Decl(bug39372.js, 6, 14)) + [K in keyof T]?: XMLObject[] +>K : Symbol(K, Decl(bug39372.js, 8, 5)) +>T : Symbol(T) +>XMLObject : Symbol(XMLObject) +>T : Symbol(T) +>K : Symbol(K, Decl(bug39372.js, 8, 5)) + }, $O: { +>$O : Symbol($O, Decl(bug39372.js, 9, 4)) + [K in keyof T]?: { +>K : Symbol(K, Decl(bug39372.js, 11, 5)) +>T : Symbol(T) + $$?: Record +>$$ : Symbol($$, Decl(bug39372.js, 11, 22)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) + } & (T[K] extends string ? {$:string} : XMLObject) +>T : Symbol(T) +>K : Symbol(K, Decl(bug39372.js, 11, 5)) +>$ : Symbol($, Decl(bug39372.js, 13, 32)) +>XMLObject : Symbol(XMLObject) +>T : Symbol(T) +>K : Symbol(K, Decl(bug39372.js, 11, 5)) + }, $$?: Record, +>$$ : Symbol($$, Decl(bug39372.js, 14, 4)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) + } & { [K in keyof T]?: ( +>K : Symbol(K, Decl(bug39372.js, 17, 3)) +>T : Symbol(T) + T[K] extends string ? string +>T : Symbol(T) +>K : Symbol(K, Decl(bug39372.js, 17, 3)) + : XMLObject +>XMLObject : Symbol(XMLObject) +>T : Symbol(T) +>K : Symbol(K, Decl(bug39372.js, 17, 3)) + ) }} XMLObject */ diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff new file mode 100644 index 0000000000..75728fa5dc --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff @@ -0,0 +1,72 @@ +--- old.recursiveTypeReferences2.symbols ++++ new.recursiveTypeReferences2.symbols +@@= skipped -1, +1 lines =@@ + + === bug39372.js === + /** @typedef {ReadonlyArray} JsonArray */ ++>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --)) ++>Json : Symbol(Json) ++ + /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ ++>key : Symbol(key, Decl(bug39372.js, 1, 26)) ++>Json : Symbol(Json) ++ + /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ ++>JsonRecord : Symbol(JsonRecord) ++>JsonArray : Symbol(JsonArray) + + /** + * @template T + * @typedef {{ + $A: { ++>$A : Symbol($A, Decl(bug39372.js, 6, 14)) ++ + [K in keyof T]?: XMLObject[] ++>K : Symbol(K, Decl(bug39372.js, 8, 5)) ++>T : Symbol(T) ++>XMLObject : Symbol(XMLObject) ++>T : Symbol(T) ++>K : Symbol(K, Decl(bug39372.js, 8, 5)) ++ + }, + $O: { ++>$O : Symbol($O, Decl(bug39372.js, 9, 4)) ++ + [K in keyof T]?: { ++>K : Symbol(K, Decl(bug39372.js, 11, 5)) ++>T : Symbol(T) ++ + $$?: Record ++>$$ : Symbol($$, Decl(bug39372.js, 11, 22)) ++>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) ++ + } & (T[K] extends string ? {$:string} : XMLObject) ++>T : Symbol(T) ++>K : Symbol(K, Decl(bug39372.js, 11, 5)) ++>$ : Symbol($, Decl(bug39372.js, 13, 32)) ++>XMLObject : Symbol(XMLObject) ++>T : Symbol(T) ++>K : Symbol(K, Decl(bug39372.js, 11, 5)) ++ + }, + $$?: Record, ++>$$ : Symbol($$, Decl(bug39372.js, 14, 4)) ++>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) ++ + } & { + [K in keyof T]?: ( ++>K : Symbol(K, Decl(bug39372.js, 17, 3)) ++>T : Symbol(T) ++ + T[K] extends string ? string ++>T : Symbol(T) ++>K : Symbol(K, Decl(bug39372.js, 17, 3)) ++ + : XMLObject ++>XMLObject : Symbol(XMLObject) ++>T : Symbol(T) ++>K : Symbol(K, Decl(bug39372.js, 17, 3)) ++ + ) + }} XMLObject */ + diff --git a/testdata/baselines/reference/submodule/conformance/thisTag3.symbols b/testdata/baselines/reference/submodule/conformance/thisTag3.symbols index 158935a1ac..32a1c15ff6 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag3.symbols +++ b/testdata/baselines/reference/submodule/conformance/thisTag3.symbols @@ -3,6 +3,9 @@ === /a.js === /** * @typedef {{fn(a: string): void}} T +>fn : Symbol(fn, Decl(a.js, 1, 14)) +>a : Symbol(a, Decl(a.js, 1, 17)) + */ class C { diff --git a/testdata/baselines/reference/submodule/conformance/thisTag3.symbols.diff b/testdata/baselines/reference/submodule/conformance/thisTag3.symbols.diff index 98e2feb073..9fced7444e 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/thisTag3.symbols.diff @@ -1,6 +1,16 @@ --- old.thisTag3.symbols +++ new.thisTag3.symbols -@@= skipped -12, +12 lines =@@ +@@= skipped -2, +2 lines =@@ + === /a.js === + /** + * @typedef {{fn(a: string): void}} T ++>fn : Symbol(fn, Decl(a.js, 1, 14)) ++>a : Symbol(a, Decl(a.js, 1, 17)) ++ + */ + + class C { +@@= skipped -10, +13 lines =@@ * @param {string} a */ p = (a) => this.fn("" + a); diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols index dee3378ce7..4f2afd328c 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols @@ -2,6 +2,11 @@ === typeTagNoErasure.js === /** @template T @typedef {(data: T1) => T1} Test */ +>T1 : Symbol(T1, Decl(typeTagNoErasure.js, 0, 27)) +>T : Symbol(T) +>data : Symbol(data, Decl(typeTagNoErasure.js, 0, 41)) +>T1 : Symbol(T1, Decl(typeTagNoErasure.js, 0, 27)) +>T1 : Symbol(T1, Decl(typeTagNoErasure.js, 0, 27)) /** @type {Test} */ const test = dibbity => dibbity diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols.diff new file mode 100644 index 0000000000..f85d4106d4 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols.diff @@ -0,0 +1,14 @@ +--- old.typeTagNoErasure.symbols ++++ new.typeTagNoErasure.symbols +@@= skipped -1, +1 lines =@@ + + === typeTagNoErasure.js === + /** @template T @typedef {(data: T1) => T1} Test */ ++>T1 : Symbol(T1, Decl(typeTagNoErasure.js, 0, 27)) ++>T : Symbol(T) ++>data : Symbol(data, Decl(typeTagNoErasure.js, 0, 41)) ++>T1 : Symbol(T1, Decl(typeTagNoErasure.js, 0, 27)) ++>T1 : Symbol(T1, Decl(typeTagNoErasure.js, 0, 27)) + + /** @type {Test} */ + const test = dibbity => dibbity diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols index 3aceee0202..4ab7fac011 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols @@ -3,6 +3,11 @@ === typeTagOnFunctionReferencesGeneric.js === /** * @typedef {(m : T) => T} IFn +>T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) +>m : Symbol(m, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 17)) +>T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) +>T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) + */ /**@type {IFn}*/ diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff new file mode 100644 index 0000000000..03b6a4fc40 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff @@ -0,0 +1,14 @@ +--- old.typeTagOnFunctionReferencesGeneric.symbols ++++ new.typeTagOnFunctionReferencesGeneric.symbols +@@= skipped -2, +2 lines =@@ + === typeTagOnFunctionReferencesGeneric.js === + /** + * @typedef {(m : T) => T} IFn ++>T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) ++>m : Symbol(m, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 17)) ++>T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) ++>T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) ++ + */ + + /**@type {IFn}*/ diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt index 41a0394ca8..c809e52544 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt @@ -1,7 +1,7 @@ mod3.js(6,1): error TS2304: Cannot find name 'exports'. -use.js(1,19): error TS2306: File 'mod1.js' is not a module. +use.js(1,29): error TS2694: Namespace '""mod1.js""' has no exported member 'Both'. use.js(3,29): error TS2694: Namespace '""mod2.js""' has no exported member 'Both'. -use.js(5,19): error TS2306: File 'mod3.js' is not a module. +use.js(5,29): error TS2694: Namespace '""mod3.js""' has no exported member 'Both'. ==== commonjs.d.ts (0 errors) ==== @@ -40,16 +40,16 @@ use.js(5,19): error TS2306: File 'mod3.js' is not a module. ==== use.js (3 errors) ==== /** @type {import('./mod1').Both} */ - ~~~~~~~~ -!!! error TS2306: File 'mod1.js' is not a module. + ~~~~ +!!! error TS2694: Namespace '""mod1.js""' has no exported member 'Both'. var both1 = { type: 'a', x: 1 }; /** @type {import('./mod2').Both} */ ~~~~ !!! error TS2694: Namespace '""mod2.js""' has no exported member 'Both'. var both2 = both1; /** @type {import('./mod3').Both} */ - ~~~~~~~~ -!!! error TS2306: File 'mod3.js' is not a module. + ~~~~ +!!! error TS2694: Namespace '""mod3.js""' has no exported member 'Both'. var both3 = both2; diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff index 7667415996..dcbdb6c6c7 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff @@ -4,9 +4,9 @@ - @@= skipped --1, +1 lines =@@ +mod3.js(6,1): error TS2304: Cannot find name 'exports'. -+use.js(1,19): error TS2306: File 'mod1.js' is not a module. ++use.js(1,29): error TS2694: Namespace '""mod1.js""' has no exported member 'Both'. +use.js(3,29): error TS2694: Namespace '""mod2.js""' has no exported member 'Both'. -+use.js(5,19): error TS2306: File 'mod3.js' is not a module. ++use.js(5,29): error TS2694: Namespace '""mod3.js""' has no exported member 'Both'. + + +==== commonjs.d.ts (0 errors) ==== @@ -45,16 +45,16 @@ + +==== use.js (3 errors) ==== + /** @type {import('./mod1').Both} */ -+ ~~~~~~~~ -+!!! error TS2306: File 'mod1.js' is not a module. ++ ~~~~ ++!!! error TS2694: Namespace '""mod1.js""' has no exported member 'Both'. + var both1 = { type: 'a', x: 1 }; + /** @type {import('./mod2').Both} */ + ~~~~ +!!! error TS2694: Namespace '""mod2.js""' has no exported member 'Both'. + var both2 = both1; + /** @type {import('./mod3').Both} */ -+ ~~~~~~~~ -+!!! error TS2306: File 'mod3.js' is not a module. ++ ~~~~ ++!!! error TS2694: Namespace '""mod3.js""' has no exported member 'Both'. + var both3 = both2; + + diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols index 5099a3d4b5..690bdfe4c3 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols @@ -8,8 +8,17 @@ declare var module: { exports: any}; === mod1.js === /// /** @typedef {{ type: "a", x: 1 }} A */ +>type : Symbol(type, Decl(mod1.js, 1, 15)) +>x : Symbol(x, Decl(mod1.js, 1, 26)) + /** @typedef {{ type: "b", y: 1 }} B */ +>type : Symbol(type, Decl(mod1.js, 2, 15)) +>y : Symbol(y, Decl(mod1.js, 2, 26)) + /** @typedef {A | B} Both */ +>A : Symbol(A) +>B : Symbol(B) + module.exports = C >module.exports : Symbol(exports, Decl(commonjs.d.ts, 0, 21)) >module : Symbol(module, Decl(commonjs.d.ts, 0, 11)) @@ -25,8 +34,16 @@ function C() { === mod2.js === /// /** @typedef {{ type: "a", x: 1 }} A */ +>type : Symbol(type, Decl(mod2.js, 1, 15)) +>x : Symbol(x, Decl(mod2.js, 1, 26)) + /** @typedef {{ type: "b", y: 1 }} B */ +>type : Symbol(type, Decl(mod2.js, 2, 15)) +>y : Symbol(y, Decl(mod2.js, 2, 26)) + /** @typedef {A | B} Both */ +>A : Symbol(A) +>B : Symbol(B) export function C() { >C : Symbol(C, Decl(mod2.js, 0, 0)) @@ -35,11 +52,18 @@ export function C() { } === mod3.js === - /// /** @typedef {{ type: "a", x: 1 }} A */ +>type : Symbol(type, Decl(mod3.js, 1, 15)) +>x : Symbol(x, Decl(mod3.js, 1, 26)) + /** @typedef {{ type: "b", y: 1 }} B */ +>type : Symbol(type, Decl(mod3.js, 2, 15)) +>y : Symbol(y, Decl(mod3.js, 2, 26)) + /** @typedef {A | B} Both */ +>A : Symbol(A) +>B : Symbol(B) exports.C = function() { this.p = 1 diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff index 991bda7cb7..4219663b1a 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff @@ -1,8 +1,20 @@ --- old.typedefCrossModule.symbols +++ new.typedefCrossModule.symbols -@@= skipped -10, +10 lines =@@ +@@= skipped -7, +7 lines =@@ + === mod1.js === + /// + /** @typedef {{ type: "a", x: 1 }} A */ ++>type : Symbol(type, Decl(mod1.js, 1, 15)) ++>x : Symbol(x, Decl(mod1.js, 1, 26)) ++ /** @typedef {{ type: "b", y: 1 }} B */ ++>type : Symbol(type, Decl(mod1.js, 2, 15)) ++>y : Symbol(y, Decl(mod1.js, 2, 26)) ++ /** @typedef {A | B} Both */ ++>A : Symbol(A) ++>B : Symbol(B) ++ module.exports = C ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 0, 0)) @@ -22,7 +34,20 @@ } === mod2.js === -@@= skipped -24, +21 lines =@@ + /// + /** @typedef {{ type: "a", x: 1 }} A */ ++>type : Symbol(type, Decl(mod2.js, 1, 15)) ++>x : Symbol(x, Decl(mod2.js, 1, 26)) ++ + /** @typedef {{ type: "b", y: 1 }} B */ ++>type : Symbol(type, Decl(mod2.js, 2, 15)) ++>y : Symbol(y, Decl(mod2.js, 2, 26)) ++ + /** @typedef {A | B} Both */ ++>A : Symbol(A) ++>B : Symbol(B) + + export function C() { >C : Symbol(C, Decl(mod2.js, 0, 0)) this.p = 1 @@ -32,11 +57,18 @@ } === mod3.js === -+ /// /** @typedef {{ type: "a", x: 1 }} A */ ++>type : Symbol(type, Decl(mod3.js, 1, 15)) ++>x : Symbol(x, Decl(mod3.js, 1, 26)) ++ /** @typedef {{ type: "b", y: 1 }} B */ ++>type : Symbol(type, Decl(mod3.js, 2, 15)) ++>y : Symbol(y, Decl(mod3.js, 2, 26)) ++ /** @typedef {A | B} Both */ ++>A : Symbol(A) ++>B : Symbol(B) exports.C = function() { ->exports.C : Symbol(C, Decl(mod3.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.errors.txt deleted file mode 100644 index b48220e505..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.errors.txt +++ /dev/null @@ -1,39 +0,0 @@ -mod1.js:2:7 - error TS2451: Cannot redeclare block-scoped variable 'Bar'. - -2 class Bar {} -   ~~~ - - mod2.js:2:7 - 'Bar' was also declared here. - 2 const Bar = 3; -    ~~~ - -mod2.js:2:7 - error TS2451: Cannot redeclare block-scoped variable 'Bar'. - -2 const Bar = 3; -   ~~~ - - mod1.js:2:7 - 'Bar' was also declared here. - 2 class Bar {} -    ~~~ - - -==== mod1.js (1 errors) ==== - /** @typedef {number} Foo */ - class Bar {} - ~~~ -!!! error TS2451: Cannot redeclare block-scoped variable 'Bar'. -!!! related TS6203 mod2.js:2:7: 'Bar' was also declared here. - -==== mod2.js (1 errors) ==== - class Foo { } // should error - const Bar = 3; - ~~~ -!!! error TS2451: Cannot redeclare block-scoped variable 'Bar'. -!!! related TS6203 mod1.js:2:7: 'Bar' was also declared here. - -Found 2 errors in 2 files. - -Errors Files - 1 mod1.js:2 - 1 mod2.js:2 - diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.errors.txt.diff index 3768eb4ab3..fcf1071a27 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.errors.txt.diff @@ -1,6 +1,6 @@ --- old.typedefCrossModule5.errors.txt +++ new.typedefCrossModule5.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -mod1.js:1:23 - error TS2300: Duplicate identifier 'Foo'. - -1 /** @typedef {number} Foo */ @@ -10,18 +10,17 @@ - 1 class Foo { } // should error -    ~~~ - 'Foo' was also declared here. - mod1.js:2:7 - error TS2451: Cannot redeclare block-scoped variable 'Bar'. - - 2 class Bar {} -    ~~~ - +-mod1.js:2:7 - error TS2451: Cannot redeclare block-scoped variable 'Bar'. +- +-2 class Bar {} +-   ~~~ +- - mod2.js:2:7 -+ mod2.js:2:7 - 'Bar' was also declared here. - 2 const Bar = 3; -    ~~~ +- 2 const Bar = 3; +-    ~~~ - 'Bar' was also declared here. -mod2.js:1:7 - error TS2300: Duplicate identifier 'Foo'. - +- -1 class Foo { } // should error -   ~~~ - @@ -29,46 +28,41 @@ - 1 /** @typedef {number} Foo */ -    ~~~ - 'Foo' was also declared here. - mod2.js:2:7 - error TS2451: Cannot redeclare block-scoped variable 'Bar'. - - 2 const Bar = 3; -    ~~~ - +-mod2.js:2:7 - error TS2451: Cannot redeclare block-scoped variable 'Bar'. +- +-2 const Bar = 3; +-   ~~~ +- - mod1.js:2:7 -+ mod1.js:2:7 - 'Bar' was also declared here. - 2 class Bar {} -    ~~~ +- 2 class Bar {} +-    ~~~ - 'Bar' was also declared here. - - +- +- -==== mod1.js (2 errors) ==== -+==== mod1.js (1 errors) ==== - /** @typedef {number} Foo */ +- /** @typedef {number} Foo */ - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -!!! related TS6203 mod2.js:1:7: 'Foo' was also declared here. - class Bar {} - ~~~ - !!! error TS2451: Cannot redeclare block-scoped variable 'Bar'. - !!! related TS6203 mod2.js:2:7: 'Bar' was also declared here. - +- class Bar {} +- ~~~ +-!!! error TS2451: Cannot redeclare block-scoped variable 'Bar'. +-!!! related TS6203 mod2.js:2:7: 'Bar' was also declared here. +- -==== mod2.js (2 errors) ==== -+==== mod2.js (1 errors) ==== - class Foo { } // should error +- class Foo { } // should error - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -!!! related TS6203 mod1.js:1:23: 'Foo' was also declared here. - const Bar = 3; - ~~~ - !!! error TS2451: Cannot redeclare block-scoped variable 'Bar'. - !!! related TS6203 mod1.js:2:7: 'Bar' was also declared here. - +- const Bar = 3; +- ~~~ +-!!! error TS2451: Cannot redeclare block-scoped variable 'Bar'. +-!!! related TS6203 mod1.js:2:7: 'Bar' was also declared here. +- -Found 4 errors in 2 files. -+Found 2 errors in 2 files. - - Errors Files +- +-Errors Files - 2 mod1.js:1 - 2 mod2.js:1 -+ 1 mod1.js:2 -+ 1 mod2.js:2 -+ +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols index 91ac8e7070..f74e112d49 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols @@ -6,6 +6,8 @@ class C { /** * @typedef {C~A} C~B +>C : Symbol(C, Decl(bug25104.js, 0, 0)) + * @typedef {object} C~A */ /** @param {C~A} o */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff new file mode 100644 index 0000000000..95dc4294f6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff @@ -0,0 +1,11 @@ +--- old.typedefInnerNamepaths.symbols ++++ new.typedefInnerNamepaths.symbols +@@= skipped -5, +5 lines =@@ + + /** + * @typedef {C~A} C~B ++>C : Symbol(C, Decl(bug25104.js, 0, 0)) ++ + * @typedef {object} C~A + */ + /** @param {C~A} o */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols index 43cf894f0c..4b84ef4c3b 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols @@ -7,6 +7,17 @@ * @template W * @template X That last one had no comment * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything +>t : Symbol(t, Decl(a.js, 5, 14)) +>T : Symbol(T) +>u : Symbol(u, Decl(a.js, 5, 20)) +>U : Symbol(U) +>v : Symbol(v, Decl(a.js, 5, 26)) +>V : Symbol(V) +>w : Symbol(w, Decl(a.js, 5, 32)) +>W : Symbol(W) +>x : Symbol(x, Decl(a.js, 5, 38)) +>X : Symbol(X) + */ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols.diff index 5f8037ef21..133422feaf 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols.diff @@ -1,6 +1,24 @@ --- old.typedefMultipleTypeParameters.symbols +++ new.typedefMultipleTypeParameters.symbols -@@= skipped -23, +23 lines =@@ +@@= skipped -6, +6 lines =@@ + * @template W + * @template X That last one had no comment + * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything ++>t : Symbol(t, Decl(a.js, 5, 14)) ++>T : Symbol(T) ++>u : Symbol(u, Decl(a.js, 5, 20)) ++>U : Symbol(U) ++>v : Symbol(v, Decl(a.js, 5, 26)) ++>V : Symbol(V) ++>w : Symbol(w, Decl(a.js, 5, 32)) ++>W : Symbol(W) ++>x : Symbol(x, Decl(a.js, 5, 38)) ++>X : Symbol(X) ++ + */ + + /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ +@@= skipped -17, +28 lines =@@ === test.ts === declare var actually: Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>; >actually : Symbol(actually, Decl(test.ts, 0, 11)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols index 236378c837..519263033c 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols @@ -2,56 +2,89 @@ === typedefOnStatements.js === /** @typedef {{a: string}} A */ +>a : Symbol(a, Decl(typedefOnStatements.js, 0, 15)) + ; /** @typedef {{ b: string }} B */ +>b : Symbol(b, Decl(typedefOnStatements.js, 2, 15)) + debugger; /** @typedef {{ c: string }} C */ +>c : Symbol(c, Decl(typedefOnStatements.js, 4, 15)) { } /** @typedef {{ d: string }} D */ +>d : Symbol(d, Decl(typedefOnStatements.js, 7, 15)) + 1 + 1; /** @typedef {{ e: string }} E */ +>e : Symbol(e, Decl(typedefOnStatements.js, 9, 15)) + if (false) { } /** @typedef {{ f: string }} F */ +>f : Symbol(f, Decl(typedefOnStatements.js, 12, 15)) + do { } while (false); /** @typedef {{ g: string }} G */ +>g : Symbol(g, Decl(typedefOnStatements.js, 15, 15)) + while (false) { } /** @typedef {{ h: string }} H */ +>h : Symbol(h, Decl(typedefOnStatements.js, 18, 15)) + for (;; false) { } /** @typedef {{ i: string }} I */ +>i : Symbol(i, Decl(typedefOnStatements.js, 21, 15)) + for (let i in []) { >i : Symbol(i, Decl(typedefOnStatements.js, 22, 8)) } /** @typedef {{ j: string }} J */ +>j : Symbol(j, Decl(typedefOnStatements.js, 24, 15)) + break; /** @typedef {{ k: string }} K */ +>k : Symbol(k, Decl(typedefOnStatements.js, 26, 15)) + for (let k of []) { >k : Symbol(k, Decl(typedefOnStatements.js, 27, 8)) } /** @typedef {{ l: string }} L */ +>l : Symbol(l, Decl(typedefOnStatements.js, 29, 15)) + continue; /** @typedef {{ m: string }} M */ +>m : Symbol(m, Decl(typedefOnStatements.js, 31, 15)) + with (name) { >name : Symbol(name, Decl(lib.dom.d.ts, --, --)) } /** @typedef {{ n: string }} N */ +>n : Symbol(n, Decl(typedefOnStatements.js, 34, 15)) + switch (name) { >name : Symbol(name, Decl(lib.dom.d.ts, --, --)) } /** @typedef {{ o: string }} O */ +>o : Symbol(o, Decl(typedefOnStatements.js, 38, 15)) + fork: while (false) { } /** @typedef {{ p: string }} P */ +>p : Symbol(p, Decl(typedefOnStatements.js, 42, 15)) + throw new Error('Unreachable') >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) /** @typedef {{ q: string }} Q */ +>q : Symbol(q, Decl(typedefOnStatements.js, 45, 15)) + try { } catch (e) { @@ -125,6 +158,8 @@ function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { >alpha : Symbol(alpha, Decl(typedefOnStatements.js, 73, 17)) /** @typedef {{ alpha: string }} Alpha */ +>alpha : Symbol(alpha, Decl(typedefOnStatements.js, 74, 19)) + return } diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols.diff index 9b47f706f4..fadfb97490 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols.diff @@ -1,6 +1,96 @@ --- old.typedefOnStatements.symbols +++ new.typedefOnStatements.symbols -@@= skipped -97, +97 lines =@@ +@@= skipped -1, +1 lines =@@ + + === typedefOnStatements.js === + /** @typedef {{a: string}} A */ ++>a : Symbol(a, Decl(typedefOnStatements.js, 0, 15)) ++ + ; + /** @typedef {{ b: string }} B */ ++>b : Symbol(b, Decl(typedefOnStatements.js, 2, 15)) ++ + debugger; + /** @typedef {{ c: string }} C */ ++>c : Symbol(c, Decl(typedefOnStatements.js, 4, 15)) + { + } + /** @typedef {{ d: string }} D */ ++>d : Symbol(d, Decl(typedefOnStatements.js, 7, 15)) ++ + 1 + 1; + /** @typedef {{ e: string }} E */ ++>e : Symbol(e, Decl(typedefOnStatements.js, 9, 15)) ++ + if (false) { + } + /** @typedef {{ f: string }} F */ ++>f : Symbol(f, Decl(typedefOnStatements.js, 12, 15)) ++ + do { + } while (false); + /** @typedef {{ g: string }} G */ ++>g : Symbol(g, Decl(typedefOnStatements.js, 15, 15)) ++ + while (false) { + } + /** @typedef {{ h: string }} H */ ++>h : Symbol(h, Decl(typedefOnStatements.js, 18, 15)) ++ + for (;; false) { + } + /** @typedef {{ i: string }} I */ ++>i : Symbol(i, Decl(typedefOnStatements.js, 21, 15)) ++ + for (let i in []) { + >i : Symbol(i, Decl(typedefOnStatements.js, 22, 8)) + } + /** @typedef {{ j: string }} J */ ++>j : Symbol(j, Decl(typedefOnStatements.js, 24, 15)) ++ + break; + /** @typedef {{ k: string }} K */ ++>k : Symbol(k, Decl(typedefOnStatements.js, 26, 15)) ++ + for (let k of []) { + >k : Symbol(k, Decl(typedefOnStatements.js, 27, 8)) + } + /** @typedef {{ l: string }} L */ ++>l : Symbol(l, Decl(typedefOnStatements.js, 29, 15)) ++ + continue; + /** @typedef {{ m: string }} M */ ++>m : Symbol(m, Decl(typedefOnStatements.js, 31, 15)) ++ + with (name) { + >name : Symbol(name, Decl(lib.dom.d.ts, --, --)) + } + /** @typedef {{ n: string }} N */ ++>n : Symbol(n, Decl(typedefOnStatements.js, 34, 15)) ++ + switch (name) { + >name : Symbol(name, Decl(lib.dom.d.ts, --, --)) + } + + /** @typedef {{ o: string }} O */ ++>o : Symbol(o, Decl(typedefOnStatements.js, 38, 15)) ++ + fork: while (false) { + } + + /** @typedef {{ p: string }} P */ ++>p : Symbol(p, Decl(typedefOnStatements.js, 42, 15)) ++ + throw new Error('Unreachable') + >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + + /** @typedef {{ q: string }} Q */ ++>q : Symbol(q, Decl(typedefOnStatements.js, 45, 15)) ++ + try { + } + catch (e) { +@@= skipped -96, +129 lines =@@ >q : Symbol(q, Decl(typedefOnStatements.js, 70, 48)) console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) @@ -63,3 +153,12 @@ /** @type {Alpha} */ var alpha = { alpha: "aleph" } +@@= skipped -61, +27 lines =@@ + >alpha : Symbol(alpha, Decl(typedefOnStatements.js, 73, 17)) + + /** @typedef {{ alpha: string }} Alpha */ ++>alpha : Symbol(alpha, Decl(typedefOnStatements.js, 74, 19)) ++ + return + } + diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols index 4dd69bf6f0..ce334edb68 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols @@ -2,6 +2,8 @@ === typedefTagExtraneousProperty.js === /** @typedef {Object.} Mmap +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + * @property {string} ignoreMe - should be ignored */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols.diff index c5a3901f5e..40e7e87727 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols.diff @@ -1,6 +1,13 @@ --- old.typedefTagExtraneousProperty.symbols +++ new.typedefTagExtraneousProperty.symbols -@@= skipped -6, +6 lines =@@ +@@= skipped -1, +1 lines =@@ + + === typedefTagExtraneousProperty.js === + /** @typedef {Object.} Mmap ++>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++ + * @property {string} ignoreMe - should be ignored + */ /** @type {Mmap} */ var y = { bye: "no" }; diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols index e198bfe33c..7ad06b9859 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols @@ -44,6 +44,8 @@ var mistake; /** @typedef {Object} Upp * @property {string} name * @property {Object} not +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + * @property {string} nested */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff index 2e6e626701..c5a96d1529 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff @@ -1,6 +1,15 @@ --- old.typedefTagNested.symbols +++ new.typedefTagNested.symbols -@@= skipped -54, +54 lines =@@ +@@= skipped -43, +43 lines =@@ + /** @typedef {Object} Upp + * @property {string} name + * @property {Object} not ++>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++ + * @property {string} nested + */ + +@@= skipped -11, +13 lines =@@ >nested : Symbol(nested, Decl(a.js, 35, 37)) sala.name diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols index 9afcc1974f..0f598dad6e 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols @@ -3,6 +3,8 @@ === github20832.js === // #20832 /** @typedef {U} T - should be "error, can't find type named 'U' */ +>U : Symbol(U) + /** * @template U * @param {U} x diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff new file mode 100644 index 0000000000..622fffa9cf --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff @@ -0,0 +1,11 @@ +--- old.typedefTagTypeResolution.symbols ++++ new.typedefTagTypeResolution.symbols +@@= skipped -2, +2 lines =@@ + === github20832.js === + // #20832 + /** @typedef {U} T - should be "error, can't find type named 'U' */ ++>U : Symbol(U) ++ + /** + * @template U + * @param {U} x diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols index 655f4ebbb6..328a57444e 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols @@ -3,6 +3,8 @@ === mod1.js === /** * @typedef {function(string): boolean} +>function : Symbol(function) + * Type1 */ @@ -27,8 +29,14 @@ function callIt(func, arg) { /** * @typedef {{ * num: number, +>num : Symbol(num, Decl(mod2.js, 1, 14)) + * str: string, +>str : Symbol(str, Decl(mod2.js, 2, 17)) + * boo: boolean +>boo : Symbol(boo, Decl(mod2.js, 3, 17)) + * }} Type2 */ @@ -52,6 +60,8 @@ function check(obj) { * A function whose signature is very long. * * @typedef {function(boolean, string, number): +>function : Symbol(function) + * (string|number)} StringOrNumber1 */ @@ -82,6 +92,8 @@ function use1(func, bool, str, num) { * A function whose signature is very long. * * @typedef {function(boolean, string, +>function : Symbol(function) + * number): * (string|number)} StringOrNumber2 */ @@ -112,10 +124,16 @@ function use2(func, bool, str, num) { /** * @typedef {{ * num: +>num : Symbol(num, Decl(mod5.js, 1, 14)) + * number, * str: +>str : Symbol(str, Decl(mod5.js, 3, 12)) + * string, * boo: +>boo : Symbol(boo, Decl(mod5.js, 5, 12)) + * boolean * }} Type5 */ @@ -139,8 +157,12 @@ function check5(obj) { /** * @typedef {{ * foo: +>foo : Symbol(foo, Decl(mod6.js, 1, 14)) + * *, * bar: +>bar : Symbol(bar, Decl(mod6.js, 3, 7)) + * * * }} Type6 */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff index d63c196fe1..9b42db48cb 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff @@ -1,6 +1,30 @@ --- old.typedefTagWrapping.symbols +++ new.typedefTagWrapping.symbols -@@= skipped -41, +41 lines =@@ +@@= skipped -2, +2 lines =@@ + === mod1.js === + /** + * @typedef {function(string): boolean} ++>function : Symbol(function) ++ + * Type1 + */ + +@@= skipped -24, +26 lines =@@ + /** + * @typedef {{ + * num: number, ++>num : Symbol(num, Decl(mod2.js, 1, 14)) ++ + * str: string, ++>str : Symbol(str, Decl(mod2.js, 2, 17)) ++ + * boo: boolean ++>boo : Symbol(boo, Decl(mod2.js, 3, 17)) ++ + * }} Type2 + */ + +@@= skipped -15, +21 lines =@@ >obj : Symbol(obj, Decl(mod2.js, 13, 15)) return obj.boo ? obj.num : obj.str; @@ -16,7 +40,42 @@ } === mod3.js === -@@= skipped -94, +88 lines =@@ +@@= skipped -16, +10 lines =@@ + * A function whose signature is very long. + * + * @typedef {function(boolean, string, number): ++>function : Symbol(function) ++ + * (string|number)} StringOrNumber1 + */ + +@@= skipped -30, +32 lines =@@ + * A function whose signature is very long. + * + * @typedef {function(boolean, string, ++>function : Symbol(function) ++ + * number): + * (string|number)} StringOrNumber2 + */ +@@= skipped -30, +32 lines =@@ + /** + * @typedef {{ + * num: ++>num : Symbol(num, Decl(mod5.js, 1, 14)) ++ + * number, + * str: ++>str : Symbol(str, Decl(mod5.js, 3, 12)) ++ + * string, + * boo: ++>boo : Symbol(boo, Decl(mod5.js, 5, 12)) ++ + * boolean + * }} Type5 + */ +@@= skipped -18, +24 lines =@@ >obj : Symbol(obj, Decl(mod5.js, 16, 16)) return obj.boo ? obj.num : obj.str; @@ -32,7 +91,19 @@ } === mod6.js === -@@= skipped -31, +25 lines =@@ + /** + * @typedef {{ + * foo: ++>foo : Symbol(foo, Decl(mod6.js, 1, 14)) ++ + * *, + * bar: ++>bar : Symbol(bar, Decl(mod6.js, 3, 7)) ++ + * * + * }} Type6 + */ +@@= skipped -31, +29 lines =@@ >obj : Symbol(obj, Decl(mod6.js, 14, 16)) return obj.foo; From 355a33919f23fb0fc0e582f415caa2dea166ef94 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 14 Mar 2025 15:30:02 -0700 Subject: [PATCH 07/25] Remove JSTypeExpression wrapper, use Clone instead --- internal/ast/ast.go | 42 --- internal/ast/kind.go | 1 - internal/ast/kind_stringer_generated.go | 17 +- internal/checker/checker.go | 2 - internal/parser/jsdoc.go | 6 +- .../amdLikeInputDeclarationEmit.symbols | 2 - .../amdLikeInputDeclarationEmit.symbols.diff | 4 +- ...kJsObjectLiteralHasCheckedKeyof.errors.txt | 18 -- ...jectLiteralHasCheckedKeyof.errors.txt.diff | 23 ++ ...JsdocTypeTagOnExportAssignment1.errors.txt | 19 -- ...TypeTagOnExportAssignment1.errors.txt.diff | 36 +-- ...JsdocTypeTagOnExportAssignment2.errors.txt | 19 -- ...TypeTagOnExportAssignment2.errors.txt.diff | 36 +-- ...JsdocTypeTagOnExportAssignment3.errors.txt | 21 -- ...TypeTagOnExportAssignment3.errors.txt.diff | 38 +-- ...JsdocTypeTagOnExportAssignment4.errors.txt | 14 - ...TypeTagOnExportAssignment4.errors.txt.diff | 29 +-- ...JsdocTypeTagOnExportAssignment5.errors.txt | 19 -- ...TypeTagOnExportAssignment5.errors.txt.diff | 24 -- ...JsdocTypeTagOnExportAssignment6.errors.txt | 19 -- ...TypeTagOnExportAssignment6.errors.txt.diff | 36 +-- ...JsdocTypeTagOnExportAssignment7.errors.txt | 21 -- ...TypeTagOnExportAssignment7.errors.txt.diff | 26 -- ...JsdocTypeTagOnExportAssignment8.errors.txt | 18 -- ...TypeTagOnExportAssignment8.errors.txt.diff | 23 -- .../compiler/commentsModules.errors.txt | 118 +++++++++ .../compiler/commentsModules.errors.txt.diff | 123 +++++++++ ...yTypedParametersOptionalInJSDoc.errors.txt | 11 +- ...dParametersOptionalInJSDoc.errors.txt.diff | 22 +- ...nferenceFromAnnotatedFunctionJs.errors.txt | 45 ---- ...nceFromAnnotatedFunctionJs.errors.txt.diff | 50 ---- ...ithAnnotatedOptionalParameterJs.errors.txt | 33 --- ...notatedOptionalParameterJs.errors.txt.diff | 38 --- .../compiler/declFileGenericType2.errors.txt | 50 ++++ .../declFileGenericType2.errors.txt.diff | 55 ++++ ...ithClassReferredByExtendsClause.errors.txt | 25 ++ ...assReferredByExtendsClause.errors.txt.diff | 30 +++ ...peNode4(strictnullchecks=false).errors.txt | 5 +- ...e4(strictnullchecks=false).errors.txt.diff | 5 +- ...ypeNode4(strictnullchecks=true).errors.txt | 43 --- ...de4(strictnullchecks=true).errors.txt.diff | 48 ---- .../declarationEmitNameConflicts.errors.txt | 53 ++++ ...clarationEmitNameConflicts.errors.txt.diff | 58 +++++ .../declarationEmitNameConflicts2.errors.txt | 30 +++ ...larationEmitNameConflicts2.errors.txt.diff | 35 +++ .../compiler/dottedModuleName2.errors.txt | 55 ++++ .../dottedModuleName2.errors.txt.diff | 60 +++++ .../compiler/dottedNamesInSystem.errors.txt | 13 + .../dottedNamesInSystem.errors.txt.diff | 18 ++ .../emitMemberAccessExpression.errors.txt | 28 ++ ...emitMemberAccessExpression.errors.txt.diff | 33 +++ ...xpandoFunctionContextualTypesJs.errors.txt | 17 +- ...oFunctionContextualTypesJs.errors.txt.diff | 17 +- .../exportDefaultWithJSDoc1.errors.txt | 16 -- .../exportDefaultWithJSDoc1.errors.txt.diff | 21 -- ...opertyInheritanceSpecialization.errors.txt | 90 +++++++ ...yInheritanceSpecialization.errors.txt.diff | 95 +++++++ .../importTypeResolutionJSDocEOF.errors.txt | 15 -- ...portTypeResolutionJSDocEOF.errors.txt.diff | 20 -- ...larationEmitDoesNotRenameImport.errors.txt | 5 +- ...ionEmitDoesNotRenameImport.errors.txt.diff | 5 +- .../jsDeclarationsInheritedTypes.errors.txt | 46 ---- ...DeclarationsInheritedTypes.errors.txt.diff | 51 ---- ...tUseNodeModulesPathWithoutError.errors.txt | 48 ---- ...odeModulesPathWithoutError.errors.txt.diff | 53 ---- .../compiler/jsEnumCrossFileExport.errors.txt | 8 +- .../jsEnumCrossFileExport.errors.txt.diff | 8 +- .../jsEnumTagOnObjectFrozen.errors.txt | 5 +- .../jsEnumTagOnObjectFrozen.errors.txt.diff | 5 +- ...eCompilationRestParamJsDocFunction.symbols | 10 - ...ilationRestParamJsDocFunction.symbols.diff | 10 - .../jsFileFunctionOverloads.errors.txt | 70 ----- .../jsFileFunctionOverloads.errors.txt.diff | 75 ------ .../compiler/jsFileFunctionOverloads.symbols | 4 - .../jsFileFunctionOverloads.symbols.diff | 4 - .../jsFileFunctionOverloads2.errors.txt | 65 ----- .../jsFileFunctionOverloads2.errors.txt.diff | 70 ----- .../compiler/jsFileFunctionOverloads2.symbols | 4 - .../jsFileFunctionOverloads2.symbols.diff | 4 - .../jsFileImportPreservedWhenUsed.errors.txt | 35 --- ...ileImportPreservedWhenUsed.errors.txt.diff | 40 --- .../compiler/jsFileMethodOverloads.errors.txt | 8 +- .../jsFileMethodOverloads.errors.txt.diff | 8 +- .../jsFileMethodOverloads2.errors.txt | 8 +- .../jsFileMethodOverloads2.errors.txt.diff | 8 +- ...ocArrayObjectPromiseImplicitAny.errors.txt | 69 ----- ...ayObjectPromiseImplicitAny.errors.txt.diff | 74 ------ ...ArrayObjectPromiseNoImplicitAny.errors.txt | 69 ----- ...ObjectPromiseNoImplicitAny.errors.txt.diff | 100 ++++--- .../jsdocBracelessTypeTag1.errors.txt | 6 +- .../jsdocBracelessTypeTag1.errors.txt.diff | 14 +- .../compiler/jsdocCallbackAndType.errors.txt | 15 -- .../jsdocCallbackAndType.errors.txt.diff | 30 +-- .../compiler/jsdocIllegalTags.errors.txt | 4 +- .../compiler/jsdocIllegalTags.errors.txt.diff | 9 +- .../jsdocImportTypeResolution.errors.txt | 16 -- .../jsdocImportTypeResolution.errors.txt.diff | 21 -- ...jsdocParamTagOnPropertyInitializer.symbols | 2 - ...ParamTagOnPropertyInitializer.symbols.diff | 2 - ...docParameterParsingInfiniteLoop.errors.txt | 12 - ...rameterParsingInfiniteLoop.errors.txt.diff | 23 +- .../jsdocPropertyTagInvalid.errors.txt | 18 -- .../jsdocPropertyTagInvalid.errors.txt.diff | 34 +-- ...sdocResolveNameFailureInTypedef.errors.txt | 15 -- ...esolveNameFailureInTypedef.errors.txt.diff | 31 ++- .../compiler/jsdocTypeCast.errors.txt | 29 --- .../compiler/jsdocTypeCast.errors.txt.diff | 47 ++-- ...eNongenericInstantiationAttempt.errors.txt | 76 ------ ...enericInstantiationAttempt.errors.txt.diff | 144 +++++----- ...efBeforeParenthesizedExpression.errors.txt | 26 -- ...oreParenthesizedExpression.errors.txt.diff | 31 --- .../jsdocTypedefMissingType.errors.txt | 20 -- .../jsdocTypedefMissingType.errors.txt.diff | 38 +-- ...jsdocTypedef_propertyWithNoType.errors.txt | 14 - ...Typedef_propertyWithNoType.errors.txt.diff | 19 -- .../compiler/moduleExports1.errors.txt.diff | 22 ++ ...sizedJSDocCastAtReturnStatement.errors.txt | 23 -- ...JSDocCastAtReturnStatement.errors.txt.diff | 28 -- ...thesizedJSDocCastAtReturnStatement.symbols | 2 - ...zedJSDocCastAtReturnStatement.symbols.diff | 2 - .../requireOfJsonFileInJsFile.symbols | 4 - .../requireOfJsonFileInJsFile.symbols.diff | 12 +- .../strictOptionalProperties3.errors.txt | 24 -- .../strictOptionalProperties3.errors.txt.diff | 44 ++-- .../subclassThisTypeAssignable01.errors.txt | 7 +- ...bclassThisTypeAssignable01.errors.txt.diff | 20 ++ .../compiler/topLevelBlockExpando.errors.txt | 47 ---- .../topLevelBlockExpando.errors.txt.diff | 52 ---- ...eWithSameNameAndCommonRoot.errors.txt.diff | 36 +++ ...thSameNameAndCommonRootES6.errors.txt.diff | 36 +++ ...sWithSameNameAndCommonRoot.errors.txt.diff | 22 ++ ...portedClassesOfTheSameName.errors.txt.diff | 32 +++ ...ithExportedModulesOfTheSameName.errors.txt | 43 +++ ...portedModulesOfTheSameName.errors.txt.diff | 48 ++++ ...asiPreventsParsingAsNamespace05.errors.txt | 15 ++ ...eventsParsingAsNamespace05.errors.txt.diff | 20 ++ .../assertionTypePredicates2.errors.txt | 32 --- .../assertionTypePredicates2.errors.txt.diff | 37 --- ...ertionsAndNonReturningFunctions.errors.txt | 72 ----- ...nsAndNonReturningFunctions.errors.txt.diff | 86 ++++-- .../asyncArrowFunction_allowJs.errors.txt | 50 ---- ...asyncArrowFunction_allowJs.errors.txt.diff | 83 +++--- .../asyncFunctionDeclaration16_es5.errors.txt | 67 ----- ...cFunctionDeclaration16_es5.errors.txt.diff | 106 ++++---- .../callbackCrossModule.errors.txt | 5 +- .../callbackCrossModule.errors.txt.diff | 5 +- .../callbackOnConstructor.errors.txt | 20 -- .../callbackOnConstructor.errors.txt.diff | 25 -- .../conformance/callbackTag1.errors.txt | 27 -- .../conformance/callbackTag1.errors.txt.diff | 32 --- .../conformance/callbackTag2.errors.txt | 11 +- .../conformance/callbackTag2.errors.txt.diff | 30 +-- .../conformance/callbackTag3.errors.txt | 13 - .../conformance/callbackTag3.errors.txt.diff | 18 -- .../conformance/callbackTag4.errors.txt | 5 +- .../conformance/callbackTag4.errors.txt.diff | 5 +- .../callbackTagNestedParameter.errors.txt | 23 -- ...callbackTagNestedParameter.errors.txt.diff | 28 -- .../callbackTagVariadicType.errors.txt | 16 -- .../callbackTagVariadicType.errors.txt.diff | 21 -- .../checkJsdocReturnTag2.errors.txt | 10 +- .../checkJsdocReturnTag2.errors.txt.diff | 32 +++ .../checkJsdocSatisfiesTag1.errors.txt | 38 --- .../checkJsdocSatisfiesTag1.errors.txt.diff | 62 +++-- .../checkJsdocSatisfiesTag1.symbols | 2 - .../checkJsdocSatisfiesTag1.symbols.diff | 2 - .../checkJsdocSatisfiesTag3.errors.txt | 5 +- .../checkJsdocSatisfiesTag3.errors.txt.diff | 9 +- .../conformance/checkJsdocTypeTag1.errors.txt | 60 ----- .../checkJsdocTypeTag1.errors.txt.diff | 89 ++++--- .../conformance/checkJsdocTypeTag2.errors.txt | 50 ---- .../checkJsdocTypeTag2.errors.txt.diff | 85 +++--- .../conformance/checkJsdocTypeTag4.errors.txt | 18 -- .../checkJsdocTypeTag4.errors.txt.diff | 36 ++- .../conformance/checkJsdocTypeTag5.errors.txt | 64 ----- .../checkJsdocTypeTag5.errors.txt.diff | 106 ++++---- .../conformance/checkJsdocTypeTag6.errors.txt | 52 ---- .../checkJsdocTypeTag6.errors.txt.diff | 87 ++++--- ...ckJsdocTypeTagOnObjectProperty1.errors.txt | 31 --- ...ocTypeTagOnObjectProperty1.errors.txt.diff | 36 --- ...ckJsdocTypeTagOnObjectProperty2.errors.txt | 36 --- ...ocTypeTagOnObjectProperty2.errors.txt.diff | 64 ++--- .../checkJsdocTypedefInParamTag1.errors.txt | 55 ---- ...eckJsdocTypedefInParamTag1.errors.txt.diff | 60 ----- ...checkJsdocTypedefOnlySourceFile.errors.txt | 5 +- ...JsdocTypedefOnlySourceFile.errors.txt.diff | 5 +- ...checkSpecialPropertyAssignments.errors.txt | 7 +- ...SpecialPropertyAssignments.errors.txt.diff | 16 +- ...assCanExtendConstructorFunction.errors.txt | 17 +- ...nExtendConstructorFunction.errors.txt.diff | 23 +- ...ommonJSImportClassTypeReference.errors.txt | 5 +- ...JSImportClassTypeReference.errors.txt.diff | 5 +- ...JSImportExportedClassExpression.errors.txt | 5 +- ...ortExportedClassExpression.errors.txt.diff | 5 +- ...SImportNestedClassTypeReference.errors.txt | 5 +- ...rtNestedClassTypeReference.errors.txt.diff | 5 +- ...torFunctionMethodTypeParameters.errors.txt | 49 ---- ...nctionMethodTypeParameters.errors.txt.diff | 54 ---- .../conformance/enumMerging.errors.txt | 72 +++++ .../conformance/enumMerging.errors.txt.diff | 77 ++++++ .../submodule/conformance/enumTag.errors.txt | 18 +- .../conformance/enumTag.errors.txt.diff | 36 +-- .../conformance/enumTagImported.errors.txt | 31 --- .../enumTagImported.errors.txt.diff | 36 --- .../enumTagUseBeforeDefCrash.errors.txt | 16 -- .../enumTagUseBeforeDefCrash.errors.txt.diff | 21 -- .../errorOnFunctionReturnType.errors.txt | 56 ---- .../errorOnFunctionReturnType.errors.txt.diff | 106 ++++---- .../exportedEnumTypeAndValue.errors.txt | 19 -- .../exportedEnumTypeAndValue.errors.txt.diff | 24 -- .../conformance/extendsTag5.errors.txt | 51 ---- .../conformance/extendsTag5.errors.txt.diff | 84 +++--- .../genericSetterInClassTypeJsDoc.errors.txt | 29 --- ...ericSetterInClassTypeJsDoc.errors.txt.diff | 34 --- .../conformance/importTag1.errors.txt | 20 -- .../conformance/importTag1.errors.txt.diff | 25 -- .../importTag15(module=es2015).errors.txt | 15 -- ...importTag15(module=es2015).errors.txt.diff | 30 +-- .../importTag15(module=esnext).errors.txt | 15 -- ...importTag15(module=esnext).errors.txt.diff | 30 +-- .../conformance/importTag16.errors.txt | 21 -- .../conformance/importTag16.errors.txt.diff | 26 -- .../conformance/importTag17.errors.txt | 44 ---- .../conformance/importTag17.errors.txt.diff | 67 +++-- .../conformance/importTag18.errors.txt | 20 -- .../conformance/importTag18.errors.txt.diff | 25 -- .../conformance/importTag19.errors.txt | 19 -- .../conformance/importTag19.errors.txt.diff | 24 -- .../conformance/importTag2.errors.txt | 20 -- .../conformance/importTag2.errors.txt.diff | 25 -- .../conformance/importTag20.errors.txt | 20 -- .../conformance/importTag20.errors.txt.diff | 25 -- .../conformance/importTag3.errors.txt | 20 -- .../conformance/importTag3.errors.txt.diff | 25 -- .../conformance/importTag4.errors.txt | 24 -- .../conformance/importTag4.errors.txt.diff | 48 ++-- .../conformance/importTag5.errors.txt | 20 -- .../conformance/importTag5.errors.txt.diff | 25 -- .../conformance/importTag6.errors.txt | 30 --- .../conformance/importTag6.errors.txt.diff | 35 --- .../conformance/importTag7.errors.txt | 29 --- .../conformance/importTag7.errors.txt.diff | 34 --- .../conformance/importTag8.errors.txt | 29 --- .../conformance/importTag8.errors.txt.diff | 34 --- .../conformance/importTag9.errors.txt | 29 --- .../conformance/importTag9.errors.txt.diff | 34 --- .../conformance/inferThis.errors.txt | 36 --- .../conformance/inferThis.errors.txt.diff | 41 --- ...ypeParameterOnVariableStatement.errors.txt | 25 -- ...rameterOnVariableStatement.errors.txt.diff | 30 --- .../invalidNestedModules.errors.txt.diff | 46 ++++ ...ImplementsGenericsSerialization.errors.txt | 28 -- ...mentsGenericsSerialization.errors.txt.diff | 33 --- .../jsDeclarationsClasses.errors.txt | 50 +--- .../jsDeclarationsClasses.errors.txt.diff | 50 +--- .../jsDeclarationsEnumTag.errors.txt | 63 ----- .../jsDeclarationsEnumTag.errors.txt.diff | 68 ----- ...rationsExportDefinePropertyEmit.errors.txt | 23 +- ...nsExportDefinePropertyEmit.errors.txt.diff | 23 +- ...clarationsExportDefinePropertyEmit.symbols | 8 - ...tionsExportDefinePropertyEmit.symbols.diff | 24 +- ...ctionClassesCjsExportAssignment.errors.txt | 16 +- ...ClassesCjsExportAssignment.errors.txt.diff | 16 +- ...DeclarationsFunctionLikeClasses.errors.txt | 5 +- ...rationsFunctionLikeClasses.errors.txt.diff | 5 +- ...eclarationsFunctionLikeClasses2.errors.txt | 5 +- ...ationsFunctionLikeClasses2.errors.txt.diff | 5 +- .../jsDeclarationsFunctions.errors.txt | 76 ------ .../jsDeclarationsFunctions.errors.txt.diff | 81 ------ .../jsDeclarationsFunctions.symbols | 8 - .../jsDeclarationsFunctions.symbols.diff | 26 ++ .../jsDeclarationsFunctionsCjs.errors.txt | 8 +- ...jsDeclarationsFunctionsCjs.errors.txt.diff | 8 +- .../jsDeclarationsFunctionsCjs.symbols | 8 - .../jsDeclarationsFunctionsCjs.symbols.diff | 22 +- ...portAliasExposedWithinNamespace.errors.txt | 61 ----- ...liasExposedWithinNamespace.errors.txt.diff | 94 ++++--- ...tAliasExposedWithinNamespaceCjs.errors.txt | 8 +- ...sExposedWithinNamespaceCjs.errors.txt.diff | 8 +- ...eclarationsImportNamespacedType.errors.txt | 14 - ...ationsImportNamespacedType.errors.txt.diff | 19 -- ...jsDeclarationsImportTypeBundled.errors.txt | 5 +- ...larationsImportTypeBundled.errors.txt.diff | 5 +- ...larationsJSDocRedirectedLookups.errors.txt | 60 ----- ...ionsJSDocRedirectedLookups.errors.txt.diff | 65 ----- .../jsDeclarationsMissingGenerics.errors.txt | 17 -- ...eclarationsMissingGenerics.errors.txt.diff | 22 -- ...clarationsMissingTypeParameters.errors.txt | 26 -- ...tionsMissingTypeParameters.errors.txt.diff | 31 --- ...larationsModuleReferenceHasEmit.errors.txt | 19 -- ...ionsModuleReferenceHasEmit.errors.txt.diff | 24 -- ...ameterTagReusesInputNodeInEmit1.errors.txt | 8 +- ...rTagReusesInputNodeInEmit1.errors.txt.diff | 8 +- ...ameterTagReusesInputNodeInEmit2.errors.txt | 8 +- ...rTagReusesInputNodeInEmit2.errors.txt.diff | 8 +- .../jsDeclarationsReactComponents.errors.txt | 5 +- ...eclarationsReactComponents.errors.txt.diff | 5 +- .../jsDeclarationsReactComponents.symbols | 2 - ...jsDeclarationsReactComponents.symbols.diff | 7 +- ...sExistingNodesMappingJSDocTypes.errors.txt | 38 --- ...tingNodesMappingJSDocTypes.errors.txt.diff | 43 --- .../jsDeclarationsTypeAliases.errors.txt | 5 +- .../jsDeclarationsTypeAliases.errors.txt.diff | 5 +- ...clarationsTypedefAndImportTypes.errors.txt | 5 +- ...tionsTypedefAndImportTypes.errors.txt.diff | 5 +- ...DeclarationsTypedefAndLatebound.errors.txt | 5 +- ...rationsTypedefAndLatebound.errors.txt.diff | 5 +- .../jsDeclarationsTypedefFunction.errors.txt | 21 -- ...eclarationsTypedefFunction.errors.txt.diff | 26 -- ...edefPropertyAndExportAssignment.errors.txt | 8 +- ...ropertyAndExportAssignment.errors.txt.diff | 8 +- ...jsDeclarationsUniqueSymbolUsage.errors.txt | 23 -- ...larationsUniqueSymbolUsage.errors.txt.diff | 28 -- ...onstructorFunctionTypeReference.errors.txt | 20 -- ...uctorFunctionTypeReference.errors.txt.diff | 25 -- .../conformance/jsdocFunctionType.errors.txt | 17 +- .../jsdocFunctionType.errors.txt.diff | 28 +- .../conformance/jsdocImportType.errors.txt | 33 --- .../jsdocImportType.errors.txt.diff | 38 --- .../conformance/jsdocImportType2.errors.txt | 32 --- .../jsdocImportType2.errors.txt.diff | 37 --- ...ImportTypeReferenceToClassAlias.errors.txt | 5 +- ...tTypeReferenceToClassAlias.errors.txt.diff | 5 +- ...rtTypeReferenceToCommonjsModule.errors.txt | 17 -- ...eReferenceToCommonjsModule.errors.txt.diff | 22 -- ...ocImportTypeReferenceToESModule.errors.txt | 14 - ...ortTypeReferenceToESModule.errors.txt.diff | 19 -- ...ortTypeReferenceToStringLiteral.errors.txt | 12 - ...peReferenceToStringLiteral.errors.txt.diff | 17 -- .../jsdocIndexSignature.errors.txt | 27 -- .../jsdocIndexSignature.errors.txt.diff | 45 ++-- .../jsdocOuterTypeParameters1.errors.txt | 5 +- .../jsdocOuterTypeParameters1.errors.txt.diff | 8 +- .../jsdocOuterTypeParameters2.errors.txt | 5 +- .../jsdocOuterTypeParameters2.errors.txt.diff | 7 +- .../jsdocParseHigherOrderFunction.errors.txt | 6 +- ...ocParseHigherOrderFunction.errors.txt.diff | 6 +- ...arseParenthesizedJSDocParameter.errors.txt | 6 +- ...arenthesizedJSDocParameter.errors.txt.diff | 6 +- .../conformance/jsdocPrivateName1.errors.txt | 11 - .../jsdocPrivateName1.errors.txt.diff | 16 ++ .../conformance/jsdocReturnTag1.errors.txt | 5 +- .../jsdocReturnTag1.errors.txt.diff | 5 +- ...sdocSignatureOnReturnedFunction.errors.txt | 51 ++++ ...ignatureOnReturnedFunction.errors.txt.diff | 56 ++++ .../conformance/jsdocTemplateClass.errors.txt | 20 +- .../jsdocTemplateClass.errors.txt.diff | 33 +-- ...sdocTemplateConstructorFunction.errors.txt | 31 --- ...emplateConstructorFunction.errors.txt.diff | 50 ++-- ...docTemplateConstructorFunction2.errors.txt | 41 --- ...mplateConstructorFunction2.errors.txt.diff | 68 ++--- .../conformance/jsdocTemplateTag.errors.txt | 12 +- .../jsdocTemplateTag.errors.txt.diff | 28 +- .../conformance/jsdocTemplateTag2.errors.txt | 20 -- .../jsdocTemplateTag2.errors.txt.diff | 25 -- .../conformance/jsdocTemplateTag3.errors.txt | 57 ---- .../jsdocTemplateTag3.errors.txt.diff | 92 +++---- .../conformance/jsdocTemplateTag5.errors.txt | 24 +- .../jsdocTemplateTag5.errors.txt.diff | 24 +- .../conformance/jsdocTemplateTag6.errors.txt | 139 ---------- .../jsdocTemplateTag6.errors.txt.diff | 144 ---------- .../conformance/jsdocTemplateTag6.symbols | 3 - .../jsdocTemplateTag6.symbols.diff | 20 +- .../conformance/jsdocTemplateTag7.errors.txt | 28 -- .../jsdocTemplateTag7.errors.txt.diff | 49 ++-- .../conformance/jsdocTemplateTag8.errors.txt | 23 +- .../jsdocTemplateTag8.errors.txt.diff | 44 +--- .../jsdocTemplateTagDefault.errors.txt | 99 ------- .../jsdocTemplateTagDefault.errors.txt.diff | 167 +++++------- .../jsdocTemplateTagNameResolution.errors.txt | 16 -- ...cTemplateTagNameResolution.errors.txt.diff | 28 +- .../conformance/jsdocThisType.errors.txt | 50 ---- .../conformance/jsdocThisType.errors.txt.diff | 89 ++++--- .../conformance/jsdocThisType.symbols | 2 - .../conformance/jsdocThisType.symbols.diff | 20 +- .../jsdocTypeDefAtStartOfFile.errors.txt | 17 -- .../jsdocTypeDefAtStartOfFile.errors.txt.diff | 22 -- .../jsdocTypeReferenceExports.errors.txt | 5 +- .../jsdocTypeReferenceExports.errors.txt.diff | 5 +- .../jsdocTypeReferenceToImport.errors.txt | 8 +- ...jsdocTypeReferenceToImport.errors.txt.diff | 8 +- ...jsdocTypeReferenceToMergedClass.errors.txt | 5 +- ...TypeReferenceToMergedClass.errors.txt.diff | 5 +- .../jsdocTypeReferenceToValue.errors.txt | 11 - .../jsdocTypeReferenceToValue.errors.txt.diff | 16 -- .../conformance/jsdocTypeTag.errors.txt | 131 ---------- .../conformance/jsdocTypeTag.errors.txt.diff | 136 ---------- .../conformance/jsdocTypeTagCast.errors.txt | 13 +- .../jsdocTypeTagCast.errors.txt.diff | 26 +- .../jsdocTypeTagParameterType.errors.txt | 6 +- .../jsdocTypeTagParameterType.errors.txt.diff | 7 +- .../jsdocTypeTagRequiredParameters.errors.txt | 6 +- ...cTypeTagRequiredParameters.errors.txt.diff | 6 +- .../conformance/jsdocVariadicType.errors.txt | 15 -- .../jsdocVariadicType.errors.txt.diff | 20 -- .../moduleExportAssignment7.errors.txt | 44 +--- .../moduleExportAssignment7.errors.txt.diff | 62 +---- .../conformance/overloadTag1.errors.txt | 50 ---- .../conformance/overloadTag1.errors.txt.diff | 79 +++--- .../conformance/overloadTag3.errors.txt | 29 --- .../conformance/overloadTag3.errors.txt.diff | 34 --- ...TagBracketsAddOptionalUndefined.errors.txt | 11 +- ...acketsAddOptionalUndefined.errors.txt.diff | 11 +- .../paramTagTypeResolution2.errors.txt | 22 -- .../paramTagTypeResolution2.errors.txt.diff | 27 -- ...esOfGenericConstructorFunctions.errors.txt | 64 ----- ...enericConstructorFunctions.errors.txt.diff | 69 ----- ...ropertyAssignmentUseParentType2.errors.txt | 38 --- ...tyAssignmentUseParentType2.errors.txt.diff | 61 ++--- .../propertyAssignmentUseParentType2.symbols | 6 - ...pertyAssignmentUseParentType2.symbols.diff | 12 +- ...ertyAssignmentMergeAcrossFiles2.errors.txt | 8 +- ...ssignmentMergeAcrossFiles2.errors.txt.diff | 9 +- ...tyAssignmentMergedTypeReference.errors.txt | 21 -- ...ignmentMergedTypeReference.errors.txt.diff | 26 -- .../recursiveTypeReferences2.errors.txt | 33 --- .../recursiveTypeReferences2.errors.txt.diff | 46 +++- .../conformance/returnTagTypeGuard.errors.txt | 12 +- .../returnTagTypeGuard.errors.txt.diff | 12 +- .../conformance/returnTagTypeGuard.symbols | 2 - .../returnTagTypeGuard.symbols.diff | 8 +- .../templateInsideCallback.errors.txt | 11 +- .../templateInsideCallback.errors.txt.diff | 22 +- .../templateInsideCallback.symbols | 4 - .../templateInsideCallback.symbols.diff | 4 - .../submodule/conformance/thisTag1.symbols | 2 - .../conformance/thisTag1.symbols.diff | 2 - .../thisTypeOfConstructorFunctions.errors.txt | 67 ----- ...TypeOfConstructorFunctions.errors.txt.diff | 72 ----- .../typeFromContextualThisType.errors.txt | 24 ++ ...typeFromContextualThisType.errors.txt.diff | 29 +++ .../typeFromContextualThisType.symbols | 12 - .../typeFromContextualThisType.symbols.diff | 24 +- .../typeFromJSInitializer.errors.txt | 6 +- .../typeFromJSInitializer.errors.txt.diff | 19 +- .../typeFromJSInitializer4.errors.txt | 5 +- .../typeFromJSInitializer4.errors.txt.diff | 22 ++ .../typeFromParamTagForFunction.errors.txt | 42 +-- ...ypeFromParamTagForFunction.errors.txt.diff | 40 +-- .../typeFromPropertyAssignment.errors.txt | 8 +- ...typeFromPropertyAssignment.errors.txt.diff | 8 +- .../typeFromPropertyAssignment10.errors.txt | 5 +- ...peFromPropertyAssignment10.errors.txt.diff | 5 +- .../typeFromPropertyAssignment10_1.errors.txt | 5 +- ...FromPropertyAssignment10_1.errors.txt.diff | 5 +- .../typeFromPropertyAssignment14.errors.txt | 5 +- ...peFromPropertyAssignment14.errors.txt.diff | 5 +- .../typeFromPropertyAssignment15.errors.txt | 5 +- ...peFromPropertyAssignment15.errors.txt.diff | 5 +- .../typeFromPropertyAssignment16.errors.txt | 5 +- ...peFromPropertyAssignment16.errors.txt.diff | 5 +- .../typeFromPropertyAssignment2.errors.txt | 8 +- ...ypeFromPropertyAssignment2.errors.txt.diff | 8 +- .../typeFromPropertyAssignment24.errors.txt | 5 +- ...peFromPropertyAssignment24.errors.txt.diff | 5 +- .../typeFromPropertyAssignment3.errors.txt | 8 +- ...ypeFromPropertyAssignment3.errors.txt.diff | 8 +- .../typeFromPropertyAssignment35.errors.txt | 5 +- ...peFromPropertyAssignment35.errors.txt.diff | 5 +- .../typeFromPropertyAssignment4.errors.txt | 10 +- ...ypeFromPropertyAssignment4.errors.txt.diff | 10 +- .../typeFromPropertyAssignment40.errors.txt | 14 - ...peFromPropertyAssignment40.errors.txt.diff | 19 -- .../typeFromPropertyAssignment5.errors.txt | 18 -- ...ypeFromPropertyAssignment5.errors.txt.diff | 23 -- .../typeFromPropertyAssignment6.errors.txt | 5 +- ...ypeFromPropertyAssignment6.errors.txt.diff | 5 +- ...romPropertyAssignmentOutOfOrder.errors.txt | 5 +- ...opertyAssignmentOutOfOrder.errors.txt.diff | 5 +- .../typeFromPrototypeAssignment3.errors.txt | 9 +- ...peFromPrototypeAssignment3.errors.txt.diff | 11 +- .../conformance/typeLookupInIIFE.errors.txt | 11 - .../typeLookupInIIFE.errors.txt.diff | 23 +- .../conformance/typeTagNoErasure.errors.txt | 14 - .../typeTagNoErasure.errors.txt.diff | 29 +-- ...eTagOnFunctionReferencesGeneric.errors.txt | 22 -- ...nFunctionReferencesGeneric.errors.txt.diff | 27 -- .../conformance/typedefCrossModule.errors.txt | 11 +- .../typedefCrossModule.errors.txt.diff | 11 +- .../typedefCrossModule2.errors.txt | 8 +- .../typedefCrossModule2.errors.txt.diff | 8 +- .../typedefMultipleTypeParameters.errors.txt | 11 +- ...edefMultipleTypeParameters.errors.txt.diff | 16 +- .../typedefOnSemicolonClassElement.errors.txt | 13 - ...defOnSemicolonClassElement.errors.txt.diff | 18 -- .../typedefOnStatements.errors.txt | 56 +--- .../typedefOnStatements.errors.txt.diff | 85 +----- .../conformance/typedefScope1.errors.txt | 27 -- .../conformance/typedefScope1.errors.txt.diff | 46 ++-- .../typedefTagExtraneousProperty.errors.txt | 16 -- ...pedefTagExtraneousProperty.errors.txt.diff | 21 -- .../conformance/typedefTagNested.errors.txt | 52 ---- .../typedefTagNested.errors.txt.diff | 57 ---- .../typedefTagTypeResolution.errors.txt | 46 ---- .../typedefTagTypeResolution.errors.txt.diff | 80 +++--- .../conformance/typedefTagWrapping.errors.txt | 148 ----------- .../typedefTagWrapping.errors.txt.diff | 246 +++++++++--------- .../varRequireFromJavascript.errors.txt | 5 +- .../varRequireFromJavascript.errors.txt.diff | 5 +- .../varRequireFromTypescript.errors.txt | 8 +- .../varRequireFromTypescript.errors.txt.diff | 8 +- 501 files changed, 3782 insertions(+), 10713 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/commentsModules.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/commentsModules.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/declFileGenericType2.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/declFileGenericType2.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/declFileWithClassNameConflictingWithClassReferredByExtendsClause.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/declFileWithClassNameConflictingWithClassReferredByExtendsClause.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts2.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts2.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/dottedModuleName2.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/dottedModuleName2.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/dottedNamesInSystem.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/dottedNamesInSystem.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/emitMemberAccessExpression.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/emitMemberAccessExpression.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/genericClassPropertyInheritanceSpecialization.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/genericClassPropertyInheritanceSpecialization.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleExports1.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/ClassAndModuleWithSameNameAndCommonRoot.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/ClassAndModuleWithSameNameAndCommonRootES6.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/ModuleAndClassWithSameNameAndCommonRoot.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/asiPreventsParsingAsNamespace05.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/asiPreventsParsingAsNamespace05.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/enumMerging.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/enumMerging.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag1.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag16.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag16.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag17.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag18.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag18.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag19.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag19.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag20.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag20.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag3.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag3.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag4.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag5.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag6.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag6.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag7.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag7.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag8.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag8.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag9.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importTag9.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/inferThis.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/inferThis.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/invalidNestedModules.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 0493ab81fc..dcb0975f3d 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -493,8 +493,6 @@ func (n *Node) Type() *Node { return n.AsTemplateLiteralTypeSpan().Type case KindJSDocTypeExpression: return n.AsJSDocTypeExpression().Type - case KindJSTypeExpression: - return n.AsJSTypeExpression().Type case KindJSDocNullableType: return n.AsJSDocNullableType().Type case KindJSDocNonNullableType: @@ -1368,10 +1366,6 @@ func (n *Node) AsJSDocTypeTag() *JSDocTypeTag { return n.data.(*JSDocTypeTag) } -func (n *Node) AsJSTypeExpression() *JSTypeExpression { - return n.data.(*JSTypeExpression) -} - func (n *Node) AsJSDocUnknownTag() *JSDocUnknownTag { return n.data.(*JSDocUnknownTag) } @@ -7848,42 +7842,6 @@ func (node *JSDocOptionalType) Clone(f *NodeFactory) *Node { return cloneNode(f.NewJSDocOptionalType(node.Type), node.AsNode(), f.hooks) } -// TODO: This name is WAAAAAAAAAAAAY too close to JSDocTypeExpression. Either rename it or remove it or use an existing node -// JSTypeExpression -type JSTypeExpression struct { - TypeNodeBase - Type *TypeNode -} - -func (f *NodeFactory) NewJSTypeExpression(typeNode *TypeNode) *Node { - data := &JSTypeExpression{} - data.Type = typeNode - return newNode(KindJSTypeExpression, data, f.hooks) -} - -func (f *NodeFactory) UpdateJSTypeExpression(node *JSTypeExpression, typeNode *TypeNode) *Node { - if typeNode != node.Type { - return updateNode(f.NewJSTypeExpression(typeNode), node.AsNode(), f.hooks) - } - return node.AsNode() -} - -func (node *JSTypeExpression) ForEachChild(v Visitor) bool { - return visit(v, node.Type) -} - -func (node *JSTypeExpression) VisitEachChild(v *NodeVisitor) *Node { - return v.Factory.UpdateJSTypeExpression(node, v.visitNode(node.Type)) -} - -func (node *JSTypeExpression) Clone(f *NodeFactory) *Node { - return updateNode(f.NewJSTypeExpression(node.Type), node.AsNode(), f.hooks) -} - -func IsJSTypeExpression(node *Node) bool { - return node.Kind == KindJSTypeExpression -} - // JSDocTypeTag type JSDocTypeTag struct { diff --git a/internal/ast/kind.go b/internal/ast/kind.go index 097b43f286..228c440c58 100644 --- a/internal/ast/kind.go +++ b/internal/ast/kind.go @@ -378,7 +378,6 @@ const ( // Synthesized list KindSyntaxList // Synthesized JS nodes - KindJSTypeExpression KindJSTypeAliasDeclaration // Transformation nodes KindNotEmittedStatement diff --git a/internal/ast/kind_stringer_generated.go b/internal/ast/kind_stringer_generated.go index 8bc7fc9b37..62972bad69 100644 --- a/internal/ast/kind_stringer_generated.go +++ b/internal/ast/kind_stringer_generated.go @@ -353,18 +353,17 @@ func _() { _ = x[KindJSDocSatisfiesTag-342] _ = x[KindJSDocImportTag-343] _ = x[KindSyntaxList-344] - _ = x[KindJSTypeExpression-345] - _ = x[KindJSTypeAliasDeclaration-346] - _ = x[KindNotEmittedStatement-347] - _ = x[KindPartiallyEmittedExpression-348] - _ = x[KindCommaListExpression-349] - _ = x[KindSyntheticReferenceExpression-350] - _ = x[KindCount-351] + _ = x[KindJSTypeAliasDeclaration-345] + _ = x[KindNotEmittedStatement-346] + _ = x[KindPartiallyEmittedExpression-347] + _ = x[KindCommaListExpression-348] + _ = x[KindSyntheticReferenceExpression-349] + _ = x[KindCount-350] } -const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindBundleKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocMemberNameKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeExpressionKindJSTypeAliasDeclarationKindNotEmittedStatementKindPartiallyEmittedExpressionKindCommaListExpressionKindSyntheticReferenceExpressionKindCount" +const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindBundleKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocMemberNameKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeAliasDeclarationKindNotEmittedStatementKindPartiallyEmittedExpressionKindCommaListExpressionKindSyntheticReferenceExpressionKindCount" -var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3141, 3165, 3182, 3195, 3208, 3229, 3252, 3271, 3292, 3323, 3338, 3353, 3368, 3385, 3407, 3425, 3442, 3459, 3475, 3494, 3507, 3522, 3535, 3548, 3564, 3576, 3589, 3609, 3628, 3641, 3662, 3674, 3690, 3711, 3725, 3740, 3760, 3783, 3810, 3824, 3848, 3871, 3889, 3915, 3942, 3970, 3997, 4015, 4032, 4060, 4087, 4114, 4136, 4153, 4173, 4193, 4211, 4230, 4255, 4281, 4301, 4326, 4348, 4367, 4384, 4403, 4424, 4455, 4471, 4492, 4508, 4531, 4554, 4570, 4595, 4604, 4622, 4643, 4666, 4681, 4696, 4714, 4730, 4748, 4766, 4787, 4805, 4824, 4841, 4860, 4880, 4898, 4914, 4935, 4958, 4985, 5008, 5028, 5052, 5076, 5095, 5116, 5131, 5144, 5174, 5201, 5222, 5238, 5257, 5273, 5292, 5312, 5333, 5349, 5368, 5387, 5409, 5436, 5450, 5475, 5496, 5517, 5532, 5554, 5576, 5592, 5609, 5631, 5648, 5669, 5683, 5700, 5718, 5733, 5753, 5772, 5794, 5825, 5845, 5859, 5873, 5883, 5906, 5928, 5947, 5963, 5984, 6008, 6029, 6050, 6059, 6072, 6092, 6110, 6123, 6140, 6158, 6170, 6190, 6212, 6234, 6252, 6271, 6292, 6312, 6332, 6352, 6372, 6393, 6411, 6427, 6443, 6463, 6482, 6497, 6517, 6538, 6556, 6570, 6590, 6616, 6639, 6669, 6692, 6724, 6733} +var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3141, 3165, 3182, 3195, 3208, 3229, 3252, 3271, 3292, 3323, 3338, 3353, 3368, 3385, 3407, 3425, 3442, 3459, 3475, 3494, 3507, 3522, 3535, 3548, 3564, 3576, 3589, 3609, 3628, 3641, 3662, 3674, 3690, 3711, 3725, 3740, 3760, 3783, 3810, 3824, 3848, 3871, 3889, 3915, 3942, 3970, 3997, 4015, 4032, 4060, 4087, 4114, 4136, 4153, 4173, 4193, 4211, 4230, 4255, 4281, 4301, 4326, 4348, 4367, 4384, 4403, 4424, 4455, 4471, 4492, 4508, 4531, 4554, 4570, 4595, 4604, 4622, 4643, 4666, 4681, 4696, 4714, 4730, 4748, 4766, 4787, 4805, 4824, 4841, 4860, 4880, 4898, 4914, 4935, 4958, 4985, 5008, 5028, 5052, 5076, 5095, 5116, 5131, 5144, 5174, 5201, 5222, 5238, 5257, 5273, 5292, 5312, 5333, 5349, 5368, 5387, 5409, 5436, 5450, 5475, 5496, 5517, 5532, 5554, 5576, 5592, 5609, 5631, 5648, 5669, 5683, 5700, 5718, 5733, 5753, 5772, 5794, 5825, 5845, 5859, 5873, 5883, 5906, 5928, 5947, 5963, 5984, 6008, 6029, 6050, 6059, 6072, 6092, 6110, 6123, 6140, 6158, 6170, 6190, 6212, 6234, 6252, 6271, 6292, 6312, 6332, 6352, 6372, 6393, 6411, 6427, 6443, 6463, 6482, 6497, 6517, 6538, 6556, 6570, 6596, 6619, 6649, 6672, 6704, 6713} func (i Kind) String() string { if i < 0 || i >= Kind(len(_Kind_index)-1) { diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 8e3ef1f89d..4368a490cf 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -20933,8 +20933,6 @@ func (c *Checker) getTypeFromTypeNodeWorker(node *ast.Node) *Type { return c.getTypeFromNamedTupleTypeNode(node) case ast.KindParenthesizedType: return c.getTypeFromTypeNode(node.AsParenthesizedTypeNode().Type) - case ast.KindJSTypeExpression: - return c.getTypeFromTypeNode(node.AsJSTypeExpression().Type) case ast.KindRestType: return c.getTypeFromRestTypeNode(node) case ast.KindFunctionType, ast.KindConstructorType, ast.KindTypeLiteral: diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index dba36c49a4..95fba08dd3 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -210,10 +210,10 @@ func (p *Parser) makeNewType(typeExpression *ast.TypeNode) *ast.Node { if typeExpression == nil { return nil } - t := p.factory.NewJSTypeExpression(typeExpression.Type()) + + t := typeExpression.Clone(&p.factory) // TODO: What other flags? Copy from decl? from tag's typeexpression? - t.Flags |= p.contextFlags | ast.NodeFlagsSynthesized - t.Loc = core.NewTextRange(t.Type().Pos(), t.Type().End()) + t.Flags |= typeExpression.Flags | ast.NodeFlagsSynthesized return t } diff --git a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols index f76120be75..2ea9dc696a 100644 --- a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols +++ b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols @@ -42,9 +42,7 @@ define("lib/ExtendedClass", ["deps/BaseClass"], const ExtendedClass = BaseClass.extends({ >ExtendedClass : Symbol(ExtendedClass, Decl(ExtendedClass.js, 8, 9)) ->BaseClass.extends : Symbol(extends, Decl(BaseClass.d.ts, 1, 21)) >BaseClass : Symbol(BaseClass, Decl(ExtendedClass.js, 6, 1)) ->extends : Symbol(extends, Decl(BaseClass.d.ts, 1, 21)) f: function() { >f : Symbol(f, Decl(ExtendedClass.js, 8, 45)) diff --git a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols.diff b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols.diff index 0397def26c..d3b6c4eb67 100644 --- a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols.diff @@ -14,14 +14,12 @@ const ExtendedClass = BaseClass.extends({ >ExtendedClass : Symbol(ExtendedClass, Decl(ExtendedClass.js, 8, 9)) ->BaseClass.extends : Symbol(BaseClass.extends, Decl(BaseClass.d.ts, 1, 21)) -+>BaseClass.extends : Symbol(extends, Decl(BaseClass.d.ts, 1, 21)) >BaseClass : Symbol(BaseClass, Decl(ExtendedClass.js, 6, 1)) ->extends : Symbol(BaseClass.extends, Decl(BaseClass.d.ts, 1, 21)) -+>extends : Symbol(extends, Decl(BaseClass.d.ts, 1, 21)) f: function() { >f : Symbol(f, Decl(ExtendedClass.js, 8, 45)) -@@= skipped -16, +16 lines =@@ +@@= skipped -16, +14 lines =@@ >module : Symbol(module, Decl(ExtendedClass.js, 15, 9)) module.exports = ExtendedClass diff --git a/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt deleted file mode 100644 index 50e261254c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -file.js(11,1): error TS2322: Type '"z"' is not assignable to type '"x" | "y"'. - - -==== file.js (1 errors) ==== - // @ts-check - const obj = { - x: 1, - y: 2 - }; - - /** - * @type {keyof typeof obj} - */ - let selected = "x"; - selected = "z"; // should fail - ~~~~~~~~ -!!! error TS2322: Type '"z"' is not assignable to type '"x" | "y"'. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt.diff new file mode 100644 index 0000000000..f353883d9e --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt.diff @@ -0,0 +1,23 @@ +--- old.checkJsObjectLiteralHasCheckedKeyof.errors.txt ++++ new.checkJsObjectLiteralHasCheckedKeyof.errors.txt +@@= skipped -0, +-1 lines =@@ +-file.js(11,1): error TS2322: Type '"z"' is not assignable to type '"x" | "y"'. +- +- +-==== file.js (1 errors) ==== +- // @ts-check +- const obj = { +- x: 1, +- y: 2 +- }; +- +- /** +- * @type {keyof typeof obj} +- */ +- let selected = "x"; +- selected = "z"; // should fail +- ~~~~~~~~ +-!!! error TS2322: Type '"z"' is not assignable to type '"x" | "y"'. +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt deleted file mode 100644 index f52b8b168b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -a.js(7,12): error TS2304: Cannot find name 'Foo'. - - -==== a.js (1 errors) ==== - /** - * @typedef {Object} Foo - * @property {boolean} a - * @property {boolean} b - */ - - /** @type {Foo} */ - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - export default { c: false }; - -==== b.js (0 errors) ==== - import a from "./a"; - a; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt.diff index 4e0fd6c24e..1e8ac76736 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt.diff @@ -1,24 +1,26 @@ --- old.checkJsdocTypeTagOnExportAssignment1.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment1.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -a.js(8,18): error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. -+a.js(7,12): error TS2304: Cannot find name 'Foo'. - - +- +- -==== checkJsdocTypeTagOnExportAssignment1.js (0 errors) ==== - - ==== a.js (1 errors) ==== - /** - * @typedef {Object} Foo -@@= skipped -10, +8 lines =@@ - */ - - /** @type {Foo} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. - export default { c: false }; +-==== a.js (1 errors) ==== +- /** +- * @typedef {Object} Foo +- * @property {boolean} a +- * @property {boolean} b +- */ +- +- /** @type {Foo} */ +- export default { c: false }; - ~ -!!! error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. - - ==== b.js (0 errors) ==== - import a from "./a"; +- +-==== b.js (0 errors) ==== +- import a from "./a"; +- a; +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt deleted file mode 100644 index f26aaeb518..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -b.js(1,12): error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b - - -==== a.ts (0 errors) ==== - export interface Foo { - a: number; - b: number; - } - -==== b.js (1 errors) ==== - /** @type {import("./a").Foo} */ - ~~~~~~~~~~~~~~~~~ -!!! error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b - export default { c: false }; - -==== c.js (0 errors) ==== - import b from "./b"; - b; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt.diff index cd7affa2e5..d5c9b8cf66 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt.diff @@ -1,24 +1,26 @@ --- old.checkJsdocTypeTagOnExportAssignment2.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment2.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -b.js(2,18): error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. -+b.js(1,12): error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b - - +- +- -==== checkJsdocTypeTagOnExportAssignment2.js (0 errors) ==== - - ==== a.ts (0 errors) ==== - export interface Foo { - a: number; -@@= skipped -10, +8 lines =@@ - - ==== b.js (1 errors) ==== - /** @type {import("./a").Foo} */ -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b - export default { c: false }; +-==== a.ts (0 errors) ==== +- export interface Foo { +- a: number; +- b: number; +- } +- +-==== b.js (1 errors) ==== +- /** @type {import("./a").Foo} */ +- export default { c: false }; - ~ -!!! error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. - - ==== c.js (0 errors) ==== - import b from "./b"; +- +-==== c.js (0 errors) ==== +- import b from "./b"; +- b; +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt deleted file mode 100644 index f7a7891e8d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -a.js(9,12): error TS2304: Cannot find name 'Foo'. - - -==== a.js (1 errors) ==== - /** - * @typedef {Object} Foo - * @property {boolean} a - * @property {boolean} b - */ - - const bar = { c: 1 }; - - /** @type {Foo} */ - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - export default bar; - -==== b.js (0 errors) ==== - import a from "./a"; - a; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt.diff index 30b59b40ee..5ff3a7c368 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt.diff @@ -1,24 +1,28 @@ --- old.checkJsdocTypeTagOnExportAssignment3.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment3.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -a.js(10,16): error TS2739: Type '{ c: number; }' is missing the following properties from type 'Foo': a, b -+a.js(9,12): error TS2304: Cannot find name 'Foo'. - - +- +- -==== checkJsdocTypeTagOnExportAssignment3.js (0 errors) ==== - - ==== a.js (1 errors) ==== - /** - * @typedef {Object} Foo -@@= skipped -12, +10 lines =@@ - const bar = { c: 1 }; - - /** @type {Foo} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. - export default bar; +-==== a.js (1 errors) ==== +- /** +- * @typedef {Object} Foo +- * @property {boolean} a +- * @property {boolean} b +- */ +- +- const bar = { c: 1 }; +- +- /** @type {Foo} */ +- export default bar; - ~~~ -!!! error TS2739: Type '{ c: number; }' is missing the following properties from type 'Foo': a, b - - ==== b.js (0 errors) ==== - import a from "./a"; +- +-==== b.js (0 errors) ==== +- import a from "./a"; +- a; +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt deleted file mode 100644 index f5148d4872..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -a.js(5,12): error TS2304: Cannot find name 'Foo'. - - -==== a.js (1 errors) ==== - /** - * @typedef {number} Foo - */ - - /** @type {Foo} */ - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - export default ""; - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt.diff index 91b0d71d40..32ddc1e69a 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt.diff @@ -1,22 +1,21 @@ --- old.checkJsdocTypeTagOnExportAssignment4.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment4.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -a.js(6,16): error TS2322: Type 'string' is not assignable to type 'number'. -+a.js(5,12): error TS2304: Cannot find name 'Foo'. - - +- +- -==== checkJsdocTypeTagOnExportAssignment4.js (0 errors) ==== - - ==== a.js (1 errors) ==== - /** - * @typedef {number} Foo - */ - - /** @type {Foo} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. - export default ""; +-==== a.js (1 errors) ==== +- /** +- * @typedef {number} Foo +- */ +- +- /** @type {Foo} */ +- export default ""; - ~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. - - +- +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt deleted file mode 100644 index bf99967b72..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -a.js(7,12): error TS2304: Cannot find name 'Foo'. - - -==== a.js (1 errors) ==== - /** - * @typedef {Object} Foo - * @property {number} a - * @property {number} b - */ - - /** @type {Foo} */ - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - export default { a: 1, b: 1 }; - -==== b.js (0 errors) ==== - import a from "./a"; - a; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt.diff deleted file mode 100644 index ce9049574d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment5.errors.txt -+++ new.checkJsdocTypeTagOnExportAssignment5.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+a.js(7,12): error TS2304: Cannot find name 'Foo'. -+ -+ -+==== a.js (1 errors) ==== -+ /** -+ * @typedef {Object} Foo -+ * @property {number} a -+ * @property {number} b -+ */ -+ -+ /** @type {Foo} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. -+ export default { a: 1, b: 1 }; -+ -+==== b.js (0 errors) ==== -+ import a from "./a"; -+ a; -+ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt deleted file mode 100644 index 519affa186..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -a.js(7,12): error TS2304: Cannot find name 'Foo'. - - -==== a.js (1 errors) ==== - /** - * @typedef {Object} Foo - * @property {number} a - * @property {number} b - */ - - /** @type {Foo} */ - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - export default { a: 1, b: 1, c: 1 }; - -==== b.js (0 errors) ==== - import a from "./a"; - a; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt.diff index 9cc8a11eeb..d0a046118c 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.errors.txt.diff @@ -1,24 +1,26 @@ --- old.checkJsdocTypeTagOnExportAssignment6.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment6.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -a.js(8,30): error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. -+a.js(7,12): error TS2304: Cannot find name 'Foo'. - - +- +- -==== checkJsdocTypeTagOnExportAssignment6.js (0 errors) ==== - - ==== a.js (1 errors) ==== - /** - * @typedef {Object} Foo -@@= skipped -10, +8 lines =@@ - */ - - /** @type {Foo} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. - export default { a: 1, b: 1, c: 1 }; +-==== a.js (1 errors) ==== +- /** +- * @typedef {Object} Foo +- * @property {number} a +- * @property {number} b +- */ +- +- /** @type {Foo} */ +- export default { a: 1, b: 1, c: 1 }; - ~ -!!! error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. - - ==== b.js (0 errors) ==== - import a from "./a"; +- +-==== b.js (0 errors) ==== +- import a from "./a"; +- a; +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt deleted file mode 100644 index 27024c5f72..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -a.js(9,12): error TS2304: Cannot find name 'Foo'. - - -==== a.js (1 errors) ==== - /** - * @typedef {Object} Foo - * @property {number} a - * @property {number} b - */ - - const abc = { a: 1, b: 1, c: 1 }; - - /** @type {Foo} */ - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - export default abc; - -==== b.js (0 errors) ==== - import a from "./a"; - a; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt.diff deleted file mode 100644 index 4e2e8ee5c0..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment7.errors.txt -+++ new.checkJsdocTypeTagOnExportAssignment7.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+a.js(9,12): error TS2304: Cannot find name 'Foo'. -+ -+ -+==== a.js (1 errors) ==== -+ /** -+ * @typedef {Object} Foo -+ * @property {number} a -+ * @property {number} b -+ */ -+ -+ const abc = { a: 1, b: 1, c: 1 }; -+ -+ /** @type {Foo} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. -+ export default abc; -+ -+==== b.js (0 errors) ==== -+ import a from "./a"; -+ a; -+ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt deleted file mode 100644 index 6171d28ef9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -a.js(7,12): error TS2304: Cannot find name 'Foo'. - - -==== a.js (1 errors) ==== - /** - * @typedef Foo - * @property {string} a - * @property {'b'} b - */ - - /** @type {Foo} */ - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - export default { - a: 'a', - b: 'b' - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt.diff deleted file mode 100644 index e01014582b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment8.errors.txt -+++ new.checkJsdocTypeTagOnExportAssignment8.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+a.js(7,12): error TS2304: Cannot find name 'Foo'. -+ -+ -+==== a.js (1 errors) ==== -+ /** -+ * @typedef Foo -+ * @property {string} a -+ * @property {'b'} b -+ */ -+ -+ /** @type {Foo} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. -+ export default { -+ a: 'a', -+ b: 'b' -+ } -+ diff --git a/testdata/baselines/reference/submodule/compiler/commentsModules.errors.txt b/testdata/baselines/reference/submodule/compiler/commentsModules.errors.txt new file mode 100644 index 0000000000..f259ae9d33 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/commentsModules.errors.txt @@ -0,0 +1,118 @@ +commentsModules.ts(46,8): error TS2339: Property 'm3' does not exist on type 'typeof m2'. +commentsModules.ts(53,8): error TS2339: Property 'm4' does not exist on type 'typeof m3'. +commentsModules.ts(62,8): error TS2339: Property 'm5' does not exist on type 'typeof m4'. +commentsModules.ts(72,8): error TS2339: Property 'm6' does not exist on type 'typeof m5'. +commentsModules.ts(80,8): error TS2339: Property 'm7' does not exist on type 'typeof m6'. +commentsModules.ts(97,8): error TS2339: Property 'm8' does not exist on type 'typeof m7'. + + +==== commentsModules.ts (6 errors) ==== + /** Module comment*/ + module m1 { + /** b's comment*/ + export var b: number; + /** foo's comment*/ + function foo() { + return b; + } + /** m2 comments*/ + export module m2 { + /** class comment;*/ + export class c { + }; + /** i*/ + export var i = new c(); + } + /** exported function*/ + export function fooExport() { + return foo(); + } + + // shouldn't appear + export function foo2Export(/**hm*/ a: string) { + } + + /** foo3Export + * comment + */ + export function foo3Export() { + } + + /** foo4Export + * comment + */ + function foo4Export() { + } + } // trailing comment module + m1.fooExport(); + var myvar = new m1.m2.c(); + /** module comment of m2.m3*/ + module m2.m3 { + /** Exported class comment*/ + export class c { + } + } /* trailing dotted module comment*/ + new m2.m3.c(); + ~~ +!!! error TS2339: Property 'm3' does not exist on type 'typeof m2'. + /** module comment of m3.m4.m5*/ + module m3.m4.m5 { + /** Exported class comment*/ + export class c { + } + } // trailing dotted module 2 + new m3.m4.m5.c(); + ~~ +!!! error TS2339: Property 'm4' does not exist on type 'typeof m3'. + /** module comment of m4.m5.m6*/ + module m4.m5.m6 { + export module m7 { + /** Exported class comment*/ + export class c { + } + } /* trailing inner module */ /* multiple comments*/ + } + new m4.m5.m6.m7.c(); + ~~ +!!! error TS2339: Property 'm5' does not exist on type 'typeof m4'. + /** module comment of m5.m6.m7*/ + module m5.m6.m7 { + /** module m8 comment*/ + export module m8 { + /** Exported class comment*/ + export class c { + } + } + } + new m5.m6.m7.m8.c(); + ~~ +!!! error TS2339: Property 'm6' does not exist on type 'typeof m5'. + module m6.m7 { + export module m8 { + /** Exported class comment*/ + export class c { + } + } + } + new m6.m7.m8.c(); + ~~ +!!! error TS2339: Property 'm7' does not exist on type 'typeof m6'. + module m7.m8 { + /** module m9 comment*/ + export module m9 { + /** Exported class comment*/ + export class c { + } + + /** class d */ + class d { + } + + // class e + export class e { + } + } + } + new m7.m8.m9.c(); + ~~ +!!! error TS2339: Property 'm8' does not exist on type 'typeof m7'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commentsModules.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/commentsModules.errors.txt.diff new file mode 100644 index 0000000000..b38442f974 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/commentsModules.errors.txt.diff @@ -0,0 +1,123 @@ +--- old.commentsModules.errors.txt ++++ new.commentsModules.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++commentsModules.ts(46,8): error TS2339: Property 'm3' does not exist on type 'typeof m2'. ++commentsModules.ts(53,8): error TS2339: Property 'm4' does not exist on type 'typeof m3'. ++commentsModules.ts(62,8): error TS2339: Property 'm5' does not exist on type 'typeof m4'. ++commentsModules.ts(72,8): error TS2339: Property 'm6' does not exist on type 'typeof m5'. ++commentsModules.ts(80,8): error TS2339: Property 'm7' does not exist on type 'typeof m6'. ++commentsModules.ts(97,8): error TS2339: Property 'm8' does not exist on type 'typeof m7'. ++ ++ ++==== commentsModules.ts (6 errors) ==== ++ /** Module comment*/ ++ module m1 { ++ /** b's comment*/ ++ export var b: number; ++ /** foo's comment*/ ++ function foo() { ++ return b; ++ } ++ /** m2 comments*/ ++ export module m2 { ++ /** class comment;*/ ++ export class c { ++ }; ++ /** i*/ ++ export var i = new c(); ++ } ++ /** exported function*/ ++ export function fooExport() { ++ return foo(); ++ } ++ ++ // shouldn't appear ++ export function foo2Export(/**hm*/ a: string) { ++ } ++ ++ /** foo3Export ++ * comment ++ */ ++ export function foo3Export() { ++ } ++ ++ /** foo4Export ++ * comment ++ */ ++ function foo4Export() { ++ } ++ } // trailing comment module ++ m1.fooExport(); ++ var myvar = new m1.m2.c(); ++ /** module comment of m2.m3*/ ++ module m2.m3 { ++ /** Exported class comment*/ ++ export class c { ++ } ++ } /* trailing dotted module comment*/ ++ new m2.m3.c(); ++ ~~ ++!!! error TS2339: Property 'm3' does not exist on type 'typeof m2'. ++ /** module comment of m3.m4.m5*/ ++ module m3.m4.m5 { ++ /** Exported class comment*/ ++ export class c { ++ } ++ } // trailing dotted module 2 ++ new m3.m4.m5.c(); ++ ~~ ++!!! error TS2339: Property 'm4' does not exist on type 'typeof m3'. ++ /** module comment of m4.m5.m6*/ ++ module m4.m5.m6 { ++ export module m7 { ++ /** Exported class comment*/ ++ export class c { ++ } ++ } /* trailing inner module */ /* multiple comments*/ ++ } ++ new m4.m5.m6.m7.c(); ++ ~~ ++!!! error TS2339: Property 'm5' does not exist on type 'typeof m4'. ++ /** module comment of m5.m6.m7*/ ++ module m5.m6.m7 { ++ /** module m8 comment*/ ++ export module m8 { ++ /** Exported class comment*/ ++ export class c { ++ } ++ } ++ } ++ new m5.m6.m7.m8.c(); ++ ~~ ++!!! error TS2339: Property 'm6' does not exist on type 'typeof m5'. ++ module m6.m7 { ++ export module m8 { ++ /** Exported class comment*/ ++ export class c { ++ } ++ } ++ } ++ new m6.m7.m8.c(); ++ ~~ ++!!! error TS2339: Property 'm7' does not exist on type 'typeof m6'. ++ module m7.m8 { ++ /** module m9 comment*/ ++ export module m9 { ++ /** Exported class comment*/ ++ export class c { ++ } ++ ++ /** class d */ ++ class d { ++ } ++ ++ // class e ++ export class e { ++ } ++ } ++ } ++ new m7.m8.m9.c(); ++ ~~ ++!!! error TS2339: Property 'm8' does not exist on type 'typeof m7'. diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt index 055bd4c5f4..784c7e1822 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt @@ -1,14 +1,11 @@ -index.js(11,12): error TS2304: Cannot find name 'Fn'. index.js(16,17): error TS7006: Parameter 'a' implicitly has an 'any' type. index.js(16,20): error TS7006: Parameter 'b' implicitly has an 'any' type. index.js(18,5): error TS2554: Expected 2 arguments, but got 1. -index.js(22,12): error TS2304: Cannot find name 'Fn'. index.js(27,17): error TS7006: Parameter 'a' implicitly has an 'any' type. index.js(29,5): error TS2554: Expected 2 arguments, but got 1. -index.js(30,14): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. -==== index.js (8 errors) ==== +==== index.js (5 errors) ==== /** * * @param {number} num @@ -20,8 +17,6 @@ index.js(30,14): error TS2345: Argument of type 'undefined' is not assignable to */ /** @type {Fn} */ - ~~ -!!! error TS2304: Cannot find name 'Fn'. const fn1 = /** * @param [b] @@ -40,8 +35,6 @@ index.js(30,14): error TS2345: Argument of type 'undefined' is not assignable to }; /** @type {Fn} */ - ~~ -!!! error TS2304: Cannot find name 'Fn'. const fn2 = /** * @param {number} [b] @@ -55,7 +48,5 @@ index.js(30,14): error TS2345: Argument of type 'undefined' is not assignable to !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 index.js:27:20: An argument for 'b' was not provided. self("", undefined); - ~~~~~~~~~ -!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff index a29b985432..d33131fbc5 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff @@ -5,29 +5,19 @@ - Type 'undefined' is not assignable to type 'number'. -index.js(28,15): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. - Type 'undefined' is not assignable to type 'number'. -+index.js(11,12): error TS2304: Cannot find name 'Fn'. +index.js(16,17): error TS7006: Parameter 'a' implicitly has an 'any' type. +index.js(16,20): error TS7006: Parameter 'b' implicitly has an 'any' type. +index.js(18,5): error TS2554: Expected 2 arguments, but got 1. -+index.js(22,12): error TS2304: Cannot find name 'Fn'. +index.js(27,17): error TS7006: Parameter 'a' implicitly has an 'any' type. +index.js(29,5): error TS2554: Expected 2 arguments, but got 1. -+index.js(30,14): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. -==== index.js (2 errors) ==== -+==== index.js (8 errors) ==== ++==== index.js (5 errors) ==== /** * * @param {number} num -@@= skipped -15, +19 lines =@@ - */ - - /** @type {Fn} */ -+ ~~ -+!!! error TS2304: Cannot find name 'Fn'. - const fn1 = - /** +@@= skipped -20, +21 lines =@@ * @param [b] */ function self(a, b) { @@ -46,11 +36,7 @@ self("", undefined); }; - /** @type {Fn} */ -+ ~~ -+!!! error TS2304: Cannot find name 'Fn'. - const fn2 = - /** +@@= skipped -14, +18 lines =@@ * @param {number} [b] */ function self(a, b) { @@ -65,7 +51,5 @@ +!!! error TS2554: Expected 2 arguments, but got 1. +!!! related TS6210 index.js:27:20: An argument for 'b' was not provided. self("", undefined); -+ ~~~~~~~~~ -+!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. }; diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt deleted file mode 100644 index 8e04300497..0000000000 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt +++ /dev/null @@ -1,45 +0,0 @@ -index.js(10,12): error TS2304: Cannot find name 'Funcs'. -index.js(10,18): error TS2304: Cannot find name 'A'. -index.js(10,21): error TS2304: Cannot find name 'B'. -index.js(11,15): error TS2304: Cannot find name 'A'. -index.js(11,18): error TS2304: Cannot find name 'B'. -index.js(14,3): error TS2322: Type 'null' is not assignable to type '[A, B]'. - - -==== index.js (6 errors) ==== - /** - * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs - * @template A - * @template {Record} B - */ - - /** - * @template A - * @template {Record} B - * @param {Funcs} fns - ~~~~~ -!!! error TS2304: Cannot find name 'Funcs'. - ~ -!!! error TS2304: Cannot find name 'A'. - ~ -!!! error TS2304: Cannot find name 'B'. - * @returns {[A, B]} - ~ -!!! error TS2304: Cannot find name 'A'. - ~ -!!! error TS2304: Cannot find name 'B'. - */ - function foo(fns) { - return /** @type {any} */ (null); - ~~~~~~ -!!! error TS2322: Type 'null' is not assignable to type '[A, B]'. - } - - const result = foo({ - bar: { - fn: - /** @param {string} a */ - (a) => {}, - thing: "asd", - }, - }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff deleted file mode 100644 index f28a121e26..0000000000 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff +++ /dev/null @@ -1,50 +0,0 @@ ---- old.contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt -+++ new.contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(10,12): error TS2304: Cannot find name 'Funcs'. -+index.js(10,18): error TS2304: Cannot find name 'A'. -+index.js(10,21): error TS2304: Cannot find name 'B'. -+index.js(11,15): error TS2304: Cannot find name 'A'. -+index.js(11,18): error TS2304: Cannot find name 'B'. -+index.js(14,3): error TS2322: Type 'null' is not assignable to type '[A, B]'. -+ -+ -+==== index.js (6 errors) ==== -+ /** -+ * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs -+ * @template A -+ * @template {Record} B -+ */ -+ -+ /** -+ * @template A -+ * @template {Record} B -+ * @param {Funcs} fns -+ ~~~~~ -+!!! error TS2304: Cannot find name 'Funcs'. -+ ~ -+!!! error TS2304: Cannot find name 'A'. -+ ~ -+!!! error TS2304: Cannot find name 'B'. -+ * @returns {[A, B]} -+ ~ -+!!! error TS2304: Cannot find name 'A'. -+ ~ -+!!! error TS2304: Cannot find name 'B'. -+ */ -+ function foo(fns) { -+ return /** @type {any} */ (null); -+ ~~~~~~ -+!!! error TS2322: Type 'null' is not assignable to type '[A, B]'. -+ } -+ -+ const result = foo({ -+ bar: { -+ fn: -+ /** @param {string} a */ -+ (a) => {}, -+ thing: "asd", -+ }, -+ }); diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt deleted file mode 100644 index 5b60d82bdc..0000000000 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt +++ /dev/null @@ -1,33 +0,0 @@ -index.js(3,20): error TS2304: Cannot find name 'T'. -index.js(4,14): error TS2304: Cannot find name 'T'. - - -==== index.js (2 errors) ==== - /** - * @template T - * @param {(value: T, index: number) => boolean} predicate - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T} - ~ -!!! error TS2304: Cannot find name 'T'. - */ - function filter(predicate) { - return /** @type {any} */ (null); - } - - const a = filter( - /** - * @param {number} [pose] - */ - (pose) => true - ); - - const b = filter( - /** - * @param {number} [pose] - * @param {number} [_] - */ - (pose, _) => true - ); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff deleted file mode 100644 index 677f461f62..0000000000 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt -+++ new.contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(3,20): error TS2304: Cannot find name 'T'. -+index.js(4,14): error TS2304: Cannot find name 'T'. -+ -+ -+==== index.js (2 errors) ==== -+ /** -+ * @template T -+ * @param {(value: T, index: number) => boolean} predicate -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ function filter(predicate) { -+ return /** @type {any} */ (null); -+ } -+ -+ const a = filter( -+ /** -+ * @param {number} [pose] -+ */ -+ (pose) => true -+ ); -+ -+ const b = filter( -+ /** -+ * @param {number} [pose] -+ * @param {number} [_] -+ */ -+ (pose, _) => true -+ ); -+ diff --git a/testdata/baselines/reference/submodule/compiler/declFileGenericType2.errors.txt b/testdata/baselines/reference/submodule/compiler/declFileGenericType2.errors.txt new file mode 100644 index 0000000000..e33c12cfc3 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/declFileGenericType2.errors.txt @@ -0,0 +1,50 @@ +declFileGenericType2.ts(25,141): error TS2304: Cannot find name 'IElementController'. +declFileGenericType2.ts(33,134): error TS2339: Property 'dom' does not exist on type 'typeof templa'. + + +==== declFileGenericType2.ts (2 errors) ==== + declare module templa.mvc { + interface IModel { + } + } + declare module templa.mvc { + interface IController { + } + } + declare module templa.mvc { + class AbstractController implements mvc.IController { + } + } + declare module templa.mvc.composite { + interface ICompositeControllerModel extends mvc.IModel { + getControllers(): mvc.IController[]; + } + } + module templa.dom.mvc { + export interface IElementController extends templa.mvc.IController { + } + } + // Module + module templa.dom.mvc { + + export class AbstractElementController extends templa.mvc.AbstractController implements IElementController { + ~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'IElementController'. + constructor() { + super(); + } + } + } + // Module + module templa.dom.mvc.composite { + export class AbstractCompositeElementController extends templa.dom.mvc.AbstractElementController { + ~~~ +!!! error TS2339: Property 'dom' does not exist on type 'typeof templa'. + public _controllers: templa.mvc.IController[]; + constructor() { + super(); + this._controllers = []; + } + } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declFileGenericType2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declFileGenericType2.errors.txt.diff new file mode 100644 index 0000000000..376e53f28b --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/declFileGenericType2.errors.txt.diff @@ -0,0 +1,55 @@ +--- old.declFileGenericType2.errors.txt ++++ new.declFileGenericType2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++declFileGenericType2.ts(25,141): error TS2304: Cannot find name 'IElementController'. ++declFileGenericType2.ts(33,134): error TS2339: Property 'dom' does not exist on type 'typeof templa'. ++ ++ ++==== declFileGenericType2.ts (2 errors) ==== ++ declare module templa.mvc { ++ interface IModel { ++ } ++ } ++ declare module templa.mvc { ++ interface IController { ++ } ++ } ++ declare module templa.mvc { ++ class AbstractController implements mvc.IController { ++ } ++ } ++ declare module templa.mvc.composite { ++ interface ICompositeControllerModel extends mvc.IModel { ++ getControllers(): mvc.IController[]; ++ } ++ } ++ module templa.dom.mvc { ++ export interface IElementController extends templa.mvc.IController { ++ } ++ } ++ // Module ++ module templa.dom.mvc { ++ ++ export class AbstractElementController extends templa.mvc.AbstractController implements IElementController { ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'IElementController'. ++ constructor() { ++ super(); ++ } ++ } ++ } ++ // Module ++ module templa.dom.mvc.composite { ++ export class AbstractCompositeElementController extends templa.dom.mvc.AbstractElementController { ++ ~~~ ++!!! error TS2339: Property 'dom' does not exist on type 'typeof templa'. ++ public _controllers: templa.mvc.IController[]; ++ constructor() { ++ super(); ++ this._controllers = []; ++ } ++ } ++ } ++ diff --git a/testdata/baselines/reference/submodule/compiler/declFileWithClassNameConflictingWithClassReferredByExtendsClause.errors.txt b/testdata/baselines/reference/submodule/compiler/declFileWithClassNameConflictingWithClassReferredByExtendsClause.errors.txt new file mode 100644 index 0000000000..ff2276dc9c --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/declFileWithClassNameConflictingWithClassReferredByExtendsClause.errors.txt @@ -0,0 +1,25 @@ +declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts(15,38): error TS2339: Property 'Y' does not exist on type 'typeof X'. + + +==== declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts (1 errors) ==== + declare module A.B.Base { + export class W { + id: number; + } + } + module X.Y.base { + + export class W extends A.B.Base.W { + name: string; + } + } + + module X.Y.base.Z { + + export class W extends X.Y.base.W { + ~ +!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. + value: boolean; + } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declFileWithClassNameConflictingWithClassReferredByExtendsClause.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declFileWithClassNameConflictingWithClassReferredByExtendsClause.errors.txt.diff new file mode 100644 index 0000000000..4a6d55da03 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/declFileWithClassNameConflictingWithClassReferredByExtendsClause.errors.txt.diff @@ -0,0 +1,30 @@ +--- old.declFileWithClassNameConflictingWithClassReferredByExtendsClause.errors.txt ++++ new.declFileWithClassNameConflictingWithClassReferredByExtendsClause.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts(15,38): error TS2339: Property 'Y' does not exist on type 'typeof X'. ++ ++ ++==== declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts (1 errors) ==== ++ declare module A.B.Base { ++ export class W { ++ id: number; ++ } ++ } ++ module X.Y.base { ++ ++ export class W extends A.B.Base.W { ++ name: string; ++ } ++ } ++ ++ module X.Y.base.Z { ++ ++ export class W extends X.Y.base.W { ++ ~ ++!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. ++ value: boolean; ++ } ++ } ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt index fc6d3f4047..53a0231319 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt @@ -1,8 +1,7 @@ input.js(5,7): error TS7005: Variable 'something' implicitly has an 'any' type. -input.js(34,12): error TS2304: Cannot find name 'P'. -==== input.js (2 errors) ==== +==== input.js (1 errors) ==== /** * @typedef {{ } & { name?: string }} P */ @@ -39,8 +38,6 @@ input.js(34,12): error TS2304: Cannot find name 'P'. /** * * @param {P} x - ~ -!!! error TS2304: Cannot find name 'P'. * @param {number} b */ export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt.diff index f2c1bd9afe..61298b1cc6 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt.diff @@ -4,10 +4,9 @@ - @@= skipped --1, +1 lines =@@ +input.js(5,7): error TS7005: Variable 'something' implicitly has an 'any' type. -+input.js(34,12): error TS2304: Cannot find name 'P'. + + -+==== input.js (2 errors) ==== ++==== input.js (1 errors) ==== + /** + * @typedef {{ } & { name?: string }} P + */ @@ -44,8 +43,6 @@ + /** + * + * @param {P} x -+ ~ -+!!! error TS2304: Cannot find name 'P'. + * @param {number} b + */ + export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {} diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt deleted file mode 100644 index 99a767b07b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt +++ /dev/null @@ -1,43 +0,0 @@ -input.js(34,12): error TS2304: Cannot find name 'P'. - - -==== input.js (1 errors) ==== - /** - * @typedef {{ } & { name?: string }} P - */ - - const something = /** @type {*} */(null); - - export let vLet = /** @type {P} */(something); - export const vConst = /** @type {P} */(something); - - export function fn(p = /** @type {P} */(something)) {} - - /** @param {number} req */ - export function fnWithRequiredDefaultParam(p = /** @type {P} */(something), req) {} - - export class C { - field = /** @type {P} */(something); - /** @optional */ optField = /** @type {P} */(something); // not a thing - /** @readonly */ roFiled = /** @type {P} */(something); - method(p = /** @type {P} */(something)) {} - /** @param {number} req */ - methodWithRequiredDefault(p = /** @type {P} */(something), req) {} - - constructor(ctorField = /** @type {P} */(something)) {} - - get x() { return /** @type {P} */(something) } - set x(v) { } - } - - export default /** @type {P} */(something); - - // allows `undefined` on the input side, thanks to the initializer - /** - * - * @param {P} x - ~ -!!! error TS2304: Cannot find name 'P'. - * @param {number} b - */ - export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt.diff deleted file mode 100644 index 1077ec5cce..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt.diff +++ /dev/null @@ -1,48 +0,0 @@ ---- old.declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt -+++ new.declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+input.js(34,12): error TS2304: Cannot find name 'P'. -+ -+ -+==== input.js (1 errors) ==== -+ /** -+ * @typedef {{ } & { name?: string }} P -+ */ -+ -+ const something = /** @type {*} */(null); -+ -+ export let vLet = /** @type {P} */(something); -+ export const vConst = /** @type {P} */(something); -+ -+ export function fn(p = /** @type {P} */(something)) {} -+ -+ /** @param {number} req */ -+ export function fnWithRequiredDefaultParam(p = /** @type {P} */(something), req) {} -+ -+ export class C { -+ field = /** @type {P} */(something); -+ /** @optional */ optField = /** @type {P} */(something); // not a thing -+ /** @readonly */ roFiled = /** @type {P} */(something); -+ method(p = /** @type {P} */(something)) {} -+ /** @param {number} req */ -+ methodWithRequiredDefault(p = /** @type {P} */(something), req) {} -+ -+ constructor(ctorField = /** @type {P} */(something)) {} -+ -+ get x() { return /** @type {P} */(something) } -+ set x(v) { } -+ } -+ -+ export default /** @type {P} */(something); -+ -+ // allows `undefined` on the input side, thanks to the initializer -+ /** -+ * -+ * @param {P} x -+ ~ -+!!! error TS2304: Cannot find name 'P'. -+ * @param {number} b -+ */ -+ export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {} diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts.errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts.errors.txt new file mode 100644 index 0000000000..4c1235ee10 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts.errors.txt @@ -0,0 +1,53 @@ +declarationEmit_nameConflicts_0.ts(23,26): error TS2694: Namespace '"declarationEmit_nameConflicts_0".M' has no exported member 'P'. + + +==== declarationEmit_nameConflicts_0.ts (1 errors) ==== + import im = require('./declarationEmit_nameConflicts_1'); + export module M { + export function f() { } + export class C { } + export module N { + export function g() { }; + export interface I { } + } + + export import a = M.f; + export import b = M.C; + export import c = N; + export import d = im; + } + + export module M.P { + export function f() { } + export class C { } + export module N { + export function g() { }; + export interface I { } + } + export import im = M.P.f; + ~ +!!! error TS2694: Namespace '"declarationEmit_nameConflicts_0".M' has no exported member 'P'. + export var a = M.a; // emitted incorrectly as typeof f + export var b = M.b; // ok + export var c = M.c; // ok + export var g = M.c.g; // ok + export var d = M.d; // emitted incorrectly as typeof im + } + + export module M.Q { + export function f() { } + export class C { } + export module N { + export function g() { }; + export interface I { } + } + export interface b extends M.b { } // ok + export interface I extends M.c.I { } // ok + export module c { + export interface I extends M.c.I { } // ok + } + } +==== declarationEmit_nameConflicts_1.ts (0 errors) ==== + module f { export class c { } } + export = f; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts.errors.txt.diff new file mode 100644 index 0000000000..19eb086c2b --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts.errors.txt.diff @@ -0,0 +1,58 @@ +--- old.declarationEmitNameConflicts.errors.txt ++++ new.declarationEmitNameConflicts.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++declarationEmit_nameConflicts_0.ts(23,26): error TS2694: Namespace '"declarationEmit_nameConflicts_0".M' has no exported member 'P'. ++ ++ ++==== declarationEmit_nameConflicts_0.ts (1 errors) ==== ++ import im = require('./declarationEmit_nameConflicts_1'); ++ export module M { ++ export function f() { } ++ export class C { } ++ export module N { ++ export function g() { }; ++ export interface I { } ++ } ++ ++ export import a = M.f; ++ export import b = M.C; ++ export import c = N; ++ export import d = im; ++ } ++ ++ export module M.P { ++ export function f() { } ++ export class C { } ++ export module N { ++ export function g() { }; ++ export interface I { } ++ } ++ export import im = M.P.f; ++ ~ ++!!! error TS2694: Namespace '"declarationEmit_nameConflicts_0".M' has no exported member 'P'. ++ export var a = M.a; // emitted incorrectly as typeof f ++ export var b = M.b; // ok ++ export var c = M.c; // ok ++ export var g = M.c.g; // ok ++ export var d = M.d; // emitted incorrectly as typeof im ++ } ++ ++ export module M.Q { ++ export function f() { } ++ export class C { } ++ export module N { ++ export function g() { }; ++ export interface I { } ++ } ++ export interface b extends M.b { } // ok ++ export interface I extends M.c.I { } // ok ++ export module c { ++ export interface I extends M.c.I { } // ok ++ } ++ } ++==== declarationEmit_nameConflicts_1.ts (0 errors) ==== ++ module f { export class c { } } ++ export = f; ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts2.errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts2.errors.txt new file mode 100644 index 0000000000..9d86ede2b3 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts2.errors.txt @@ -0,0 +1,30 @@ +declarationEmitNameConflicts2.ts(11,22): error TS2339: Property 'Y' does not exist on type 'typeof X'. +declarationEmitNameConflicts2.ts(12,22): error TS2339: Property 'Y' does not exist on type 'typeof X'. +declarationEmitNameConflicts2.ts(13,22): error TS2339: Property 'Y' does not exist on type 'typeof X'. +declarationEmitNameConflicts2.ts(14,22): error TS2339: Property 'Y' does not exist on type 'typeof X'. + + +==== declarationEmitNameConflicts2.ts (4 errors) ==== + module X.Y.base { + export function f() { } + export class C { } + export module M { + export var v; + } + export enum E { } + } + + module X.Y.base.Z { + export var f = X.Y.base.f; // Should be base.f + ~ +!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. + export var C = X.Y.base.C; // Should be base.C + ~ +!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. + export var M = X.Y.base.M; // Should be base.M + ~ +!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. + export var E = X.Y.base.E; // Should be base.E + ~ +!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts2.errors.txt.diff new file mode 100644 index 0000000000..f5edb594b2 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts2.errors.txt.diff @@ -0,0 +1,35 @@ +--- old.declarationEmitNameConflicts2.errors.txt ++++ new.declarationEmitNameConflicts2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++declarationEmitNameConflicts2.ts(11,22): error TS2339: Property 'Y' does not exist on type 'typeof X'. ++declarationEmitNameConflicts2.ts(12,22): error TS2339: Property 'Y' does not exist on type 'typeof X'. ++declarationEmitNameConflicts2.ts(13,22): error TS2339: Property 'Y' does not exist on type 'typeof X'. ++declarationEmitNameConflicts2.ts(14,22): error TS2339: Property 'Y' does not exist on type 'typeof X'. ++ ++ ++==== declarationEmitNameConflicts2.ts (4 errors) ==== ++ module X.Y.base { ++ export function f() { } ++ export class C { } ++ export module M { ++ export var v; ++ } ++ export enum E { } ++ } ++ ++ module X.Y.base.Z { ++ export var f = X.Y.base.f; // Should be base.f ++ ~ ++!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. ++ export var C = X.Y.base.C; // Should be base.C ++ ~ ++!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. ++ export var M = X.Y.base.M; // Should be base.M ++ ~ ++!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. ++ export var E = X.Y.base.E; // Should be base.E ++ ~ ++!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. ++ } diff --git a/testdata/baselines/reference/submodule/compiler/dottedModuleName2.errors.txt b/testdata/baselines/reference/submodule/compiler/dottedModuleName2.errors.txt new file mode 100644 index 0000000000..7c3542ef28 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/dottedModuleName2.errors.txt @@ -0,0 +1,55 @@ +dottedModuleName2.ts(19,18): error TS2339: Property 'B' does not exist on type 'typeof A'. +dottedModuleName2.ts(38,19): error TS2694: Namespace 'A' has no exported member 'B'. +dottedModuleName2.ts(40,19): error TS2694: Namespace 'A' has no exported member 'B'. + + +==== dottedModuleName2.ts (3 errors) ==== + module A.B { + + export var x = 1; + + } + + + + module AA { export module B { + + export var x = 1; + + } } + + + + var tmpOK = AA.B.x; + + var tmpError = A.B.x; + ~ +!!! error TS2339: Property 'B' does not exist on type 'typeof A'. + + + module A.B.C + + { + + export var x = 1; + + } + + + + module M + + { + + import X1 = A; + + import X2 = A.B; + ~ +!!! error TS2694: Namespace 'A' has no exported member 'B'. + + import X3 = A.B.C; + ~ +!!! error TS2694: Namespace 'A' has no exported member 'B'. + + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/dottedModuleName2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/dottedModuleName2.errors.txt.diff new file mode 100644 index 0000000000..a5bca41311 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/dottedModuleName2.errors.txt.diff @@ -0,0 +1,60 @@ +--- old.dottedModuleName2.errors.txt ++++ new.dottedModuleName2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++dottedModuleName2.ts(19,18): error TS2339: Property 'B' does not exist on type 'typeof A'. ++dottedModuleName2.ts(38,19): error TS2694: Namespace 'A' has no exported member 'B'. ++dottedModuleName2.ts(40,19): error TS2694: Namespace 'A' has no exported member 'B'. ++ ++ ++==== dottedModuleName2.ts (3 errors) ==== ++ module A.B { ++ ++ export var x = 1; ++ ++ } ++ ++ ++ ++ module AA { export module B { ++ ++ export var x = 1; ++ ++ } } ++ ++ ++ ++ var tmpOK = AA.B.x; ++ ++ var tmpError = A.B.x; ++ ~ ++!!! error TS2339: Property 'B' does not exist on type 'typeof A'. ++ ++ ++ module A.B.C ++ ++ { ++ ++ export var x = 1; ++ ++ } ++ ++ ++ ++ module M ++ ++ { ++ ++ import X1 = A; ++ ++ import X2 = A.B; ++ ~ ++!!! error TS2694: Namespace 'A' has no exported member 'B'. ++ ++ import X3 = A.B.C; ++ ~ ++!!! error TS2694: Namespace 'A' has no exported member 'B'. ++ ++ } ++ diff --git a/testdata/baselines/reference/submodule/compiler/dottedNamesInSystem.errors.txt b/testdata/baselines/reference/submodule/compiler/dottedNamesInSystem.errors.txt new file mode 100644 index 0000000000..5cb91ed391 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/dottedNamesInSystem.errors.txt @@ -0,0 +1,13 @@ +dottedNamesInSystem.ts(6,14): error TS2339: Property 'B' does not exist on type 'typeof A'. + + +==== dottedNamesInSystem.ts (1 errors) ==== + export namespace A.B.C { + export function foo() {} + } + + export function bar() { + return A.B.C.foo(); + ~ +!!! error TS2339: Property 'B' does not exist on type 'typeof A'. + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/dottedNamesInSystem.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/dottedNamesInSystem.errors.txt.diff new file mode 100644 index 0000000000..8a7131f1d5 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/dottedNamesInSystem.errors.txt.diff @@ -0,0 +1,18 @@ +--- old.dottedNamesInSystem.errors.txt ++++ new.dottedNamesInSystem.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++dottedNamesInSystem.ts(6,14): error TS2339: Property 'B' does not exist on type 'typeof A'. ++ ++ ++==== dottedNamesInSystem.ts (1 errors) ==== ++ export namespace A.B.C { ++ export function foo() {} ++ } ++ ++ export function bar() { ++ return A.B.C.foo(); ++ ~ ++!!! error TS2339: Property 'B' does not exist on type 'typeof A'. ++ } diff --git a/testdata/baselines/reference/submodule/compiler/emitMemberAccessExpression.errors.txt b/testdata/baselines/reference/submodule/compiler/emitMemberAccessExpression.errors.txt new file mode 100644 index 0000000000..bf4331e06f --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/emitMemberAccessExpression.errors.txt @@ -0,0 +1,28 @@ +emitMemberAccessExpression_file2.ts(6,29): error TS2339: Property 'KnockoutExtentions' does not exist on type 'typeof Model'. + + +==== emitMemberAccessExpression_file3.ts (0 errors) ==== + /// + /// + declare var OData: any; + module Microsoft.PeopleAtWork.Model { + export class KnockoutExtentions { + } + } +==== emitMemberAccessExpression_file1.ts (0 errors) ==== + /// + "use strict"; + +==== emitMemberAccessExpression_file2.ts (1 errors) ==== + /// + "use strict"; + module Microsoft.PeopleAtWork.Model { + export class _Person { + public populate(raw: any) { + var res = Model.KnockoutExtentions; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'KnockoutExtentions' does not exist on type 'typeof Model'. + } + } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/emitMemberAccessExpression.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/emitMemberAccessExpression.errors.txt.diff new file mode 100644 index 0000000000..3952a62565 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/emitMemberAccessExpression.errors.txt.diff @@ -0,0 +1,33 @@ +--- old.emitMemberAccessExpression.errors.txt ++++ new.emitMemberAccessExpression.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++emitMemberAccessExpression_file2.ts(6,29): error TS2339: Property 'KnockoutExtentions' does not exist on type 'typeof Model'. ++ ++ ++==== emitMemberAccessExpression_file3.ts (0 errors) ==== ++ /// ++ /// ++ declare var OData: any; ++ module Microsoft.PeopleAtWork.Model { ++ export class KnockoutExtentions { ++ } ++ } ++==== emitMemberAccessExpression_file1.ts (0 errors) ==== ++ /// ++ "use strict"; ++ ++==== emitMemberAccessExpression_file2.ts (1 errors) ==== ++ /// ++ "use strict"; ++ module Microsoft.PeopleAtWork.Model { ++ export class _Person { ++ public populate(raw: any) { ++ var res = Model.KnockoutExtentions; ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS2339: Property 'KnockoutExtentions' does not exist on type 'typeof Model'. ++ } ++ } ++ } ++ diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt index 321561cda1..602c5117a3 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt @@ -1,13 +1,8 @@ -input.js(8,12): error TS2304: Cannot find name 'StatelessComponent'. -input.js(8,31): error TS2304: Cannot find name 'MyComponentProps'. -input.js(26,12): error TS2304: Cannot find name 'StatelessComponent'. -input.js(26,31): error TS2304: Cannot find name 'MyComponentProps'. -input.js(32,21): error TS2304: Cannot find name 'MyComponentProps'. input.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== input.js (7 errors) ==== +==== input.js (2 errors) ==== /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ /** @@ -16,10 +11,6 @@ input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install /** * @type {StatelessComponent} - ~~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'StatelessComponent'. - ~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'MyComponentProps'. */ const MyComponent = () => /* @type {any} */(null); @@ -38,18 +29,12 @@ input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install /** * @type {StatelessComponent} - ~~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'StatelessComponent'. - ~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'MyComponentProps'. */ const check = MyComponent2; /** * * @param {{ props: MyComponentProps }} p - ~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'MyComponentProps'. */ function expectLiteral(p) {} diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff index d5c5d0e6f3..19326846f3 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff @@ -3,16 +3,11 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+input.js(8,12): error TS2304: Cannot find name 'StatelessComponent'. -+input.js(8,31): error TS2304: Cannot find name 'MyComponentProps'. -+input.js(26,12): error TS2304: Cannot find name 'StatelessComponent'. -+input.js(26,31): error TS2304: Cannot find name 'MyComponentProps'. -+input.js(32,21): error TS2304: Cannot find name 'MyComponentProps'. +input.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== input.js (7 errors) ==== ++==== input.js (2 errors) ==== + /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ + + /** @@ -21,10 +16,6 @@ + + /** + * @type {StatelessComponent} -+ ~~~~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'StatelessComponent'. -+ ~~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'MyComponentProps'. + */ + const MyComponent = () => /* @type {any} */(null); + @@ -43,18 +34,12 @@ + + /** + * @type {StatelessComponent} -+ ~~~~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'StatelessComponent'. -+ ~~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'MyComponentProps'. + */ + const check = MyComponent2; + + /** + * + * @param {{ props: MyComponentProps }} p -+ ~~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'MyComponentProps'. + */ + function expectLiteral(p) {} + diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt deleted file mode 100644 index 61fd199c4a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -a.js(6,12): error TS2304: Cannot find name 'NumberLike'. - - -==== a.js (1 errors) ==== - /** - * A number, or a string containing a number. - * @typedef {(number|string)} NumberLike - */ - - /** @type {NumberLike[]} */export default ([ ]); - ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'NumberLike'. - -==== b.ts (0 errors) ==== - import A from './a' - A[0] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt.diff deleted file mode 100644 index 2050c328f3..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.exportDefaultWithJSDoc1.errors.txt -+++ new.exportDefaultWithJSDoc1.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+a.js(6,12): error TS2304: Cannot find name 'NumberLike'. -+ -+ -+==== a.js (1 errors) ==== -+ /** -+ * A number, or a string containing a number. -+ * @typedef {(number|string)} NumberLike -+ */ -+ -+ /** @type {NumberLike[]} */export default ([ ]); -+ ~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'NumberLike'. -+ -+==== b.ts (0 errors) ==== -+ import A from './a' -+ A[0] diff --git a/testdata/baselines/reference/submodule/compiler/genericClassPropertyInheritanceSpecialization.errors.txt b/testdata/baselines/reference/submodule/compiler/genericClassPropertyInheritanceSpecialization.errors.txt new file mode 100644 index 0000000000..583a9eef85 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/genericClassPropertyInheritanceSpecialization.errors.txt @@ -0,0 +1,90 @@ +genericClassPropertyInheritanceSpecialization.ts(55,51): error TS2339: Property 'Controls' does not exist on type 'typeof Portal'. +genericClassPropertyInheritanceSpecialization.ts(66,50): error TS2694: Namespace 'PortalFx' has no exported member 'ViewModels'. +genericClassPropertyInheritanceSpecialization.ts(72,57): error TS2694: Namespace 'PortalFx' has no exported member 'ViewModels'. +genericClassPropertyInheritanceSpecialization.ts(72,137): error TS2694: Namespace 'PortalFx' has no exported member 'ViewModels'. + + +==== genericClassPropertyInheritanceSpecialization.ts (4 errors) ==== + interface KnockoutObservableBase { + peek(): T; + (): T; + (value: T): void; + } + + interface KnockoutObservable extends KnockoutObservableBase { + equalityComparer(a: T, b: T): boolean; + valueHasMutated(): void; + valueWillMutate(): void; + } + + interface KnockoutObservableArray extends KnockoutObservable { + indexOf(searchElement: T, fromIndex?: number): number; + slice(start: number, end?: number): T[]; + splice(start: number, deleteCount?: number, ...items: T[]): T[]; + pop(): T; + push(...items: T[]): void; + shift(): T; + unshift(...items: T[]): number; + reverse(): T[]; + sort(compareFunction?: (a: T, b: T) => number): void; + replace(oldItem: T, newItem: T): void; + remove(item: T): T[]; + removeAll(items?: T[]): T[]; + destroy(item: T): void; + destroyAll(items?: T[]): void; + } + + interface KnockoutObservableArrayStatic { + fn: KnockoutObservableArray; + + (value?: T[]): KnockoutObservableArray; + } + + declare module ko { + export var observableArray: KnockoutObservableArrayStatic; + } + + module Portal.Controls.Validators { + + export class Validator { + private _subscription; + public message: KnockoutObservable; + public validationState: KnockoutObservable; + public validate: KnockoutObservable; + constructor(message?: string) { } + public destroy(): void { } + public _validate(value: TValue): number {return 0 } + } + } + + module PortalFx.ViewModels.Controls.Validators { + + export class Validator extends Portal.Controls.Validators.Validator { + ~~~~~~~~ +!!! error TS2339: Property 'Controls' does not exist on type 'typeof Portal'. + + constructor(message?: string) { + super(message); + } + } + + } + + interface Contract { + + validators: KnockoutObservableArray>; + ~~~~~~~~~~ +!!! error TS2694: Namespace 'PortalFx' has no exported member 'ViewModels'. + } + + + class ViewModel implements Contract { + + public validators: KnockoutObservableArray> = ko.observableArray>(); + ~~~~~~~~~~ +!!! error TS2694: Namespace 'PortalFx' has no exported member 'ViewModels'. + ~~~~~~~~~~ +!!! error TS2694: Namespace 'PortalFx' has no exported member 'ViewModels'. + } + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/genericClassPropertyInheritanceSpecialization.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/genericClassPropertyInheritanceSpecialization.errors.txt.diff new file mode 100644 index 0000000000..4dc252dd1a --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/genericClassPropertyInheritanceSpecialization.errors.txt.diff @@ -0,0 +1,95 @@ +--- old.genericClassPropertyInheritanceSpecialization.errors.txt ++++ new.genericClassPropertyInheritanceSpecialization.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++genericClassPropertyInheritanceSpecialization.ts(55,51): error TS2339: Property 'Controls' does not exist on type 'typeof Portal'. ++genericClassPropertyInheritanceSpecialization.ts(66,50): error TS2694: Namespace 'PortalFx' has no exported member 'ViewModels'. ++genericClassPropertyInheritanceSpecialization.ts(72,57): error TS2694: Namespace 'PortalFx' has no exported member 'ViewModels'. ++genericClassPropertyInheritanceSpecialization.ts(72,137): error TS2694: Namespace 'PortalFx' has no exported member 'ViewModels'. ++ ++ ++==== genericClassPropertyInheritanceSpecialization.ts (4 errors) ==== ++ interface KnockoutObservableBase { ++ peek(): T; ++ (): T; ++ (value: T): void; ++ } ++ ++ interface KnockoutObservable extends KnockoutObservableBase { ++ equalityComparer(a: T, b: T): boolean; ++ valueHasMutated(): void; ++ valueWillMutate(): void; ++ } ++ ++ interface KnockoutObservableArray extends KnockoutObservable { ++ indexOf(searchElement: T, fromIndex?: number): number; ++ slice(start: number, end?: number): T[]; ++ splice(start: number, deleteCount?: number, ...items: T[]): T[]; ++ pop(): T; ++ push(...items: T[]): void; ++ shift(): T; ++ unshift(...items: T[]): number; ++ reverse(): T[]; ++ sort(compareFunction?: (a: T, b: T) => number): void; ++ replace(oldItem: T, newItem: T): void; ++ remove(item: T): T[]; ++ removeAll(items?: T[]): T[]; ++ destroy(item: T): void; ++ destroyAll(items?: T[]): void; ++ } ++ ++ interface KnockoutObservableArrayStatic { ++ fn: KnockoutObservableArray; ++ ++ (value?: T[]): KnockoutObservableArray; ++ } ++ ++ declare module ko { ++ export var observableArray: KnockoutObservableArrayStatic; ++ } ++ ++ module Portal.Controls.Validators { ++ ++ export class Validator { ++ private _subscription; ++ public message: KnockoutObservable; ++ public validationState: KnockoutObservable; ++ public validate: KnockoutObservable; ++ constructor(message?: string) { } ++ public destroy(): void { } ++ public _validate(value: TValue): number {return 0 } ++ } ++ } ++ ++ module PortalFx.ViewModels.Controls.Validators { ++ ++ export class Validator extends Portal.Controls.Validators.Validator { ++ ~~~~~~~~ ++!!! error TS2339: Property 'Controls' does not exist on type 'typeof Portal'. ++ ++ constructor(message?: string) { ++ super(message); ++ } ++ } ++ ++ } ++ ++ interface Contract { ++ ++ validators: KnockoutObservableArray>; ++ ~~~~~~~~~~ ++!!! error TS2694: Namespace 'PortalFx' has no exported member 'ViewModels'. ++ } ++ ++ ++ class ViewModel implements Contract { ++ ++ public validators: KnockoutObservableArray> = ko.observableArray>(); ++ ~~~~~~~~~~ ++!!! error TS2694: Namespace 'PortalFx' has no exported member 'ViewModels'. ++ ~~~~~~~~~~ ++!!! error TS2694: Namespace 'PortalFx' has no exported member 'ViewModels'. ++ } ++ ++ diff --git a/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt deleted file mode 100644 index 3f5fe39172..0000000000 --- a/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -usage.js(1,12): error TS2304: Cannot find name 'Bar'. - - -==== interfaces.d.ts (0 errors) ==== - export interface Bar { - prop: string - } - -==== usage.js (1 errors) ==== - /** @type {Bar} */ - ~~~ -!!! error TS2304: Cannot find name 'Bar'. - export let bar; - - /** @typedef {import('./interfaces').Bar} Bar */ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt.diff deleted file mode 100644 index 2f9a807d64..0000000000 --- a/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.importTypeResolutionJSDocEOF.errors.txt -+++ new.importTypeResolutionJSDocEOF.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+usage.js(1,12): error TS2304: Cannot find name 'Bar'. -+ -+ -+==== interfaces.d.ts (0 errors) ==== -+ export interface Bar { -+ prop: string -+ } -+ -+==== usage.js (1 errors) ==== -+ /** @type {Bar} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Bar'. -+ export let bar; -+ -+ /** @typedef {import('./interfaces').Bar} Bar */ diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt index d62abe17e0..d4e3e8cb73 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt @@ -1,4 +1,3 @@ -index.js(10,16): error TS2304: Cannot find name 'Options'. index.js(15,18): error TS2339: Property 'test' does not exist on type 'X'. @@ -10,7 +9,7 @@ index.js(15,18): error TS2339: Property 'test' does not exist on type 'X'. /** @module Test */ class Test {} export default Test; -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== import Test from './test/Test.js' /** @@ -21,8 +20,6 @@ index.js(15,18): error TS2339: Property 'test' does not exist on type 'X'. class X extends Test { /** * @param {Options} options - ~~~~~~~ -!!! error TS2304: Cannot find name 'Options'. */ constructor(options) { super(); diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt.diff index 976dd454b2..2d7908b73d 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.errors.txt.diff @@ -3,7 +3,6 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+index.js(10,16): error TS2304: Cannot find name 'Options'. +index.js(15,18): error TS2339: Property 'test' does not exist on type 'X'. + + @@ -15,7 +14,7 @@ + /** @module Test */ + class Test {} + export default Test; -+==== index.js (2 errors) ==== ++==== index.js (1 errors) ==== + import Test from './test/Test.js' + + /** @@ -26,8 +25,6 @@ + class X extends Test { + /** + * @param {Options} options -+ ~~~~~~~ -+!!! error TS2304: Cannot find name 'Options'. + */ + constructor(options) { + super(); diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt b/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt deleted file mode 100644 index ab1fc23499..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt +++ /dev/null @@ -1,46 +0,0 @@ -a.js(13,15): error TS2304: Cannot find name 'A'. -a.js(20,15): error TS2304: Cannot find name 'A'. -a.js(27,15): error TS2304: Cannot find name 'A'. -a.js(27,19): error TS2304: Cannot find name 'B'. - - -==== a.js (4 errors) ==== - /** - * @typedef A - * @property {string} a - */ - - /** - * @typedef B - * @property {number} b - */ - - class C1 { - /** - * @type {A} - ~ -!!! error TS2304: Cannot find name 'A'. - */ - value; - } - - class C2 extends C1 { - /** - * @type {A} - ~ -!!! error TS2304: Cannot find name 'A'. - */ - value; - } - - class C3 extends C1 { - /** - * @type {A & B} - ~ -!!! error TS2304: Cannot find name 'A'. - ~ -!!! error TS2304: Cannot find name 'B'. - */ - value; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt.diff deleted file mode 100644 index b51b83eedf..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.errors.txt.diff +++ /dev/null @@ -1,51 +0,0 @@ ---- old.jsDeclarationsInheritedTypes.errors.txt -+++ new.jsDeclarationsInheritedTypes.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+a.js(13,15): error TS2304: Cannot find name 'A'. -+a.js(20,15): error TS2304: Cannot find name 'A'. -+a.js(27,15): error TS2304: Cannot find name 'A'. -+a.js(27,19): error TS2304: Cannot find name 'B'. -+ -+ -+==== a.js (4 errors) ==== -+ /** -+ * @typedef A -+ * @property {string} a -+ */ -+ -+ /** -+ * @typedef B -+ * @property {number} b -+ */ -+ -+ class C1 { -+ /** -+ * @type {A} -+ ~ -+!!! error TS2304: Cannot find name 'A'. -+ */ -+ value; -+ } -+ -+ class C2 extends C1 { -+ /** -+ * @type {A} -+ ~ -+!!! error TS2304: Cannot find name 'A'. -+ */ -+ value; -+ } -+ -+ class C3 extends C1 { -+ /** -+ * @type {A & B} -+ ~ -+!!! error TS2304: Cannot find name 'A'. -+ ~ -+!!! error TS2304: Cannot find name 'B'. -+ */ -+ value; -+ } -+ diff --git a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt deleted file mode 100644 index d4686d7290..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt +++ /dev/null @@ -1,48 +0,0 @@ -index.js(7,16): error TS2552: Cannot find name 'LionRequestInit'. Did you mean 'RequestInit'? - - -==== package.json (0 errors) ==== - { - "name": "typescript-issue", - "private": true, - "version": "0.0.0", - "type": "module" - } -==== node_modules/@lion/ajax/package.json (0 errors) ==== - { - "name": "@lion/ajax", - "version": "2.0.2", - "type": "module", - "exports": { - ".": { - "types": "./dist-types/src/index.d.ts", - "default": "./src/index.js" - }, - "./docs/*": "./docs/*" - } - } -==== node_modules/@lion/ajax/dist-types/src/index.d.ts (0 errors) ==== - export type LionRequestInit = import('../types/types.js').LionRequestInit; -==== node_modules/@lion/ajax/dist-types/types/types.d.ts (0 errors) ==== - export interface LionRequestInit { - body?: null | Object; - } -==== index.js (1 errors) ==== - /** - * @typedef {import('@lion/ajax').LionRequestInit} LionRequestInit - */ - - export class NewAjax { - /** - * @param {LionRequestInit} [init] - ~~~~~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'LionRequestInit'. Did you mean 'RequestInit'? - */ - case5_unexpectedlyResolvesPathToNodeModules(init) {} - } - - /** - * @type {(init?: LionRequestInit) => void} - */ - // @ts-expect-error - NewAjax.prototype.case6_unexpectedlyResolvesPathToNodeModules; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt.diff deleted file mode 100644 index d0c0b64602..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt -+++ new.jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(7,16): error TS2552: Cannot find name 'LionRequestInit'. Did you mean 'RequestInit'? -+ -+ -+==== package.json (0 errors) ==== -+ { -+ "name": "typescript-issue", -+ "private": true, -+ "version": "0.0.0", -+ "type": "module" -+ } -+==== node_modules/@lion/ajax/package.json (0 errors) ==== -+ { -+ "name": "@lion/ajax", -+ "version": "2.0.2", -+ "type": "module", -+ "exports": { -+ ".": { -+ "types": "./dist-types/src/index.d.ts", -+ "default": "./src/index.js" -+ }, -+ "./docs/*": "./docs/*" -+ } -+ } -+==== node_modules/@lion/ajax/dist-types/src/index.d.ts (0 errors) ==== -+ export type LionRequestInit = import('../types/types.js').LionRequestInit; -+==== node_modules/@lion/ajax/dist-types/types/types.d.ts (0 errors) ==== -+ export interface LionRequestInit { -+ body?: null | Object; -+ } -+==== index.js (1 errors) ==== -+ /** -+ * @typedef {import('@lion/ajax').LionRequestInit} LionRequestInit -+ */ -+ -+ export class NewAjax { -+ /** -+ * @param {LionRequestInit} [init] -+ ~~~~~~~~~~~~~~~ -+!!! error TS2552: Cannot find name 'LionRequestInit'. Did you mean 'RequestInit'? -+ */ -+ case5_unexpectedlyResolvesPathToNodeModules(init) {} -+ } -+ -+ /** -+ * @type {(init?: LionRequestInit) => void} -+ */ -+ // @ts-expect-error -+ NewAjax.prototype.case6_unexpectedlyResolvesPathToNodeModules; diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt index 18863ef803..0ee31e5c1f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt @@ -3,8 +3,6 @@ enumDef.js(4,6): error TS2339: Property 'UserMetrics' does not exist on type '{} enumDef.js(16,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'. index.js(2,7): error TS2339: Property 'Cls' does not exist on type '{}'. index.js(8,21): error TS2304: Cannot find name 'Host'. -index.js(13,11): error TS2503: Cannot find namespace 'Host'. -index.js(18,11): error TS2503: Cannot find namespace 'Host'. ==== enumDef.js (3 errors) ==== @@ -32,7 +30,7 @@ index.js(18,11): error TS2503: Cannot find namespace 'Host'. !!! error TS2339: Property 'UserMetrics' does not exist on type '{}'. x: 12 } -==== index.js (4 errors) ==== +==== index.js (2 errors) ==== var Other = {}; Other.Cls = class { ~~~ @@ -50,15 +48,11 @@ index.js(18,11): error TS2503: Cannot find namespace 'Host'. /** * @type {Host.UserMetrics.Bargh} - ~~~~ -!!! error TS2503: Cannot find namespace 'Host'. */ var x = "ok"; /** * @type {Host.UserMetrics.Blah} - ~~~~ -!!! error TS2503: Cannot find namespace 'Host'. */ var y = "ok"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt.diff index 455e085a23..1a186c555d 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt.diff @@ -8,8 +8,6 @@ +enumDef.js(16,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'. +index.js(2,7): error TS2339: Property 'Cls' does not exist on type '{}'. +index.js(8,21): error TS2304: Cannot find name 'Host'. -+index.js(13,11): error TS2503: Cannot find namespace 'Host'. -+index.js(18,11): error TS2503: Cannot find namespace 'Host'. + + +==== enumDef.js (3 errors) ==== @@ -37,7 +35,7 @@ +!!! error TS2339: Property 'UserMetrics' does not exist on type '{}'. + x: 12 + } -+==== index.js (4 errors) ==== ++==== index.js (2 errors) ==== + var Other = {}; + Other.Cls = class { + ~~~ @@ -55,15 +53,11 @@ + + /** + * @type {Host.UserMetrics.Bargh} -+ ~~~~ -+!!! error TS2503: Cannot find namespace 'Host'. + */ + var x = "ok"; + + /** + * @type {Host.UserMetrics.Blah} -+ ~~~~ -+!!! error TS2503: Cannot find namespace 'Host'. + */ + var y = "ok"; + diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt index db25c6ae25..7e856086bc 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt @@ -1,8 +1,7 @@ usage.js(1,38): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -usage.js(12,16): error TS2304: Cannot find name 'LogEntry'. -==== usage.js (2 errors) ==== +==== usage.js (1 errors) ==== const { Thing, useThing, cbThing } = require("./index"); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -17,8 +16,6 @@ usage.js(12,16): error TS2304: Cannot find name 'LogEntry'. cbThing(type => { /** @type {LogEntry} */ - ~~~~~~~~ -!!! error TS2304: Cannot find name 'LogEntry'. const logEntry = { time: Date.now(), type, diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff index cf1ff34342..7354401ab1 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff @@ -4,10 +4,9 @@ - @@= skipped --1, +1 lines =@@ +usage.js(1,38): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+usage.js(12,16): error TS2304: Cannot find name 'LogEntry'. + + -+==== usage.js (2 errors) ==== ++==== usage.js (1 errors) ==== + const { Thing, useThing, cbThing } = require("./index"); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -22,8 +21,6 @@ + + cbThing(type => { + /** @type {LogEntry} */ -+ ~~~~~~~~ -+!!! error TS2304: Cannot find name 'LogEntry'. + const logEntry = { + time: Date.now(), + type, diff --git a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols index fa45eaf1c0..2544ae315c 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols @@ -25,39 +25,29 @@ function apply(func, thisArg, ...args) { >length : Symbol(length, Decl(_apply.js, 11, 7)) case 0: return func.call(thisArg); ->func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) case 1: return func.call(thisArg, args[0]); ->func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) case 2: return func.call(thisArg, args[0], args[1]); ->func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) case 3: return func.call(thisArg, args[0], args[1], args[2]); ->func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) } return func.apply(thisArg, args); ->func.apply : Symbol(apply, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->apply : Symbol(apply, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff index f17b70333f..64b1ff90ba 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff @@ -13,37 +13,29 @@ case 0: return func.call(thisArg); ->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) -+>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) -+>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) case 1: return func.call(thisArg, args[0]); ->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) -+>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) -+>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) case 2: return func.call(thisArg, args[0], args[1]); ->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) -+>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) -+>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) case 3: return func.call(thisArg, args[0], args[1], args[2]); ->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) -+>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) -+>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) @@ -51,10 +43,8 @@ } return func.apply(thisArg, args); ->func.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) -+>func.apply : Symbol(apply, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) -+>apply : Symbol(apply, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt deleted file mode 100644 index 5948c8878c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt +++ /dev/null @@ -1,70 +0,0 @@ -jsFileFunctionOverloads.js(26,12): error TS2304: Cannot find name 'T'. -jsFileFunctionOverloads.js(27,14): error TS2304: Cannot find name 'T'. -jsFileFunctionOverloads.js(54,44): error TS2461: Type 'unknown' is not an array type. - - -==== jsFileFunctionOverloads.js (3 errors) ==== - /** - * @overload - * @param {number} x - * @returns {'number'} - */ - /** - * @overload - * @param {string} x - * @returns {'string'} - */ - /** - * @overload - * @param {boolean} x - * @returns {'boolean'} - */ - /** - * @param {unknown} x - * @returns {string} - */ - function getTypeName(x) { - return typeof x; - } - - /** - * @template T - * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T} - ~ -!!! error TS2304: Cannot find name 'T'. - */ - const identity = x => x; - - /** - * @template T - * @template U - * @overload - * @param {T[]} array - * @param {(x: T) => U[]} iterable - * @returns {U[]} - */ - /** - * @template T - * @overload - * @param {T[][]} array - * @returns {T[]} - */ - /** - * @param {unknown[]} array - * @param {(x: unknown) => unknown} iterable - * @returns {unknown[]} - */ - function flatMap(array, iterable = identity) { - /** @type {unknown[]} */ - const result = []; - for (let i = 0; i < array.length; i += 1) { - result.push(.../** @type {unknown[]} */(iterable(array[i]))); - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2461: Type 'unknown' is not an array type. - } - return result; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt.diff deleted file mode 100644 index 2484aabb20..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt.diff +++ /dev/null @@ -1,75 +0,0 @@ ---- old.jsFileFunctionOverloads.errors.txt -+++ new.jsFileFunctionOverloads.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+jsFileFunctionOverloads.js(26,12): error TS2304: Cannot find name 'T'. -+jsFileFunctionOverloads.js(27,14): error TS2304: Cannot find name 'T'. -+jsFileFunctionOverloads.js(54,44): error TS2461: Type 'unknown' is not an array type. -+ -+ -+==== jsFileFunctionOverloads.js (3 errors) ==== -+ /** -+ * @overload -+ * @param {number} x -+ * @returns {'number'} -+ */ -+ /** -+ * @overload -+ * @param {string} x -+ * @returns {'string'} -+ */ -+ /** -+ * @overload -+ * @param {boolean} x -+ * @returns {'boolean'} -+ */ -+ /** -+ * @param {unknown} x -+ * @returns {string} -+ */ -+ function getTypeName(x) { -+ return typeof x; -+ } -+ -+ /** -+ * @template T -+ * @param {T} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ const identity = x => x; -+ -+ /** -+ * @template T -+ * @template U -+ * @overload -+ * @param {T[]} array -+ * @param {(x: T) => U[]} iterable -+ * @returns {U[]} -+ */ -+ /** -+ * @template T -+ * @overload -+ * @param {T[][]} array -+ * @returns {T[]} -+ */ -+ /** -+ * @param {unknown[]} array -+ * @param {(x: unknown) => unknown} iterable -+ * @returns {unknown[]} -+ */ -+ function flatMap(array, iterable = identity) { -+ /** @type {unknown[]} */ -+ const result = []; -+ for (let i = 0; i < array.length; i += 1) { -+ result.push(.../** @type {unknown[]} */(iterable(array[i]))); -+ ~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2461: Type 'unknown' is not an array type. -+ } -+ return result; -+ } -+ diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols index 06d3e43822..ab94d8fda5 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols @@ -70,15 +70,11 @@ function flatMap(array, iterable = identity) { for (let i = 0; i < array.length; i += 1) { >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) ->array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(jsFileFunctionOverloads.js, 49, 17)) ->length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); ->result.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(jsFileFunctionOverloads.js, 51, 7)) ->push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >iterable : Symbol(iterable, Decl(jsFileFunctionOverloads.js, 49, 23)) >array : Symbol(array, Decl(jsFileFunctionOverloads.js, 49, 17)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff index f653c587e3..a27e87d408 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff @@ -5,18 +5,14 @@ >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) ->array.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) -+>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(jsFileFunctionOverloads.js, 49, 17)) ->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) -+>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); ->result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) -+>result.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(jsFileFunctionOverloads.js, 51, 7)) ->push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) -+>push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >iterable : Symbol(iterable, Decl(jsFileFunctionOverloads.js, 49, 23)) >array : Symbol(array, Decl(jsFileFunctionOverloads.js, 49, 17)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt deleted file mode 100644 index af369198c2..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt +++ /dev/null @@ -1,65 +0,0 @@ -jsFileFunctionOverloads2.js(24,12): error TS2304: Cannot find name 'T'. -jsFileFunctionOverloads2.js(25,14): error TS2304: Cannot find name 'T'. -jsFileFunctionOverloads2.js(49,44): error TS2461: Type 'unknown' is not an array type. - - -==== jsFileFunctionOverloads2.js (3 errors) ==== - // Also works if all @overload tags are combined in one comment. - /** - * @overload - * @param {number} x - * @returns {'number'} - * - * @overload - * @param {string} x - * @returns {'string'} - * - * @overload - * @param {boolean} x - * @returns {'boolean'} - * - * @param {unknown} x - * @returns {string} - */ - function getTypeName(x) { - return typeof x; - } - - /** - * @template T - * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T} - ~ -!!! error TS2304: Cannot find name 'T'. - */ - const identity = x => x; - - /** - * @template T - * @template U - * @overload - * @param {T[]} array - * @param {(x: T) => U[]} iterable - * @returns {U[]} - * - * @overload - * @param {T[][]} array - * @returns {T[]} - * - * @param {unknown[]} array - * @param {(x: unknown) => unknown} iterable - * @returns {unknown[]} - */ - function flatMap(array, iterable = identity) { - /** @type {unknown[]} */ - const result = []; - for (let i = 0; i < array.length; i += 1) { - result.push(.../** @type {unknown[]} */(iterable(array[i]))); - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2461: Type 'unknown' is not an array type. - } - return result; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt.diff deleted file mode 100644 index 391e00632b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.jsFileFunctionOverloads2.errors.txt -+++ new.jsFileFunctionOverloads2.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+jsFileFunctionOverloads2.js(24,12): error TS2304: Cannot find name 'T'. -+jsFileFunctionOverloads2.js(25,14): error TS2304: Cannot find name 'T'. -+jsFileFunctionOverloads2.js(49,44): error TS2461: Type 'unknown' is not an array type. -+ -+ -+==== jsFileFunctionOverloads2.js (3 errors) ==== -+ // Also works if all @overload tags are combined in one comment. -+ /** -+ * @overload -+ * @param {number} x -+ * @returns {'number'} -+ * -+ * @overload -+ * @param {string} x -+ * @returns {'string'} -+ * -+ * @overload -+ * @param {boolean} x -+ * @returns {'boolean'} -+ * -+ * @param {unknown} x -+ * @returns {string} -+ */ -+ function getTypeName(x) { -+ return typeof x; -+ } -+ -+ /** -+ * @template T -+ * @param {T} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ const identity = x => x; -+ -+ /** -+ * @template T -+ * @template U -+ * @overload -+ * @param {T[]} array -+ * @param {(x: T) => U[]} iterable -+ * @returns {U[]} -+ * -+ * @overload -+ * @param {T[][]} array -+ * @returns {T[]} -+ * -+ * @param {unknown[]} array -+ * @param {(x: unknown) => unknown} iterable -+ * @returns {unknown[]} -+ */ -+ function flatMap(array, iterable = identity) { -+ /** @type {unknown[]} */ -+ const result = []; -+ for (let i = 0; i < array.length; i += 1) { -+ result.push(.../** @type {unknown[]} */(iterable(array[i]))); -+ ~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2461: Type 'unknown' is not an array type. -+ } -+ return result; -+ } -+ diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols index 226798dfdc..134ec539b9 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols @@ -65,15 +65,11 @@ function flatMap(array, iterable = identity) { for (let i = 0; i < array.length; i += 1) { >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) ->array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(jsFileFunctionOverloads2.js, 44, 17)) ->length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); ->result.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(jsFileFunctionOverloads2.js, 46, 7)) ->push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >iterable : Symbol(iterable, Decl(jsFileFunctionOverloads2.js, 44, 23)) >array : Symbol(array, Decl(jsFileFunctionOverloads2.js, 44, 17)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff index 3a61f98336..e83c7b9946 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff @@ -5,18 +5,14 @@ >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) ->array.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) -+>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(jsFileFunctionOverloads2.js, 44, 17)) ->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) -+>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); ->result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) -+>result.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(jsFileFunctionOverloads2.js, 46, 7)) ->push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) -+>push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >iterable : Symbol(iterable, Decl(jsFileFunctionOverloads2.js, 44, 23)) >array : Symbol(array, Decl(jsFileFunctionOverloads2.js, 44, 17)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) diff --git a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt deleted file mode 100644 index afd42d87b7..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt +++ /dev/null @@ -1,35 +0,0 @@ -index.js(11,12): error TS2339: Property 'objects' does not exist on type 'object'. -index.js(13,26): error TS2698: Spread types may only be created from object types. - - -==== dash.d.ts (0 errors) ==== - type ObjectIterator = (value: TObject[keyof TObject], key: string, collection: TObject) => TResult; - - interface LoDashStatic { - mapValues(obj: T | null | undefined, callback: ObjectIterator): { [P in keyof T]: TResult }; - } - declare const _: LoDashStatic; - export = _; -==== Consts.ts (0 errors) ==== - export const INDEX_FIELD = '__INDEX'; -==== index.js (2 errors) ==== - import * as _ from './dash'; - import { INDEX_FIELD } from './Consts'; - - export class Test { - /** - * @param {object} obj - * @param {object} vm - */ - test(obj, vm) { - let index = 0; - vm.objects = _.mapValues( - ~~~~~~~ -!!! error TS2339: Property 'objects' does not exist on type 'object'. - obj, - object => ({ ...object, [INDEX_FIELD]: index++ }), - ~~~~~~~~~ -!!! error TS2698: Spread types may only be created from object types. - ); - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt.diff deleted file mode 100644 index 0cace8ce94..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt.diff +++ /dev/null @@ -1,40 +0,0 @@ ---- old.jsFileImportPreservedWhenUsed.errors.txt -+++ new.jsFileImportPreservedWhenUsed.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(11,12): error TS2339: Property 'objects' does not exist on type 'object'. -+index.js(13,26): error TS2698: Spread types may only be created from object types. -+ -+ -+==== dash.d.ts (0 errors) ==== -+ type ObjectIterator = (value: TObject[keyof TObject], key: string, collection: TObject) => TResult; -+ -+ interface LoDashStatic { -+ mapValues(obj: T | null | undefined, callback: ObjectIterator): { [P in keyof T]: TResult }; -+ } -+ declare const _: LoDashStatic; -+ export = _; -+==== Consts.ts (0 errors) ==== -+ export const INDEX_FIELD = '__INDEX'; -+==== index.js (2 errors) ==== -+ import * as _ from './dash'; -+ import { INDEX_FIELD } from './Consts'; -+ -+ export class Test { -+ /** -+ * @param {object} obj -+ * @param {object} vm -+ */ -+ test(obj, vm) { -+ let index = 0; -+ vm.objects = _.mapValues( -+ ~~~~~~~ -+!!! error TS2339: Property 'objects' does not exist on type 'object'. -+ obj, -+ object => ({ ...object, [INDEX_FIELD]: index++ }), -+ ~~~~~~~~~ -+!!! error TS2698: Spread types may only be created from object types. -+ ); -+ } -+ } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt index e8e15bef0a..942187b6f0 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt @@ -1,20 +1,16 @@ -jsFileMethodOverloads.js(6,14): error TS2304: Cannot find name 'T'. jsFileMethodOverloads.js(9,10): error TS2339: Property 'value' does not exist on type 'Example'. jsFileMethodOverloads.js(26,24): error TS2339: Property 'value' does not exist on type 'Example'. -jsFileMethodOverloads.js(40,18): error TS2304: Cannot find name 'T'. jsFileMethodOverloads.js(44,25): error TS2339: Property 'value' does not exist on type 'Example'. jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist on type 'Example'. -==== jsFileMethodOverloads.js (6 errors) ==== +==== jsFileMethodOverloads.js (4 errors) ==== /** * @template T */ class Example { /** * @param {T} value - ~ -!!! error TS2304: Cannot find name 'T'. */ constructor(value) { this.value = value; @@ -53,8 +49,6 @@ jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist o */ /** * @param {(y: T) => unknown} [fn] - ~ -!!! error TS2304: Cannot find name 'T'. * @returns {unknown} */ transform(fn) { diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt.diff index 41769012b0..c7ba1d7958 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt.diff @@ -3,23 +3,19 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+jsFileMethodOverloads.js(6,14): error TS2304: Cannot find name 'T'. +jsFileMethodOverloads.js(9,10): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads.js(26,24): error TS2339: Property 'value' does not exist on type 'Example'. -+jsFileMethodOverloads.js(40,18): error TS2304: Cannot find name 'T'. +jsFileMethodOverloads.js(44,25): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist on type 'Example'. + + -+==== jsFileMethodOverloads.js (6 errors) ==== ++==== jsFileMethodOverloads.js (4 errors) ==== + /** + * @template T + */ + class Example { + /** + * @param {T} value -+ ~ -+!!! error TS2304: Cannot find name 'T'. + */ + constructor(value) { + this.value = value; @@ -58,8 +54,6 @@ + */ + /** + * @param {(y: T) => unknown} [fn] -+ ~ -+!!! error TS2304: Cannot find name 'T'. + * @returns {unknown} + */ + transform(fn) { diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt index c4db6be524..4e6cf1d02b 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt @@ -1,12 +1,10 @@ -jsFileMethodOverloads2.js(7,14): error TS2304: Cannot find name 'T'. jsFileMethodOverloads2.js(10,10): error TS2339: Property 'value' does not exist on type 'Example'. jsFileMethodOverloads2.js(25,24): error TS2339: Property 'value' does not exist on type 'Example'. -jsFileMethodOverloads2.js(37,18): error TS2304: Cannot find name 'T'. jsFileMethodOverloads2.js(41,25): error TS2339: Property 'value' does not exist on type 'Example'. jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist on type 'Example'. -==== jsFileMethodOverloads2.js (6 errors) ==== +==== jsFileMethodOverloads2.js (4 errors) ==== // Also works if all @overload tags are combined in one comment. /** * @template T @@ -14,8 +12,6 @@ jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist class Example { /** * @param {T} value - ~ -!!! error TS2304: Cannot find name 'T'. */ constructor(value) { this.value = value; @@ -50,8 +46,6 @@ jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist * @returns {T} * * @param {(y: T) => unknown} [fn] - ~ -!!! error TS2304: Cannot find name 'T'. * @returns {unknown} */ transform(fn) { diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt.diff index 61e2b924d4..4b61d6f32c 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt.diff @@ -3,15 +3,13 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+jsFileMethodOverloads2.js(7,14): error TS2304: Cannot find name 'T'. +jsFileMethodOverloads2.js(10,10): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads2.js(25,24): error TS2339: Property 'value' does not exist on type 'Example'. -+jsFileMethodOverloads2.js(37,18): error TS2304: Cannot find name 'T'. +jsFileMethodOverloads2.js(41,25): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist on type 'Example'. + + -+==== jsFileMethodOverloads2.js (6 errors) ==== ++==== jsFileMethodOverloads2.js (4 errors) ==== + // Also works if all @overload tags are combined in one comment. + /** + * @template T @@ -19,8 +17,6 @@ + class Example { + /** + * @param {T} value -+ ~ -+!!! error TS2304: Cannot find name 'T'. + */ + constructor(value) { + this.value = value; @@ -55,8 +51,6 @@ + * @returns {T} + * + * @param {(y: T) => unknown} [fn] -+ ~ -+!!! error TS2304: Cannot find name 'T'. + * @returns {unknown} + */ + transform(fn) { diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt deleted file mode 100644 index 1d9b3df6af..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt +++ /dev/null @@ -1,69 +0,0 @@ -jsdocArrayObjectPromiseImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -jsdocArrayObjectPromiseImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -jsdocArrayObjectPromiseImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). -jsdocArrayObjectPromiseImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -jsdocArrayObjectPromiseImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -jsdocArrayObjectPromiseImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). -jsdocArrayObjectPromiseImplicitAny.js(30,18): error TS2322: Type 'number' is not assignable to type '() => Object'. -jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. - - -==== jsdocArrayObjectPromiseImplicitAny.js (8 errors) ==== - /** @type {Array} */ - ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - var anyArray = [5]; - - /** @type {Array} */ - var numberArray = [5]; - - /** - * @param {Array} arr - ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - * @return {Array} - ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - */ - function returnAnyArray(arr) { - return arr; - } - - /** @type {Promise} */ - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). - var anyPromise = Promise.resolve(5); - - /** @type {Promise} */ - var numberPromise = Promise.resolve(5); - - /** - * @param {Promise} pr - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). - * @return {Promise} - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). - */ - function returnAnyPromise(pr) { - return pr; - } - - /** @type {Object} */ - var anyObject = {valueOf: 1}; // not an error since assigning to any. - ~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type '() => Object'. - - /** @type {Object} */ - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2315: Type 'Object' is not generic. - var paramedObject = {valueOf: 1}; - - /** - * @param {Object} obj - * @return {Object} - */ - function returnAnyObject(obj) { - return obj; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff deleted file mode 100644 index 64a04b64c4..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.jsdocArrayObjectPromiseImplicitAny.errors.txt -+++ new.jsdocArrayObjectPromiseImplicitAny.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+jsdocArrayObjectPromiseImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+jsdocArrayObjectPromiseImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+jsdocArrayObjectPromiseImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+jsdocArrayObjectPromiseImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -+jsdocArrayObjectPromiseImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -+jsdocArrayObjectPromiseImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). -+jsdocArrayObjectPromiseImplicitAny.js(30,18): error TS2322: Type 'number' is not assignable to type '() => Object'. -+jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. -+ -+ -+==== jsdocArrayObjectPromiseImplicitAny.js (8 errors) ==== -+ /** @type {Array} */ -+ ~~~~~ -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). -+ var anyArray = [5]; -+ -+ /** @type {Array} */ -+ var numberArray = [5]; -+ -+ /** -+ * @param {Array} arr -+ ~~~~~ -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). -+ * @return {Array} -+ ~~~~~ -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). -+ */ -+ function returnAnyArray(arr) { -+ return arr; -+ } -+ -+ /** @type {Promise} */ -+ ~~~~~~~ -+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). -+ var anyPromise = Promise.resolve(5); -+ -+ /** @type {Promise} */ -+ var numberPromise = Promise.resolve(5); -+ -+ /** -+ * @param {Promise} pr -+ ~~~~~~~ -+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). -+ * @return {Promise} -+ ~~~~~~~ -+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). -+ */ -+ function returnAnyPromise(pr) { -+ return pr; -+ } -+ -+ /** @type {Object} */ -+ var anyObject = {valueOf: 1}; // not an error since assigning to any. -+ ~~~~~~~ -+!!! error TS2322: Type 'number' is not assignable to type '() => Object'. -+ -+ /** @type {Object} */ -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2315: Type 'Object' is not generic. -+ var paramedObject = {valueOf: 1}; -+ -+ /** -+ * @param {Object} obj -+ * @return {Object} -+ */ -+ function returnAnyObject(obj) { -+ return obj; -+ } -+ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt deleted file mode 100644 index c88b521e45..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt +++ /dev/null @@ -1,69 +0,0 @@ -jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(30,21): error TS2322: Type 'number' is not assignable to type '() => Object'. -jsdocArrayObjectPromiseNoImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. - - -==== jsdocArrayObjectPromiseNoImplicitAny.js (8 errors) ==== - /** @type {Array} */ - ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - var notAnyArray = [5]; - - /** @type {Array} */ - var numberArray = [5]; - - /** - * @param {Array} arr - ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - * @return {Array} - ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - */ - function returnNotAnyArray(arr) { - return arr; - } - - /** @type {Promise} */ - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). - var notAnyPromise = Promise.resolve(5); - - /** @type {Promise} */ - var numberPromise = Promise.resolve(5); - - /** - * @param {Promise} pr - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). - * @return {Promise} - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). - */ - function returnNotAnyPromise(pr) { - return pr; - } - - /** @type {Object} */ - var notAnyObject = {valueOf: 1}; // error since assigning to Object, not any. - ~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type '() => Object'. - - /** @type {Object} */ - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2315: Type 'Object' is not generic. - var paramedObject = {valueOf: 1}; - - /** - * @param {Object} obj - * @return {Object} - */ - function returnNotAnyObject(obj) { - return obj; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff index 8907da0eca..dd54222c94 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff @@ -1,47 +1,71 @@ --- old.jsdocArrayObjectPromiseNoImplicitAny.errors.txt +++ new.jsdocArrayObjectPromiseNoImplicitAny.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'Array' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'Array' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'Array' requires 1 type argument(s). -+jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). - jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). - jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). - jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). - jsdocArrayObjectPromiseNoImplicitAny.js(30,21): error TS2322: Type 'number' is not assignable to type '() => Object'. -+jsdocArrayObjectPromiseNoImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. - - +-jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +-jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +-jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). +-jsdocArrayObjectPromiseNoImplicitAny.js(30,21): error TS2322: Type 'number' is not assignable to type '() => Object'. +- +- -==== jsdocArrayObjectPromiseNoImplicitAny.js (7 errors) ==== -+==== jsdocArrayObjectPromiseNoImplicitAny.js (8 errors) ==== - /** @type {Array} */ - ~~~~~ +- /** @type {Array} */ +- ~~~~~ -!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - var notAnyArray = [5]; - - /** @type {Array} */ -@@= skipped -18, +19 lines =@@ - /** - * @param {Array} arr - ~~~~~ +- var notAnyArray = [5]; +- +- /** @type {Array} */ +- var numberArray = [5]; +- +- /** +- * @param {Array} arr +- ~~~~~ -!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - * @return {Array} - ~~~~~ +- * @return {Array} +- ~~~~~ -!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - */ - function returnNotAnyArray(arr) { - return arr; -@@= skipped -35, +35 lines =@@ - !!! error TS2322: Type 'number' is not assignable to type '() => Object'. - - /** @type {Object} */ -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2315: Type 'Object' is not generic. - var paramedObject = {valueOf: 1}; - - /** +- */ +- function returnNotAnyArray(arr) { +- return arr; +- } +- +- /** @type {Promise} */ +- ~~~~~~~ +-!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). +- var notAnyPromise = Promise.resolve(5); +- +- /** @type {Promise} */ +- var numberPromise = Promise.resolve(5); +- +- /** +- * @param {Promise} pr +- ~~~~~~~ +-!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). +- * @return {Promise} +- ~~~~~~~ +-!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). +- */ +- function returnNotAnyPromise(pr) { +- return pr; +- } +- +- /** @type {Object} */ +- var notAnyObject = {valueOf: 1}; // error since assigning to Object, not any. +- ~~~~~~~ +-!!! error TS2322: Type 'number' is not assignable to type '() => Object'. +- +- /** @type {Object} */ +- var paramedObject = {valueOf: 1}; +- +- /** +- * @param {Object} obj +- * @return {Object} +- */ +- function returnNotAnyObject(obj) { +- return obj; +- } +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt index d8a5fdf957..9697d6f2aa 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt @@ -1,8 +1,7 @@ index.js(12,14): error TS7006: Parameter 'arg' implicitly has an 'any' type. -index.js(20,16): error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'. -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== /** @type () => string */ function fn1() { return 42; @@ -25,7 +24,4 @@ index.js(20,16): error TS2322: Type '"other"' is not assignable to type '"bar" | /** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */ const obj2 = { type: "other", prop: 10 }; - ~~~~ -!!! error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'. -!!! related TS6500 index.js:19:14: The expected type comes from property 'type' which is declared here on type '({ type: "foo"; } | { type: "bar"; }) & { prop: number; }' \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt.diff index fc65d1e9e5..d1d1cf09bd 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt.diff @@ -4,10 +4,10 @@ -index.js(3,3): error TS2322: Type 'number' is not assignable to type 'string'. -index.js(20,16): error TS2322: Type '"other"' is not assignable to type '"foo" | "bar"'. +index.js(12,14): error TS7006: Parameter 'arg' implicitly has an 'any' type. -+index.js(20,16): error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'. - ==== index.js (2 errors) ==== +-==== index.js (2 errors) ==== ++==== index.js (1 errors) ==== /** @type () => string */ function fn1() { return 42; @@ -16,7 +16,7 @@ } /** @type () => string */ -@@= skipped -16, +14 lines =@@ +@@= skipped -16, +13 lines =@@ /** @type (arg: string) => string */ function fn3(arg) { @@ -25,11 +25,11 @@ return arg; } -@@= skipped -9, +11 lines =@@ +@@= skipped -8, +10 lines =@@ + /** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */ const obj2 = { type: "other", prop: 10 }; - ~~~~ +- ~~~~ -!!! error TS2322: Type '"other"' is not assignable to type '"foo" | "bar"'. -+!!! error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'. - !!! related TS6500 index.js:19:14: The expected type comes from property 'type' which is declared here on type '({ type: "foo"; } | { type: "bar"; }) & { prop: number; }' +-!!! related TS6500 index.js:19:14: The expected type comes from property 'type' which is declared here on type '({ type: "foo"; } | { type: "bar"; }) & { prop: number; }' diff --git a/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt deleted file mode 100644 index 79546958ff..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -/a.js(5,12): error TS2304: Cannot find name 'B'. - - -==== /a.js (1 errors) ==== - /** - * @template T - * @callback B - */ - /** @type {B} */ - ~ -!!! error TS2304: Cannot find name 'B'. - let b; - b(); - b(1); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt.diff index 9f045ce14f..68509d8155 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt.diff @@ -1,20 +1,20 @@ --- old.jsdocCallbackAndType.errors.txt +++ new.jsdocCallbackAndType.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -/a.js(8,3): error TS2554: Expected 0 arguments, but got 1. -+/a.js(5,12): error TS2304: Cannot find name 'B'. - - - ==== /a.js (1 errors) ==== -@@= skipped -6, +6 lines =@@ - * @callback B - */ - /** @type {B} */ -+ ~ -+!!! error TS2304: Cannot find name 'B'. - let b; - b(); - b(1); +- +- +-==== /a.js (1 errors) ==== +- /** +- * @template T +- * @callback B +- */ +- /** @type {B} */ +- let b; +- b(); +- b(1); - ~ -!!! error TS2554: Expected 0 arguments, but got 1. - +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt index 0720aa43ad..a0b46cd948 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt @@ -1,4 +1,4 @@ -/a.js(6,18): error TS1093: Type annotation cannot appear on a constructor declaration. +/a.js(6,17): error TS1093: Type annotation cannot appear on a constructor declaration. ==== /a.js (1 errors) ==== @@ -8,7 +8,7 @@ } class D { /** @return {number} */ - ~~~~~~ + ~~~~~~~~ !!! error TS1093: Type annotation cannot appear on a constructor declaration. constructor() {} } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt.diff index a7a65f54e0..82630ab0ac 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt.diff @@ -2,7 +2,8 @@ +++ new.jsdocIllegalTags.errors.txt @@= skipped -0, +0 lines =@@ -/a.js(2,19): error TS1092: Type parameters cannot appear on a constructor declaration. - /a.js(6,18): error TS1093: Type annotation cannot appear on a constructor declaration. +-/a.js(6,18): error TS1093: Type annotation cannot appear on a constructor declaration. ++/a.js(6,17): error TS1093: Type annotation cannot appear on a constructor declaration. -==== /a.js (2 errors) ==== @@ -14,3 +15,9 @@ constructor() { } } class D { + /** @return {number} */ +- ~~~~~~ ++ ~~~~~~~~ + !!! error TS1093: Type annotation cannot appear on a constructor declaration. + constructor() {} + } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt deleted file mode 100644 index 6fce29fff1..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -usage.js(5,12): error TS2304: Cannot find name 'options'. - - -==== module.js (0 errors) ==== - export class MyClass { - } - -==== usage.js (1 errors) ==== - /** - * @typedef {Object} options - * @property {import("./module").MyClass} option - */ - /** @type {options} */ - ~~~~~~~ -!!! error TS2304: Cannot find name 'options'. - let v; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt.diff deleted file mode 100644 index aa4adc138b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.jsdocImportTypeResolution.errors.txt -+++ new.jsdocImportTypeResolution.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+usage.js(5,12): error TS2304: Cannot find name 'options'. -+ -+ -+==== module.js (0 errors) ==== -+ export class MyClass { -+ } -+ -+==== usage.js (1 errors) ==== -+ /** -+ * @typedef {Object} options -+ * @property {import("./module").MyClass} option -+ */ -+ /** @type {options} */ -+ ~~~~~~~ -+!!! error TS2304: Cannot find name 'options'. -+ let v; diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols index 8e62ab992a..45e5696a1a 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols @@ -8,8 +8,6 @@ class Foo { m = x => x.toLowerCase(); >m : Symbol(m, Decl(a.js, 0, 11)) >x : Symbol(x, Decl(a.js, 2, 7)) ->x.toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(a.js, 2, 7)) ->toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --)) } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff index da85b80884..9d7a20e19d 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff @@ -8,9 +8,7 @@ +>m : Symbol(m, Decl(a.js, 0, 11)) >x : Symbol(x, Decl(a.js, 2, 7)) ->x.toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) -+>x.toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(a.js, 2, 7)) ->toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) -+>toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --)) } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt deleted file mode 100644 index 1b0b2a8cd2..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -example.js(3,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? - - -==== example.js (1 errors) ==== - // @ts-check - /** - * @type {function(@foo)} - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - */ - let x; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff index 02309368e5..795b5d4d8d 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff @@ -1,25 +1,22 @@ --- old.jsdocParameterParsingInfiniteLoop.errors.txt +++ new.jsdocParameterParsingInfiniteLoop.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -example.js(3,11): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -example.js(3,20): error TS1110: Type expected. -example.js(3,21): error TS2304: Cannot find name 'foo'. -+example.js(3,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? - - +- +- -==== example.js (3 errors) ==== -+==== example.js (1 errors) ==== - // @ts-check - /** - * @type {function(@foo)} +- // @ts-check +- /** +- * @type {function(@foo)} - ~~~~~~~~~~~~~~ -!!! error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. - ~ -!!! error TS1110: Type expected. - ~~~ -!!! error TS2304: Cannot find name 'foo'. -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - */ - let x; +- */ +- let x; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt deleted file mode 100644 index 2d8bfd5235..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -/a.js(6,13): error TS2304: Cannot find name 'MyType'. - - -==== /a.js (1 errors) ==== - /** - * @typedef MyType - * @property {sting} [x] - */ - - /** @param {MyType} p */ - ~~~~~~ -!!! error TS2304: Cannot find name 'MyType'. - export function f(p) { } - -==== /b.js (0 errors) ==== - import { f } from "./a.js" - f({ x: 42 }) - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt.diff index 587a061b2f..f7b8894087 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.errors.txt.diff @@ -1,21 +1,23 @@ --- old.jsdocPropertyTagInvalid.errors.txt +++ new.jsdocPropertyTagInvalid.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -/a.js(3,15): error TS2552: Cannot find name 'sting'. Did you mean 'string'? -+/a.js(6,13): error TS2304: Cannot find name 'MyType'. - - - ==== /a.js (1 errors) ==== - /** - * @typedef MyType - * @property {sting} [x] +- +- +-==== /a.js (1 errors) ==== +- /** +- * @typedef MyType +- * @property {sting} [x] - ~~~~~ -!!! error TS2552: Cannot find name 'sting'. Did you mean 'string'? - */ - - /** @param {MyType} p */ -+ ~~~~~~ -+!!! error TS2304: Cannot find name 'MyType'. - export function f(p) { } - - ==== /b.js (0 errors) ==== +- */ +- +- /** @param {MyType} p */ +- export function f(p) { } +- +-==== /b.js (0 errors) ==== +- import { f } from "./a.js" +- f({ x: 42 }) +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt deleted file mode 100644 index 6c3a675c1e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -/a.js(2,12): error TS2304: Cannot find name 'Ty'. - - -==== /a.js (1 errors) ==== - /** - * @param {Ty} x - ~~ -!!! error TS2304: Cannot find name 'Ty'. - */ - function f(x) {} - - /** - * @typedef {CantResolveThis} Ty - */ - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt.diff index 77654e6eef..4b568dd738 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt.diff @@ -1,21 +1,20 @@ --- old.jsdocResolveNameFailureInTypedef.errors.txt +++ new.jsdocResolveNameFailureInTypedef.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -/a.js(7,14): error TS2304: Cannot find name 'CantResolveThis'. -+/a.js(2,12): error TS2304: Cannot find name 'Ty'. - - - ==== /a.js (1 errors) ==== - /** - * @param {Ty} x -+ ~~ -+!!! error TS2304: Cannot find name 'Ty'. - */ - function f(x) {} - - /** - * @typedef {CantResolveThis} Ty +- +- +-==== /a.js (1 errors) ==== +- /** +- * @param {Ty} x +- */ +- function f(x) {} +- +- /** +- * @typedef {CantResolveThis} Ty - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'CantResolveThis'. - */ - +- */ +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt deleted file mode 100644 index e7d78345b9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -jsdocTypeCast.js(6,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. -jsdocTypeCast.js(10,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. -jsdocTypeCast.js(14,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. - - -==== jsdocTypeCast.js (3 errors) ==== - /** - * @param {string} x - */ - function f(x) { - /** @type {'a' | 'b'} */ - let a = (x); // Error - ~ -!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. - a; - - /** @type {'a' | 'b'} */ - let b = (((x))); // Error - ~ -!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. - b; - - /** @type {'a' | 'b'} */ - let c = /** @type {'a' | 'b'} */ (x); // Ok - ~ -!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. - c; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt.diff index df8b910a28..0d143fd995 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt.diff @@ -1,22 +1,31 @@ --- old.jsdocTypeCast.errors.txt +++ new.jsdocTypeCast.errors.txt -@@= skipped -0, +0 lines =@@ - jsdocTypeCast.js(6,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. - jsdocTypeCast.js(10,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. -+jsdocTypeCast.js(14,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. - - +@@= skipped -0, +-1 lines =@@ +-jsdocTypeCast.js(6,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. +-jsdocTypeCast.js(10,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. +- +- -==== jsdocTypeCast.js (2 errors) ==== -+==== jsdocTypeCast.js (3 errors) ==== - /** - * @param {string} x - */ -@@= skipped -20, +21 lines =@@ - - /** @type {'a' | 'b'} */ - let c = /** @type {'a' | 'b'} */ (x); // Ok -+ ~ -+!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. - c; - } - +- /** +- * @param {string} x +- */ +- function f(x) { +- /** @type {'a' | 'b'} */ +- let a = (x); // Error +- ~ +-!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. +- a; +- +- /** @type {'a' | 'b'} */ +- let b = (((x))); // Error +- ~ +-!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. +- b; +- +- /** @type {'a' | 'b'} */ +- let c = /** @type {'a' | 'b'} */ (x); // Ok +- c; +- } +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt deleted file mode 100644 index ee345c568c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt +++ /dev/null @@ -1,76 +0,0 @@ -index8.js(4,12): error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? -index8.js(4,15): error TS2304: Cannot find name 'T'. - - -==== index.js (0 errors) ==== - /** - * @param {(m: Boolean) => string} somebody - */ - function sayHello(somebody) { - return 'Hello ' + somebody; - } - -==== index2.js (0 errors) ==== - /** - * @param {(m: Void) => string} somebody - */ - function sayHello2(somebody) { - return 'Hello ' + somebody; - } - - -==== index3.js (0 errors) ==== - /** - * @param {(m: Undefined) => string} somebody - */ - function sayHello3(somebody) { - return 'Hello ' + somebody; - } - - -==== index4.js (0 errors) ==== - /** - * @param {(m: Function) => string} somebody - */ - function sayHello4(somebody) { - return 'Hello ' + somebody; - } - - -==== index5.js (0 errors) ==== - /** - * @param {(m: String) => string} somebody - */ - function sayHello5(somebody) { - return 'Hello ' + somebody; - } - - -==== index6.js (0 errors) ==== - /** - * @param {(m: Number) => string} somebody - */ - function sayHello6(somebody) { - return 'Hello ' + somebody; - } - - -==== index7.js (0 errors) ==== - /** - * @param {(m: Object) => string} somebody - */ - function sayHello7(somebody) { - return 'Hello ' + somebody; - } - -==== index8.js (2 errors) ==== - function fn() {} - - /** - * @param {fn} somebody - ~~ -!!! error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? - ~ -!!! error TS2304: Cannot find name 'T'. - */ - function sayHello8(somebody) { } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff index 8e19d6b491..0632a01195 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff @@ -1,6 +1,6 @@ --- old.jsdocTypeNongenericInstantiationAttempt.errors.txt +++ new.jsdocTypeNongenericInstantiationAttempt.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -index.js(2,19): error TS2315: Type 'Boolean' is not generic. -index2.js(2,19): error TS2315: Type 'Void' is not generic. -index3.js(2,19): error TS2315: Type 'Undefined' is not generic. @@ -8,100 +8,92 @@ -index5.js(2,19): error TS2315: Type 'String' is not generic. -index6.js(2,19): error TS2315: Type 'Number' is not generic. -index7.js(2,19): error TS2315: Type 'Object' is not generic. -+index8.js(4,12): error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? - index8.js(4,15): error TS2304: Cannot find name 'T'. - - +-index8.js(4,15): error TS2304: Cannot find name 'T'. +- +- -==== index.js (1 errors) ==== -+==== index.js (0 errors) ==== - /** - * @param {(m: Boolean) => string} somebody +- /** +- * @param {(m: Boolean) => string} somebody - ~~~~~~~~~~ -!!! error TS2315: Type 'Boolean' is not generic. - */ - function sayHello(somebody) { - return 'Hello ' + somebody; - } - +- */ +- function sayHello(somebody) { +- return 'Hello ' + somebody; +- } +- -==== index2.js (1 errors) ==== -+==== index2.js (0 errors) ==== - /** - * @param {(m: Void) => string} somebody +- /** +- * @param {(m: Void) => string} somebody - ~~~~~~~ -!!! error TS2315: Type 'Void' is not generic. - */ - function sayHello2(somebody) { - return 'Hello ' + somebody; - } - - +- */ +- function sayHello2(somebody) { +- return 'Hello ' + somebody; +- } +- +- -==== index3.js (1 errors) ==== -+==== index3.js (0 errors) ==== - /** - * @param {(m: Undefined) => string} somebody +- /** +- * @param {(m: Undefined) => string} somebody - ~~~~~~~~~~~~ -!!! error TS2315: Type 'Undefined' is not generic. - */ - function sayHello3(somebody) { - return 'Hello ' + somebody; - } - - +- */ +- function sayHello3(somebody) { +- return 'Hello ' + somebody; +- } +- +- -==== index4.js (1 errors) ==== -+==== index4.js (0 errors) ==== - /** - * @param {(m: Function) => string} somebody +- /** +- * @param {(m: Function) => string} somebody - ~~~~~~~~~~~ -!!! error TS2315: Type 'Function' is not generic. - */ - function sayHello4(somebody) { - return 'Hello ' + somebody; - } - - +- */ +- function sayHello4(somebody) { +- return 'Hello ' + somebody; +- } +- +- -==== index5.js (1 errors) ==== -+==== index5.js (0 errors) ==== - /** - * @param {(m: String) => string} somebody +- /** +- * @param {(m: String) => string} somebody - ~~~~~~~~~ -!!! error TS2315: Type 'String' is not generic. - */ - function sayHello5(somebody) { - return 'Hello ' + somebody; - } - - +- */ +- function sayHello5(somebody) { +- return 'Hello ' + somebody; +- } +- +- -==== index6.js (1 errors) ==== -+==== index6.js (0 errors) ==== - /** - * @param {(m: Number) => string} somebody +- /** +- * @param {(m: Number) => string} somebody - ~~~~~~~~~ -!!! error TS2315: Type 'Number' is not generic. - */ - function sayHello6(somebody) { - return 'Hello ' + somebody; - } - - +- */ +- function sayHello6(somebody) { +- return 'Hello ' + somebody; +- } +- +- -==== index7.js (1 errors) ==== -+==== index7.js (0 errors) ==== - /** - * @param {(m: Object) => string} somebody +- /** +- * @param {(m: Object) => string} somebody - ~~~~~~~~~ -!!! error TS2315: Type 'Object' is not generic. - */ - function sayHello7(somebody) { - return 'Hello ' + somebody; - } - +- */ +- function sayHello7(somebody) { +- return 'Hello ' + somebody; +- } +- -==== index8.js (1 errors) ==== -+==== index8.js (2 errors) ==== - function fn() {} - - /** - * @param {fn} somebody -+ ~~ -+!!! error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? - ~ - !!! error TS2304: Cannot find name 'T'. - */ +- function fn() {} +- +- /** +- * @param {fn} somebody +- ~ +-!!! error TS2304: Cannot find name 'T'. +- */ +- function sayHello8(somebody) { } +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt deleted file mode 100644 index 1760973e82..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -test.js(13,14): error TS2304: Cannot find name 'NotADuplicateIdentifier'. -test.js(14,14): error TS2304: Cannot find name 'AlsoNotADuplicate'. - - -==== test.js (2 errors) ==== - // @ts-check - /** @typedef {number} NotADuplicateIdentifier */ - - (2 * 2); - - /** @typedef {number} AlsoNotADuplicate */ - - (2 * 2) + 1; - - - /** - * - * @param a {NotADuplicateIdentifier} - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'NotADuplicateIdentifier'. - * @param b {AlsoNotADuplicate} - ~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'AlsoNotADuplicate'. - */ - function makeSureTypedefsAreStillRecognized(a, b) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt.diff deleted file mode 100644 index 4c1cfab958..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.jsdocTypedefBeforeParenthesizedExpression.errors.txt -+++ new.jsdocTypedefBeforeParenthesizedExpression.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+test.js(13,14): error TS2304: Cannot find name 'NotADuplicateIdentifier'. -+test.js(14,14): error TS2304: Cannot find name 'AlsoNotADuplicate'. -+ -+ -+==== test.js (2 errors) ==== -+ // @ts-check -+ /** @typedef {number} NotADuplicateIdentifier */ -+ -+ (2 * 2); -+ -+ /** @typedef {number} AlsoNotADuplicate */ -+ -+ (2 * 2) + 1; -+ -+ -+ /** -+ * -+ * @param a {NotADuplicateIdentifier} -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'NotADuplicateIdentifier'. -+ * @param b {AlsoNotADuplicate} -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'AlsoNotADuplicate'. -+ */ -+ function makeSureTypedefsAreStillRecognized(a, b) {} -+ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt deleted file mode 100644 index 630d35b328..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -/a.js(12,11): error TS2304: Cannot find name 'Person'. - - -==== /a.js (1 errors) ==== - // Bad: missing a type - /** @typedef T */ - - const t = 0; - - // OK: missing a type, but have property tags. - /** - * @typedef Person - * @property {string} name - */ - - /** @type Person */ - ~~~~~~ -!!! error TS2304: Cannot find name 'Person'. - const person = { name: "" }; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt.diff index e65bd272f2..d849c2bad5 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.errors.txt.diff @@ -1,23 +1,25 @@ --- old.jsdocTypedefMissingType.errors.txt +++ new.jsdocTypedefMissingType.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -/a.js(2,14): error TS8021: JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags. -+/a.js(12,11): error TS2304: Cannot find name 'Person'. - - - ==== /a.js (1 errors) ==== - // Bad: missing a type - /** @typedef T */ +- +- +-==== /a.js (1 errors) ==== +- // Bad: missing a type +- /** @typedef T */ - ~ -!!! error TS8021: JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags. - - const t = 0; - -@@= skipped -15, +13 lines =@@ - */ - - /** @type Person */ -+ ~~~~~~ -+!!! error TS2304: Cannot find name 'Person'. - const person = { name: "" }; - +- +- const t = 0; +- +- // OK: missing a type, but have property tags. +- /** +- * @typedef Person +- * @property {string} name +- */ +- +- /** @type Person */ +- const person = { name: "" }; +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt deleted file mode 100644 index 929b50f960..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -/a.js(6,12): error TS2304: Cannot find name 'Foo'. - - -==== /a.js (1 errors) ==== - /** - * @typedef Foo - * @property foo - */ - - /** @type {Foo} */ - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - const x = { foo: 0 }; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt.diff deleted file mode 100644 index 64d63eca72..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.jsdocTypedef_propertyWithNoType.errors.txt -+++ new.jsdocTypedef_propertyWithNoType.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/a.js(6,12): error TS2304: Cannot find name 'Foo'. -+ -+ -+==== /a.js (1 errors) ==== -+ /** -+ * @typedef Foo -+ * @property foo -+ */ -+ -+ /** @type {Foo} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. -+ const x = { foo: 0 }; -+ diff --git a/testdata/baselines/reference/submodule/compiler/moduleExports1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleExports1.errors.txt.diff new file mode 100644 index 0000000000..9c28bb3626 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleExports1.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.moduleExports1.errors.txt ++++ new.moduleExports1.errors.txt +@@= skipped -0, +0 lines =@@ ++moduleExports1.ts(7,26): error TS2339: Property 'Strasse' does not exist on type 'typeof TypeScript'. + moduleExports1.ts(13,6): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + moduleExports1.ts(13,22): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + +-==== moduleExports1.ts (2 errors) ==== ++==== moduleExports1.ts (3 errors) ==== + export module TypeScript.Strasse.Street { + export class Rue { + public address:string; +@@= skipped -9, +10 lines =@@ + } + + var rue = new TypeScript.Strasse.Street.Rue(); ++ ~~~~~~~ ++!!! error TS2339: Property 'Strasse' does not exist on type 'typeof TypeScript'. + + rue.address = "1 Main Street"; + diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt deleted file mode 100644 index d65872e460..0000000000 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -index.js(9,3): error TS2322: Type '() => string | Set | undefined' is not assignable to type '() => string'. - Type 'string | Set | undefined' is not assignable to type 'string'. - Type 'undefined' is not assignable to type 'string'. - - -==== index.js (1 errors) ==== - /** @type {Map>} */ - const cache = new Map() - - /** - * @param {string} key - * @returns {() => string} - */ - const getStringGetter = (key) => { - return () => { - ~~~~~~ -!!! error TS2322: Type '() => string | Set | undefined' is not assignable to type '() => string'. -!!! error TS2322: Type 'string | Set | undefined' is not assignable to type 'string'. -!!! error TS2322: Type 'undefined' is not assignable to type 'string'. - return /** @type {string} */ (cache.get(key)) - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff deleted file mode 100644 index bb0fcf5910..0000000000 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.parenthesizedJSDocCastAtReturnStatement.errors.txt -+++ new.parenthesizedJSDocCastAtReturnStatement.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(9,3): error TS2322: Type '() => string | Set | undefined' is not assignable to type '() => string'. -+ Type 'string | Set | undefined' is not assignable to type 'string'. -+ Type 'undefined' is not assignable to type 'string'. -+ -+ -+==== index.js (1 errors) ==== -+ /** @type {Map>} */ -+ const cache = new Map() -+ -+ /** -+ * @param {string} key -+ * @returns {() => string} -+ */ -+ const getStringGetter = (key) => { -+ return () => { -+ ~~~~~~ -+!!! error TS2322: Type '() => string | Set | undefined' is not assignable to type '() => string'. -+!!! error TS2322: Type 'string | Set | undefined' is not assignable to type 'string'. -+!!! error TS2322: Type 'undefined' is not assignable to type 'string'. -+ return /** @type {string} */ (cache.get(key)) -+ } -+ } -+ diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols index 3acb7e7680..0cf1309b93 100644 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols +++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols @@ -16,9 +16,7 @@ const getStringGetter = (key) => { return () => { return /** @type {string} */ (cache.get(key)) ->cache.get : Symbol(get, Decl(lib.es2015.collection.d.ts, --, --)) >cache : Symbol(cache, Decl(index.js, 1, 5)) ->get : Symbol(get, Decl(lib.es2015.collection.d.ts, --, --)) >key : Symbol(key, Decl(index.js, 7, 25)) } } diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols.diff b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols.diff index 2bd63ad02b..719418e59e 100644 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols.diff @@ -5,10 +5,8 @@ return () => { return /** @type {string} */ (cache.get(key)) ->cache.get : Symbol(Map.get, Decl(lib.es2015.collection.d.ts, --, --)) -+>cache.get : Symbol(get, Decl(lib.es2015.collection.d.ts, --, --)) >cache : Symbol(cache, Decl(index.js, 1, 5)) ->get : Symbol(Map.get, Decl(lib.es2015.collection.d.ts, --, --)) -+>get : Symbol(get, Decl(lib.es2015.collection.d.ts, --, --)) >key : Symbol(key, Decl(index.js, 7, 25)) } } diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols index 4d4e83f4f4..e68a2c1803 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols @@ -12,9 +12,7 @@ const json1 = require("./json.json"); // No error (bad) >json1 : Symbol(json1, Decl(user.js, 4, 5)) json1.b; // No error (OK since that's the type annotation) ->json1.b : Symbol(b, Decl(user.js, 3, 12)) >json1 : Symbol(json1, Decl(user.js, 4, 5)) ->b : Symbol(b, Decl(user.js, 3, 12)) const js0 = require("./js.js"); >js0 : Symbol(js0, Decl(user.js, 7, 5)) @@ -27,9 +25,7 @@ const js1 = require("./js.js"); // Error (good) >js1 : Symbol(js1, Decl(user.js, 11, 5)) js1.b; ->js1.b : Symbol(b, Decl(user.js, 10, 12)) >js1 : Symbol(js1, Decl(user.js, 11, 5)) ->b : Symbol(b, Decl(user.js, 10, 12)) === /json.json === { "a": 0 } diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff index 99b69ac56e..4a853f1c3a 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff @@ -17,8 +17,9 @@ ->"./json.json" : Symbol("/json", Decl(json.json, 0, 0)) json1.b; // No error (OK since that's the type annotation) - >json1.b : Symbol(b, Decl(user.js, 3, 12)) -@@= skipped -10, +8 lines =@@ +->json1.b : Symbol(b, Decl(user.js, 3, 12)) + >json1 : Symbol(json1, Decl(user.js, 4, 5)) +->b : Symbol(b, Decl(user.js, 3, 12)) const js0 = require("./js.js"); >js0 : Symbol(js0, Decl(user.js, 7, 5)) @@ -27,7 +28,7 @@ json0.b; // Error (good) >json0 : Symbol(json0, Decl(user.js, 0, 5)) -@@= skipped -9, +7 lines =@@ +@@= skipped -19, +13 lines =@@ /** @type {{ b: number }} */ const js1 = require("./js.js"); // Error (good) >js1 : Symbol(js1, Decl(user.js, 11, 5)) @@ -35,8 +36,9 @@ ->"./js.js" : Symbol("/js", Decl(js.js, 0, 0)) js1.b; - >js1.b : Symbol(b, Decl(user.js, 10, 12)) -@@= skipped -10, +8 lines =@@ +->js1.b : Symbol(b, Decl(user.js, 10, 12)) + >js1 : Symbol(js1, Decl(user.js, 11, 5)) +->b : Symbol(b, Decl(user.js, 10, 12)) === /json.json === { "a": 0 } diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt deleted file mode 100644 index 9730b2402e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt +++ /dev/null @@ -1,24 +0,0 @@ -a.js(6,12): error TS2304: Cannot find name 'A'. -a.js(13,12): error TS2304: Cannot find name 'B'. - - -==== a.js (2 errors) ==== - /** - * @typedef {object} A - * @property {number} [value] - */ - - /** @type {A} */ - ~ -!!! error TS2304: Cannot find name 'A'. - const a = { value: undefined }; // error - - /** - * @typedef {{ value?: number }} B - */ - - /** @type {B} */ - ~ -!!! error TS2304: Cannot find name 'B'. - const b = { value: undefined }; // error - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt.diff index 9af09cbf0b..0732681a52 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt.diff @@ -1,39 +1,37 @@ --- old.strictOptionalProperties3.errors.txt +++ new.strictOptionalProperties3.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -a.js(7,7): error TS2375: Type '{ value: undefined; }' is not assignable to type 'A' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. - Types of property 'value' are incompatible. - Type 'undefined' is not assignable to type 'number'. -a.js(14,7): error TS2375: Type '{ value: undefined; }' is not assignable to type 'B' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. - Types of property 'value' are incompatible. - Type 'undefined' is not assignable to type 'number'. -+a.js(6,12): error TS2304: Cannot find name 'A'. -+a.js(13,12): error TS2304: Cannot find name 'B'. - - - ==== a.js (2 errors) ==== -@@= skipped -12, +8 lines =@@ - */ - - /** @type {A} */ -+ ~ -+!!! error TS2304: Cannot find name 'A'. - const a = { value: undefined }; // error +- +- +-==== a.js (2 errors) ==== +- /** +- * @typedef {object} A +- * @property {number} [value] +- */ +- +- /** @type {A} */ +- const a = { value: undefined }; // error - ~ -!!! error TS2375: Type '{ value: undefined; }' is not assignable to type 'A' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. -!!! error TS2375: Types of property 'value' are incompatible. -!!! error TS2375: Type 'undefined' is not assignable to type 'number'. - - /** - * @typedef {{ value?: number }} B - */ - - /** @type {B} */ -+ ~ -+!!! error TS2304: Cannot find name 'B'. - const b = { value: undefined }; // error +- +- /** +- * @typedef {{ value?: number }} B +- */ +- +- /** @type {B} */ +- const b = { value: undefined }; // error - ~ -!!! error TS2375: Type '{ value: undefined; }' is not assignable to type 'B' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. -!!! error TS2375: Types of property 'value' are incompatible. -!!! error TS2375: Type 'undefined' is not assignable to type 'number'. - +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt index e97bdfb5ac..222af3b09f 100644 --- a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt @@ -1,5 +1,3 @@ -file1.js(2,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent'. - Index signature for type 'number' is missing in type 'C'. tile1.ts(2,30): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. tile1.ts(6,81): error TS2744: Type parameter defaults can only reference previously declared type parameters. tile1.ts(11,40): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. @@ -58,10 +56,7 @@ tile1.ts(24,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent ~~~~~ !!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'. !!! error TS2322: Index signature for type 'number' is missing in type 'C'. -==== file1.js (1 errors) ==== +==== file1.js (0 errors) ==== /** @type {ClassComponent} */ const test9 = new C(); - ~~~~~ -!!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'. -!!! error TS2322: Index signature for type 'number' is missing in type 'C'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt.diff new file mode 100644 index 0000000000..13748f7453 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt.diff @@ -0,0 +1,20 @@ +--- old.subclassThisTypeAssignable01.errors.txt ++++ new.subclassThisTypeAssignable01.errors.txt +@@= skipped -0, +0 lines =@@ +-file1.js(2,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent'. +- Index signature for type 'number' is missing in type 'C'. + tile1.ts(2,30): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. + tile1.ts(6,81): error TS2744: Type parameter defaults can only reference previously declared type parameters. + tile1.ts(11,40): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. +@@= skipped -57, +55 lines =@@ + ~~~~~ + !!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'. + !!! error TS2322: Index signature for type 'number' is missing in type 'C'. +-==== file1.js (1 errors) ==== ++==== file1.js (0 errors) ==== + /** @type {ClassComponent} */ + const test9 = new C(); +- ~~~~~ +-!!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'. +-!!! error TS2322: Index signature for type 'number' is missing in type 'C'. + diff --git a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt deleted file mode 100644 index 101171f1ce..0000000000 --- a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt +++ /dev/null @@ -1,47 +0,0 @@ -check.js(9,12): error TS2304: Cannot find name 'Human'. - - -==== check.ts (0 errors) ==== - // https://github.com/microsoft/TypeScript/issues/31972 - interface Person { - first: string; - last: string; - } - - { - const dice = () => Math.floor(Math.random() * 6); - dice.first = 'Rando'; - dice.last = 'Calrissian'; - const diceP: Person = dice; - } - -==== check.js (1 errors) ==== - // Creates a type { first:string, last: string } - /** - * @typedef {Object} Human - creates a new type named 'SpecialType' - * @property {string} first - a string property of SpecialType - * @property {string} last - a number property of SpecialType - */ - - /** - * @param {Human} param used as a validation tool - ~~~~~ -!!! error TS2304: Cannot find name 'Human'. - */ - function doHumanThings(param) {} - - const dice1 = () => Math.floor(Math.random() * 6); - // dice1.first = 'Rando'; - dice1.last = 'Calrissian'; - - // doHumanThings(dice) - - // but inside a block... you can't call a human - { - const dice2 = () => Math.floor(Math.random() * 6); - dice2.first = 'Rando'; - dice2.last = 'Calrissian'; - - doHumanThings(dice2) - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt.diff deleted file mode 100644 index 5eeb6e5256..0000000000 --- a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.errors.txt.diff +++ /dev/null @@ -1,52 +0,0 @@ ---- old.topLevelBlockExpando.errors.txt -+++ new.topLevelBlockExpando.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+check.js(9,12): error TS2304: Cannot find name 'Human'. -+ -+ -+==== check.ts (0 errors) ==== -+ // https://github.com/microsoft/TypeScript/issues/31972 -+ interface Person { -+ first: string; -+ last: string; -+ } -+ -+ { -+ const dice = () => Math.floor(Math.random() * 6); -+ dice.first = 'Rando'; -+ dice.last = 'Calrissian'; -+ const diceP: Person = dice; -+ } -+ -+==== check.js (1 errors) ==== -+ // Creates a type { first:string, last: string } -+ /** -+ * @typedef {Object} Human - creates a new type named 'SpecialType' -+ * @property {string} first - a string property of SpecialType -+ * @property {string} last - a number property of SpecialType -+ */ -+ -+ /** -+ * @param {Human} param used as a validation tool -+ ~~~~~ -+!!! error TS2304: Cannot find name 'Human'. -+ */ -+ function doHumanThings(param) {} -+ -+ const dice1 = () => Math.floor(Math.random() * 6); -+ // dice1.first = 'Rando'; -+ dice1.last = 'Calrissian'; -+ -+ // doHumanThings(dice) -+ -+ // but inside a block... you can't call a human -+ { -+ const dice2 = () => Math.floor(Math.random() * 6); -+ dice2.first = 'Rando'; -+ dice2.last = 'Calrissian'; -+ -+ doHumanThings(dice2) -+ } -+ diff --git a/testdata/baselines/reference/submodule/conformance/ClassAndModuleWithSameNameAndCommonRoot.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/ClassAndModuleWithSameNameAndCommonRoot.errors.txt.diff new file mode 100644 index 0000000000..3870b90265 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/ClassAndModuleWithSameNameAndCommonRoot.errors.txt.diff @@ -0,0 +1,36 @@ +--- old.ClassAndModuleWithSameNameAndCommonRoot.errors.txt ++++ new.ClassAndModuleWithSameNameAndCommonRoot.errors.txt +@@= skipped -0, +0 lines =@@ +-module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. ++module.ts(3,33): error TS2351: This expression is not constructable. ++ Type 'typeof Point' has no construct signatures. ++test.ts(2,16): error TS2339: Property 'Y' does not exist on type 'typeof X'. ++test.ts(3,12): error TS2339: Property 'Y' does not exist on type 'typeof X'. + + + ==== class.ts (0 errors) ==== +@@= skipped -15, +18 lines =@@ + ==== module.ts (1 errors) ==== + module X.Y { + export module Point { +- ~~~~~ +-!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. + export var Origin = new Point(0, 0); ++ ~~~~~ ++!!! error TS2351: This expression is not constructable. ++!!! error TS2351: Type 'typeof Point' has no construct signatures. + } + } + +-==== test.ts (0 errors) ==== ++==== test.ts (2 errors) ==== + //var cl: { x: number; y: number; } + var cl = new X.Y.Point(1,1); ++ ~ ++!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. + var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ? ++ ~ ++!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. + + + ==== simple.ts (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/ClassAndModuleWithSameNameAndCommonRootES6.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/ClassAndModuleWithSameNameAndCommonRootES6.errors.txt.diff new file mode 100644 index 0000000000..c5ed5875eb --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/ClassAndModuleWithSameNameAndCommonRootES6.errors.txt.diff @@ -0,0 +1,36 @@ +--- old.ClassAndModuleWithSameNameAndCommonRootES6.errors.txt ++++ new.ClassAndModuleWithSameNameAndCommonRootES6.errors.txt +@@= skipped -0, +0 lines =@@ +-module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. ++module.ts(3,33): error TS2351: This expression is not constructable. ++ Type 'typeof Point' has no construct signatures. ++test.ts(2,16): error TS2339: Property 'Y' does not exist on type 'typeof X'. ++test.ts(3,12): error TS2339: Property 'Y' does not exist on type 'typeof X'. + + + ==== class.ts (0 errors) ==== +@@= skipped -15, +18 lines =@@ + ==== module.ts (1 errors) ==== + module X.Y { + export module Point { +- ~~~~~ +-!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. + export var Origin = new Point(0, 0); ++ ~~~~~ ++!!! error TS2351: This expression is not constructable. ++!!! error TS2351: Type 'typeof Point' has no construct signatures. + } + } + +-==== test.ts (0 errors) ==== ++==== test.ts (2 errors) ==== + //var cl: { x: number; y: number; } + var cl = new X.Y.Point(1,1); ++ ~ ++!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. + var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ? ++ ~ ++!!! error TS2339: Property 'Y' does not exist on type 'typeof X'. + + + ==== simple.ts (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/ModuleAndClassWithSameNameAndCommonRoot.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/ModuleAndClassWithSameNameAndCommonRoot.errors.txt.diff new file mode 100644 index 0000000000..7e52d4abe7 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/ModuleAndClassWithSameNameAndCommonRoot.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.ModuleAndClassWithSameNameAndCommonRoot.errors.txt ++++ new.ModuleAndClassWithSameNameAndCommonRoot.errors.txt +@@= skipped -0, +0 lines =@@ +-module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. ++module.ts(3,33): error TS2351: This expression is not constructable. ++ Type 'typeof Point' has no construct signatures. + simple.ts(1,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. + simple.ts(2,31): error TS2449: Class 'A' used before its declaration. + +@@= skipped -5, +6 lines =@@ + ==== module.ts (1 errors) ==== + module X.Y { + export module Point { +- ~~~~~ +-!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. + export var Origin = new Point(0, 0); ++ ~~~~~ ++!!! error TS2351: This expression is not constructable. ++!!! error TS2351: Type 'typeof Point' has no construct signatures. + } + } + diff --git a/testdata/baselines/reference/submodule/conformance/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt.diff new file mode 100644 index 0000000000..1961d5d649 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt.diff @@ -0,0 +1,32 @@ +--- old.TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt ++++ new.TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt +@@= skipped -0, +0 lines =@@ + TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(2,18): error TS2300: Duplicate identifier 'Point'. + TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(10,18): error TS2300: Duplicate identifier 'Point'. +-TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(17,18): error TS2300: Duplicate identifier 'Line'. +-TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(26,26): error TS2300: Duplicate identifier 'Line'. + + +-==== TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts (4 errors) ==== ++==== TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts (2 errors) ==== + module A { + export class Point { + ~~~~~ +@@= skipped -25, +23 lines =@@ + + module X.Y.Z { + export class Line { +- ~~~~ +-!!! error TS2300: Duplicate identifier 'Line'. + length: number; + } + } +@@= skipped -11, +9 lines =@@ + export module Z { + // expected error + export class Line { +- ~~~~ +-!!! error TS2300: Duplicate identifier 'Line'. + name: string; + } + } diff --git a/testdata/baselines/reference/submodule/conformance/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.errors.txt b/testdata/baselines/reference/submodule/conformance/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.errors.txt new file mode 100644 index 0000000000..a8a5e12b34 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.errors.txt @@ -0,0 +1,43 @@ +TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts(13,11): error TS2339: Property 'B' does not exist on type 'typeof A'. +TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts(33,12): error TS2694: Namespace 'X.Y' has no exported member 'Z'. + + +==== TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts (2 errors) ==== + module A.B { + export var x: number; + } + + module A{ + module B { + export var x: string; + } + } + + // ensure the right var decl is exported + var x: number; + var x = A.B.x; + ~ +!!! error TS2339: Property 'B' does not exist on type 'typeof A'. + + module X.Y.Z { + export class Line { + length: number; + } + } + + module X { + export module Y { + module Z { + export class Line { + name: string; + } + } + } + } + + // make sure merging works as expected + var l: { length: number }; + var l: X.Y.Z.Line; + ~ +!!! error TS2694: Namespace 'X.Y' has no exported member 'Z'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.errors.txt.diff new file mode 100644 index 0000000000..4697d3288e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.errors.txt.diff @@ -0,0 +1,48 @@ +--- old.TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.errors.txt ++++ new.TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts(13,11): error TS2339: Property 'B' does not exist on type 'typeof A'. ++TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts(33,12): error TS2694: Namespace 'X.Y' has no exported member 'Z'. ++ ++ ++==== TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts (2 errors) ==== ++ module A.B { ++ export var x: number; ++ } ++ ++ module A{ ++ module B { ++ export var x: string; ++ } ++ } ++ ++ // ensure the right var decl is exported ++ var x: number; ++ var x = A.B.x; ++ ~ ++!!! error TS2339: Property 'B' does not exist on type 'typeof A'. ++ ++ module X.Y.Z { ++ export class Line { ++ length: number; ++ } ++ } ++ ++ module X { ++ export module Y { ++ module Z { ++ export class Line { ++ name: string; ++ } ++ } ++ } ++ } ++ ++ // make sure merging works as expected ++ var l: { length: number }; ++ var l: X.Y.Z.Line; ++ ~ ++!!! error TS2694: Namespace 'X.Y' has no exported member 'Z'. ++ diff --git a/testdata/baselines/reference/submodule/conformance/asiPreventsParsingAsNamespace05.errors.txt b/testdata/baselines/reference/submodule/conformance/asiPreventsParsingAsNamespace05.errors.txt new file mode 100644 index 0000000000..ef55e4b6b0 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/asiPreventsParsingAsNamespace05.errors.txt @@ -0,0 +1,15 @@ +asiPreventsParsingAsNamespace05.ts(7,3): error TS2339: Property 'b' does not exist on type 'typeof a'. + + +==== asiPreventsParsingAsNamespace05.ts (1 errors) ==== + let namespace = 10; + namespace a.b { + export let c = 20; + } + + namespace + a.b.c + ~ +!!! error TS2339: Property 'b' does not exist on type 'typeof a'. + { + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/asiPreventsParsingAsNamespace05.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/asiPreventsParsingAsNamespace05.errors.txt.diff new file mode 100644 index 0000000000..a82ea06f2c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/asiPreventsParsingAsNamespace05.errors.txt.diff @@ -0,0 +1,20 @@ +--- old.asiPreventsParsingAsNamespace05.errors.txt ++++ new.asiPreventsParsingAsNamespace05.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++asiPreventsParsingAsNamespace05.ts(7,3): error TS2339: Property 'b' does not exist on type 'typeof a'. ++ ++ ++==== asiPreventsParsingAsNamespace05.ts (1 errors) ==== ++ let namespace = 10; ++ namespace a.b { ++ export let c = 20; ++ } ++ ++ namespace ++ a.b.c ++ ~ ++!!! error TS2339: Property 'b' does not exist on type 'typeof a'. ++ { ++ } diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt deleted file mode 100644 index 9c78b8a6ae..0000000000 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -assertionTypePredicates2.js(10,12): error TS2304: Cannot find name 'A'. -assertionTypePredicates2.js(19,17): error TS2304: Cannot find name 'A'. - - -==== assertionTypePredicates2.js (2 errors) ==== - /** - * @typedef {{ x: number }} A - */ - - /** - * @typedef { A & { y: number } } B - */ - - /** - * @param {A} a - ~ -!!! error TS2304: Cannot find name 'A'. - * @returns { asserts a is B } - */ - const foo = (a) => { - if (/** @type { B } */ (a).y !== 0) throw TypeError(); - return undefined; - }; - - export const main = () => { - /** @type { A } */ - ~ -!!! error TS2304: Cannot find name 'A'. - const a = { x: 1 }; - foo(a); - }; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt.diff deleted file mode 100644 index bb838e0309..0000000000 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt.diff +++ /dev/null @@ -1,37 +0,0 @@ ---- old.assertionTypePredicates2.errors.txt -+++ new.assertionTypePredicates2.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+assertionTypePredicates2.js(10,12): error TS2304: Cannot find name 'A'. -+assertionTypePredicates2.js(19,17): error TS2304: Cannot find name 'A'. -+ -+ -+==== assertionTypePredicates2.js (2 errors) ==== -+ /** -+ * @typedef {{ x: number }} A -+ */ -+ -+ /** -+ * @typedef { A & { y: number } } B -+ */ -+ -+ /** -+ * @param {A} a -+ ~ -+!!! error TS2304: Cannot find name 'A'. -+ * @returns { asserts a is B } -+ */ -+ const foo = (a) => { -+ if (/** @type { B } */ (a).y !== 0) throw TypeError(); -+ return undefined; -+ }; -+ -+ export const main = () => { -+ /** @type { A } */ -+ ~ -+!!! error TS2304: Cannot find name 'A'. -+ const a = { x: 1 }; -+ foo(a); -+ }; -+ diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt deleted file mode 100644 index 9597a4dd6e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt +++ /dev/null @@ -1,72 +0,0 @@ -assertionsAndNonReturningFunctions.js(3,12): error TS2304: Cannot find name 'AssertFunc'. -assertionsAndNonReturningFunctions.js(46,9): error TS7027: Unreachable code detected. -assertionsAndNonReturningFunctions.js(58,5): error TS7027: Unreachable code detected. - - -==== assertionsAndNonReturningFunctions.js (3 errors) ==== - /** @typedef {(check: boolean) => asserts check} AssertFunc */ - - /** @type {AssertFunc} */ - ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'AssertFunc'. - const assert = check => { - if (!check) throw new Error(); - } - - /** @type {(x: unknown) => asserts x is string } */ - function assertIsString(x) { - if (!(typeof x === "string")) throw new Error(); - } - - /** - * @param {boolean} check - * @returns {asserts check} - */ - function assert2(check) { - if (!check) throw new Error(); - } - - /** - * @returns {never} - */ - function fail() { - throw new Error(); - } - - /** - * @param {*} x - */ - function f1(x) { - if (!!true) { - assert(typeof x === "string"); - x.length; - } - if (!!true) { - assert2(typeof x === "string"); - x.length; - } - if (!!true) { - assertIsString(x); - x.length; - } - if (!!true) { - fail(); - x; // Unreachable - ~~ -!!! error TS7027: Unreachable code detected. - } - } - - /** - * @param {boolean} b - */ - function f2(b) { - switch (b) { - case true: return 1; - case false: return 0; - } - b; // Unreachable - ~~ -!!! error TS7027: Unreachable code detected. - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt.diff index 061385a2b6..991af43a91 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt.diff @@ -1,18 +1,74 @@ --- old.assertionsAndNonReturningFunctions.errors.txt +++ new.assertionsAndNonReturningFunctions.errors.txt -@@= skipped -0, +0 lines =@@ -+assertionsAndNonReturningFunctions.js(3,12): error TS2304: Cannot find name 'AssertFunc'. - assertionsAndNonReturningFunctions.js(46,9): error TS7027: Unreachable code detected. - assertionsAndNonReturningFunctions.js(58,5): error TS7027: Unreachable code detected. - - +@@= skipped -0, +-1 lines =@@ +-assertionsAndNonReturningFunctions.js(46,9): error TS7027: Unreachable code detected. +-assertionsAndNonReturningFunctions.js(58,5): error TS7027: Unreachable code detected. +- +- -==== assertionsAndNonReturningFunctions.js (2 errors) ==== -+==== assertionsAndNonReturningFunctions.js (3 errors) ==== - /** @typedef {(check: boolean) => asserts check} AssertFunc */ - - /** @type {AssertFunc} */ -+ ~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'AssertFunc'. - const assert = check => { - if (!check) throw new Error(); - } +- /** @typedef {(check: boolean) => asserts check} AssertFunc */ +- +- /** @type {AssertFunc} */ +- const assert = check => { +- if (!check) throw new Error(); +- } +- +- /** @type {(x: unknown) => asserts x is string } */ +- function assertIsString(x) { +- if (!(typeof x === "string")) throw new Error(); +- } +- +- /** +- * @param {boolean} check +- * @returns {asserts check} +- */ +- function assert2(check) { +- if (!check) throw new Error(); +- } +- +- /** +- * @returns {never} +- */ +- function fail() { +- throw new Error(); +- } +- +- /** +- * @param {*} x +- */ +- function f1(x) { +- if (!!true) { +- assert(typeof x === "string"); +- x.length; +- } +- if (!!true) { +- assert2(typeof x === "string"); +- x.length; +- } +- if (!!true) { +- assertIsString(x); +- x.length; +- } +- if (!!true) { +- fail(); +- x; // Unreachable +- ~~ +-!!! error TS7027: Unreachable code detected. +- } +- } +- +- /** +- * @param {boolean} b +- */ +- function f2(b) { +- switch (b) { +- case true: return 1; +- case false: return 0; +- } +- b; // Unreachable +- ~~ +-!!! error TS7027: Unreachable code detected. +- } +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt deleted file mode 100644 index 6dc5427f14..0000000000 --- a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt +++ /dev/null @@ -1,50 +0,0 @@ -file.js(2,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -file.js(6,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -file.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -file.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? - - -==== file.js (5 errors) ==== - // Error (good) - /** @type {function(): string} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const a = () => 0 - - // Error (good) - /** @type {function(): string} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const b = async () => 0 - - // No error (bad) - /** @type {function(): string} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const c = async () => { - return 0 - } - - // Error (good) - /** @type {function(): string} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const d = async () => { - return "" - } - - /** @type {function(function(): string): void} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const f = (p) => {} - - // Error (good) - f(async () => { - return 0 - }) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt.diff index 0f2415be05..ca701d2045 100644 --- a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt.diff @@ -1,6 +1,6 @@ --- old.asyncArrowFunction_allowJs.errors.txt +++ new.asyncArrowFunction_allowJs.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -file.js(3,17): error TS2322: Type 'number' is not assignable to type 'string'. -file.js(6,24): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -file.js(7,23): error TS2322: Type 'number' is not assignable to type 'string'. @@ -9,69 +9,50 @@ -file.js(16,24): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -file.js(25,3): error TS2345: Argument of type '() => Promise' is not assignable to parameter of type '() => string'. - Type 'Promise' is not assignable to type 'string'. -+file.js(2,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+file.js(6,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+file.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+file.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? - - +- +- -==== file.js (7 errors) ==== -+==== file.js (5 errors) ==== - // Error (good) - /** @type {function(): string} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const a = () => 0 +- // Error (good) +- /** @type {function(): string} */ +- const a = () => 0 - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - - // Error (good) - /** @type {function(): string} */ +- +- // Error (good) +- /** @type {function(): string} */ - ~~~~~~ -!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const b = async () => 0 +- const b = async () => 0 - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - - // No error (bad) - /** @type {function(): string} */ +- +- // No error (bad) +- /** @type {function(): string} */ - ~~~~~~ -!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const c = async () => { - return 0 +- const c = async () => { +- return 0 - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - } - - // Error (good) - /** @type {function(): string} */ +- } +- +- // Error (good) +- /** @type {function(): string} */ - ~~~~~~ -!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const d = async () => { - return "" - } - - /** @type {function(function(): string): void} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const f = (p) => {} - - // Error (good) - f(async () => { +- const d = async () => { +- return "" +- } +- +- /** @type {function(function(): string): void} */ +- const f = (p) => {} +- +- // Error (good) +- f(async () => { - ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '() => Promise' is not assignable to parameter of type '() => string'. -!!! error TS2345: Type 'Promise' is not assignable to type 'string'. - return 0 - }) +- return 0 +- }) +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt deleted file mode 100644 index 18d3c442d6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt +++ /dev/null @@ -1,67 +0,0 @@ -/a.js(21,14): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -/a.js(27,12): error TS2304: Cannot find name 'T1'. -/a.js(40,12): error TS2304: Cannot find name 'T2'. -/a.js(45,12): error TS2304: Cannot find name 'T3'. - - -==== /types.d.ts (0 errors) ==== - declare class Thenable { then(): void; } - -==== /a.js (4 errors) ==== - /** - * @callback T1 - * @param {string} str - * @returns {string} - */ - - /** - * @callback T2 - * @param {string} str - * @returns {Promise} - */ - - /** - * @callback T3 - * @param {string} str - * @returns {Thenable} - */ - - /** - * @param {string} str - * @returns {string} - ~~~~~~ -!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? - */ - const f1 = async str => { - return str; - } - - /** @type {T1} */ - ~~ -!!! error TS2304: Cannot find name 'T1'. - const f2 = async str => { - return str; - } - - /** - * @param {string} str - * @returns {Promise} - */ - const f3 = async str => { - return str; - } - - /** @type {T2} */ - ~~ -!!! error TS2304: Cannot find name 'T2'. - const f4 = async str => { - return str; - } - - /** @type {T3} */ - ~~ -!!! error TS2304: Cannot find name 'T3'. - const f5 = async str => { - return str; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt.diff index febfcff46c..7b01d94509 100644 --- a/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt.diff @@ -1,6 +1,6 @@ --- old.asyncFunctionDeclaration16_es5.errors.txt +++ new.asyncFunctionDeclaration16_es5.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -/a.js(21,14): error TS1055: Type 'string' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -/a.js(27,12): error TS1065: The return type of an async function or method must be the global Promise type. -/a.js(45,12): error TS1065: The return type of an async function or method must be the global Promise type. @@ -8,57 +8,71 @@ - Construct signature return types 'Thenable' and 'PromiseLike' are incompatible. - The types returned by 'then(...)' are incompatible between these types. - Type 'void' is not assignable to type 'PromiseLike'. -+/a.js(21,14): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -+/a.js(27,12): error TS2304: Cannot find name 'T1'. -+/a.js(40,12): error TS2304: Cannot find name 'T2'. -+/a.js(45,12): error TS2304: Cannot find name 'T3'. - - - ==== /types.d.ts (0 errors) ==== - declare class Thenable { then(): void; } - +- +- +-==== /types.d.ts (0 errors) ==== +- declare class Thenable { then(): void; } +- -==== /a.js (3 errors) ==== -+==== /a.js (4 errors) ==== - /** - * @callback T1 - * @param {string} str -@@= skipped -32, +29 lines =@@ - * @param {string} str - * @returns {string} - ~~~~~~ +- /** +- * @callback T1 +- * @param {string} str +- * @returns {string} +- */ +- +- /** +- * @callback T2 +- * @param {string} str +- * @returns {Promise} +- */ +- +- /** +- * @callback T3 +- * @param {string} str +- * @returns {Thenable} +- */ +- +- /** +- * @param {string} str +- * @returns {string} +- ~~~~~~ -!!! error TS1055: Type 'string' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -+!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? - */ - const f1 = async str => { - return str; -@@= skipped -8, +8 lines =@@ - - /** @type {T1} */ - ~~ +- */ +- const f1 = async str => { +- return str; +- } +- +- /** @type {T1} */ +- ~~ -!!! error TS1065: The return type of an async function or method must be the global Promise type. -!!! related TS1055 /a.js:4:14: Type 'string' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -+!!! error TS2304: Cannot find name 'T1'. - const f2 = async str => { - return str; - } -@@= skipped -15, +14 lines =@@ - } - - /** @type {T2} */ -+ ~~ -+!!! error TS2304: Cannot find name 'T2'. - const f4 = async str => { - return str; - } - - /** @type {T3} */ - ~~ +- const f2 = async str => { +- return str; +- } +- +- /** +- * @param {string} str +- * @returns {Promise} +- */ +- const f3 = async str => { +- return str; +- } +- +- /** @type {T2} */ +- const f4 = async str => { +- return str; +- } +- +- /** @type {T3} */ +- ~~ -!!! error TS1065: The return type of an async function or method must be the global Promise type. -!!! error TS1065: Type 'typeof Thenable' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -!!! error TS1065: Construct signature return types 'Thenable' and 'PromiseLike' are incompatible. -!!! error TS1065: The types returned by 'then(...)' are incompatible between these types. -!!! error TS1065: Type 'void' is not assignable to type 'PromiseLike'. -+!!! error TS2304: Cannot find name 'T3'. - const f5 = async str => { - return str; - } +- const f5 = async str => { +- return str; +- } +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt index dbbbe1f34c..2994a55aa7 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt @@ -1,5 +1,4 @@ mod1.js(5,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -use.js(1,20): error TS2306: File 'mod1.js' is not a module. ==== mod1.js (1 errors) ==== @@ -14,10 +13,8 @@ use.js(1,20): error TS2306: File 'mod1.js' is not a module. this.p = 1 } -==== use.js (1 errors) ==== +==== use.js (0 errors) ==== /** @param {import('./mod1').Con} k */ - ~~~~~~~~ -!!! error TS2306: File 'mod1.js' is not a module. function f(k) { if (1 === 2 - 1) { // I guess basic math works! diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt.diff index fc24b46f5c..ac9047c074 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt.diff @@ -4,7 +4,6 @@ - @@= skipped --1, +1 lines =@@ +mod1.js(5,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+use.js(1,20): error TS2306: File 'mod1.js' is not a module. + + +==== mod1.js (1 errors) ==== @@ -19,10 +18,8 @@ + this.p = 1 + } + -+==== use.js (1 errors) ==== ++==== use.js (0 errors) ==== + /** @param {import('./mod1').Con} k */ -+ ~~~~~~~~ -+!!! error TS2306: File 'mod1.js' is not a module. + function f(k) { + if (1 === 2 - 1) { + // I guess basic math works! diff --git a/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt deleted file mode 100644 index 9b0c649c61..0000000000 --- a/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -callbackOnConstructor.js(12,12): error TS2304: Cannot find name 'ValueGetter_2'. - - -==== callbackOnConstructor.js (1 errors) ==== - export class Preferences { - assignability = "no" - /** - * @callback ValueGetter_2 - * @param {string} name - * @returns {boolean|number|string|undefined} - */ - constructor() {} - } - - - /** @type {ValueGetter_2} */ - ~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'ValueGetter_2'. - var ooscope2 = s => s.length > 0 - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt.diff deleted file mode 100644 index df85b5798e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.callbackOnConstructor.errors.txt -+++ new.callbackOnConstructor.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+callbackOnConstructor.js(12,12): error TS2304: Cannot find name 'ValueGetter_2'. -+ -+ -+==== callbackOnConstructor.js (1 errors) ==== -+ export class Preferences { -+ assignability = "no" -+ /** -+ * @callback ValueGetter_2 -+ * @param {string} name -+ * @returns {boolean|number|string|undefined} -+ */ -+ constructor() {} -+ } -+ -+ -+ /** @type {ValueGetter_2} */ -+ ~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'ValueGetter_2'. -+ var ooscope2 = s => s.length > 0 -+ diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt deleted file mode 100644 index 1ef41942a9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -cb.js(7,12): error TS2304: Cannot find name 'Sid'. -cb.js(11,12): error TS2304: Cannot find name 'NoReturn'. - - -==== cb.js (2 errors) ==== - /** @callback Sid - * @param {string} s - * @returns {string} What were you expecting - */ - var x = 1 - - /** @type {Sid} smallId */ - ~~~ -!!! error TS2304: Cannot find name 'Sid'. - var sid = s => s + "!"; - - - /** @type {NoReturn} */ - ~~~~~~~~ -!!! error TS2304: Cannot find name 'NoReturn'. - var noreturn = obj => void obj.title - - /** - * @callback NoReturn - * @param {{ e: number, m: number, title: string }} s - Knee deep, shores, etc - */ - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt.diff deleted file mode 100644 index f7336c1648..0000000000 --- a/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.callbackTag1.errors.txt -+++ new.callbackTag1.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+cb.js(7,12): error TS2304: Cannot find name 'Sid'. -+cb.js(11,12): error TS2304: Cannot find name 'NoReturn'. -+ -+ -+==== cb.js (2 errors) ==== -+ /** @callback Sid -+ * @param {string} s -+ * @returns {string} What were you expecting -+ */ -+ var x = 1 -+ -+ /** @type {Sid} smallId */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Sid'. -+ var sid = s => s + "!"; -+ -+ -+ /** @type {NoReturn} */ -+ ~~~~~~~~ -+!!! error TS2304: Cannot find name 'NoReturn'. -+ var noreturn = obj => void obj.title -+ -+ /** -+ * @callback NoReturn -+ * @param {{ e: number, m: number, title: string }} s - Knee deep, shores, etc -+ */ -+ diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt index a4fdfaa642..2dbccc172d 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt @@ -1,10 +1,7 @@ -cb.js(8,12): error TS2304: Cannot find name 'Id'. cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'. -cb.js(22,12): error TS2304: Cannot find name 'SharedId'. -cb.js(25,12): error TS2304: Cannot find name 'Final'. -==== cb.js (4 errors) ==== +==== cb.js (1 errors) ==== /** @template T * @callback Id * @param {T} t @@ -13,8 +10,6 @@ cb.js(25,12): error TS2304: Cannot find name 'Final'. var x = 1 /** @type {Id} I actually wanted to write `const "120"` */ - ~~ -!!! error TS2304: Cannot find name 'Id'. var one_twenty = s => "120"; /** @template S @@ -31,13 +26,9 @@ cb.js(25,12): error TS2304: Cannot find name 'Final'. } } /** @type {SharedId} */ - ~~~~~~~~ -!!! error TS2304: Cannot find name 'SharedId'. var outside = n => n + 1; /** @type {Final<{ fantasy }, { heroes }>} */ - ~~~~~ -!!! error TS2304: Cannot find name 'Final'. var noreturn = (barts, tidus, noctis) => "cecil" /** diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt.diff index 0ac90a5c99..c58ffc7f0c 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt.diff @@ -2,27 +2,11 @@ +++ new.callbackTag2.errors.txt @@= skipped -0, +0 lines =@@ -cb.js(18,29): error TS2304: Cannot find name 'S'. -+cb.js(8,12): error TS2304: Cannot find name 'Id'. +cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'. -+cb.js(22,12): error TS2304: Cannot find name 'SharedId'. -+cb.js(25,12): error TS2304: Cannot find name 'Final'. --==== cb.js (1 errors) ==== -+==== cb.js (4 errors) ==== - /** @template T - * @callback Id - * @param {T} t -@@= skipped -9, +12 lines =@@ - var x = 1 - - /** @type {Id} I actually wanted to write `const "120"` */ -+ ~~ -+!!! error TS2304: Cannot find name 'Id'. - var one_twenty = s => "120"; - - /** @template S -@@= skipped -10, +12 lines =@@ + ==== cb.js (1 errors) ==== +@@= skipped -19, +19 lines =@@ class SharedClass { constructor() { /** @type {SharedId} */ @@ -34,13 +18,3 @@ } } /** @type {SharedId} */ -+ ~~~~~~~~ -+!!! error TS2304: Cannot find name 'SharedId'. - var outside = n => n + 1; - - /** @type {Final<{ fantasy }, { heroes }>} */ -+ ~~~~~ -+!!! error TS2304: Cannot find name 'Final'. - var noreturn = (barts, tidus, noctis) => "cecil" - - /** diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt deleted file mode 100644 index 0ea6446b4b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -cb.js(4,12): error TS2304: Cannot find name 'Miracle'. - - -==== cb.js (1 errors) ==== - /** @callback Miracle - * @returns {string} What were you expecting - */ - /** @type {Miracle} smallId */ - ~~~~~~~ -!!! error TS2304: Cannot find name 'Miracle'. - var sid = () => "!"; - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt.diff deleted file mode 100644 index 7ab5188958..0000000000 --- a/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.callbackTag3.errors.txt -+++ new.callbackTag3.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+cb.js(4,12): error TS2304: Cannot find name 'Miracle'. -+ -+ -+==== cb.js (1 errors) ==== -+ /** @callback Miracle -+ * @returns {string} What were you expecting -+ */ -+ /** @type {Miracle} smallId */ -+ ~~~~~~~ -+!!! error TS2304: Cannot find name 'Miracle'. -+ var sid = () => "!"; -+ -+ diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt index 654e48ca41..e4e4f3b568 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt @@ -1,10 +1,9 @@ -a.js(9,12): error TS2304: Cannot find name 'C'. a.js(10,22): error TS7006: Parameter 'a' implicitly has an 'any' type. a.js(10,25): error TS7006: Parameter 'b' implicitly has an 'any' type. a.js(11,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -==== a.js (4 errors) ==== +==== a.js (3 errors) ==== /** * @callback C * @this {{ a: string, b: number }} @@ -14,8 +13,6 @@ a.js(11,5): error TS2683: 'this' implicitly has type 'any' because it does not h */ /** @type {C} */ - ~ -!!! error TS2304: Cannot find name 'C'. const cb = function (a, b) { ~ !!! error TS7006: Parameter 'a' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt.diff index 0b07465530..9977dcc3f9 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt.diff @@ -3,13 +3,12 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+a.js(9,12): error TS2304: Cannot find name 'C'. +a.js(10,22): error TS7006: Parameter 'a' implicitly has an 'any' type. +a.js(10,25): error TS7006: Parameter 'b' implicitly has an 'any' type. +a.js(11,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + + -+==== a.js (4 errors) ==== ++==== a.js (3 errors) ==== + /** + * @callback C + * @this {{ a: string, b: number }} @@ -19,8 +18,6 @@ + */ + + /** @type {C} */ -+ ~ -+!!! error TS2304: Cannot find name 'C'. + const cb = function (a, b) { + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt deleted file mode 100644 index fa694a91df..0000000000 --- a/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -cb_nested.js(11,12): error TS2304: Cannot find name 'WorksWithPeopleCallback'. - - -==== cb_nested.js (1 errors) ==== - /** - * @callback WorksWithPeopleCallback - * @param {Object} person - * @param {string} person.name - * @param {number} [person.age] - * @returns {void} - */ - - /** - * For each person, calls your callback. - * @param {WorksWithPeopleCallback} callback - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'WorksWithPeopleCallback'. - * @returns {void} - */ - function eachPerson(callback) { - callback({ name: "Empty" }); - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt.diff deleted file mode 100644 index f6ca9c7ec2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.callbackTagNestedParameter.errors.txt -+++ new.callbackTagNestedParameter.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+cb_nested.js(11,12): error TS2304: Cannot find name 'WorksWithPeopleCallback'. -+ -+ -+==== cb_nested.js (1 errors) ==== -+ /** -+ * @callback WorksWithPeopleCallback -+ * @param {Object} person -+ * @param {string} person.name -+ * @param {number} [person.age] -+ * @returns {void} -+ */ -+ -+ /** -+ * For each person, calls your callback. -+ * @param {WorksWithPeopleCallback} callback -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'WorksWithPeopleCallback'. -+ * @returns {void} -+ */ -+ function eachPerson(callback) { -+ callback({ name: "Empty" }); -+ } -+ diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt deleted file mode 100644 index 79b28e665e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -callbackTagVariadicType.js(7,12): error TS2304: Cannot find name 'Foo'. - - -==== callbackTagVariadicType.js (1 errors) ==== - /** - * @callback Foo - * @param {...string} args - * @returns {number} - */ - - /** @type {Foo} */ - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - export const x = () => 1 - var res = x('a', 'b') - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt.diff deleted file mode 100644 index 329423e0b5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.callbackTagVariadicType.errors.txt -+++ new.callbackTagVariadicType.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+callbackTagVariadicType.js(7,12): error TS2304: Cannot find name 'Foo'. -+ -+ -+==== callbackTagVariadicType.js (1 errors) ==== -+ /** -+ * @callback Foo -+ * @param {...string} args -+ * @returns {number} -+ */ -+ -+ /** @type {Foo} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. -+ export const x = () => 1 -+ var res = x('a', 'b') -+ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt index c5ab204ed8..ab240f6d40 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt @@ -1,18 +1,13 @@ -returns.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. -returns.js(13,5): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. - Type 'boolean' is not assignable to type 'string | number'. returns.js(13,12): error TS2872: This kind of expression is always truthy. -==== returns.js (3 errors) ==== +==== returns.js (1 errors) ==== // @ts-check /** * @returns {string} This comment is not currently exposed */ function f() { return 5; - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. } /** @@ -20,9 +15,6 @@ returns.js(13,12): error TS2872: This kind of expression is always truthy. */ function f1() { return 5 || true; - ~~~~~~ -!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. -!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. ~ !!! error TS2872: This kind of expression is always truthy. } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt.diff new file mode 100644 index 0000000000..d4d9342407 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt.diff @@ -0,0 +1,32 @@ +--- old.checkJsdocReturnTag2.errors.txt ++++ new.checkJsdocReturnTag2.errors.txt +@@= skipped -0, +0 lines =@@ +-returns.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. +-returns.js(13,5): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. +- Type 'boolean' is not assignable to type 'string | number'. + returns.js(13,12): error TS2872: This kind of expression is always truthy. + + +-==== returns.js (3 errors) ==== ++==== returns.js (1 errors) ==== + // @ts-check + /** + * @returns {string} This comment is not currently exposed + */ + function f() { + return 5; +- ~~~~~~ +-!!! error TS2322: Type 'number' is not assignable to type 'string'. + } + + /** +@@= skipped -19, +14 lines =@@ + */ + function f1() { + return 5 || true; +- ~~~~~~ +-!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. +-!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. + ~ + !!! error TS2872: This kind of expression is always truthy. + } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt deleted file mode 100644 index 206a690a68..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt +++ /dev/null @@ -1,38 +0,0 @@ -/a.js(24,12): error TS2304: Cannot find name 'T2'. - - -==== /a.js (1 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 }); - const t3 = /** @satisfies {T1} */ ({}); - - /** @type {T2} */ - ~~ -!!! error TS2304: Cannot find name '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' }); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt.diff index 17cf4face7..ca71ca7073 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.errors.txt.diff @@ -1,40 +1,52 @@ --- old.checkJsdocSatisfiesTag1.errors.txt +++ new.checkJsdocSatisfiesTag1.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -/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(24,12): error TS2304: Cannot find name 'T2'. - - +- +- -==== /a.js (3 errors) ==== -+==== /a.js (1 errors) ==== - /** - * @typedef {Object} T1 - * @property {number} a -@@= skipped -25, +22 lines =@@ - - const t1 = /** @satisfies {T1} */ ({ a: 1 }); - const t2 = /** @satisfies {T1} */ ({ a: 1, b: 1 }); +- /** +- * @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} */ ({}); +- 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} */ -+ ~~ -+!!! error TS2304: Cannot find name 'T2'. - const t4 = /** @satisfies {T2} */ ({ a: "a" }); - - /** @type {(m: string) => string} */ -@@= skipped -16, +12 lines =@@ - const t6 = /** @satisfies {[number, number]} */ ([1, 2]); - const t7 = /** @satisfies {T4} */ ({ a: 'test' }); - const t8 = /** @satisfies {T4} */ ({ a: 'test', b: 'test' }); +- +- /** @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'. - +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols index 6d630c1741..755f6ce45f 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols @@ -43,9 +43,7 @@ const t4 = /** @satisfies {T2} */ ({ a: "a" }); const t5 = /** @satisfies {T3} */((m) => m.substring(0)); >t5 : Symbol(t5, Decl(a.js, 27, 5)) >m : Symbol(m, Decl(a.js, 27, 35)) ->m.substring : Symbol(substring, Decl(lib.es5.d.ts, --, --)) >m : Symbol(m, Decl(a.js, 27, 35)) ->substring : Symbol(substring, Decl(lib.es5.d.ts, --, --)) const t6 = /** @satisfies {[number, number]} */ ([1, 2]); >t6 : Symbol(t6, Decl(a.js, 28, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff index f794869a16..face8ef166 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff @@ -14,10 +14,8 @@ >t5 : Symbol(t5, Decl(a.js, 27, 5)) >m : Symbol(m, Decl(a.js, 27, 35)) ->m.substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --)) -+>m.substring : Symbol(substring, Decl(lib.es5.d.ts, --, --)) >m : Symbol(m, Decl(a.js, 27, 35)) ->substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --)) -+>substring : Symbol(substring, Decl(lib.es5.d.ts, --, --)) const t6 = /** @satisfies {[number, number]} */ ([1, 2]); >t6 : Symbol(t6, Decl(a.js, 28, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt index f41bb7633d..ff2916a9e4 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt @@ -1,11 +1,14 @@ +/a.js(3,7): error TS7006: Parameter 's' implicitly has an 'any' type. /a.js(4,7): error TS7006: Parameter 's' implicitly has an 'any' type. /a.js(8,49): error TS7006: Parameter 'x' implicitly has an 'any' type. -==== /a.js (2 errors) ==== +==== /a.js (3 errors) ==== /** @type {{ f(s: string): void } & Record }} */ let obj = /** @satisfies {{ g(s: string): void } & Record} */ ({ f(s) { }, // "incorrect" implicit any on 's' + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. g(s) { } ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt.diff index 73eaaa76a0..318b609d0d 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt.diff @@ -1,20 +1,21 @@ --- old.checkJsdocSatisfiesTag3.errors.txt +++ new.checkJsdocSatisfiesTag3.errors.txt @@= skipped -0, +0 lines =@@ --/a.js(3,7): error TS7006: Parameter 's' implicitly has an 'any' type. + /a.js(3,7): error TS7006: Parameter 's' implicitly has an 'any' type. +/a.js(4,7): error TS7006: Parameter 's' implicitly has an 'any' type. +/a.js(8,49): error TS7006: Parameter 'x' implicitly has an 'any' type. -==== /a.js (1 errors) ==== -+==== /a.js (2 errors) ==== ++==== /a.js (3 errors) ==== /** @type {{ f(s: string): void } & Record }} */ let obj = /** @satisfies {{ g(s: string): void } & Record} */ ({ f(s) { }, // "incorrect" implicit any on 's' -+ g(s) { } ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. -- g(s) { } + g(s) { } ++ ~ ++!!! error TS7006: Parameter 's' implicitly has an 'any' type. }); // This needs to not crash (outer node is not expression) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt deleted file mode 100644 index 3523f4ecbe..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt +++ /dev/null @@ -1,60 +0,0 @@ -0.js(20,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -0.js(24,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -0.js(28,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -0.js(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. - - -==== 0.js (4 errors) ==== - // @ts-check - /** @type {String} */ - var S = "hello world"; - - /** @type {number} */ - var n = 10; - - /** @type {*} */ - var anyT = 2; - anyT = "hello"; - - /** @type {?} */ - var anyT1 = 2; - anyT1 = "hi"; - - /** @type {Function} */ - const x = (a) => a + 1; - x(1); - - /** @type {function} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const y = (a) => a + 1; - y(1); - - /** @type {function (number)} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const x1 = (a) => a + 1; - x1(0); - - /** @type {function (number): number} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const x2 = (a) => a + 1; - x2(0); - - /** - * @type {object} - */ - var props = {}; - - /** - * @type {Object} - */ - var props = {}; - ~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. -!!! related TS6203 0.js:35:5: 'props' was also declared here. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt.diff index 621cec769f..dab89aba16 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt.diff @@ -1,49 +1,52 @@ --- old.checkJsdocTypeTag1.errors.txt +++ new.checkJsdocTypeTag1.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -0.js(24,12): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -+0.js(20,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+0.js(24,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+0.js(28,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+0.js(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. - - +- +- -==== 0.js (1 errors) ==== -+==== 0.js (4 errors) ==== - // @ts-check - /** @type {String} */ - var S = "hello world"; -@@= skipped -21, +24 lines =@@ - x(1); - - /** @type {function} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const y = (a) => a + 1; - y(1); - - /** @type {function (number)} */ +- // @ts-check +- /** @type {String} */ +- var S = "hello world"; +- +- /** @type {number} */ +- var n = 10; +- +- /** @type {*} */ +- var anyT = 2; +- anyT = "hello"; +- +- /** @type {?} */ +- var anyT1 = 2; +- anyT1 = "hi"; +- +- /** @type {Function} */ +- const x = (a) => a + 1; +- x(1); +- +- /** @type {function} */ +- const y = (a) => a + 1; +- y(1); +- +- /** @type {function (number)} */ - ~~~~~~~~~~~~~~~~~ -!!! error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const x1 = (a) => a + 1; - x1(0); - - /** @type {function (number): number} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const x2 = (a) => a + 1; - x2(0); - -@@= skipped -22, +29 lines =@@ - * @type {Object} - */ - var props = {}; -+ ~~~~~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. -+!!! related TS6203 0.js:35:5: 'props' was also declared here. - +- const x1 = (a) => a + 1; +- x1(0); +- +- /** @type {function (number): number} */ +- const x2 = (a) => a + 1; +- x2(0); +- +- /** +- * @type {object} +- */ +- var props = {}; +- +- /** +- * @type {Object} +- */ +- var props = {}; +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt deleted file mode 100644 index 76933dc06a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt +++ /dev/null @@ -1,50 +0,0 @@ -0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'String'. -0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'. -0.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -0.js(12,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -0.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -0.js(23,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? - - -==== 0.js (6 errors) ==== - // @ts-check - /** @type {String} */ - var S = true; - ~ -!!! error TS2322: Type 'boolean' is not assignable to type 'String'. - - /** @type {number} */ - var n = "hello"; - ~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. - - /** @type {function (number)} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const x1 = (a) => a + 1; - x1("string"); - - /** @type {function (number): number} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const x2 = (a) => a + 1; - - /** @type {string} */ - var a; - a = x2(0); - - /** @type {function (number): number} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const x3 = (a) => a.concat("hi"); - x3(0); - - /** @type {function (number): string} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const x4 = (a) => a + 1; - x4(0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt.diff index a26d98f387..f06ecf6e93 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt.diff @@ -1,71 +1,54 @@ --- old.checkJsdocTypeTag2.errors.txt +++ new.checkJsdocTypeTag2.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'string'. -+0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'String'. - 0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'. +-0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'. -0.js(8,12): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -0.js(10,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -0.js(17,1): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(20,21): error TS2339: Property 'concat' does not exist on type 'number'. -0.js(24,19): error TS2322: Type 'number' is not assignable to type 'string'. -+0.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+0.js(12,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+0.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+0.js(23,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? - - +- +- -==== 0.js (7 errors) ==== -+==== 0.js (6 errors) ==== - // @ts-check - /** @type {String} */ - var S = true; - ~ +- // @ts-check +- /** @type {String} */ +- var S = true; +- ~ -!!! error TS2322: Type 'boolean' is not assignable to type 'string'. -+!!! error TS2322: Type 'boolean' is not assignable to type 'String'. - - /** @type {number} */ - var n = "hello"; -@@= skipped -19, +18 lines =@@ - !!! error TS2322: Type 'string' is not assignable to type 'number'. - - /** @type {function (number)} */ +- +- /** @type {number} */ +- var n = "hello"; +- ~ +-!!! error TS2322: Type 'string' is not assignable to type 'number'. +- +- /** @type {function (number)} */ - ~~~~~~~~~~~~~~~~~ -!!! error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const x1 = (a) => a + 1; - x1("string"); +- const x1 = (a) => a + 1; +- x1("string"); - ~~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - - /** @type {function (number): number} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const x2 = (a) => a + 1; - - /** @type {string} */ - var a; - a = x2(0); +- +- /** @type {function (number): number} */ +- const x2 = (a) => a + 1; +- +- /** @type {string} */ +- var a; +- a = x2(0); - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - - /** @type {function (number): number} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const x3 = (a) => a.concat("hi"); +- +- /** @type {function (number): number} */ +- const x3 = (a) => a.concat("hi"); - ~~~~~~ -!!! error TS2339: Property 'concat' does not exist on type 'number'. - x3(0); - - /** @type {function (number): string} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - const x4 = (a) => a + 1; +- x3(0); +- +- /** @type {function (number): string} */ +- const x4 = (a) => a + 1; - ~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - x4(0); +- x4(0); +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt deleted file mode 100644 index e242e52f52..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -test.js(7,12): error TS2304: Cannot find name 'B'. - - -==== t.d.ts (0 errors) ==== - type A = { a: T } - -==== test.js (1 errors) ==== - /** Also should error for jsdoc typedefs - * @template {string} U - * @typedef {{ b: U }} B - */ - /** @type {A} */ - var a; - /** @type {B} */ - ~ -!!! error TS2304: Cannot find name 'B'. - var b; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt.diff index bf4140ef7f..ffefc22db0 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt.diff @@ -1,28 +1,26 @@ --- old.checkJsdocTypeTag4.errors.txt +++ new.checkJsdocTypeTag4.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -test.js(5,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. -test.js(7,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. -+test.js(7,12): error TS2304: Cannot find name 'B'. - - - ==== t.d.ts (0 errors) ==== - type A = { a: T } - +- +- +-==== t.d.ts (0 errors) ==== +- type A = { a: T } +- -==== test.js (2 errors) ==== -+==== test.js (1 errors) ==== - /** Also should error for jsdoc typedefs - * @template {string} U - * @typedef {{ b: U }} B - */ - /** @type {A} */ +- /** Also should error for jsdoc typedefs +- * @template {string} U +- * @typedef {{ b: U }} B +- */ +- /** @type {A} */ - ~~~~~~ -!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. - var a; - /** @type {B} */ +- var a; +- /** @type {B} */ - ~~~~~~ -!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. -+ ~ -+!!! error TS2304: Cannot find name 'B'. - var b; - +- var b; +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt deleted file mode 100644 index 285e2ac7c4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt +++ /dev/null @@ -1,64 +0,0 @@ -test.js(5,14): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(7,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. - Type 'number' is not assignable to type 'string'. -test.js(12,14): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(14,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. - Type 'number' is not assignable to type 'string'. -test.js(24,5): error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'. -test.js(34,5): error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. - Type '1' is not assignable to type '2 | 3'. - - -==== test.js (6 errors) ==== - // all 6 should error on return statement/expression - /** @type {(x: number) => string} */ - function h(x) { return x } - /** @type {(x: number) => string} */ - var f = x => x - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -!!! related TS6502 test.js:4:12: The expected type comes from the return type of this signature. - /** @type {(x: number) => string} */ - var g = function (x) { return x } - ~ -!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. -!!! error TS2322: Type 'number' is not assignable to type 'string'. - - /** @type {{ (x: number): string }} */ - function i(x) { return x } - /** @type {{ (x: number): string }} */ - var j = x => x - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -!!! related TS6502 test.js:11:12: The expected type comes from the return type of this signature. - /** @type {{ (x: number): string }} */ - var k = function (x) { return x } - ~ -!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. -!!! error TS2322: Type 'number' is not assignable to type 'string'. - - - /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ - /** @type {Argle} */ - function blargle(s) { - return 0; - } - - /** @type {0 | 1 | 2} - assignment should not error */ - var zeroonetwo = blargle('hi') - ~~~~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'. - - /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ - - /** @type {Gioconda} */ - function monaLisa(sb) { - return typeof sb === 'string' ? 1 : 2; - } - - /** @type {2 | 3} - overloads are not supported, so there will be an error */ - var twothree = monaLisa(false); - ~~~~~~~~ -!!! error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. -!!! error TS2322: Type '1' is not assignable to type '2 | 3'. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt.diff index aadaba2498..ef88515543 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt.diff @@ -1,73 +1,69 @@ --- old.checkJsdocTypeTag5.errors.txt +++ new.checkJsdocTypeTag5.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -test.js(3,17): error TS2322: Type 'number' is not assignable to type 'string'. - test.js(5,14): error TS2322: Type 'number' is not assignable to type 'string'. +-test.js(5,14): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(7,24): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(10,17): error TS2322: Type 'number' is not assignable to type 'string'. -+test.js(7,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. -+ Type 'number' is not assignable to type 'string'. - test.js(12,14): error TS2322: Type 'number' is not assignable to type 'string'. +-test.js(12,14): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(14,24): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(28,12): error TS8030: The type of a function declaration must match the function's signature. -+test.js(14,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. -+ Type 'number' is not assignable to type 'string'. -+test.js(24,5): error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'. - test.js(34,5): error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. - Type '1' is not assignable to type '2 | 3'. - - +-test.js(34,5): error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. +- Type '1' is not assignable to type '2 | 3'. +- +- -==== test.js (8 errors) ==== -+==== test.js (6 errors) ==== - // all 6 should error on return statement/expression - /** @type {(x: number) => string} */ - function h(x) { return x } +- // all 6 should error on return statement/expression +- /** @type {(x: number) => string} */ +- function h(x) { return x } - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - /** @type {(x: number) => string} */ - var f = x => x - ~ - !!! error TS2322: Type 'number' is not assignable to type 'string'. -+!!! related TS6502 test.js:4:12: The expected type comes from the return type of this signature. - /** @type {(x: number) => string} */ - var g = function (x) { return x } +- /** @type {(x: number) => string} */ +- var f = x => x +- ~ +-!!! error TS2322: Type 'number' is not assignable to type 'string'. +- /** @type {(x: number) => string} */ +- var g = function (x) { return x } - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -+ ~ -+!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. -+!!! error TS2322: Type 'number' is not assignable to type 'string'. - - /** @type {{ (x: number): string }} */ - function i(x) { return x } +- +- /** @type {{ (x: number): string }} */ +- function i(x) { return x } - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - /** @type {{ (x: number): string }} */ - var j = x => x - ~ - !!! error TS2322: Type 'number' is not assignable to type 'string'. -+!!! related TS6502 test.js:11:12: The expected type comes from the return type of this signature. - /** @type {{ (x: number): string }} */ - var k = function (x) { return x } +- /** @type {{ (x: number): string }} */ +- var j = x => x +- ~ +-!!! error TS2322: Type 'number' is not assignable to type 'string'. +- /** @type {{ (x: number): string }} */ +- var k = function (x) { return x } - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -+ ~ -+!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. -+!!! error TS2322: Type 'number' is not assignable to type 'string'. - - - /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ -@@= skipped -45, +45 lines =@@ - - /** @type {0 | 1 | 2} - assignment should not error */ - var zeroonetwo = blargle('hi') -+ ~~~~~~~~~~ -+!!! error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'. - - /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ - - /** @type {Gioconda} */ +- +- +- /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ +- /** @type {Argle} */ +- function blargle(s) { +- return 0; +- } +- +- /** @type {0 | 1 | 2} - assignment should not error */ +- var zeroonetwo = blargle('hi') +- +- /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ +- +- /** @type {Gioconda} */ - ~~~~~~~~ -!!! error TS8030: The type of a function declaration must match the function's signature. - function monaLisa(sb) { - return typeof sb === 'string' ? 1 : 2; - } +- function monaLisa(sb) { +- return typeof sb === 'string' ? 1 : 2; +- } +- +- /** @type {2 | 3} - overloads are not supported, so there will be an error */ +- var twothree = monaLisa(false); +- ~~~~~~~~ +-!!! error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. +-!!! error TS2322: Type '1' is not assignable to type '2 | 3'. +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt deleted file mode 100644 index 34a62935d5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt +++ /dev/null @@ -1,52 +0,0 @@ -test.js(7,5): error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. -test.js(27,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. - Target signature provides too few arguments. Expected 1 or more, but got 0. -test.js(30,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. - Target signature provides too few arguments. Expected 1 or more, but got 0. - - -==== test.js (3 errors) ==== - /** @type {number} */ - function f() { - return 1 - } - - /** @type {{ prop: string }} */ - var g = function (prop) { - ~ -!!! error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. - } - - /** @type {(a: number) => number} */ - function add1(a, b) { return a + b; } - - /** @type {(a: number, b: number) => number} */ - function add2(a, b) { return a + b; } - - // TODO: Should be an error since signature doesn't match. - /** @type {(a: number, b: number, c: number) => number} */ - function add3(a, b) { return a + b; } - - // Confirm initializers are compatible. - // They can't have more parameters than the type/context. - - /** @type {() => void} */ - function funcWithMoreParameters(more) {} // error - - /** @type {() => void} */ - const variableWithMoreParameters = function (more) {}; // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. -!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. - - /** @type {() => void} */ - const arrowWithMoreParameters = (more) => {}; // error - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. -!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. - - ({ - /** @type {() => void} */ - methodWithMoreParameters(more) {}, // error - }); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt.diff index 13763ae1a4..dc81be50ce 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt.diff @@ -1,50 +1,71 @@ --- old.checkJsdocTypeTag6.errors.txt +++ new.checkJsdocTypeTag6.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -test.js(1,12): error TS8030: The type of a function declaration must match the function's signature. - test.js(7,5): error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. +-test.js(7,5): error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. -test.js(10,12): error TS8030: The type of a function declaration must match the function's signature. -test.js(23,12): error TS8030: The type of a function declaration must match the function's signature. - test.js(27,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. - Target signature provides too few arguments. Expected 1 or more, but got 0. - test.js(30,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. - Target signature provides too few arguments. Expected 1 or more, but got 0. +-test.js(27,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. +- Target signature provides too few arguments. Expected 1 or more, but got 0. +-test.js(30,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. +- Target signature provides too few arguments. Expected 1 or more, but got 0. -test.js(34,3): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. - Target signature provides too few arguments. Expected 1 or more, but got 0. - - +- +- -==== test.js (7 errors) ==== -+==== test.js (3 errors) ==== - /** @type {number} */ +- /** @type {number} */ - ~~~~~~ -!!! error TS8030: The type of a function declaration must match the function's signature. - function f() { - return 1 - } -@@= skipped -24, +17 lines =@@ - } - - /** @type {(a: number) => number} */ +- function f() { +- return 1 +- } +- +- /** @type {{ prop: string }} */ +- var g = function (prop) { +- ~ +-!!! error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. +- } +- +- /** @type {(a: number) => number} */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8030: The type of a function declaration must match the function's signature. - function add1(a, b) { return a + b; } - - /** @type {(a: number, b: number) => number} */ -@@= skipped -15, +13 lines =@@ - // They can't have more parameters than the type/context. - - /** @type {() => void} */ +- function add1(a, b) { return a + b; } +- +- /** @type {(a: number, b: number) => number} */ +- function add2(a, b) { return a + b; } +- +- // TODO: Should be an error since signature doesn't match. +- /** @type {(a: number, b: number, c: number) => number} */ +- function add3(a, b) { return a + b; } +- +- // Confirm initializers are compatible. +- // They can't have more parameters than the type/context. +- +- /** @type {() => void} */ - ~~~~~~~~~~ -!!! error TS8030: The type of a function declaration must match the function's signature. - function funcWithMoreParameters(more) {} // error - - /** @type {() => void} */ -@@= skipped -19, +17 lines =@@ - ({ - /** @type {() => void} */ - methodWithMoreParameters(more) {}, // error +- function funcWithMoreParameters(more) {} // error +- +- /** @type {() => void} */ +- const variableWithMoreParameters = function (more) {}; // error +- ~~~~~~~~~~~~~~~~~~~~~~~~~~ +-!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. +-!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. +- +- /** @type {() => void} */ +- const arrowWithMoreParameters = (more) => {}; // error +- ~~~~~~~~~~~~~~~~~~~~~~~ +-!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. +-!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. +- +- ({ +- /** @type {() => void} */ +- methodWithMoreParameters(more) {}, // error - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. -!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. - }); - +- }); +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt deleted file mode 100644 index 35c7d11f52..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -0.js(16,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? - - -==== 0.js (1 errors) ==== - // @ts-check - var lol = "hello Lol" - const obj = { - /** @type {string|undefined} */ - foo: undefined, - /** @type {string|undefined} */ - bar: "42", - /** @type {function(number): number} */ - method1(n1) { - return n1 + 42; - }, - /** @type {string} */ - lol, - /** @type {number} */ - ['b' + 'ar1']: 42, - /** @type {function(number): number} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - arrowFunc: (num) => num + 42 - } - obj.foo = 'string' - obj.lol - obj.bar = undefined; - var k = obj.method1(0); - obj.bar1 = "42"; - obj.arrowFunc(0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff deleted file mode 100644 index 7aa3c6a048..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.checkJsdocTypeTagOnObjectProperty1.errors.txt -+++ new.checkJsdocTypeTagOnObjectProperty1.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+0.js(16,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+ -+ -+==== 0.js (1 errors) ==== -+ // @ts-check -+ var lol = "hello Lol" -+ const obj = { -+ /** @type {string|undefined} */ -+ foo: undefined, -+ /** @type {string|undefined} */ -+ bar: "42", -+ /** @type {function(number): number} */ -+ method1(n1) { -+ return n1 + 42; -+ }, -+ /** @type {string} */ -+ lol, -+ /** @type {number} */ -+ ['b' + 'ar1']: 42, -+ /** @type {function(number): number} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. -+ arrowFunc: (num) => num + 42 -+ } -+ obj.foo = 'string' -+ obj.lol -+ obj.bar = undefined; -+ var k = obj.method1(0); -+ obj.bar1 = "42"; -+ obj.arrowFunc(0); diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt deleted file mode 100644 index 210047f7bf..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt +++ /dev/null @@ -1,36 +0,0 @@ -0.js(4,14): error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. -0.js(10,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -0.js(12,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? - - -==== 0.js (3 errors) ==== - // @ts-check - var lol; - const obj = { - /** @type {string|undefined} */ - ~~~~~~~~~~~~~~~~ -!!! error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. - bar: 42, - /** @type {function(number): number} */ - method1(n1) { - return "42"; - }, - /** @type {function(number): number} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - method2: (n1) => "lol", - /** @type {function(number): number} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - arrowFunc: (num="0") => num + 42, - /** @type {string} */ - lol - } - lol = "string" - /** @type {string} */ - var s = obj.method1(0); - - /** @type {string} */ - var s1 = obj.method2("0"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff index b889b4f92c..015876ca90 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff @@ -1,6 +1,6 @@ --- old.checkJsdocTypeTagOnObjectProperty2.errors.txt +++ new.checkJsdocTypeTagOnObjectProperty2.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -0.js(5,3): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(8,7): error TS2322: Type 'string' is not assignable to type 'number'. -0.js(11,20): error TS2322: Type 'string' is not assignable to type 'number'. @@ -9,56 +9,46 @@ -0.js(19,5): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(22,5): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(22,22): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -+0.js(4,14): error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. -+0.js(10,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+0.js(12,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? - - +- +- -==== 0.js (8 errors) ==== -+==== 0.js (3 errors) ==== - // @ts-check - var lol; - const obj = { - /** @type {string|undefined} */ -+ ~~~~~~~~~~~~~~~~ -+!!! error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. - bar: 42, +- // @ts-check +- var lol; +- const obj = { +- /** @type {string|undefined} */ +- bar: 42, - ~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - /** @type {function(number): number} */ - method1(n1) { - return "42"; +- /** @type {function(number): number} */ +- method1(n1) { +- return "42"; - ~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. - }, - /** @type {function(number): number} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - method2: (n1) => "lol", +- }, +- /** @type {function(number): number} */ +- method2: (n1) => "lol", - ~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. - /** @type {function(number): number} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - arrowFunc: (num="0") => num + 42, +- /** @type {function(number): number} */ +- arrowFunc: (num="0") => num + 42, - ~~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. - /** @type {string} */ - lol +- /** @type {string} */ +- lol - ~~~ -!!! error TS2322: Type 'undefined' is not assignable to type 'string'. - } - lol = "string" - /** @type {string} */ - var s = obj.method1(0); +- } +- lol = "string" +- /** @type {string} */ +- var s = obj.method1(0); - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - - /** @type {string} */ - var s1 = obj.method2("0"); +- +- /** @type {string} */ +- var s1 = obj.method2("0"); - ~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - ~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt deleted file mode 100644 index 6667ba8172..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt +++ /dev/null @@ -1,55 +0,0 @@ -0.js(9,12): error TS2304: Cannot find name 'Opts'. -0.js(22,12): error TS2304: Cannot find name 'AnotherOpts'. -0.js(37,12): error TS2304: Cannot find name 'Opts1'. - - -==== 0.js (3 errors) ==== - // @ts-check - /** - * @typedef {Object} Opts - * @property {string} x - * @property {string=} y - * @property {string} [z] - * @property {string} [w="hi"] - * - * @param {Opts} opts - ~~~~ -!!! error TS2304: Cannot find name 'Opts'. - */ - function foo(opts) { - opts.x; - } - - foo({x: 'abc'}); - - /** - * @typedef {Object} AnotherOpts - * @property anotherX {string} - * @property anotherY {string=} - * - * @param {AnotherOpts} opts - ~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'AnotherOpts'. - */ - function foo1(opts) { - opts.anotherX; - } - - foo1({anotherX: "world"}); - - /** - * @typedef {object} Opts1 - * @property {string} x - * @property {string=} y - * @property {string} [z] - * @property {string} [w="hi"] - * - * @param {Opts1} opts - ~~~~~ -!!! error TS2304: Cannot find name 'Opts1'. - */ - function foo2(opts) { - opts.x; - } - foo2({x: 'abc'}); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff deleted file mode 100644 index 79407aac3d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.checkJsdocTypedefInParamTag1.errors.txt -+++ new.checkJsdocTypedefInParamTag1.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+0.js(9,12): error TS2304: Cannot find name 'Opts'. -+0.js(22,12): error TS2304: Cannot find name 'AnotherOpts'. -+0.js(37,12): error TS2304: Cannot find name 'Opts1'. -+ -+ -+==== 0.js (3 errors) ==== -+ // @ts-check -+ /** -+ * @typedef {Object} Opts -+ * @property {string} x -+ * @property {string=} y -+ * @property {string} [z] -+ * @property {string} [w="hi"] -+ * -+ * @param {Opts} opts -+ ~~~~ -+!!! error TS2304: Cannot find name 'Opts'. -+ */ -+ function foo(opts) { -+ opts.x; -+ } -+ -+ foo({x: 'abc'}); -+ -+ /** -+ * @typedef {Object} AnotherOpts -+ * @property anotherX {string} -+ * @property anotherY {string=} -+ * -+ * @param {AnotherOpts} opts -+ ~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'AnotherOpts'. -+ */ -+ function foo1(opts) { -+ opts.anotherX; -+ } -+ -+ foo1({anotherX: "world"}); -+ -+ /** -+ * @typedef {object} Opts1 -+ * @property {string} x -+ * @property {string=} y -+ * @property {string} [z] -+ * @property {string} [w="hi"] -+ * -+ * @param {Opts1} opts -+ ~~~~~ -+!!! error TS2304: Cannot find name 'Opts1'. -+ */ -+ function foo2(opts) { -+ opts.x; -+ } -+ foo2({x: 'abc'}); -+ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt index 7cb22b9170..719537df87 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt @@ -1,9 +1,8 @@ 0.js(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. 0.js(8,9): error TS2339: Property 'SomeName' does not exist on type '{}'. -0.js(10,12): error TS2503: Cannot find namespace 'exports'. -==== 0.js (3 errors) ==== +==== 0.js (2 errors) ==== // @ts-check var exports = {}; @@ -18,7 +17,5 @@ !!! error TS2339: Property 'SomeName' does not exist on type '{}'. /** @type {exports.SomeName} */ - ~~~~~~~ -!!! error TS2503: Cannot find namespace 'exports'. const myString = 'str'; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff index 363f19a91b..74d01ceb26 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff @@ -4,11 +4,10 @@ -0.js(10,20): error TS2694: Namespace 'exports' has no exported member 'SomeName'. +0.js(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. +0.js(8,9): error TS2339: Property 'SomeName' does not exist on type '{}'. -+0.js(10,12): error TS2503: Cannot find namespace 'exports'. -==== 0.js (1 errors) ==== -+==== 0.js (3 errors) ==== ++==== 0.js (2 errors) ==== // @ts-check var exports = {}; @@ -25,7 +24,5 @@ /** @type {exports.SomeName} */ - ~~~~~~~~ -!!! error TS2694: Namespace 'exports' has no exported member 'SomeName'. -+ ~~~~~~~ -+!!! error TS2503: Cannot find namespace 'exports'. const myString = 'str'; diff --git a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt index f2698865d7..9e51e0e0f0 100644 --- a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt @@ -1,9 +1,7 @@ bug24252.js(2,3): error TS2339: Property 'B' does not exist on type '{}'. -bug24252.js(8,9): error TS2322: Type 'string[]' is not assignable to type 'number[]'. - Type 'string' is not assignable to type 'number'. -==== bug24252.js (2 errors) ==== +==== bug24252.js (1 errors) ==== var A = {}; A.B = class { ~ @@ -14,9 +12,6 @@ bug24252.js(8,9): error TS2322: Type 'string[]' is not assignable to type 'numbe /** @type {number[]} */ var y; y = x; - ~ -!!! error TS2322: Type 'string[]' is not assignable to type 'number[]'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. } }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt.diff index 9788eb2be5..ca5f8336d5 100644 --- a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt.diff @@ -1,13 +1,12 @@ --- old.checkSpecialPropertyAssignments.errors.txt +++ new.checkSpecialPropertyAssignments.errors.txt @@= skipped -0, +0 lines =@@ +-bug24252.js(8,9): error TS2322: Type 'string[]' is not assignable to type 'number[]'. +- Type 'string' is not assignable to type 'number'. +bug24252.js(2,3): error TS2339: Property 'B' does not exist on type '{}'. - bug24252.js(8,9): error TS2322: Type 'string[]' is not assignable to type 'number[]'. - Type 'string' is not assignable to type 'number'. --==== bug24252.js (1 errors) ==== -+==== bug24252.js (2 errors) ==== + ==== bug24252.js (1 errors) ==== var A = {}; A.B = class { + ~ @@ -15,3 +14,12 @@ m() { /** @type {string[]} */ var x = []; + /** @type {number[]} */ + var y; + y = x; +- ~ +-!!! error TS2322: Type 'string[]' is not assignable to type 'number[]'. +-!!! error TS2322: Type 'string' is not assignable to type 'number'. + } + }; + diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt index 9168ba5e40..212636b13a 100644 --- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt @@ -1,16 +1,15 @@ -first.js(21,19): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. +first.js(21,19): error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. first.js(24,14): error TS2339: Property 'foonly' does not exist on type 'Sql'. first.js(44,4): error TS2339: Property 'numberOxen' does not exist on type 'Sql'. first.js(44,20): error TS2339: Property 'foonly' does not exist on type 'Sql'. first.js(47,24): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. -generic.js(3,12): error TS2304: Cannot find name 'T'. -generic.js(9,23): error TS2507: Type '(flavour: T) => void' is not a constructor function type. +generic.js(9,23): error TS2507: Type '(flavour: any) => void' is not a constructor function type. generic.js(11,21): error TS2339: Property 'flavour' does not exist on type 'Chowder'. generic.js(17,27): error TS2554: Expected 0 arguments, but got 1. generic.js(18,9): error TS2339: Property 'flavour' does not exist on type 'Chowder'. generic.js(20,32): error TS2554: Expected 0 arguments, but got 1. second.ts(8,25): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. -second.ts(14,25): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. +second.ts(14,25): error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Conestoga'. @@ -37,7 +36,7 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con // ok class Sql extends Wagon { ~~~~~ -!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. +!!! error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. constructor() { super(); // error: not enough arguments this.foonly = 12 @@ -93,7 +92,7 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con // ok class Conestoga extends Wagon { ~~~~~ -!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. +!!! error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. constructor(public drunkOO: true) { // error: wrong type super('nope'); @@ -109,12 +108,10 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con ~~~~~~~~~~ !!! error TS2339: Property 'numberOxen' does not exist on type 'Conestoga'. -==== generic.js (6 errors) ==== +==== generic.js (5 errors) ==== /** * @template T * @param {T} flavour - ~ -!!! error TS2304: Cannot find name 'T'. */ function Soup(flavour) { this.flavour = flavour @@ -122,7 +119,7 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con /** @extends {Soup<{ claim: "ignorant" | "malicious" }>} */ class Chowder extends Soup { ~~~~ -!!! error TS2507: Type '(flavour: T) => void' is not a constructor function type. +!!! error TS2507: Type '(flavour: any) => void' is not a constructor function type. log() { return this.flavour ~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt.diff index 857faf1608..183cf7367f 100644 --- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt.diff @@ -5,15 +5,14 @@ -first.js(31,5): error TS2416: Property 'load' in type 'Sql' is not assignable to the same property in base type 'Wagon'. - Type '(files: string[], format: "csv" | "json" | "xmlolololol") => void' is not assignable to type '(supplies?: any[]) => void'. - Target signature provides too few arguments. Expected 2 or more, but got 1. -+first.js(21,19): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. ++first.js(21,19): error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. +first.js(24,14): error TS2339: Property 'foonly' does not exist on type 'Sql'. +first.js(44,4): error TS2339: Property 'numberOxen' does not exist on type 'Sql'. +first.js(44,20): error TS2339: Property 'foonly' does not exist on type 'Sql'. first.js(47,24): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. -generic.js(19,19): error TS2554: Expected 1 arguments, but got 0. -generic.js(20,32): error TS2345: Argument of type 'number' is not assignable to parameter of type '{ claim: "ignorant" | "malicious"; }'. -+generic.js(3,12): error TS2304: Cannot find name 'T'. -+generic.js(9,23): error TS2507: Type '(flavour: T) => void' is not a constructor function type. ++generic.js(9,23): error TS2507: Type '(flavour: any) => void' is not a constructor function type. +generic.js(11,21): error TS2339: Property 'flavour' does not exist on type 'Chowder'. +generic.js(17,27): error TS2554: Expected 0 arguments, but got 1. +generic.js(18,9): error TS2339: Property 'flavour' does not exist on type 'Chowder'. @@ -26,7 +25,7 @@ - Type 'Wagon[]' is not assignable to type '(typeof Wagon)[]'. - Property 'circle' is missing in type 'Wagon' but required in type 'typeof Wagon'. -second.ts(17,15): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -+second.ts(14,25): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. ++second.ts(14,25): error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. +second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Conestoga'. @@ -35,12 +34,12 @@ /** * @constructor * @param {number} numberOxen -@@= skipped -36, +35 lines =@@ +@@= skipped -36, +34 lines =@@ } // ok class Sql extends Wagon { + ~~~~~ -+!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. ++!!! error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. constructor() { super(); // error: not enough arguments - ~~~~~ @@ -87,7 +86,7 @@ -!!! error TS2417: Property 'circle' is missing in type 'Wagon' but required in type 'typeof Wagon'. -!!! related TS2728 first.js:9:1: 'circle' is declared here. + ~~~~~ -+!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. ++!!! error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. constructor(public drunkOO: true) { // error: wrong type super('nope'); @@ -104,20 +103,16 @@ +!!! error TS2339: Property 'numberOxen' does not exist on type 'Conestoga'. -==== generic.js (2 errors) ==== -+==== generic.js (6 errors) ==== ++==== generic.js (5 errors) ==== /** * @template T * @param {T} flavour -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - function Soup(flavour) { - this.flavour = flavour +@@= skipped -11, +13 lines =@@ } /** @extends {Soup<{ claim: "ignorant" | "malicious" }>} */ class Chowder extends Soup { + ~~~~ -+!!! error TS2507: Type '(flavour: T) => void' is not a constructor function type. ++!!! error TS2507: Type '(flavour: any) => void' is not a constructor function type. log() { return this.flavour + ~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt index 04d5cfd894..d5df7b8226 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt @@ -1,11 +1,10 @@ main.js(1,9): error TS2451: Cannot redeclare block-scoped variable 'K'. main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? mod1.js(1,7): error TS2451: Cannot redeclare block-scoped variable 'K'. mod1.js(6,1): error TS2304: Cannot find name 'exports'. -==== main.js (3 errors) ==== +==== main.js (2 errors) ==== const { K } = require("./mod1"); ~ !!! error TS2451: Cannot redeclare block-scoped variable 'K'. @@ -13,8 +12,6 @@ mod1.js(6,1): error TS2304: Cannot find name 'exports'. ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @param {K} k */ - ~ -!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? function f(k) { k.values() } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt.diff index d2f2ce6611..a3879ab8a8 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt.diff @@ -5,12 +5,11 @@ @@= skipped --1, +1 lines =@@ +main.js(1,9): error TS2451: Cannot redeclare block-scoped variable 'K'. +main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? +mod1.js(1,7): error TS2451: Cannot redeclare block-scoped variable 'K'. +mod1.js(6,1): error TS2304: Cannot find name 'exports'. + + -+==== main.js (3 errors) ==== ++==== main.js (2 errors) ==== + const { K } = require("./mod1"); + ~ +!!! error TS2451: Cannot redeclare block-scoped variable 'K'. @@ -18,8 +17,6 @@ + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @param {K} k */ -+ ~ -+!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? + function f(k) { + k.values() + } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt index eb50cc5891..d50a8f4124 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt @@ -1,15 +1,12 @@ main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? mod1.js(1,1): error TS2304: Cannot find name 'exports'. -==== main.js (2 errors) ==== +==== main.js (1 errors) ==== const { K } = require("./mod1"); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @param {K} k */ - ~ -!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? function f(k) { k.values() } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt.diff index bf8c296755..42ae2e59b2 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt.diff @@ -4,17 +4,14 @@ - @@= skipped --1, +1 lines =@@ +main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? +mod1.js(1,1): error TS2304: Cannot find name 'exports'. + + -+==== main.js (2 errors) ==== ++==== main.js (1 errors) ==== + const { K } = require("./mod1"); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @param {K} k */ -+ ~ -+!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? + function f(k) { + k.values() + } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt index 0444e83a7f..4276b855f5 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt @@ -1,18 +1,15 @@ main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? mod1.js(2,4): error TS2339: Property 'K' does not exist on type '{}'. mod1.js(4,23): error TS2339: Property 'K' does not exist on type '{}'. mod1.js(7,1): error TS2304: Cannot find name 'exports'. mod1.js(7,16): error TS2339: Property 'K' does not exist on type '{}'. -==== main.js (2 errors) ==== +==== main.js (1 errors) ==== const { K } = require("./mod1"); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @param {K} k */ - ~ -!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? function f(k) { k.values() } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt.diff index 89b004e1e7..23b8172836 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt.diff @@ -4,20 +4,17 @@ - @@= skipped --1, +1 lines =@@ +main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? +mod1.js(2,4): error TS2339: Property 'K' does not exist on type '{}'. +mod1.js(4,23): error TS2339: Property 'K' does not exist on type '{}'. +mod1.js(7,1): error TS2304: Cannot find name 'exports'. +mod1.js(7,16): error TS2339: Property 'K' does not exist on type '{}'. + + -+==== main.js (2 errors) ==== ++==== main.js (1 errors) ==== + const { K } = require("./mod1"); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @param {K} k */ -+ ~ -+!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? + function f(k) { + k.values() + } diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt deleted file mode 100644 index 40c3397a77..0000000000 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt +++ /dev/null @@ -1,49 +0,0 @@ -constructorFunctionMethodTypeParameters.js(3,12): error TS2304: Cannot find name 'T'. -constructorFunctionMethodTypeParameters.js(22,16): error TS2304: Cannot find name 'T'. -constructorFunctionMethodTypeParameters.js(23,16): error TS2304: Cannot find name 'U'. -constructorFunctionMethodTypeParameters.js(24,17): error TS2304: Cannot find name 'T'. - - -==== constructorFunctionMethodTypeParameters.js (4 errors) ==== - /** - * @template {string} T - * @param {T} t - ~ -!!! error TS2304: Cannot find name 'T'. - */ - function Cls(t) { - this.t = t; - } - - /** - * @template {string} V - * @param {T} t - * @param {V} v - * @return {V} - */ - Cls.prototype.topLevelComment = function (t, v) { - return v - }; - - Cls.prototype.nestedComment = - /** - * @template {string} U - * @param {T} t - ~ -!!! error TS2304: Cannot find name 'T'. - * @param {U} u - ~ -!!! error TS2304: Cannot find name 'U'. - * @return {T} - ~ -!!! error TS2304: Cannot find name 'T'. - */ - function (t, u) { - return t - }; - - var c = new Cls('a'); - const s = c.topLevelComment('a', 'b'); - const t = c.nestedComment('a', 'b'); - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff deleted file mode 100644 index a5192ef807..0000000000 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff +++ /dev/null @@ -1,54 +0,0 @@ ---- old.constructorFunctionMethodTypeParameters.errors.txt -+++ new.constructorFunctionMethodTypeParameters.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+constructorFunctionMethodTypeParameters.js(3,12): error TS2304: Cannot find name 'T'. -+constructorFunctionMethodTypeParameters.js(22,16): error TS2304: Cannot find name 'T'. -+constructorFunctionMethodTypeParameters.js(23,16): error TS2304: Cannot find name 'U'. -+constructorFunctionMethodTypeParameters.js(24,17): error TS2304: Cannot find name 'T'. -+ -+ -+==== constructorFunctionMethodTypeParameters.js (4 errors) ==== -+ /** -+ * @template {string} T -+ * @param {T} t -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ function Cls(t) { -+ this.t = t; -+ } -+ -+ /** -+ * @template {string} V -+ * @param {T} t -+ * @param {V} v -+ * @return {V} -+ */ -+ Cls.prototype.topLevelComment = function (t, v) { -+ return v -+ }; -+ -+ Cls.prototype.nestedComment = -+ /** -+ * @template {string} U -+ * @param {T} t -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @param {U} u -+ ~ -+!!! error TS2304: Cannot find name 'U'. -+ * @return {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ function (t, u) { -+ return t -+ }; -+ -+ var c = new Cls('a'); -+ const s = c.topLevelComment('a', 'b'); -+ const t = c.nestedComment('a', 'b'); -+ -+ diff --git a/testdata/baselines/reference/submodule/conformance/enumMerging.errors.txt b/testdata/baselines/reference/submodule/conformance/enumMerging.errors.txt new file mode 100644 index 0000000000..eae39b432f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/enumMerging.errors.txt @@ -0,0 +1,72 @@ +enumMerging.ts(64,17): error TS2339: Property 'Red' does not exist on type 'typeof Color'. + + +==== enumMerging.ts (1 errors) ==== + // Enum with only constant members across 2 declarations with the same root module + // Enum with initializer in all declarations with constant members with the same root module + module M1 { + enum EImpl1 { + A, B, C + } + + enum EImpl1 { + D = 1, E, F + } + + export enum EConst1 { + A = 3, B = 2, C = 1 + } + + export enum EConst1 { + D = 7, E = 9, F = 8 + } + + var x = [EConst1.A, EConst1.B, EConst1.C, EConst1.D, EConst1.E, EConst1.F]; + } + + // Enum with only computed members across 2 declarations with the same root module + module M2 { + export enum EComp2 { + A = 'foo'.length, B = 'foo'.length, C = 'foo'.length + } + + export enum EComp2 { + D = 'foo'.length, E = 'foo'.length, F = 'foo'.length + } + + var x = [EComp2.A, EComp2.B, EComp2.C, EComp2.D, EComp2.E, EComp2.F]; + } + + // Enum with initializer in only one of two declarations with constant members with the same root module + module M3 { + enum EInit { + A, + B + } + + enum EInit { + C = 1, D, E + } + } + + // Enums with same name but different root module + module M4 { + export enum Color { Red, Green, Blue } + } + module M5 { + export enum Color { Red, Green, Blue } + } + + module M6.A { + export enum Color { Red, Green, Blue } + } + module M6 { + export module A { + export enum Color { Yellow = 1 } + } + var t = A.Color.Yellow; + t = A.Color.Red; + ~~~ +!!! error TS2339: Property 'Red' does not exist on type 'typeof Color'. + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/enumMerging.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/enumMerging.errors.txt.diff new file mode 100644 index 0000000000..1ceb7f9cf5 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/enumMerging.errors.txt.diff @@ -0,0 +1,77 @@ +--- old.enumMerging.errors.txt ++++ new.enumMerging.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++enumMerging.ts(64,17): error TS2339: Property 'Red' does not exist on type 'typeof Color'. ++ ++ ++==== enumMerging.ts (1 errors) ==== ++ // Enum with only constant members across 2 declarations with the same root module ++ // Enum with initializer in all declarations with constant members with the same root module ++ module M1 { ++ enum EImpl1 { ++ A, B, C ++ } ++ ++ enum EImpl1 { ++ D = 1, E, F ++ } ++ ++ export enum EConst1 { ++ A = 3, B = 2, C = 1 ++ } ++ ++ export enum EConst1 { ++ D = 7, E = 9, F = 8 ++ } ++ ++ var x = [EConst1.A, EConst1.B, EConst1.C, EConst1.D, EConst1.E, EConst1.F]; ++ } ++ ++ // Enum with only computed members across 2 declarations with the same root module ++ module M2 { ++ export enum EComp2 { ++ A = 'foo'.length, B = 'foo'.length, C = 'foo'.length ++ } ++ ++ export enum EComp2 { ++ D = 'foo'.length, E = 'foo'.length, F = 'foo'.length ++ } ++ ++ var x = [EComp2.A, EComp2.B, EComp2.C, EComp2.D, EComp2.E, EComp2.F]; ++ } ++ ++ // Enum with initializer in only one of two declarations with constant members with the same root module ++ module M3 { ++ enum EInit { ++ A, ++ B ++ } ++ ++ enum EInit { ++ C = 1, D, E ++ } ++ } ++ ++ // Enums with same name but different root module ++ module M4 { ++ export enum Color { Red, Green, Blue } ++ } ++ module M5 { ++ export enum Color { Red, Green, Blue } ++ } ++ ++ module M6.A { ++ export enum Color { Red, Green, Blue } ++ } ++ module M6 { ++ export module A { ++ export enum Color { Yellow = 1 } ++ } ++ var t = A.Color.Yellow; ++ t = A.Color.Red; ++ ~~~ ++!!! error TS2339: Property 'Red' does not exist on type 'typeof Color'. ++ } ++ diff --git a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt index 800958af53..473e3b85dd 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt @@ -1,11 +1,7 @@ -a.js(24,13): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? -a.js(25,12): error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? -a.js(26,12): error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? -a.js(35,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? -a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. +a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: any; }'. -==== a.js (5 errors) ==== +==== a.js (1 errors) ==== /** @enum {string} */ const Target = { START: "start", @@ -30,14 +26,8 @@ a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: s } /** @param {Target} t - ~~~~~~ -!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? * @param {Second} s - ~~~~~~ -!!! error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? * @param {Fs} f - ~~ -!!! error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? */ function consume(t,s,f) { /** @type {string} */ @@ -47,12 +37,10 @@ a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: s /** @type {(n: number) => number} */ var fun = f /** @type {Target} */ - ~~~~~~ -!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? var v = Target.START v = Target.UNKNOWN // error, can't find 'UNKNOWN' ~~~~~~~ -!!! error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. +!!! error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: any; }'. v = Second.MISTAKE // meh..ok, I guess? v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums } diff --git a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt.diff index 62b9f20755..b9e53d50eb 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt.diff @@ -3,15 +3,12 @@ @@= skipped -0, +0 lines =@@ -a.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. -a.js(12,5): error TS2322: Type 'string' is not assignable to type 'number'. -+a.js(24,13): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? -+a.js(25,12): error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? -+a.js(26,12): error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? -+a.js(35,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? - a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. +-a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. ++a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: any; }'. -==== a.js (3 errors) ==== -+==== a.js (5 errors) ==== ++==== a.js (1 errors) ==== /** @enum {string} */ const Target = { START: "start", @@ -31,27 +28,12 @@ OK: 1, /** @type {number} */ FINE: 2, -@@= skipped -31, +29 lines =@@ - } - - /** @param {Target} t -+ ~~~~~~ -+!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? - * @param {Second} s -+ ~~~~~~ -+!!! error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? - * @param {Fs} f -+ ~~ -+!!! error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? - */ - function consume(t,s,f) { - /** @type {string} */ -@@= skipped -11, +17 lines =@@ - /** @type {(n: number) => number} */ - var fun = f - /** @type {Target} */ -+ ~~~~~~ -+!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? +@@= skipped -45, +39 lines =@@ var v = Target.START v = Target.UNKNOWN // error, can't find 'UNKNOWN' ~~~~~~~ +-!!! error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. ++!!! error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: any; }'. + v = Second.MISTAKE // meh..ok, I guess? + v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums + } diff --git a/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt b/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt deleted file mode 100644 index 89a0238c1e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -type.js(2,12): error TS2304: Cannot find name 'TE'. -type.js(4,29): error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'. -value.js(2,12): error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'? - - -==== type.js (2 errors) ==== - /** @typedef {import("./mod1").TestEnum} TE */ - /** @type {TE} */ - ~~ -!!! error TS2304: Cannot find name 'TE'. - const test = 'add' - /** @type {import("./mod1").TestEnum} */ - ~~~~~~~~ -!!! error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'. - const tost = 'remove' - -==== value.js (1 errors) ==== - import { TestEnum } from "./mod1" - /** @type {TestEnum} */ - ~~~~~~~~ -!!! error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'? - const tist = TestEnum.ADD - - -==== mod1.js (0 errors) ==== - /** @enum {string} */ - export const TestEnum = { - ADD: 'add', - REMOVE: 'remove' - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt.diff deleted file mode 100644 index fc656213d0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.enumTagImported.errors.txt -+++ new.enumTagImported.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+type.js(2,12): error TS2304: Cannot find name 'TE'. -+type.js(4,29): error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'. -+value.js(2,12): error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'? -+ -+ -+==== type.js (2 errors) ==== -+ /** @typedef {import("./mod1").TestEnum} TE */ -+ /** @type {TE} */ -+ ~~ -+!!! error TS2304: Cannot find name 'TE'. -+ const test = 'add' -+ /** @type {import("./mod1").TestEnum} */ -+ ~~~~~~~~ -+!!! error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'. -+ const tost = 'remove' -+ -+==== value.js (1 errors) ==== -+ import { TestEnum } from "./mod1" -+ /** @type {TestEnum} */ -+ ~~~~~~~~ -+!!! error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'? -+ const tist = TestEnum.ADD -+ -+ -+==== mod1.js (0 errors) ==== -+ /** @enum {string} */ -+ export const TestEnum = { -+ ADD: 'add', -+ REMOVE: 'remove' -+ } -+ diff --git a/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt deleted file mode 100644 index 5aebbf567d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -bug27134.js(7,11): error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? - - -==== bug27134.js (1 errors) ==== - /** - * @enum {number} - */ - var foo = { }; - - /** - * @type {foo} - ~~~ -!!! error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? - */ - var s; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt.diff deleted file mode 100644 index 732a57f4c7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.enumTagUseBeforeDefCrash.errors.txt -+++ new.enumTagUseBeforeDefCrash.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+bug27134.js(7,11): error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? -+ -+ -+==== bug27134.js (1 errors) ==== -+ /** -+ * @enum {number} -+ */ -+ var foo = { }; -+ -+ /** -+ * @type {foo} -+ ~~~ -+!!! error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? -+ */ -+ var s; -+ diff --git a/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt deleted file mode 100644 index 35cf4728a3..0000000000 --- a/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt +++ /dev/null @@ -1,56 +0,0 @@ -foo.js(20,12): error TS2304: Cannot find name 'FunctionReturningPromise'. -foo.js(44,12): error TS2304: Cannot find name 'FunctionReturningNever'. - - -==== foo.js (2 errors) ==== - /** - * @callback FunctionReturningPromise - * @returns {Promise} - */ - - /** @type {FunctionReturningPromise} */ - function testPromise1() { - console.log("Nope"); - } - - /** @type {FunctionReturningPromise} */ - async function testPromise2() { - return "asd"; - } - - var testPromise3 = /** @type {FunctionReturningPromise} */ function() { - console.log("test") - } - - /** @type {FunctionReturningPromise} */ - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'FunctionReturningPromise'. - var testPromise4 = function() { - console.log("test") - } - - /** - * @callback FunctionReturningNever - * @returns {never} - */ - - /** @type {FunctionReturningNever} */ - function testNever1() { - - } - - /** @type {FunctionReturningNever} */ - async function testNever2() { - return "asd"; - } - - var testNever3 = /** @type {FunctionReturningNever} */ function() { - console.log("test") - } - - /** @type {FunctionReturningNever} */ - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'FunctionReturningNever'. - var testNever4 = function() { - console.log("test") - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt.diff index a85247a036..bf618fbdbf 100644 --- a/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt.diff @@ -1,6 +1,6 @@ --- old.errorOnFunctionReturnType.errors.txt +++ new.errorOnFunctionReturnType.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -foo.js(7,10): error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. -foo.js(11,12): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -foo.js(13,5): error TS2322: Type 'string' is not assignable to type 'number'. @@ -11,78 +11,76 @@ -foo.js(37,5): error TS2322: Type '"asd"' is not assignable to type 'never'. -foo.js(40,56): error TS2534: A function returning 'never' cannot have a reachable end point. -foo.js(45,18): error TS2534: A function returning 'never' cannot have a reachable end point. -+foo.js(20,12): error TS2304: Cannot find name 'FunctionReturningPromise'. -+foo.js(44,12): error TS2304: Cannot find name 'FunctionReturningNever'. - - +- +- -==== foo.js (10 errors) ==== -+==== foo.js (2 errors) ==== - /** - * @callback FunctionReturningPromise - * @returns {Promise} -@@= skipped -17, +9 lines =@@ - - /** @type {FunctionReturningPromise} */ - function testPromise1() { +- /** +- * @callback FunctionReturningPromise +- * @returns {Promise} +- */ +- +- /** @type {FunctionReturningPromise} */ +- function testPromise1() { - ~~~~~~~~~~~~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. - console.log("Nope"); - } - - /** @type {FunctionReturningPromise} */ +- console.log("Nope"); +- } +- +- /** @type {FunctionReturningPromise} */ - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - async function testPromise2() { - return "asd"; +- async function testPromise2() { +- return "asd"; - ~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. - } - - var testPromise3 = /** @type {FunctionReturningPromise} */ function() { +- } +- +- var testPromise3 = /** @type {FunctionReturningPromise} */ function() { - ~~~~~~~~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. - console.log("test") - } - - /** @type {FunctionReturningPromise} */ -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'FunctionReturningPromise'. - var testPromise4 = function() { +- console.log("test") +- } +- +- /** @type {FunctionReturningPromise} */ +- var testPromise4 = function() { - ~~~~~~~~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. - console.log("test") - } - -@@= skipped -34, +26 lines =@@ - - /** @type {FunctionReturningNever} */ - function testNever1() { +- console.log("test") +- } +- +- /** +- * @callback FunctionReturningNever +- * @returns {never} +- */ +- +- /** @type {FunctionReturningNever} */ +- function testNever1() { - ~~~~~~~~~~ -!!! error TS2534: A function returning 'never' cannot have a reachable end point. - - } - - /** @type {FunctionReturningNever} */ +- +- } +- +- /** @type {FunctionReturningNever} */ - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1065: The return type of an async function or method must be the global Promise type. -!!! related TS1055 foo.js:27:14: Type 'never' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. - async function testNever2() { - return "asd"; +- async function testNever2() { +- return "asd"; - ~~~~~~ -!!! error TS2322: Type '"asd"' is not assignable to type 'never'. - } - - var testNever3 = /** @type {FunctionReturningNever} */ function() { +- } +- +- var testNever3 = /** @type {FunctionReturningNever} */ function() { - ~~~~~~~~ -!!! error TS2534: A function returning 'never' cannot have a reachable end point. - console.log("test") - } - - /** @type {FunctionReturningNever} */ -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'FunctionReturningNever'. - var testNever4 = function() { +- console.log("test") +- } +- +- /** @type {FunctionReturningNever} */ +- var testNever4 = function() { - ~~~~~~~~ -!!! error TS2534: A function returning 'never' cannot have a reachable end point. - console.log("test") - } +- console.log("test") +- } +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt deleted file mode 100644 index 3e7597d212..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -use.js(3,12): error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'? - - -==== def.js (0 errors) ==== - /** @enum {number} */ - const MyEnum = { - a: 1, - b: 2 - }; - export default MyEnum; - -==== use.js (1 errors) ==== - import MyEnum from "./def"; - - /** @type {MyEnum} */ - ~~~~~~ -!!! error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'? - const v = MyEnum.b; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt.diff deleted file mode 100644 index a8138db37b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.exportedEnumTypeAndValue.errors.txt -+++ new.exportedEnumTypeAndValue.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+use.js(3,12): error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'? -+ -+ -+==== def.js (0 errors) ==== -+ /** @enum {number} */ -+ const MyEnum = { -+ a: 1, -+ b: 2 -+ }; -+ export default MyEnum; -+ -+==== use.js (1 errors) ==== -+ import MyEnum from "./def"; -+ -+ /** @type {MyEnum} */ -+ ~~~~~~ -+!!! error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'? -+ const v = MyEnum.b; -+ diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt deleted file mode 100644 index 56965bed27..0000000000 --- a/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt +++ /dev/null @@ -1,51 +0,0 @@ -/a.js(13,15): error TS2304: Cannot find name 'T'. - - -==== /a.js (1 errors) ==== - /** - * @typedef {{ - * a: number | string; - * b: boolean | string[]; - * }} Foo - */ - - /** - * @template {Foo} T - */ - class A { - /** - * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. - */ - constructor(a) { - return a - } - } - - /** - * @extends {A<{ - * a: string, - * b: string[] - * }>} - */ - class B extends A {} - - /** - * @extends {A<{ - * a: string, - * b: string - * }>} - */ - class C extends A {} - - /** - * @extends {A<{a: string, b: string[]}>} - */ - class D extends A {} - - /** - * @extends {A<{a: string, b: string}>} - */ - class E extends A {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt.diff index b4e6231a88..536d568237 100644 --- a/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt.diff @@ -1,54 +1,70 @@ --- old.extendsTag5.errors.txt +++ new.extendsTag5.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -/a.js(29,16): error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. - Types of property 'b' are incompatible. - Type 'string' is not assignable to type 'boolean | string[]'. -/a.js(42,16): error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. - Types of property 'b' are incompatible. - Type 'string' is not assignable to type 'boolean | string[]'. -+/a.js(13,15): error TS2304: Cannot find name 'T'. - - +- +- -==== /a.js (2 errors) ==== -+==== /a.js (1 errors) ==== - /** - * @typedef {{ - * a: number | string; -@@= skipped -19, +14 lines =@@ - class A { - /** - * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - constructor(a) { - return a -@@= skipped -16, +18 lines =@@ - - /** - * @extends {A<{ +- /** +- * @typedef {{ +- * a: number | string; +- * b: boolean | string[]; +- * }} Foo +- */ +- +- /** +- * @template {Foo} T +- */ +- class A { +- /** +- * @param {T} a +- */ +- constructor(a) { +- return a +- } +- } +- +- /** +- * @extends {A<{ +- * a: string, +- * b: string[] +- * }>} +- */ +- class B extends A {} +- +- /** +- * @extends {A<{ - ~ - * a: string, +- * a: string, - ~~~~~~~~~~~~~~~~~ - * b: string +- * b: string - ~~~~~~~~~~~~~~~~ - * }>} +- * }>} - ~~~~ -!!! error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. -!!! error TS2344: Types of property 'b' are incompatible. -!!! error TS2344: Type 'string' is not assignable to type 'boolean | string[]'. - */ - class C extends A {} - -@@= skipped -20, +13 lines =@@ - - /** - * @extends {A<{a: string, b: string}>} +- */ +- class C extends A {} +- +- /** +- * @extends {A<{a: string, b: string[]}>} +- */ +- class D extends A {} +- +- /** +- * @extends {A<{a: string, b: string}>} - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. -!!! error TS2344: Types of property 'b' are incompatible. -!!! error TS2344: Type 'string' is not assignable to type 'boolean | string[]'. - */ - class E extends A {} - +- */ +- class E extends A {} +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt b/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt deleted file mode 100644 index e84a7edd68..0000000000 --- a/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -genericSetterInClassTypeJsDoc.js(7,17): error TS2304: Cannot find name 'T'. - - -==== genericSetterInClassTypeJsDoc.js (1 errors) ==== - /** - * @template T - */ - class Box { - #value; - - /** @param {T} initialValue */ - ~ -!!! error TS2304: Cannot find name 'T'. - constructor(initialValue) { - this.#value = initialValue; - } - - /** @type {T} */ - get value() { - return this.#value; - } - - set value(value) { - this.#value = value; - } - } - - new Box(3).value = 3; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt.diff deleted file mode 100644 index 535e78bd35..0000000000 --- a/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.genericSetterInClassTypeJsDoc.errors.txt -+++ new.genericSetterInClassTypeJsDoc.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+genericSetterInClassTypeJsDoc.js(7,17): error TS2304: Cannot find name 'T'. -+ -+ -+==== genericSetterInClassTypeJsDoc.js (1 errors) ==== -+ /** -+ * @template T -+ */ -+ class Box { -+ #value; -+ -+ /** @param {T} initialValue */ -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ constructor(initialValue) { -+ this.#value = initialValue; -+ } -+ -+ /** @type {T} */ -+ get value() { -+ return this.#value; -+ } -+ -+ set value(value) { -+ this.#value = value; -+ } -+ } -+ -+ new Box(3).value = 3; -+ diff --git a/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt deleted file mode 100644 index bfac61ad4a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -/foo.js(6,13): error TS2304: Cannot find name 'Foo'. - - -==== /types.ts (0 errors) ==== - export interface Foo { - a: number; - } - -==== /foo.js (1 errors) ==== - /** - * @import { Foo } from "./types" - */ - - /** - * @param { Foo } foo - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - */ - function f(foo) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt.diff deleted file mode 100644 index 045636af04..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.importTag1.errors.txt -+++ new.importTag1.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/foo.js(6,13): error TS2304: Cannot find name 'Foo'. -+ -+ -+==== /types.ts (0 errors) ==== -+ export interface Foo { -+ a: number; -+ } -+ -+==== /foo.js (1 errors) ==== -+ /** -+ * @import { Foo } from "./types" -+ */ -+ -+ /** -+ * @param { Foo } foo -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. -+ */ -+ function f(foo) {} -+ diff --git a/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt b/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt deleted file mode 100644 index 021e5864c6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -1.js(4,13): error TS2304: Cannot find name 'I'. - - -==== 0.ts (0 errors) ==== - export interface I { } - -==== 1.js (1 errors) ==== - /** @import { I } from './0' with { type: "json" } */ - /** @import * as foo from './0' with { type: "json" } */ - - /** @param {I} a */ - ~ -!!! error TS2304: Cannot find name 'I'. - function f(a) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt.diff index 619cb1400c..fe54c81fd5 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt.diff @@ -1,25 +1,23 @@ --- old.importTag15(module=es2015).errors.txt +++ new.importTag15(module=es2015).errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -1.js(1,30): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.js(2,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -+1.js(4,13): error TS2304: Cannot find name 'I'. - - - ==== 0.ts (0 errors) ==== - export interface I { } - +- +- +-==== 0.ts (0 errors) ==== +- export interface I { } +- -==== 1.js (2 errors) ==== -+==== 1.js (1 errors) ==== - /** @import { I } from './0' with { type: "json" } */ +- /** @import { I } from './0' with { type: "json" } */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. - /** @import * as foo from './0' with { type: "json" } */ +- /** @import * as foo from './0' with { type: "json" } */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. - - /** @param {I} a */ -+ ~ -+!!! error TS2304: Cannot find name 'I'. - function f(a) {} - +- +- /** @param {I} a */ +- function f(a) {} +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt b/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt deleted file mode 100644 index 021e5864c6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -1.js(4,13): error TS2304: Cannot find name 'I'. - - -==== 0.ts (0 errors) ==== - export interface I { } - -==== 1.js (1 errors) ==== - /** @import { I } from './0' with { type: "json" } */ - /** @import * as foo from './0' with { type: "json" } */ - - /** @param {I} a */ - ~ -!!! error TS2304: Cannot find name 'I'. - function f(a) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt.diff index 3f390debf8..89c48b23da 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt.diff @@ -1,25 +1,23 @@ --- old.importTag15(module=esnext).errors.txt +++ new.importTag15(module=esnext).errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -1.js(1,30): error TS2857: Import attributes cannot be used with type-only imports or exports. -1.js(2,33): error TS2857: Import attributes cannot be used with type-only imports or exports. -+1.js(4,13): error TS2304: Cannot find name 'I'. - - - ==== 0.ts (0 errors) ==== - export interface I { } - +- +- +-==== 0.ts (0 errors) ==== +- export interface I { } +- -==== 1.js (2 errors) ==== -+==== 1.js (1 errors) ==== - /** @import { I } from './0' with { type: "json" } */ +- /** @import { I } from './0' with { type: "json" } */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2857: Import attributes cannot be used with type-only imports or exports. - /** @import * as foo from './0' with { type: "json" } */ +- /** @import * as foo from './0' with { type: "json" } */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2857: Import attributes cannot be used with type-only imports or exports. - - /** @param {I} a */ -+ ~ -+!!! error TS2304: Cannot find name 'I'. - function f(a) {} - +- +- /** @param {I} a */ +- function f(a) {} +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt deleted file mode 100644 index 152fcdec23..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -b.js(4,12): error TS2304: Cannot find name 'Foo'. -b.js(5,12): error TS2304: Cannot find name 'I'. - - -==== a.ts (0 errors) ==== - export default interface Foo {} - export interface I {} - -==== b.js (2 errors) ==== - /** @import Foo, { I } from "./a" */ - - /** - * @param {Foo} a - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - * @param {I} b - ~ -!!! error TS2304: Cannot find name 'I'. - */ - export function foo(a, b) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt.diff deleted file mode 100644 index a2ed8030b1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.importTag16.errors.txt -+++ new.importTag16.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+b.js(4,12): error TS2304: Cannot find name 'Foo'. -+b.js(5,12): error TS2304: Cannot find name 'I'. -+ -+ -+==== a.ts (0 errors) ==== -+ export default interface Foo {} -+ export interface I {} -+ -+==== b.js (2 errors) ==== -+ /** @import Foo, { I } from "./a" */ -+ -+ /** -+ * @param {Foo} a -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. -+ * @param {I} b -+ ~ -+!!! error TS2304: Cannot find name 'I'. -+ */ -+ export function foo(a, b) {} -+ diff --git a/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt deleted file mode 100644 index 049012688d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt +++ /dev/null @@ -1,44 +0,0 @@ -/a.js(5,15): error TS2304: Cannot find name 'Import'. -/a.js(12,15): error TS2552: Cannot find name 'Require'. Did you mean 'Required'? - - -==== /node_modules/@types/foo/package.json (0 errors) ==== - { - "name": "@types/foo", - "version": "1.0.0", - "exports": { - ".": { - "import": "./index.d.mts", - "require": "./index.d.cts" - } - } - } - -==== /node_modules/@types/foo/index.d.mts (0 errors) ==== - export declare const Import: "module"; - -==== /node_modules/@types/foo/index.d.cts (0 errors) ==== - export declare const Require: "script"; - -==== /a.js (2 errors) ==== - /** @import { Import } from 'foo' with { 'resolution-mode': 'import' } */ - /** @import { Require } from 'foo' with { 'resolution-mode': 'require' } */ - - /** - * @returns { Import } - ~~~~~~ -!!! error TS2304: Cannot find name 'Import'. - */ - export function f1() { - return 1; - } - - /** - * @returns { Require } - ~~~~~~~ -!!! error TS2552: Cannot find name 'Require'. Did you mean 'Required'? - */ - export function f2() { - return 1; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt.diff index 3dba612b3e..ec2074c7cf 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt.diff @@ -1,34 +1,49 @@ --- old.importTag17.errors.txt +++ new.importTag17.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -/a.js(8,5): error TS2322: Type '1' is not assignable to type '"module"'. -/a.js(15,5): error TS2322: Type '1' is not assignable to type '"script"'. -+/a.js(5,15): error TS2304: Cannot find name 'Import'. -+/a.js(12,15): error TS2552: Cannot find name 'Require'. Did you mean 'Required'? - - - ==== /node_modules/@types/foo/package.json (0 errors) ==== -@@= skipped -25, +25 lines =@@ - - /** - * @returns { Import } -+ ~~~~~~ -+!!! error TS2304: Cannot find name 'Import'. - */ - export function f1() { - return 1; +- +- +-==== /node_modules/@types/foo/package.json (0 errors) ==== +- { +- "name": "@types/foo", +- "version": "1.0.0", +- "exports": { +- ".": { +- "import": "./index.d.mts", +- "require": "./index.d.cts" +- } +- } +- } +- +-==== /node_modules/@types/foo/index.d.mts (0 errors) ==== +- export declare const Import: "module"; +- +-==== /node_modules/@types/foo/index.d.cts (0 errors) ==== +- export declare const Require: "script"; +- +-==== /a.js (2 errors) ==== +- /** @import { Import } from 'foo' with { 'resolution-mode': 'import' } */ +- /** @import { Require } from 'foo' with { 'resolution-mode': 'require' } */ +- +- /** +- * @returns { Import } +- */ +- export function f1() { +- return 1; - ~~~~~~ -!!! error TS2322: Type '1' is not assignable to type '"module"'. - } - - /** - * @returns { Require } -+ ~~~~~~~ -+!!! error TS2552: Cannot find name 'Require'. Did you mean 'Required'? - */ - export function f2() { - return 1; +- } +- +- /** +- * @returns { Require } +- */ +- export function f2() { +- return 1; - ~~~~~~ -!!! error TS2322: Type '1' is not assignable to type '"script"'. - } - +- } +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt deleted file mode 100644 index 843e5470b9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -b.js(8,12): error TS2304: Cannot find name 'Foo'. - - -==== a.ts (0 errors) ==== - export interface Foo {} - -==== b.js (1 errors) ==== - /** - * @import { - * Foo - * } from "./a" - */ - - /** - * @param {Foo} a - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - */ - export function foo(a) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt.diff deleted file mode 100644 index 8895183edb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.importTag18.errors.txt -+++ new.importTag18.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+b.js(8,12): error TS2304: Cannot find name 'Foo'. -+ -+ -+==== a.ts (0 errors) ==== -+ export interface Foo {} -+ -+==== b.js (1 errors) ==== -+ /** -+ * @import { -+ * Foo -+ * } from "./a" -+ */ -+ -+ /** -+ * @param {Foo} a -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. -+ */ -+ export function foo(a) {} -+ diff --git a/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt deleted file mode 100644 index 1adc07dfbe..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -b.js(7,12): error TS2304: Cannot find name 'Foo'. - - -==== a.ts (0 errors) ==== - export interface Foo {} - -==== b.js (1 errors) ==== - /** - * @import { Foo } - * from "./a" - */ - - /** - * @param {Foo} a - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - */ - export function foo(a) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt.diff deleted file mode 100644 index 8839708644..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.importTag19.errors.txt -+++ new.importTag19.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+b.js(7,12): error TS2304: Cannot find name 'Foo'. -+ -+ -+==== a.ts (0 errors) ==== -+ export interface Foo {} -+ -+==== b.js (1 errors) ==== -+ /** -+ * @import { Foo } -+ * from "./a" -+ */ -+ -+ /** -+ * @param {Foo} a -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. -+ */ -+ export function foo(a) {} -+ diff --git a/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt deleted file mode 100644 index 75e50ed132..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -/foo.js(6,13): error TS2503: Cannot find namespace 'types'. - - -==== /types.ts (0 errors) ==== - export interface Foo { - a: number; - } - -==== /foo.js (1 errors) ==== - /** - * @import * as types from "./types" - */ - - /** - * @param { types.Foo } foo - ~~~~~ -!!! error TS2503: Cannot find namespace 'types'. - */ - export function f(foo) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt.diff deleted file mode 100644 index 68b2074596..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.importTag2.errors.txt -+++ new.importTag2.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/foo.js(6,13): error TS2503: Cannot find namespace 'types'. -+ -+ -+==== /types.ts (0 errors) ==== -+ export interface Foo { -+ a: number; -+ } -+ -+==== /foo.js (1 errors) ==== -+ /** -+ * @import * as types from "./types" -+ */ -+ -+ /** -+ * @param { types.Foo } foo -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'types'. -+ */ -+ export function f(foo) {} -+ diff --git a/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt deleted file mode 100644 index 2ec34959d1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -b.js(8,12): error TS2304: Cannot find name 'Foo'. - - -==== a.ts (0 errors) ==== - export interface Foo {} - -==== b.js (1 errors) ==== - /** - * @import - * { Foo - * } from './a' - */ - - /** - * @param {Foo} a - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - */ - export function foo(a) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt.diff deleted file mode 100644 index 3001e176c7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.importTag20.errors.txt -+++ new.importTag20.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+b.js(8,12): error TS2304: Cannot find name 'Foo'. -+ -+ -+==== a.ts (0 errors) ==== -+ export interface Foo {} -+ -+==== b.js (1 errors) ==== -+ /** -+ * @import -+ * { Foo -+ * } from './a' -+ */ -+ -+ /** -+ * @param {Foo} a -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. -+ */ -+ export function foo(a) {} -+ diff --git a/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt deleted file mode 100644 index 74ccb4534f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -/foo.js(6,13): error TS2304: Cannot find name 'Foo'. - - -==== /types.ts (0 errors) ==== - export default interface Foo { - a: number; - } - -==== /foo.js (1 errors) ==== - /** - * @import Foo from "./types" - */ - - /** - * @param { Foo } foo - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - */ - export function f(foo) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt.diff deleted file mode 100644 index 31d34ac710..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.importTag3.errors.txt -+++ new.importTag3.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/foo.js(6,13): error TS2304: Cannot find name 'Foo'. -+ -+ -+==== /types.ts (0 errors) ==== -+ export default interface Foo { -+ a: number; -+ } -+ -+==== /foo.js (1 errors) ==== -+ /** -+ * @import Foo from "./types" -+ */ -+ -+ /** -+ * @param { Foo } foo -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. -+ */ -+ export function f(foo) {} -+ diff --git a/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt deleted file mode 100644 index 23e58203fa..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt +++ /dev/null @@ -1,24 +0,0 @@ -/foo.js(10,13): error TS2304: Cannot find name 'Foo'. - - -==== /types.ts (0 errors) ==== - export interface Foo { - a: number; - } - -==== /foo.js (1 errors) ==== - /** - * @import { Foo } from "./types" - */ - - /** - * @import { Foo } from "./types" - */ - - /** - * @param { Foo } foo - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - */ - function f(foo) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt.diff index 8f00ca389e..816497509b 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt.diff @@ -1,34 +1,32 @@ --- old.importTag4.errors.txt +++ new.importTag4.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -/foo.js(2,14): error TS2300: Duplicate identifier 'Foo'. -/foo.js(6,14): error TS2300: Duplicate identifier 'Foo'. -+/foo.js(10,13): error TS2304: Cannot find name 'Foo'. - - - ==== /types.ts (0 errors) ==== -@@= skipped -6, +5 lines =@@ - a: number; - } - +- +- +-==== /types.ts (0 errors) ==== +- export interface Foo { +- a: number; +- } +- -==== /foo.js (2 errors) ==== -+==== /foo.js (1 errors) ==== - /** - * @import { Foo } from "./types" +- /** +- * @import { Foo } from "./types" - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. - */ - - /** - * @import { Foo } from "./types" +- */ +- +- /** +- * @import { Foo } from "./types" - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. - */ - - /** - * @param { Foo } foo -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. - */ - function f(foo) {} - +- */ +- +- /** +- * @param { Foo } foo +- */ +- function f(foo) {} +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt deleted file mode 100644 index bfac61ad4a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -/foo.js(6,13): error TS2304: Cannot find name 'Foo'. - - -==== /types.ts (0 errors) ==== - export interface Foo { - a: number; - } - -==== /foo.js (1 errors) ==== - /** - * @import { Foo } from "./types" - */ - - /** - * @param { Foo } foo - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - */ - function f(foo) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt.diff deleted file mode 100644 index 25bcd83984..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.importTag5.errors.txt -+++ new.importTag5.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/foo.js(6,13): error TS2304: Cannot find name 'Foo'. -+ -+ -+==== /types.ts (0 errors) ==== -+ export interface Foo { -+ a: number; -+ } -+ -+==== /foo.js (1 errors) ==== -+ /** -+ * @import { Foo } from "./types" -+ */ -+ -+ /** -+ * @param { Foo } foo -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. -+ */ -+ function f(foo) {} -+ diff --git a/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt deleted file mode 100644 index 6a1ec95ceb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt +++ /dev/null @@ -1,30 +0,0 @@ -/foo.js(9,13): error TS2304: Cannot find name 'A'. -/foo.js(10,13): error TS2304: Cannot find name 'B'. - - -==== /types.ts (0 errors) ==== - export interface A { - a: number; - } - export interface B { - a: number; - } - -==== /foo.js (2 errors) ==== - /** - * @import { - * A, - * B, - * } from "./types" - */ - - /** - * @param { A } a - ~ -!!! error TS2304: Cannot find name 'A'. - * @param { B } b - ~ -!!! error TS2304: Cannot find name 'B'. - */ - function f(a, b) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt.diff deleted file mode 100644 index 51eb4dfd60..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.importTag6.errors.txt -+++ new.importTag6.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/foo.js(9,13): error TS2304: Cannot find name 'A'. -+/foo.js(10,13): error TS2304: Cannot find name 'B'. -+ -+ -+==== /types.ts (0 errors) ==== -+ export interface A { -+ a: number; -+ } -+ export interface B { -+ a: number; -+ } -+ -+==== /foo.js (2 errors) ==== -+ /** -+ * @import { -+ * A, -+ * B, -+ * } from "./types" -+ */ -+ -+ /** -+ * @param { A } a -+ ~ -+!!! error TS2304: Cannot find name 'A'. -+ * @param { B } b -+ ~ -+!!! error TS2304: Cannot find name 'B'. -+ */ -+ function f(a, b) {} -+ diff --git a/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt deleted file mode 100644 index 90936c1814..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -/foo.js(8,13): error TS2304: Cannot find name 'A'. -/foo.js(9,13): error TS2304: Cannot find name 'B'. - - -==== /types.ts (0 errors) ==== - export interface A { - a: number; - } - export interface B { - a: number; - } - -==== /foo.js (2 errors) ==== - /** - * @import { - * A, - * B } from "./types" - */ - - /** - * @param { A } a - ~ -!!! error TS2304: Cannot find name 'A'. - * @param { B } b - ~ -!!! error TS2304: Cannot find name 'B'. - */ - function f(a, b) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt.diff deleted file mode 100644 index 7e454e8a8a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.importTag7.errors.txt -+++ new.importTag7.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/foo.js(8,13): error TS2304: Cannot find name 'A'. -+/foo.js(9,13): error TS2304: Cannot find name 'B'. -+ -+ -+==== /types.ts (0 errors) ==== -+ export interface A { -+ a: number; -+ } -+ export interface B { -+ a: number; -+ } -+ -+==== /foo.js (2 errors) ==== -+ /** -+ * @import { -+ * A, -+ * B } from "./types" -+ */ -+ -+ /** -+ * @param { A } a -+ ~ -+!!! error TS2304: Cannot find name 'A'. -+ * @param { B } b -+ ~ -+!!! error TS2304: Cannot find name 'B'. -+ */ -+ function f(a, b) {} -+ diff --git a/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt deleted file mode 100644 index dadfa9424e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -/foo.js(8,13): error TS2304: Cannot find name 'A'. -/foo.js(9,13): error TS2304: Cannot find name 'B'. - - -==== /types.ts (0 errors) ==== - export interface A { - a: number; - } - export interface B { - a: number; - } - -==== /foo.js (2 errors) ==== - /** - * @import - * { A, B } - * from "./types" - */ - - /** - * @param { A } a - ~ -!!! error TS2304: Cannot find name 'A'. - * @param { B } b - ~ -!!! error TS2304: Cannot find name 'B'. - */ - function f(a, b) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt.diff deleted file mode 100644 index 9bb7bbb81c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.importTag8.errors.txt -+++ new.importTag8.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/foo.js(8,13): error TS2304: Cannot find name 'A'. -+/foo.js(9,13): error TS2304: Cannot find name 'B'. -+ -+ -+==== /types.ts (0 errors) ==== -+ export interface A { -+ a: number; -+ } -+ export interface B { -+ a: number; -+ } -+ -+==== /foo.js (2 errors) ==== -+ /** -+ * @import -+ * { A, B } -+ * from "./types" -+ */ -+ -+ /** -+ * @param { A } a -+ ~ -+!!! error TS2304: Cannot find name 'A'. -+ * @param { B } b -+ ~ -+!!! error TS2304: Cannot find name 'B'. -+ */ -+ function f(a, b) {} -+ diff --git a/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt deleted file mode 100644 index 44b7a7c5ba..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -/foo.js(8,13): error TS2503: Cannot find namespace 'types'. -/foo.js(9,13): error TS2503: Cannot find namespace 'types'. - - -==== /types.ts (0 errors) ==== - export interface A { - a: number; - } - export interface B { - a: number; - } - -==== /foo.js (2 errors) ==== - /** - * @import - * * as types - * from "./types" - */ - - /** - * @param { types.A } a - ~~~~~ -!!! error TS2503: Cannot find namespace 'types'. - * @param { types.B } b - ~~~~~ -!!! error TS2503: Cannot find namespace 'types'. - */ - function f(a, b) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt.diff deleted file mode 100644 index 047a55a6c9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.importTag9.errors.txt -+++ new.importTag9.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/foo.js(8,13): error TS2503: Cannot find namespace 'types'. -+/foo.js(9,13): error TS2503: Cannot find namespace 'types'. -+ -+ -+==== /types.ts (0 errors) ==== -+ export interface A { -+ a: number; -+ } -+ export interface B { -+ a: number; -+ } -+ -+==== /foo.js (2 errors) ==== -+ /** -+ * @import -+ * * as types -+ * from "./types" -+ */ -+ -+ /** -+ * @param { types.A } a -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'types'. -+ * @param { types.B } b -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'types'. -+ */ -+ function f(a, b) {} -+ diff --git a/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt b/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt deleted file mode 100644 index ed3d68f55d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt +++ /dev/null @@ -1,36 +0,0 @@ -/a.js(5,17): error TS2304: Cannot find name 'T'. -/a.js(14,17): error TS2304: Cannot find name 'T'. - - -==== /a.js (2 errors) ==== - export class C { - /** - * @template T - * @this {T} - * @return {T} - ~ -!!! error TS2304: Cannot find name 'T'. - */ - static a() { - return this; - } - - /** - * @template T - * @this {T} - * @return {T} - ~ -!!! error TS2304: Cannot find name 'T'. - */ - b() { - return this; - } - } - - const a = C.a(); - a; // typeof C - - const c = new C(); - const b = c.b(); - b; // C - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt.diff deleted file mode 100644 index 17d7c303d8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- old.inferThis.errors.txt -+++ new.inferThis.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/a.js(5,17): error TS2304: Cannot find name 'T'. -+/a.js(14,17): error TS2304: Cannot find name 'T'. -+ -+ -+==== /a.js (2 errors) ==== -+ export class C { -+ /** -+ * @template T -+ * @this {T} -+ * @return {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ static a() { -+ return this; -+ } -+ -+ /** -+ * @template T -+ * @this {T} -+ * @return {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ b() { -+ return this; -+ } -+ } -+ -+ const a = C.a(); -+ a; // typeof C -+ -+ const c = new C(); -+ const b = c.b(); -+ b; // C -+ diff --git a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt deleted file mode 100644 index bd258156de..0000000000 --- a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt +++ /dev/null @@ -1,25 +0,0 @@ -instantiateTemplateTagTypeParameterOnVariableStatement.js(3,12): error TS2304: Cannot find name 'T'. -instantiateTemplateTagTypeParameterOnVariableStatement.js(4,18): error TS2304: Cannot find name 'T'. -instantiateTemplateTagTypeParameterOnVariableStatement.js(4,24): error TS2304: Cannot find name 'T'. - - -==== instantiateTemplateTagTypeParameterOnVariableStatement.js (3 errors) ==== - /** - * @template T - * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {(b: T) => T} - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'T'. - */ - const seq = a => b => b; - - const text1 = "hello"; - const text2 = "world"; - - /** @type {string} */ - var text3 = seq(text1)(text2); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff deleted file mode 100644 index b2e4887db6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt -+++ new.instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+instantiateTemplateTagTypeParameterOnVariableStatement.js(3,12): error TS2304: Cannot find name 'T'. -+instantiateTemplateTagTypeParameterOnVariableStatement.js(4,18): error TS2304: Cannot find name 'T'. -+instantiateTemplateTagTypeParameterOnVariableStatement.js(4,24): error TS2304: Cannot find name 'T'. -+ -+ -+==== instantiateTemplateTagTypeParameterOnVariableStatement.js (3 errors) ==== -+ /** -+ * @template T -+ * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {(b: T) => T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ const seq = a => b => b; -+ -+ const text1 = "hello"; -+ const text2 = "world"; -+ -+ /** @type {string} */ -+ var text3 = seq(text1)(text2); -+ diff --git a/testdata/baselines/reference/submodule/conformance/invalidNestedModules.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/invalidNestedModules.errors.txt.diff new file mode 100644 index 0000000000..f20fc34380 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/invalidNestedModules.errors.txt.diff @@ -0,0 +1,46 @@ +--- old.invalidNestedModules.errors.txt ++++ new.invalidNestedModules.errors.txt +@@= skipped -0, +-1 lines =@@ +-invalidNestedModules.ts(1,12): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. +-invalidNestedModules.ts(17,18): error TS2300: Duplicate identifier 'Point'. +-invalidNestedModules.ts(24,20): error TS2300: Duplicate identifier 'Point'. +- +- +-==== invalidNestedModules.ts (3 errors) ==== +- module A.B.C { +- ~ +-!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. +- export class Point { +- x: number; +- y: number; +- } +- } +- +- module A { +- export module B { +- export class C { // Error +- name: string; +- } +- } +- } +- +- module M2.X { +- export class Point { +- ~~~~~ +-!!! error TS2300: Duplicate identifier 'Point'. +- x: number; y: number; +- } +- } +- +- module M2 { +- export module X { +- export var Point: number; // Error +- ~~~~~ +-!!! error TS2300: Duplicate identifier 'Point'. +- } +- } +- +- +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt deleted file mode 100644 index 1e562e728e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -lib.js(7,16): error TS2304: Cannot find name 'T'. - - -==== interface.ts (0 errors) ==== - export interface Encoder { - encode(value: T): Uint8Array - } -==== lib.js (1 errors) ==== - /** - * @template T - * @implements {IEncoder} - */ - export class Encoder { - /** - * @param {T} value - ~ -!!! error TS2304: Cannot find name 'T'. - */ - encode(value) { - return new Uint8Array(0) - } - } - - - /** - * @template T - * @typedef {import('./interface').Encoder} IEncoder - */ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt.diff deleted file mode 100644 index bc7b9eeb6f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.jsDeclarationsClassImplementsGenericsSerialization.errors.txt -+++ new.jsDeclarationsClassImplementsGenericsSerialization.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+lib.js(7,16): error TS2304: Cannot find name 'T'. -+ -+ -+==== interface.ts (0 errors) ==== -+ export interface Encoder { -+ encode(value: T): Uint8Array -+ } -+==== lib.js (1 errors) ==== -+ /** -+ * @template T -+ * @implements {IEncoder} -+ */ -+ export class Encoder { -+ /** -+ * @param {T} value -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ encode(value) { -+ return new Uint8Array(0) -+ } -+ } -+ -+ -+ /** -+ * @template T -+ * @typedef {import('./interface').Encoder} IEncoder -+ */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt index 72f8243285..6a70384f9a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt @@ -1,28 +1,12 @@ -index.js(24,15): error TS2304: Cannot find name 'T'. -index.js(24,19): error TS2304: Cannot find name 'U'. -index.js(30,15): error TS2304: Cannot find name 'T'. -index.js(30,19): error TS2304: Cannot find name 'U'. -index.js(38,17): error TS2304: Cannot find name 'U'. -index.js(43,16): error TS2304: Cannot find name 'U'. -index.js(48,17): error TS2304: Cannot find name 'U'. -index.js(53,16): error TS2304: Cannot find name 'U'. -index.js(58,16): error TS2304: Cannot find name 'T'. -index.js(59,16): error TS2304: Cannot find name 'U'. -index.js(104,15): error TS2304: Cannot find name 'T'. -index.js(104,19): error TS2304: Cannot find name 'U'. -index.js(108,16): error TS2304: Cannot find name 'T'. -index.js(109,16): error TS2304: Cannot find name 'U'. index.js(138,14): error TS2339: Property 'p1' does not exist on type 'K'. index.js(139,14): error TS2339: Property 'p2' does not exist on type 'K'. index.js(143,21): error TS2339: Property 'p1' does not exist on type 'K'. index.js(151,14): error TS2339: Property 'prop' does not exist on type 'M'. -index.js(161,16): error TS2304: Cannot find name 'T'. index.js(165,14): error TS2339: Property 'another' does not exist on type 'N'. -index.js(175,16): error TS2304: Cannot find name 'U'. index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. -==== index.js (22 errors) ==== +==== index.js (6 errors) ==== export class A {} export class B { @@ -47,20 +31,12 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. export class E { /** * @type {T & U} - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'U'. */ field; // @readonly is currently unsupported, it seems - included here just in case that changes /** * @type {T & U} - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'U'. * @readonly */ readonlyField; @@ -69,39 +45,27 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. /** * @return {U} - ~ -!!! error TS2304: Cannot find name 'U'. */ get f1() { return /** @type {*} */(null); } /** * @param {U} _p - ~ -!!! error TS2304: Cannot find name 'U'. */ set f1(_p) {} /** * @return {U} - ~ -!!! error TS2304: Cannot find name 'U'. */ get f2() { return /** @type {*} */(null); } /** * @param {U} _p - ~ -!!! error TS2304: Cannot find name 'U'. */ set f3(_p) {} /** * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. * @param {U} b - ~ -!!! error TS2304: Cannot find name 'U'. */ constructor(a, b) {} @@ -147,19 +111,11 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. export class F { /** * @type {T & U} - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'U'. */ field; /** * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. * @param {U} b - ~ -!!! error TS2304: Cannot find name 'U'. */ constructor(a, b) {} @@ -220,8 +176,6 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. export class N extends L { /** * @param {T} param - ~ -!!! error TS2304: Cannot find name 'T'. */ constructor(param) { super(); @@ -238,8 +192,6 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. export class O extends N { /** * @param {U} param - ~ -!!! error TS2304: Cannot find name 'U'. */ constructor(param) { super(param); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt.diff index 8c15452462..4389d4e7fc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt.diff @@ -3,31 +3,15 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+index.js(24,15): error TS2304: Cannot find name 'T'. -+index.js(24,19): error TS2304: Cannot find name 'U'. -+index.js(30,15): error TS2304: Cannot find name 'T'. -+index.js(30,19): error TS2304: Cannot find name 'U'. -+index.js(38,17): error TS2304: Cannot find name 'U'. -+index.js(43,16): error TS2304: Cannot find name 'U'. -+index.js(48,17): error TS2304: Cannot find name 'U'. -+index.js(53,16): error TS2304: Cannot find name 'U'. -+index.js(58,16): error TS2304: Cannot find name 'T'. -+index.js(59,16): error TS2304: Cannot find name 'U'. -+index.js(104,15): error TS2304: Cannot find name 'T'. -+index.js(104,19): error TS2304: Cannot find name 'U'. -+index.js(108,16): error TS2304: Cannot find name 'T'. -+index.js(109,16): error TS2304: Cannot find name 'U'. +index.js(138,14): error TS2339: Property 'p1' does not exist on type 'K'. +index.js(139,14): error TS2339: Property 'p2' does not exist on type 'K'. +index.js(143,21): error TS2339: Property 'p1' does not exist on type 'K'. +index.js(151,14): error TS2339: Property 'prop' does not exist on type 'M'. -+index.js(161,16): error TS2304: Cannot find name 'T'. +index.js(165,14): error TS2339: Property 'another' does not exist on type 'N'. -+index.js(175,16): error TS2304: Cannot find name 'U'. +index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. + + -+==== index.js (22 errors) ==== ++==== index.js (6 errors) ==== + export class A {} + + export class B { @@ -52,20 +36,12 @@ + export class E { + /** + * @type {T & U} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'U'. + */ + field; + + // @readonly is currently unsupported, it seems - included here just in case that changes + /** + * @type {T & U} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'U'. + * @readonly + */ + readonlyField; @@ -74,39 +50,27 @@ + + /** + * @return {U} -+ ~ -+!!! error TS2304: Cannot find name 'U'. + */ + get f1() { return /** @type {*} */(null); } + + /** + * @param {U} _p -+ ~ -+!!! error TS2304: Cannot find name 'U'. + */ + set f1(_p) {} + + /** + * @return {U} -+ ~ -+!!! error TS2304: Cannot find name 'U'. + */ + get f2() { return /** @type {*} */(null); } + + /** + * @param {U} _p -+ ~ -+!!! error TS2304: Cannot find name 'U'. + */ + set f3(_p) {} + + /** + * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. + * @param {U} b -+ ~ -+!!! error TS2304: Cannot find name 'U'. + */ + constructor(a, b) {} + @@ -152,19 +116,11 @@ + export class F { + /** + * @type {T & U} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'U'. + */ + field; + /** + * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. + * @param {U} b -+ ~ -+!!! error TS2304: Cannot find name 'U'. + */ + constructor(a, b) {} + @@ -225,8 +181,6 @@ + export class N extends L { + /** + * @param {T} param -+ ~ -+!!! error TS2304: Cannot find name 'T'. + */ + constructor(param) { + super(); @@ -243,8 +197,6 @@ + export class O extends N { + /** + * @param {U} param -+ ~ -+!!! error TS2304: Cannot find name 'U'. + */ + constructor(param) { + super(param); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt deleted file mode 100644 index 7312ed2c66..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt +++ /dev/null @@ -1,63 +0,0 @@ -index.js(23,12): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? -index.js(24,12): error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? -index.js(25,12): error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? -index.js(34,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? - - -==== index.js (4 errors) ==== - /** @enum {string} */ - export const Target = { - START: "start", - MIDDLE: "middle", - END: "end", - /** @type {number} */ - OK_I_GUESS: 2 - } - /** @enum number */ - export const Second = { - OK: 1, - /** @type {number} */ - FINE: 2, - } - /** @enum {function(number): number} */ - export const Fs = { - ADD1: n => n + 1, - ID: n => n, - SUB1: n => n - 1 - } - - /** - * @param {Target} t - ~~~~~~ -!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? - * @param {Second} s - ~~~~~~ -!!! error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? - * @param {Fs} f - ~~ -!!! error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? - */ - export function consume(t,s,f) { - /** @type {string} */ - var str = t - /** @type {number} */ - var num = s - /** @type {(n: number) => number} */ - var fun = f - /** @type {Target} */ - ~~~~~~ -!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? - var v = Target.START - v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums - } - /** @param {string} s */ - export function ff(s) { - // element access with arbitrary string is an error only with noImplicitAny - if (!Target[s]) { - return null - } - else { - return Target[s] - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt.diff deleted file mode 100644 index 0926175c08..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt.diff +++ /dev/null @@ -1,68 +0,0 @@ ---- old.jsDeclarationsEnumTag.errors.txt -+++ new.jsDeclarationsEnumTag.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(23,12): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? -+index.js(24,12): error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? -+index.js(25,12): error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? -+index.js(34,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? -+ -+ -+==== index.js (4 errors) ==== -+ /** @enum {string} */ -+ export const Target = { -+ START: "start", -+ MIDDLE: "middle", -+ END: "end", -+ /** @type {number} */ -+ OK_I_GUESS: 2 -+ } -+ /** @enum number */ -+ export const Second = { -+ OK: 1, -+ /** @type {number} */ -+ FINE: 2, -+ } -+ /** @enum {function(number): number} */ -+ export const Fs = { -+ ADD1: n => n + 1, -+ ID: n => n, -+ SUB1: n => n - 1 -+ } -+ -+ /** -+ * @param {Target} t -+ ~~~~~~ -+!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? -+ * @param {Second} s -+ ~~~~~~ -+!!! error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? -+ * @param {Fs} f -+ ~~ -+!!! error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? -+ */ -+ export function consume(t,s,f) { -+ /** @type {string} */ -+ var str = t -+ /** @type {number} */ -+ var num = s -+ /** @type {(n: number) => number} */ -+ var fun = f -+ /** @type {Target} */ -+ ~~~~~~ -+!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? -+ var v = Target.START -+ v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums -+ } -+ /** @param {string} s */ -+ export function ff(s) { -+ // element access with arbitrary string is an error only with noImplicitAny -+ if (!Target[s]) { -+ return null -+ } -+ else { -+ return Target[s] -+ } -+ } -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt index 8bfacb8e9c..6445eae929 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt @@ -2,18 +2,11 @@ index.js(1,23): error TS2580: Cannot find name 'module'. Do you need to install index.js(3,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(4,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(12,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -index.js(17,12): error TS2304: Cannot find name 'T'. -index.js(18,12): error TS2304: Cannot find name 'U'. -index.js(19,13): error TS2304: Cannot find name 'T'. -index.js(19,17): error TS2304: Cannot find name 'U'. index.js(22,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -index.js(26,12): error TS2304: Cannot find name 'T'. index.js(31,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(32,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(32,58): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -index.js(36,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(41,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -index.js(46,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(51,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(53,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(54,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -23,7 +16,7 @@ index.js(57,54): error TS2580: Cannot find name 'module'. Do you need to install index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== index.js (23 errors) ==== +==== index.js (16 errors) ==== Object.defineProperty(module.exports, "a", { value: function a() {} }); ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -49,16 +42,8 @@ index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install /** * @template T,U * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. * @param {U} b - ~ -!!! error TS2304: Cannot find name 'U'. * @return {T & U} - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'U'. */ function e(a, b) { return /** @type {*} */(null); } Object.defineProperty(module.exports, "e", { value: e }); @@ -68,8 +53,6 @@ index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install /** * @template T * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. */ function f(a) { return a; @@ -86,8 +69,6 @@ index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b - ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. */ function g(a, b) { return a.x && b.y(); @@ -100,8 +81,6 @@ index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b - ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. */ function hh(a, b) { return a.x && b.y(); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff index 8bbf3a1050..566f77664d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff @@ -7,18 +7,11 @@ +index.js(3,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(4,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(12,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+index.js(17,12): error TS2304: Cannot find name 'T'. -+index.js(18,12): error TS2304: Cannot find name 'U'. -+index.js(19,13): error TS2304: Cannot find name 'T'. -+index.js(19,17): error TS2304: Cannot find name 'U'. +index.js(22,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+index.js(26,12): error TS2304: Cannot find name 'T'. +index.js(31,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(32,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(32,58): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+index.js(36,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(41,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+index.js(46,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(51,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(53,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(54,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -28,7 +21,7 @@ +index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== index.js (23 errors) ==== ++==== index.js (16 errors) ==== + Object.defineProperty(module.exports, "a", { value: function a() {} }); + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -54,16 +47,8 @@ + /** + * @template T,U + * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. + * @param {U} b -+ ~ -+!!! error TS2304: Cannot find name 'U'. + * @return {T & U} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'U'. + */ + function e(a, b) { return /** @type {*} */(null); } + Object.defineProperty(module.exports, "e", { value: e }); @@ -73,8 +58,6 @@ + /** + * @template T + * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. + */ + function f(a) { + return a; @@ -91,8 +74,6 @@ + /** + * @param {{x: string}} a + * @param {{y: typeof module.exports.b}} b -+ ~~~~~~ -+!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + function g(a, b) { + return a.x && b.y(); @@ -105,8 +86,6 @@ + /** + * @param {{x: string}} a + * @param {{y: typeof module.exports.b}} b -+ ~~~~~~ -+!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + function hh(a, b) { + return a.x && b.y(); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols index c042f1a5a8..2af33397b3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols @@ -91,12 +91,8 @@ function g(a, b) { >b : Symbol(b, Decl(index.js, 37, 13)) return a.x && b.y(); ->a.x : Symbol(x, Decl(index.js, 34, 12)) >a : Symbol(a, Decl(index.js, 37, 11)) ->x : Symbol(x, Decl(index.js, 34, 12)) ->b.y : Symbol(y, Decl(index.js, 35, 12)) >b : Symbol(b, Decl(index.js, 37, 13)) ->y : Symbol(y, Decl(index.js, 35, 12)) } Object.defineProperty(module.exports, "g", { value: g }); >Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) @@ -116,12 +112,8 @@ function hh(a, b) { >b : Symbol(b, Decl(index.js, 47, 14)) return a.x && b.y(); ->a.x : Symbol(x, Decl(index.js, 44, 12)) >a : Symbol(a, Decl(index.js, 47, 12)) ->x : Symbol(x, Decl(index.js, 44, 12)) ->b.y : Symbol(y, Decl(index.js, 45, 12)) >b : Symbol(b, Decl(index.js, 47, 14)) ->y : Symbol(y, Decl(index.js, 45, 12)) } Object.defineProperty(module.exports, "h", { value: hh }); >Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols.diff index a07682c725..a83909aa88 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols.diff @@ -113,8 +113,16 @@ /** * @param {{x: string}} a -@@= skipped -45, +30 lines =@@ - >y : Symbol(y, Decl(index.js, 35, 12)) +@@= skipped -37, +22 lines =@@ + >b : Symbol(b, Decl(index.js, 37, 13)) + + return a.x && b.y(); +->a.x : Symbol(x, Decl(index.js, 34, 12)) + >a : Symbol(a, Decl(index.js, 37, 11)) +->x : Symbol(x, Decl(index.js, 34, 12)) +->b.y : Symbol(y, Decl(index.js, 35, 12)) + >b : Symbol(b, Decl(index.js, 37, 13)) +->y : Symbol(y, Decl(index.js, 35, 12)) } Object.defineProperty(module.exports, "g", { value: g }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) @@ -129,8 +137,16 @@ >value : Symbol(value, Decl(index.js, 40, 44)) >g : Symbol(g, Decl(index.js, 31, 77)) -@@= skipped -29, +25 lines =@@ - >y : Symbol(y, Decl(index.js, 45, 12)) +@@= skipped -29, +21 lines =@@ + >b : Symbol(b, Decl(index.js, 47, 14)) + + return a.x && b.y(); +->a.x : Symbol(x, Decl(index.js, 44, 12)) + >a : Symbol(a, Decl(index.js, 47, 12)) +->x : Symbol(x, Decl(index.js, 44, 12)) +->b.y : Symbol(y, Decl(index.js, 45, 12)) + >b : Symbol(b, Decl(index.js, 47, 14)) +->y : Symbol(y, Decl(index.js, 45, 12)) } Object.defineProperty(module.exports, "h", { value: hh }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt index 0d818efd34..d61c510933 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt @@ -1,9 +1,5 @@ -context.js(29,12): error TS2304: Cannot find name 'Input'. context.js(34,14): error TS2350: Only a void function can be called with the 'new' keyword. -context.js(40,16): error TS2304: Cannot find name 'Input'. -context.js(42,18): error TS2304: Cannot find name 'State'. context.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -hook.js(5,12): error TS2304: Cannot find name 'HookHandler'. hook.js(10,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -18,14 +14,12 @@ timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install t module.exports = Timer; ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== hook.js (2 errors) ==== +==== hook.js (1 errors) ==== /** * @typedef {(arg: import("./context")) => void} HookHandler */ /** * @param {HookHandler} handle - ~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'HookHandler'. */ function Hook(handle) { this.handle = handle; @@ -34,7 +28,7 @@ timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install t ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== context.js (5 errors) ==== +==== context.js (2 errors) ==== /** * Imports * @@ -64,8 +58,6 @@ timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install t * * @class * @param {Input} input - ~~~~~ -!!! error TS2304: Cannot find name 'Input'. */ function Context(input) { @@ -79,12 +71,8 @@ timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install t Context.prototype = { /** * @param {Input} input - ~~~~~ -!!! error TS2304: Cannot find name 'Input'. * @param {HookHandler=} handle * @returns {State} - ~~~~~ -!!! error TS2304: Cannot find name 'State'. */ construct(input, handle = () => void 0) { return input; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff index 29d8810e77..908a49bb28 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff @@ -3,12 +3,8 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+context.js(29,12): error TS2304: Cannot find name 'Input'. +context.js(34,14): error TS2350: Only a void function can be called with the 'new' keyword. -+context.js(40,16): error TS2304: Cannot find name 'Input'. -+context.js(42,18): error TS2304: Cannot find name 'State'. +context.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+hook.js(5,12): error TS2304: Cannot find name 'HookHandler'. +hook.js(10,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + @@ -23,14 +19,12 @@ + module.exports = Timer; + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+==== hook.js (2 errors) ==== ++==== hook.js (1 errors) ==== + /** + * @typedef {(arg: import("./context")) => void} HookHandler + */ + /** + * @param {HookHandler} handle -+ ~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'HookHandler'. + */ + function Hook(handle) { + this.handle = handle; @@ -39,7 +33,7 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== context.js (5 errors) ==== ++==== context.js (2 errors) ==== + /** + * Imports + * @@ -69,8 +63,6 @@ + * + * @class + * @param {Input} input -+ ~~~~~ -+!!! error TS2304: Cannot find name 'Input'. + */ + + function Context(input) { @@ -84,12 +76,8 @@ + Context.prototype = { + /** + * @param {Input} input -+ ~~~~~ -+!!! error TS2304: Cannot find name 'Input'. + * @param {HookHandler=} handle + * @returns {State} -+ ~~~~~ -+!!! error TS2304: Cannot find name 'State'. + */ + construct(input, handle = () => void 0) { + return input; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt index cd9c5cdf28..4257e9ac23 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt @@ -1,4 +1,3 @@ -referencer.js(4,12): error TS2749: 'Point' refers to a value, but is being used as a type here. Did you mean 'typeof Point'? source.js(7,16): error TS2350: Only a void function can be called with the 'new' keyword. @@ -17,13 +16,11 @@ source.js(7,16): error TS2350: Only a void function can be called with the 'new' this.y = y; } -==== referencer.js (1 errors) ==== +==== referencer.js (0 errors) ==== import {Point} from "./source"; /** * @param {Point} p - ~~~~~ -!!! error TS2749: 'Point' refers to a value, but is being used as a type here. Did you mean 'typeof Point'? */ export function magnitude(p) { return Math.sqrt(p.x ** 2 + p.y ** 2); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt.diff index 142d50e852..3ea0bd366c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt.diff @@ -3,7 +3,6 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+referencer.js(4,12): error TS2749: 'Point' refers to a value, but is being used as a type here. Did you mean 'typeof Point'? +source.js(7,16): error TS2350: Only a void function can be called with the 'new' keyword. + + @@ -22,13 +21,11 @@ + this.y = y; + } + -+==== referencer.js (1 errors) ==== ++==== referencer.js (0 errors) ==== + import {Point} from "./source"; + + /** + * @param {Point} p -+ ~~~~~ -+!!! error TS2749: 'Point' refers to a value, but is being used as a type here. Did you mean 'typeof Point'? + */ + export function magnitude(p) { + return Math.sqrt(p.x ** 2 + p.y ** 2); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt index ab252908a8..3aedf38175 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt @@ -1,9 +1,8 @@ referencer.js(3,23): error TS2350: Only a void function can be called with the 'new' keyword. -source.js(13,16): error TS2749: 'Vec' refers to a value, but is being used as a type here. Did you mean 'typeof Vec'? source.js(40,16): error TS2350: Only a void function can be called with the 'new' keyword. -==== source.js (2 errors) ==== +==== source.js (1 errors) ==== /** * @param {number} len */ @@ -17,8 +16,6 @@ source.js(40,16): error TS2350: Only a void function can be called with the 'new Vec.prototype = { /** * @param {Vec} other - ~~~ -!!! error TS2749: 'Vec' refers to a value, but is being used as a type here. Did you mean 'typeof Vec'? */ dot(other) { if (other.storage.length !== this.storage.length) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt.diff index 123f6c5506..88d60fa3dd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt.diff @@ -4,11 +4,10 @@ - @@= skipped --1, +1 lines =@@ +referencer.js(3,23): error TS2350: Only a void function can be called with the 'new' keyword. -+source.js(13,16): error TS2749: 'Vec' refers to a value, but is being used as a type here. Did you mean 'typeof Vec'? +source.js(40,16): error TS2350: Only a void function can be called with the 'new' keyword. + + -+==== source.js (2 errors) ==== ++==== source.js (1 errors) ==== + /** + * @param {number} len + */ @@ -22,8 +21,6 @@ + Vec.prototype = { + /** + * @param {Vec} other -+ ~~~ -+!!! error TS2749: 'Vec' refers to a value, but is being used as a type here. Did you mean 'typeof Vec'? + */ + dot(other) { + if (other.storage.length !== this.storage.length) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt deleted file mode 100644 index 89beafd9ee..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt +++ /dev/null @@ -1,76 +0,0 @@ -index.js(18,12): error TS2304: Cannot find name 'T'. -index.js(19,12): error TS2304: Cannot find name 'U'. -index.js(20,13): error TS2304: Cannot find name 'T'. -index.js(20,17): error TS2304: Cannot find name 'U'. -index.js(26,12): error TS2304: Cannot find name 'T'. - - -==== index.js (5 errors) ==== - export function a() {} - - export function b() {} - b.cat = "cat"; - - export function c() {} - c.Cls = class {} - - /** - * @param {number} a - * @param {number} b - * @return {string} - */ - export function d(a, b) { return /** @type {*} */(null); } - - /** - * @template T,U - * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. - * @param {U} b - ~ -!!! error TS2304: Cannot find name 'U'. - * @return {T & U} - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'U'. - */ - export function e(a, b) { return /** @type {*} */(null); } - - /** - * @template T - * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. - */ - export function f(a) { - return a; - } - f.self = f; - - /** - * @param {{x: string}} a - * @param {{y: typeof b}} b - */ - function g(a, b) { - return a.x && b.y(); - } - - export { g }; - - /** - * @param {{x: string}} a - * @param {{y: typeof b}} b - */ - function hh(a, b) { - return a.x && b.y(); - } - - export { hh as h }; - - export function i() {} - export { i as ii }; - - export { j as jj }; - export function j() {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt.diff deleted file mode 100644 index c4025181cd..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt.diff +++ /dev/null @@ -1,81 +0,0 @@ ---- old.jsDeclarationsFunctions.errors.txt -+++ new.jsDeclarationsFunctions.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(18,12): error TS2304: Cannot find name 'T'. -+index.js(19,12): error TS2304: Cannot find name 'U'. -+index.js(20,13): error TS2304: Cannot find name 'T'. -+index.js(20,17): error TS2304: Cannot find name 'U'. -+index.js(26,12): error TS2304: Cannot find name 'T'. -+ -+ -+==== index.js (5 errors) ==== -+ export function a() {} -+ -+ export function b() {} -+ b.cat = "cat"; -+ -+ export function c() {} -+ c.Cls = class {} -+ -+ /** -+ * @param {number} a -+ * @param {number} b -+ * @return {string} -+ */ -+ export function d(a, b) { return /** @type {*} */(null); } -+ -+ /** -+ * @template T,U -+ * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @param {U} b -+ ~ -+!!! error TS2304: Cannot find name 'U'. -+ * @return {T & U} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'U'. -+ */ -+ export function e(a, b) { return /** @type {*} */(null); } -+ -+ /** -+ * @template T -+ * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ export function f(a) { -+ return a; -+ } -+ f.self = f; -+ -+ /** -+ * @param {{x: string}} a -+ * @param {{y: typeof b}} b -+ */ -+ function g(a, b) { -+ return a.x && b.y(); -+ } -+ -+ export { g }; -+ -+ /** -+ * @param {{x: string}} a -+ * @param {{y: typeof b}} b -+ */ -+ function hh(a, b) { -+ return a.x && b.y(); -+ } -+ -+ export { hh as h }; -+ -+ export function i() {} -+ export { i as ii }; -+ -+ export { j as jj }; -+ export function j() {} -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols index 7c366d06b6..4722a46367 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols @@ -68,12 +68,8 @@ function g(a, b) { >b : Symbol(b, Decl(index.js, 36, 13)) return a.x && b.y(); ->a.x : Symbol(x, Decl(index.js, 33, 12)) >a : Symbol(a, Decl(index.js, 36, 11)) ->x : Symbol(x, Decl(index.js, 33, 12)) ->b.y : Symbol(y, Decl(index.js, 34, 12)) >b : Symbol(b, Decl(index.js, 36, 13)) ->y : Symbol(y, Decl(index.js, 34, 12)) } export { g }; @@ -89,12 +85,8 @@ function hh(a, b) { >b : Symbol(b, Decl(index.js, 46, 14)) return a.x && b.y(); ->a.x : Symbol(x, Decl(index.js, 43, 12)) >a : Symbol(a, Decl(index.js, 46, 12)) ->x : Symbol(x, Decl(index.js, 43, 12)) ->b.y : Symbol(y, Decl(index.js, 44, 12)) >b : Symbol(b, Decl(index.js, 46, 14)) ->y : Symbol(y, Decl(index.js, 44, 12)) } export { hh as h }; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols.diff index 7b851080df..2035423afc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols.diff @@ -52,3 +52,29 @@ /** * @param {{x: string}} a +@@= skipped -22, +22 lines =@@ + >b : Symbol(b, Decl(index.js, 36, 13)) + + return a.x && b.y(); +->a.x : Symbol(x, Decl(index.js, 33, 12)) + >a : Symbol(a, Decl(index.js, 36, 11)) +->x : Symbol(x, Decl(index.js, 33, 12)) +->b.y : Symbol(y, Decl(index.js, 34, 12)) + >b : Symbol(b, Decl(index.js, 36, 13)) +->y : Symbol(y, Decl(index.js, 34, 12)) + } + + export { g }; +@@= skipped -21, +17 lines =@@ + >b : Symbol(b, Decl(index.js, 46, 14)) + + return a.x && b.y(); +->a.x : Symbol(x, Decl(index.js, 43, 12)) + >a : Symbol(a, Decl(index.js, 46, 12)) +->x : Symbol(x, Decl(index.js, 43, 12)) +->b.y : Symbol(y, Decl(index.js, 44, 12)) + >b : Symbol(b, Decl(index.js, 46, 14)) +->y : Symbol(y, Decl(index.js, 44, 12)) + } + + export { hh as h }; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt index 263140ef38..11aee39fcc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt @@ -8,9 +8,7 @@ index.js(22,1): error TS2580: Cannot find name 'module'. Do you need to install index.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(31,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(31,25): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -index.js(35,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(41,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -index.js(45,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(51,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(53,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(54,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -20,7 +18,7 @@ index.js(57,21): error TS2580: Cannot find name 'module'. Do you need to install index.js(58,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== index.js (20 errors) ==== +==== index.js (18 errors) ==== module.exports.a = function a() {} ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -76,8 +74,6 @@ index.js(58,1): error TS2580: Cannot find name 'module'. Do you need to install /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b - ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. */ function g(a, b) { return a.x && b.y(); @@ -90,8 +86,6 @@ index.js(58,1): error TS2580: Cannot find name 'module'. Do you need to install /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b - ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. */ function hh(a, b) { return a.x && b.y(); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff index 1d33520fdf..a627695439 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff @@ -13,9 +13,7 @@ +index.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(31,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(31,25): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+index.js(35,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(41,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+index.js(45,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(51,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(53,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(54,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -25,7 +23,7 @@ +index.js(58,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== index.js (20 errors) ==== ++==== index.js (18 errors) ==== + module.exports.a = function a() {} + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -81,8 +79,6 @@ + /** + * @param {{x: string}} a + * @param {{y: typeof module.exports.b}} b -+ ~~~~~~ -+!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + function g(a, b) { + return a.x && b.y(); @@ -95,8 +91,6 @@ + /** + * @param {{x: string}} a + * @param {{y: typeof module.exports.b}} b -+ ~~~~~~ -+!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + function hh(a, b) { + return a.x && b.y(); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols index 2d71c847d6..23c01b990e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols @@ -58,12 +58,8 @@ function g(a, b) { >b : Symbol(b, Decl(index.js, 36, 13)) return a.x && b.y(); ->a.x : Symbol(x, Decl(index.js, 33, 12)) >a : Symbol(a, Decl(index.js, 36, 11)) ->x : Symbol(x, Decl(index.js, 33, 12)) ->b.y : Symbol(y, Decl(index.js, 34, 12)) >b : Symbol(b, Decl(index.js, 36, 13)) ->y : Symbol(y, Decl(index.js, 34, 12)) } module.exports.g = g; @@ -79,12 +75,8 @@ function hh(a, b) { >b : Symbol(b, Decl(index.js, 46, 14)) return a.x && b.y(); ->a.x : Symbol(x, Decl(index.js, 43, 12)) >a : Symbol(a, Decl(index.js, 46, 12)) ->x : Symbol(x, Decl(index.js, 43, 12)) ->b.y : Symbol(y, Decl(index.js, 44, 12)) >b : Symbol(b, Decl(index.js, 46, 14)) ->y : Symbol(y, Decl(index.js, 44, 12)) } module.exports.h = hh; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols.diff index 495b153c83..15a1c0b4c3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols.diff @@ -102,7 +102,16 @@ /** * @param {{x: string}} a -@@= skipped -32, +20 lines =@@ +@@= skipped -23, +11 lines =@@ + >b : Symbol(b, Decl(index.js, 36, 13)) + + return a.x && b.y(); +->a.x : Symbol(x, Decl(index.js, 33, 12)) + >a : Symbol(a, Decl(index.js, 36, 11)) +->x : Symbol(x, Decl(index.js, 33, 12)) +->b.y : Symbol(y, Decl(index.js, 34, 12)) + >b : Symbol(b, Decl(index.js, 36, 13)) +->y : Symbol(y, Decl(index.js, 34, 12)) } module.exports.g = g; @@ -114,7 +123,16 @@ >g : Symbol(g, Decl(index.js, 30, 41)) /** -@@= skipped -26, +21 lines =@@ +@@= skipped -26, +17 lines =@@ + >b : Symbol(b, Decl(index.js, 46, 14)) + + return a.x && b.y(); +->a.x : Symbol(x, Decl(index.js, 43, 12)) + >a : Symbol(a, Decl(index.js, 46, 12)) +->x : Symbol(x, Decl(index.js, 43, 12)) +->b.y : Symbol(y, Decl(index.js, 44, 12)) + >b : Symbol(b, Decl(index.js, 46, 14)) +->y : Symbol(y, Decl(index.js, 44, 12)) } module.exports.h = hh; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt deleted file mode 100644 index 46462e31e8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt +++ /dev/null @@ -1,61 +0,0 @@ -file.js(4,11): error TS2315: Type 'Object' is not generic. -file2.js(6,11): error TS2315: Type 'Object' is not generic. -file2.js(17,12): error TS2503: Cannot find namespace 'testFnTypes'. - - -==== file.js (1 errors) ==== - /** - * @namespace myTypes - * @global - * @type {Object} - ~~~~~~~~~~~~~~~~ -!!! error TS2315: Type 'Object' is not generic. - */ - const myTypes = { - // SOME PROPS HERE - }; - - /** @typedef {string|RegExp|Array} myTypes.typeA */ - - /** - * @typedef myTypes.typeB - * @property {myTypes.typeA} prop1 - Prop 1. - * @property {string} prop2 - Prop 2. - */ - - /** @typedef {myTypes.typeB|Function} myTypes.typeC */ - - export {myTypes}; -==== file2.js (2 errors) ==== - import {myTypes} from './file.js'; - - /** - * @namespace testFnTypes - * @global - * @type {Object} - ~~~~~~~~~~~~~~~~ -!!! error TS2315: Type 'Object' is not generic. - */ - const testFnTypes = { - // SOME PROPS HERE - }; - - /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ - - /** - * @function testFn - * @description A test function. - * @param {testFnTypes.input} input - Input. - ~~~~~~~~~~~ -!!! error TS2503: Cannot find namespace 'testFnTypes'. - * @returns {number|null} Result. - */ - function testFn(input) { - if (typeof input === 'number') { - return 2 * input; - } else { - return null; - } - } - - export {testFn, testFnTypes}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff index e5e5da07a4..818f900585 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff @@ -1,48 +1,60 @@ --- old.jsDeclarationsImportAliasExposedWithinNamespace.errors.txt +++ new.jsDeclarationsImportAliasExposedWithinNamespace.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -file2.js(1,9): error TS18042: 'myTypes' is a type and cannot be imported in JavaScript files. Use 'import("./file.js").myTypes' in a JSDoc type annotation. -+file.js(4,11): error TS2315: Type 'Object' is not generic. -+file2.js(6,11): error TS2315: Type 'Object' is not generic. -+file2.js(17,12): error TS2503: Cannot find namespace 'testFnTypes'. - - +- +- -==== file.js (0 errors) ==== -+==== file.js (1 errors) ==== - /** - * @namespace myTypes - * @global - * @type {Object} -+ ~~~~~~~~~~~~~~~~ -+!!! error TS2315: Type 'Object' is not generic. - */ - const myTypes = { - // SOME PROPS HERE -@@= skipped -21, +25 lines =@@ - /** @typedef {myTypes.typeB|Function} myTypes.typeC */ - - export {myTypes}; +- /** +- * @namespace myTypes +- * @global +- * @type {Object} +- */ +- const myTypes = { +- // SOME PROPS HERE +- }; +- +- /** @typedef {string|RegExp|Array} myTypes.typeA */ +- +- /** +- * @typedef myTypes.typeB +- * @property {myTypes.typeA} prop1 - Prop 1. +- * @property {string} prop2 - Prop 2. +- */ +- +- /** @typedef {myTypes.typeB|Function} myTypes.typeC */ +- +- export {myTypes}; -==== file2.js (1 errors) ==== -+==== file2.js (2 errors) ==== - import {myTypes} from './file.js'; +- import {myTypes} from './file.js'; - ~~~~~~~ -!!! error TS18042: 'myTypes' is a type and cannot be imported in JavaScript files. Use 'import("./file.js").myTypes' in a JSDoc type annotation. - - /** - * @namespace testFnTypes - * @global - * @type {Object} -+ ~~~~~~~~~~~~~~~~ -+!!! error TS2315: Type 'Object' is not generic. - */ - const testFnTypes = { - // SOME PROPS HERE -@@= skipped -20, +20 lines =@@ - * @function testFn - * @description A test function. - * @param {testFnTypes.input} input - Input. -+ ~~~~~~~~~~~ -+!!! error TS2503: Cannot find namespace 'testFnTypes'. - * @returns {number|null} Result. - */ - function testFn(input) { +- +- /** +- * @namespace testFnTypes +- * @global +- * @type {Object} +- */ +- const testFnTypes = { +- // SOME PROPS HERE +- }; +- +- /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ +- +- /** +- * @function testFn +- * @description A test function. +- * @param {testFnTypes.input} input - Input. +- * @returns {number|null} Result. +- */ +- function testFn(input) { +- if (typeof input === 'number') { +- return 2 * input; +- } else { +- return null; +- } +- } +- +- export {testFn, testFnTypes}; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt index 59f5a69936..927a6ecac4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt @@ -1,10 +1,8 @@ file2.js(1,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -file2.js(6,11): error TS2315: Type 'Object' is not generic. -file2.js(17,12): error TS2503: Cannot find namespace 'testFnTypes'. file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== file2.js (4 errors) ==== +==== file2.js (2 errors) ==== const {myTypes} = require('./file.js'); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -13,8 +11,6 @@ file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install * @namespace testFnTypes * @global * @type {Object} - ~~~~~~~~~~~~~~~~ -!!! error TS2315: Type 'Object' is not generic. */ const testFnTypes = { // SOME PROPS HERE @@ -26,8 +22,6 @@ file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install * @function testFn * @description A test function. * @param {testFnTypes.input} input - Input. - ~~~~~~~~~~~ -!!! error TS2503: Cannot find namespace 'testFnTypes'. * @returns {number|null} Result. */ function testFn(input) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff index 5b87602da7..eec1b597c4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff @@ -4,12 +4,10 @@ - @@= skipped --1, +1 lines =@@ +file2.js(1,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+file2.js(6,11): error TS2315: Type 'Object' is not generic. -+file2.js(17,12): error TS2503: Cannot find namespace 'testFnTypes'. +file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== file2.js (4 errors) ==== ++==== file2.js (2 errors) ==== + const {myTypes} = require('./file.js'); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -18,8 +16,6 @@ + * @namespace testFnTypes + * @global + * @type {Object} -+ ~~~~~~~~~~~~~~~~ -+!!! error TS2315: Type 'Object' is not generic. + */ + const testFnTypes = { + // SOME PROPS HERE @@ -31,8 +27,6 @@ + * @function testFn + * @description A test function. + * @param {testFnTypes.input} input - Input. -+ ~~~~~~~~~~~ -+!!! error TS2503: Cannot find namespace 'testFnTypes'. + * @returns {number|null} Result. + */ + function testFn(input) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt deleted file mode 100644 index 8634dc2259..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -file.js(2,29): error TS2694: Namespace '"mod1"' has no exported member 'Dotted'. - - -==== file.js (1 errors) ==== - import { dummy } from './mod1' - /** @type {import('./mod1').Dotted.Name} - should work */ - ~~~~~~ -!!! error TS2694: Namespace '"mod1"' has no exported member 'Dotted'. - var dot2 - -==== mod1.js (0 errors) ==== - /** @typedef {number} Dotted.Name */ - export var dummy = 1 - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt.diff deleted file mode 100644 index ce41044958..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.jsDeclarationsImportNamespacedType.errors.txt -+++ new.jsDeclarationsImportNamespacedType.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+file.js(2,29): error TS2694: Namespace '"mod1"' has no exported member 'Dotted'. -+ -+ -+==== file.js (1 errors) ==== -+ import { dummy } from './mod1' -+ /** @type {import('./mod1').Dotted.Name} - should work */ -+ ~~~~~~ -+!!! error TS2694: Namespace '"mod1"' has no exported member 'Dotted'. -+ var dot2 -+ -+==== mod1.js (0 errors) ==== -+ /** @typedef {number} Dotted.Name */ -+ export var dummy = 1 -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt index 16ceee1f85..46cd155399 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt @@ -1,16 +1,13 @@ -folder/mod1.js(5,11): error TS2304: Cannot find name 'Item'. folder/mod1.js(8,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(3,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== folder/mod1.js (2 errors) ==== +==== folder/mod1.js (1 errors) ==== /** * @typedef {{x: number}} Item */ /** * @type {Item}; - ~~~~ -!!! error TS2304: Cannot find name 'Item'. */ const x = {x: 12}; module.exports = x; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff index e2caeaacf5..071cda2aad 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff @@ -3,19 +3,16 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+folder/mod1.js(5,11): error TS2304: Cannot find name 'Item'. +folder/mod1.js(8,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(3,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== folder/mod1.js (2 errors) ==== ++==== folder/mod1.js (1 errors) ==== + /** + * @typedef {{x: number}} Item + */ + /** + * @type {Item}; -+ ~~~~ -+!!! error TS2304: Cannot find name 'Item'. + */ + const x = {x: 12}; + module.exports = x; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt deleted file mode 100644 index 38ff884b7d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt +++ /dev/null @@ -1,60 +0,0 @@ -index.js(5,12): error TS2304: Cannot find name 'Void'. -index.js(6,12): error TS2304: Cannot find name 'Undefined'. -index.js(7,12): error TS2304: Cannot find name 'Null'. -index.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -index.js(11,12): error TS2552: Cannot find name 'array'. Did you mean 'Array'? -index.js(12,12): error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? -index.js(13,12): error TS2315: Type 'Object' is not generic. -index.js(30,12): error TS2749: 'event' refers to a value, but is being used as a type here. Did you mean 'typeof event'? - - -==== index.js (8 errors) ==== - // these are recognized as TS concepts by the checker - /** @type {String} */const a = ""; - /** @type {Number} */const b = 0; - /** @type {Boolean} */const c = true; - /** @type {Void} */const d = undefined; - ~~~~ -!!! error TS2304: Cannot find name 'Void'. - /** @type {Undefined} */const e = undefined; - ~~~~~~~~~ -!!! error TS2304: Cannot find name 'Undefined'. - /** @type {Null} */const f = null; - ~~~~ -!!! error TS2304: Cannot find name 'Null'. - - /** @type {Function} */const g = () => void 0; - /** @type {function} */const h = () => void 0; - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - /** @type {array} */const i = []; - ~~~~~ -!!! error TS2552: Cannot find name 'array'. Did you mean 'Array'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Array' is declared here. - /** @type {promise} */const j = Promise.resolve(0); - ~~~~~~~ -!!! error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? -!!! related TS2728 lib.es2015.promise.d.ts:--:--: 'Promise' is declared here. - /** @type {Object} */const k = {x: "x"}; - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2315: Type 'Object' is not generic. - - - // these are not recognized as anything and should just be lookup failures - // ignore the errors to try to ensure they're emitted as `any` in declaration emit - // @ts-ignore - /** @type {class} */const l = true; - // @ts-ignore - /** @type {bool} */const m = true; - // @ts-ignore - /** @type {int} */const n = true; - // @ts-ignore - /** @type {float} */const o = true; - // @ts-ignore - /** @type {integer} */const p = true; - - // or, in the case of `event` likely erroneously refers to the type of the global Event object - /** @type {event} */const q = undefined; - ~~~~~ -!!! error TS2749: 'event' refers to a value, but is being used as a type here. Did you mean 'typeof event'? \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt.diff deleted file mode 100644 index fd7f1f4724..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt.diff +++ /dev/null @@ -1,65 +0,0 @@ ---- old.jsDeclarationsJSDocRedirectedLookups.errors.txt -+++ new.jsDeclarationsJSDocRedirectedLookups.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(5,12): error TS2304: Cannot find name 'Void'. -+index.js(6,12): error TS2304: Cannot find name 'Undefined'. -+index.js(7,12): error TS2304: Cannot find name 'Null'. -+index.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+index.js(11,12): error TS2552: Cannot find name 'array'. Did you mean 'Array'? -+index.js(12,12): error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? -+index.js(13,12): error TS2315: Type 'Object' is not generic. -+index.js(30,12): error TS2749: 'event' refers to a value, but is being used as a type here. Did you mean 'typeof event'? -+ -+ -+==== index.js (8 errors) ==== -+ // these are recognized as TS concepts by the checker -+ /** @type {String} */const a = ""; -+ /** @type {Number} */const b = 0; -+ /** @type {Boolean} */const c = true; -+ /** @type {Void} */const d = undefined; -+ ~~~~ -+!!! error TS2304: Cannot find name 'Void'. -+ /** @type {Undefined} */const e = undefined; -+ ~~~~~~~~~ -+!!! error TS2304: Cannot find name 'Undefined'. -+ /** @type {Null} */const f = null; -+ ~~~~ -+!!! error TS2304: Cannot find name 'Null'. -+ -+ /** @type {Function} */const g = () => void 0; -+ /** @type {function} */const h = () => void 0; -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. -+ /** @type {array} */const i = []; -+ ~~~~~ -+!!! error TS2552: Cannot find name 'array'. Did you mean 'Array'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Array' is declared here. -+ /** @type {promise} */const j = Promise.resolve(0); -+ ~~~~~~~ -+!!! error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? -+!!! related TS2728 lib.es2015.promise.d.ts:--:--: 'Promise' is declared here. -+ /** @type {Object} */const k = {x: "x"}; -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2315: Type 'Object' is not generic. -+ -+ -+ // these are not recognized as anything and should just be lookup failures -+ // ignore the errors to try to ensure they're emitted as `any` in declaration emit -+ // @ts-ignore -+ /** @type {class} */const l = true; -+ // @ts-ignore -+ /** @type {bool} */const m = true; -+ // @ts-ignore -+ /** @type {int} */const n = true; -+ // @ts-ignore -+ /** @type {float} */const o = true; -+ // @ts-ignore -+ /** @type {integer} */const p = true; -+ -+ // or, in the case of `event` likely erroneously refers to the type of the global Event object -+ /** @type {event} */const q = undefined; -+ ~~~~~ -+!!! error TS2749: 'event' refers to a value, but is being used as a type here. Did you mean 'typeof event'? diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt deleted file mode 100644 index d4557d9119..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -file.js(2,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -file.js(6,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). - - -==== file.js (2 errors) ==== - /** - * @param {Array} x - ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - */ - function x(x) {} - /** - * @param {Promise} x - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). - */ - function y(x) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt.diff deleted file mode 100644 index 83d2307f9d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.jsDeclarationsMissingGenerics.errors.txt -+++ new.jsDeclarationsMissingGenerics.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+file.js(2,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+file.js(6,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -+ -+ -+==== file.js (2 errors) ==== -+ /** -+ * @param {Array} x -+ ~~~~~ -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). -+ */ -+ function x(x) {} -+ /** -+ * @param {Promise} x -+ ~~~~~~~ -+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). -+ */ -+ function y(x) {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt deleted file mode 100644 index f79329d29a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -file.js(12,14): error TS2314: Generic type 'T[]' requires 1 type argument(s). - - -==== file.js (1 errors) ==== - /** - * @param {Array=} y desc - */ - function x(y) { } - - // @ts-ignore - /** @param {function (Array)} func Invoked - */ - function y(func) { return; } - - /** - * @return {(Array.<> | null)} list of devices - ~~~~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - */ - function z() { return null ;} - - /** - * - * @return {?Promise} A promise - */ - function w() { return null; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff deleted file mode 100644 index 75f8386020..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.jsDeclarationsMissingTypeParameters.errors.txt -+++ new.jsDeclarationsMissingTypeParameters.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+file.js(12,14): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+ -+ -+==== file.js (1 errors) ==== -+ /** -+ * @param {Array=} y desc -+ */ -+ function x(y) { } -+ -+ // @ts-ignore -+ /** @param {function (Array)} func Invoked -+ */ -+ function y(func) { return; } -+ -+ /** -+ * @return {(Array.<> | null)} list of devices -+ ~~~~~~~~ -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). -+ */ -+ function z() { return null ;} -+ -+ /** -+ * -+ * @return {?Promise} A promise -+ */ -+ function w() { return null; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt deleted file mode 100644 index 30a9f935a7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -index.js(9,11): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. - - -==== index.js (1 errors) ==== - /** - * @module A - */ - class A {} - - - /** - * Target element - * @type {module:A} - ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. - */ - export let el = null; - - export default A; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff deleted file mode 100644 index 0b455a33c0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.jsDeclarationsModuleReferenceHasEmit.errors.txt -+++ new.jsDeclarationsModuleReferenceHasEmit.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(9,11): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+ -+ -+==== index.js (1 errors) ==== -+ /** -+ * @module A -+ */ -+ class A {} -+ -+ -+ /** -+ * Target element -+ * @type {module:A} -+ ~~~~~~ -+!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+ */ -+ export let el = null; -+ -+ export default A; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt index 4b3c334f6b..f19f51ad05 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt @@ -1,6 +1,4 @@ base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -file.js(11,25): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? -file.js(12,27): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? ==== base.js (1 errors) ==== @@ -18,7 +16,7 @@ file.js(12,27): error TS2749: 'BaseFactory' refers to a value, but is being used ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== file.js (2 errors) ==== +==== file.js (0 errors) ==== /** @typedef {import('./base')} BaseFactory */ /** * @callback BaseFactoryFactory @@ -30,11 +28,7 @@ file.js(12,27): error TS2749: 'BaseFactory' refers to a value, but is being used /** * * @param {InstanceType} base - ~~~~~~~~~~~ -!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? * @returns {InstanceType} - ~~~~~~~~~~~ -!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? */ const test = (base) => { return base; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff index 3b51d431a2..17b4baf21c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff @@ -4,8 +4,6 @@ - @@= skipped --1, +1 lines =@@ +base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+file.js(11,25): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? -+file.js(12,27): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + + +==== base.js (1 errors) ==== @@ -23,7 +21,7 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== file.js (2 errors) ==== ++==== file.js (0 errors) ==== + /** @typedef {import('./base')} BaseFactory */ + /** + * @callback BaseFactoryFactory @@ -35,11 +33,7 @@ + /** + * + * @param {InstanceType} base -+ ~~~~~~~~~~~ -+!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + * @returns {InstanceType} -+ ~~~~~~~~~~~ -+!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + */ + const test = (base) => { + return base; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt index 25954ffbb3..ad61ed984b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt @@ -1,6 +1,4 @@ base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -file.js(5,25): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? -file.js(6,27): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? ==== base.js (1 errors) ==== @@ -18,17 +16,13 @@ file.js(6,27): error TS2749: 'BaseFactory' refers to a value, but is being used ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== file.js (2 errors) ==== +==== file.js (0 errors) ==== /** @typedef {typeof import('./base')} BaseFactory */ /** * * @param {InstanceType} base - ~~~~~~~~~~~ -!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? * @returns {InstanceType} - ~~~~~~~~~~~ -!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? */ const test = (base) => { return base; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff index 9353abbb7d..88e0ccb660 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff @@ -4,8 +4,6 @@ - @@= skipped --1, +1 lines =@@ +base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+file.js(5,25): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? -+file.js(6,27): error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + + +==== base.js (1 errors) ==== @@ -23,17 +21,13 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== file.js (2 errors) ==== ++==== file.js (0 errors) ==== + /** @typedef {typeof import('./base')} BaseFactory */ + + /** + * + * @param {InstanceType} base -+ ~~~~~~~~~~~ -+!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + * @returns {InstanceType} -+ ~~~~~~~~~~~ -+!!! error TS2749: 'BaseFactory' refers to a value, but is being used as a type here. Did you mean 'typeof BaseFactory'? + */ + const test = (base) => { + return base; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt index 0925027326..3dc32347aa 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt @@ -2,7 +2,6 @@ jsDeclarationsReactComponents1.jsx(2,19): error TS2307: Cannot find module 'reac jsDeclarationsReactComponents1.jsx(3,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. jsDeclarationsReactComponents2.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. jsDeclarationsReactComponents3.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. -jsDeclarationsReactComponents3.jsx(3,73): error TS2503: Cannot find namespace 'JSX'. jsDeclarationsReactComponents4.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. jsDeclarationsReactComponents5.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. jsDeclarationsReactComponents5.jsx(2,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. @@ -56,14 +55,12 @@ jsDeclarationsReactComponents5.jsx(2,23): error TS2307: Cannot find module 'prop export default TabbedShowLayout; -==== jsDeclarationsReactComponents3.jsx (2 errors) ==== +==== jsDeclarationsReactComponents3.jsx (1 errors) ==== import React from "react"; ~~~~~~~ !!! error TS2307: Cannot find module 'react' or its corresponding type declarations. /** * @type {{defaultProps: {tabs: string}} & ((props?: {elem: string}) => JSX.Element)} - ~~~ -!!! error TS2503: Cannot find namespace 'JSX'. */ const TabbedShowLayout = () => { return ( diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt.diff index ba62b06bd8..17c105f385 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt.diff @@ -7,7 +7,6 @@ +jsDeclarationsReactComponents1.jsx(3,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. +jsDeclarationsReactComponents2.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. +jsDeclarationsReactComponents3.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. -+jsDeclarationsReactComponents3.jsx(3,73): error TS2503: Cannot find namespace 'JSX'. +jsDeclarationsReactComponents4.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. +jsDeclarationsReactComponents5.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. +jsDeclarationsReactComponents5.jsx(2,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. @@ -61,14 +60,12 @@ + + export default TabbedShowLayout; + -+==== jsDeclarationsReactComponents3.jsx (2 errors) ==== ++==== jsDeclarationsReactComponents3.jsx (1 errors) ==== + import React from "react"; + ~~~~~~~ +!!! error TS2307: Cannot find module 'react' or its corresponding type declarations. + /** + * @type {{defaultProps: {tabs: string}} & ((props?: {elem: string}) => JSX.Element)} -+ ~~~ -+!!! error TS2503: Cannot find namespace 'JSX'. + */ + const TabbedShowLayout = () => { + return ( diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols index 7c1a3b5659..7f520e1d80 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols @@ -94,9 +94,7 @@ const TabbedShowLayout = () => { }; TabbedShowLayout.defaultProps = { ->TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) >TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents3.jsx, 4, 5)) ->defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) tabs: "default value" >tabs : Symbol(tabs, Decl(jsDeclarationsReactComponents3.jsx, 12, 33)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff index fd956083bf..98ae603506 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff @@ -108,13 +108,14 @@ }; TabbedShowLayout.defaultProps = { - >TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) +->TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) ->TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents3.jsx, 4, 5), Decl(jsDeclarationsReactComponents3.jsx, 10, 2)) +->defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) +>TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents3.jsx, 4, 5)) - >defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) tabs: "default value" -@@= skipped -26, +23 lines =@@ + >tabs : Symbol(tabs, Decl(jsDeclarationsReactComponents3.jsx, 12, 33)) +@@= skipped -26, +21 lines =@@ }; export default TabbedShowLayout; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt deleted file mode 100644 index e15b2747c9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt +++ /dev/null @@ -1,38 +0,0 @@ -index.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -index.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -index.js(22,12): error TS2315: Type 'Object' is not generic. - - -==== index.js (3 errors) ==== - /** @type {?} */ - export const a = null; - - /** @type {*} */ - export const b = null; - - /** @type {string?} */ - export const c = null; - - /** @type {string=} */ - export const d = null; - - /** @type {string!} */ - export const e = null; - - /** @type {function(string, number): object} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - export const f = null; - - /** @type {function(new: object, string, number)} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - export const g = null; - - /** @type {Object.} */ - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2315: Type 'Object' is not generic. - export const h = null; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff deleted file mode 100644 index 8d93f3c93b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff +++ /dev/null @@ -1,43 +0,0 @@ ---- old.jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt -+++ new.jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+index.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+index.js(22,12): error TS2315: Type 'Object' is not generic. -+ -+ -+==== index.js (3 errors) ==== -+ /** @type {?} */ -+ export const a = null; -+ -+ /** @type {*} */ -+ export const b = null; -+ -+ /** @type {string?} */ -+ export const c = null; -+ -+ /** @type {string=} */ -+ export const d = null; -+ -+ /** @type {string!} */ -+ export const e = null; -+ -+ /** @type {function(string, number): object} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. -+ export const f = null; -+ -+ /** @type {function(new: object, string, number)} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. -+ export const g = null; -+ -+ /** @type {Object.} */ -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2315: Type 'Object' is not generic. -+ export const h = null; -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt index 153eb09137..45186dc6b4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt @@ -1,4 +1,3 @@ -mixed.js(6,14): error TS2304: Cannot find name 'SomeType'. mixed.js(14,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -30,15 +29,13 @@ mixed.js(14,1): error TS2580: Cannot find name 'module'. Do you need to install * @returns {T} */ -==== mixed.js (2 errors) ==== +==== mixed.js (1 errors) ==== /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType */ /** * @param {number} x * @returns {SomeType} - ~~~~~~~~ -!!! error TS2304: Cannot find name 'SomeType'. */ function doTheThing(x) { return {x: ""+x}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt.diff index a73ae0a0e9..4d6fadf8b9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt.diff @@ -3,7 +3,6 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+mixed.js(6,14): error TS2304: Cannot find name 'SomeType'. +mixed.js(14,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + @@ -35,15 +34,13 @@ + * @returns {T} + */ + -+==== mixed.js (2 errors) ==== ++==== mixed.js (1 errors) ==== + /** + * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType + */ + /** + * @param {number} x + * @returns {SomeType} -+ ~~~~~~~~ -+!!! error TS2304: Cannot find name 'SomeType'. + */ + function doTheThing(x) { + return {x: ""+x}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt index bb5abdfa34..c077de5eb6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt @@ -1,5 +1,4 @@ conn.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -usage.js(7,16): error TS2304: Cannot find name 'Conn'. usage.js(10,14): error TS2339: Property 'connItem' does not exist on type 'Wrap'. usage.js(12,14): error TS2339: Property 'another' does not exist on type 'Wrap'. usage.js(16,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -20,7 +19,7 @@ usage.js(16,1): error TS2580: Cannot find name 'module'. Do you need to install ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== usage.js (4 errors) ==== +==== usage.js (3 errors) ==== /** * @typedef {import("./conn")} Conn */ @@ -28,8 +27,6 @@ usage.js(16,1): error TS2580: Cannot find name 'module'. Do you need to install class Wrap { /** * @param {Conn} c - ~~~~ -!!! error TS2304: Cannot find name 'Conn'. */ constructor(c) { this.connItem = c.item; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff index add040f1db..4e172cc4ee 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff @@ -4,7 +4,6 @@ - @@= skipped --1, +1 lines =@@ +conn.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+usage.js(7,16): error TS2304: Cannot find name 'Conn'. +usage.js(10,14): error TS2339: Property 'connItem' does not exist on type 'Wrap'. +usage.js(12,14): error TS2339: Property 'another' does not exist on type 'Wrap'. +usage.js(16,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -25,7 +24,7 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== usage.js (4 errors) ==== ++==== usage.js (3 errors) ==== + /** + * @typedef {import("./conn")} Conn + */ @@ -33,8 +32,6 @@ + class Wrap { + /** + * @param {Conn} c -+ ~~~~ -+!!! error TS2304: Cannot find name 'Conn'. + */ + constructor(c) { + this.connItem = c.item; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt index 48fc6a2824..a550fd267d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt @@ -1,16 +1,13 @@ LazySet.js(13,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(1,17): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -index.js(3,12): error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== const LazySet = require("./LazySet"); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @type {LazySet} */ - ~~~~~~~ -!!! error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? const stringSet = undefined; stringSet.addAll(stringSet); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff index e8f0b635bd..c9b7a1ae44 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff @@ -5,17 +5,14 @@ @@= skipped --1, +1 lines =@@ +LazySet.js(13,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(1,17): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+index.js(3,12): error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? + + -+==== index.js (2 errors) ==== ++==== index.js (1 errors) ==== + const LazySet = require("./LazySet"); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + /** @type {LazySet} */ -+ ~~~~~~~ -+!!! error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? + const stringSet = undefined; + stringSet.addAll(stringSet); + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt deleted file mode 100644 index a3e60af524..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -foo.js(10,12): error TS2304: Cannot find name 'ResolveRejectMap'. - - -==== foo.js (1 errors) ==== - /** - * @typedef {{ - * [id: string]: [Function, Function]; - * }} ResolveRejectMap - */ - - let id = 0 - - /** - * @param {ResolveRejectMap} handlers - ~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'ResolveRejectMap'. - * @returns {Promise} - */ - const send = handlers => new Promise((resolve, reject) => { - handlers[++id] = [resolve, reject] - }) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt.diff deleted file mode 100644 index 7767b47ca0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.jsDeclarationsTypedefFunction.errors.txt -+++ new.jsDeclarationsTypedefFunction.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+foo.js(10,12): error TS2304: Cannot find name 'ResolveRejectMap'. -+ -+ -+==== foo.js (1 errors) ==== -+ /** -+ * @typedef {{ -+ * [id: string]: [Function, Function]; -+ * }} ResolveRejectMap -+ */ -+ -+ let id = 0 -+ -+ /** -+ * @param {ResolveRejectMap} handlers -+ ~~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'ResolveRejectMap'. -+ * @returns {Promise} -+ */ -+ const send = handlers => new Promise((resolve, reject) => { -+ handlers[++id] = [resolve, reject] -+ }) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt index a28a1bb62e..871a4cb6f7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt @@ -1,10 +1,8 @@ index.js(1,39): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -index.js(15,16): error TS2304: Cannot find name 'TaskGroup'. -index.js(16,16): error TS2304: Cannot find name 'TaskNode'. index.js(21,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== index.js (4 errors) ==== +==== index.js (2 errors) ==== const {taskGroups, taskNameToGroup} = require('./module.js'); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -22,11 +20,7 @@ index.js(21,1): error TS2580: Cannot find name 'module'. Do you need to install class MainThreadTasks { /** * @param {TaskGroup} x - ~~~~~~~~~ -!!! error TS2304: Cannot find name 'TaskGroup'. * @param {TaskNode} y - ~~~~~~~~ -!!! error TS2304: Cannot find name 'TaskNode'. */ constructor(x, y){} } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff index 12ec6eec81..5b098b29d9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff @@ -4,12 +4,10 @@ - @@= skipped --1, +1 lines =@@ +index.js(1,39): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+index.js(15,16): error TS2304: Cannot find name 'TaskGroup'. -+index.js(16,16): error TS2304: Cannot find name 'TaskNode'. +index.js(21,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== index.js (4 errors) ==== ++==== index.js (2 errors) ==== + const {taskGroups, taskNameToGroup} = require('./module.js'); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -27,11 +25,7 @@ + class MainThreadTasks { + /** + * @param {TaskGroup} x -+ ~~~~~~~~~ -+!!! error TS2304: Cannot find name 'TaskGroup'. + * @param {TaskNode} y -+ ~~~~~~~~ -+!!! error TS2304: Cannot find name 'TaskNode'. + */ + constructor(x, y){} + } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt deleted file mode 100644 index 4903c8be4b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -b.js(2,28): error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. -b.js(3,26): error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. - - -==== a.js (0 errors) ==== - export const kSymbol = Symbol("my-symbol"); - - /** - * @typedef {{[kSymbol]: true}} WithSymbol - */ -==== b.js (2 errors) ==== - /** - * @returns {import('./a').WithSymbol} - ~~~~~~~~~~ -!!! error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. - * @param {import('./a').WithSymbol} value - ~~~~~~~~~~ -!!! error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. - */ - export function b(value) { - return value; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff deleted file mode 100644 index dd3cb451d4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.jsDeclarationsUniqueSymbolUsage.errors.txt -+++ new.jsDeclarationsUniqueSymbolUsage.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+b.js(2,28): error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. -+b.js(3,26): error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. -+ -+ -+==== a.js (0 errors) ==== -+ export const kSymbol = Symbol("my-symbol"); -+ -+ /** -+ * @typedef {{[kSymbol]: true}} WithSymbol -+ */ -+==== b.js (2 errors) ==== -+ /** -+ * @returns {import('./a').WithSymbol} -+ ~~~~~~~~~~ -+!!! error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. -+ * @param {import('./a').WithSymbol} value -+ ~~~~~~~~~~ -+!!! error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. -+ */ -+ export function b(value) { -+ return value; -+ } -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt deleted file mode 100644 index 0ecef16650..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -jsdocConstructorFunctionTypeReference.js(8,12): error TS2749: 'Validator' refers to a value, but is being used as a type here. Did you mean 'typeof Validator'? - - -==== jsdocConstructorFunctionTypeReference.js (1 errors) ==== - var Validator = function VFunc() { - this.flags = "gim" - }; - - Validator.prototype.num = 12 - - /** - * @param {Validator} state - ~~~~~~~~~ -!!! error TS2749: 'Validator' refers to a value, but is being used as a type here. Did you mean 'typeof Validator'? - */ - var validateRegExpFlags = function(state) { - return state.flags - }; - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt.diff deleted file mode 100644 index c21b318347..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.jsdocConstructorFunctionTypeReference.errors.txt -+++ new.jsdocConstructorFunctionTypeReference.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+jsdocConstructorFunctionTypeReference.js(8,12): error TS2749: 'Validator' refers to a value, but is being used as a type here. Did you mean 'typeof Validator'? -+ -+ -+==== jsdocConstructorFunctionTypeReference.js (1 errors) ==== -+ var Validator = function VFunc() { -+ this.flags = "gim" -+ }; -+ -+ Validator.prototype.num = 12 -+ -+ /** -+ * @param {Validator} state -+ ~~~~~~~~~ -+!!! error TS2749: 'Validator' refers to a value, but is being used as a type here. Did you mean 'typeof Validator'? -+ */ -+ var validateRegExpFlags = function(state) { -+ return state.flags -+ }; -+ -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt index 47d91d1ee9..daecd7a134 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt @@ -1,24 +1,17 @@ -functions.js(3,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? functions.js(5,14): error TS7006: Parameter 'c' implicitly has an 'any' type. functions.js(9,23): error TS7006: Parameter 'n' implicitly has an 'any' type. -functions.js(13,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? functions.js(15,14): error TS7006: Parameter 'c' implicitly has an 'any' type. functions.js(22,14): error TS2339: Property 'length' does not exist on type 'C'. -functions.js(30,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? functions.js(31,19): error TS7006: Parameter 'ab' implicitly has an 'any' type. functions.js(31,23): error TS7006: Parameter 'onetwo' implicitly has an 'any' type. -functions.js(49,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type. functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. -==== functions.js (12 errors) ==== +==== functions.js (8 errors) ==== /** * @param {function(this: string, number): number} c is just passing on through * @return {function(this: string, number): number} - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function id1(c) { ~ @@ -33,9 +26,6 @@ functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[ /** * @param {function(new: { length: number }, number): number} c is just passing on through * @return {function(new: { length: number }, number): number} - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function id2(c) { ~ @@ -57,9 +47,6 @@ functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[ z.length; /** @type {function ("a" | "b", 1 | 2): 3 | 4} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. var f = function (ab, onetwo) { return ab === "a" ? 3 : 4; } ~~ !!! error TS7006: Parameter 'ab' implicitly has an 'any' type. @@ -83,8 +70,6 @@ functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[ /** * @param {function(new: D, number)} dref * @return {D} - ~ -!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? */ var construct = function(dref) { return new dref(33); } ~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt.diff index 4dfb3b025c..d174f92343 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt.diff @@ -3,28 +3,21 @@ @@= skipped -0, +0 lines =@@ -functions.js(65,14): error TS2345: Argument of type 'typeof E' is not assignable to parameter of type 'new (arg1: number) => { length: number; }'. - Property 'length' is missing in type 'E' but required in type '{ length: number; }'. -+functions.js(3,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(5,14): error TS7006: Parameter 'c' implicitly has an 'any' type. +functions.js(9,23): error TS7006: Parameter 'n' implicitly has an 'any' type. -+functions.js(13,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(15,14): error TS7006: Parameter 'c' implicitly has an 'any' type. +functions.js(22,14): error TS2339: Property 'length' does not exist on type 'C'. -+functions.js(30,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(31,19): error TS7006: Parameter 'ab' implicitly has an 'any' type. +functions.js(31,23): error TS7006: Parameter 'onetwo' implicitly has an 'any' type. -+functions.js(49,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? +functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type. +functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. -==== functions.js (1 errors) ==== -+==== functions.js (12 errors) ==== ++==== functions.js (8 errors) ==== /** * @param {function(this: string, number): number} c is just passing on through * @return {function(this: string, number): number} -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function id1(c) { + ~ @@ -39,9 +32,6 @@ /** * @param {function(new: { length: number }, number): number} c is just passing on through * @return {function(new: { length: number }, number): number} -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function id2(c) { + ~ @@ -49,7 +39,7 @@ return c } -@@= skipped -24, +46 lines =@@ +@@= skipped -24, +36 lines =@@ /** @param {number} n */ constructor(n) { this.length = n; @@ -58,13 +48,9 @@ } } -@@= skipped -8, +10 lines =@@ - z.length; +@@= skipped -9, +11 lines =@@ /** @type {function ("a" | "b", 1 | 2): 3 | 4} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. var f = function (ab, onetwo) { return ab === "a" ? 3 : 4; } + ~~ +!!! error TS7006: Parameter 'ab' implicitly has an 'any' type. @@ -73,12 +59,8 @@ /** -@@= skipped -19, +26 lines =@@ - /** - * @param {function(new: D, number)} dref +@@= skipped -20, +24 lines =@@ * @return {D} -+ ~ -+!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? */ var construct = function(dref) { return new dref(33); } + ~~~~ @@ -86,7 +68,7 @@ var z3 = construct(D); z3.length; -@@= skipped -16, +20 lines =@@ +@@= skipped -14, +16 lines =@@ var y3 = id2(E); diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt deleted file mode 100644 index 7b0d591cfa..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt +++ /dev/null @@ -1,33 +0,0 @@ -use.js(3,11): error TS2304: Cannot find name 'C'. -use.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? - - -==== use.js (2 errors) ==== - /// - /** @typedef {import("./mod1")} C - * @type {C} */ - ~ -!!! error TS2304: Cannot find name 'C'. - var c; - c.chunk; - - const D = require("./mod1"); - /** @type {D} */ - ~ -!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? - var d; - d.chunk; - -==== types.d.ts (0 errors) ==== - declare function require(name: string): any; - declare var exports: any; - declare var module: { exports: any }; -==== mod1.js (0 errors) ==== - /// - class Chunk { - constructor() { - this.chunk = 1; - } - } - module.exports = Chunk; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt.diff deleted file mode 100644 index eb5185c886..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.jsdocImportType.errors.txt -+++ new.jsdocImportType.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+use.js(3,11): error TS2304: Cannot find name 'C'. -+use.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? -+ -+ -+==== use.js (2 errors) ==== -+ /// -+ /** @typedef {import("./mod1")} C -+ * @type {C} */ -+ ~ -+!!! error TS2304: Cannot find name 'C'. -+ var c; -+ c.chunk; -+ -+ const D = require("./mod1"); -+ /** @type {D} */ -+ ~ -+!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? -+ var d; -+ d.chunk; -+ -+==== types.d.ts (0 errors) ==== -+ declare function require(name: string): any; -+ declare var exports: any; -+ declare var module: { exports: any }; -+==== mod1.js (0 errors) ==== -+ /// -+ class Chunk { -+ constructor() { -+ this.chunk = 1; -+ } -+ } -+ module.exports = Chunk; -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt deleted file mode 100644 index 29447de0e6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -use.js(3,11): error TS2304: Cannot find name 'C'. -use.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? - - -==== use.js (2 errors) ==== - /// - /** @typedef {import("./mod1")} C - * @type {C} */ - ~ -!!! error TS2304: Cannot find name 'C'. - var c; - c.chunk; - - const D = require("./mod1"); - /** @type {D} */ - ~ -!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? - var d; - d.chunk; - -==== types.d.ts (0 errors) ==== - declare function require(name: string): any; - declare var exports: any; - declare var module: { exports: any }; -==== mod1.js (0 errors) ==== - /// - module.exports = class Chunk { - constructor() { - this.chunk = 1; - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt.diff deleted file mode 100644 index 5fa6e7b4cf..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt.diff +++ /dev/null @@ -1,37 +0,0 @@ ---- old.jsdocImportType2.errors.txt -+++ new.jsdocImportType2.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+use.js(3,11): error TS2304: Cannot find name 'C'. -+use.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? -+ -+ -+==== use.js (2 errors) ==== -+ /// -+ /** @typedef {import("./mod1")} C -+ * @type {C} */ -+ ~ -+!!! error TS2304: Cannot find name 'C'. -+ var c; -+ c.chunk; -+ -+ const D = require("./mod1"); -+ /** @type {D} */ -+ ~ -+!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? -+ var d; -+ d.chunk; -+ -+==== types.d.ts (0 errors) ==== -+ declare function require(name: string): any; -+ declare var exports: any; -+ declare var module: { exports: any }; -+==== mod1.js (0 errors) ==== -+ /// -+ module.exports = class Chunk { -+ constructor() { -+ this.chunk = 1; -+ } -+ } -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt index 1eb51ea255..679391ceef 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt @@ -1,5 +1,4 @@ mod1.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -test.js(2,13): error TS2304: Cannot find name 'X'. ==== mod1.js (1 errors) ==== @@ -10,11 +9,9 @@ test.js(2,13): error TS2304: Cannot find name 'X'. ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== test.js (1 errors) ==== +==== test.js (0 errors) ==== /** @typedef {import('./mod1').C} X */ /** @param {X} c */ - ~ -!!! error TS2304: Cannot find name 'X'. function demo(c) { c.s } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt.diff index e8d4895fbb..e55e44a227 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt.diff @@ -4,7 +4,6 @@ - @@= skipped --1, +1 lines =@@ +mod1.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+test.js(2,13): error TS2304: Cannot find name 'X'. + + +==== mod1.js (1 errors) ==== @@ -15,11 +14,9 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== test.js (1 errors) ==== ++==== test.js (0 errors) ==== + /** @typedef {import('./mod1').C} X */ + /** @param {X} c */ -+ ~ -+!!! error TS2304: Cannot find name 'X'. + function demo(c) { + c.s + } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt deleted file mode 100644 index 7cfc65e1df..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -test.js(1,13): error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? - - -==== ex.d.ts (0 errors) ==== - declare var config: { - fix: boolean - } - export = config; - -==== test.js (1 errors) ==== - /** @param {import('./ex')} a */ - ~~~~~~~~~~~~~~ -!!! error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? - function demo(a) { - a.fix - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt.diff deleted file mode 100644 index 3f2fae2ebd..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.jsdocImportTypeReferenceToCommonjsModule.errors.txt -+++ new.jsdocImportTypeReferenceToCommonjsModule.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+test.js(1,13): error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? -+ -+ -+==== ex.d.ts (0 errors) ==== -+ declare var config: { -+ fix: boolean -+ } -+ export = config; -+ -+==== test.js (1 errors) ==== -+ /** @param {import('./ex')} a */ -+ ~~~~~~~~~~~~~~ -+!!! error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? -+ function demo(a) { -+ a.fix -+ } -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt deleted file mode 100644 index b5f2e2a2bf..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -test.js(1,13): error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? - - -==== ex.d.ts (0 errors) ==== - export var config: {} - -==== test.js (1 errors) ==== - /** @param {import('./ex')} a */ - ~~~~~~~~~~~~~~ -!!! error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? - function demo(a) { - a.config - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt.diff deleted file mode 100644 index def5d93263..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.jsdocImportTypeReferenceToESModule.errors.txt -+++ new.jsdocImportTypeReferenceToESModule.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+test.js(1,13): error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? -+ -+ -+==== ex.d.ts (0 errors) ==== -+ export var config: {} -+ -+==== test.js (1 errors) ==== -+ /** @param {import('./ex')} a */ -+ ~~~~~~~~~~~~~~ -+!!! error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? -+ function demo(a) { -+ a.config -+ } -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt deleted file mode 100644 index 84a4804709..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -a.js(1,26): error TS2694: Namespace '"b"' has no exported member 'FOO'. - - -==== b.js (0 errors) ==== - export const FOO = "foo"; - -==== a.js (1 errors) ==== - /** @type {import('./b').FOO} */ - ~~~ -!!! error TS2694: Namespace '"b"' has no exported member 'FOO'. - let x; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt.diff deleted file mode 100644 index 7ec491bcaa..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.jsdocImportTypeReferenceToStringLiteral.errors.txt -+++ new.jsdocImportTypeReferenceToStringLiteral.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+a.js(1,26): error TS2694: Namespace '"b"' has no exported member 'FOO'. -+ -+ -+==== b.js (0 errors) ==== -+ export const FOO = "foo"; -+ -+==== a.js (1 errors) ==== -+ /** @type {import('./b').FOO} */ -+ ~~~ -+!!! error TS2694: Namespace '"b"' has no exported member 'FOO'. -+ let x; -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt deleted file mode 100644 index 9e8c9aa105..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -indices.js(1,12): error TS2315: Type 'Object' is not generic. -indices.js(3,12): error TS2315: Type 'Object' is not generic. -indices.js(5,12): error TS2315: Type 'Object' is not generic. -indices.js(7,13): error TS2315: Type 'Object' is not generic. - - -==== indices.js (4 errors) ==== - /** @type {Object.} */ - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2315: Type 'Object' is not generic. - var o1; - /** @type {Object.} */ - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2315: Type 'Object' is not generic. - var o2; - /** @type {Object.} */ - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2315: Type 'Object' is not generic. - var o3; - /** @param {Object.} o */ - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2315: Type 'Object' is not generic. - function f(o) { - o.foo = 1; // error - o.bar = false; // ok - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt.diff index b0dd51963b..67f90c1063 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt.diff @@ -1,34 +1,23 @@ --- old.jsdocIndexSignature.errors.txt +++ new.jsdocIndexSignature.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -indices.js(9,5): error TS2322: Type 'number' is not assignable to type 'boolean'. -+indices.js(1,12): error TS2315: Type 'Object' is not generic. -+indices.js(3,12): error TS2315: Type 'Object' is not generic. -+indices.js(5,12): error TS2315: Type 'Object' is not generic. -+indices.js(7,13): error TS2315: Type 'Object' is not generic. - - +- +- -==== indices.js (1 errors) ==== -+==== indices.js (4 errors) ==== - /** @type {Object.} */ -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2315: Type 'Object' is not generic. - var o1; - /** @type {Object.} */ -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2315: Type 'Object' is not generic. - var o2; - /** @type {Object.} */ -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2315: Type 'Object' is not generic. - var o3; - /** @param {Object.} o */ -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2315: Type 'Object' is not generic. - function f(o) { - o.foo = 1; // error +- /** @type {Object.} */ +- var o1; +- /** @type {Object.} */ +- var o2; +- /** @type {Object.} */ +- var o3; +- /** @param {Object.} o */ +- function f(o) { +- o.foo = 1; // error - ~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'boolean'. - o.bar = false; // ok - } - +- o.bar = false; // ok +- } +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt index c0a05d7652..9246cf7e70 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt @@ -1,11 +1,8 @@ -jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. -==== jsdocOuterTypeParameters1.js (2 errors) ==== +==== jsdocOuterTypeParameters1.js (1 errors) ==== /** @return {T} */ - ~ -!!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template {T} */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt.diff index a7781ae987..2c33e4dd18 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +0 lines =@@ -error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. - jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. +-jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. -jsdocOuterTypeParameters1.js(4,17): error TS2304: Cannot find name 'T'. -jsdocOuterTypeParameters1.js(4,19): error TS1069: Unexpected token. A type parameter name was expected without curly braces. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. @@ -12,10 +12,10 @@ -!!! error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -==== jsdocOuterTypeParameters1.js (4 errors) ==== -+==== jsdocOuterTypeParameters1.js (2 errors) ==== ++==== jsdocOuterTypeParameters1.js (1 errors) ==== /** @return {T} */ - ~ - !!! error TS2304: Cannot find name 'T'. +- ~ +-!!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template {T} */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt index f78e45da6b..f48b72dc8a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt @@ -1,11 +1,8 @@ -jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. -==== jsdocOuterTypeParameters1.js (2 errors) ==== +==== jsdocOuterTypeParameters1.js (1 errors) ==== /** @return {T} */ - ~ -!!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template T */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt.diff index 837f743c5a..d1baa63090 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt.diff @@ -4,17 +4,16 @@ -error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -jsdocOuterTypeParameters1.js(1,14): error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. -+jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. -!!! error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. - ==== jsdocOuterTypeParameters1.js (2 errors) ==== +-==== jsdocOuterTypeParameters1.js (2 errors) ==== ++==== jsdocOuterTypeParameters1.js (1 errors) ==== /** @return {T} */ - ~ +- ~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. -+!!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template T */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt index ff420a46d1..5fc557919c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt @@ -1,13 +1,9 @@ -paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? paren.js(2,10): error TS7006: Parameter 's' implicitly has an 'any' type. paren.js(2,13): error TS7006: Parameter 'id' implicitly has an 'any' type. -==== paren.js (3 errors) ==== +==== paren.js (2 errors) ==== /** @type {function((string), function((string)): string): string} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. var x = (s, id) => id(s) ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt.diff index 8649a77e4f..4b661c13ec 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt.diff @@ -3,16 +3,12 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +paren.js(2,10): error TS7006: Parameter 's' implicitly has an 'any' type. +paren.js(2,13): error TS7006: Parameter 'id' implicitly has an 'any' type. + + -+==== paren.js (3 errors) ==== ++==== paren.js (2 errors) ==== + /** @type {function((string), function((string)): string): string} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + var x = (s, id) => id(s) + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt index 89b948713c..8b239e96fe 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt @@ -1,12 +1,8 @@ -paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? paren.js(2,9): error TS7006: Parameter 's' implicitly has an 'any' type. -==== paren.js (2 errors) ==== +==== paren.js (1 errors) ==== /** @type {function((string)): string} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. var x = s => s.toString() ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff index ee5d9700e8..493485caab 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff @@ -3,15 +3,11 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +paren.js(2,9): error TS7006: Parameter 's' implicitly has an 'any' type. + + -+==== paren.js (2 errors) ==== ++==== paren.js (1 errors) ==== + /** @type {function((string)): string} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + var x = s => s.toString() + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt deleted file mode 100644 index d6c7a99ac5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -jsdocPrivateName1.js(3,5): error TS2322: Type 'number' is not assignable to type 'boolean'. - - -==== jsdocPrivateName1.js (1 errors) ==== - class A { - /** @type {boolean} some number value */ - #foo = 3 // Error because not assignable to boolean - ~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'boolean'. - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt.diff new file mode 100644 index 0000000000..2c8264ffb2 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt.diff @@ -0,0 +1,16 @@ +--- old.jsdocPrivateName1.errors.txt ++++ new.jsdocPrivateName1.errors.txt +@@= skipped -0, +-1 lines =@@ +-jsdocPrivateName1.js(3,5): error TS2322: Type 'number' is not assignable to type 'boolean'. +- +- +-==== jsdocPrivateName1.js (1 errors) ==== +- class A { +- /** @type {boolean} some number value */ +- #foo = 3 // Error because not assignable to boolean +- ~~~~ +-!!! error TS2322: Type 'number' is not assignable to type 'boolean'. +- } +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt index c48ed5e68c..fa5f1759a3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt @@ -1,15 +1,12 @@ -returns.js(5,5): error TS2322: Type 'number' is not assignable to type 'string'. returns.js(19,12): error TS2872: This kind of expression is always truthy. -==== returns.js (2 errors) ==== +==== returns.js (1 errors) ==== /** * @returns {string} This comment is not currently exposed */ function f() { return 5; - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. } /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt.diff index 64decd8264..3270f2608a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt.diff @@ -3,18 +3,15 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+returns.js(5,5): error TS2322: Type 'number' is not assignable to type 'string'. +returns.js(19,12): error TS2872: This kind of expression is always truthy. + + -+==== returns.js (2 errors) ==== ++==== returns.js (1 errors) ==== + /** + * @returns {string} This comment is not currently exposed + */ + function f() { + return 5; -+ ~~~~~~ -+!!! error TS2322: Type 'number' is not assignable to type 'string'. + } + + /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt new file mode 100644 index 0000000000..3bd3c736a4 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt @@ -0,0 +1,51 @@ +jsdocSignatureOnReturnedFunction.js(25,13): error TS7006: Parameter 'a' implicitly has an 'any' type. +jsdocSignatureOnReturnedFunction.js(25,16): error TS7006: Parameter 'b' implicitly has an 'any' type. +jsdocSignatureOnReturnedFunction.js(32,22): error TS7006: Parameter 'a' implicitly has an 'any' type. +jsdocSignatureOnReturnedFunction.js(32,25): error TS7006: Parameter 'b' implicitly has an 'any' type. + + +==== jsdocSignatureOnReturnedFunction.js (4 errors) ==== + function f1() { + /** + * @param {number} a + * @param {number} b + * @returns {number} + */ + return (a, b) => { + return a + b; + } + } + + function f2() { + /** + * @param {number} a + * @param {number} b + * @returns {number} + */ + return function (a, b){ + return a + b; + } + } + + function f3() { + /** @type {(a: number, b: number) => number} */ + return (a, b) => { + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'b' implicitly has an 'any' type. + return a + b; + } + } + + function f4() { + /** @type {(a: number, b: number) => number} */ + return function (a, b){ + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'b' implicitly has an 'any' type. + return a + b; + } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff new file mode 100644 index 0000000000..2ccb14f1cf --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff @@ -0,0 +1,56 @@ +--- old.jsdocSignatureOnReturnedFunction.errors.txt ++++ new.jsdocSignatureOnReturnedFunction.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++jsdocSignatureOnReturnedFunction.js(25,13): error TS7006: Parameter 'a' implicitly has an 'any' type. ++jsdocSignatureOnReturnedFunction.js(25,16): error TS7006: Parameter 'b' implicitly has an 'any' type. ++jsdocSignatureOnReturnedFunction.js(32,22): error TS7006: Parameter 'a' implicitly has an 'any' type. ++jsdocSignatureOnReturnedFunction.js(32,25): error TS7006: Parameter 'b' implicitly has an 'any' type. ++ ++ ++==== jsdocSignatureOnReturnedFunction.js (4 errors) ==== ++ function f1() { ++ /** ++ * @param {number} a ++ * @param {number} b ++ * @returns {number} ++ */ ++ return (a, b) => { ++ return a + b; ++ } ++ } ++ ++ function f2() { ++ /** ++ * @param {number} a ++ * @param {number} b ++ * @returns {number} ++ */ ++ return function (a, b){ ++ return a + b; ++ } ++ } ++ ++ function f3() { ++ /** @type {(a: number, b: number) => number} */ ++ return (a, b) => { ++ ~ ++!!! error TS7006: Parameter 'a' implicitly has an 'any' type. ++ ~ ++!!! error TS7006: Parameter 'b' implicitly has an 'any' type. ++ return a + b; ++ } ++ } ++ ++ function f4() { ++ /** @type {(a: number, b: number) => number} */ ++ return function (a, b){ ++ ~ ++!!! error TS7006: Parameter 'a' implicitly has an 'any' type. ++ ~ ++!!! error TS7006: Parameter 'b' implicitly has an 'any' type. ++ return a + b; ++ } ++ } ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt index 81b519724a..ec71f9db75 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt @@ -1,15 +1,9 @@ -templateTagOnClasses.js(8,17): error TS2304: Cannot find name 'T'. templateTagOnClasses.js(10,14): error TS2339: Property 'a' does not exist on type 'Foo'. -templateTagOnClasses.js(14,16): error TS2304: Cannot find name 'T'. -templateTagOnClasses.js(15,16): error TS2304: Cannot find name 'Id'. -templateTagOnClasses.js(15,19): error TS2304: Cannot find name 'T'. -templateTagOnClasses.js(16,16): error TS2304: Cannot find name 'Id2'. -templateTagOnClasses.js(17,17): error TS2304: Cannot find name 'T'. templateTagOnClasses.js(25,3): error TS2339: Property 'a' does not exist on type 'Foo'. templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type 'Foo'. -==== templateTagOnClasses.js (9 errors) ==== +==== templateTagOnClasses.js (3 errors) ==== /** * @template T * @typedef {(t: T) => T} Id @@ -18,8 +12,6 @@ templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type class Foo { /** @typedef {(t: T) => T} Id2 */ /** @param {T} x */ - ~ -!!! error TS2304: Cannot find name 'T'. constructor (x) { this.a = x ~ @@ -28,19 +20,9 @@ templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type /** * * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. * @param {Id} y - ~~ -!!! error TS2304: Cannot find name 'Id'. - ~ -!!! error TS2304: Cannot find name 'T'. * @param {Id2} alpha - ~~~ -!!! error TS2304: Cannot find name 'Id2'. * @return {T} - ~ -!!! error TS2304: Cannot find name 'T'. */ foo(x, y, alpha) { return alpha(y(x)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt.diff index 0aad856fe8..1f3bad0a46 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt.diff @@ -2,28 +2,18 @@ +++ new.jsdocTemplateClass.errors.txt @@= skipped -0, +0 lines =@@ -templateTagOnClasses.js(25,1): error TS2322: Type 'boolean' is not assignable to type 'number'. -+templateTagOnClasses.js(8,17): error TS2304: Cannot find name 'T'. +templateTagOnClasses.js(10,14): error TS2339: Property 'a' does not exist on type 'Foo'. -+templateTagOnClasses.js(14,16): error TS2304: Cannot find name 'T'. -+templateTagOnClasses.js(15,16): error TS2304: Cannot find name 'Id'. -+templateTagOnClasses.js(15,19): error TS2304: Cannot find name 'T'. -+templateTagOnClasses.js(16,16): error TS2304: Cannot find name 'Id2'. -+templateTagOnClasses.js(17,17): error TS2304: Cannot find name 'T'. +templateTagOnClasses.js(25,3): error TS2339: Property 'a' does not exist on type 'Foo'. +templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type 'Foo'. -==== templateTagOnClasses.js (1 errors) ==== -+==== templateTagOnClasses.js (9 errors) ==== ++==== templateTagOnClasses.js (3 errors) ==== /** * @template T * @typedef {(t: T) => T} Id -@@= skipped -9, +17 lines =@@ - class Foo { - /** @typedef {(t: T) => T} Id2 */ +@@= skipped -11, +13 lines =@@ /** @param {T} x */ -+ ~ -+!!! error TS2304: Cannot find name 'T'. constructor (x) { this.a = x + ~ @@ -31,24 +21,7 @@ } /** * - * @param {T} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @param {Id} y -+ ~~ -+!!! error TS2304: Cannot find name 'Id'. -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @param {Id2} alpha -+ ~~~ -+!!! error TS2304: Cannot find name 'Id2'. - * @return {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - foo(x, y, alpha) { - return alpha(y(x)) -@@= skipped -17, +31 lines =@@ +@@= skipped -15, +17 lines =@@ var f = new Foo(1) var g = new Foo(false) f.a = g.a diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt deleted file mode 100644 index d143e9dbe1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -templateTagOnConstructorFunctions.js(6,12): error TS2304: Cannot find name 'T'. - - -==== templateTagOnConstructorFunctions.js (1 errors) ==== - /** - * @template U - * @typedef {(u: U) => U} Id - */ - /** - * @param {T} t - ~ -!!! error TS2304: Cannot find name 'T'. - * @template T - */ - function Zet(t) { - /** @type {T} */ - this.u - this.t = t - } - /** - * @param {T} v - * @param {Id} id - */ - Zet.prototype.add = function(v, id) { - this.u = v || this.t - return id(this.u) - } - var z = new Zet(1) - z.t = 2 - z.u = false - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt.diff index b0c893adcf..d0e17268a9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.errors.txt.diff @@ -1,24 +1,36 @@ --- old.jsdocTemplateConstructorFunction.errors.txt +++ new.jsdocTemplateConstructorFunction.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -templateTagOnConstructorFunctions.js(24,1): error TS2322: Type 'boolean' is not assignable to type 'number'. -+templateTagOnConstructorFunctions.js(6,12): error TS2304: Cannot find name 'T'. - - - ==== templateTagOnConstructorFunctions.js (1 errors) ==== -@@= skipped -7, +7 lines =@@ - */ - /** - * @param {T} t -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @template T - */ - function Zet(t) { -@@= skipped -18, +20 lines =@@ - var z = new Zet(1) - z.t = 2 - z.u = false +- +- +-==== templateTagOnConstructorFunctions.js (1 errors) ==== +- /** +- * @template U +- * @typedef {(u: U) => U} Id +- */ +- /** +- * @param {T} t +- * @template T +- */ +- function Zet(t) { +- /** @type {T} */ +- this.u +- this.t = t +- } +- /** +- * @param {T} v +- * @param {Id} id +- */ +- Zet.prototype.add = function(v, id) { +- this.u = v || this.t +- return id(this.u) +- } +- var z = new Zet(1) +- z.t = 2 +- z.u = false - ~~~ -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. - +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt deleted file mode 100644 index 3de300722c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt +++ /dev/null @@ -1,41 +0,0 @@ -templateTagWithNestedTypeLiteral.js(2,12): error TS2304: Cannot find name 'T'. -templateTagWithNestedTypeLiteral.js(30,12): error TS2304: Cannot find name 'A'. - - -==== templateTagWithNestedTypeLiteral.js (2 errors) ==== - /** - * @param {T} t - ~ -!!! error TS2304: Cannot find name 'T'. - * @template T - */ - function Zet(t) { - /** @type {T} */ - this.u - this.t = t - } - /** - * @param {T} v - * @param {object} o - * @param {T} o.nested - */ - Zet.prototype.add = function(v, o) { - this.u = v || o.nested - return this.u - } - var z = new Zet(1) - z.t = 2 - z.u = false - /** @type {number} */ - let answer = z.add(3, { nested: 4 }) - - // lookup in typedef should not crash the compiler, even when the type is unknown - /** - * @typedef {Object} A - * @property {T} value - */ - /** @type {A} */ - ~ -!!! error TS2304: Cannot find name 'A'. - const options = { value: null }; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff index b5ef0f8d74..53983833c0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.errors.txt.diff @@ -1,38 +1,46 @@ --- old.jsdocTemplateConstructorFunction2.errors.txt +++ new.jsdocTemplateConstructorFunction2.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -templateTagWithNestedTypeLiteral.js(21,1): error TS2322: Type 'boolean' is not assignable to type 'number'. -templateTagWithNestedTypeLiteral.js(28,15): error TS2304: Cannot find name 'T'. -+templateTagWithNestedTypeLiteral.js(2,12): error TS2304: Cannot find name 'T'. -+templateTagWithNestedTypeLiteral.js(30,12): error TS2304: Cannot find name 'A'. - - - ==== templateTagWithNestedTypeLiteral.js (2 errors) ==== - /** - * @param {T} t -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @template T - */ - function Zet(t) { -@@= skipped -23, +25 lines =@@ - var z = new Zet(1) - z.t = 2 - z.u = false +- +- +-==== templateTagWithNestedTypeLiteral.js (2 errors) ==== +- /** +- * @param {T} t +- * @template T +- */ +- function Zet(t) { +- /** @type {T} */ +- this.u +- this.t = t +- } +- /** +- * @param {T} v +- * @param {object} o +- * @param {T} o.nested +- */ +- Zet.prototype.add = function(v, o) { +- this.u = v || o.nested +- return this.u +- } +- var z = new Zet(1) +- z.t = 2 +- z.u = false - ~~~ -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. - /** @type {number} */ - let answer = z.add(3, { nested: 4 }) - -@@= skipped -9, +7 lines =@@ - /** - * @typedef {Object} A - * @property {T} value +- /** @type {number} */ +- let answer = z.add(3, { nested: 4 }) +- +- // lookup in typedef should not crash the compiler, even when the type is unknown +- /** +- * @typedef {Object} A +- * @property {T} value - ~ -!!! error TS2304: Cannot find name 'T'. - */ - /** @type {A} */ -+ ~ -+!!! error TS2304: Cannot find name 'A'. - const options = { value: null }; - +- */ +- /** @type {A} */ +- const options = { value: null }; +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt index 21a9fab8a3..9078b6efa4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt @@ -1,15 +1,10 @@ -forgot.js(2,12): error TS2304: Cannot find name 'T'. -forgot.js(11,12): error TS2304: Cannot find name 'T'. -forgot.js(13,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. Type 'void' is not assignable to type 'Animation'. -==== forgot.js (4 errors) ==== +==== forgot.js (1 errors) ==== /** * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. * @template T */ function f(a) { @@ -19,13 +14,8 @@ forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKey /** * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. * @template T * @returns {function(): T} - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function g(a) { return () => a diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff index e5cc7d533a..b06fd95851 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt.diff @@ -2,37 +2,11 @@ +++ new.jsdocTemplateTag.errors.txt @@= skipped -0, +0 lines =@@ -forgot.js(23,1): error TS2322: Type '(keyframes: any[]) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. -+forgot.js(2,12): error TS2304: Cannot find name 'T'. -+forgot.js(11,12): error TS2304: Cannot find name 'T'. -+forgot.js(13,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. Type 'void' is not assignable to type 'Animation'. --==== forgot.js (1 errors) ==== -+==== forgot.js (4 errors) ==== - /** - * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @template T - */ - function f(a) { -@@= skipped -13, +18 lines =@@ - - /** - * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @template T - * @returns {function(): T} -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - */ - function g(a) { - return () => a -@@= skipped -13, +18 lines =@@ +@@= skipped -26, +26 lines =@@ */ Element.prototype.animate = function(keyframes) {}; ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt deleted file mode 100644 index 5513f1c711..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -github17339.js(4,13): error TS2304: Cannot find name 'T'. -github17339.js(5,15): error TS2304: Cannot find name 'T'. - - -==== github17339.js (2 errors) ==== - var obj = { - /** - * @template T - * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T} - ~ -!!! error TS2304: Cannot find name 'T'. - */ - x: function (a) { - return a; - }, - }; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt.diff deleted file mode 100644 index 00574f819b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.jsdocTemplateTag2.errors.txt -+++ new.jsdocTemplateTag2.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+github17339.js(4,13): error TS2304: Cannot find name 'T'. -+github17339.js(5,15): error TS2304: Cannot find name 'T'. -+ -+ -+==== github17339.js (2 errors) ==== -+ var obj = { -+ /** -+ * @template T -+ * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ x: function (a) { -+ return a; -+ }, -+ }; -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt deleted file mode 100644 index 65c5b3e1df..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt +++ /dev/null @@ -1,57 +0,0 @@ -a.js(6,12): error TS2304: Cannot find name 'T'. -a.js(7,12): error TS2304: Cannot find name 'U'. -a.js(8,12): error TS2304: Cannot find name 'V'. -a.js(9,12): error TS2304: Cannot find name 'W'. -a.js(10,12): error TS2304: Cannot find name 'X'. -a.js(11,13): error TS2304: Cannot find name 'W'. -a.js(11,17): error TS2304: Cannot find name 'X'. -a.js(26,12): error TS2304: Cannot find name 'T'. - - -==== a.js (8 errors) ==== - /** - * @template {{ a: number, b: string }} T,U A Comment - * @template {{ c: boolean }} V uh ... are comments even supported?? - * @template W - * @template X That last one had no comment - * @param {T} t - ~ -!!! error TS2304: Cannot find name 'T'. - * @param {U} u - ~ -!!! error TS2304: Cannot find name 'U'. - * @param {V} v - ~ -!!! error TS2304: Cannot find name 'V'. - * @param {W} w - ~ -!!! error TS2304: Cannot find name 'W'. - * @param {X} x - ~ -!!! error TS2304: Cannot find name 'X'. - * @return {W | X} - ~ -!!! error TS2304: Cannot find name 'W'. - ~ -!!! error TS2304: Cannot find name 'X'. - */ - function f(t, u, v, w, x) { - if(t.a + t.b.length > u.a - u.b.length && v.c) { - return w; - } - return x; - } - - f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); - f({ a: 12 }, undefined, undefined, 101, 'nope'); - - /** - * @template {NoLongerAllowed} - * @template T preceding line's syntax is no longer allowed - * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. - */ - function g(x) { } - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt.diff index 92fa4d9c45..050a812ed7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt.diff @@ -1,78 +1,56 @@ --- old.jsdocTemplateTag3.errors.txt +++ new.jsdocTemplateTag3.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -a.js(14,29): error TS2339: Property 'a' does not exist on type 'U'. -a.js(14,35): error TS2339: Property 'b' does not exist on type 'U'. -a.js(21,3): error TS2345: Argument of type '{ a: number; }' is not assignable to parameter of type '{ a: number; b: string; }'. - Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -a.js(24,15): error TS2304: Cannot find name 'NoLongerAllowed'. -a.js(25,2): error TS1069: Unexpected token. A type parameter name was expected without curly braces. -+a.js(6,12): error TS2304: Cannot find name 'T'. -+a.js(7,12): error TS2304: Cannot find name 'U'. -+a.js(8,12): error TS2304: Cannot find name 'V'. -+a.js(9,12): error TS2304: Cannot find name 'W'. -+a.js(10,12): error TS2304: Cannot find name 'X'. -+a.js(11,13): error TS2304: Cannot find name 'W'. -+a.js(11,17): error TS2304: Cannot find name 'X'. -+a.js(26,12): error TS2304: Cannot find name 'T'. - - +- +- -==== a.js (5 errors) ==== -+==== a.js (8 errors) ==== - /** - * @template {{ a: number, b: string }} T,U A Comment - * @template {{ c: boolean }} V uh ... are comments even supported?? - * @template W - * @template X That last one had no comment - * @param {T} t -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @param {U} u -+ ~ -+!!! error TS2304: Cannot find name 'U'. - * @param {V} v -+ ~ -+!!! error TS2304: Cannot find name 'V'. - * @param {W} w -+ ~ -+!!! error TS2304: Cannot find name 'W'. - * @param {X} x -+ ~ -+!!! error TS2304: Cannot find name 'X'. - * @return {W | X} -+ ~ -+!!! error TS2304: Cannot find name 'W'. -+ ~ -+!!! error TS2304: Cannot find name 'X'. - */ - function f(t, u, v, w, x) { - if(t.a + t.b.length > u.a - u.b.length && v.c) { +- /** +- * @template {{ a: number, b: string }} T,U A Comment +- * @template {{ c: boolean }} V uh ... are comments even supported?? +- * @template W +- * @template X That last one had no comment +- * @param {T} t +- * @param {U} u +- * @param {V} v +- * @param {W} w +- * @param {X} x +- * @return {W | X} +- */ +- function f(t, u, v, w, x) { +- if(t.a + t.b.length > u.a - u.b.length && v.c) { - ~ -!!! error TS2339: Property 'a' does not exist on type 'U'. - ~ -!!! error TS2339: Property 'b' does not exist on type 'U'. - return w; - } - return x; -@@= skipped -31, +43 lines =@@ - - f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); - f({ a: 12 }, undefined, undefined, 101, 'nope'); +- return w; +- } +- return x; +- } +- +- f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); +- f({ a: 12 }, undefined, undefined, 101, 'nope'); - ~~~~~~~~~~ -!!! error TS2345: Argument of type '{ a: number; }' is not assignable to parameter of type '{ a: number; b: string; }'. -!!! error TS2345: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -!!! related TS2728 a.js:2:28: 'b' is declared here. - - /** - * @template {NoLongerAllowed} +- +- /** +- * @template {NoLongerAllowed} - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'NoLongerAllowed'. - * @template T preceding line's syntax is no longer allowed +- * @template T preceding line's syntax is no longer allowed - ~ -!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. - * @param {T} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - function g(x) { } - +- * @param {T} x +- */ +- function g(x) { } +- +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt index 3327c8ae09..4abd3d42f7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt @@ -1,18 +1,12 @@ a.js(9,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -a.js(14,16): error TS2304: Cannot find name 'K'. -a.js(15,18): error TS2304: Cannot find name 'V'. -a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. +a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. a.js(30,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -a.js(35,16): error TS2304: Cannot find name 'K'. -a.js(36,18): error TS2304: Cannot find name 'V'. a.js(50,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. a.js(52,10): error TS2339: Property '_map' does not exist on type '{}'. a.js(55,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. -a.js(57,16): error TS2304: Cannot find name 'K'. -a.js(58,18): error TS2304: Cannot find name 'V'. -==== a.js (12 errors) ==== +==== a.js (6 errors) ==== /** * Should work for function declarations * @constructor @@ -29,16 +23,12 @@ a.js(58,18): error TS2304: Cannot find name 'V'. Multimap.prototype = { /** * @param {K} key the key ok - ~ -!!! error TS2304: Cannot find name 'K'. * @returns {V} the value ok - ~ -!!! error TS2304: Cannot find name 'V'. */ get(key) { return this._map[key + '']; ~~~~ -!!! error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. +!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. } } @@ -58,11 +48,7 @@ a.js(58,18): error TS2304: Cannot find name 'V'. Multimap2.prototype = { /** * @param {K} key the key ok - ~ -!!! error TS2304: Cannot find name 'K'. * @returns {V} the value ok - ~ -!!! error TS2304: Cannot find name 'V'. */ get: function(key) { return this._map[key + '']; @@ -90,11 +76,7 @@ a.js(58,18): error TS2304: Cannot find name 'V'. !!! error TS2339: Property 'Multimap3' does not exist on type '{}'. /** * @param {K} key the key ok - ~ -!!! error TS2304: Cannot find name 'K'. * @returns {V} the value ok - ~ -!!! error TS2304: Cannot find name 'V'. */ get(key) { return this._map[key + '']; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff index 06a4860016..77b6c5ec32 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt.diff @@ -4,20 +4,14 @@ - @@= skipped --1, +1 lines =@@ +a.js(9,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+a.js(14,16): error TS2304: Cannot find name 'K'. -+a.js(15,18): error TS2304: Cannot find name 'V'. -+a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. ++a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. +a.js(30,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+a.js(35,16): error TS2304: Cannot find name 'K'. -+a.js(36,18): error TS2304: Cannot find name 'V'. +a.js(50,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. +a.js(52,10): error TS2339: Property '_map' does not exist on type '{}'. +a.js(55,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. -+a.js(57,16): error TS2304: Cannot find name 'K'. -+a.js(58,18): error TS2304: Cannot find name 'V'. + + -+==== a.js (12 errors) ==== ++==== a.js (6 errors) ==== + /** + * Should work for function declarations + * @constructor @@ -34,16 +28,12 @@ + Multimap.prototype = { + /** + * @param {K} key the key ok -+ ~ -+!!! error TS2304: Cannot find name 'K'. + * @returns {V} the value ok -+ ~ -+!!! error TS2304: Cannot find name 'V'. + */ + get(key) { + return this._map[key + '']; + ~~~~ -+!!! error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. ++!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. + } + } + @@ -63,11 +53,7 @@ + Multimap2.prototype = { + /** + * @param {K} key the key ok -+ ~ -+!!! error TS2304: Cannot find name 'K'. + * @returns {V} the value ok -+ ~ -+!!! error TS2304: Cannot find name 'V'. + */ + get: function(key) { + return this._map[key + '']; @@ -95,11 +81,7 @@ +!!! error TS2339: Property 'Multimap3' does not exist on type '{}'. + /** + * @param {K} key the key ok -+ ~ -+!!! error TS2304: Cannot find name 'K'. + * @returns {V} the value ok -+ ~ -+!!! error TS2304: Cannot find name 'V'. + */ + get(key) { + return this._map[key + '']; 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 eb19fe5905..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt +++ /dev/null @@ -1,139 +0,0 @@ -a.js(3,12): error TS2304: Cannot find name 'T'. -a.js(4,14): error TS2304: Cannot find name 'T'. -a.js(15,12): error TS2304: Cannot find name 'T'. -a.js(16,14): error TS2304: Cannot find name 'T'. -a.js(27,12): error TS2304: Cannot find name 'T'. -a.js(28,14): error TS2304: Cannot find name 'T'. -a.js(38,13): error TS2304: Cannot find name 'T'. -a.js(38,16): error TS2304: Cannot find name 'T'. -a.js(39,14): error TS2304: Cannot find name 'T'. -a.js(49,17): error TS2304: Cannot find name 'T'. -a.js(49,23): error TS2304: Cannot find name 'T'. -a.js(50,14): error TS2304: Cannot find name 'T'. -a.js(63,16): error TS2304: Cannot find name 'T'. -a.js(69,16): error TS2304: Cannot find name 'U'. -a.js(81,12): error TS2304: Cannot find name 'T'. -a.js(82,14): error TS2304: Cannot find name 'T'. - - -==== a.js (16 errors) ==== - /** - * @template const T - * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T} - ~ -!!! error TS2304: Cannot find name '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 - * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T} - ~ -!!! error TS2304: Cannot find name '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 - * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T[]} - ~ -!!! error TS2304: Cannot find name 'T'. - */ - function f3(x) { - return [x]; - } - const t7 = f3("hello"); - const t8 = f3("hello"); - - /** - * @template const T - * @param {[T, T]} x - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T} - ~ -!!! error TS2304: Cannot find name '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 - * @param {{ x: T, y: T}} obj - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T} - ~ -!!! error TS2304: Cannot find name '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 - */ - class C { - /** - * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. - */ - constructor(x) {} - - /** - * @template const U - * @param {U} x - ~ -!!! error TS2304: Cannot find name 'U'. - */ - 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 - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T} - ~ -!!! error TS2304: Cannot find name '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/jsdocTemplateTag6.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt.diff deleted file mode 100644 index 48001aa0bf..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.errors.txt.diff +++ /dev/null @@ -1,144 +0,0 @@ ---- old.jsdocTemplateTag6.errors.txt -+++ new.jsdocTemplateTag6.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+a.js(3,12): error TS2304: Cannot find name 'T'. -+a.js(4,14): error TS2304: Cannot find name 'T'. -+a.js(15,12): error TS2304: Cannot find name 'T'. -+a.js(16,14): error TS2304: Cannot find name 'T'. -+a.js(27,12): error TS2304: Cannot find name 'T'. -+a.js(28,14): error TS2304: Cannot find name 'T'. -+a.js(38,13): error TS2304: Cannot find name 'T'. -+a.js(38,16): error TS2304: Cannot find name 'T'. -+a.js(39,14): error TS2304: Cannot find name 'T'. -+a.js(49,17): error TS2304: Cannot find name 'T'. -+a.js(49,23): error TS2304: Cannot find name 'T'. -+a.js(50,14): error TS2304: Cannot find name 'T'. -+a.js(63,16): error TS2304: Cannot find name 'T'. -+a.js(69,16): error TS2304: Cannot find name 'U'. -+a.js(81,12): error TS2304: Cannot find name 'T'. -+a.js(82,14): error TS2304: Cannot find name 'T'. -+ -+ -+==== a.js (16 errors) ==== -+ /** -+ * @template const T -+ * @param {T} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {T} -+ ~ -+!!! error TS2304: Cannot find name '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 -+ * @param {T} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {T} -+ ~ -+!!! error TS2304: Cannot find name '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 -+ * @param {T} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {T[]} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ function f3(x) { -+ return [x]; -+ } -+ const t7 = f3("hello"); -+ const t8 = f3("hello"); -+ -+ /** -+ * @template const T -+ * @param {[T, T]} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {T} -+ ~ -+!!! error TS2304: Cannot find name '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 -+ * @param {{ x: T, y: T}} obj -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {T} -+ ~ -+!!! error TS2304: Cannot find name '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 -+ */ -+ class C { -+ /** -+ * @param {T} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ constructor(x) {} -+ -+ /** -+ * @template const U -+ * @param {U} x -+ ~ -+!!! error TS2304: Cannot find name 'U'. -+ */ -+ 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 -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ function f6(...args) { -+ return args; -+ } -+ const t15 = f6(1, 'b', { a: 1, b: 'x' }); -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols index ab292c55c2..e885cba37e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols @@ -89,7 +89,6 @@ function f4(x) { return x[0]; >x : Symbol(x, Decl(a.js, 40, 12)) ->0 : Symbol(0) } const t9 = f4([[1, "x"], [2, "y"]]); >t9 : Symbol(t9, Decl(a.js, 43, 5)) @@ -113,9 +112,7 @@ function f5(obj) { >obj : Symbol(obj, Decl(a.js, 51, 12)) return obj.x; ->obj.x : Symbol(x, Decl(a.js, 48, 12)) >obj : Symbol(obj, Decl(a.js, 51, 12)) ->x : Symbol(x, Decl(a.js, 48, 12)) } const t11 = f5({ x: [1, "x"], y: [2, "y"] }); >t11 : Symbol(t11, Decl(a.js, 54, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols.diff index c00aee2b03..78d72ec4b2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols.diff @@ -1,6 +1,24 @@ --- old.jsdocTemplateTag6.symbols +++ new.jsdocTemplateTag6.symbols -@@= skipped -149, +149 lines =@@ +@@= skipped -88, +88 lines =@@ + + return x[0]; + >x : Symbol(x, Decl(a.js, 40, 12)) +->0 : Symbol(0) + } + const t9 = f4([[1, "x"], [2, "y"]]); + >t9 : Symbol(t9, Decl(a.js, 43, 5)) +@@= skipped -24, +23 lines =@@ + >obj : Symbol(obj, Decl(a.js, 51, 12)) + + return obj.x; +->obj.x : Symbol(x, Decl(a.js, 48, 12)) + >obj : Symbol(obj, Decl(a.js, 51, 12)) +->x : Symbol(x, Decl(a.js, 48, 12)) + } + const t11 = f5({ x: [1, "x"], y: [2, "y"] }); + >t11 : Symbol(t11, Decl(a.js, 54, 5)) +@@= skipped -37, +35 lines =@@ * @param {U} x */ foo(x) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt deleted file mode 100644 index 8521be0860..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -a.js(13,12): error TS2304: Cannot find name 'T'. -a.js(14,14): error TS2304: Cannot find name 'T'. - - -==== a.js (2 errors) ==== - /** - * @template const T - * @typedef {[T]} X - */ - - /** - * @template const T - */ - class C { } - - /** - * @template private T - * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T} - ~ -!!! error TS2304: Cannot find name 'T'. - */ - function f(x) { - return x; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt.diff index e47ca4a1bb..44c8b6fc84 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt.diff @@ -1,32 +1,33 @@ --- old.jsdocTemplateTag7.errors.txt +++ new.jsdocTemplateTag7.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -a.js(2,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(13,12): error TS2304: Cannot find name 'T'. -+a.js(14,14): error TS2304: Cannot find name 'T'. - - - ==== a.js (2 errors) ==== - /** - * @template const T +- +- +-==== a.js (2 errors) ==== +- /** +- * @template const T - ~~~~~ -!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class - * @typedef {[T]} X - */ - -@@= skipped -16, +14 lines =@@ - - /** - * @template private T +- * @typedef {[T]} X +- */ +- +- /** +- * @template const T +- */ +- class C { } +- +- /** +- * @template private T - ~~~~~~~ -!!! error TS1273: 'private' modifier cannot appear on a type parameter - * @param {T} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @returns {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - function f(x) { - return x; +- * @param {T} x +- * @returns {T} +- */ +- function f(x) { +- return x; +- } +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt index ca0f96dde5..fa41333755 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt @@ -1,17 +1,10 @@ -a.js(8,11): error TS2304: Cannot find name 'Covariant'. -a.js(13,11): error TS2304: Cannot find name 'Covariant'. -a.js(27,11): error TS2304: Cannot find name 'Contravariant'. a.js(29,33): error TS7006: Parameter 'x' implicitly has an 'any' type. -a.js(32,11): error TS2304: Cannot find name 'Contravariant'. a.js(34,31): error TS7006: Parameter 'x' implicitly has an 'any' type. -a.js(46,11): error TS2304: Cannot find name 'Invariant'. a.js(48,29): error TS7006: Parameter 'x' implicitly has an 'any' type. -a.js(51,11): error TS2304: Cannot find name 'Invariant'. a.js(53,27): error TS7006: Parameter 'x' implicitly has an 'any' type. -a.js(60,12): error TS2304: Cannot find name 'T'. -==== a.js (11 errors) ==== +==== a.js (4 errors) ==== /** * @template out T * @typedef {Object} Covariant @@ -20,15 +13,11 @@ a.js(60,12): error TS2304: Cannot find name 'T'. /** * @type {Covariant} - ~~~~~~~~~ -!!! error TS2304: Cannot find name 'Covariant'. */ let super_covariant = { x: 1 }; /** * @type {Covariant} - ~~~~~~~~~ -!!! error TS2304: Cannot find name 'Covariant'. */ let sub_covariant = { x: '' }; @@ -43,8 +32,6 @@ a.js(60,12): error TS2304: Cannot find name 'T'. /** * @type {Contravariant} - ~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'Contravariant'. */ let super_contravariant = { f: (x) => {} }; ~ @@ -52,8 +39,6 @@ a.js(60,12): error TS2304: Cannot find name 'T'. /** * @type {Contravariant} - ~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'Contravariant'. */ let sub_contravariant = { f: (x) => {} }; ~ @@ -70,8 +55,6 @@ a.js(60,12): error TS2304: Cannot find name 'T'. /** * @type {Invariant} - ~~~~~~~~~ -!!! error TS2304: Cannot find name 'Invariant'. */ let super_invariant = { f: (x) => {} }; ~ @@ -79,8 +62,6 @@ a.js(60,12): error TS2304: Cannot find name 'T'. /** * @type {Invariant} - ~~~~~~~~~ -!!! error TS2304: Cannot find name 'Invariant'. */ let sub_invariant = { f: (x) => { return "" } }; ~ @@ -92,8 +73,6 @@ a.js(60,12): error TS2304: Cannot find name 'T'. /** * @template in T * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. */ function f(x) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt.diff index 7e7d2a8170..2c159fbbe2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt.diff @@ -14,39 +14,18 @@ - 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(8,11): error TS2304: Cannot find name 'Covariant'. -+a.js(13,11): error TS2304: Cannot find name 'Covariant'. -+a.js(27,11): error TS2304: Cannot find name 'Contravariant'. +a.js(29,33): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(32,11): error TS2304: Cannot find name 'Contravariant'. +a.js(34,31): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(46,11): error TS2304: Cannot find name 'Invariant'. +a.js(48,29): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(51,11): error TS2304: Cannot find name 'Invariant'. +a.js(53,27): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(60,12): error TS2304: Cannot find name 'T'. -==== a.js (5 errors) ==== -+==== a.js (11 errors) ==== ++==== a.js (4 errors) ==== /** * @template out T * @typedef {Object} Covariant -@@= skipped -21, +19 lines =@@ - - /** - * @type {Covariant} -+ ~~~~~~~~~ -+!!! error TS2304: Cannot find name 'Covariant'. - */ - let super_covariant = { x: 1 }; - - /** - * @type {Covariant} -+ ~~~~~~~~~ -+!!! error TS2304: Cannot find name 'Covariant'. - */ - let sub_covariant = { x: '' }; +@@= skipped -31, +22 lines =@@ super_covariant = sub_covariant; sub_covariant = super_covariant; // Error @@ -56,12 +35,8 @@ /** * @template in T -@@= skipped -22, +23 lines =@@ - - /** +@@= skipped -14, +11 lines =@@ * @type {Contravariant} -+ ~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'Contravariant'. */ let super_contravariant = { f: (x) => {} }; + ~ @@ -69,8 +44,6 @@ /** * @type {Contravariant} -+ ~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'Contravariant'. */ let sub_contravariant = { f: (x) => {} }; + ~ @@ -83,12 +56,8 @@ sub_contravariant = super_contravariant; /** -@@= skipped -22, +27 lines =@@ - - /** +@@= skipped -22, +23 lines =@@ * @type {Invariant} -+ ~~~~~~~~~ -+!!! error TS2304: Cannot find name 'Invariant'. */ let super_invariant = { f: (x) => {} }; + ~ @@ -96,8 +65,6 @@ /** * @type {Invariant} -+ ~~~~~~~~~ -+!!! error TS2304: Cannot find name 'Invariant'. */ let sub_invariant = { f: (x) => { return "" } }; + ~ @@ -121,8 +88,5 @@ - ~~ -!!! error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias * @param {T} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. */ function f(x) {} - diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt deleted file mode 100644 index ba699fddc5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt +++ /dev/null @@ -1,99 +0,0 @@ -file.js(6,12): error TS2304: Cannot find name 'A'. -file.js(8,12): error TS2304: Cannot find name 'A'. -file.js(10,12): error TS2304: Cannot find name 'A'. -file.js(12,12): error TS2304: Cannot find name 'A'. -file.js(46,12): error TS2304: Cannot find name 'T'. -file.js(47,12): error TS2304: Cannot find name 'U'. -file.js(54,12): error TS2304: Cannot find name 'T'. -file.js(55,12): error TS2304: Cannot find name 'U'. -file.js(62,12): error TS2304: Cannot find name 'T'. -file.js(63,12): error TS2304: Cannot find name 'U'. - - -==== file.js (10 errors) ==== - /** - * @template {string | number} [T=string] - ok: defaults are permitted - * @typedef {[T]} A - */ - - /** @type {A} */ // ok, default for `T` in `A` is `string` - ~ -!!! error TS2304: Cannot find name 'A'. - const aDefault1 = [""]; - /** @type {A} */ // error: `number` is not assignable to string` - ~ -!!! error TS2304: Cannot find name 'A'. - const aDefault2 = [0]; - /** @type {A} */ // ok, `T` is provided for `A` - ~ -!!! error TS2304: Cannot find name 'A'. - const aString = [""]; - /** @type {A} */ // ok, `T` is provided for `A` - ~ -!!! error TS2304: Cannot find name 'A'. - const aNumber = [0]; - - /** - * @template T - * @template [U=T] - ok: default can reference earlier type parameter - * @typedef {[T, U]} B - */ - - /** - * @template {string | number} [T] - error: default requires an `=type` - * @typedef {[T]} C - */ - - /** - * @template {string | number} [T=] - error: default requires a `type` - * @typedef {[T]} D - */ - - /** - * @template {string | number} [T=string] - * @template U - error: Required type parameters cannot follow optional type parameters - * @typedef {[T, U]} E - */ - - /** - * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. - * @template [U=T] - * @typedef {[T, U]} G - */ - - /** - * @template T - * @template [U=T] - ok: default can reference earlier type parameter - * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. - * @param {U} b - ~ -!!! error TS2304: Cannot find name 'U'. - */ - function f1(a, b) {} - - /** - * @template {string | number} [T=string] - * @template U - error: Required type parameters cannot follow optional type parameters - * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. - * @param {U} b - ~ -!!! error TS2304: Cannot find name 'U'. - */ - function f2(a, b) {} - - /** - * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. - * @template [U=T] - * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. - * @param {U} b - ~ -!!! error TS2304: Cannot find name 'U'. - */ - function f3(a, b) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt.diff index 9353dab363..eec04653f1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt.diff @@ -1,6 +1,6 @@ --- old.jsdocTemplateTagDefault.errors.txt +++ new.jsdocTemplateTagDefault.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -file.js(9,20): error TS2322: Type 'number' is not assignable to type 'string'. -file.js(22,34): error TS1005: '=' expected. -file.js(27,35): error TS1110: Type expected. @@ -8,113 +8,88 @@ -file.js(38,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. -file.js(53,14): error TS2706: Required type parameters may not follow optional type parameters. -file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. -+file.js(6,12): error TS2304: Cannot find name 'A'. -+file.js(8,12): error TS2304: Cannot find name 'A'. -+file.js(10,12): error TS2304: Cannot find name 'A'. -+file.js(12,12): error TS2304: Cannot find name 'A'. -+file.js(46,12): error TS2304: Cannot find name 'T'. -+file.js(47,12): error TS2304: Cannot find name 'U'. -+file.js(54,12): error TS2304: Cannot find name 'T'. -+file.js(55,12): error TS2304: Cannot find name 'U'. -+file.js(62,12): error TS2304: Cannot find name 'T'. -+file.js(63,12): error TS2304: Cannot find name 'U'. - - +- +- -==== file.js (7 errors) ==== -+==== file.js (10 errors) ==== - /** - * @template {string | number} [T=string] - ok: defaults are permitted - * @typedef {[T]} A - */ - - /** @type {A} */ // ok, default for `T` in `A` is `string` -+ ~ -+!!! error TS2304: Cannot find name 'A'. - const aDefault1 = [""]; - /** @type {A} */ // error: `number` is not assignable to string` -+ ~ -+!!! error TS2304: Cannot find name 'A'. - const aDefault2 = [0]; +- /** +- * @template {string | number} [T=string] - ok: defaults are permitted +- * @typedef {[T]} A +- */ +- +- /** @type {A} */ // ok, default for `T` in `A` is `string` +- const aDefault1 = [""]; +- /** @type {A} */ // error: `number` is not assignable to string` +- const aDefault2 = [0]; - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - /** @type {A} */ // ok, `T` is provided for `A` -+ ~ -+!!! error TS2304: Cannot find name 'A'. - const aString = [""]; - /** @type {A} */ // ok, `T` is provided for `A` -+ ~ -+!!! error TS2304: Cannot find name 'A'. - const aNumber = [0]; - - /** -@@= skipped -31, +40 lines =@@ - - /** - * @template {string | number} [T] - error: default requires an `=type` +- /** @type {A} */ // ok, `T` is provided for `A` +- const aString = [""]; +- /** @type {A} */ // ok, `T` is provided for `A` +- const aNumber = [0]; +- +- /** +- * @template T +- * @template [U=T] - ok: default can reference earlier type parameter +- * @typedef {[T, U]} B +- */ +- +- /** +- * @template {string | number} [T] - error: default requires an `=type` - ~ -!!! error TS1005: '=' expected. - * @typedef {[T]} C - */ - - /** - * @template {string | number} [T=] - error: default requires a `type` +- * @typedef {[T]} C +- */ +- +- /** +- * @template {string | number} [T=] - error: default requires a `type` - ~ -!!! error TS1110: Type expected. - * @typedef {[T]} D - */ - - /** - * @template {string | number} [T=string] - * @template U - error: Required type parameters cannot follow optional type parameters +- * @typedef {[T]} D +- */ +- +- /** +- * @template {string | number} [T=string] +- * @template U - error: Required type parameters cannot follow optional type parameters - ~ -!!! error TS2706: Required type parameters may not follow optional type parameters. - * @typedef {[T, U]} E - */ - - /** - * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. +- * @typedef {[T, U]} E +- */ +- +- /** +- * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. - ~ -!!! error TS2744: Type parameter defaults can only reference previously declared type parameters. - * @template [U=T] - * @typedef {[T, U]} G - */ -@@= skipped -32, +24 lines =@@ - * @template T - * @template [U=T] - ok: default can reference earlier type parameter - * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @param {U} b -+ ~ -+!!! error TS2304: Cannot find name 'U'. - */ - function f1(a, b) {} - - /** - * @template {string | number} [T=string] - * @template U - error: Required type parameters cannot follow optional type parameters +- * @template [U=T] +- * @typedef {[T, U]} G +- */ +- +- /** +- * @template T +- * @template [U=T] - ok: default can reference earlier type parameter +- * @param {T} a +- * @param {U} b +- */ +- function f1(a, b) {} +- +- /** +- * @template {string | number} [T=string] +- * @template U - error: Required type parameters cannot follow optional type parameters - ~ -!!! error TS2706: Required type parameters may not follow optional type parameters. - * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @param {U} b -+ ~ -+!!! error TS2304: Cannot find name 'U'. - */ - function f2(a, b) {} - - /** - * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. +- * @param {T} a +- * @param {U} b +- */ +- function f2(a, b) {} +- +- /** +- * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. - ~ -!!! error TS2744: Type parameter defaults can only reference previously declared type parameters. - * @template [U=T] - * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. - * @param {U} b -+ ~ -+!!! error TS2304: Cannot find name 'U'. - */ - function f3(a, b) {} - +- * @template [U=T] +- * @param {T} a +- * @param {U} b +- */ +- function f3(a, b) {} +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt deleted file mode 100644 index 39fe8a2b7a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -file.js(9,12): error TS2304: Cannot find name 'Foo'. - - -==== file.js (1 errors) ==== - /** - * @template T - * @template {keyof T} K - * @typedef {T[K]} Foo - */ - - const x = { a: 1 }; - - /** @type {Foo} */ - ~~~ -!!! error TS2304: Cannot find name 'Foo'. - const y = "a"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt.diff index 45d19e2253..5d4aec8581 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt.diff @@ -1,17 +1,21 @@ --- old.jsdocTemplateTagNameResolution.errors.txt +++ new.jsdocTemplateTagNameResolution.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -file.js(10,7): error TS2322: Type 'string' is not assignable to type 'number'. -+file.js(9,12): error TS2304: Cannot find name 'Foo'. - - - ==== file.js (1 errors) ==== -@@= skipped -10, +10 lines =@@ - const x = { a: 1 }; - - /** @type {Foo} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Foo'. - const y = "a"; +- +- +-==== file.js (1 errors) ==== +- /** +- * @template T +- * @template {keyof T} K +- * @typedef {T[K]} Foo +- */ +- +- const x = { a: 1 }; +- +- /** @type {Foo} */ +- const y = "a"; - ~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt deleted file mode 100644 index 94ee1d5f47..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt +++ /dev/null @@ -1,50 +0,0 @@ -/a.js(3,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(13,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? - - -==== /types.d.ts (0 errors) ==== - export interface Foo { - foo: () => void; - } - - export type M = (this: Foo) => void; - -==== /a.js (3 errors) ==== - /** @type {import('./types').M} */ - export const f1 = function() { - this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. - } - - /** @type {import('./types').M} */ - export function f2() { - this.test(); - } - - /** @type {(this: import('./types').Foo) => void} */ - export const f3 = function() { - this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. - } - - /** @type {(this: import('./types').Foo) => void} */ - export function f4() { - this.test(); - } - - /** @type {function(this: import('./types').Foo): void} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - export const f5 = function() { - this.test(); - } - - /** @type {function(this: import('./types').Foo): void} */ - export function f6() { - this.test(); - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt.diff index 2531a30be7..953254940d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt.diff @@ -1,56 +1,63 @@ --- old.jsdocThisType.errors.txt +++ new.jsdocThisType.errors.txt -@@= skipped -0, +0 lines =@@ - /a.js(3,10): error TS2339: Property 'test' does not exist on type 'Foo'. +@@= skipped -0, +-1 lines =@@ +-/a.js(3,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(8,10): error TS2339: Property 'test' does not exist on type 'Foo'. - /a.js(13,10): error TS2339: Property 'test' does not exist on type 'Foo'. +-/a.js(13,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(18,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(23,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(28,10): error TS2339: Property 'test' does not exist on type 'Foo'. -+/a.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? - - - ==== /types.d.ts (0 errors) ==== -@@= skipped -12, +9 lines =@@ - - export type M = (this: Foo) => void; - +- +- +-==== /types.d.ts (0 errors) ==== +- export interface Foo { +- foo: () => void; +- } +- +- export type M = (this: Foo) => void; +- -==== /a.js (6 errors) ==== -+==== /a.js (3 errors) ==== - /** @type {import('./types').M} */ - export const f1 = function() { - this.test(); -@@= skipped -11, +11 lines =@@ - /** @type {import('./types').M} */ - export function f2() { - this.test(); +- /** @type {import('./types').M} */ +- export const f1 = function() { +- this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. - } - - /** @type {(this: import('./types').Foo) => void} */ -@@= skipped -14, +12 lines =@@ - /** @type {(this: import('./types').Foo) => void} */ - export function f4() { - this.test(); +- } +- +- /** @type {import('./types').M} */ +- export function f2() { +- this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. - } - - /** @type {function(this: import('./types').Foo): void} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - export const f5 = function() { - this.test(); +- } +- +- /** @type {(this: import('./types').Foo) => void} */ +- export const f3 = function() { +- this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. - } - - /** @type {function(this: import('./types').Foo): void} */ - export function f6() { - this.test(); +- } +- +- /** @type {(this: import('./types').Foo) => void} */ +- export function f4() { +- this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. - } - +- } +- +- /** @type {function(this: import('./types').Foo): void} */ +- export const f5 = function() { +- this.test(); +- ~~~~ +-!!! error TS2339: Property 'test' does not exist on type 'Foo'. +- } +- +- /** @type {function(this: import('./types').Foo): void} */ +- export function f6() { +- this.test(); +- ~~~~ +-!!! error TS2339: Property 'test' does not exist on type 'Foo'. +- } +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols b/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols index f9fd5bc328..308da31e12 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols @@ -19,7 +19,6 @@ export const f1 = function() { >f1 : Symbol(f1, Decl(a.js, 1, 12)) this.test(); ->this : Symbol(this, Decl(types.d.ts, 4, 17)) } /** @type {import('./types').M} */ @@ -34,7 +33,6 @@ export const f3 = function() { >f3 : Symbol(f3, Decl(a.js, 11, 12)) this.test(); ->this : Symbol(this, Decl(a.js, 10, 12)) } /** @type {(this: import('./types').Foo) => void} */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols.diff index 9b62092c66..c988aae3fa 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols.diff @@ -9,7 +9,15 @@ } export type M = (this: Foo) => void; -@@= skipped -22, +22 lines =@@ +@@= skipped -14, +14 lines =@@ + >f1 : Symbol(f1, Decl(a.js, 1, 12)) + + this.test(); +->this : Symbol(this, Decl(types.d.ts, 4, 17)) + } + + /** @type {import('./types').M} */ +@@= skipped -8, +7 lines =@@ >f2 : Symbol(f2, Decl(a.js, 3, 1)) this.test(); @@ -17,7 +25,15 @@ } /** @type {(this: import('./types').Foo) => void} */ -@@= skipped -16, +15 lines =@@ +@@= skipped -8, +7 lines =@@ + >f3 : Symbol(f3, Decl(a.js, 11, 12)) + + this.test(); +->this : Symbol(this, Decl(a.js, 10, 12)) + } + + /** @type {(this: import('./types').Foo) => void} */ +@@= skipped -8, +7 lines =@@ >f4 : Symbol(f4, Decl(a.js, 13, 1)) this.test(); diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt deleted file mode 100644 index be8a7c7817..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -index.js(1,12): error TS2304: Cannot find name 'AnyEffect'. -index.js(3,12): error TS2304: Cannot find name 'Third'. - - -==== dtsEquivalent.js (0 errors) ==== - /** @typedef {{[k: string]: any}} AnyEffect */ - /** @typedef {number} Third */ -==== index.js (2 errors) ==== - /** @type {AnyEffect} */ - ~~~~~~~~~ -!!! error TS2304: Cannot find name 'AnyEffect'. - let b; - /** @type {Third} */ - ~~~~~ -!!! error TS2304: Cannot find name 'Third'. - let c; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt.diff deleted file mode 100644 index e03e9d76e5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.jsdocTypeDefAtStartOfFile.errors.txt -+++ new.jsdocTypeDefAtStartOfFile.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(1,12): error TS2304: Cannot find name 'AnyEffect'. -+index.js(3,12): error TS2304: Cannot find name 'Third'. -+ -+ -+==== dtsEquivalent.js (0 errors) ==== -+ /** @typedef {{[k: string]: any}} AnyEffect */ -+ /** @typedef {number} Third */ -+==== index.js (2 errors) ==== -+ /** @type {AnyEffect} */ -+ ~~~~~~~~~ -+!!! error TS2304: Cannot find name 'AnyEffect'. -+ let b; -+ /** @type {Third} */ -+ ~~~~~ -+!!! error TS2304: Cannot find name 'Third'. -+ let c; -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt index 4b1d9f2cb3..4bd269ce21 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt @@ -1,15 +1,12 @@ bug27342.js(1,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -bug27342.js(3,11): error TS2304: Cannot find name 'exports'. -==== bug27342.js (2 errors) ==== +==== bug27342.js (1 errors) ==== module.exports = {} ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** * @type {exports} - ~~~~~~~ -!!! error TS2304: Cannot find name 'exports'. */ var x diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt.diff index 262c292351..b63d4bf21d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt.diff @@ -4,17 +4,14 @@ - @@= skipped --1, +1 lines =@@ +bug27342.js(1,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+bug27342.js(3,11): error TS2304: Cannot find name 'exports'. + + -+==== bug27342.js (2 errors) ==== ++==== bug27342.js (1 errors) ==== + module.exports = {} + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** + * @type {exports} -+ ~~~~~~~ -+!!! error TS2304: Cannot find name 'exports'. + */ + var x + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt index a7f7b62b4e..e7cbf8fc04 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt @@ -1,10 +1,8 @@ jsdocTypeReferenceToImport.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. jsdocTypeReferenceToImport.js(2,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -jsdocTypeReferenceToImport.js(3,12): error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? -jsdocTypeReferenceToImport.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? -==== jsdocTypeReferenceToImport.js (4 errors) ==== +==== jsdocTypeReferenceToImport.js (2 errors) ==== const C = require('./ex').C; ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -12,15 +10,11 @@ jsdocTypeReferenceToImport.js(8,12): error TS2749: 'D' refers to a value, but is ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @type {C} c */ - ~ -!!! error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? var c = new C() c.start c.end /** @type {D} c */ - ~ -!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? var d = new D() d.start d.end diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt.diff index 6e5a04bd5a..63e4a4f2bd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt.diff @@ -5,11 +5,9 @@ @@= skipped --1, +1 lines =@@ +jsdocTypeReferenceToImport.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +jsdocTypeReferenceToImport.js(2,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+jsdocTypeReferenceToImport.js(3,12): error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? -+jsdocTypeReferenceToImport.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + + -+==== jsdocTypeReferenceToImport.js (4 errors) ==== ++==== jsdocTypeReferenceToImport.js (2 errors) ==== + const C = require('./ex').C; + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -17,15 +15,11 @@ + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @type {C} c */ -+ ~ -+!!! error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? + var c = new C() + c.start + c.end + + /** @type {D} c */ -+ ~ -+!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + var d = new D() + d.start + d.end diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt index a820680442..87c84ddade 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt @@ -1,13 +1,10 @@ -jsdocTypeReferenceToMergedClass.js(2,12): error TS2503: Cannot find namespace 'Workspace'. jsdocTypeReferenceToMergedClass.js(6,11): error TS2339: Property 'Project' does not exist on type '{}'. jsdocTypeReferenceToMergedClass.js(7,11): error TS2339: Property 'Project' does not exist on type '{}'. -==== jsdocTypeReferenceToMergedClass.js (3 errors) ==== +==== jsdocTypeReferenceToMergedClass.js (2 errors) ==== var Workspace = {} /** @type {Workspace.Project} */ - ~~~~~~~~~ -!!! error TS2503: Cannot find namespace 'Workspace'. var p; p.isServiceProject() diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt.diff index 4f06122ae6..1f84bbb30a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt.diff @@ -3,16 +3,13 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+jsdocTypeReferenceToMergedClass.js(2,12): error TS2503: Cannot find namespace 'Workspace'. +jsdocTypeReferenceToMergedClass.js(6,11): error TS2339: Property 'Project' does not exist on type '{}'. +jsdocTypeReferenceToMergedClass.js(7,11): error TS2339: Property 'Project' does not exist on type '{}'. + + -+==== jsdocTypeReferenceToMergedClass.js (3 errors) ==== ++==== jsdocTypeReferenceToMergedClass.js (2 errors) ==== + var Workspace = {} + /** @type {Workspace.Project} */ -+ ~~~~~~~~~ -+!!! error TS2503: Cannot find namespace 'Workspace'. + var p; + p.isServiceProject() + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt deleted file mode 100644 index bee4d86738..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -foo.js(1,13): error TS2749: 'Image' refers to a value, but is being used as a type here. Did you mean 'typeof Image'? - - -==== foo.js (1 errors) ==== - /** @param {Image} image */ - ~~~~~ -!!! error TS2749: 'Image' refers to a value, but is being used as a type here. Did you mean 'typeof Image'? - function process(image) { - return new image(1, 1) - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt.diff deleted file mode 100644 index 9ea73f0fd7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.jsdocTypeReferenceToValue.errors.txt -+++ new.jsdocTypeReferenceToValue.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+foo.js(1,13): error TS2749: 'Image' refers to a value, but is being used as a type here. Did you mean 'typeof Image'? -+ -+ -+==== foo.js (1 errors) ==== -+ /** @param {Image} image */ -+ ~~~~~ -+!!! error TS2749: 'Image' refers to a value, but is being used as a type here. Did you mean 'typeof Image'? -+ function process(image) { -+ return new image(1, 1) -+ } -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt deleted file mode 100644 index 8ef37b875d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt +++ /dev/null @@ -1,131 +0,0 @@ -a.js(19,12): error TS2304: Cannot find name 'Void'. -a.js(25,12): error TS2304: Cannot find name 'Undefined'. -a.js(31,12): error TS2304: Cannot find name 'Null'. -a.js(37,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -a.js(40,12): error TS2552: Cannot find name 'array'. Did you mean 'Array'? -a.js(43,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -a.js(46,12): error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? -b.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. -b.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. -b.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. -b.ts(18,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. - - -==== a.js (7 errors) ==== - /** @type {String} */ - var S; - - /** @type {string} */ - var s; - - /** @type {Number} */ - var N; - - /** @type {number} */ - var n; - - /** @type {Boolean} */ - var B; - - /** @type {boolean} */ - var b; - - /** @type {Void} */ - ~~~~ -!!! error TS2304: Cannot find name 'Void'. - var V; - - /** @type {void} */ - var v; - - /** @type {Undefined} */ - ~~~~~~~~~ -!!! error TS2304: Cannot find name 'Undefined'. - var U; - - /** @type {undefined} */ - var u; - - /** @type {Null} */ - ~~~~ -!!! error TS2304: Cannot find name 'Null'. - var Nl; - - /** @type {null} */ - var nl; - - /** @type {Array} */ - ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - var A; - - /** @type {array} */ - ~~~~~ -!!! error TS2552: Cannot find name 'array'. Did you mean 'Array'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Array' is declared here. - var a; - - /** @type {Promise} */ - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). - var P; - - /** @type {promise} */ - ~~~~~~~ -!!! error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? - var p; - - /** @type {?number} */ - var nullable; - - /** @type {Object} */ - var Obj; - - /** @type {object} */ - var obj; - - /** @type {Function} */ - var Func; - - /** @type {(s: string) => number} */ - var f; - - /** @type {new (s: string) => { s: string }} */ - var ctor; - -==== b.ts (4 errors) ==== - var S: string; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. -!!! related TS6203 a.js:2:5: 'S' was also declared here. - var s: string; - var N: number; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. -!!! related TS6203 a.js:8:5: 'N' was also declared here. - var n: number - var B: boolean; - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. -!!! related TS6203 a.js:14:5: 'B' was also declared here. - var b: boolean; - var V :void; - var v: void; - var U: undefined; - var u: undefined; - var Nl: null; - var nl: null; - var A: any[]; - var a: any[]; - var P: Promise; - var p: Promise; - var nullable: number | null; - var Obj: any; - ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. -!!! related TS6203 a.js:53:5: 'Obj' was also declared here. - var obj: any; - var Func: Function; - var f: (s: string) => number; - var ctor: new (s: string) => { s: string }; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt.diff deleted file mode 100644 index 0a8f07906a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt.diff +++ /dev/null @@ -1,136 +0,0 @@ ---- old.jsdocTypeTag.errors.txt -+++ new.jsdocTypeTag.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+a.js(19,12): error TS2304: Cannot find name 'Void'. -+a.js(25,12): error TS2304: Cannot find name 'Undefined'. -+a.js(31,12): error TS2304: Cannot find name 'Null'. -+a.js(37,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+a.js(40,12): error TS2552: Cannot find name 'array'. Did you mean 'Array'? -+a.js(43,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -+a.js(46,12): error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? -+b.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. -+b.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. -+b.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. -+b.ts(18,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. -+ -+ -+==== a.js (7 errors) ==== -+ /** @type {String} */ -+ var S; -+ -+ /** @type {string} */ -+ var s; -+ -+ /** @type {Number} */ -+ var N; -+ -+ /** @type {number} */ -+ var n; -+ -+ /** @type {Boolean} */ -+ var B; -+ -+ /** @type {boolean} */ -+ var b; -+ -+ /** @type {Void} */ -+ ~~~~ -+!!! error TS2304: Cannot find name 'Void'. -+ var V; -+ -+ /** @type {void} */ -+ var v; -+ -+ /** @type {Undefined} */ -+ ~~~~~~~~~ -+!!! error TS2304: Cannot find name 'Undefined'. -+ var U; -+ -+ /** @type {undefined} */ -+ var u; -+ -+ /** @type {Null} */ -+ ~~~~ -+!!! error TS2304: Cannot find name 'Null'. -+ var Nl; -+ -+ /** @type {null} */ -+ var nl; -+ -+ /** @type {Array} */ -+ ~~~~~ -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). -+ var A; -+ -+ /** @type {array} */ -+ ~~~~~ -+!!! error TS2552: Cannot find name 'array'. Did you mean 'Array'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Array' is declared here. -+ var a; -+ -+ /** @type {Promise} */ -+ ~~~~~~~ -+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). -+ var P; -+ -+ /** @type {promise} */ -+ ~~~~~~~ -+!!! error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? -+ var p; -+ -+ /** @type {?number} */ -+ var nullable; -+ -+ /** @type {Object} */ -+ var Obj; -+ -+ /** @type {object} */ -+ var obj; -+ -+ /** @type {Function} */ -+ var Func; -+ -+ /** @type {(s: string) => number} */ -+ var f; -+ -+ /** @type {new (s: string) => { s: string }} */ -+ var ctor; -+ -+==== b.ts (4 errors) ==== -+ var S: string; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. -+!!! related TS6203 a.js:2:5: 'S' was also declared here. -+ var s: string; -+ var N: number; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. -+!!! related TS6203 a.js:8:5: 'N' was also declared here. -+ var n: number -+ var B: boolean; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. -+!!! related TS6203 a.js:14:5: 'B' was also declared here. -+ var b: boolean; -+ var V :void; -+ var v: void; -+ var U: undefined; -+ var u: undefined; -+ var Nl: null; -+ var nl: null; -+ var A: any[]; -+ var a: any[]; -+ var P: Promise; -+ var p: Promise; -+ var nullable: number | null; -+ var Obj: any; -+ ~~~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. -+!!! related TS6203 a.js:53:5: 'Obj' was also declared here. -+ var obj: any; -+ var Func: Function; -+ var f: (s: string) => number; -+ var ctor: new (s: string) => { s: string }; -+ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt index fe4c9bb317..1ec09afcfc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt @@ -3,16 +3,12 @@ b.js(4,5): error TS2403: Subsequent variable declarations must have the same typ b.js(17,14): error TS2339: Property 'p' does not exist on type 'SomeBase'. b.js(23,14): error TS2339: Property 'x' does not exist on type 'SomeDerived'. b.js(28,14): error TS2339: Property 'q' does not exist on type 'SomeOther'. -b.js(66,38): error TS2454: Variable 'numOrStr' is used before being assigned. -b.js(67,2): error TS2322: Type 'string | number' is not assignable to type 'string'. - Type 'number' is not assignable to type 'string'. -b.js(67,8): error TS2454: Variable 'numOrStr' is used before being assigned. ==== a.ts (0 errors) ==== var W: string; -==== b.js (8 errors) ==== +==== b.js (5 errors) ==== // @ts-check var W = /** @type {string} */(/** @type {*} */ (4)); ~ @@ -91,14 +87,7 @@ b.js(67,8): error TS2454: Variable 'numOrStr' is used before being assigned. /** @type {string} */ var str; if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error - ~~~~~~~~ -!!! error TS2454: Variable 'numOrStr' is used before being assigned. str = numOrStr; // Error, no narrowing occurred - ~~~ -!!! error TS2322: Type 'string | number' is not assignable to type 'string'. -!!! error TS2322: Type 'number' is not assignable to type 'string'. - ~~~~~~~~ -!!! error TS2454: Variable 'numOrStr' is used before being assigned. } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt.diff index a99fa40921..c4f2e49124 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt.diff @@ -15,20 +15,22 @@ - Type 'string | number' is not assignable to type 'number'. - Type 'string' is not assignable to type 'number'. -b.js(66,15): error TS1228: A type predicate is only allowed in return type position for functions and methods. +-b.js(66,38): error TS2454: Variable 'numOrStr' is used before being assigned. +-b.js(67,2): error TS2322: Type 'string | number' is not assignable to type 'string'. +- Type 'number' is not assignable to type 'string'. +-b.js(67,8): error TS2454: Variable 'numOrStr' is used before being assigned. +b.js(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. +b.js(4,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. +b.js(17,14): error TS2339: Property 'p' does not exist on type 'SomeBase'. +b.js(23,14): error TS2339: Property 'x' does not exist on type 'SomeDerived'. +b.js(28,14): error TS2339: Property 'q' does not exist on type 'SomeOther'. - b.js(66,38): error TS2454: Variable 'numOrStr' is used before being assigned. - b.js(67,2): error TS2322: Type 'string | number' is not assignable to type 'string'. - Type 'number' is not assignable to type 'string'. -@@= skipped -20, +11 lines =@@ + + ==== a.ts (0 errors) ==== var W: string; -==== b.js (10 errors) ==== -+==== b.js (8 errors) ==== ++==== b.js (5 errors) ==== // @ts-check var W = /** @type {string} */(/** @type {*} */ (4)); + ~ @@ -44,7 +46,7 @@ /** @type {*} */ var a; -@@= skipped -20, +24 lines =@@ +@@= skipped -40, +31 lines =@@ class SomeBase { constructor() { this.p = 42; @@ -114,6 +116,14 @@ if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error - ~~~~~~~~~~~~~~~~~~ -!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. - ~~~~~~~~ - !!! error TS2454: Variable 'numOrStr' is used before being assigned. +- ~~~~~~~~ +-!!! error TS2454: Variable 'numOrStr' is used before being assigned. str = numOrStr; // Error, no narrowing occurred +- ~~~ +-!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +-!!! error TS2322: Type 'number' is not assignable to type 'string'. +- ~~~~~~~~ +-!!! error TS2454: Variable 'numOrStr' is used before being assigned. + } + + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt index 4b79a3d468..6d33f5168c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt @@ -1,13 +1,9 @@ -a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. a.js(6,12): error TS7006: Parameter 's' implicitly has an 'any' type. -==== a.js (3 errors) ==== +==== a.js (2 errors) ==== /** @type {function(string): void} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const f = (value) => { ~~~~~ !!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt.diff index 186716f23c..efbaae8b0e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt.diff @@ -3,17 +3,12 @@ @@= skipped -0, +0 lines =@@ -a.js(3,5): error TS2322: Type 'number' is not assignable to type 'string'. -a.js(7,5): error TS2322: Type 'number' is not assignable to type 'string'. -+a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. +a.js(6,12): error TS7006: Parameter 's' implicitly has an 'any' type. --==== a.js (2 errors) ==== -+==== a.js (3 errors) ==== + ==== a.js (2 errors) ==== /** @type {function(string): void} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const f = (value) => { + ~~~~~ +!!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt index 96a1ffda77..daf530d84c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt @@ -1,4 +1,3 @@ -a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. a.js(5,12): error TS7006: Parameter 's' implicitly has an 'any' type. a.js(8,12): error TS7006: Parameter 's' implicitly has an 'any' type. @@ -6,11 +5,8 @@ a.js(12,1): error TS2554: Expected 1 arguments, but got 0. a.js(13,1): error TS2554: Expected 1 arguments, but got 0. -==== a.js (6 errors) ==== +==== a.js (5 errors) ==== /** @type {function(string): void} */ - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const f = (value) => { ~~~~~ !!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff index f075ff78a8..7c75708ad3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff @@ -2,7 +2,6 @@ +++ new.jsdocTypeTagRequiredParameters.errors.txt @@= skipped -0, +0 lines =@@ -a.js(11,1): error TS2554: Expected 1 arguments, but got 0. -+a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. +a.js(5,12): error TS7006: Parameter 's' implicitly has an 'any' type. +a.js(8,12): error TS7006: Parameter 's' implicitly has an 'any' type. @@ -11,11 +10,8 @@ -==== a.js (3 errors) ==== -+==== a.js (6 errors) ==== ++==== a.js (5 errors) ==== /** @type {function(string): void} */ -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const f = (value) => { + ~~~~~ +!!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt deleted file mode 100644 index 908bca4dda..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -a.js(2,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? - - -==== a.js (1 errors) ==== - /** - * @type {function(boolean, string, ...*):void} - ~~~~~~~~ -!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. - */ - const foo = function (a, b, ...r) { }; - -==== b.ts (0 errors) ==== - foo(false, ''); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt.diff deleted file mode 100644 index a1c6c35172..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.jsdocVariadicType.errors.txt -+++ new.jsdocVariadicType.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+a.js(2,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+ -+ -+==== a.js (1 errors) ==== -+ /** -+ * @type {function(boolean, string, ...*):void} -+ ~~~~~~~~ -+!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. -+ */ -+ const foo = function (a, b, ...r) { }; -+ -+==== b.ts (0 errors) ==== -+ foo(false, ''); -+ diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt index 553c24aa00..65b4903c8a 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt @@ -12,20 +12,6 @@ index.ts(17,31): error TS2694: Namespace '"mod"' has no exported member 'qux'. index.ts(18,31): error TS2694: Namespace '"mod"' has no exported member 'baz'. index.ts(19,31): error TS2694: Namespace '"mod"' has no exported member 'buz'. index.ts(20,31): error TS2694: Namespace '"mod"' has no exported member 'literal'. -main.js(2,28): error TS2694: Namespace '"mod"' has no exported member 'Thing'. -main.js(3,28): error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. -main.js(4,28): error TS2694: Namespace '"mod"' has no exported member 'foo'. -main.js(5,28): error TS2694: Namespace '"mod"' has no exported member 'qux'. -main.js(6,28): error TS2694: Namespace '"mod"' has no exported member 'baz'. -main.js(7,28): error TS2694: Namespace '"mod"' has no exported member 'buz'. -main.js(8,28): error TS2694: Namespace '"mod"' has no exported member 'literal'. -main.js(15,35): error TS2694: Namespace '"mod"' has no exported member 'Thing'. -main.js(16,35): error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. -main.js(17,35): error TS2694: Namespace '"mod"' has no exported member 'foo'. -main.js(18,35): error TS2694: Namespace '"mod"' has no exported member 'qux'. -main.js(19,35): error TS2694: Namespace '"mod"' has no exported member 'baz'. -main.js(20,35): error TS2694: Namespace '"mod"' has no exported member 'buz'. -main.js(21,35): error TS2694: Namespace '"mod"' has no exported member 'literal'. mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -45,29 +31,15 @@ mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install typ baz() { return 5 }, literal: "", } -==== main.js (14 errors) ==== +==== main.js (0 errors) ==== /** * @param {import("./mod").Thing} a - ~~~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'Thing'. * @param {import("./mod").AnotherThing} b - ~~~~~~~~~~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. * @param {import("./mod").foo} c - ~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'foo'. * @param {import("./mod").qux} d - ~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'qux'. * @param {import("./mod").baz} e - ~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'baz'. * @param {import("./mod").buz} f - ~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'buz'. * @param {import("./mod").literal} g - ~~~~~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'literal'. */ function jstypes(a, b, c, d, e, f, g) { return a.x + b.y + c() + d() + e() + f() + g.length @@ -75,26 +47,12 @@ mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install typ /** * @param {typeof import("./mod").Thing} a - ~~~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'Thing'. * @param {typeof import("./mod").AnotherThing} b - ~~~~~~~~~~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. * @param {typeof import("./mod").foo} c - ~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'foo'. * @param {typeof import("./mod").qux} d - ~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'qux'. * @param {typeof import("./mod").baz} e - ~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'baz'. * @param {typeof import("./mod").buz} f - ~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'buz'. * @param {typeof import("./mod").literal} g - ~~~~~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'literal'. */ function jsvalues(a, b, c, d, e, f, g) { return a.length + b.length + c() + d() + e() + f() + g.length diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff index 277b160237..9b2c9edf9d 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff @@ -23,20 +23,6 @@ +index.ts(18,31): error TS2694: Namespace '"mod"' has no exported member 'baz'. +index.ts(19,31): error TS2694: Namespace '"mod"' has no exported member 'buz'. +index.ts(20,31): error TS2694: Namespace '"mod"' has no exported member 'literal'. -+main.js(2,28): error TS2694: Namespace '"mod"' has no exported member 'Thing'. -+main.js(3,28): error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. -+main.js(4,28): error TS2694: Namespace '"mod"' has no exported member 'foo'. -+main.js(5,28): error TS2694: Namespace '"mod"' has no exported member 'qux'. -+main.js(6,28): error TS2694: Namespace '"mod"' has no exported member 'baz'. -+main.js(7,28): error TS2694: Namespace '"mod"' has no exported member 'buz'. -+main.js(8,28): error TS2694: Namespace '"mod"' has no exported member 'literal'. -+main.js(15,35): error TS2694: Namespace '"mod"' has no exported member 'Thing'. -+main.js(16,35): error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. -+main.js(17,35): error TS2694: Namespace '"mod"' has no exported member 'foo'. -+main.js(18,35): error TS2694: Namespace '"mod"' has no exported member 'qux'. -+main.js(19,35): error TS2694: Namespace '"mod"' has no exported member 'baz'. -+main.js(20,35): error TS2694: Namespace '"mod"' has no exported member 'buz'. -+main.js(21,35): error TS2694: Namespace '"mod"' has no exported member 'literal'. +mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -53,62 +39,22 @@ Thing, AnotherThing, foo, -@@= skipped -21, +44 lines =@@ +@@= skipped -21, +30 lines =@@ baz() { return 5 }, literal: "", } -==== main.js (1 errors) ==== -+==== main.js (14 errors) ==== ++==== main.js (0 errors) ==== /** * @param {import("./mod").Thing} a -+ ~~~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'Thing'. * @param {import("./mod").AnotherThing} b -+ ~~~~~~~~~~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. - * @param {import("./mod").foo} c -+ ~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'foo'. - * @param {import("./mod").qux} d -+ ~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'qux'. - * @param {import("./mod").baz} e -+ ~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'baz'. - * @param {import("./mod").buz} f -+ ~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'buz'. - * @param {import("./mod").literal} g -+ ~~~~~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'literal'. - */ - function jstypes(a, b, c, d, e, f, g) { - return a.x + b.y + c() + d() + e() + f() + g.length -@@= skipped -16, +30 lines =@@ - - /** - * @param {typeof import("./mod").Thing} a -+ ~~~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'Thing'. - * @param {typeof import("./mod").AnotherThing} b -+ ~~~~~~~~~~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. - * @param {typeof import("./mod").foo} c -+ ~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'foo'. +@@= skipped -21, +21 lines =@@ * @param {typeof import("./mod").qux} d -+ ~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'qux'. * @param {typeof import("./mod").baz} e -+ ~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'baz'. * @param {typeof import("./mod").buz} f - ~~~ +- ~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'buz'. -+!!! error TS2694: Namespace '"mod"' has no exported member 'buz'. * @param {typeof import("./mod").literal} g -+ ~~~~~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'literal'. */ function jsvalues(a, b, c, d, e, f, g) { return a.length + b.length + c() + d() + e() + f() + g.length diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt deleted file mode 100644 index c9b3fb4a96..0000000000 --- a/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt +++ /dev/null @@ -1,50 +0,0 @@ -overloadTag1.js(26,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. - - -==== overloadTag1.js (1 errors) ==== - /** - * @overload - * @param {number} a - * @param {number} b - * @returns {number} - * - * @overload - * @param {string} a - * @param {boolean} b - * @returns {string} - * - * @param {string | number} a - * @param {string | number} b - * @returns {string | number} - */ - export function overloaded(a,b) { - if (typeof a === "string" && typeof b === "string") { - return a + b; - } else if (typeof a === "number" && typeof b === "number") { - return a + b; - } - throw new Error("Invalid arguments"); - } - var o1 = overloaded(1,2) - var o2 = overloaded("zero", "one") - var o3 = overloaded("a",false) - ~~~~~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. - - /** - * @overload - * @param {number} a - * @param {number} b - * @returns {number} - * - * @overload - * @param {string} a - * @param {boolean} b - * @returns {string} - */ - export function uncheckedInternally(a, b) { - return a + b; - } - uncheckedInternally(1,2) - uncheckedInternally("zero", "one") - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt.diff index 1b93fe96e9..ada3f5d3c0 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt.diff @@ -1,6 +1,6 @@ --- old.overloadTag1.errors.txt +++ new.overloadTag1.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -overloadTag1.js(7,5): error TS2394: This overload signature is not compatible with its implementation signature. -overloadTag1.js(25,10): error TS2769: No overload matches this call. - Overload 1 of 2, '(a: number, b: number): number', gave the following error. @@ -12,48 +12,67 @@ - Argument of type 'string' is not assignable to parameter of type 'number'. - Overload 2 of 2, '(a: string, b: boolean): string', gave the following error. - Argument of type 'string' is not assignable to parameter of type 'boolean'. -+overloadTag1.js(26,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. - - +- +- -==== overloadTag1.js (3 errors) ==== -+==== overloadTag1.js (1 errors) ==== - /** - * @overload - * @param {number} a -@@= skipped -18, +8 lines =@@ - * @returns {number} - * - * @overload +- /** +- * @overload +- * @param {number} a +- * @param {number} b +- * @returns {number} +- * +- * @overload - ~~~~~~~~ -!!! error TS2394: This overload signature is not compatible with its implementation signature. -!!! related TS2750 overloadTag1.js:16:17: The implementation signature is declared here. - * @param {string} a - * @param {boolean} b - * @returns {string} -@@= skipped -21, +18 lines =@@ - } - var o1 = overloaded(1,2) - var o2 = overloaded("zero", "one") +- * @param {string} a +- * @param {boolean} b +- * @returns {string} +- * +- * @param {string | number} a +- * @param {string | number} b +- * @returns {string | number} +- */ +- export function overloaded(a,b) { +- if (typeof a === "string" && typeof b === "string") { +- return a + b; +- } else if (typeof a === "number" && typeof b === "number") { +- return a + b; +- } +- throw new Error("Invalid arguments"); +- } +- var o1 = overloaded(1,2) +- var o2 = overloaded("zero", "one") - ~~~~~~~~~~ -!!! error TS2769: No overload matches this call. -!!! error TS2769: Overload 1 of 2, '(a: number, b: number): number', gave the following error. -!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'number'. -!!! error TS2769: Overload 2 of 2, '(a: string, b: boolean): string', gave the following error. -!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'boolean'. - var o3 = overloaded("a",false) -+ ~~~~~ -+!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. - - /** - * @overload -@@= skipped -24, +20 lines =@@ - } - uncheckedInternally(1,2) - uncheckedInternally("zero", "one") +- var o3 = overloaded("a",false) +- +- /** +- * @overload +- * @param {number} a +- * @param {number} b +- * @returns {number} +- * +- * @overload +- * @param {string} a +- * @param {boolean} b +- * @returns {string} +- */ +- export function uncheckedInternally(a, b) { +- return a + b; +- } +- uncheckedInternally(1,2) +- uncheckedInternally("zero", "one") - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2769: No overload matches this call. -!!! error TS2769: Overload 1 of 2, '(a: number, b: number): number', gave the following error. -!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'number'. -!!! error TS2769: Overload 2 of 2, '(a: string, b: boolean): string', gave the following error. -!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'boolean'. - +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt deleted file mode 100644 index bc5d4f4c38..0000000000 --- a/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -/a.js(12,16): error TS2304: Cannot find name 'T'. -/a.js(17,12): error TS2315: Type 'Foo' is not generic. - - -==== /a.js (2 errors) ==== - /** - * @template T - */ - export class Foo { - /** - * @constructor - * @overload - */ - constructor() { } - - /** - * @param {T} value - ~ -!!! error TS2304: Cannot find name 'T'. - */ - bar(value) { } - } - - /** @type {Foo} */ - ~~~~~~~~~~~ -!!! error TS2315: Type 'Foo' is not generic. - let foo; - foo = new Foo(); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt.diff deleted file mode 100644 index d917bac74a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/overloadTag3.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.overloadTag3.errors.txt -+++ new.overloadTag3.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/a.js(12,16): error TS2304: Cannot find name 'T'. -+/a.js(17,12): error TS2315: Type 'Foo' is not generic. -+ -+ -+==== /a.js (2 errors) ==== -+ /** -+ * @template T -+ */ -+ export class Foo { -+ /** -+ * @constructor -+ * @overload -+ */ -+ constructor() { } -+ -+ /** -+ * @param {T} value -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ bar(value) { } -+ } -+ -+ /** @type {Foo} */ -+ ~~~~~~~~~~~ -+!!! error TS2315: Type 'Foo' is not generic. -+ let foo; -+ foo = new Foo(); -+ diff --git a/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt b/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt index ebf1ebdf77..bb89418ac5 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt @@ -1,10 +1,7 @@ -a.js(7,5): error TS2322: Type 'undefined' is not assignable to type 'number'. -a.js(11,5): error TS2322: Type 'undefined' is not assignable to type 'number'. a.js(13,1): error TS2554: Expected 3 arguments, but got 0. -a.js(14,3): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. -==== a.js (4 errors) ==== +==== a.js (1 errors) ==== /** * @param {number} [p] * @param {number=} q @@ -12,21 +9,15 @@ a.js(14,3): error TS2345: Argument of type 'undefined' is not assignable to para */ function f(p, q, r) { p = undefined - ~ -!!! error TS2322: Type 'undefined' is not assignable to type 'number'. q = undefined // note that, unlike TS, JSDOC [r=101] retains | undefined because // there's no code emitted to get rid of it. r = undefined - ~ -!!! error TS2322: Type 'undefined' is not assignable to type 'number'. } f() ~ !!! error TS2554: Expected 3 arguments, but got 0. !!! related TS6210 a.js:6:12: An argument for 'p' was not provided. f(undefined, undefined, undefined) - ~~~~~~~~~ -!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. f(1, 2, 3) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt.diff index 6ecd7d7846..ec0b259876 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt.diff @@ -3,13 +3,10 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+a.js(7,5): error TS2322: Type 'undefined' is not assignable to type 'number'. -+a.js(11,5): error TS2322: Type 'undefined' is not assignable to type 'number'. +a.js(13,1): error TS2554: Expected 3 arguments, but got 0. -+a.js(14,3): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. + + -+==== a.js (4 errors) ==== ++==== a.js (1 errors) ==== + /** + * @param {number} [p] + * @param {number=} q @@ -17,21 +14,15 @@ + */ + function f(p, q, r) { + p = undefined -+ ~ -+!!! error TS2322: Type 'undefined' is not assignable to type 'number'. + q = undefined + // note that, unlike TS, JSDOC [r=101] retains | undefined because + // there's no code emitted to get rid of it. + r = undefined -+ ~ -+!!! error TS2322: Type 'undefined' is not assignable to type 'number'. + } + f() + ~ +!!! error TS2554: Expected 3 arguments, but got 0. +!!! related TS6210 a.js:6:12: An argument for 'p' was not provided. + f(undefined, undefined, undefined) -+ ~~~~~~~~~ -+!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. + f(1, 2, 3) + diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt deleted file mode 100644 index ff7b951d2a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt +++ /dev/null @@ -1,22 +0,0 @@ -38572.js(3,12): error TS2304: Cannot find name 'T'. -38572.js(4,25): error TS2304: Cannot find name 'T'. -38572.js(4,37): error TS2304: Cannot find name 'T'. - - -==== 38572.js (3 errors) ==== - /** - * @template T - * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. - * @param {{[K in keyof T]: (value: T[K]) => void }} b - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'T'. - */ - function f(a, b) { - } - - f({ x: 42 }, { x(param) { param.toFixed() } }); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt.diff deleted file mode 100644 index 74550d5f7d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.paramTagTypeResolution2.errors.txt -+++ new.paramTagTypeResolution2.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+38572.js(3,12): error TS2304: Cannot find name 'T'. -+38572.js(4,25): error TS2304: Cannot find name 'T'. -+38572.js(4,37): error TS2304: Cannot find name 'T'. -+ -+ -+==== 38572.js (3 errors) ==== -+ /** -+ * @template T -+ * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @param {{[K in keyof T]: (value: T[K]) => void }} b -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ function f(a, b) { -+ } -+ -+ f({ x: 42 }, { x(param) { param.toFixed() } }); -+ diff --git a/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt deleted file mode 100644 index e1b7ef763b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt +++ /dev/null @@ -1,64 +0,0 @@ -propertiesOfGenericConstructorFunctions.js(5,12): error TS2304: Cannot find name 'V'. -propertiesOfGenericConstructorFunctions.js(14,12): error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? -propertiesOfGenericConstructorFunctions.js(31,12): error TS2304: Cannot find name 'T'. - - -==== propertiesOfGenericConstructorFunctions.js (3 errors) ==== - /** - * @template {string} K - * @template V - * @param {string} ik - * @param {V} iv - ~ -!!! error TS2304: Cannot find name 'V'. - */ - function Multimap(ik, iv) { - /** @type {{ [s: string]: V }} */ - this._map = {}; - // without type annotation - this._map2 = { [ik]: iv }; - }; - - /** @type {Multimap<"a" | "b", number>} with type annotation */ - ~~~~~~~~ -!!! error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? - const map = new Multimap("a", 1); - // without type annotation - const map2 = new Multimap("m", 2); - - /** @type {number} */ - var n = map._map['hi'] - /** @type {number} */ - var n = map._map2['hi'] - /** @type {number} */ - var n = map2._map['hi'] - /** @type {number} */ - var n = map._map2['hi'] - - /** - * @class - * @template T - * @param {T} t - ~ -!!! error TS2304: Cannot find name 'T'. - */ - function Cp(t) { - this.x = 1 - this.y = t - } - Cp.prototype = { - m1() { return this.x }, - m2() { this.z = this.x + 1; return this.y } - } - var cp = new Cp(1) - - /** @type {number} */ - var n = cp.x - /** @type {number} */ - var n = cp.y - /** @type {number} */ - var n = cp.m1() - /** @type {number} */ - var n = cp.m2() - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff deleted file mode 100644 index 2faa77c5b5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff +++ /dev/null @@ -1,69 +0,0 @@ ---- old.propertiesOfGenericConstructorFunctions.errors.txt -+++ new.propertiesOfGenericConstructorFunctions.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+propertiesOfGenericConstructorFunctions.js(5,12): error TS2304: Cannot find name 'V'. -+propertiesOfGenericConstructorFunctions.js(14,12): error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? -+propertiesOfGenericConstructorFunctions.js(31,12): error TS2304: Cannot find name 'T'. -+ -+ -+==== propertiesOfGenericConstructorFunctions.js (3 errors) ==== -+ /** -+ * @template {string} K -+ * @template V -+ * @param {string} ik -+ * @param {V} iv -+ ~ -+!!! error TS2304: Cannot find name 'V'. -+ */ -+ function Multimap(ik, iv) { -+ /** @type {{ [s: string]: V }} */ -+ this._map = {}; -+ // without type annotation -+ this._map2 = { [ik]: iv }; -+ }; -+ -+ /** @type {Multimap<"a" | "b", number>} with type annotation */ -+ ~~~~~~~~ -+!!! error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? -+ const map = new Multimap("a", 1); -+ // without type annotation -+ const map2 = new Multimap("m", 2); -+ -+ /** @type {number} */ -+ var n = map._map['hi'] -+ /** @type {number} */ -+ var n = map._map2['hi'] -+ /** @type {number} */ -+ var n = map2._map['hi'] -+ /** @type {number} */ -+ var n = map._map2['hi'] -+ -+ /** -+ * @class -+ * @template T -+ * @param {T} t -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ function Cp(t) { -+ this.x = 1 -+ this.y = t -+ } -+ Cp.prototype = { -+ m1() { return this.x }, -+ m2() { this.z = this.x + 1; return this.y } -+ } -+ var cp = new Cp(1) -+ -+ /** @type {number} */ -+ var n = cp.x -+ /** @type {number} */ -+ var n = cp.y -+ /** @type {number} */ -+ var n = cp.m1() -+ /** @type {number} */ -+ var n = cp.m2() -+ -+ diff --git a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt deleted file mode 100644 index 16c899bde3..0000000000 --- a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt +++ /dev/null @@ -1,38 +0,0 @@ -propertyAssignmentUseParentType2.js(2,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. - Types of property 'nuo' are incompatible. - Type 'number' is not assignable to type '789'. -propertyAssignmentUseParentType2.js(6,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. - Types of property 'nuo' are incompatible. - Type 'number' is not assignable to type '789'. -propertyAssignmentUseParentType2.js(11,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. - Types of property 'nuo' are incompatible. - Type 'number' is not assignable to type '789'. - - -==== propertyAssignmentUseParentType2.js (3 errors) ==== - /** @type {{ (): boolean; nuo: 789 }} */ - export const inlined = () => true - ~~~~~~~ -!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. -!!! error TS2322: Types of property 'nuo' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type '789'. - inlined.nuo = 789 - - /** @type {{ (): boolean; nuo: 789 }} */ - export const duplicated = () => true - ~~~~~~~~~~ -!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. -!!! error TS2322: Types of property 'nuo' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type '789'. - /** @type {789} */ - duplicated.nuo = 789 - - /** @type {{ (): boolean; nuo: 789 }} */ - export const conflictingDuplicated = () => true - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. -!!! error TS2322: Types of property 'nuo' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type '789'. - /** @type {1000} */ - conflictingDuplicated.nuo = 789 - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt.diff index 242581f4dc..4d69dc31f4 100644 --- a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt.diff @@ -1,46 +1,29 @@ --- old.propertyAssignmentUseParentType2.errors.txt +++ new.propertyAssignmentUseParentType2.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -propertyAssignmentUseParentType2.js(11,14): error TS2322: Type '{ (): boolean; nuo: 1000; }' is not assignable to type '{ (): boolean; nuo: 789; }'. -+propertyAssignmentUseParentType2.js(2,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. - Types of property 'nuo' are incompatible. +- Types of property 'nuo' are incompatible. - Type '1000' is not assignable to type '789'. -+ Type 'number' is not assignable to type '789'. -+propertyAssignmentUseParentType2.js(6,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. -+ Types of property 'nuo' are incompatible. -+ Type 'number' is not assignable to type '789'. -+propertyAssignmentUseParentType2.js(11,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. -+ Types of property 'nuo' are incompatible. -+ Type 'number' is not assignable to type '789'. - - +- +- -==== propertyAssignmentUseParentType2.js (1 errors) ==== -+==== propertyAssignmentUseParentType2.js (3 errors) ==== - /** @type {{ (): boolean; nuo: 789 }} */ - export const inlined = () => true -+ ~~~~~~~ -+!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. -+!!! error TS2322: Types of property 'nuo' are incompatible. -+!!! error TS2322: Type 'number' is not assignable to type '789'. - inlined.nuo = 789 - - /** @type {{ (): boolean; nuo: 789 }} */ - export const duplicated = () => true -+ ~~~~~~~~~~ -+!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. -+!!! error TS2322: Types of property 'nuo' are incompatible. -+!!! error TS2322: Type 'number' is not assignable to type '789'. - /** @type {789} */ - duplicated.nuo = 789 - - /** @type {{ (): boolean; nuo: 789 }} */ - export const conflictingDuplicated = () => true - ~~~~~~~~~~~~~~~~~~~~~ +- /** @type {{ (): boolean; nuo: 789 }} */ +- export const inlined = () => true +- inlined.nuo = 789 +- +- /** @type {{ (): boolean; nuo: 789 }} */ +- export const duplicated = () => true +- /** @type {789} */ +- duplicated.nuo = 789 +- +- /** @type {{ (): boolean; nuo: 789 }} */ +- export const conflictingDuplicated = () => true +- ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ (): boolean; nuo: 1000; }' is not assignable to type '{ (): boolean; nuo: 789; }'. -+!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. - !!! error TS2322: Types of property 'nuo' are incompatible. +-!!! error TS2322: Types of property 'nuo' are incompatible. -!!! error TS2322: Type '1000' is not assignable to type '789'. -+!!! error TS2322: Type 'number' is not assignable to type '789'. - /** @type {1000} */ - conflictingDuplicated.nuo = 789 - +- /** @type {1000} */ +- conflictingDuplicated.nuo = 789 +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols index f0708a96c2..5f2b102aed 100644 --- a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols +++ b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols @@ -6,9 +6,7 @@ export const inlined = () => true >inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12)) inlined.nuo = 789 ->inlined.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) >inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12)) ->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) /** @type {{ (): boolean; nuo: 789 }} */ export const duplicated = () => true @@ -16,9 +14,7 @@ export const duplicated = () => true /** @type {789} */ duplicated.nuo = 789 ->duplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) >duplicated : Symbol(duplicated, Decl(propertyAssignmentUseParentType2.js, 5, 12)) ->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) /** @type {{ (): boolean; nuo: 789 }} */ export const conflictingDuplicated = () => true @@ -26,7 +22,5 @@ export const conflictingDuplicated = () => true /** @type {1000} */ conflictingDuplicated.nuo = 789 ->conflictingDuplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) >conflictingDuplicated : Symbol(conflictingDuplicated, Decl(propertyAssignmentUseParentType2.js, 10, 12)) ->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) diff --git a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols.diff b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols.diff index 4bc4b1c28b..1d99f592e7 100644 --- a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols.diff @@ -8,10 +8,10 @@ +>inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12)) inlined.nuo = 789 - >inlined.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) +->inlined.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) ->inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12), Decl(propertyAssignmentUseParentType2.js, 1, 33)) +->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) +>inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12)) - >nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) /** @type {{ (): boolean; nuo: 789 }} */ export const duplicated = () => true @@ -20,10 +20,10 @@ /** @type {789} */ duplicated.nuo = 789 - >duplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) +->duplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) ->duplicated : Symbol(duplicated, Decl(propertyAssignmentUseParentType2.js, 5, 12), Decl(propertyAssignmentUseParentType2.js, 5, 36)) +->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) +>duplicated : Symbol(duplicated, Decl(propertyAssignmentUseParentType2.js, 5, 12)) - >nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) /** @type {{ (): boolean; nuo: 789 }} */ export const conflictingDuplicated = () => true @@ -32,8 +32,8 @@ /** @type {1000} */ conflictingDuplicated.nuo = 789 - >conflictingDuplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) +->conflictingDuplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) ->conflictingDuplicated : Symbol(conflictingDuplicated, Decl(propertyAssignmentUseParentType2.js, 10, 12), Decl(propertyAssignmentUseParentType2.js, 10, 47)) +->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) +>conflictingDuplicated : Symbol(conflictingDuplicated, Decl(propertyAssignmentUseParentType2.js, 10, 12)) - >nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt index 29eab95b99..2ac8d5ec6b 100644 --- a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt @@ -1,5 +1,3 @@ -other.js(2,11): error TS2503: Cannot find namespace 'Ns'. -other.js(7,11): error TS2503: Cannot find namespace 'Ns'. prototypePropertyAssignmentMergeAcrossFiles2.js(2,4): error TS2339: Property 'One' does not exist on type '{}'. prototypePropertyAssignmentMergeAcrossFiles2.js(3,4): error TS2339: Property 'Two' does not exist on type '{}'. prototypePropertyAssignmentMergeAcrossFiles2.js(5,4): error TS2339: Property 'One' does not exist on type '{}'. @@ -25,18 +23,14 @@ prototypePropertyAssignmentMergeAcrossFiles2.js(8,4): error TS2339: Property 'Tw !!! error TS2339: Property 'Two' does not exist on type '{}'. } -==== other.js (2 errors) ==== +==== other.js (0 errors) ==== /** * @type {Ns.One} - ~~ -!!! error TS2503: Cannot find namespace 'Ns'. */ var one; one.wat; /** * @type {Ns.Two} - ~~ -!!! error TS2503: Cannot find namespace 'Ns'. */ var two; two.wat; diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt.diff index 3249e91f43..bf58b928b2 100644 --- a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt.diff @@ -3,8 +3,6 @@ @@= skipped -0, +0 lines =@@ -other.js(5,5): error TS2339: Property 'wat' does not exist on type 'One'. -other.js(10,5): error TS2339: Property 'wat' does not exist on type 'Two'. -+other.js(2,11): error TS2503: Cannot find namespace 'Ns'. -+other.js(7,11): error TS2503: Cannot find namespace 'Ns'. +prototypePropertyAssignmentMergeAcrossFiles2.js(2,4): error TS2339: Property 'One' does not exist on type '{}'. +prototypePropertyAssignmentMergeAcrossFiles2.js(3,4): error TS2339: Property 'Two' does not exist on type '{}'. +prototypePropertyAssignmentMergeAcrossFiles2.js(5,4): error TS2339: Property 'One' does not exist on type '{}'. @@ -31,11 +29,10 @@ +!!! error TS2339: Property 'Two' does not exist on type '{}'. } - ==== other.js (2 errors) ==== +-==== other.js (2 errors) ==== ++==== other.js (0 errors) ==== /** * @type {Ns.One} -+ ~~ -+!!! error TS2503: Cannot find namespace 'Ns'. */ var one; one.wat; @@ -43,8 +40,6 @@ -!!! error TS2339: Property 'wat' does not exist on type 'One'. /** * @type {Ns.Two} -+ ~~ -+!!! error TS2503: Cannot find namespace 'Ns'. */ var two; two.wat; diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt deleted file mode 100644 index fcf4d43ce1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -prototypePropertyAssignmentMergedTypeReference.js(7,22): error TS2749: 'f' refers to a value, but is being used as a type here. Did you mean 'typeof f'? -prototypePropertyAssignmentMergedTypeReference.js(8,5): error TS2322: Type '() => number' is not assignable to type 'new () => f'. - Type '() => number' provides no match for the signature 'new (): f'. - - -==== prototypePropertyAssignmentMergedTypeReference.js (2 errors) ==== - var f = function() { - return 12; - }; - - f.prototype.a = "a"; - - /** @type {new () => f} */ - ~ -!!! error TS2749: 'f' refers to a value, but is being used as a type here. Did you mean 'typeof f'? - var x = f; - ~ -!!! error TS2322: Type '() => number' is not assignable to type 'new () => f'. -!!! error TS2322: Type '() => number' provides no match for the signature 'new (): f'. - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt.diff deleted file mode 100644 index ff3362d846..0000000000 --- a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.prototypePropertyAssignmentMergedTypeReference.errors.txt -+++ new.prototypePropertyAssignmentMergedTypeReference.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+prototypePropertyAssignmentMergedTypeReference.js(7,22): error TS2749: 'f' refers to a value, but is being used as a type here. Did you mean 'typeof f'? -+prototypePropertyAssignmentMergedTypeReference.js(8,5): error TS2322: Type '() => number' is not assignable to type 'new () => f'. -+ Type '() => number' provides no match for the signature 'new (): f'. -+ -+ -+==== prototypePropertyAssignmentMergedTypeReference.js (2 errors) ==== -+ var f = function() { -+ return 12; -+ }; -+ -+ f.prototype.a = "a"; -+ -+ /** @type {new () => f} */ -+ ~ -+!!! error TS2749: 'f' refers to a value, but is being used as a type here. Did you mean 'typeof f'? -+ var x = f; -+ ~ -+!!! error TS2322: Type '() => number' is not assignable to type 'new () => f'. -+!!! error TS2322: Type '() => number' provides no match for the signature 'new (): f'. -+ -+ diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt deleted file mode 100644 index e20923d91c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt +++ /dev/null @@ -1,33 +0,0 @@ -bug39372.js(24,12): error TS2552: Cannot find name 'XMLObject'. Did you mean 'Object'? - - -==== bug39372.js (1 errors) ==== - /** @typedef {ReadonlyArray} JsonArray */ - /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ - /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ - - /** - * @template T - * @typedef {{ - $A: { - [K in keyof T]?: XMLObject[] - }, - $O: { - [K in keyof T]?: { - $$?: Record - } & (T[K] extends string ? {$:string} : XMLObject) - }, - $$?: Record, - } & { - [K in keyof T]?: ( - T[K] extends string ? string - : XMLObject - ) - }} XMLObject */ - - /** @type {XMLObject<{foo:string}>} */ - ~~~~~~~~~ -!!! error TS2552: Cannot find name 'XMLObject'. Did you mean 'Object'? -!!! related TS2728 lib.es5.d.ts:--:--: 'Object' is declared here. - const p = {}; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt.diff index d41efdc475..84778a0c58 100644 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt.diff @@ -1,21 +1,39 @@ --- old.recursiveTypeReferences2.errors.txt +++ new.recursiveTypeReferences2.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -bug39372.js(25,7): error TS2322: Type '{}' is not assignable to type 'XMLObject<{ foo: string; }>'. - Type '{}' is missing the following properties from type '{ $A: { foo?: XMLObject[]; }; $O: { foo?: { $$?: Record; } & { $: string; }; }; $$?: Record; }': $A, $O -+bug39372.js(24,12): error TS2552: Cannot find name 'XMLObject'. Did you mean 'Object'? - - - ==== bug39372.js (1 errors) ==== -@@= skipped -26, +25 lines =@@ - }} XMLObject */ - - /** @type {XMLObject<{foo:string}>} */ -+ ~~~~~~~~~ -+!!! error TS2552: Cannot find name 'XMLObject'. Did you mean 'Object'? -+!!! related TS2728 lib.es5.d.ts:--:--: 'Object' is declared here. - const p = {}; +- +- +-==== bug39372.js (1 errors) ==== +- /** @typedef {ReadonlyArray} JsonArray */ +- /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ +- /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ +- +- /** +- * @template T +- * @typedef {{ +- $A: { +- [K in keyof T]?: XMLObject[] +- }, +- $O: { +- [K in keyof T]?: { +- $$?: Record +- } & (T[K] extends string ? {$:string} : XMLObject) +- }, +- $$?: Record, +- } & { +- [K in keyof T]?: ( +- T[K] extends string ? string +- : XMLObject +- ) +- }} XMLObject */ +- +- /** @type {XMLObject<{foo:string}>} */ +- const p = {}; - ~ -!!! error TS2322: Type '{}' is not assignable to type 'XMLObject<{ foo: string; }>'. -!!! error TS2322: Type '{}' is missing the following properties from type '{ $A: { foo?: XMLObject[]; }; $O: { foo?: { $$?: Record; } & { $: string; }; }; $$?: Record; }': $A, $O - +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt index acce525d87..3b7364ece6 100644 --- a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt @@ -1,12 +1,8 @@ bug25127.js(3,14): error TS2339: Property 'c' does not exist on type 'Entry'. bug25127.js(15,14): error TS2339: Property 'd' does not exist on type 'Group'. -bug25127.js(27,41): error TS2339: Property 'c' does not exist on type 'Entry | Group'. - Property 'c' does not exist on type 'Entry'. -bug25127.js(27,51): error TS2339: Property 'd' does not exist on type 'Entry | Group'. - Property 'd' does not exist on type 'Entry'. -==== bug25127.js (4 errors) ==== +==== bug25127.js (2 errors) ==== class Entry { constructor() { this.c = 1 @@ -38,12 +34,6 @@ bug25127.js(27,51): error TS2339: Property 'd' does not exist on type 'Entry | G /** @param {Entry | Group} chunk */ function f(chunk) { let x = chunk.isInit(chunk) ? chunk.c : chunk.d - ~ -!!! error TS2339: Property 'c' does not exist on type 'Entry | Group'. -!!! error TS2339: Property 'c' does not exist on type 'Entry'. - ~ -!!! error TS2339: Property 'd' does not exist on type 'Entry | Group'. -!!! error TS2339: Property 'd' does not exist on type 'Entry'. return x } diff --git a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt.diff index dc9eb530ec..99e9a0c170 100644 --- a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt.diff @@ -5,13 +5,9 @@ @@= skipped --1, +1 lines =@@ +bug25127.js(3,14): error TS2339: Property 'c' does not exist on type 'Entry'. +bug25127.js(15,14): error TS2339: Property 'd' does not exist on type 'Group'. -+bug25127.js(27,41): error TS2339: Property 'c' does not exist on type 'Entry | Group'. -+ Property 'c' does not exist on type 'Entry'. -+bug25127.js(27,51): error TS2339: Property 'd' does not exist on type 'Entry | Group'. -+ Property 'd' does not exist on type 'Entry'. + + -+==== bug25127.js (4 errors) ==== ++==== bug25127.js (2 errors) ==== + class Entry { + constructor() { + this.c = 1 @@ -43,12 +39,6 @@ + /** @param {Entry | Group} chunk */ + function f(chunk) { + let x = chunk.isInit(chunk) ? chunk.c : chunk.d -+ ~ -+!!! error TS2339: Property 'c' does not exist on type 'Entry | Group'. -+!!! error TS2339: Property 'c' does not exist on type 'Entry'. -+ ~ -+!!! error TS2339: Property 'd' does not exist on type 'Entry | Group'. -+!!! error TS2339: Property 'd' does not exist on type 'Entry'. + return x + } + diff --git a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols index 62dda0ebe8..15303022d0 100644 --- a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols +++ b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols @@ -44,9 +44,7 @@ function f(chunk) { let x = chunk.isInit(chunk) ? chunk.c : chunk.d >x : Symbol(x, Decl(bug25127.js, 26, 7)) ->chunk.isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) ->isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) diff --git a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols.diff b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols.diff index 1d4c21c5a9..954ef40c70 100644 --- a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols.diff @@ -36,9 +36,13 @@ >x : Symbol(x, Decl(bug25127.js, 20, 11)) return false -@@= skipped -26, +24 lines =@@ +@@= skipped -22, +20 lines =@@ + + let x = chunk.isInit(chunk) ? chunk.c : chunk.d + >x : Symbol(x, Decl(bug25127.js, 26, 7)) +->chunk.isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) - >isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) +->isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) ->chunk.c : Symbol(Entry.c, Decl(bug25127.js, 1, 19)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt index f56291bbf5..e0215e5259 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt @@ -1,10 +1,7 @@ -templateInsideCallback.js(15,11): error TS2304: Cannot find name 'Call'. -templateInsideCallback.js(15,16): error TS2304: Cannot find name 'T'. templateInsideCallback.js(17,18): error TS7006: Parameter 'x' implicitly has an 'any' type. -templateInsideCallback.js(51,44): error TS2461: Type 'unknown' is not an array type. -==== templateInsideCallback.js (4 errors) ==== +==== templateInsideCallback.js (1 errors) ==== /** * @typedef Oops * @template T @@ -20,10 +17,6 @@ templateInsideCallback.js(51,44): error TS2461: Type 'unknown' is not an array t /** * @template T * @type {Call} - ~~~~ -!!! error TS2304: Cannot find name 'Call'. - ~ -!!! error TS2304: Cannot find name 'T'. */ const identity = x => x; ~ @@ -62,8 +55,6 @@ templateInsideCallback.js(51,44): error TS2461: Type 'unknown' is not an array t const result = []; for (let i = 0; i < array.length; i += 1) { result.push(.../** @type {unknown[]} */(iterable(array[i]))); - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2461: Type 'unknown' is not an array type. } return result; } diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt.diff index d3812ab9f7..0bce3810f9 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt.diff @@ -6,8 +6,6 @@ -templateInsideCallback.js(9,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -templateInsideCallback.js(10,12): error TS2304: Cannot find name 'T'. -templateInsideCallback.js(15,11): error TS2315: Type 'Call' is not generic. -+templateInsideCallback.js(15,11): error TS2304: Cannot find name 'Call'. -+templateInsideCallback.js(15,16): error TS2304: Cannot find name 'T'. templateInsideCallback.js(17,18): error TS7006: Parameter 'x' implicitly has an 'any' type. -templateInsideCallback.js(23,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -templateInsideCallback.js(30,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag @@ -15,7 +13,6 @@ -templateInsideCallback.js(33,16): error TS2304: Cannot find name 'T'. -templateInsideCallback.js(38,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -templateInsideCallback.js(39,12): error TS2304: Cannot find name 'T'. -+templateInsideCallback.js(51,44): error TS2461: Type 'unknown' is not an array type. -!!! error TS-1: Pre-emit (11) and post-emit (13) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! @@ -23,7 +20,7 @@ -!!! related TS7012 templateInsideCallback.js:29:5: This overload implicitly returns the type 'any' because it lacks a return type annotation. -!!! related TS7012 templateInsideCallback.js:37:5: This overload implicitly returns the type 'any' because it lacks a return type annotation. -==== templateInsideCallback.js (11 errors) ==== -+==== templateInsideCallback.js (4 errors) ==== ++==== templateInsideCallback.js (1 errors) ==== /** * @typedef Oops - ~~~~ @@ -31,7 +28,7 @@ * @template T * @property {T} a * @property {T} b -@@= skipped -27, +13 lines =@@ +@@= skipped -27, +10 lines =@@ /** * @callback Call * @template T @@ -47,14 +44,10 @@ * @type {Call} - ~~~~~~~ -!!! error TS2315: Type 'Call' is not generic. -+ ~~~~ -+!!! error TS2304: Cannot find name 'Call'. -+ ~ -+!!! error TS2304: Cannot find name 'T'. */ const identity = x => x; ~ -@@= skipped -22, +20 lines =@@ +@@= skipped -22, +16 lines =@@ * @property {Object} oh * @property {number} oh.no * @template T @@ -89,12 +82,3 @@ * @returns {T[]} */ /** -@@= skipped -31, +21 lines =@@ - const result = []; - for (let i = 0; i < array.length; i += 1) { - result.push(.../** @type {unknown[]} */(iterable(array[i]))); -+ ~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2461: Type 'unknown' is not an array type. - } - return result; - } diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols index 15ac0e4570..241be94711 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols @@ -63,15 +63,11 @@ function flatMap(array, iterable = identity) { for (let i = 0; i < array.length; i += 1) { >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) ->array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(templateInsideCallback.js, 46, 17)) ->length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); ->result.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(templateInsideCallback.js, 48, 7)) ->push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >iterable : Symbol(iterable, Decl(templateInsideCallback.js, 46, 23)) >array : Symbol(array, Decl(templateInsideCallback.js, 46, 17)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff index 5e0b33b705..6f68c0bd3d 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff @@ -5,18 +5,14 @@ >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) ->array.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) -+>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(templateInsideCallback.js, 46, 17)) ->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) -+>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); ->result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) -+>result.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(templateInsideCallback.js, 48, 7)) ->push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) -+>push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >iterable : Symbol(iterable, Decl(templateInsideCallback.js, 46, 23)) >array : Symbol(array, Decl(templateInsideCallback.js, 46, 17)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) diff --git a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols index 123d62d3cd..13f51a6f5c 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols +++ b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols @@ -10,9 +10,7 @@ function f(s) { >s : Symbol(s, Decl(a.js, 4, 11)) return this.n + s.length ->s.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(a.js, 4, 11)) ->length : Symbol(length, Decl(lib.es5.d.ts, --, --)) } const o = { diff --git a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff index 2c28611217..50e7f941ca 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff @@ -8,10 +8,8 @@ ->this : Symbol(this) ->n : Symbol(n, Decl(a.js, 0, 12)) ->s.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) -+>s.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(a.js, 4, 11)) ->length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) -+>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) } const o = { diff --git a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt deleted file mode 100644 index a72a92450c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt +++ /dev/null @@ -1,67 +0,0 @@ -thisTypeOfConstructorFunctions.js(4,12): error TS2304: Cannot find name 'T'. -thisTypeOfConstructorFunctions.js(15,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface. -thisTypeOfConstructorFunctions.js(24,12): error TS2304: Cannot find name 'T'. -thisTypeOfConstructorFunctions.js(38,12): error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? -thisTypeOfConstructorFunctions.js(41,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? -thisTypeOfConstructorFunctions.js(43,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? - - -==== thisTypeOfConstructorFunctions.js (6 errors) ==== - /** - * @class - * @template T - * @param {T} t - ~ -!!! error TS2304: Cannot find name 'T'. - */ - function Cp(t) { - /** @type {this} */ - this.dit = this - this.y = t - /** @return {this} */ - this.m3 = () => this - } - - Cp.prototype = { - /** @return {this} */ - ~~~~ -!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. - m4() { - this.z = this.y; return this - } - } - - /** - * @class - * @template T - * @param {T} t - ~ -!!! error TS2304: Cannot find name 'T'. - */ - function Cpp(t) { - this.y = t - } - /** @return {this} */ - Cpp.prototype.m2 = function () { - this.z = this.y; return this - } - - var cp = new Cp(1) - var cpp = new Cpp(2) - cp.dit - - /** @type {Cpp} */ - ~~~ -!!! error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? - var cppn = cpp.m2() - - /** @type {Cp} */ - ~~ -!!! error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? - var cpn = cp.m3() - /** @type {Cp} */ - ~~ -!!! error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? - var cpn = cp.m4() - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff deleted file mode 100644 index 792d116821..0000000000 --- a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt.diff +++ /dev/null @@ -1,72 +0,0 @@ ---- old.thisTypeOfConstructorFunctions.errors.txt -+++ new.thisTypeOfConstructorFunctions.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+thisTypeOfConstructorFunctions.js(4,12): error TS2304: Cannot find name 'T'. -+thisTypeOfConstructorFunctions.js(15,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface. -+thisTypeOfConstructorFunctions.js(24,12): error TS2304: Cannot find name 'T'. -+thisTypeOfConstructorFunctions.js(38,12): error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? -+thisTypeOfConstructorFunctions.js(41,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? -+thisTypeOfConstructorFunctions.js(43,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? -+ -+ -+==== thisTypeOfConstructorFunctions.js (6 errors) ==== -+ /** -+ * @class -+ * @template T -+ * @param {T} t -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ function Cp(t) { -+ /** @type {this} */ -+ this.dit = this -+ this.y = t -+ /** @return {this} */ -+ this.m3 = () => this -+ } -+ -+ Cp.prototype = { -+ /** @return {this} */ -+ ~~~~ -+!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. -+ m4() { -+ this.z = this.y; return this -+ } -+ } -+ -+ /** -+ * @class -+ * @template T -+ * @param {T} t -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ function Cpp(t) { -+ this.y = t -+ } -+ /** @return {this} */ -+ Cpp.prototype.m2 = function () { -+ this.z = this.y; return this -+ } -+ -+ var cp = new Cp(1) -+ var cpp = new Cpp(2) -+ cp.dit -+ -+ /** @type {Cpp} */ -+ ~~~ -+!!! error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? -+ var cppn = cpp.m2() -+ -+ /** @type {Cp} */ -+ ~~ -+!!! error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? -+ var cpn = cp.m3() -+ /** @type {Cp} */ -+ ~~ -+!!! error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? -+ var cpn = cp.m4() -+ -+ diff --git a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt new file mode 100644 index 0000000000..204843acf2 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt @@ -0,0 +1,24 @@ +bug25926.js(4,18): error TS7006: Parameter 'n' implicitly has an 'any' type. +bug25926.js(11,27): error TS7006: Parameter 'm' implicitly has an 'any' type. + + +==== bug25926.js (2 errors) ==== + /** @type {{ a(): void; b?(n: number): number; }} */ + const o1 = { + a() { + this.b = n => n; + ~ +!!! error TS7006: Parameter 'n' implicitly has an 'any' type. + } + }; + + /** @type {{ d(): void; e?(n: number): number; f?(n: number): number; g?: number }} */ + const o2 = { + d() { + this.e = this.f = m => this.g || m; + ~ +!!! error TS7006: Parameter 'm' implicitly has an 'any' type. + } + }; + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt.diff new file mode 100644 index 0000000000..025e58a5f6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt.diff @@ -0,0 +1,29 @@ +--- old.typeFromContextualThisType.errors.txt ++++ new.typeFromContextualThisType.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++bug25926.js(4,18): error TS7006: Parameter 'n' implicitly has an 'any' type. ++bug25926.js(11,27): error TS7006: Parameter 'm' implicitly has an 'any' type. ++ ++ ++==== bug25926.js (2 errors) ==== ++ /** @type {{ a(): void; b?(n: number): number; }} */ ++ const o1 = { ++ a() { ++ this.b = n => n; ++ ~ ++!!! error TS7006: Parameter 'n' implicitly has an 'any' type. ++ } ++ }; ++ ++ /** @type {{ d(): void; e?(n: number): number; f?(n: number): number; g?: number }} */ ++ const o2 = { ++ d() { ++ this.e = this.f = m => this.g || m; ++ ~ ++!!! error TS7006: Parameter 'm' implicitly has an 'any' type. ++ } ++ }; ++ ++ diff --git a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols index 4400ed3a9c..d0f3683e98 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols @@ -9,9 +9,6 @@ const o1 = { >a : Symbol(a, Decl(bug25926.js, 1, 12)) this.b = n => n; ->this.b : Symbol(b, Decl(bug25926.js, 0, 23)) ->this : Symbol((Anonymous type), 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)) } @@ -25,16 +22,7 @@ const o2 = { >d : Symbol(d, Decl(bug25926.js, 8, 12)) this.e = this.f = m => this.g || m; ->this.e : Symbol(e, Decl(bug25926.js, 7, 23)) ->this : Symbol((Anonymous type), Decl(bug25926.js, 7, 11)) ->e : Symbol(e, Decl(bug25926.js, 7, 23)) ->this.f : Symbol(f, Decl(bug25926.js, 7, 46)) ->this : Symbol((Anonymous type), 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((Anonymous type), 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 f39477cc81..c79bf20cf8 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols.diff @@ -1,33 +1,29 @@ --- old.typeFromContextualThisType.symbols +++ new.typeFromContextualThisType.symbols -@@= skipped -9, +9 lines =@@ +@@= skipped -8, +8 lines =@@ + >a : Symbol(a, Decl(bug25926.js, 1, 12)) this.b = n => n; - >this.b : Symbol(b, Decl(bug25926.js, 0, 23)) +->this.b : Symbol(b, Decl(bug25926.js, 0, 23)) ->this : Symbol(__type, Decl(bug25926.js, 0, 11)) ->b : Symbol(b, Decl(bug25926.js, 2, 9)) -+>this : Symbol((Anonymous type), 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 =@@ +@@= skipped -16, +13 lines =@@ + >d : Symbol(d, Decl(bug25926.js, 8, 12)) this.e = this.f = m => this.g || m; - >this.e : Symbol(e, Decl(bug25926.js, 7, 23)) +->this.e : Symbol(e, Decl(bug25926.js, 7, 23)) ->this : Symbol(__type, Decl(bug25926.js, 7, 11)) ->e : Symbol(e, Decl(bug25926.js, 9, 9)) -+>this : Symbol((Anonymous type), Decl(bug25926.js, 7, 11)) -+>e : Symbol(e, Decl(bug25926.js, 7, 23)) - >this.f : Symbol(f, Decl(bug25926.js, 7, 46)) +->this.f : Symbol(f, Decl(bug25926.js, 7, 46)) ->this : Symbol(__type, Decl(bug25926.js, 7, 11)) ->f : Symbol(f, Decl(bug25926.js, 10, 16)) -+>this : Symbol((Anonymous type), 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.g : Symbol(g, Decl(bug25926.js, 7, 69)) ->this : Symbol(__type, Decl(bug25926.js, 7, 11)) -+>this : Symbol((Anonymous type), Decl(bug25926.js, 7, 11)) - >g : Symbol(g, Decl(bug25926.js, 7, 69)) +->g : Symbol(g, Decl(bug25926.js, 7, 69)) >m : Symbol(m, Decl(bug25926.js, 10, 25)) } + }; diff --git a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt index ecf3829086..71115a8cff 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt @@ -4,9 +4,9 @@ a.js(29,5): error TS2322: Type '1' is not assignable to type 'null'. a.js(30,5): error TS2322: Type 'true' is not assignable to type 'null'. a.js(31,5): error TS2322: Type '{}' is not assignable to type 'null'. a.js(32,5): error TS2322: Type '"ok"' is not assignable to type 'null'. -a.js(37,5): error TS2322: Type 'string' is not assignable to type 'number'. a.js(40,12): error TS2345: Argument of type '1' is not assignable to parameter of type 'never'. a.js(41,12): error TS2345: Argument of type '"ok"' is not assignable to parameter of type 'never'. +a.js(56,17): error TS7006: Parameter 'v' implicitly has an 'any' type. ==== a.js (9 errors) ==== @@ -59,8 +59,6 @@ a.js(41,12): error TS2345: Argument of type '"ok"' is not assignable to paramete b = 1 b = undefined b = 'error' - ~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. // l should be any[] l.push(1) @@ -84,6 +82,8 @@ a.js(41,12): error TS2345: Argument of type '"ok"' is not assignable to paramete /** @type {(v: unknown) => v is undefined} */ const isUndef = v => v === undefined; + ~ +!!! error TS7006: Parameter 'v' implicitly has an 'any' type. const e = [1, undefined]; // should be undefined[] diff --git a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt.diff index 627d899f5b..55300f97e4 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt.diff @@ -11,9 +11,10 @@ a.js(30,5): error TS2322: Type 'true' is not assignable to type 'null'. a.js(31,5): error TS2322: Type '{}' is not assignable to type 'null'. a.js(32,5): error TS2322: Type '"ok"' is not assignable to type 'null'. - a.js(37,5): error TS2322: Type 'string' is not assignable to type 'number'. +-a.js(37,5): error TS2322: Type 'string' is not assignable to type 'number'. +a.js(40,12): error TS2345: Argument of type '1' is not assignable to parameter of type 'never'. +a.js(41,12): error TS2345: Argument of type '"ok"' is not assignable to parameter of type 'never'. ++a.js(56,17): error TS7006: Parameter 'v' implicitly has an 'any' type. -==== a.js (10 errors) ==== @@ -45,7 +46,12 @@ // a should be null in strict mode a = undefined ~ -@@= skipped -29, +27 lines =@@ +@@= skipped -24, +22 lines =@@ + b = 1 + b = undefined + b = 'error' +- ~ +-!!! error TS2322: Type 'string' is not assignable to type 'number'. // l should be any[] l.push(1) @@ -57,3 +63,12 @@ } // should get any on variable initialisers +@@= skipped -21, +23 lines =@@ + + /** @type {(v: unknown) => v is undefined} */ + const isUndef = v => v === undefined; ++ ~ ++!!! error TS7006: Parameter 'v' implicitly has an 'any' type. + const e = [1, undefined]; + + // should be undefined[] diff --git a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt index 58532b712f..1e19ff1c3f 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt @@ -1,9 +1,8 @@ a.js(5,12): error TS7006: Parameter 'a' implicitly has an 'any' type. a.js(5,29): error TS7006: Parameter 'l' implicitly has an 'any[]' type. -a.js(17,5): error TS2322: Type 'string' is not assignable to type 'number'. -==== a.js (3 errors) ==== +==== a.js (2 errors) ==== /** @type {number | undefined} */ var n; @@ -25,8 +24,6 @@ a.js(17,5): error TS2322: Type 'string' is not assignable to type 'number'. b = 1 b = undefined b = 'error' - ~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. // l should be any[] l.push(1) diff --git a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt.diff new file mode 100644 index 0000000000..86d203d0e2 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.typeFromJSInitializer4.errors.txt ++++ new.typeFromJSInitializer4.errors.txt +@@= skipped -0, +0 lines =@@ + a.js(5,12): error TS7006: Parameter 'a' implicitly has an 'any' type. + a.js(5,29): error TS7006: Parameter 'l' implicitly has an 'any[]' type. +-a.js(17,5): error TS2322: Type 'string' is not assignable to type 'number'. + + +-==== a.js (3 errors) ==== ++==== a.js (2 errors) ==== + /** @type {number | undefined} */ + var n; + +@@= skipped -24, +23 lines =@@ + b = 1 + b = undefined + b = 'error' +- ~ +-!!! error TS2322: Type 'string' is not assignable to type 'number'. + + // l should be any[] + l.push(1) diff --git a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt index 631f5be936..acff5629e9 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt @@ -1,14 +1,6 @@ -a.js(3,13): error TS2749: 'A' refers to a value, but is being used as a type here. Did you mean 'typeof A'? b-ext.js(3,14): error TS2339: Property 'x' does not exist on type 'B'. -b.js(3,13): error TS2749: 'B' refers to a value, but is being used as a type here. Did you mean 'typeof B'? -c.js(3,13): error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? -d.js(3,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? e-ext.js(3,14): error TS2339: Property 'x' does not exist on type 'E'. -e.js(3,13): error TS2749: 'E' refers to a value, but is being used as a type here. Did you mean 'typeof E'? -f.js(5,13): error TS2749: 'F' refers to a value, but is being used as a type here. Did you mean 'typeof F'? -g.js(5,13): error TS2749: 'G' refers to a value, but is being used as a type here. Did you mean 'typeof G'? h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. -h.js(8,19): error TS2339: Property 'x' does not exist on type 'H'. ==== node.d.ts (0 errors) ==== @@ -20,12 +12,10 @@ h.js(8,19): error TS2339: Property 'x' does not exist on type 'H'. this.x = 1; }; -==== a.js (1 errors) ==== +==== a.js (0 errors) ==== const { A } = require("./a-ext"); /** @param {A} p */ - ~ -!!! error TS2749: 'A' refers to a value, but is being used as a type here. Did you mean 'typeof A'? function a(p) { p.x; } ==== b-ext.js (1 errors) ==== @@ -37,12 +27,10 @@ h.js(8,19): error TS2339: Property 'x' does not exist on type 'H'. } }; -==== b.js (1 errors) ==== +==== b.js (0 errors) ==== const { B } = require("./b-ext"); /** @param {B} p */ - ~ -!!! error TS2749: 'B' refers to a value, but is being used as a type here. Did you mean 'typeof B'? function b(p) { p.x; } ==== c-ext.js (0 errors) ==== @@ -50,12 +38,10 @@ h.js(8,19): error TS2339: Property 'x' does not exist on type 'H'. this.x = 1; } -==== c.js (1 errors) ==== +==== c.js (0 errors) ==== const { C } = require("./c-ext"); /** @param {C} p */ - ~ -!!! error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? function c(p) { p.x; } ==== d-ext.js (0 errors) ==== @@ -63,12 +49,10 @@ h.js(8,19): error TS2339: Property 'x' does not exist on type 'H'. this.x = 1; }; -==== d.js (1 errors) ==== +==== d.js (0 errors) ==== const { D } = require("./d-ext"); /** @param {D} p */ - ~ -!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? function d(p) { p.x; } ==== e-ext.js (1 errors) ==== @@ -80,35 +64,29 @@ h.js(8,19): error TS2339: Property 'x' does not exist on type 'H'. } } -==== e.js (1 errors) ==== +==== e.js (0 errors) ==== const { E } = require("./e-ext"); /** @param {E} p */ - ~ -!!! error TS2749: 'E' refers to a value, but is being used as a type here. Did you mean 'typeof E'? function e(p) { p.x; } -==== f.js (1 errors) ==== +==== f.js (0 errors) ==== var F = function () { this.x = 1; }; /** @param {F} p */ - ~ -!!! error TS2749: 'F' refers to a value, but is being used as a type here. Did you mean 'typeof F'? function f(p) { p.x; } -==== g.js (1 errors) ==== +==== g.js (0 errors) ==== function G() { this.x = 1; } /** @param {G} p */ - ~ -!!! error TS2749: 'G' refers to a value, but is being used as a type here. Did you mean 'typeof G'? function g(p) { p.x; } -==== h.js (2 errors) ==== +==== h.js (1 errors) ==== class H { constructor() { this.x = 1; @@ -118,6 +96,4 @@ h.js(8,19): error TS2339: Property 'x' does not exist on type 'H'. } /** @param {H} p */ - function h(p) { p.x; } - ~ -!!! error TS2339: Property 'x' does not exist on type 'H'. \ No newline at end of file + function h(p) { p.x; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt.diff index 1f35e42090..9b8e49178a 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt.diff @@ -3,17 +3,9 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+a.js(3,13): error TS2749: 'A' refers to a value, but is being used as a type here. Did you mean 'typeof A'? +b-ext.js(3,14): error TS2339: Property 'x' does not exist on type 'B'. -+b.js(3,13): error TS2749: 'B' refers to a value, but is being used as a type here. Did you mean 'typeof B'? -+c.js(3,13): error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? -+d.js(3,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? +e-ext.js(3,14): error TS2339: Property 'x' does not exist on type 'E'. -+e.js(3,13): error TS2749: 'E' refers to a value, but is being used as a type here. Did you mean 'typeof E'? -+f.js(5,13): error TS2749: 'F' refers to a value, but is being used as a type here. Did you mean 'typeof F'? -+g.js(5,13): error TS2749: 'G' refers to a value, but is being used as a type here. Did you mean 'typeof G'? +h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. -+h.js(8,19): error TS2339: Property 'x' does not exist on type 'H'. + + +==== node.d.ts (0 errors) ==== @@ -25,12 +17,10 @@ + this.x = 1; + }; + -+==== a.js (1 errors) ==== ++==== a.js (0 errors) ==== + const { A } = require("./a-ext"); + + /** @param {A} p */ -+ ~ -+!!! error TS2749: 'A' refers to a value, but is being used as a type here. Did you mean 'typeof A'? + function a(p) { p.x; } + +==== b-ext.js (1 errors) ==== @@ -42,12 +32,10 @@ + } + }; + -+==== b.js (1 errors) ==== ++==== b.js (0 errors) ==== + const { B } = require("./b-ext"); + + /** @param {B} p */ -+ ~ -+!!! error TS2749: 'B' refers to a value, but is being used as a type here. Did you mean 'typeof B'? + function b(p) { p.x; } + +==== c-ext.js (0 errors) ==== @@ -55,12 +43,10 @@ + this.x = 1; + } + -+==== c.js (1 errors) ==== ++==== c.js (0 errors) ==== + const { C } = require("./c-ext"); + + /** @param {C} p */ -+ ~ -+!!! error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? + function c(p) { p.x; } + +==== d-ext.js (0 errors) ==== @@ -68,12 +54,10 @@ + this.x = 1; + }; + -+==== d.js (1 errors) ==== ++==== d.js (0 errors) ==== + const { D } = require("./d-ext"); + + /** @param {D} p */ -+ ~ -+!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + function d(p) { p.x; } + +==== e-ext.js (1 errors) ==== @@ -85,35 +69,29 @@ + } + } + -+==== e.js (1 errors) ==== ++==== e.js (0 errors) ==== + const { E } = require("./e-ext"); + + /** @param {E} p */ -+ ~ -+!!! error TS2749: 'E' refers to a value, but is being used as a type here. Did you mean 'typeof E'? + function e(p) { p.x; } + -+==== f.js (1 errors) ==== ++==== f.js (0 errors) ==== + var F = function () { + this.x = 1; + }; + + /** @param {F} p */ -+ ~ -+!!! error TS2749: 'F' refers to a value, but is being used as a type here. Did you mean 'typeof F'? + function f(p) { p.x; } + -+==== g.js (1 errors) ==== ++==== g.js (0 errors) ==== + function G() { + this.x = 1; + } + + /** @param {G} p */ -+ ~ -+!!! error TS2749: 'G' refers to a value, but is being used as a type here. Did you mean 'typeof G'? + function g(p) { p.x; } + -+==== h.js (2 errors) ==== ++==== h.js (1 errors) ==== + class H { + constructor() { + this.x = 1; @@ -124,5 +102,3 @@ + + /** @param {H} p */ + function h(p) { p.x; } -+ ~ -+!!! error TS2339: Property 'x' does not exist on type 'H'. diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt index 7a0891aa8f..47fe9440fb 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt @@ -1,9 +1,7 @@ a.js(4,7): error TS2339: Property 'Inner' does not exist on type 'typeof O'. -a.js(8,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? -a.js(11,12): error TS2503: Cannot find namespace 'Outer'. -==== a.js (3 errors) ==== +==== a.js (1 errors) ==== var Outer = class O { m(x, y) { } } @@ -14,13 +12,9 @@ a.js(11,12): error TS2503: Cannot find namespace 'Outer'. } /** @type {Outer} */ - ~~~~~ -!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? var si si.m /** @type {Outer.Inner} */ - ~~~~~ -!!! error TS2503: Cannot find namespace 'Outer'. var oi oi.n diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt.diff index e664ba81d5..9ba0b36eb2 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt.diff @@ -4,11 +4,9 @@ - @@= skipped --1, +1 lines =@@ +a.js(4,7): error TS2339: Property 'Inner' does not exist on type 'typeof O'. -+a.js(8,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? -+a.js(11,12): error TS2503: Cannot find namespace 'Outer'. + + -+==== a.js (3 errors) ==== ++==== a.js (1 errors) ==== + var Outer = class O { + m(x, y) { } + } @@ -19,13 +17,9 @@ + + } + /** @type {Outer} */ -+ ~~~~~ -+!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? + var si + si.m + /** @type {Outer.Inner} */ -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'Outer'. + var oi + oi.n + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt index 12557bce5a..579073d8b0 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt @@ -1,4 +1,3 @@ -main.js(4,12): error TS2503: Cannot find namespace 'Outer'. someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. @@ -40,13 +39,11 @@ someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. }; return Application; })(); -==== main.js (1 errors) ==== +==== main.js (0 errors) ==== var app = new Outer.app.Application(); var inner = new Outer.app.Inner(); inner.y; /** @type {Outer.app.Inner} */ - ~~~~~ -!!! error TS2503: Cannot find namespace 'Outer'. var x; x.y; Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt.diff index 97079b8545..9f8abcdd71 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt.diff @@ -3,7 +3,6 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+main.js(4,12): error TS2503: Cannot find namespace 'Outer'. +someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. + + @@ -45,13 +44,11 @@ + }; + return Application; + })(); -+==== main.js (1 errors) ==== ++==== main.js (0 errors) ==== + var app = new Outer.app.Application(); + var inner = new Outer.app.Inner(); + inner.y; + /** @type {Outer.app.Inner} */ -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'Outer'. + var x; + x.y; + Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt index 4c083f927a..9726ce6c15 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt @@ -1,4 +1,3 @@ -main.js(4,12): error TS2503: Cannot find namespace 'Outer'. someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. @@ -40,13 +39,11 @@ someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. }; return Application; })(); -==== main.js (1 errors) ==== +==== main.js (0 errors) ==== var app = new Outer.app.Application(); var inner = new Outer.app.Inner(); inner.y; /** @type {Outer.app.Inner} */ - ~~~~~ -!!! error TS2503: Cannot find namespace 'Outer'. var x; x.y; Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt.diff index 86f508d4ff..2e5bbae387 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt.diff @@ -3,7 +3,6 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+main.js(4,12): error TS2503: Cannot find namespace 'Outer'. +someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. + + @@ -45,13 +44,11 @@ + }; + return Application; + })(); -+==== main.js (1 errors) ==== ++==== main.js (0 errors) ==== + var app = new Outer.app.Application(); + var inner = new Outer.app.Inner(); + inner.y; + /** @type {Outer.app.Inner} */ -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'Outer'. + var x; + x.y; + Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt index aa43d4abec..dc608b527e 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt @@ -1,4 +1,3 @@ -use.js(1,12): error TS2503: Cannot find namespace 'Outer'. use.js(5,22): error TS2339: Property 'Inner' does not exist on type '{}'. work.js(1,7): error TS2339: Property 'Inner' does not exist on type '{}'. work.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. @@ -18,10 +17,8 @@ work.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. m() { } } -==== use.js (2 errors) ==== +==== use.js (1 errors) ==== /** @type {Outer.Inner} */ - ~~~~~ -!!! error TS2503: Cannot find namespace 'Outer'. var inner inner.x inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt.diff index 709710d9f3..1b358dcf1a 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt.diff @@ -3,7 +3,6 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+use.js(1,12): error TS2503: Cannot find namespace 'Outer'. +use.js(5,22): error TS2339: Property 'Inner' does not exist on type '{}'. +work.js(1,7): error TS2339: Property 'Inner' does not exist on type '{}'. +work.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. @@ -23,10 +22,8 @@ + m() { } + } + -+==== use.js (2 errors) ==== ++==== use.js (1 errors) ==== + /** @type {Outer.Inner} */ -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'Outer'. + var inner + inner.x + inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt index fb4921e205..9a82edb3d4 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt @@ -1,10 +1,9 @@ a.js(3,7): error TS2339: Property 'Inner' does not exist on type '{}'. a.js(5,14): error TS2339: Property 'x' does not exist on type 'Inner'. -a.js(10,12): error TS2503: Cannot find namespace 'Outer'. a.js(14,22): error TS2339: Property 'Inner' does not exist on type '{}'. -==== a.js (4 errors) ==== +==== a.js (3 errors) ==== var Outer = {}; Outer.Inner = class { @@ -19,8 +18,6 @@ a.js(14,22): error TS2339: Property 'Inner' does not exist on type '{}'. } /** @type {Outer.Inner} */ - ~~~~~ -!!! error TS2503: Cannot find namespace 'Outer'. var inner inner.x inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt.diff index 5079f95655..c885063aab 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt.diff @@ -5,11 +5,10 @@ @@= skipped --1, +1 lines =@@ +a.js(3,7): error TS2339: Property 'Inner' does not exist on type '{}'. +a.js(5,14): error TS2339: Property 'x' does not exist on type 'Inner'. -+a.js(10,12): error TS2503: Cannot find namespace 'Outer'. +a.js(14,22): error TS2339: Property 'Inner' does not exist on type '{}'. + + -+==== a.js (4 errors) ==== ++==== a.js (3 errors) ==== + var Outer = {}; + + Outer.Inner = class { @@ -24,8 +23,6 @@ + } + + /** @type {Outer.Inner} */ -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'Outer'. + var inner + inner.x + inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt index c54db8a4a9..05184f45d8 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt @@ -1,10 +1,9 @@ a.js(3,7): error TS2339: Property 'Inner' does not exist on type '{}'. a.js(4,7): error TS2339: Property 'Inner' does not exist on type '{}'. -a.js(9,12): error TS2503: Cannot find namespace 'Outer'. a.js(13,22): error TS2339: Property 'Inner' does not exist on type '{}'. -==== a.js (4 errors) ==== +==== a.js (3 errors) ==== var Outer = {}; Outer.Inner = function () {} @@ -18,8 +17,6 @@ a.js(13,22): error TS2339: Property 'Inner' does not exist on type '{}'. } /** @type {Outer.Inner} */ - ~~~~~ -!!! error TS2503: Cannot find namespace 'Outer'. var inner inner.x inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt.diff index 4e3e2fba37..d6e59f438d 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt.diff @@ -5,11 +5,10 @@ @@= skipped --1, +1 lines =@@ +a.js(3,7): error TS2339: Property 'Inner' does not exist on type '{}'. +a.js(4,7): error TS2339: Property 'Inner' does not exist on type '{}'. -+a.js(9,12): error TS2503: Cannot find namespace 'Outer'. +a.js(13,22): error TS2339: Property 'Inner' does not exist on type '{}'. + + -+==== a.js (4 errors) ==== ++==== a.js (3 errors) ==== + var Outer = {}; + + Outer.Inner = function () {} @@ -23,8 +22,6 @@ + } + + /** @type {Outer.Inner} */ -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'Outer'. + var inner + inner.x + inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt index 8cb50e996a..477e317e0e 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt @@ -1,9 +1,7 @@ a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. -a.js(9,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? -a.js(12,12): error TS2503: Cannot find namespace 'Outer'. -==== a.js (3 errors) ==== +==== a.js (1 errors) ==== function Outer() { this.y = 2 } @@ -15,13 +13,9 @@ a.js(12,12): error TS2503: Cannot find namespace 'Outer'. } } /** @type {Outer} */ - ~~~~~ -!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? var ok ok.y /** @type {Outer.Inner} */ - ~~~~~ -!!! error TS2503: Cannot find namespace 'Outer'. var oc oc.x \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt.diff index cca49f15f0..4fb290638b 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt.diff @@ -4,11 +4,9 @@ - @@= skipped --1, +1 lines =@@ +a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. -+a.js(9,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? -+a.js(12,12): error TS2503: Cannot find namespace 'Outer'. + + -+==== a.js (3 errors) ==== ++==== a.js (1 errors) ==== + function Outer() { + this.y = 2 + } @@ -20,13 +18,9 @@ + } + } + /** @type {Outer} */ -+ ~~~~~ -+!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? + var ok + ok.y + /** @type {Outer.Inner} */ -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'Outer'. + var oc + oc.x + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt index 4de02a5a06..d4e17911fb 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt @@ -1,10 +1,9 @@ def.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. usage.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. usage.js(5,19): error TS2339: Property 'Inner' does not exist on type '{}'. -usage.js(7,12): error TS2503: Cannot find namespace 'Outer'. -==== usage.js (3 errors) ==== +==== usage.js (2 errors) ==== // note that usage is first in the compilation Outer.Inner.Message = function() { ~~~~~ @@ -16,8 +15,6 @@ usage.js(7,12): error TS2503: Cannot find namespace 'Outer'. !!! error TS2339: Property 'Inner' does not exist on type '{}'. y.name /** @type {Outer.Inner} should be instance type, not static type */ - ~~~~~ -!!! error TS2503: Cannot find namespace 'Outer'. var x; x.name diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt.diff index 3a0a45820f..794b24d9de 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt.diff @@ -6,10 +6,9 @@ +def.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. +usage.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. +usage.js(5,19): error TS2339: Property 'Inner' does not exist on type '{}'. -+usage.js(7,12): error TS2503: Cannot find namespace 'Outer'. + + -+==== usage.js (3 errors) ==== ++==== usage.js (2 errors) ==== + // note that usage is first in the compilation + Outer.Inner.Message = function() { + ~~~~~ @@ -21,8 +20,6 @@ +!!! error TS2339: Property 'Inner' does not exist on type '{}'. + y.name + /** @type {Outer.Inner} should be instance type, not static type */ -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'Outer'. + var x; + x.name + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt index f02f8f9f4d..e9e2972b40 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt @@ -1,10 +1,8 @@ a.js(4,7): error TS2339: Property 'Inner' does not exist on type '() => void'. a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. -a.js(9,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? -a.js(12,12): error TS2503: Cannot find namespace 'Outer'. -==== a.js (4 errors) ==== +==== a.js (2 errors) ==== var Outer = function O() { this.y = 2 } @@ -18,13 +16,9 @@ a.js(12,12): error TS2503: Cannot find namespace 'Outer'. } } /** @type {Outer} */ - ~~~~~ -!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? var ja ja.y /** @type {Outer.Inner} */ - ~~~~~ -!!! error TS2503: Cannot find namespace 'Outer'. var da da.x \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt.diff index 4531ff7bdf..f2a1bb765e 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt.diff @@ -5,11 +5,9 @@ @@= skipped --1, +1 lines =@@ +a.js(4,7): error TS2339: Property 'Inner' does not exist on type '() => void'. +a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. -+a.js(9,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? -+a.js(12,12): error TS2503: Cannot find namespace 'Outer'. + + -+==== a.js (4 errors) ==== ++==== a.js (2 errors) ==== + var Outer = function O() { + this.y = 2 + } @@ -23,13 +21,9 @@ + } + } + /** @type {Outer} */ -+ ~~~~~ -+!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? + var ja + ja.y + /** @type {Outer.Inner} */ -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'Outer'. + var da + da.x + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt index 13dca3e156..08e085ad62 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt @@ -1,4 +1,3 @@ -bug26877.js(1,13): error TS2503: Cannot find namespace 'Emu'. bug26877.js(4,23): error TS2339: Property 'D' does not exist on type '{}'. bug26877.js(5,19): error TS2339: Property 'D' does not exist on type '{}'. bug26877.js(7,5): error TS2339: Property 'D' does not exist on type '{}'. @@ -6,10 +5,8 @@ bug26877.js(9,14): error TS2339: Property '_model' does not exist on type 'D'. second.js(3,5): error TS2339: Property 'D' does not exist on type '{}'. -==== bug26877.js (5 errors) ==== +==== bug26877.js (4 errors) ==== /** @param {Emu.D} x */ - ~~~ -!!! error TS2503: Cannot find namespace 'Emu'. function ollKorrect(x) { x._model const y = new Emu.D() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt.diff index 4a037f26e0..128ce049a7 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt.diff @@ -3,7 +3,6 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+bug26877.js(1,13): error TS2503: Cannot find namespace 'Emu'. +bug26877.js(4,23): error TS2339: Property 'D' does not exist on type '{}'. +bug26877.js(5,19): error TS2339: Property 'D' does not exist on type '{}'. +bug26877.js(7,5): error TS2339: Property 'D' does not exist on type '{}'. @@ -11,10 +10,8 @@ +second.js(3,5): error TS2339: Property 'D' does not exist on type '{}'. + + -+==== bug26877.js (5 errors) ==== ++==== bug26877.js (4 errors) ==== + /** @param {Emu.D} x */ -+ ~~~ -+!!! error TS2503: Cannot find namespace 'Emu'. + function ollKorrect(x) { + x._model + const y = new Emu.D() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt index 3b644b682e..91587b0f27 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt @@ -1,15 +1,13 @@ a.js(1,7): error TS2339: Property 'Inner' does not exist on type '{}'. a.js(4,14): error TS2339: Property 'y' does not exist on type 'Inner'. -a.js(8,12): error TS2503: Cannot find namespace 'Outer'. a.js(11,23): error TS2339: Property 'Inner' does not exist on type '{}'. -b.js(1,12): error TS2503: Cannot find namespace 'Outer'. b.js(4,19): error TS2339: Property 'Inner' does not exist on type '{}'. ==== def.js (0 errors) ==== var Outer = {}; -==== a.js (4 errors) ==== +==== a.js (3 errors) ==== Outer.Inner = class { ~~~~~ !!! error TS2339: Property 'Inner' does not exist on type '{}'. @@ -22,8 +20,6 @@ b.js(4,19): error TS2339: Property 'Inner' does not exist on type '{}'. } /** @type {Outer.Inner} */ - ~~~~~ -!!! error TS2503: Cannot find namespace 'Outer'. var local local.y var inner = new Outer.Inner() @@ -31,10 +27,8 @@ b.js(4,19): error TS2339: Property 'Inner' does not exist on type '{}'. !!! error TS2339: Property 'Inner' does not exist on type '{}'. inner.y -==== b.js (2 errors) ==== +==== b.js (1 errors) ==== /** @type {Outer.Inner} */ - ~~~~~ -!!! error TS2503: Cannot find namespace 'Outer'. var x x.y var z = new Outer.Inner() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt.diff index 1160915612..ac91c9aa73 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt.diff @@ -5,16 +5,14 @@ @@= skipped --1, +1 lines =@@ +a.js(1,7): error TS2339: Property 'Inner' does not exist on type '{}'. +a.js(4,14): error TS2339: Property 'y' does not exist on type 'Inner'. -+a.js(8,12): error TS2503: Cannot find namespace 'Outer'. +a.js(11,23): error TS2339: Property 'Inner' does not exist on type '{}'. -+b.js(1,12): error TS2503: Cannot find namespace 'Outer'. +b.js(4,19): error TS2339: Property 'Inner' does not exist on type '{}'. + + +==== def.js (0 errors) ==== + var Outer = {}; + -+==== a.js (4 errors) ==== ++==== a.js (3 errors) ==== + Outer.Inner = class { + ~~~~~ +!!! error TS2339: Property 'Inner' does not exist on type '{}'. @@ -27,8 +25,6 @@ + } + + /** @type {Outer.Inner} */ -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'Outer'. + var local + local.y + var inner = new Outer.Inner() @@ -36,10 +32,8 @@ +!!! error TS2339: Property 'Inner' does not exist on type '{}'. + inner.y + -+==== b.js (2 errors) ==== ++==== b.js (1 errors) ==== + /** @type {Outer.Inner} */ -+ ~~~~~ -+!!! error TS2503: Cannot find namespace 'Outer'. + var x + x.y + var z = new Outer.Inner() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt deleted file mode 100644 index 9e6a8111a7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -typeFromPropertyAssignment40.js(5,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? - - -==== typeFromPropertyAssignment40.js (1 errors) ==== - function Outer() { - var self = this - self.y = 2 - } - /** @type {Outer} */ - ~~~~~ -!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? - var ok - ok.y - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt.diff deleted file mode 100644 index c0e369b6ff..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.typeFromPropertyAssignment40.errors.txt -+++ new.typeFromPropertyAssignment40.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+typeFromPropertyAssignment40.js(5,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? -+ -+ -+==== typeFromPropertyAssignment40.js (1 errors) ==== -+ function Outer() { -+ var self = this -+ self.y = 2 -+ } -+ /** @type {Outer} */ -+ ~~~~~ -+!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? -+ var ok -+ ok.y -+ diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt deleted file mode 100644 index d247630d9d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -b.js(3,12): error TS2503: Cannot find namespace 'MC'. - - -==== a.js (0 errors) ==== - export default function MyClass() { - } - MyClass.bar = class C { - } - MyClass.bar - -==== b.js (1 errors) ==== - import MC from './a' - MC.bar - /** @type {MC.bar} */ - ~~ -!!! error TS2503: Cannot find namespace 'MC'. - var x - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt.diff deleted file mode 100644 index d058564af3..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.typeFromPropertyAssignment5.errors.txt -+++ new.typeFromPropertyAssignment5.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+b.js(3,12): error TS2503: Cannot find namespace 'MC'. -+ -+ -+==== a.js (0 errors) ==== -+ export default function MyClass() { -+ } -+ MyClass.bar = class C { -+ } -+ MyClass.bar -+ -+==== b.js (1 errors) ==== -+ import MC from './a' -+ MC.bar -+ /** @type {MC.bar} */ -+ ~~ -+!!! error TS2503: Cannot find namespace 'MC'. -+ var x -+ diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt index 48dce5754d..1798238608 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt @@ -1,7 +1,6 @@ a.js(1,7): error TS2339: Property 'Inner' does not exist on type 'typeof Outer'. a.js(5,7): error TS2339: Property 'i' does not exist on type 'typeof Outer'. b.js(1,18): error TS2339: Property 'i' does not exist on type 'typeof Outer'. -b.js(3,13): error TS2702: 'Outer' only refers to a type, but is being used as a namespace here. ==== def.js (0 errors) ==== @@ -18,14 +17,12 @@ b.js(3,13): error TS2702: 'Outer' only refers to a type, but is being used as a ~ !!! error TS2339: Property 'i' does not exist on type 'typeof Outer'. -==== b.js (2 errors) ==== +==== b.js (1 errors) ==== var msgs = Outer.i.messages() ~ !!! error TS2339: Property 'i' does not exist on type 'typeof Outer'. /** @param {Outer.Inner} inner */ - ~~~~~ -!!! error TS2702: 'Outer' only refers to a type, but is being used as a namespace here. function x(inner) { } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt.diff index c9d605435f..f67d4b476a 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt.diff @@ -6,7 +6,6 @@ +a.js(1,7): error TS2339: Property 'Inner' does not exist on type 'typeof Outer'. +a.js(5,7): error TS2339: Property 'i' does not exist on type 'typeof Outer'. +b.js(1,18): error TS2339: Property 'i' does not exist on type 'typeof Outer'. -+b.js(3,13): error TS2702: 'Outer' only refers to a type, but is being used as a namespace here. + + +==== def.js (0 errors) ==== @@ -23,14 +22,12 @@ + ~ +!!! error TS2339: Property 'i' does not exist on type 'typeof Outer'. + -+==== b.js (2 errors) ==== ++==== b.js (1 errors) ==== + var msgs = Outer.i.messages() + ~ +!!! error TS2339: Property 'i' does not exist on type 'typeof Outer'. + + /** @param {Outer.Inner} inner */ -+ ~~~~~ -+!!! error TS2702: 'Outer' only refers to a type, but is being used as a namespace here. + function x(inner) { + } + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt index c10ea07ed6..594bf0fd6f 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt @@ -3,10 +3,9 @@ index.js(2,8): error TS2339: Property 'Object' does not exist on type '{}'. index.js(2,37): error TS2339: Property 'Item' does not exist on type '{}'. index.js(4,11): error TS2339: Property 'Object' does not exist on type '{}'. index.js(4,41): error TS2339: Property 'Object' does not exist on type '{}'. -index.js(6,12): error TS2503: Cannot find namespace 'Workspace'. -==== index.js (6 errors) ==== +==== index.js (5 errors) ==== First.Item = class I {} ~~~~ !!! error TS2339: Property 'Item' does not exist on type '{}'. @@ -23,8 +22,6 @@ index.js(6,12): error TS2503: Cannot find namespace 'Workspace'. !!! error TS2339: Property 'Object' does not exist on type '{}'. /** @type {Workspace.Object} */ - ~~~~~~~~~ -!!! error TS2503: Cannot find namespace 'Workspace'. var am; ==== roots.js (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt.diff index 1369c11c34..79eee8a1cf 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt.diff @@ -8,10 +8,9 @@ +index.js(2,37): error TS2339: Property 'Item' does not exist on type '{}'. +index.js(4,11): error TS2339: Property 'Object' does not exist on type '{}'. +index.js(4,41): error TS2339: Property 'Object' does not exist on type '{}'. -+index.js(6,12): error TS2503: Cannot find namespace 'Workspace'. + + -+==== index.js (6 errors) ==== ++==== index.js (5 errors) ==== + First.Item = class I {} + ~~~~ +!!! error TS2339: Property 'Item' does not exist on type '{}'. @@ -28,8 +27,6 @@ +!!! error TS2339: Property 'Object' does not exist on type '{}'. + + /** @type {Workspace.Object} */ -+ ~~~~~~~~~ -+!!! error TS2503: Cannot find namespace 'Workspace'. + var am; + +==== roots.js (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt index 03f06755e4..384219bf48 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt @@ -1,10 +1,9 @@ bug26885.js(2,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: string) => number; }'. -bug26885.js(15,12): error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? +bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. bug26885.js(16,13): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -==== bug26885.js (4 errors) ==== +==== bug26885.js (3 errors) ==== function Multimap3() { this._map = {}; ~~~~ @@ -19,13 +18,11 @@ bug26885.js(16,13): error TS7009: 'new' expression, whose target lacks a constru get(key) { return this._map[key + '']; ~~~~ -!!! error TS2339: Property '_map' does not exist on type '{ get: (key: string) => number; }'. +!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. } } /** @type {Multimap3} */ - ~~~~~~~~~ -!!! error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? const map = new Multimap3(); ~~~~~~~~~~~~~~~ !!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt.diff index 1244d23302..37b1cd3e6d 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt.diff @@ -4,13 +4,12 @@ -bug26885.js(11,16): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. - No index signature with a parameter of type 'string' was found on type '{}'. +bug26885.js(2,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: string) => number; }'. -+bug26885.js(15,12): error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? ++bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. +bug26885.js(16,13): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -==== bug26885.js (1 errors) ==== -+==== bug26885.js (4 errors) ==== ++==== bug26885.js (3 errors) ==== function Multimap3() { this._map = {}; + ~~~~ @@ -18,7 +17,7 @@ }; Multimap3.prototype = { -@@= skipped -13, +17 lines =@@ +@@= skipped -13, +16 lines =@@ */ get(key) { return this._map[key + '']; @@ -26,13 +25,11 @@ -!!! error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. -!!! error TS7053: No index signature with a parameter of type 'string' was found on type '{}'. + ~~~~ -+!!! error TS2339: Property '_map' does not exist on type '{ get: (key: string) => number; }'. ++!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. } } /** @type {Multimap3} */ -+ ~~~~~~~~~ -+!!! error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? const map = new Multimap3(); + ~~~~~~~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt b/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt deleted file mode 100644 index b8f89f9c63..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -a.js(3,12): error TS2503: Cannot find namespace 'ns'. - - -==== a.js (1 errors) ==== - // #22973 - var ns = (function() {})(); - /** @type {ns.NotFound} */ - ~~ -!!! error TS2503: Cannot find namespace 'ns'. - var crash; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt.diff index 9db1564091..5710e50dc9 100644 --- a/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt.diff @@ -1,17 +1,16 @@ --- old.typeLookupInIIFE.errors.txt +++ new.typeLookupInIIFE.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -a.js(3,15): error TS2694: Namespace 'ns' has no exported member 'NotFound'. -+a.js(3,12): error TS2503: Cannot find namespace 'ns'. - - - ==== a.js (1 errors) ==== - // #22973 - var ns = (function() {})(); - /** @type {ns.NotFound} */ +- +- +-==== a.js (1 errors) ==== +- // #22973 +- var ns = (function() {})(); +- /** @type {ns.NotFound} */ - ~~~~~~~~ -!!! error TS2694: Namespace 'ns' has no exported member 'NotFound'. -+ ~~ -+!!! error TS2503: Cannot find namespace 'ns'. - var crash; - +- var crash; +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt deleted file mode 100644 index de325584fa..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -typeTagNoErasure.js(3,12): error TS2304: Cannot find name 'Test'. - - -==== typeTagNoErasure.js (1 errors) ==== - /** @template T @typedef {(data: T1) => T1} Test */ - - /** @type {Test} */ - ~~~~ -!!! error TS2304: Cannot find name 'Test'. - const test = dibbity => dibbity - - test(1) // ok, T=1 - test('hi') // error, T=number - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt.diff index dad0be3c83..67ef76739b 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt.diff @@ -1,20 +1,19 @@ --- old.typeTagNoErasure.errors.txt +++ new.typeTagNoErasure.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -typeTagNoErasure.js(7,6): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -+typeTagNoErasure.js(3,12): error TS2304: Cannot find name 'Test'. - - - ==== typeTagNoErasure.js (1 errors) ==== - /** @template T @typedef {(data: T1) => T1} Test */ - - /** @type {Test} */ -+ ~~~~ -+!!! error TS2304: Cannot find name 'Test'. - const test = dibbity => dibbity - - test(1) // ok, T=1 - test('hi') // error, T=number +- +- +-==== typeTagNoErasure.js (1 errors) ==== +- /** @template T @typedef {(data: T1) => T1} Test */ +- +- /** @type {Test} */ +- const test = dibbity => dibbity +- +- test(1) // ok, T=1 +- test('hi') // error, T=number - ~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt deleted file mode 100644 index dbe7d7c99d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt +++ /dev/null @@ -1,22 +0,0 @@ -typeTagOnFunctionReferencesGeneric.js(11,11): error TS2304: Cannot find name 'IFn'. - - -==== typeTagOnFunctionReferencesGeneric.js (1 errors) ==== - /** - * @typedef {(m : T) => T} IFn - */ - - /**@type {IFn}*/ - export function inJs(l) { - return l; - } - inJs(1); // lints error. Why? - - /**@type {IFn}*/ - ~~~ -!!! error TS2304: Cannot find name 'IFn'. - const inJsArrow = (j) => { - return j; - } - inJsArrow(2); // no error gets linted as expected - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt.diff deleted file mode 100644 index 5d13f650bc..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.typeTagOnFunctionReferencesGeneric.errors.txt -+++ new.typeTagOnFunctionReferencesGeneric.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+typeTagOnFunctionReferencesGeneric.js(11,11): error TS2304: Cannot find name 'IFn'. -+ -+ -+==== typeTagOnFunctionReferencesGeneric.js (1 errors) ==== -+ /** -+ * @typedef {(m : T) => T} IFn -+ */ -+ -+ /**@type {IFn}*/ -+ export function inJs(l) { -+ return l; -+ } -+ inJs(1); // lints error. Why? -+ -+ /**@type {IFn}*/ -+ ~~~ -+!!! error TS2304: Cannot find name 'IFn'. -+ const inJsArrow = (j) => { -+ return j; -+ } -+ inJsArrow(2); // no error gets linted as expected -+ diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt index f24690a5c6..0477d0beb9 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt @@ -1,7 +1,4 @@ mod3.js(6,1): error TS2304: Cannot find name 'exports'. -use.js(1,29): error TS2694: Namespace '"mod1"' has no exported member 'Both'. -use.js(3,29): error TS2694: Namespace '"mod2"' has no exported member 'Both'. -use.js(5,29): error TS2694: Namespace '"mod3"' has no exported member 'Both'. ==== commonjs.d.ts (0 errors) ==== @@ -38,18 +35,12 @@ use.js(5,29): error TS2694: Namespace '"mod3"' has no exported member 'Both'. this.p = 1 } -==== use.js (3 errors) ==== +==== use.js (0 errors) ==== /** @type {import('./mod1').Both} */ - ~~~~ -!!! error TS2694: Namespace '"mod1"' has no exported member 'Both'. var both1 = { type: 'a', x: 1 }; /** @type {import('./mod2').Both} */ - ~~~~ -!!! error TS2694: Namespace '"mod2"' has no exported member 'Both'. var both2 = both1; /** @type {import('./mod3').Both} */ - ~~~~ -!!! error TS2694: Namespace '"mod3"' has no exported member 'Both'. var both3 = both2; diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff index fba37714ea..47b8f2f3bc 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff @@ -4,9 +4,6 @@ - @@= skipped --1, +1 lines =@@ +mod3.js(6,1): error TS2304: Cannot find name 'exports'. -+use.js(1,29): error TS2694: Namespace '"mod1"' has no exported member 'Both'. -+use.js(3,29): error TS2694: Namespace '"mod2"' has no exported member 'Both'. -+use.js(5,29): error TS2694: Namespace '"mod3"' has no exported member 'Both'. + + +==== commonjs.d.ts (0 errors) ==== @@ -43,18 +40,12 @@ + this.p = 1 + } + -+==== use.js (3 errors) ==== ++==== use.js (0 errors) ==== + /** @type {import('./mod1').Both} */ -+ ~~~~ -+!!! error TS2694: Namespace '"mod1"' has no exported member 'Both'. + var both1 = { type: 'a', x: 1 }; + /** @type {import('./mod2').Both} */ -+ ~~~~ -+!!! error TS2694: Namespace '"mod2"' has no exported member 'Both'. + var both2 = both1; + /** @type {import('./mod3').Both} */ -+ ~~~~ -+!!! error TS2694: Namespace '"mod3"' has no exported member 'Both'. + var both3 = both2; + + diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt index 98a50caafd..bdbed02782 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt @@ -1,19 +1,13 @@ use.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -use.js(2,19): error TS2307: Cannot find module './mod1.js' or its corresponding type declarations. -use.js(4,12): error TS2503: Cannot find namespace 'mod'. -==== use.js (3 errors) ==== +==== use.js (1 errors) ==== var mod = require('./mod1.js'); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @type {import("./mod1.js").Baz} */ - ~~~~~~~~~~~ -!!! error TS2307: Cannot find module './mod1.js' or its corresponding type declarations. var b; /** @type {mod.Baz} */ - ~~~ -!!! error TS2503: Cannot find namespace 'mod'. var bb; var bbb = new mod.Baz(); diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt.diff index 5b880ebdd3..ecc36a9d6a 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt.diff @@ -6,22 +6,16 @@ -mod1.js(9,23): error TS2300: Duplicate identifier 'Baz'. -mod1.js(11,5): error TS2300: Duplicate identifier 'Baz'. +use.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+use.js(2,19): error TS2307: Cannot find module './mod1.js' or its corresponding type declarations. -+use.js(4,12): error TS2503: Cannot find namespace 'mod'. -==== use.js (0 errors) ==== -+==== use.js (3 errors) ==== ++==== use.js (1 errors) ==== var mod = require('./mod1.js'); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @type {import("./mod1.js").Baz} */ -+ ~~~~~~~~~~~ -+!!! error TS2307: Cannot find module './mod1.js' or its corresponding type declarations. var b; /** @type {mod.Baz} */ -+ ~~~ -+!!! error TS2503: Cannot find namespace 'mod'. var bb; var bbb = new mod.Baz(); diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt index f8e5a8a165..222260e5aa 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt @@ -1,10 +1,7 @@ -a.js(9,12): error TS2304: Cannot find name 'Everything'. -a.js(12,12): error TS2304: Cannot find name 'Everything'. -a.js(15,12): error TS2304: Cannot find name 'Everything'. test.ts(1,23): error TS2304: Cannot find name 'Everything'. -==== a.js (3 errors) ==== +==== a.js (0 errors) ==== /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? @@ -14,18 +11,12 @@ test.ts(1,23): error TS2304: Cannot find name 'Everything'. */ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ - ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'Everything'. var tuvwx; /** @type {Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>} */ - ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'Everything'. var wrong; /** @type {Everything<{ a: number }>} */ - ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'Everything'. var insufficient; ==== test.ts (1 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt.diff index 1e2c000cb7..dff9383d64 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt.diff @@ -6,23 +6,15 @@ -a.js(15,12): error TS2314: Generic type 'Everything' requires 5 type argument(s). -test.ts(1,34): error TS2344: Type '{ a: number; }' does not satisfy the constraint '{ a: number; b: string; }'. - Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -+a.js(9,12): error TS2304: Cannot find name 'Everything'. -+a.js(12,12): error TS2304: Cannot find name 'Everything'. -+a.js(15,12): error TS2304: Cannot find name 'Everything'. +test.ts(1,23): error TS2304: Cannot find name 'Everything'. -==== a.js (2 errors) ==== -+==== a.js (3 errors) ==== ++==== a.js (0 errors) ==== /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? -@@= skipped -14, +13 lines =@@ - */ - - /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ -+ ~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'Everything'. +@@= skipped -17, +13 lines =@@ var tuvwx; /** @type {Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>} */ @@ -30,15 +22,11 @@ -!!! error TS2344: Type '{ a: number; }' does not satisfy the constraint '{ a: number; b: string; }'. -!!! error TS2344: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -!!! related TS2728 a.js:2:28: 'b' is declared here. -+ ~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'Everything'. var wrong; /** @type {Everything<{ a: number }>} */ - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2314: Generic type 'Everything' requires 5 type argument(s). -+ ~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'Everything'. var insufficient; ==== test.ts (1 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt deleted file mode 100644 index 12655bf398..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -typedefOnSemicolonClassElement.js(4,14): error TS2304: Cannot find name 'A'. - - -==== typedefOnSemicolonClassElement.js (1 errors) ==== - export class Preferences { - /** @typedef {string} A */ - ; - /** @type {A} */ - ~ -!!! error TS2304: Cannot find name 'A'. - a = 'ok' - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt.diff deleted file mode 100644 index e517e57756..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.typedefOnSemicolonClassElement.errors.txt -+++ new.typedefOnSemicolonClassElement.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+typedefOnSemicolonClassElement.js(4,14): error TS2304: Cannot find name 'A'. -+ -+ -+==== typedefOnSemicolonClassElement.js (1 errors) ==== -+ export class Preferences { -+ /** @typedef {string} A */ -+ ; -+ /** @type {A} */ -+ ~ -+!!! error TS2304: Cannot find name 'A'. -+ a = 'ok' -+ } -+ diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt index 192157c956..bb1b8d809e 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt @@ -1,27 +1,9 @@ typedefOnStatements.js(26,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. typedefOnStatements.js(31,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. typedefOnStatements.js(33,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. -typedefOnStatements.js(53,12): error TS2304: Cannot find name 'A'. -typedefOnStatements.js(54,12): error TS2304: Cannot find name 'B'. -typedefOnStatements.js(55,12): error TS2304: Cannot find name 'C'. -typedefOnStatements.js(56,12): error TS2304: Cannot find name 'D'. -typedefOnStatements.js(57,12): error TS2304: Cannot find name 'E'. -typedefOnStatements.js(58,12): error TS2304: Cannot find name 'F'. -typedefOnStatements.js(59,12): error TS2304: Cannot find name 'G'. -typedefOnStatements.js(60,12): error TS2304: Cannot find name 'H'. -typedefOnStatements.js(61,12): error TS2304: Cannot find name 'I'. -typedefOnStatements.js(62,12): error TS2304: Cannot find name 'J'. -typedefOnStatements.js(63,12): error TS2304: Cannot find name 'K'. -typedefOnStatements.js(64,12): error TS2304: Cannot find name 'L'. -typedefOnStatements.js(65,12): error TS2304: Cannot find name 'M'. -typedefOnStatements.js(66,12): error TS2304: Cannot find name 'N'. -typedefOnStatements.js(67,12): error TS2304: Cannot find name 'O'. -typedefOnStatements.js(68,12): error TS2304: Cannot find name 'P'. -typedefOnStatements.js(69,12): error TS2304: Cannot find name 'Q'. -typedefOnStatements.js(73,16): error TS2304: Cannot find name 'Alpha'. -==== typedefOnStatements.js (21 errors) ==== +==== typedefOnStatements.js (3 errors) ==== /** @typedef {{a: string}} A */ ; /** @typedef {{ b: string }} B */ @@ -81,62 +63,26 @@ typedefOnStatements.js(73,16): error TS2304: Cannot find name 'Alpha'. /** * @param {A} a - ~ -!!! error TS2304: Cannot find name 'A'. * @param {B} b - ~ -!!! error TS2304: Cannot find name 'B'. * @param {C} c - ~ -!!! error TS2304: Cannot find name 'C'. * @param {D} d - ~ -!!! error TS2304: Cannot find name 'D'. * @param {E} e - ~ -!!! error TS2304: Cannot find name 'E'. * @param {F} f - ~ -!!! error TS2304: Cannot find name 'F'. * @param {G} g - ~ -!!! error TS2304: Cannot find name 'G'. * @param {H} h - ~ -!!! error TS2304: Cannot find name 'H'. * @param {I} i - ~ -!!! error TS2304: Cannot find name 'I'. * @param {J} j - ~ -!!! error TS2304: Cannot find name 'J'. * @param {K} k - ~ -!!! error TS2304: Cannot find name 'K'. * @param {L} l - ~ -!!! error TS2304: Cannot find name 'L'. * @param {M} m - ~ -!!! error TS2304: Cannot find name 'M'. * @param {N} n - ~ -!!! error TS2304: Cannot find name 'N'. * @param {O} o - ~ -!!! error TS2304: Cannot find name 'O'. * @param {P} p - ~ -!!! error TS2304: Cannot find name 'P'. * @param {Q} q - ~ -!!! error TS2304: Cannot find name 'Q'. */ function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) /** @type {Alpha} */ - ~~~~~ -!!! error TS2304: Cannot find name 'Alpha'. var alpha = { alpha: "aleph" } /** @typedef {{ alpha: string }} Alpha */ return diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt.diff index 0355405c06..c375dd6a74 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt.diff @@ -5,32 +5,14 @@ typedefOnStatements.js(31,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. -typedefOnStatements.js(33,1): error TS1101: 'with' statements are not allowed in strict mode. typedefOnStatements.js(33,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. -+typedefOnStatements.js(53,12): error TS2304: Cannot find name 'A'. -+typedefOnStatements.js(54,12): error TS2304: Cannot find name 'B'. -+typedefOnStatements.js(55,12): error TS2304: Cannot find name 'C'. -+typedefOnStatements.js(56,12): error TS2304: Cannot find name 'D'. -+typedefOnStatements.js(57,12): error TS2304: Cannot find name 'E'. -+typedefOnStatements.js(58,12): error TS2304: Cannot find name 'F'. -+typedefOnStatements.js(59,12): error TS2304: Cannot find name 'G'. -+typedefOnStatements.js(60,12): error TS2304: Cannot find name 'H'. -+typedefOnStatements.js(61,12): error TS2304: Cannot find name 'I'. -+typedefOnStatements.js(62,12): error TS2304: Cannot find name 'J'. -+typedefOnStatements.js(63,12): error TS2304: Cannot find name 'K'. -+typedefOnStatements.js(64,12): error TS2304: Cannot find name 'L'. -+typedefOnStatements.js(65,12): error TS2304: Cannot find name 'M'. -+typedefOnStatements.js(66,12): error TS2304: Cannot find name 'N'. -+typedefOnStatements.js(67,12): error TS2304: Cannot find name 'O'. -+typedefOnStatements.js(68,12): error TS2304: Cannot find name 'P'. -+typedefOnStatements.js(69,12): error TS2304: Cannot find name 'Q'. -+typedefOnStatements.js(73,16): error TS2304: Cannot find name 'Alpha'. -==== typedefOnStatements.js (4 errors) ==== -+==== typedefOnStatements.js (21 errors) ==== ++==== typedefOnStatements.js (3 errors) ==== /** @typedef {{a: string}} A */ ; /** @typedef {{ b: string }} B */ -@@= skipped -41, +58 lines =@@ +@@= skipped -41, +40 lines =@@ !!! error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. /** @typedef {{ m: string }} M */ with (name) { @@ -39,66 +21,3 @@ ~~~~~~~~~~~ !!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. } -@@= skipped -24, +22 lines =@@ - - /** - * @param {A} a -+ ~ -+!!! error TS2304: Cannot find name 'A'. - * @param {B} b -+ ~ -+!!! error TS2304: Cannot find name 'B'. - * @param {C} c -+ ~ -+!!! error TS2304: Cannot find name 'C'. - * @param {D} d -+ ~ -+!!! error TS2304: Cannot find name 'D'. - * @param {E} e -+ ~ -+!!! error TS2304: Cannot find name 'E'. - * @param {F} f -+ ~ -+!!! error TS2304: Cannot find name 'F'. - * @param {G} g -+ ~ -+!!! error TS2304: Cannot find name 'G'. - * @param {H} h -+ ~ -+!!! error TS2304: Cannot find name 'H'. - * @param {I} i -+ ~ -+!!! error TS2304: Cannot find name 'I'. - * @param {J} j -+ ~ -+!!! error TS2304: Cannot find name 'J'. - * @param {K} k -+ ~ -+!!! error TS2304: Cannot find name 'K'. - * @param {L} l -+ ~ -+!!! error TS2304: Cannot find name 'L'. - * @param {M} m -+ ~ -+!!! error TS2304: Cannot find name 'M'. - * @param {N} n -+ ~ -+!!! error TS2304: Cannot find name 'N'. - * @param {O} o -+ ~ -+!!! error TS2304: Cannot find name 'O'. - * @param {P} p -+ ~ -+!!! error TS2304: Cannot find name 'P'. - * @param {Q} q -+ ~ -+!!! error TS2304: Cannot find name 'Q'. - */ - function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { - console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) - /** @type {Alpha} */ -+ ~~~~~ -+!!! error TS2304: Cannot find name 'Alpha'. - var alpha = { alpha: "aleph" } - /** @typedef {{ alpha: string }} Alpha */ - return diff --git a/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt deleted file mode 100644 index 90065b5b9c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -typedefScope1.js(3,16): error TS2304: Cannot find name 'B'. -typedefScope1.js(9,16): error TS2304: Cannot find name 'B'. -typedefScope1.js(13,12): error TS2304: Cannot find name 'B'. - - -==== typedefScope1.js (3 errors) ==== - function B1() { - /** @typedef {number} B */ - /** @type {B} */ - ~ -!!! error TS2304: Cannot find name 'B'. - var ok1 = 0; - } - - function B2() { - /** @typedef {string} B */ - /** @type {B} */ - ~ -!!! error TS2304: Cannot find name 'B'. - var ok2 = 'hi'; - } - - /** @type {B} */ - ~ -!!! error TS2304: Cannot find name 'B'. - var notOK = 0; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt.diff index 4ecf22eef8..e138e63ed9 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt.diff @@ -1,26 +1,26 @@ --- old.typedefScope1.errors.txt +++ new.typedefScope1.errors.txt -@@= skipped -0, +0 lines =@@ -+typedefScope1.js(3,16): error TS2304: Cannot find name 'B'. -+typedefScope1.js(9,16): error TS2304: Cannot find name 'B'. - typedefScope1.js(13,12): error TS2304: Cannot find name 'B'. - - +@@= skipped -0, +-1 lines =@@ +-typedefScope1.js(13,12): error TS2304: Cannot find name 'B'. +- +- -==== typedefScope1.js (1 errors) ==== -+==== typedefScope1.js (3 errors) ==== - function B1() { - /** @typedef {number} B */ - /** @type {B} */ -+ ~ -+!!! error TS2304: Cannot find name 'B'. - var ok1 = 0; - } - - function B2() { - /** @typedef {string} B */ - /** @type {B} */ -+ ~ -+!!! error TS2304: Cannot find name 'B'. - var ok2 = 'hi'; - } - +- function B1() { +- /** @typedef {number} B */ +- /** @type {B} */ +- var ok1 = 0; +- } +- +- function B2() { +- /** @typedef {string} B */ +- /** @type {B} */ +- var ok2 = 'hi'; +- } +- +- /** @type {B} */ +- ~ +-!!! error TS2304: Cannot find name 'B'. +- var notOK = 0; +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt deleted file mode 100644 index 01da705943..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -typedefTagExtraneousProperty.js(5,12): error TS2304: Cannot find name 'Mmap'. - - -==== typedefTagExtraneousProperty.js (1 errors) ==== - /** @typedef {Object.} Mmap - * @property {string} ignoreMe - should be ignored - */ - - /** @type {Mmap} */ - ~~~~ -!!! error TS2304: Cannot find name 'Mmap'. - var y = { bye: "no" }; - y - y.ignoreMe = "ok but just because of the index signature" - y['hi'] = "yes" - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt.diff deleted file mode 100644 index b638cc4c9e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.typedefTagExtraneousProperty.errors.txt -+++ new.typedefTagExtraneousProperty.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+typedefTagExtraneousProperty.js(5,12): error TS2304: Cannot find name 'Mmap'. -+ -+ -+==== typedefTagExtraneousProperty.js (1 errors) ==== -+ /** @typedef {Object.} Mmap -+ * @property {string} ignoreMe - should be ignored -+ */ -+ -+ /** @type {Mmap} */ -+ ~~~~ -+!!! error TS2304: Cannot find name 'Mmap'. -+ var y = { bye: "no" }; -+ y -+ y.ignoreMe = "ok but just because of the index signature" -+ y['hi'] = "yes" -+ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt deleted file mode 100644 index a0183ea0d0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt +++ /dev/null @@ -1,52 +0,0 @@ -a.js(9,12): error TS2304: Cannot find name 'App'. -a.js(26,12): error TS2304: Cannot find name 'Opp'. -a.js(35,12): error TS2304: Cannot find name 'Upp'. - - -==== a.js (3 errors) ==== - /** @typedef {Object} App - * @property {string} name - * @property {Object} icons - * @property {string} icons.image32 - * @property {string} icons.image64 - */ - var ex; - - /** @type {App} */ - ~~~ -!!! error TS2304: Cannot find name 'App'. - const app = { - name: 'name', - icons: { - image32: 'x.png', - image64: 'y.png', - } - } - - /** @typedef {Object} Opp - * @property {string} name - * @property {Object} oops - * @property {string} horrible - * @type {string} idea - */ - var intercessor = 1 - - /** @type {Opp} */ - ~~~ -!!! error TS2304: Cannot find name 'Opp'. - var mistake; - - /** @typedef {Object} Upp - * @property {string} name - * @property {Object} not - * @property {string} nested - */ - - /** @type {Upp} */ - ~~~ -!!! error TS2304: Cannot find name 'Upp'. - var sala = { name: 'uppsala', not: 0, nested: "ok" }; - sala.name - sala.not - sala.nested - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt.diff deleted file mode 100644 index d9198a6693..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.errors.txt.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.typedefTagNested.errors.txt -+++ new.typedefTagNested.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+a.js(9,12): error TS2304: Cannot find name 'App'. -+a.js(26,12): error TS2304: Cannot find name 'Opp'. -+a.js(35,12): error TS2304: Cannot find name 'Upp'. -+ -+ -+==== a.js (3 errors) ==== -+ /** @typedef {Object} App -+ * @property {string} name -+ * @property {Object} icons -+ * @property {string} icons.image32 -+ * @property {string} icons.image64 -+ */ -+ var ex; -+ -+ /** @type {App} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'App'. -+ const app = { -+ name: 'name', -+ icons: { -+ image32: 'x.png', -+ image64: 'y.png', -+ } -+ } -+ -+ /** @typedef {Object} Opp -+ * @property {string} name -+ * @property {Object} oops -+ * @property {string} horrible -+ * @type {string} idea -+ */ -+ var intercessor = 1 -+ -+ /** @type {Opp} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Opp'. -+ var mistake; -+ -+ /** @typedef {Object} Upp -+ * @property {string} name -+ * @property {Object} not -+ * @property {string} nested -+ */ -+ -+ /** @type {Upp} */ -+ ~~~ -+!!! error TS2304: Cannot find name 'Upp'. -+ var sala = { name: 'uppsala', not: 0, nested: "ok" }; -+ sala.name -+ sala.not -+ sala.nested -+ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt deleted file mode 100644 index 2c0ea264b2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt +++ /dev/null @@ -1,46 +0,0 @@ -github20832.js(5,12): error TS2304: Cannot find name 'U'. -github20832.js(6,13): error TS2304: Cannot find name 'T'. -github20832.js(12,11): error TS2304: Cannot find name 'T'. -github20832.js(21,12): error TS2304: Cannot find name 'V'. -github20832.js(26,12): error TS2304: Cannot find name 'Cb'. - - -==== github20832.js (5 errors) ==== - // #20832 - /** @typedef {U} T - should be "error, can't find type named 'U' */ - /** - * @template U - * @param {U} x - ~ -!!! error TS2304: Cannot find name 'U'. - * @return {T} - ~ -!!! error TS2304: Cannot find name 'T'. - */ - function f(x) { - return x; - } - - /** @type T - should be fine, since T will be any */ - ~ -!!! error TS2304: Cannot find name 'T'. - const x = 3; - - /** - * @callback Cb - * @param {V} firstParam - */ - /** - * @template V - * @param {V} vvvvv - ~ -!!! error TS2304: Cannot find name 'V'. - */ - function g(vvvvv) { - } - - /** @type {Cb} */ - ~~ -!!! error TS2304: Cannot find name 'Cb'. - const cb = x => {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt.diff index 4078d8fc97..0f73f88c40 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt.diff @@ -1,56 +1,42 @@ --- old.typedefTagTypeResolution.errors.txt +++ new.typedefTagTypeResolution.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -github20832.js(2,15): error TS2304: Cannot find name 'U'. -github20832.js(17,12): error TS2304: Cannot find name 'V'. -+github20832.js(5,12): error TS2304: Cannot find name 'U'. -+github20832.js(6,13): error TS2304: Cannot find name 'T'. -+github20832.js(12,11): error TS2304: Cannot find name 'T'. -+github20832.js(21,12): error TS2304: Cannot find name 'V'. -+github20832.js(26,12): error TS2304: Cannot find name 'Cb'. - - +- +- -==== github20832.js (2 errors) ==== -+==== github20832.js (5 errors) ==== - // #20832 - /** @typedef {U} T - should be "error, can't find type named 'U' */ +- // #20832 +- /** @typedef {U} T - should be "error, can't find type named 'U' */ - ~ -!!! error TS2304: Cannot find name 'U'. - /** - * @template U - * @param {U} x -+ ~ -+!!! error TS2304: Cannot find name 'U'. - * @return {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. - */ - function f(x) { - return x; - } - - /** @type T - should be fine, since T will be any */ -+ ~ -+!!! error TS2304: Cannot find name 'T'. - const x = 3; - - /** - * @callback Cb - * @param {V} firstParam +- /** +- * @template U +- * @param {U} x +- * @return {T} +- */ +- function f(x) { +- return x; +- } +- +- /** @type T - should be fine, since T will be any */ +- const x = 3; +- +- /** +- * @callback Cb +- * @param {V} firstParam - ~ -!!! error TS2304: Cannot find name 'V'. - */ - /** - * @template V - * @param {V} vvvvv -+ ~ -+!!! error TS2304: Cannot find name 'V'. - */ - function g(vvvvv) { - } - - /** @type {Cb} */ -+ ~~ -+!!! error TS2304: Cannot find name 'Cb'. - const cb = x => {} - +- */ +- /** +- * @template V +- * @param {V} vvvvv +- */ +- function g(vvvvv) { +- } +- +- /** @type {Cb} */ +- const cb = x => {} +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt deleted file mode 100644 index 9b800efef5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt +++ /dev/null @@ -1,148 +0,0 @@ -mod1.js(9,12): error TS2304: Cannot find name 'Type1'. -mod2.js(11,12): error TS2304: Cannot find name 'Type2'. -mod3.js(10,12): error TS2304: Cannot find name 'StringOrNumber1'. -mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. -mod5.js(14,12): error TS2304: Cannot find name 'Type5'. -mod6.js(12,12): error TS2304: Cannot find name 'Type6'. - - -==== mod1.js (1 errors) ==== - /** - * @typedef {function(string): boolean} - * Type1 - */ - - /** - * Tries to use a type whose name is on a different - * line than the typedef tag. - * @param {Type1} func The function to call. - ~~~~~ -!!! error TS2304: Cannot find name 'Type1'. - * @param {string} arg The argument to call it with. - * @returns {boolean} The return. - */ - function callIt(func, arg) { - return func(arg); - } - -==== mod2.js (1 errors) ==== - /** - * @typedef {{ - * num: number, - * str: string, - * boo: boolean - * }} Type2 - */ - - /** - * Makes use of a type with a multiline type expression. - * @param {Type2} obj The object. - ~~~~~ -!!! error TS2304: Cannot find name 'Type2'. - * @returns {string|number} The return. - */ - function check(obj) { - return obj.boo ? obj.num : obj.str; - } - -==== mod3.js (1 errors) ==== - /** - * A function whose signature is very long. - * - * @typedef {function(boolean, string, number): - * (string|number)} StringOrNumber1 - */ - - /** - * Makes use of a function type with a long signature. - * @param {StringOrNumber1} func The function. - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'StringOrNumber1'. - * @param {boolean} bool The condition. - * @param {string} str The string. - * @param {number} num The number. - * @returns {string|number} The return. - */ - function use1(func, bool, str, num) { - return func(bool, str, num) - } - -==== mod4.js (1 errors) ==== - /** - * A function whose signature is very long. - * - * @typedef {function(boolean, string, - * number): - * (string|number)} StringOrNumber2 - */ - - /** - * Makes use of a function type with a long signature. - * @param {StringOrNumber2} func The function. - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'StringOrNumber2'. - * @param {boolean} bool The condition. - * @param {string} str The string. - * @param {number} num The number. - * @returns {string|number} The return. - */ - function use2(func, bool, str, num) { - return func(bool, str, num) - } - -==== mod5.js (1 errors) ==== - /** - * @typedef {{ - * num: - * number, - * str: - * string, - * boo: - * boolean - * }} Type5 - */ - - /** - * Makes use of a type with a multiline type expression. - * @param {Type5} obj The object. - ~~~~~ -!!! error TS2304: Cannot find name 'Type5'. - * @returns {string|number} The return. - */ - function check5(obj) { - return obj.boo ? obj.num : obj.str; - } - -==== mod6.js (1 errors) ==== - /** - * @typedef {{ - * foo: - * *, - * bar: - * * - * }} Type6 - */ - - /** - * Makes use of a type with a multiline type expression. - * @param {Type6} obj The object. - ~~~~~ -!!! error TS2304: Cannot find name 'Type6'. - * @returns {*} The return. - */ - function check6(obj) { - return obj.foo; - } - - -==== mod7.js (0 errors) ==== - /** - Multiline type expressions in comments without leading * are not supported. - @typedef {{ - foo: - *, - bar: - * - }} Type7 - */ - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt.diff index c76ce01fcb..128f3065bf 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt.diff @@ -1,135 +1,141 @@ --- old.typedefTagWrapping.errors.txt +++ new.typedefTagWrapping.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -mod7.js(5,7): error TS1110: Type expected. -mod7.js(8,4): error TS1110: Type expected. -+mod1.js(9,12): error TS2304: Cannot find name 'Type1'. -+mod2.js(11,12): error TS2304: Cannot find name 'Type2'. -+mod3.js(10,12): error TS2304: Cannot find name 'StringOrNumber1'. -+mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. -+mod5.js(14,12): error TS2304: Cannot find name 'Type5'. -+mod6.js(12,12): error TS2304: Cannot find name 'Type6'. - - +- +- -==== mod1.js (0 errors) ==== -+==== mod1.js (1 errors) ==== - /** - * @typedef {function(string): boolean} - * Type1 -@@= skipped -11, +15 lines =@@ - * Tries to use a type whose name is on a different - * line than the typedef tag. - * @param {Type1} func The function to call. -+ ~~~~~ -+!!! error TS2304: Cannot find name 'Type1'. - * @param {string} arg The argument to call it with. - * @returns {boolean} The return. - */ -@@= skipped -7, +9 lines =@@ - return func(arg); - } - +- /** +- * @typedef {function(string): boolean} +- * Type1 +- */ +- +- /** +- * Tries to use a type whose name is on a different +- * line than the typedef tag. +- * @param {Type1} func The function to call. +- * @param {string} arg The argument to call it with. +- * @returns {boolean} The return. +- */ +- function callIt(func, arg) { +- return func(arg); +- } +- -==== mod2.js (0 errors) ==== -+==== mod2.js (1 errors) ==== - /** - * @typedef {{ - * num: number, -@@= skipped -12, +12 lines =@@ - /** - * Makes use of a type with a multiline type expression. - * @param {Type2} obj The object. -+ ~~~~~ -+!!! error TS2304: Cannot find name 'Type2'. - * @returns {string|number} The return. - */ - function check(obj) { - return obj.boo ? obj.num : obj.str; - } - +- /** +- * @typedef {{ +- * num: number, +- * str: string, +- * boo: boolean +- * }} Type2 +- */ +- +- /** +- * Makes use of a type with a multiline type expression. +- * @param {Type2} obj The object. +- * @returns {string|number} The return. +- */ +- function check(obj) { +- return obj.boo ? obj.num : obj.str; +- } +- -==== mod3.js (0 errors) ==== -+==== mod3.js (1 errors) ==== - /** - * A function whose signature is very long. - * -@@= skipped -17, +19 lines =@@ - /** - * Makes use of a function type with a long signature. - * @param {StringOrNumber1} func The function. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'StringOrNumber1'. - * @param {boolean} bool The condition. - * @param {string} str The string. - * @param {number} num The number. -@@= skipped -9, +11 lines =@@ - return func(bool, str, num) - } - +- /** +- * A function whose signature is very long. +- * +- * @typedef {function(boolean, string, number): +- * (string|number)} StringOrNumber1 +- */ +- +- /** +- * Makes use of a function type with a long signature. +- * @param {StringOrNumber1} func The function. +- * @param {boolean} bool The condition. +- * @param {string} str The string. +- * @param {number} num The number. +- * @returns {string|number} The return. +- */ +- function use1(func, bool, str, num) { +- return func(bool, str, num) +- } +- -==== mod4.js (0 errors) ==== -+==== mod4.js (1 errors) ==== - /** - * A function whose signature is very long. - * -@@= skipped -12, +12 lines =@@ - /** - * Makes use of a function type with a long signature. - * @param {StringOrNumber2} func The function. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'StringOrNumber2'. - * @param {boolean} bool The condition. - * @param {string} str The string. - * @param {number} num The number. -@@= skipped -9, +11 lines =@@ - return func(bool, str, num) - } - +- /** +- * A function whose signature is very long. +- * +- * @typedef {function(boolean, string, +- * number): +- * (string|number)} StringOrNumber2 +- */ +- +- /** +- * Makes use of a function type with a long signature. +- * @param {StringOrNumber2} func The function. +- * @param {boolean} bool The condition. +- * @param {string} str The string. +- * @param {number} num The number. +- * @returns {string|number} The return. +- */ +- function use2(func, bool, str, num) { +- return func(bool, str, num) +- } +- -==== mod5.js (0 errors) ==== -+==== mod5.js (1 errors) ==== - /** - * @typedef {{ - * num: -@@= skipped -15, +15 lines =@@ - /** - * Makes use of a type with a multiline type expression. - * @param {Type5} obj The object. -+ ~~~~~ -+!!! error TS2304: Cannot find name 'Type5'. - * @returns {string|number} The return. - */ - function check5(obj) { - return obj.boo ? obj.num : obj.str; - } - +- /** +- * @typedef {{ +- * num: +- * number, +- * str: +- * string, +- * boo: +- * boolean +- * }} Type5 +- */ +- +- /** +- * Makes use of a type with a multiline type expression. +- * @param {Type5} obj The object. +- * @returns {string|number} The return. +- */ +- function check5(obj) { +- return obj.boo ? obj.num : obj.str; +- } +- -==== mod6.js (0 errors) ==== -+==== mod6.js (1 errors) ==== - /** - * @typedef {{ - * foo: -@@= skipped -19, +21 lines =@@ - /** - * Makes use of a type with a multiline type expression. - * @param {Type6} obj The object. -+ ~~~~~ -+!!! error TS2304: Cannot find name 'Type6'. - * @returns {*} The return. - */ - function check6(obj) { -@@= skipped -7, +9 lines =@@ - } - - +- /** +- * @typedef {{ +- * foo: +- * *, +- * bar: +- * * +- * }} Type6 +- */ +- +- /** +- * Makes use of a type with a multiline type expression. +- * @param {Type6} obj The object. +- * @returns {*} The return. +- */ +- function check6(obj) { +- return obj.foo; +- } +- +- -==== mod7.js (2 errors) ==== -+==== mod7.js (0 errors) ==== - /** - Multiline type expressions in comments without leading * are not supported. - @typedef {{ - foo: - *, +- /** +- Multiline type expressions in comments without leading * are not supported. +- @typedef {{ +- foo: +- *, - ~ -!!! error TS1110: Type expected. - bar: - * - }} Type7 +- bar: +- * +- }} Type7 - ~ -!!! error TS1110: Type expected. - */ - +- */ +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt index d8c96807f4..d6462527e5 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt @@ -1,8 +1,7 @@ use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -use.js(10,12): error TS2503: Cannot find namespace 'ex'. -==== use.js (2 errors) ==== +==== use.js (1 errors) ==== var ex = require('./ex') ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -15,8 +14,6 @@ use.js(10,12): error TS2503: Cannot find namespace 'ex'. // types work /** * @param {ex.Crunch} wrap - ~~ -!!! error TS2503: Cannot find namespace 'ex'. */ function f(wrap) { wrap.n diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt.diff index 69e845ec0f..e64541e1ba 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt.diff @@ -4,10 +4,9 @@ - @@= skipped --1, +1 lines =@@ +use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+use.js(10,12): error TS2503: Cannot find namespace 'ex'. + + -+==== use.js (2 errors) ==== ++==== use.js (1 errors) ==== + var ex = require('./ex') + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -20,8 +19,6 @@ + // types work + /** + * @param {ex.Crunch} wrap -+ ~~ -+!!! error TS2503: Cannot find namespace 'ex'. + */ + function f(wrap) { + wrap.n diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt b/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt index f53556abb1..adf3e8e93c 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt @@ -1,9 +1,7 @@ use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -use.js(10,12): error TS2503: Cannot find namespace 'ex'. -use.js(11,12): error TS2503: Cannot find namespace 'ex'. -==== use.js (3 errors) ==== +==== use.js (1 errors) ==== var ex = require('./ex') ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -16,11 +14,7 @@ use.js(11,12): error TS2503: Cannot find namespace 'ex'. // types work /** * @param {ex.Greatest} greatest - ~~ -!!! error TS2503: Cannot find namespace 'ex'. * @param {ex.Crunch} wrap - ~~ -!!! error TS2503: Cannot find namespace 'ex'. */ function f(greatest, wrap) { greatest.day diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt.diff index 26a8cc3d72..a125326dac 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt.diff @@ -4,11 +4,9 @@ - @@= skipped --1, +1 lines =@@ +use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+use.js(10,12): error TS2503: Cannot find namespace 'ex'. -+use.js(11,12): error TS2503: Cannot find namespace 'ex'. + + -+==== use.js (3 errors) ==== ++==== use.js (1 errors) ==== + var ex = require('./ex') + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -21,11 +19,7 @@ + // types work + /** + * @param {ex.Greatest} greatest -+ ~~ -+!!! error TS2503: Cannot find namespace 'ex'. + * @param {ex.Crunch} wrap -+ ~~ -+!!! error TS2503: Cannot find namespace 'ex'. + */ + function f(greatest, wrap) { + greatest.day From 4d420bc74885a2f8ba0a627a43882e76ebd40669 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 19 Mar 2025 08:43:19 -0700 Subject: [PATCH 08/25] Various fixes+ features - Transform `@typedef`+`@property` in a type object literal. - type check JSDoc types - add `@param` optionality when bracketed. --- internal/ast/ast.go | 25 ++++++++------- internal/checker/checker.go | 17 ++++++++-- internal/parser/jsdoc.go | 62 ++++++++++++++++++++----------------- 3 files changed, 63 insertions(+), 41 deletions(-) diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 0bf5961283..5e3fa4d2a4 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -428,7 +428,7 @@ func (n *Node) MemberList() *NodeList { case KindMappedType: return n.AsMappedTypeNode().Members } - panic("Unhandled case in Node.MemberList") + panic("Unhandled case in Node.MemberList: " + n.Kind.String()) } func (n *Node) Members() []*Node { @@ -496,6 +496,8 @@ func (n *Node) Type() *Node { return n.AsTemplateLiteralTypeSpan().Type case KindJSDocTypeExpression: return n.AsJSDocTypeExpression().Type + case KindJSDocPropertyTag: + return n.AsJSDocPropertyTag().TypeExpression case KindJSDocNullableType: return n.AsJSDocNullableType().Type case KindJSDocNonNullableType: @@ -510,7 +512,7 @@ func (n *Node) Type() *Node { return funcLike.Type } } - panic("Unhandled case in Node.Type") + panic("Unhandled case in Node.Type: " + n.Kind.String()) } func (n *Node) Initializer() *Node { @@ -8563,20 +8565,20 @@ func (node *JSDocOverloadTag) Clone(f *NodeFactory) *Node { type JSDocTypedefTag struct { JSDocTagBase TypeExpression *Node - FullName *Node + name *IdentifierNode } -func (f *NodeFactory) NewJSDocTypedefTag(tagName *IdentifierNode, typeExpression *Node, fullName *Node, comment *NodeList) *Node { +func (f *NodeFactory) NewJSDocTypedefTag(tagName *IdentifierNode, typeExpression *Node, name *IdentifierNode, comment *NodeList) *Node { data := &JSDocTypedefTag{} data.TagName = tagName data.TypeExpression = typeExpression - data.FullName = fullName + data.name = name data.Comment = comment return newNode(KindJSDocTypedefTag, data, f.hooks) } -func (f *NodeFactory) UpdateJSDocTypedefTag(node *JSDocTypedefTag, tagName *IdentifierNode, typeExpression *Node, fullName *Node, comment *NodeList) *Node { - if tagName != node.TagName || typeExpression != node.TypeExpression || fullName != node.FullName || comment != node.Comment { +func (f *NodeFactory) UpdateJSDocTypedefTag(node *JSDocTypedefTag, tagName *IdentifierNode, typeExpression *Node, fullName *IdentifierNode, comment *NodeList) *Node { + if tagName != node.TagName || typeExpression != node.TypeExpression || fullName != node.name || comment != node.Comment { return updateNode(f.NewJSDocTypedefTag(tagName, typeExpression, fullName, comment), node.AsNode(), f.hooks) } return node.AsNode() @@ -8584,19 +8586,20 @@ func (f *NodeFactory) UpdateJSDocTypedefTag(node *JSDocTypedefTag, tagName *Iden func (node *JSDocTypedefTag) ForEachChild(v Visitor) bool { if node.TypeExpression != nil && node.TypeExpression.Kind == KindJSDocTypeLiteral { - return visit(v, node.TagName) || visit(v, node.FullName) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment) + return visit(v, node.TagName) || visit(v, node.name) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment) } - return visit(v, node.TagName) || visit(v, node.TypeExpression) || visit(v, node.FullName) || visitNodeList(v, node.Comment) + return visit(v, node.TagName) || visit(v, node.TypeExpression) || visit(v, node.name) || visitNodeList(v, node.Comment) } func (node *JSDocTypedefTag) VisitEachChild(v *NodeVisitor) *Node { - return v.Factory.UpdateJSDocTypedefTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNode(node.FullName), v.visitNodes(node.Comment)) + return v.Factory.UpdateJSDocTypedefTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNode(node.name), v.visitNodes(node.Comment)) } func (node *JSDocTypedefTag) Clone(f *NodeFactory) *Node { - return cloneNode(f.NewJSDocTypedefTag(node.TagName, node.TypeExpression, node.FullName, node.Comment), node.AsNode(), f.hooks) + return cloneNode(f.NewJSDocTypedefTag(node.TagName, node.TypeExpression, node.name, node.Comment), node.AsNode(), f.hooks) } +func (node *JSDocTypedefTag) Name() *DeclarationName { return node.name } // JSDocTypeLiteral type JSDocTypeLiteral struct { TypeNodeBase diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 1905129742..79f915716e 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -20905,8 +20905,21 @@ func (c *Checker) getTypeFromTypeNode(node *ast.Node) *Type { func (c *Checker) getTypeFromTypeNodeWorker(node *ast.Node) *Type { switch node.Kind { - case ast.KindAnyKeyword: + case ast.KindAnyKeyword, ast.KindJSDocAllType: return c.anyType + case ast.KindJSDocNonNullableType: + return c.getTypeFromTypeNode(node.AsJSDocNonNullableType().Type) + case ast.KindJSDocNullableType: + t := c.getTypeFromTypeNode(node.AsJSDocNullableType().Type) + if c.strictNullChecks { + return c.getNullableType(t, TypeFlagsNull) + } else { + return t + } + case ast.KindJSDocVariadicType: + return c.createArrayType(c.getTypeFromTypeNode(node.AsJSDocOptionalType().Type)) + case ast.KindJSDocOptionalType: + return c.addOptionality(c.getTypeFromTypeNode(node.AsJSDocOptionalType().Type)) case ast.KindUnknownKeyword: return c.unknownType case ast.KindStringKeyword: @@ -21846,7 +21859,7 @@ func (c *Checker) getDeclaredTypeOfTypeAlias(symbol *ast.Symbol) *Type { return c.errorType } declaration := core.Find(symbol.Declarations, ast.IsEitherTypeAliasDeclaration) - typeNode := declaration.AsTypeAliasDeclaration().Type + typeNode := declaration.Type() t := c.getTypeFromTypeNode(typeNode) if c.popTypeResolution() { typeParameters := c.getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index 95fba08dd3..328ba4ebbb 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -104,18 +104,39 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { case ast.KindJSDocTypedefTag: // TODO: Maybe save an Original pointer // TODO: Look for neighbouring template tags to fill in typeparameters - // TODO: Figure out the mechanism for putting statements into a container node list + // TODO: Don't mark typedefs as exported if they are not in a module + typeexpr := tag.AsJSDocTypedefTag().TypeExpression + if typeexpr == nil { + break + } export := p.factory.NewModifier(ast.KindExportKeyword) export.Loc = core.NewTextRange(p.nodePos(), p.nodePos()) export.Flags = ast.NodeFlagsSynthesized nodes := p.nodeSlicePool.NewSlice(1) nodes[0] = export modifiers := p.newModifierList(export.Loc, nodes) - jstype := p.factory.NewJSTypeAliasDeclaration(modifiers, tag.AsJSDocTypedefTag().Name(), nil /*typeParameters*/, tag.AsJSDocTypedefTag().TypeExpression) + var t *ast.Node + switch typeexpr.Kind { + case ast.KindJSDocTypeExpression: + t = typeexpr.Type() + case ast.KindJSDocTypeLiteral: + members := p.nodeSlicePool.NewSlice(0) + for _, member := range typeexpr.AsJSDocTypeLiteral().JsDocPropertyTags { + prop := p.factory.NewPropertySignatureDeclaration(nil, member.Name(), nil /*postfixToken*/, member.Type(), nil /*initializer*/) + prop.Loc = export.Loc + members = append(members, prop) + } + t = p.factory.NewTypeLiteralNode(p.newNodeList(export.Loc, members)) + t.Loc = export.Loc + default: + panic("typedef tag type expression should be a name reference or a type expression" + typeexpr.Kind.String()) + } + jstype := p.factory.NewJSTypeAliasDeclaration(modifiers, tag.AsJSDocTypedefTag().Name(), nil /*typeParameters*/, t) + jstype.Loc = core.NewTextRange(p.nodePos(), p.nodePos()) p.reparseList = append(p.reparseList, jstype) + // TODO: @overload and unattached tags (@callback, @import et al) support goes here } if !isLast { - // TODO: @overload and unattached tags support goes here continue } switch tag.Kind { @@ -148,6 +169,12 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { if param, ok := findMatchingParameter(fun, jsparam); ok { if param.Type() == nil { param.AsParameterDeclaration().Type = p.makeNewType(jsparam.TypeExpression) + if param.AsParameterDeclaration().QuestionToken == nil && + // TODO: TypeExpression can *still* be nil here! + (jsparam.IsBracketed || jsparam.TypeExpression.Type().Kind == ast.KindJSDocOptionalType) { + param.AsParameterDeclaration().QuestionToken = p.factory.NewToken(ast.KindQuestionToken) + param.AsParameterDeclaration().QuestionToken.Loc = core.NewTextRange(param.End(), param.End()) + } } } } @@ -207,11 +234,11 @@ func (p *Parser) makeNewTypeAssertion(t *ast.TypeNode, e *ast.Node) *ast.Node { } func (p *Parser) makeNewType(typeExpression *ast.TypeNode) *ast.Node { - if typeExpression == nil { + if typeExpression == nil || typeExpression.Type() == nil { return nil } - t := typeExpression.Clone(&p.factory) + t := typeExpression.Type().Clone(&p.factory) // TODO: What other flags? Copy from decl? from tag's typeexpression? t.Flags |= typeExpression.Flags | ast.NodeFlagsSynthesized return t @@ -1056,8 +1083,7 @@ func (p *Parser) parseThisTag(start int, tagName *ast.IdentifierNode, margin int func (p *Parser) parseTypedefTag(start int, tagName *ast.IdentifierNode, indent int, indentText string) *ast.Node { typeExpression := p.tryParseTypeExpression() p.skipWhitespaceOrAsterisk() - - fullName := p.parseJSDocTypeNameWithNamespace(false /*nested*/) + fullName := p.parseJSDocIdentifierName(nil) p.skipWhitespace() comment := p.parseTagComments(indent, nil) @@ -1129,26 +1155,6 @@ func (p *Parser) parseTypedefTag(start int, tagName *ast.IdentifierNode, indent return typedefTag } -func (p *Parser) parseJSDocTypeNameWithNamespace(nested bool) *ast.Node { - start := p.scanner.TokenStart() - typeNameOrNamespaceName := p.parseJSDocIdentifierName(nil) - if p.parseOptional(ast.KindDotToken) { - body := p.parseJSDocTypeNameWithNamespace(true) - var flags ast.NodeFlags - if nested { - flags = ast.NodeFlagsNestedNamespace - } - jsDocNamespaceNode := p.factory.NewModuleDeclaration(nil, typeNameOrNamespaceName, body, flags) - p.finishNode(jsDocNamespaceNode, start) - return jsDocNamespaceNode - } - - if nested { - typeNameOrNamespaceName.Flags |= ast.NodeFlagsIdentifierIsInJSDocNamespace - } - return typeNameOrNamespaceName -} - func (p *Parser) parseCallbackTagParameters(indent int) *ast.NodeList { var child *ast.Node var parameters []*ast.Node @@ -1188,7 +1194,7 @@ func (p *Parser) parseJSDocSignature(start int, indent int) *ast.Node { } func (p *Parser) parseCallbackTag(start int, tagName *ast.IdentifierNode, indent int, indentText string) *ast.Node { - fullName := p.parseJSDocTypeNameWithNamespace(false /*nested*/) + fullName := p.parseJSDocIdentifierName(nil) p.skipWhitespace() comment := p.parseTagComments(indent, nil) typeExpression := p.parseJSDocSignature(start, indent) From 20a6f6aee4f0c311a88cb8896d7e26dd759928ed Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 20 Mar 2025 10:07:42 -0700 Subject: [PATCH 09/25] Add some tags, accept baselines - refactor `@template` parsing to share constraints in multi-parameter tags - type `@template` tags - type assertions on parenthesised expressions - miscellaneous fixes - I looked at the diffs for compiler/ tests and skimmed the conformance/ ones. There are still some failures I want to fix. --- internal/ast/ast.go | 16 +- internal/checker/utilities.go | 2 +- internal/parser/jsdoc.go | 71 ++- .../tsbaseline/type_symbol_baseline.go | 10 +- internal/transformers/typeeraser.go | 1 + .../amdLikeInputDeclarationEmit.symbols | 2 + .../amdLikeInputDeclarationEmit.symbols.diff | 4 +- .../amdLikeInputDeclarationEmit.types | 24 +- .../argumentsObjectCreatesRestForJs.types | 6 +- .../argumentsReferenceInConstructor1_Js.types | 6 +- .../argumentsReferenceInConstructor2_Js.types | 6 +- .../argumentsReferenceInConstructor3_Js.types | 6 +- .../argumentsReferenceInConstructor4_Js.types | 26 +- .../argumentsReferenceInConstructor5_Js.types | 6 +- .../argumentsReferenceInMethod1_Js.types | 8 +- .../argumentsReferenceInMethod2_Js.types | 8 +- .../argumentsReferenceInMethod3_Js.types | 8 +- .../argumentsReferenceInMethod4_Js.types | 28 +- .../argumentsReferenceInMethod5_Js.types | 8 +- .../arrowFunctionJSDocAnnotation.types | 6 +- ...kJsObjectLiteralHasCheckedKeyof.errors.txt | 18 + .../checkJsObjectLiteralHasCheckedKeyof.types | 4 +- .../checkJsTypeDefNoUnusedLocalMarked.symbols | 3 +- ...kJsTypeDefNoUnusedLocalMarked.symbols.diff | 3 +- .../checkJsTypeDefNoUnusedLocalMarked.types | 8 +- ...JsdocTypeTagOnExportAssignment1.errors.txt | 19 + ...eckJsdocTypeTagOnExportAssignment1.symbols | 2 +- ...docTypeTagOnExportAssignment1.symbols.diff | 2 +- ...checkJsdocTypeTagOnExportAssignment1.types | 11 +- ...JsdocTypeTagOnExportAssignment2.errors.txt | 19 + ...checkJsdocTypeTagOnExportAssignment2.types | 5 +- ...JsdocTypeTagOnExportAssignment3.errors.txt | 21 + ...eckJsdocTypeTagOnExportAssignment3.symbols | 2 +- ...docTypeTagOnExportAssignment3.symbols.diff | 2 +- ...checkJsdocTypeTagOnExportAssignment3.types | 11 +- ...JsdocTypeTagOnExportAssignment4.errors.txt | 14 + ...eckJsdocTypeTagOnExportAssignment4.symbols | 2 +- ...docTypeTagOnExportAssignment4.symbols.diff | 2 +- ...checkJsdocTypeTagOnExportAssignment4.types | 5 +- ...eckJsdocTypeTagOnExportAssignment5.symbols | 2 +- ...docTypeTagOnExportAssignment5.symbols.diff | 2 +- ...checkJsdocTypeTagOnExportAssignment5.types | 11 +- ...eckJsdocTypeTagOnExportAssignment6.symbols | 2 +- ...docTypeTagOnExportAssignment6.symbols.diff | 2 +- ...checkJsdocTypeTagOnExportAssignment6.types | 11 +- ...eckJsdocTypeTagOnExportAssignment7.symbols | 2 +- ...docTypeTagOnExportAssignment7.symbols.diff | 2 +- ...checkJsdocTypeTagOnExportAssignment7.types | 11 +- ...eckJsdocTypeTagOnExportAssignment8.symbols | 2 +- ...docTypeTagOnExportAssignment8.symbols.diff | 2 +- ...checkJsdocTypeTagOnExportAssignment8.types | 7 + ...yTypedParametersOptionalInJSDoc.errors.txt | 29 +- ...tuallyTypedParametersOptionalInJSDoc.types | 44 +- ...lyInferenceFromAnnotatedFunctionJs.symbols | 16 +- ...erenceFromAnnotatedFunctionJs.symbols.diff | 18 +- ...OnlyInferenceFromAnnotatedFunctionJs.types | 31 +- ...enceWithAnnotatedOptionalParameterJs.types | 29 +- .../compiler/controlFlowInstanceof.types | 6 +- ...peNode4(strictnullchecks=false).errors.txt | 43 -- .../declarationEmitClassAccessorsJs1.types | 2 +- ...ionEmitClassSetAccessorParamNameInJs.types | 4 +- ...arationEmitObjectLiteralAccessorsJs1.types | 10 +- ...xpandoFunctionContextualTypesJs.errors.txt | 5 +- .../expandoFunctionContextualTypesJs.symbols | 2 + ...andoFunctionContextualTypesJs.symbols.diff | 7 +- .../expandoFunctionContextualTypesJs.types | 22 +- .../expandoFunctionSymbolPropertyJs.types | 2 +- .../compiler/exportDefaultWithJSDoc1.symbols | 2 +- .../exportDefaultWithJSDoc1.symbols.diff | 2 +- .../compiler/exportDefaultWithJSDoc1.types | 9 +- .../compiler/exportDefaultWithJSDoc2.symbols | 2 +- .../exportDefaultWithJSDoc2.symbols.diff | 17 + .../compiler/exportDefaultWithJSDoc2.types | 11 +- ...extendedUnicodePlaneIdentifiersJSDoc.types | 12 +- .../importTypeResolutionJSDocEOF.errors.txt | 15 + .../importTypeResolutionJSDocEOF.types | 2 +- ...DeclarationEmitDoesNotRenameImport.symbols | 4 + ...rationEmitDoesNotRenameImport.symbols.diff | 4 + ...jsDeclarationEmitDoesNotRenameImport.types | 11 +- ...gnedFunctionWithExtraTypedefsMembers.types | 4 + .../jsDeclarationsInheritedTypes.types | 14 +- ...oesNotUseNodeModulesPathWithoutError.types | 6 +- .../compiler/jsEnumCrossFileExport.errors.txt | 11 +- .../compiler/jsEnumCrossFileExport.symbols | 8 +- .../jsEnumCrossFileExport.symbols.diff | 8 +- .../compiler/jsEnumCrossFileExport.types | 18 +- .../compiler/jsEnumTagOnObjectFrozen.types | 8 +- ...rtMemberMergedWithModuleAugmentation.types | 2 +- ...eCompilationRestParamJsDocFunction.symbols | 12 + ...ilationRestParamJsDocFunction.symbols.diff | 12 + ...ileCompilationRestParamJsDocFunction.types | 36 +- .../jsFileCompilationSyntaxError.types | 2 +- .../jsFileFunctionOverloads.errors.txt | 67 +++ .../compiler/jsFileFunctionOverloads.symbols | 4 + .../jsFileFunctionOverloads.symbols.diff | 4 + .../compiler/jsFileFunctionOverloads.types | 51 +-- .../jsFileFunctionOverloads2.errors.txt | 62 +++ .../compiler/jsFileFunctionOverloads2.symbols | 4 + .../jsFileFunctionOverloads2.symbols.diff | 4 + .../compiler/jsFileFunctionOverloads2.types | 51 +-- .../jsFileImportPreservedWhenUsed.errors.txt | 35 ++ .../jsFileImportPreservedWhenUsed.types | 20 +- .../compiler/jsFileMethodOverloads.errors.txt | 16 +- .../compiler/jsFileMethodOverloads.types | 20 +- .../jsFileMethodOverloads2.errors.txt | 16 +- .../compiler/jsFileMethodOverloads2.types | 20 +- .../compiler/jsFileMethodOverloads3.types | 18 +- .../compiler/jsFileMethodOverloads5.types | 8 +- .../compiler/jsdocAccessEnumType.types | 2 +- ...ocArrayObjectPromiseImplicitAny.errors.txt | 69 +++ .../jsdocArrayObjectPromiseImplicitAny.types | 14 +- ...ArrayObjectPromiseNoImplicitAny.errors.txt | 69 +++ ...jsdocArrayObjectPromiseNoImplicitAny.types | 14 +- .../jsdocBracelessTypeTag1.errors.txt | 6 +- .../compiler/jsdocBracelessTypeTag1.types | 12 +- .../compiler/jsdocCallbackAndType.errors.txt | 15 + .../compiler/jsdocCallbackAndType.types | 6 +- .../jsdocClassMissingTypeArguments.errors.txt | 12 + .../jsdocClassMissingTypeArguments.types | 2 +- ...ocFunctionClassPropertiesDeclaration.types | 22 +- .../jsdocFunctionTypeFalsePositive.errors.txt | 9 + .../jsdocFunctionTypeFalsePositive.types | 4 +- .../compiler/jsdocIllegalTags.errors.txt | 9 +- .../jsdocImportTypeNodeNamespace.errors.txt | 16 + .../jsdocImportTypeNodeNamespace.types | 3 +- .../compiler/jsdocImportTypeResolution.types | 6 +- ...jsdocParamTagOnPropertyInitializer.symbols | 2 + ...ParamTagOnPropertyInitializer.symbols.diff | 2 + .../jsdocParamTagOnPropertyInitializer.types | 14 +- ...docParameterParsingInfiniteLoop.errors.txt | 12 + .../jsdocParameterParsingInfiniteLoop.types | 2 +- .../compiler/jsdocPropertyTagInvalid.symbols | 3 + .../jsdocPropertyTagInvalid.symbols.diff | 6 +- .../compiler/jsdocPropertyTagInvalid.types | 12 +- .../jsdocReferenceGlobalTypeInCommonJs.types | 2 +- ...sdocResolveNameFailureInTypedef.errors.txt | 15 + .../jsdocResolveNameFailureInTypedef.types | 4 +- .../compiler/jsdocRestParameter.types | 12 +- .../compiler/jsdocRestParameter_es6.types | 6 +- .../compiler/jsdocTypeCast.errors.txt | 26 ++ .../submodule/compiler/jsdocTypeCast.types | 33 +- ...jsdocTypeGenericInstantiationAttempt.types | 6 +- ...eNongenericInstantiationAttempt.errors.txt | 118 +++++ ...ocTypeNongenericInstantiationAttempt.types | 46 +- ...TypedefBeforeParenthesizedExpression.types | 8 +- .../compiler/jsdocTypedefMissingType.types | 6 +- .../compiler/jsdocTypedefNoCrash.types | 2 + .../compiler/jsdocTypedefNoCrash2.types | 2 + .../jsdocTypedef_propertyWithNoType.types | 6 +- .../misspelledJsDocTypedefTags.errors.txt | 5 +- .../compiler/misspelledJsDocTypedefTags.types | 8 + ...thesizedJSDocCastAtReturnStatement.symbols | 2 + ...zedJSDocCastAtReturnStatement.symbols.diff | 2 + ...enthesizedJSDocCastAtReturnStatement.types | 23 +- ...nthesizedJSDocCastDoesNotNarrow.errors.txt | 22 + .../parenthesizedJSDocCastDoesNotNarrow.types | 9 +- .../requireOfJsonFileInJsFile.symbols | 4 + .../requireOfJsonFileInJsFile.symbols.diff | 12 +- .../compiler/requireOfJsonFileInJsFile.types | 16 +- .../strictOptionalProperties3.errors.txt | 25 ++ .../compiler/strictOptionalProperties3.types | 11 +- .../strictOptionalProperties4.errors.txt | 20 - .../strictOptionalProperties4.symbols | 7 + .../strictOptionalProperties4.symbols.diff | 11 +- .../compiler/strictOptionalProperties4.types | 18 +- .../subclassThisTypeAssignable01.errors.txt | 7 +- .../subclassThisTypeAssignable01.types | 2 +- .../subclassThisTypeAssignable02.types | 2 +- .../compiler/topLevelBlockExpando.symbols | 6 + .../topLevelBlockExpando.symbols.diff | 17 +- .../compiler/topLevelBlockExpando.types | 12 +- .../compiler/unicodeEscapesInJSDoc.types | 24 +- ...TypeConstraintInJSDocImportCall.errors.txt | 19 + ...unmetTypeConstraintInJSDocImportCall.types | 3 + ...nusedTypeParameters_templateTag.errors.txt | 9 + .../unusedTypeParameters_templateTag.types | 2 +- ...usedTypeParameters_templateTag2.errors.txt | 57 ++- .../unusedTypeParameters_templateTag2.types | 6 +- ...dThisPropertyInitializerDoesntNarrow.types | 6 +- .../assertionTypePredicates2.errors.txt | 33 ++ .../assertionTypePredicates2.symbols | 5 +- .../assertionTypePredicates2.symbols.diff | 12 +- .../assertionTypePredicates2.types | 25 +- ...ertionsAndNonReturningFunctions.errors.txt | 69 +++ ...assertionsAndNonReturningFunctions.symbols | 4 + ...tionsAndNonReturningFunctions.symbols.diff | 8 +- .../assertionsAndNonReturningFunctions.types | 46 +- .../asyncArrowFunction_allowJs.errors.txt | 50 +++ .../asyncArrowFunction_allowJs.types | 14 +- .../asyncFunctionDeclaration16_es5.errors.txt | 67 +++ .../asyncFunctionDeclaration16_es5.types | 22 +- .../callbackCrossModule.errors.txt | 5 +- .../callbackOnConstructor.errors.txt | 20 + .../conformance/callbackOnConstructor.types | 2 +- .../conformance/callbackTag1.errors.txt | 27 ++ .../submodule/conformance/callbackTag1.types | 4 +- .../conformance/callbackTag2.errors.txt | 15 +- .../submodule/conformance/callbackTag2.types | 8 +- .../conformance/callbackTag3.errors.txt | 13 + .../submodule/conformance/callbackTag3.types | 2 +- .../conformance/callbackTag4.errors.txt | 5 +- .../submodule/conformance/callbackTag4.types | 2 +- .../callbackTagNestedParameter.errors.txt | 23 + .../callbackTagNestedParameter.types | 6 +- .../callbackTagVariadicType.errors.txt | 16 + .../conformance/callbackTagVariadicType.types | 8 +- .../checkJsdocOptionalParamOrder.errors.txt | 14 + .../checkJsdocOptionalParamOrder.types | 8 +- ...OnVariableDeclaredFunctionExpression.types | 16 +- .../checkJsdocParamTag1.errors.txt | 21 - .../conformance/checkJsdocParamTag1.types | 12 +- .../conformance/checkJsdocReturnTag1.types | 2 +- .../checkJsdocReturnTag2.errors.txt | 10 +- .../conformance/checkJsdocReturnTag2.types | 4 +- .../checkJsdocSatisfiesTag1.symbols | 2 + .../checkJsdocSatisfiesTag1.symbols.diff | 2 + .../conformance/checkJsdocSatisfiesTag1.types | 33 +- .../checkJsdocSatisfiesTag10.types | 1 + .../checkJsdocSatisfiesTag11.types | 8 + .../checkJsdocSatisfiesTag12.types | 12 + .../checkJsdocSatisfiesTag14.types | 4 + .../checkJsdocSatisfiesTag2.errors.txt | 16 + .../conformance/checkJsdocSatisfiesTag2.types | 2 + .../checkJsdocSatisfiesTag3.errors.txt | 5 +- .../conformance/checkJsdocSatisfiesTag3.types | 10 +- .../conformance/checkJsdocSatisfiesTag4.types | 8 + .../conformance/checkJsdocSatisfiesTag5.types | 3 + .../conformance/checkJsdocSatisfiesTag6.types | 6 + .../conformance/checkJsdocSatisfiesTag7.types | 1 + .../checkJsdocSatisfiesTag8.errors.txt | 17 + .../conformance/checkJsdocSatisfiesTag8.types | 1 + .../conformance/checkJsdocSatisfiesTag9.types | 8 + .../conformance/checkJsdocTypeTag1.errors.txt | 60 +++ .../conformance/checkJsdocTypeTag1.types | 30 +- .../conformance/checkJsdocTypeTag2.errors.txt | 50 +++ .../conformance/checkJsdocTypeTag2.types | 24 +- .../conformance/checkJsdocTypeTag3.types | 2 +- .../conformance/checkJsdocTypeTag4.errors.txt | 24 + .../conformance/checkJsdocTypeTag4.types | 7 +- .../conformance/checkJsdocTypeTag5.errors.txt | 64 +++ .../conformance/checkJsdocTypeTag5.symbols | 2 + .../checkJsdocTypeTag5.symbols.diff | 4 +- .../conformance/checkJsdocTypeTag5.types | 42 +- .../conformance/checkJsdocTypeTag6.errors.txt | 52 +++ .../conformance/checkJsdocTypeTag6.types | 6 +- .../conformance/checkJsdocTypeTag7.types | 4 + ...ckJsdocTypeTagOnObjectProperty1.errors.txt | 31 ++ .../checkJsdocTypeTagOnObjectProperty1.types | 42 +- ...ckJsdocTypeTagOnObjectProperty2.errors.txt | 36 ++ .../checkJsdocTypeTagOnObjectProperty2.types | 23 +- .../checkJsdocTypedefInParamTag1.errors.txt | 56 +++ .../checkJsdocTypedefInParamTag1.symbols | 32 ++ .../checkJsdocTypedefInParamTag1.symbols.diff | 69 ++- .../checkJsdocTypedefInParamTag1.types | 50 ++- ...checkJsdocTypedefOnlySourceFile.errors.txt | 5 +- .../checkJsdocTypedefOnlySourceFile.types | 4 +- ...checkSpecialPropertyAssignments.errors.txt | 7 +- .../checkSpecialPropertyAssignments.types | 10 +- ...assCanExtendConstructorFunction.errors.txt | 17 +- .../classCanExtendConstructorFunction.types | 48 +- .../conformance/commonJSAliasedExport.types | 4 +- ...ommonJSImportClassTypeReference.errors.txt | 5 +- .../commonJSImportClassTypeReference.types | 6 +- ...JSImportExportedClassExpression.errors.txt | 5 +- ...ommonJSImportExportedClassExpression.types | 6 +- ...SImportNestedClassTypeReference.errors.txt | 5 +- ...mmonJSImportNestedClassTypeReference.types | 6 +- ...torFunctionMethodTypeParameters.errors.txt | 43 ++ ...structorFunctionMethodTypeParameters.types | 24 +- .../conformance/constructorFunctions.types | 6 +- .../constructorFunctionsStrict.types | 30 +- .../conformance/contextualTypeFromJSDoc.types | 28 +- .../contextualTypedSpecialAssignment.types | 1 + .../submodule/conformance/enumTag.errors.txt | 18 +- .../submodule/conformance/enumTag.types | 38 +- .../conformance/enumTagImported.errors.txt | 31 ++ .../conformance/enumTagImported.types | 8 +- .../enumTagUseBeforeDefCrash.errors.txt | 16 + .../enumTagUseBeforeDefCrash.types | 2 +- .../errorOnFunctionReturnType.errors.txt | 56 +++ .../errorOnFunctionReturnType.types | 4 +- .../conformance/exportNestedNamespaces.types | 10 +- .../exportedEnumTypeAndValue.errors.txt | 19 + .../exportedEnumTypeAndValue.types | 2 +- .../submodule/conformance/extendsTag1.types | 2 +- .../conformance/extendsTag5.errors.txt | 60 +++ .../submodule/conformance/extendsTag5.types | 16 +- .../genericSetterInClassTypeJsDoc.types | 10 +- .../conformance/importTag1.errors.txt | 20 + .../submodule/conformance/importTag1.types | 4 +- .../importTag15(module=es2015).errors.txt | 15 + .../importTag15(module=es2015).types | 4 +- .../importTag15(module=esnext).errors.txt | 15 + .../importTag15(module=esnext).types | 4 +- .../conformance/importTag16.errors.txt | 21 + .../submodule/conformance/importTag16.types | 6 +- .../conformance/importTag17.errors.txt | 44 ++ .../submodule/conformance/importTag17.types | 4 +- .../conformance/importTag18.errors.txt | 20 + .../submodule/conformance/importTag18.types | 4 +- .../conformance/importTag19.errors.txt | 19 + .../submodule/conformance/importTag19.types | 4 +- .../conformance/importTag2.errors.txt | 20 + .../submodule/conformance/importTag2.types | 4 +- .../conformance/importTag20.errors.txt | 20 + .../submodule/conformance/importTag20.types | 4 +- .../conformance/importTag3.errors.txt | 20 + .../submodule/conformance/importTag3.types | 4 +- .../conformance/importTag4.errors.txt | 24 + .../submodule/conformance/importTag4.types | 4 +- .../conformance/importTag5.errors.txt | 20 + .../submodule/conformance/importTag5.types | 4 +- .../conformance/importTag6.errors.txt | 30 ++ .../submodule/conformance/importTag6.types | 6 +- .../conformance/importTag7.errors.txt | 29 ++ .../submodule/conformance/importTag7.types | 6 +- .../conformance/importTag8.errors.txt | 29 ++ .../submodule/conformance/importTag8.types | 6 +- .../conformance/importTag9.errors.txt | 29 ++ .../submodule/conformance/importTag9.types | 6 +- .../conformance/importTypeInJSDoc.symbols | 3 + .../importTypeInJSDoc.symbols.diff | 18 +- .../conformance/importTypeInJSDoc.types | 39 +- .../importingExportingTypes.errors.txt | 9 +- .../importingExportingTypes.symbols | 3 +- .../importingExportingTypes.symbols.diff | 3 +- .../conformance/importingExportingTypes.types | 2 + .../conformance/inferThis.errors.txt | 40 ++ .../submodule/conformance/inferThis.types | 24 +- ...ypeParameterOnVariableStatement.errors.txt | 25 ++ ...eTagTypeParameterOnVariableStatement.types | 20 +- ...ClassImplementsGenericsSerialization.types | 6 +- .../jsDeclarationsClassMethod.types | 12 +- .../jsDeclarationsClasses.errors.txt | 13 +- .../conformance/jsDeclarationsClasses.symbols | 1 - .../jsDeclarationsClasses.symbols.diff | 8 +- .../conformance/jsDeclarationsClasses.types | 85 ++-- .../jsDeclarationsComputedNames.types | 2 +- .../conformance/jsDeclarationsDefault.symbols | 2 + .../jsDeclarationsDefault.symbols.diff | 6 +- .../conformance/jsDeclarationsDefault.types | 10 +- .../jsDeclarationsEnumTag.errors.txt | 63 +++ .../conformance/jsDeclarationsEnumTag.types | 34 +- ...rationsExportAssignedClassExpression.types | 8 +- ...portAssignedClassExpressionAnonymous.types | 8 +- ...ignedClassExpressionAnonymousWithSub.types | 8 +- ...rationsExportDefinePropertyEmit.errors.txt | 8 +- ...clarationsExportDefinePropertyEmit.symbols | 8 + ...tionsExportDefinePropertyEmit.symbols.diff | 24 +- ...DeclarationsExportDefinePropertyEmit.types | 82 ++-- ...ctionClassesCjsExportAssignment.errors.txt | 13 +- ...FunctionClassesCjsExportAssignment.symbols | 24 +- ...ionClassesCjsExportAssignment.symbols.diff | 41 +- ...nsFunctionClassesCjsExportAssignment.types | 79 ++-- .../jsDeclarationsFunctionJSDoc.types | 14 +- ...DeclarationsFunctionLikeClasses.errors.txt | 5 +- .../jsDeclarationsFunctionLikeClasses.types | 32 +- ...eclarationsFunctionLikeClasses2.errors.txt | 5 +- .../jsDeclarationsFunctionLikeClasses2.types | 86 ++-- .../jsDeclarationsFunctions.symbols | 8 + .../jsDeclarationsFunctions.symbols.diff | 26 -- .../conformance/jsDeclarationsFunctions.types | 84 ++-- .../jsDeclarationsFunctionsCjs.errors.txt | 8 +- .../jsDeclarationsFunctionsCjs.symbols | 8 + .../jsDeclarationsFunctionsCjs.symbols.diff | 22 +- .../jsDeclarationsFunctionsCjs.types | 42 +- .../jsDeclarationsGetterSetter.types | 108 ++--- ...portAliasExposedWithinNamespace.errors.txt | 76 ++++ ...sImportAliasExposedWithinNamespace.symbols | 9 +- ...rtAliasExposedWithinNamespace.symbols.diff | 11 +- ...onsImportAliasExposedWithinNamespace.types | 30 +- ...tAliasExposedWithinNamespaceCjs.errors.txt | 11 +- ...portAliasExposedWithinNamespaceCjs.symbols | 3 +- ...liasExposedWithinNamespaceCjs.symbols.diff | 5 +- ...ImportAliasExposedWithinNamespaceCjs.types | 18 +- ...eclarationsImportNamespacedType.errors.txt | 14 + .../jsDeclarationsImportNamespacedType.types | 2 + .../jsDeclarationsImportTypeBundled.types | 9 +- ...larationsJSDocRedirectedLookups.errors.txt | 60 +++ ...jsDeclarationsJSDocRedirectedLookups.types | 34 +- .../jsDeclarationsMissingGenerics.errors.txt | 17 + ...clarationsMissingTypeParameters.errors.txt | 38 ++ .../jsDeclarationsMissingTypeParameters.types | 2 +- ...larationsModuleReferenceHasEmit.errors.txt | 19 + ...jsDeclarationsModuleReferenceHasEmit.types | 2 +- .../jsDeclarationsNestedParams.errors.txt | 33 ++ .../jsDeclarationsNestedParams.types | 4 +- ...eclarationsOptionalTypeLiteralProps1.types | 2 +- ...eclarationsOptionalTypeLiteralProps2.types | 2 +- ...ameterTagReusesInputNodeInEmit1.errors.txt | 5 +- ...nsParameterTagReusesInputNodeInEmit1.types | 2 + ...ameterTagReusesInputNodeInEmit2.errors.txt | 5 +- ...nsParameterTagReusesInputNodeInEmit2.types | 1 + .../jsDeclarationsReactComponents.errors.txt | 5 +- .../jsDeclarationsReactComponents.symbols | 2 + ...jsDeclarationsReactComponents.symbols.diff | 7 +- .../jsDeclarationsReactComponents.types | 16 +- ...sExistingNodesMappingJSDocTypes.errors.txt | 41 ++ ...ReusesExistingNodesMappingJSDocTypes.types | 10 +- ...nsReusesExistingTypeAnnotations.errors.txt | 111 +++++ ...rationsReusesExistingTypeAnnotations.types | 112 ++--- ...assWithExplicitNoArgumentConstructor.types | 4 +- .../jsDeclarationsTypeAliases.symbols | 1 + .../jsDeclarationsTypeAliases.symbols.diff | 3 +- .../jsDeclarationsTypeAliases.types | 15 +- ...tionsTypeReassignmentFromDeclaration.types | 6 +- ...clarationsTypedefAndImportTypes.errors.txt | 5 +- .../jsDeclarationsTypedefAndImportTypes.types | 4 + ...DeclarationsTypedefAndLatebound.errors.txt | 5 +- .../jsDeclarationsTypedefAndLatebound.types | 16 +- .../jsDeclarationsTypedefFunction.types | 24 +- ...edefPropertyAndExportAssignment.errors.txt | 5 +- ...TypedefPropertyAndExportAssignment.symbols | 8 +- ...efPropertyAndExportAssignment.symbols.diff | 8 +- ...nsTypedefPropertyAndExportAssignment.types | 14 +- ...jsDeclarationsUniqueSymbolUsage.errors.txt | 23 + .../jsdocBindingInUnreachableCode.types | 6 +- ...jsdocCatchClauseWithTypeAnnotation.symbols | 4 + ...CatchClauseWithTypeAnnotation.symbols.diff | 17 +- .../jsdocCatchClauseWithTypeAnnotation.types | 8 +- ...onstructorFunctionTypeReference.errors.txt | 20 + ...sdocConstructorFunctionTypeReference.types | 8 +- .../conformance/jsdocFunctionType.errors.txt | 17 +- .../conformance/jsdocFunctionType.types | 76 ++-- .../conformance/jsdocImplements_class.types | 2 +- .../conformance/jsdocImportType.errors.txt | 33 ++ .../conformance/jsdocImportType.types | 6 +- .../conformance/jsdocImportType2.errors.txt | 32 ++ .../conformance/jsdocImportType2.types | 6 +- ...ImportTypeReferenceToClassAlias.errors.txt | 5 +- ...docImportTypeReferenceToClassAlias.symbols | 2 + ...portTypeReferenceToClassAlias.symbols.diff | 7 +- ...jsdocImportTypeReferenceToClassAlias.types | 2 + ...rtTypeReferenceToCommonjsModule.errors.txt | 17 + ...ocImportTypeReferenceToESModule.errors.txt | 14 + ...ortTypeReferenceToStringLiteral.errors.txt | 12 + .../jsdocIndexSignature.errors.txt | 39 ++ .../submodule/conformance/jsdocLiteral.types | 30 +- .../conformance/jsdocNeverUndefinedNull.types | 8 +- .../jsdocOuterTypeParameters1.errors.txt | 5 +- .../jsdocOuterTypeParameters1.types | 10 +- .../jsdocOuterTypeParameters2.errors.txt | 5 +- .../jsdocOuterTypeParameters2.types | 10 +- .../conformance/jsdocOverrideTag1.types | 16 +- .../conformance/jsdocParamTag2.types | 24 +- .../jsdocParamTagTypeLiteral.types | 8 +- .../jsdocParseBackquotedParamName.errors.txt | 20 + .../jsdocParseBackquotedParamName.types | 6 +- ...ocParseDotDotDotInJSDocFunction.errors.txt | 6 +- .../jsdocParseDotDotDotInJSDocFunction.types | 2 +- .../jsdocParseHigherOrderFunction.errors.txt | 6 +- .../jsdocParseHigherOrderFunction.types | 2 +- .../jsdocParseMatchingBackticks.types | 36 +- ...arseParenthesizedJSDocParameter.errors.txt | 6 +- ...sdocParseParenthesizedJSDocParameter.types | 2 +- .../jsdocParseStarEquals.errors.txt | 8 +- .../conformance/jsdocParseStarEquals.types | 4 +- ...docPostfixEqualsAddsOptionality.errors.txt | 12 +- .../jsdocPostfixEqualsAddsOptionality.types | 18 +- .../jsdocPrefixPostfixParsing.types | 14 +- .../conformance/jsdocPrivateName1.errors.txt | 11 + .../conformance/jsdocPrivateName1.types | 2 +- .../conformance/jsdocReturnTag1.errors.txt | 8 +- .../conformance/jsdocReturnTag1.types | 6 +- ...sdocSignatureOnReturnedFunction.errors.txt | 51 --- .../jsdocSignatureOnReturnedFunction.types | 58 +-- .../conformance/jsdocTemplateClass.errors.txt | 12 +- .../conformance/jsdocTemplateClass.symbols | 8 +- .../jsdocTemplateClass.symbols.diff | 8 +- .../conformance/jsdocTemplateClass.types | 44 +- .../jsdocTemplateConstructorFunction.symbols | 5 +- ...ocTemplateConstructorFunction.symbols.diff | 7 +- .../jsdocTemplateConstructorFunction.types | 15 +- .../jsdocTemplateConstructorFunction2.types | 20 +- .../conformance/jsdocTemplateTag.errors.txt | 6 +- .../conformance/jsdocTemplateTag.types | 28 +- .../conformance/jsdocTemplateTag2.errors.txt | 20 + .../conformance/jsdocTemplateTag2.types | 12 +- .../conformance/jsdocTemplateTag3.errors.txt | 37 ++ .../conformance/jsdocTemplateTag3.symbols | 14 + .../jsdocTemplateTag3.symbols.diff | 28 +- .../conformance/jsdocTemplateTag3.types | 74 ++-- .../conformance/jsdocTemplateTag4.types | 10 +- .../conformance/jsdocTemplateTag5.errors.txt | 24 +- .../conformance/jsdocTemplateTag5.types | 48 +- .../conformance/jsdocTemplateTag6.symbols | 3 + .../jsdocTemplateTag6.symbols.diff | 20 +- .../conformance/jsdocTemplateTag6.types | 254 +++++------ .../conformance/jsdocTemplateTag7.errors.txt | 28 ++ .../conformance/jsdocTemplateTag7.symbols | 2 +- .../jsdocTemplateTag7.symbols.diff | 2 +- .../conformance/jsdocTemplateTag7.types | 10 +- .../conformance/jsdocTemplateTag8.errors.txt | 34 +- .../conformance/jsdocTemplateTag8.types | 66 +-- .../jsdocTemplateTagDefault.errors.txt | 84 ++++ .../jsdocTemplateTagDefault.symbols | 21 +- .../jsdocTemplateTagDefault.symbols.diff | 21 +- .../conformance/jsdocTemplateTagDefault.types | 46 +- .../jsdocTemplateTagNameResolution.errors.txt | 22 + .../jsdocTemplateTagNameResolution.symbols | 2 + ...sdocTemplateTagNameResolution.symbols.diff | 5 +- .../jsdocTemplateTagNameResolution.types | 4 +- .../conformance/jsdocThisType.errors.txt | 50 +++ .../conformance/jsdocThisType.symbols | 2 + .../conformance/jsdocThisType.symbols.diff | 20 +- .../submodule/conformance/jsdocThisType.types | 8 +- .../jsdocTypeDefAtStartOfFile.errors.txt | 17 + .../jsdocTypeDefAtStartOfFile.types | 4 +- .../jsdocTypeReferenceExports.errors.txt | 5 +- .../jsdocTypeReferenceExports.types | 2 +- .../jsdocTypeReferenceToImport.errors.txt | 8 +- .../jsdocTypeReferenceToImport.types | 12 +- ...peReferenceToImportOfClassExpression.types | 1 + ...eferenceToImportOfFunctionExpression.types | 5 +- ...jsdocTypeReferenceToMergedClass.errors.txt | 5 +- .../jsdocTypeReferenceToMergedClass.types | 4 +- .../jsdocTypeReferenceToValue.errors.txt | 11 + .../jsdocTypeReferenceToValue.types | 6 +- .../jsdocTypeReferenceUseBeforeDef.types | 2 +- .../conformance/jsdocTypeTag.errors.txt | 131 ++++++ .../submodule/conformance/jsdocTypeTag.types | 76 ++-- .../conformance/jsdocTypeTagCast.errors.txt | 27 +- .../conformance/jsdocTypeTagCast.symbols | 13 + .../conformance/jsdocTypeTagCast.symbols.diff | 76 ++++ .../conformance/jsdocTypeTagCast.types | 82 ++-- .../jsdocTypeTagParameterType.errors.txt | 6 +- .../jsdocTypeTagParameterType.types | 2 +- .../jsdocTypeTagRequiredParameters.errors.txt | 6 +- .../jsdocTypeTagRequiredParameters.types | 6 +- ...ariableDeclarationWithTypeAnnotation.types | 4 +- .../conformance/jsdocVariadicType.errors.txt | 15 + .../conformance/jsdocVariadicType.types | 6 +- .../conformance/linkTagEmit1.symbols | 9 + .../conformance/linkTagEmit1.symbols.diff | 25 ++ .../submodule/conformance/linkTagEmit1.types | 17 +- .../submodule/conformance/malformedTags.types | 2 +- .../conformance/moduleExportAssignment6.types | 18 +- .../moduleExportAssignment7.errors.txt | 46 +- .../moduleExportAssignment7.symbols | 1 + .../moduleExportAssignment7.symbols.diff | 3 +- .../conformance/moduleExportAssignment7.types | 18 +- .../moduleExportNestedNamespaces.types | 10 +- .../noAssertForUnparseableTypedefs.errors.txt | 5 +- .../noAssertForUnparseableTypedefs.types | 2 + .../optionalBindingParameters3.symbols | 4 + .../optionalBindingParameters3.symbols.diff | 14 + .../optionalBindingParameters3.types | 4 + .../conformance/overloadTag1.errors.txt | 50 +++ .../submodule/conformance/overloadTag1.types | 20 +- .../submodule/conformance/overloadTag2.types | 6 +- .../submodule/conformance/overloadTag3.types | 14 +- ...TagBracketsAddOptionalUndefined.errors.txt | 23 - ...paramTagBracketsAddOptionalUndefined.types | 20 +- .../paramTagTypeResolution2.errors.txt | 16 + .../conformance/paramTagTypeResolution2.types | 16 +- .../conformance/paramTagWrapping.types | 10 +- ...esOfGenericConstructorFunctions.errors.txt | 58 +++ ...pertiesOfGenericConstructorFunctions.types | 56 +-- ...ropertyAssignmentUseParentType2.errors.txt | 38 ++ .../propertyAssignmentUseParentType2.symbols | 6 + ...pertyAssignmentUseParentType2.symbols.diff | 12 +- .../propertyAssignmentUseParentType2.types | 30 +- ...ertyAssignmentMergeAcrossFiles2.errors.txt | 8 +- ...ePropertyAssignmentMergeAcrossFiles2.types | 8 +- ...tyAssignmentMergedTypeReference.errors.txt | 21 + ...ropertyAssignmentMergedTypeReference.types | 2 +- .../recursiveTypeReferences2.errors.txt | 64 +++ .../recursiveTypeReferences2.symbols | 14 +- .../recursiveTypeReferences2.symbols.diff | 14 +- .../recursiveTypeReferences2.types | 9 +- .../conformance/returnTagTypeGuard.errors.txt | 8 +- .../conformance/returnTagTypeGuard.symbols | 2 + .../returnTagTypeGuard.symbols.diff | 8 +- .../conformance/returnTagTypeGuard.types | 34 +- .../submodule/conformance/seeTag4.types | 2 + .../submodule/conformance/syntaxErrors.types | 6 +- .../templateInsideCallback.errors.txt | 8 +- .../templateInsideCallback.symbols | 8 + .../templateInsideCallback.symbols.diff | 18 +- .../conformance/templateInsideCallback.types | 53 ++- .../thisPropertyAssignmentInherited.types | 24 +- .../submodule/conformance/thisTag1.symbols | 2 + .../conformance/thisTag1.symbols.diff | 2 + .../submodule/conformance/thisTag1.types | 24 +- .../submodule/conformance/thisTag3.types | 12 +- .../thisTypeOfConstructorFunctions.errors.txt | 61 +++ .../thisTypeOfConstructorFunctions.types | 30 +- .../typeFromContextualThisType.errors.txt | 24 - .../typeFromContextualThisType.symbols | 12 + .../typeFromContextualThisType.symbols.diff | 24 +- .../typeFromContextualThisType.types | 48 +- .../typeFromJSInitializer.errors.txt | 6 +- .../conformance/typeFromJSInitializer.types | 28 +- .../typeFromJSInitializer4.errors.txt | 5 +- .../conformance/typeFromJSInitializer4.types | 14 +- .../typeFromParamTagForFunction.errors.txt | 42 +- .../typeFromParamTagForFunction.types | 48 +- .../typeFromPrivatePropertyAssignmentJs.types | 18 +- .../typeFromPropertyAssignment.errors.txt | 8 +- .../typeFromPropertyAssignment.types | 8 +- .../typeFromPropertyAssignment10.errors.txt | 5 +- .../typeFromPropertyAssignment10.types | 4 +- .../typeFromPropertyAssignment10_1.errors.txt | 5 +- .../typeFromPropertyAssignment10_1.types | 4 +- .../typeFromPropertyAssignment14.errors.txt | 5 +- .../typeFromPropertyAssignment14.types | 6 +- .../typeFromPropertyAssignment15.errors.txt | 5 +- .../typeFromPropertyAssignment15.types | 6 +- .../typeFromPropertyAssignment16.errors.txt | 5 +- .../typeFromPropertyAssignment16.types | 6 +- .../typeFromPropertyAssignment2.errors.txt | 8 +- .../typeFromPropertyAssignment2.types | 8 +- .../typeFromPropertyAssignment24.errors.txt | 5 +- .../typeFromPropertyAssignment24.types | 4 +- .../typeFromPropertyAssignment3.errors.txt | 8 +- .../typeFromPropertyAssignment3.types | 8 +- .../typeFromPropertyAssignment35.errors.txt | 5 +- .../typeFromPropertyAssignment35.types | 6 +- .../typeFromPropertyAssignment4.errors.txt | 10 +- .../typeFromPropertyAssignment4.types | 8 +- .../typeFromPropertyAssignment40.errors.txt | 14 + .../typeFromPropertyAssignment40.types | 4 +- .../typeFromPropertyAssignment5.errors.txt | 18 + .../typeFromPropertyAssignment5.types | 2 +- .../typeFromPropertyAssignment6.errors.txt | 5 +- .../typeFromPropertyAssignment6.types | 4 +- ...romPropertyAssignmentOutOfOrder.errors.txt | 5 +- ...typeFromPropertyAssignmentOutOfOrder.types | 2 +- .../typeFromPrototypeAssignment3.errors.txt | 9 +- .../typeFromPrototypeAssignment3.types | 26 +- .../typeFromPrototypeAssignment4.types | 30 +- .../conformance/typeLookupInIIFE.errors.txt | 11 + .../conformance/typeLookupInIIFE.types | 2 +- .../conformance/typeTagNoErasure.errors.txt | 14 + .../conformance/typeTagNoErasure.types | 18 +- ...typeTagOnFunctionReferencesGeneric.symbols | 1 + ...agOnFunctionReferencesGeneric.symbols.diff | 1 + .../typeTagOnFunctionReferencesGeneric.types | 15 +- .../typeTagOnPropertyAssignment.types | 24 +- .../conformance/typedefCrossModule.symbols | 15 +- .../typedefCrossModule.symbols.diff | 15 +- .../conformance/typedefCrossModule.types | 44 +- .../typedefCrossModule2.errors.txt | 8 +- .../conformance/typedefCrossModule2.types | 2 +- .../conformance/typedefCrossModule3.types | 2 + .../conformance/typedefCrossModule4.types | 2 + .../conformance/typedefCrossModule5.types | 2 + .../conformance/typedefInnerNamepaths.symbols | 2 +- .../typedefInnerNamepaths.symbols.diff | 2 +- .../conformance/typedefInnerNamepaths.types | 4 + .../typedefMultipleTypeParameters.errors.txt | 24 +- .../typedefMultipleTypeParameters.symbols | 7 + ...typedefMultipleTypeParameters.symbols.diff | 15 +- .../typedefMultipleTypeParameters.types | 11 +- .../typedefOnSemicolonClassElement.types | 2 + .../typedefOnStatements.errors.txt | 8 +- .../conformance/typedefOnStatements.symbols | 34 ++ .../typedefOnStatements.symbols.diff | 57 +-- .../conformance/typedefOnStatements.types | 191 +++++--- .../conformance/typedefScope1.errors.txt | 21 + .../submodule/conformance/typedefScope1.types | 6 +- .../typedefTagExtraneousProperty.errors.txt | 19 + .../typedefTagExtraneousProperty.types | 10 +- .../conformance/typedefTagNested.symbols | 6 + .../conformance/typedefTagNested.symbols.diff | 6 + .../conformance/typedefTagNested.types | 48 +- .../typedefTagTypeResolution.errors.txt | 37 ++ .../typedefTagTypeResolution.symbols | 1 + .../typedefTagTypeResolution.symbols.diff | 1 + .../typedefTagTypeResolution.types | 16 +- .../conformance/typedefTagWrapping.errors.txt | 151 +++++++ .../conformance/typedefTagWrapping.symbols | 39 +- .../typedefTagWrapping.symbols.diff | 90 +--- .../conformance/typedefTagWrapping.types | 112 ++--- .../uniqueSymbolsDeclarationsInJs.errors.txt | 37 ++ .../uniqueSymbolsDeclarationsInJs.types | 2 +- ...ueSymbolsDeclarationsInJsErrors.errors.txt | 28 ++ .../uniqueSymbolsDeclarationsInJsErrors.types | 6 +- .../varRequireFromJavascript.errors.txt | 5 +- .../varRequireFromJavascript.types | 6 +- .../varRequireFromTypescript.errors.txt | 8 +- .../varRequireFromTypescript.types | 10 +- .../amdLikeInputDeclarationEmit.types.diff | 31 +- ...argumentsObjectCreatesRestForJs.types.diff | 7 +- ...mentsReferenceInConstructor1_Js.types.diff | 24 - ...mentsReferenceInConstructor2_Js.types.diff | 24 - ...mentsReferenceInConstructor3_Js.types.diff | 23 +- ...mentsReferenceInConstructor4_Js.types.diff | 77 ---- ...mentsReferenceInConstructor5_Js.types.diff | 24 - .../argumentsReferenceInMethod1_Js.types.diff | 19 +- .../argumentsReferenceInMethod2_Js.types.diff | 19 +- .../argumentsReferenceInMethod3_Js.types.diff | 19 +- .../argumentsReferenceInMethod4_Js.types.diff | 72 +-- .../argumentsReferenceInMethod5_Js.types.diff | 19 +- ...rowFunctionJSDocAnnotation.errors.txt.diff | 29 -- .../arrowFunctionJSDocAnnotation.types.diff | 15 - ...jectLiteralHasCheckedKeyof.errors.txt.diff | 23 - ...kJsObjectLiteralHasCheckedKeyof.types.diff | 16 - ...eckJsTypeDefNoUnusedLocalMarked.types.diff | 14 +- ...TypeTagOnExportAssignment1.errors.txt.diff | 35 +- ...JsdocTypeTagOnExportAssignment1.types.diff | 25 +- ...TypeTagOnExportAssignment2.errors.txt.diff | 35 +- ...JsdocTypeTagOnExportAssignment2.types.diff | 13 +- ...TypeTagOnExportAssignment3.errors.txt.diff | 31 +- ...JsdocTypeTagOnExportAssignment3.types.diff | 26 +- ...TypeTagOnExportAssignment4.errors.txt.diff | 29 +- ...JsdocTypeTagOnExportAssignment4.types.diff | 19 + ...JsdocTypeTagOnExportAssignment5.types.diff | 26 +- ...JsdocTypeTagOnExportAssignment6.types.diff | 26 +- ...JsdocTypeTagOnExportAssignment7.types.diff | 26 +- ...JsdocTypeTagOnExportAssignment8.types.diff | 15 +- ...dParametersOptionalInJSDoc.errors.txt.diff | 55 --- ...yTypedParametersOptionalInJSDoc.types.diff | 73 +--- ...nceFromAnnotatedFunctionJs.errors.txt.diff | 38 -- ...nferenceFromAnnotatedFunctionJs.types.diff | 52 +-- ...notatedOptionalParameterJs.errors.txt.diff | 44 -- ...ithAnnotatedOptionalParameterJs.types.diff | 50 +-- .../compiler/controlFlowInstanceof.types.diff | 12 +- ...e4(strictnullchecks=false).errors.txt.diff | 48 -- ...de4(strictnullchecks=true).errors.txt.diff | 54 --- ...eclarationEmitClassAccessorsJs1.types.diff | 11 - ...itClassSetAccessorParamNameInJs.types.diff | 12 - ...tObjectLiteralAccessorsJs1.errors.txt.diff | 64 --- ...onEmitObjectLiteralAccessorsJs1.types.diff | 30 -- ...oFunctionContextualTypesJs.errors.txt.diff | 5 +- ...xpandoFunctionContextualTypesJs.types.diff | 35 +- ...expandoFunctionSymbolPropertyJs.types.diff | 2 +- .../exportDefaultWithJSDoc1.types.diff | 14 +- .../exportDefaultWithJSDoc2.types.diff | 16 +- ...dedUnicodePlaneIdentifiersJSDoc.types.diff | 25 -- ...portTypeResolutionJSDocEOF.errors.txt.diff | 20 + .../importTypeResolutionJSDocEOF.types.diff | 2 +- ...larationEmitDoesNotRenameImport.types.diff | 31 +- ...unctionWithExtraTypedefsMembers.types.diff | 13 +- .../jsDeclarationsInheritedTypes.types.diff | 43 +- ...odeModulesPathWithoutError.errors.txt.diff | 53 --- ...tUseNodeModulesPathWithoutError.types.diff | 15 +- .../jsEnumCrossFileExport.errors.txt.diff | 11 +- .../compiler/jsEnumCrossFileExport.types.diff | 40 +- .../jsEnumTagOnObjectFrozen.types.diff | 14 +- ...berMergedWithModuleAugmentation.types.diff | 9 +- ...mpilationRestParamJsDocFunction.types.diff | 53 +-- .../jsFileCompilationSyntaxError.types.diff | 9 - .../jsFileFunctionOverloads.errors.txt.diff | 72 +++ .../jsFileFunctionOverloads.types.diff | 90 +--- .../jsFileFunctionOverloads2.errors.txt.diff | 67 +++ .../jsFileFunctionOverloads2.types.diff | 90 +--- ...ileImportPreservedWhenUsed.errors.txt.diff | 12 +- .../jsFileImportPreservedWhenUsed.types.diff | 39 +- .../jsFileMethodOverloads.errors.txt.diff | 16 +- .../compiler/jsFileMethodOverloads.types.diff | 45 +- .../jsFileMethodOverloads2.errors.txt.diff | 16 +- .../jsFileMethodOverloads2.types.diff | 45 +- .../jsFileMethodOverloads3.types.diff | 24 +- .../jsFileMethodOverloads5.types.diff | 10 +- .../compiler/jsdocAccessEnumType.types.diff | 11 - ...ayObjectPromiseImplicitAny.errors.txt.diff | 74 ++++ ...ocArrayObjectPromiseImplicitAny.types.diff | 22 +- ...ObjectPromiseNoImplicitAny.errors.txt.diff | 100 ++--- ...ArrayObjectPromiseNoImplicitAny.types.diff | 27 +- .../jsdocBracelessTypeTag1.errors.txt.diff | 14 +- .../jsdocBracelessTypeTag1.types.diff | 22 - .../jsdocCallbackAndType.errors.txt.diff | 30 +- .../compiler/jsdocCallbackAndType.types.diff | 20 - ...cClassMissingTypeArguments.errors.txt.diff | 17 - .../jsdocClassMissingTypeArguments.types.diff | 7 +- ...ctionClassPropertiesDeclaration.types.diff | 33 +- ...cFunctionTypeFalsePositive.errors.txt.diff | 21 +- .../jsdocFunctionTypeFalsePositive.types.diff | 11 - .../compiler/jsdocIllegalTags.errors.txt.diff | 14 +- ...docImportTypeNodeNamespace.errors.txt.diff | 29 +- .../jsdocImportTypeNodeNamespace.types.diff | 3 +- .../jsdocImportTypeResolution.types.diff | 13 +- ...amTagOnPropertyInitializer.errors.txt.diff | 16 - ...ocParamTagOnPropertyInitializer.types.diff | 22 - ...rameterParsingInfiniteLoop.errors.txt.diff | 23 +- ...docParameterParsingInfiniteLoop.types.diff | 2 +- .../jsdocPropertyTagInvalid.types.diff | 29 +- ...ocReferenceGlobalTypeInCommonJs.types.diff | 2 +- ...esolveNameFailureInTypedef.errors.txt.diff | 31 +- ...sdocResolveNameFailureInTypedef.types.diff | 8 +- .../compiler/jsdocRestParameter.types.diff | 12 +- .../jsdocRestParameter_es6.errors.txt.diff | 16 - .../jsdocRestParameter_es6.types.diff | 16 - .../compiler/jsdocTypeCast.errors.txt.diff | 31 -- .../compiler/jsdocTypeCast.types.diff | 57 +-- ...TypeGenericInstantiationAttempt.types.diff | 9 +- ...enericInstantiationAttempt.errors.txt.diff | 201 +++++---- ...eNongenericInstantiationAttempt.types.diff | 59 +-- ...efBeforeParenthesizedExpression.types.diff | 25 +- .../jsdocTypedefMissingType.types.diff | 17 +- .../compiler/jsdocTypedefNoCrash.types.diff | 11 + .../compiler/jsdocTypedefNoCrash2.types.diff | 11 + ...jsdocTypedef_propertyWithNoType.types.diff | 17 +- ...misspelledJsDocTypedefTags.errors.txt.diff | 5 +- .../misspelledJsDocTypedefTags.types.diff | 11 +- ...JSDocCastAtReturnStatement.errors.txt.diff | 24 - ...sizedJSDocCastAtReturnStatement.types.diff | 44 +- ...izedJSDocCastDoesNotNarrow.errors.txt.diff | 36 +- ...nthesizedJSDocCastDoesNotNarrow.types.diff | 29 +- .../requireOfJsonFileInJsFile.types.diff | 27 +- .../strictOptionalProperties3.errors.txt.diff | 50 +-- .../strictOptionalProperties3.types.diff | 28 +- .../strictOptionalProperties4.errors.txt.diff | 25 -- .../strictOptionalProperties4.types.diff | 34 +- ...bclassThisTypeAssignable01.errors.txt.diff | 20 - .../subclassThisTypeAssignable01.types.diff | 9 - .../subclassThisTypeAssignable02.types.diff | 9 - .../compiler/topLevelBlockExpando.types.diff | 31 +- .../compiler/unicodeEscapesInJSDoc.types.diff | 51 --- ...onstraintInJSDocImportCall.errors.txt.diff | 37 +- ...TypeConstraintInJSDocImportCall.types.diff | 12 + ...TypeParameters_templateTag.errors.txt.diff | 19 +- ...nusedTypeParameters_templateTag.types.diff | 9 - ...ypeParameters_templateTag2.errors.txt.diff | 60 ++- ...usedTypeParameters_templateTag2.types.diff | 25 +- ...PropertyInitializerDoesntNarrow.types.diff | 19 +- .../assertionTypePredicates2.errors.txt.diff | 38 ++ .../assertionTypePredicates2.types.diff | 44 +- ...nsAndNonReturningFunctions.errors.txt.diff | 74 ---- ...ertionsAndNonReturningFunctions.types.diff | 110 +---- ...asyncArrowFunction_allowJs.errors.txt.diff | 83 ++-- .../asyncArrowFunction_allowJs.types.diff | 15 +- ...cFunctionDeclaration16_es5.errors.txt.diff | 106 ++--- .../asyncFunctionDeclaration16_es5.types.diff | 41 +- .../callbackCrossModule.errors.txt.diff | 5 +- .../callbackOnConstructor.errors.txt.diff | 25 ++ .../callbackOnConstructor.types.diff | 2 +- .../conformance/callbackTag1.errors.txt.diff | 32 ++ .../conformance/callbackTag1.types.diff | 9 +- .../conformance/callbackTag2.errors.txt.diff | 34 +- .../conformance/callbackTag2.types.diff | 20 +- .../conformance/callbackTag3.errors.txt.diff | 18 + .../conformance/callbackTag3.types.diff | 11 - .../conformance/callbackTag4.errors.txt.diff | 5 +- .../conformance/callbackTag4.types.diff | 6 +- ...callbackTagNestedParameter.errors.txt.diff | 28 ++ .../callbackTagNestedParameter.types.diff | 14 +- .../callbackTagVariadicType.errors.txt.diff | 6 +- .../callbackTagVariadicType.types.diff | 18 +- ...eckJsdocOptionalParamOrder.errors.txt.diff | 19 - .../checkJsdocOptionalParamOrder.types.diff | 12 +- ...iableDeclaredFunctionExpression.types.diff | 25 +- .../checkJsdocParamTag1.errors.txt.diff | 26 -- .../checkJsdocParamTag1.types.diff | 14 +- .../checkJsdocReturnTag1.types.diff | 9 - .../checkJsdocReturnTag2.errors.txt.diff | 32 -- .../checkJsdocReturnTag2.types.diff | 17 +- .../checkJsdocSatisfiesTag1.types.diff | 59 ++- .../checkJsdocSatisfiesTag10.types.diff | 10 + .../checkJsdocSatisfiesTag11.types.diff | 23 + .../checkJsdocSatisfiesTag12.types.diff | 32 +- .../checkJsdocSatisfiesTag14.types.diff | 14 + .../checkJsdocSatisfiesTag2.errors.txt.diff | 21 + .../checkJsdocSatisfiesTag2.types.diff | 6 +- .../checkJsdocSatisfiesTag3.errors.txt.diff | 9 +- .../checkJsdocSatisfiesTag3.types.diff | 12 +- .../checkJsdocSatisfiesTag4.types.diff | 26 ++ .../checkJsdocSatisfiesTag5.types.diff | 7 +- .../checkJsdocSatisfiesTag6.types.diff | 17 + .../checkJsdocSatisfiesTag7.types.diff | 10 + .../checkJsdocSatisfiesTag8.errors.txt.diff | 31 +- .../checkJsdocSatisfiesTag8.types.diff | 6 +- .../checkJsdocSatisfiesTag9.types.diff | 20 + .../checkJsdocTypeTag1.errors.txt.diff | 89 ++-- .../conformance/checkJsdocTypeTag1.types.diff | 77 +--- .../checkJsdocTypeTag2.errors.txt.diff | 85 ++-- .../conformance/checkJsdocTypeTag2.types.diff | 33 +- .../conformance/checkJsdocTypeTag3.types.diff | 9 - .../checkJsdocTypeTag4.errors.txt.diff | 41 +- .../conformance/checkJsdocTypeTag4.types.diff | 13 +- .../checkJsdocTypeTag5.errors.txt.diff | 106 ++--- .../conformance/checkJsdocTypeTag5.types.diff | 70 ++- .../checkJsdocTypeTag6.errors.txt.diff | 87 ++-- .../conformance/checkJsdocTypeTag6.types.diff | 22 +- .../conformance/checkJsdocTypeTag7.types.diff | 13 +- ...ocTypeTagOnObjectProperty1.errors.txt.diff | 12 +- ...ckJsdocTypeTagOnObjectProperty1.types.diff | 54 +-- ...ocTypeTagOnObjectProperty2.errors.txt.diff | 64 +-- ...ckJsdocTypeTagOnObjectProperty2.types.diff | 28 +- ...eckJsdocTypedefInParamTag1.errors.txt.diff | 61 +++ .../checkJsdocTypedefInParamTag1.types.diff | 107 +++-- ...JsdocTypedefOnlySourceFile.errors.txt.diff | 5 +- ...checkJsdocTypedefOnlySourceFile.types.diff | 13 +- ...SpecialPropertyAssignments.errors.txt.diff | 16 +- ...checkSpecialPropertyAssignments.types.diff | 23 - ...nExtendConstructorFunction.errors.txt.diff | 23 +- ...assCanExtendConstructorFunction.types.diff | 61 +-- .../commonJSAliasedExport.types.diff | 8 +- ...JSImportClassTypeReference.errors.txt.diff | 5 +- ...ommonJSImportClassTypeReference.types.diff | 15 +- ...ortExportedClassExpression.errors.txt.diff | 5 +- ...JSImportExportedClassExpression.types.diff | 13 +- ...rtNestedClassTypeReference.errors.txt.diff | 5 +- ...SImportNestedClassTypeReference.types.diff | 13 +- ...nctionMethodTypeParameters.errors.txt.diff | 48 ++ ...torFunctionMethodTypeParameters.types.diff | 40 +- .../constructorFunctions.types.diff | 7 +- .../constructorFunctionsStrict.types.diff | 39 +- .../contextualTypeFromJSDoc.types.diff | 76 +--- ...ontextualTypedSpecialAssignment.types.diff | 8 +- .../conformance/enumTag.errors.txt.diff | 36 +- .../conformance/enumTag.types.diff | 93 ++-- .../enumTagImported.errors.txt.diff | 36 ++ .../conformance/enumTagImported.types.diff | 19 +- .../enumTagUseBeforeDefCrash.errors.txt.diff | 21 + .../enumTagUseBeforeDefCrash.types.diff | 2 +- .../errorOnFunctionReturnType.errors.txt.diff | 106 ++--- .../errorOnFunctionReturnType.types.diff | 14 +- .../exportNestedNamespaces.types.diff | 14 +- .../exportedEnumTypeAndValue.errors.txt.diff | 24 + .../exportedEnumTypeAndValue.types.diff | 9 + .../conformance/extendsTag1.types.diff | 6 +- .../conformance/extendsTag5.errors.txt.diff | 92 ++-- .../conformance/extendsTag5.types.diff | 35 +- .../genericSetterInClassTypeJsDoc.types.diff | 20 +- .../conformance/importTag1.errors.txt.diff | 25 ++ .../conformance/importTag1.types.diff | 11 - ...importTag15(module=es2015).errors.txt.diff | 30 +- .../importTag15(module=es2015).types.diff | 11 - ...importTag15(module=esnext).errors.txt.diff | 30 +- .../importTag15(module=esnext).types.diff | 11 - .../conformance/importTag16.errors.txt.diff | 26 ++ .../conformance/importTag16.types.diff | 13 - .../conformance/importTag17.errors.txt.diff | 67 ++- .../conformance/importTag17.types.diff | 4 +- .../conformance/importTag18.errors.txt.diff | 25 ++ .../conformance/importTag18.types.diff | 11 - .../conformance/importTag19.errors.txt.diff | 24 + .../conformance/importTag19.types.diff | 11 - .../conformance/importTag2.errors.txt.diff | 25 ++ .../conformance/importTag2.types.diff | 4 +- .../conformance/importTag20.errors.txt.diff | 25 ++ .../conformance/importTag20.types.diff | 11 - .../conformance/importTag3.errors.txt.diff | 25 ++ .../conformance/importTag3.types.diff | 11 - .../conformance/importTag4.errors.txt.diff | 48 +- .../conformance/importTag4.types.diff | 11 - .../conformance/importTag5.errors.txt.diff | 25 ++ .../conformance/importTag5.types.diff | 11 - .../conformance/importTag6.errors.txt.diff | 35 ++ .../conformance/importTag6.types.diff | 13 - .../conformance/importTag7.errors.txt.diff | 34 ++ .../conformance/importTag7.types.diff | 13 - .../conformance/importTag8.errors.txt.diff | 34 ++ .../conformance/importTag8.types.diff | 13 - .../conformance/importTag9.errors.txt.diff | 34 ++ .../conformance/importTag9.types.diff | 6 +- .../conformance/importTypeInJSDoc.types.diff | 56 ++- .../importingExportingTypes.errors.txt.diff | 12 +- .../importingExportingTypes.types.diff | 11 + .../conformance/inferThis.errors.txt.diff | 45 ++ .../conformance/inferThis.types.diff | 38 +- ...rameterOnVariableStatement.errors.txt.diff | 30 ++ ...ypeParameterOnVariableStatement.types.diff | 33 +- ...ImplementsGenericsSerialization.types.diff | 18 - .../jsDeclarationsClassMethod.types.diff | 23 +- .../jsDeclarationsClasses.errors.txt.diff | 13 +- .../jsDeclarationsClasses.types.diff | 222 +--------- .../jsDeclarationsComputedNames.types.diff | 9 - .../jsDeclarationsDefault.types.diff | 12 +- .../jsDeclarationsEnumTag.errors.txt.diff | 68 +++ .../jsDeclarationsEnumTag.types.diff | 73 ++-- ...nsExportAssignedClassExpression.types.diff | 18 - ...ssignedClassExpressionAnonymous.types.diff | 18 - ...ClassExpressionAnonymousWithSub.types.diff | 18 +- ...nsExportDefinePropertyEmit.errors.txt.diff | 8 +- ...rationsExportDefinePropertyEmit.types.diff | 132 ++---- ...ClassesCjsExportAssignment.errors.txt.diff | 13 +- ...ctionClassesCjsExportAssignment.types.diff | 122 ++++-- .../jsDeclarationsFunctionJSDoc.types.diff | 38 -- ...rationsFunctionLikeClasses.errors.txt.diff | 5 +- ...DeclarationsFunctionLikeClasses.types.diff | 55 +-- ...ationsFunctionLikeClasses2.errors.txt.diff | 5 +- ...eclarationsFunctionLikeClasses2.types.diff | 146 +++---- .../jsDeclarationsFunctions.types.diff | 114 ++--- ...jsDeclarationsFunctionsCjs.errors.txt.diff | 8 +- .../jsDeclarationsFunctionsCjs.types.diff | 58 ++- .../jsDeclarationsGetterSetter.types.diff | 225 +--------- ...liasExposedWithinNamespace.errors.txt.diff | 122 +++--- ...portAliasExposedWithinNamespace.types.diff | 51 ++- ...sExposedWithinNamespaceCjs.errors.txt.diff | 11 +- ...tAliasExposedWithinNamespaceCjs.types.diff | 26 +- ...ationsImportNamespacedType.errors.txt.diff | 19 + ...eclarationsImportNamespacedType.types.diff | 5 + ...jsDeclarationsImportTypeBundled.types.diff | 16 +- ...ionsJSDocRedirectedLookups.errors.txt.diff | 65 +++ ...larationsJSDocRedirectedLookups.types.diff | 45 +- ...eclarationsMissingGenerics.errors.txt.diff | 22 + ...tionsMissingTypeParameters.errors.txt.diff | 43 ++ ...clarationsMissingTypeParameters.types.diff | 2 +- ...ionsModuleReferenceHasEmit.errors.txt.diff | 24 + ...larationsModuleReferenceHasEmit.types.diff | 2 +- ...jsDeclarationsNestedParams.errors.txt.diff | 38 ++ .../jsDeclarationsNestedParams.types.diff | 4 +- ...ationsOptionalTypeLiteralProps1.types.diff | 2 +- ...ationsOptionalTypeLiteralProps2.types.diff | 2 +- ...rTagReusesInputNodeInEmit1.errors.txt.diff | 5 +- ...ameterTagReusesInputNodeInEmit1.types.diff | 8 +- ...rTagReusesInputNodeInEmit2.errors.txt.diff | 5 +- ...ameterTagReusesInputNodeInEmit2.types.diff | 7 +- ...eclarationsReactComponents.errors.txt.diff | 5 +- .../jsDeclarationsReactComponents.types.diff | 16 +- ...tingNodesMappingJSDocTypes.errors.txt.diff | 46 ++ ...sExistingNodesMappingJSDocTypes.types.diff | 21 +- ...sesExistingTypeAnnotations.errors.txt.diff | 32 +- ...nsReusesExistingTypeAnnotations.types.diff | 220 +--------- ...thExplicitNoArgumentConstructor.types.diff | 13 - .../jsDeclarationsTypeAliases.types.diff | 39 +- ...TypeReassignmentFromDeclaration.types.diff | 14 +- ...tionsTypedefAndImportTypes.errors.txt.diff | 5 +- ...clarationsTypedefAndImportTypes.types.diff | 20 +- ...rationsTypedefAndLatebound.errors.txt.diff | 5 +- ...DeclarationsTypedefAndLatebound.types.diff | 38 +- .../jsDeclarationsTypedefFunction.types.diff | 44 +- ...ropertyAndExportAssignment.errors.txt.diff | 5 +- ...edefPropertyAndExportAssignment.types.diff | 30 +- ...larationsUniqueSymbolUsage.errors.txt.diff | 28 ++ .../jsdocBindingInUnreachableCode.types.diff | 15 - ...ocCatchClauseWithTypeAnnotation.types.diff | 35 +- ...uctorFunctionTypeReference.errors.txt.diff | 6 +- ...onstructorFunctionTypeReference.types.diff | 8 +- .../jsdocFunctionType.errors.txt.diff | 28 +- .../conformance/jsdocFunctionType.types.diff | 104 ++--- .../jsdocImplements_class.types.diff | 11 +- .../jsdocImportType.errors.txt.diff | 38 ++ .../conformance/jsdocImportType.types.diff | 19 +- .../jsdocImportType2.errors.txt.diff | 37 ++ .../conformance/jsdocImportType2.types.diff | 19 +- ...tTypeReferenceToClassAlias.errors.txt.diff | 5 +- ...ImportTypeReferenceToClassAlias.types.diff | 2 + ...eReferenceToCommonjsModule.errors.txt.diff | 22 + ...ortTypeReferenceToESModule.errors.txt.diff | 19 + ...peReferenceToStringLiteral.errors.txt.diff | 17 + .../jsdocIndexSignature.errors.txt.diff | 57 ++- .../conformance/jsdocLiteral.types.diff | 38 +- .../jsdocNeverUndefinedNull.types.diff | 16 - .../jsdocOuterTypeParameters1.errors.txt.diff | 8 +- .../jsdocOuterTypeParameters1.types.diff | 23 - .../jsdocOuterTypeParameters2.errors.txt.diff | 7 +- .../jsdocOuterTypeParameters2.types.diff | 23 - .../conformance/jsdocOverrideTag1.types.diff | 34 +- .../conformance/jsdocParamTag2.types.diff | 38 +- .../jsdocParamTagTypeLiteral.types.diff | 22 +- ...ocParseBackquotedParamName.errors.txt.diff | 25 -- .../jsdocParseBackquotedParamName.types.diff | 10 +- ...seDotDotDotInJSDocFunction.errors.txt.diff | 12 +- ...ocParseDotDotDotInJSDocFunction.types.diff | 2 +- ...ocParseHigherOrderFunction.errors.txt.diff | 6 +- .../jsdocParseHigherOrderFunction.types.diff | 2 +- ...sdocParseMatchingBackticks.errors.txt.diff | 41 -- .../jsdocParseMatchingBackticks.types.diff | 46 -- ...arenthesizedJSDocParameter.errors.txt.diff | 6 +- ...arseParenthesizedJSDocParameter.types.diff | 2 +- .../jsdocParseStarEquals.errors.txt.diff | 8 +- .../jsdocParseStarEquals.types.diff | 4 +- ...stfixEqualsAddsOptionality.errors.txt.diff | 22 +- ...docPostfixEqualsAddsOptionality.types.diff | 48 +- .../jsdocPrefixPostfixParsing.types.diff | 22 +- .../jsdocPrivateName1.errors.txt.diff | 16 - .../conformance/jsdocPrivateName1.types.diff | 11 - .../jsdocReturnTag1.errors.txt.diff | 8 +- .../conformance/jsdocReturnTag1.types.diff | 21 +- ...ignatureOnReturnedFunction.errors.txt.diff | 56 --- ...sdocSignatureOnReturnedFunction.types.diff | 107 +---- .../jsdocTemplateClass.errors.txt.diff | 12 +- .../conformance/jsdocTemplateClass.types.diff | 82 ++-- ...sdocTemplateConstructorFunction.types.diff | 29 +- ...docTemplateConstructorFunction2.types.diff | 35 +- .../jsdocTemplateTag.errors.txt.diff | 18 +- .../conformance/jsdocTemplateTag.types.diff | 44 +- .../jsdocTemplateTag2.errors.txt.diff | 25 ++ .../conformance/jsdocTemplateTag2.types.diff | 30 -- .../jsdocTemplateTag3.errors.txt.diff | 65 ++- .../conformance/jsdocTemplateTag3.types.diff | 114 ++--- .../conformance/jsdocTemplateTag4.types.diff | 10 +- .../jsdocTemplateTag5.errors.txt.diff | 24 +- .../conformance/jsdocTemplateTag5.types.diff | 79 ++-- .../jsdocTemplateTag6.errors.txt.diff | 120 ----- .../conformance/jsdocTemplateTag6.types.diff | 412 +++++------------- .../jsdocTemplateTag7.errors.txt.diff | 33 -- .../conformance/jsdocTemplateTag7.types.diff | 24 +- .../jsdocTemplateTag8.errors.txt.diff | 77 ++-- .../conformance/jsdocTemplateTag8.types.diff | 122 ++---- .../jsdocTemplateTagDefault.errors.txt.diff | 137 +++--- .../jsdocTemplateTagDefault.types.diff | 96 ++-- ...cTemplateTagNameResolution.errors.txt.diff | 38 +- .../jsdocTemplateTagNameResolution.types.diff | 13 +- .../conformance/jsdocThisType.errors.txt.diff | 89 ++-- .../conformance/jsdocThisType.types.diff | 8 +- .../jsdocTypeDefAtStartOfFile.errors.txt.diff | 22 + .../jsdocTypeDefAtStartOfFile.types.diff | 9 +- .../jsdocTypeReferenceExports.errors.txt.diff | 5 +- .../jsdocTypeReferenceExports.types.diff | 2 +- ...jsdocTypeReferenceToImport.errors.txt.diff | 8 +- .../jsdocTypeReferenceToImport.types.diff | 19 +- ...erenceToImportOfClassExpression.types.diff | 1 + ...nceToImportOfFunctionExpression.types.diff | 9 +- ...TypeReferenceToMergedClass.errors.txt.diff | 5 +- ...jsdocTypeReferenceToMergedClass.types.diff | 4 +- .../jsdocTypeReferenceToValue.errors.txt.diff | 16 + .../jsdocTypeReferenceToValue.types.diff | 6 +- .../jsdocTypeReferenceUseBeforeDef.types.diff | 11 - .../conformance/jsdocTypeTag.errors.txt.diff | 110 ++--- .../conformance/jsdocTypeTag.types.diff | 116 ++--- .../jsdocTypeTagCast.errors.txt.diff | 45 +- .../conformance/jsdocTypeTagCast.types.diff | 149 +++---- .../jsdocTypeTagParameterType.errors.txt.diff | 7 +- .../jsdocTypeTagParameterType.types.diff | 2 +- ...cTypeTagRequiredParameters.errors.txt.diff | 6 +- .../jsdocTypeTagRequiredParameters.types.diff | 7 +- ...leDeclarationWithTypeAnnotation.types.diff | 4 +- .../jsdocVariadicType.errors.txt.diff | 20 + .../conformance/jsdocVariadicType.types.diff | 7 +- .../conformance/linkTagEmit1.types.diff | 34 +- .../conformance/malformedTags.types.diff | 11 - .../moduleExportAssignment6.types.diff | 37 +- .../moduleExportAssignment7.errors.txt.diff | 64 ++- .../moduleExportAssignment7.types.diff | 38 +- .../moduleExportNestedNamespaces.types.diff | 10 +- ...tsElementAccessAssignment2.errors.txt.diff | 34 -- ...sertForUnparseableTypedefs.errors.txt.diff | 15 + .../noAssertForUnparseableTypedefs.types.diff | 11 + .../optionalBindingParameters3.types.diff | 13 +- .../conformance/overloadTag1.errors.txt.diff | 79 ++-- .../conformance/overloadTag1.types.diff | 28 +- .../conformance/overloadTag2.types.diff | 18 - .../conformance/overloadTag3.errors.txt.diff | 31 -- .../conformance/overloadTag3.types.diff | 35 -- ...acketsAddOptionalUndefined.errors.txt.diff | 28 -- ...TagBracketsAddOptionalUndefined.types.diff | 38 +- .../paramTagTypeResolution2.errors.txt.diff | 21 + .../paramTagTypeResolution2.types.diff | 17 +- .../conformance/paramTagWrapping.types.diff | 23 - ...enericConstructorFunctions.errors.txt.diff | 63 +++ ...esOfGenericConstructorFunctions.types.diff | 88 ++-- ...tyAssignmentUseParentType2.errors.txt.diff | 61 ++- ...ropertyAssignmentUseParentType2.types.diff | 49 +-- ...ssignmentMergeAcrossFiles2.errors.txt.diff | 9 +- ...ertyAssignmentMergeAcrossFiles2.types.diff | 26 -- ...ignmentMergedTypeReference.errors.txt.diff | 26 ++ ...tyAssignmentMergedTypeReference.types.diff | 5 +- .../recursiveTypeReferences2.errors.txt.diff | 97 +++-- .../recursiveTypeReferences2.types.diff | 23 +- .../returnTagTypeGuard.errors.txt.diff | 8 +- .../conformance/returnTagTypeGuard.types.diff | 74 +--- .../conformance/seeTag4.types.diff | 11 + .../conformance/syntaxErrors.types.diff | 24 - .../templateInsideCallback.errors.txt.diff | 12 +- .../templateInsideCallback.types.diff | 92 ++-- ...thisPropertyAssignmentInherited.types.diff | 49 +++ .../conformance/thisTag1.types.diff | 31 +- .../conformance/thisTag3.types.diff | 28 +- ...TypeOfConstructorFunctions.errors.txt.diff | 66 +++ .../thisTypeOfConstructorFunctions.types.diff | 39 +- ...typeFromContextualThisType.errors.txt.diff | 29 -- .../typeFromContextualThisType.types.diff | 65 ++- .../typeFromJSInitializer.errors.txt.diff | 19 +- .../typeFromJSInitializer.types.diff | 63 +-- .../typeFromJSInitializer4.errors.txt.diff | 22 - .../typeFromJSInitializer4.types.diff | 42 -- ...ypeFromParamTagForFunction.errors.txt.diff | 40 +- .../typeFromParamTagForFunction.types.diff | 115 ++--- ...FromPrivatePropertyAssignmentJs.types.diff | 40 -- ...typeFromPropertyAssignment.errors.txt.diff | 8 +- .../typeFromPropertyAssignment.types.diff | 8 +- ...peFromPropertyAssignment10.errors.txt.diff | 5 +- .../typeFromPropertyAssignment10.types.diff | 8 +- ...FromPropertyAssignment10_1.errors.txt.diff | 5 +- .../typeFromPropertyAssignment10_1.types.diff | 8 +- ...peFromPropertyAssignment14.errors.txt.diff | 5 +- .../typeFromPropertyAssignment14.types.diff | 18 +- ...peFromPropertyAssignment15.errors.txt.diff | 5 +- .../typeFromPropertyAssignment15.types.diff | 18 +- ...peFromPropertyAssignment16.errors.txt.diff | 5 +- .../typeFromPropertyAssignment16.types.diff | 18 +- ...ypeFromPropertyAssignment2.errors.txt.diff | 8 +- .../typeFromPropertyAssignment2.types.diff | 17 +- ...peFromPropertyAssignment24.errors.txt.diff | 5 +- .../typeFromPropertyAssignment24.types.diff | 8 +- ...ypeFromPropertyAssignment3.errors.txt.diff | 8 +- .../typeFromPropertyAssignment3.types.diff | 8 +- ...peFromPropertyAssignment35.errors.txt.diff | 5 +- .../typeFromPropertyAssignment35.types.diff | 17 +- ...ypeFromPropertyAssignment4.errors.txt.diff | 10 +- .../typeFromPropertyAssignment4.types.diff | 22 +- ...peFromPropertyAssignment40.errors.txt.diff | 19 + .../typeFromPropertyAssignment40.types.diff | 11 +- ...ypeFromPropertyAssignment5.errors.txt.diff | 23 + .../typeFromPropertyAssignment5.types.diff | 2 +- ...ypeFromPropertyAssignment6.errors.txt.diff | 5 +- .../typeFromPropertyAssignment6.types.diff | 4 +- ...opertyAssignmentOutOfOrder.errors.txt.diff | 5 +- ...romPropertyAssignmentOutOfOrder.types.diff | 3 +- ...peFromPrototypeAssignment3.errors.txt.diff | 11 +- .../typeFromPrototypeAssignment3.types.diff | 39 +- .../typeFromPrototypeAssignment4.types.diff | 39 +- .../typeLookupInIIFE.errors.txt.diff | 23 +- .../conformance/typeLookupInIIFE.types.diff | 2 +- .../typeTagNoErasure.errors.txt.diff | 29 +- .../conformance/typeTagNoErasure.types.diff | 26 +- ...eTagOnFunctionReferencesGeneric.types.diff | 28 +- .../typeTagOnPropertyAssignment.types.diff | 40 +- .../conformance/typedefCrossModule.types.diff | 67 ++- .../typedefCrossModule2.errors.txt.diff | 8 +- .../typedefCrossModule2.types.diff | 2 +- .../typedefCrossModule3.types.diff | 5 +- .../typedefCrossModule4.types.diff | 9 +- .../typedefCrossModule5.types.diff | 11 + .../typedefInnerNamepaths.types.diff | 14 + ...edefMultipleTypeParameters.errors.txt.diff | 39 +- .../typedefMultipleTypeParameters.types.diff | 17 +- .../typedefOnSemicolonClassElement.types.diff | 11 + .../typedefOnStatements.errors.txt.diff | 123 ------ .../typedefOnStatements.types.diff | 309 ++++++++----- .../conformance/typedefScope1.errors.txt.diff | 26 -- .../conformance/typedefScope1.types.diff | 22 +- ...pedefTagExtraneousProperty.errors.txt.diff | 11 +- .../typedefTagExtraneousProperty.types.diff | 17 +- .../conformance/typedefTagNested.types.diff | 93 ++-- .../typedefTagTypeResolution.errors.txt.diff | 58 +-- .../typedefTagTypeResolution.types.diff | 40 +- .../typedefTagWrapping.errors.txt.diff | 218 ++++----- .../conformance/typedefTagWrapping.types.diff | 198 +++------ ...queSymbolsDeclarationsInJs.errors.txt.diff | 42 ++ .../uniqueSymbolsDeclarationsInJs.types.diff | 2 +- ...bolsDeclarationsInJsErrors.errors.txt.diff | 46 +- ...ueSymbolsDeclarationsInJsErrors.types.diff | 18 +- .../varRequireFromJavascript.errors.txt.diff | 5 +- .../varRequireFromJavascript.types.diff | 6 +- .../varRequireFromTypescript.errors.txt.diff | 8 +- .../varRequireFromTypescript.types.diff | 10 +- 1232 files changed, 16365 insertions(+), 13390 deletions(-) create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols.diff create mode 100644 testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag16.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag17.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag18.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag19.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag20.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag3.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag4.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag5.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag6.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag7.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag8.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag9.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/inferThis.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor1_Js.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor2_Js.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor4_Js.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor5_Js.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/arrowFunctionJSDocAnnotation.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/arrowFunctionJSDocAnnotation.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/checkJsObjectLiteralHasCheckedKeyof.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment4.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitClassAccessorsJs1.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitClassSetAccessorParamNameInJs.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/extendedUnicodePlaneIdentifiersJSDoc.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/importTypeResolutionJSDocEOF.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationSyntaxError.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocAccessEnumType.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocCallbackAndType.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocClassMissingTypeArguments.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocParamTagOnPropertyInitializer.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocParamTagOnPropertyInitializer.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocRestParameter_es6.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocRestParameter_es6.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeCast.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash2.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/subclassThisTypeAssignable01.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/unicodeEscapesInJSDoc.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/callbackOnConstructor.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/callbackTag1.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/callbackTag3.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/callbackTag3.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/callbackTagNestedParameter.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocOptionalParamOrder.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamTag1.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag2.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag10.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag11.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag4.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag6.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag7.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag9.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag3.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/enumTagUseBeforeDefCrash.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag1.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag1.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=es2015).types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=esnext).types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag16.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag16.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag18.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag18.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag19.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag19.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag2.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag20.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag20.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag3.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag3.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag4.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag5.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag6.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag6.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag7.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag7.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag8.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag8.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag9.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importingExportingTypes.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/inferThis.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsEnumTag.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionJSDoc.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportNamespacedType.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingGenerics.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsNestedParams.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsSubclassWithExplicitNoArgumentConstructor.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocBindingInUnreachableCode.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToESModule.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocNeverUndefinedNull.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters2.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseBackquotedParamName.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseMatchingBackticks.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseMatchingBackticks.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName1.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName1.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag2.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag6.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag7.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeDefAtStartOfFile.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToValue.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceUseBeforeDef.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/malformedTags.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment2.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/overloadTag3.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/overloadTag3.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/paramTagBracketsAddOptionalUndefined.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/paramTagWrapping.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/seeTag4.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/syntaxErrors.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/thisPropertyAssignmentInherited.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/thisTypeOfConstructorFunctions.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typeFromContextualThisType.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer4.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer4.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrivatePropertyAssignmentJs.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment40.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment5.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule5.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typedefOnSemicolonClassElement.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typedefScope1.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.errors.txt.diff diff --git a/internal/ast/ast.go b/internal/ast/ast.go index ac6cd4e5f7..31760df868 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -7923,36 +7923,34 @@ func IsJSDocUnknownTag(node *Node) bool { // JSDocTemplateTag type JSDocTemplateTag struct { JSDocTagBase - Constraint *Node typeParameters *TypeParameterList } -func (f *NodeFactory) NewJSDocTemplateTag(tagName *IdentifierNode, constraint *Node, typeParameters *TypeParameterList, comment *NodeList) *Node { +func (f *NodeFactory) NewJSDocTemplateTag(tagName *IdentifierNode, typeParameters *TypeParameterList, comment *NodeList) *Node { data := &JSDocTemplateTag{} data.TagName = tagName - data.Constraint = constraint data.typeParameters = typeParameters data.Comment = comment return newNode(KindJSDocTemplateTag, data, f.hooks) } -func (f *NodeFactory) UpdateJSDocTemplateTag(node *JSDocTemplateTag, tagName *IdentifierNode, constraint *Node, typeParameters *TypeParameterList, comment *NodeList) *Node { - if tagName != node.TagName || constraint != node.Constraint || typeParameters != node.typeParameters || comment != node.Comment { - return updateNode(f.NewJSDocTemplateTag(tagName, constraint, typeParameters, comment), node.AsNode(), f.hooks) +func (f *NodeFactory) UpdateJSDocTemplateTag(node *JSDocTemplateTag, tagName *IdentifierNode, typeParameters *TypeParameterList, comment *NodeList) *Node { + if tagName != node.TagName || typeParameters != node.typeParameters || comment != node.Comment { + return updateNode(f.NewJSDocTemplateTag(tagName, typeParameters, comment), node.AsNode(), f.hooks) } return node.AsNode() } func (node *JSDocTemplateTag) ForEachChild(v Visitor) bool { - return visit(v, node.TagName) || visit(v, node.Constraint) || visitNodeList(v, node.typeParameters) || visitNodeList(v, node.Comment) + return visit(v, node.TagName) || visitNodeList(v, node.typeParameters) || visitNodeList(v, node.Comment) } func (node *JSDocTemplateTag) VisitEachChild(v *NodeVisitor) *Node { - return v.Factory.UpdateJSDocTemplateTag(node, v.visitNode(node.TagName), v.visitNode(node.Constraint), v.visitNodes(node.typeParameters), v.visitNodes(node.Comment)) + return v.Factory.UpdateJSDocTemplateTag(node, v.visitNode(node.TagName), v.visitNodes(node.typeParameters), v.visitNodes(node.Comment)) } func (node *JSDocTemplateTag) Clone(f *NodeFactory) *Node { - return cloneNode(f.NewJSDocTemplateTag(node.TagName, node.Constraint, node.TypeParameters(), node.Comment), node.AsNode(), f.hooks) + return cloneNode(f.NewJSDocTemplateTag(node.TagName, node.TypeParameters(), node.Comment), node.AsNode(), f.hooks) } func (node *JSDocTemplateTag) TypeParameters() *TypeParameterList { return node.typeParameters } diff --git a/internal/checker/utilities.go b/internal/checker/utilities.go index a03b9cc1fc..c9d5887529 100644 --- a/internal/checker/utilities.go +++ b/internal/checker/utilities.go @@ -2042,7 +2042,7 @@ var getFeatureMap = sync.OnceValue(func() map[string][]FeatureMapEntry { }) func rangeOfTypeParameters(sourceFile *ast.SourceFile, typeParameters *ast.NodeList) core.TextRange { - return core.NewTextRange(typeParameters.Pos()-1, min(len(sourceFile.Text), scanner.SkipTrivia(sourceFile.Text, typeParameters.End())+1)) + return core.NewTextRange(max(0, typeParameters.Pos()-1), min(len(sourceFile.Text), scanner.SkipTrivia(sourceFile.Text, typeParameters.End())+1)) } func tryGetPropertyAccessOrIdentifierToString(expr *ast.Node) string { diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index 328ba4ebbb..66ab309350 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -102,9 +102,7 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { for _, tag := range j.AsJSDoc().Tags.Nodes { switch tag.Kind { case ast.KindJSDocTypedefTag: - // TODO: Maybe save an Original pointer - // TODO: Look for neighbouring template tags to fill in typeparameters - // TODO: Don't mark typedefs as exported if they are not in a module + // !!! Don't mark typedefs as exported if they are not in a module typeexpr := tag.AsJSDocTypedefTag().TypeExpression if typeexpr == nil { break @@ -115,6 +113,9 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { nodes := p.nodeSlicePool.NewSlice(1) nodes[0] = export modifiers := p.newModifierList(export.Loc, nodes) + + typeParameters := p.gatherTypeParameters(j, export.Loc) + var t *ast.Node switch typeexpr.Kind { case ast.KindJSDocTypeExpression: @@ -131,10 +132,10 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { default: panic("typedef tag type expression should be a name reference or a type expression" + typeexpr.Kind.String()) } - jstype := p.factory.NewJSTypeAliasDeclaration(modifiers, tag.AsJSDocTypedefTag().Name(), nil /*typeParameters*/, t) + jstype := p.factory.NewJSTypeAliasDeclaration(modifiers, tag.AsJSDocTypedefTag().Name(), typeParameters, t) jstype.Loc = core.NewTextRange(p.nodePos(), p.nodePos()) p.reparseList = append(p.reparseList, jstype) - // TODO: @overload and unattached tags (@callback, @import et al) support goes here + // !!! @overload and other unattached tags (@callback, @import et al) support goes here } if !isLast { continue @@ -162,6 +163,25 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { } else if host.Kind == ast.KindReturnStatement { ret := host.AsReturnStatement() ret.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), ret.Expression) + } else if host.Kind == ast.KindParenthesizedExpression { + paren:= host.AsParenthesizedExpression() + paren.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), paren.Expression) + } + case ast.KindJSDocTemplateTag: + if fun, ok := getFunctionLikeHost(host); ok { + if fun.TypeParameters() == nil { + fun.FunctionLikeData().TypeParameters = p.gatherTypeParameters(j, fun.Loc) + } + } else if host.Kind == ast.KindClassDeclaration { + class := host.AsClassDeclaration() + if class.TypeParameters == nil { + class.TypeParameters = p.gatherTypeParameters(j, host.Loc) + } + } else if host.Kind == ast.KindClassExpression { + class := host.AsClassExpression() + if class.TypeParameters == nil { + class.TypeParameters = p.gatherTypeParameters(j, host.Loc) + } } case ast.KindJSDocParameterTag: if fun, ok := getFunctionLikeHost(host); ok { @@ -170,8 +190,8 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { if param.Type() == nil { param.AsParameterDeclaration().Type = p.makeNewType(jsparam.TypeExpression) if param.AsParameterDeclaration().QuestionToken == nil && - // TODO: TypeExpression can *still* be nil here! - (jsparam.IsBracketed || jsparam.TypeExpression.Type().Kind == ast.KindJSDocOptionalType) { + param.AsParameterDeclaration().Initializer == nil && + (jsparam.IsBracketed || jsparam.TypeExpression != nil && jsparam.TypeExpression.Type().Kind == ast.KindJSDocOptionalType) { param.AsParameterDeclaration().QuestionToken = p.factory.NewToken(ast.KindQuestionToken) param.AsParameterDeclaration().QuestionToken.Loc = core.NewTextRange(param.End(), param.End()) } @@ -199,6 +219,26 @@ func findMatchingParameter(fun *ast.Node, jsparam *ast.JSDocParameterTag) (*ast. return nil, false } +func (p *Parser) gatherTypeParameters(j *ast.Node, loc core.TextRange) *ast.NodeList { + nodes := p.nodeSlicePool.NewSlice(0) + for _, tag := range j.AsJSDoc().Tags.Nodes { + if tag.Kind == ast.KindJSDocTemplateTag { + template := tag.AsJSDocTemplateTag() + for _, tp := range template.TypeParameters().Nodes { + // TODO: decide whether this clone/location update is needed + tp2 := tp.Clone(&p.factory) + tp2.Loc = loc + nodes = append(nodes, tp2) + } + } + } + if len(nodes) == 0 { + return nil + } else { + return p.newNodeList(loc, nodes) + } +} + func getFunctionLikeHost(host *ast.Node) (*ast.Node, bool) { fun := host if host.Kind == ast.KindVariableStatement && host.AsVariableStatement().DeclarationList != nil { @@ -229,7 +269,7 @@ func getFunctionLikeHost(host *ast.Node) (*ast.Node, bool) { func (p *Parser) makeNewTypeAssertion(t *ast.TypeNode, e *ast.Node) *ast.Node { assert := p.factory.NewTypeAssertion(t, e) assert.Flags |= p.contextFlags | ast.NodeFlagsSynthesized - assert.Loc = core.NewTextRange(assert.Type().Pos(), assert.Type().End()) + assert.Loc = core.NewTextRange(e.Pos(), e.End()) return assert } @@ -1310,7 +1350,7 @@ func (p *Parser) tryParseChildTag(target propertyLikeParse, indent int) *ast.Nod return p.parseParameterOrPropertyTag(start, tagName, target, indent) } -func (p *Parser) parseTemplateTagTypeParameter() *ast.Node { +func (p *Parser) parseTemplateTagTypeParameter(constraint *ast.Node) *ast.Node { typeParameterPos := p.nodePos() isBracketed := p.parseOptionalJsdoc(ast.KindOpenBracketToken) if isBracketed { @@ -1333,16 +1373,16 @@ func (p *Parser) parseTemplateTagTypeParameter() *ast.Node { if ast.NodeIsMissing(name) { return nil } - result := p.factory.NewTypeParameterDeclaration(modifiers, name /*constraint*/, nil, defaultType) + result := p.factory.NewTypeParameterDeclaration(modifiers, name, constraint, defaultType) p.finishNode(result, typeParameterPos) return result } -func (p *Parser) parseTemplateTagTypeParameters() *ast.TypeParameterList { +func (p *Parser) parseTemplateTagTypeParameters(constraint *ast.Node) *ast.TypeParameterList { typeParameters := ast.TypeParameterList{} for ok := true; ok; ok = p.parseOptionalJsdoc(ast.KindCommaToken) { // do-while loop p.skipWhitespace() - node := p.parseTemplateTagTypeParameter() + node := p.parseTemplateTagTypeParameter(constraint) if node != nil { typeParameters.Nodes = append(typeParameters.Nodes, node) } @@ -1366,9 +1406,12 @@ func (p *Parser) parseTemplateTag(start int, tagName *ast.IdentifierNode, indent var constraint *ast.Node if p.token == ast.KindOpenBraceToken { constraint = p.parseJSDocTypeExpression(false) + if constraint != nil { + constraint = constraint.Type() + } } - typeParameters := p.parseTemplateTagTypeParameters() - result := p.factory.NewJSDocTemplateTag(tagName, constraint, typeParameters, p.parseTrailingTagComments(start, p.nodePos(), indent, indentText)) + typeParameters := p.parseTemplateTagTypeParameters(constraint) + result := p.factory.NewJSDocTemplateTag(tagName, typeParameters, p.parseTrailingTagComments(start, p.nodePos(), indent, indentText)) p.finishNode(result, start) return result } diff --git a/internal/testutil/tsbaseline/type_symbol_baseline.go b/internal/testutil/tsbaseline/type_symbol_baseline.go index a79ae41c11..f036e24c69 100644 --- a/internal/testutil/tsbaseline/type_symbol_baseline.go +++ b/internal/testutil/tsbaseline/type_symbol_baseline.go @@ -341,16 +341,8 @@ func (walker *typeWriterWalker) writeTypeOrSymbol(node *ast.Node, isSymbolWalk b // Exception for `T` in `type T = something` because that may evaluate to some interesting type. if ast.IsPartOfTypeNode(node) || ast.IsIdentifier(node) && -<<<<<<< HEAD - (ast.GetMeaningFromDeclaration(node)&ast.SemanticMeaningValue) == 0 && - !(ast.IsEitherTypeAliasDeclaration(node.Parent) && node == node.Parent.Name()) { -||||||| 677e0f31e - (ast.GetMeaningFromDeclaration(node)&ast.SemanticMeaningValue) == 0 && - !(ast.IsTypeAliasDeclaration(node.Parent) && node == node.Parent.Name()) { -======= (ast.GetMeaningFromDeclaration(node.Parent)&ast.SemanticMeaningValue) == 0 && - !(ast.IsTypeAliasDeclaration(node.Parent) && node == node.Parent.Name()) { ->>>>>>> main + !(ast.IsEitherTypeAliasDeclaration(node.Parent) && node == node.Parent.Name()) { return nil } diff --git a/internal/transformers/typeeraser.go b/internal/transformers/typeeraser.go index 3973e1b9c7..e685b9ff23 100644 --- a/internal/transformers/typeeraser.go +++ b/internal/transformers/typeeraser.go @@ -87,6 +87,7 @@ func (tx *TypeEraserTransformer) visit(node *ast.Node) *ast.Node { return nil case ast.KindTypeAliasDeclaration, + ast.KindJSTypeAliasDeclaration, ast.KindInterfaceDeclaration, ast.KindNamespaceExportDeclaration: // TypeScript type-only declarations are elided. diff --git a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols index 2ea9dc696a..f76120be75 100644 --- a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols +++ b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols @@ -42,7 +42,9 @@ define("lib/ExtendedClass", ["deps/BaseClass"], const ExtendedClass = BaseClass.extends({ >ExtendedClass : Symbol(ExtendedClass, Decl(ExtendedClass.js, 8, 9)) +>BaseClass.extends : Symbol(extends, Decl(BaseClass.d.ts, 1, 21)) >BaseClass : Symbol(BaseClass, Decl(ExtendedClass.js, 6, 1)) +>extends : Symbol(extends, Decl(BaseClass.d.ts, 1, 21)) f: function() { >f : Symbol(f, Decl(ExtendedClass.js, 8, 45)) diff --git a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols.diff b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols.diff index d3b6c4eb67..0397def26c 100644 --- a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.symbols.diff @@ -14,12 +14,14 @@ const ExtendedClass = BaseClass.extends({ >ExtendedClass : Symbol(ExtendedClass, Decl(ExtendedClass.js, 8, 9)) ->BaseClass.extends : Symbol(BaseClass.extends, Decl(BaseClass.d.ts, 1, 21)) ++>BaseClass.extends : Symbol(extends, Decl(BaseClass.d.ts, 1, 21)) >BaseClass : Symbol(BaseClass, Decl(ExtendedClass.js, 6, 1)) ->extends : Symbol(BaseClass.extends, Decl(BaseClass.d.ts, 1, 21)) ++>extends : Symbol(extends, Decl(BaseClass.d.ts, 1, 21)) f: function() { >f : Symbol(f, Decl(ExtendedClass.js, 8, 45)) -@@= skipped -16, +14 lines =@@ +@@= skipped -16, +16 lines =@@ >module : Symbol(module, Decl(ExtendedClass.js, 15, 9)) module.exports = ExtendedClass diff --git a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.types b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.types index 0a23c37510..176cd065be 100644 --- a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.types +++ b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.types @@ -36,20 +36,20 @@ define("lib/ExtendedClass", ["deps/BaseClass"], * @returns */ (BaseClass) => { ->(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : (BaseClass: unknown) => any ->BaseClass : unknown +>(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : (BaseClass: typeof BaseClass) => any +>BaseClass : typeof BaseClass const ExtendedClass = BaseClass.extends({ ->ExtendedClass : any ->BaseClass.extends({ f: function() { return "something"; } }) : any ->BaseClass.extends : any ->BaseClass : unknown ->extends : any ->{ f: function() { return "something"; } } : { f: () => string; } +>ExtendedClass : new () => { f: () => "something"; } & BaseClass +>BaseClass.extends({ f: function() { return "something"; } }) : new () => { f: () => "something"; } & BaseClass +>BaseClass.extends : (a: A) => new () => A & BaseClass +>BaseClass : typeof BaseClass +>extends : (a: A) => new () => A & BaseClass +>{ f: function() { return "something"; } } : { f: () => "something"; } f: function() { ->f : () => string ->function() { return "something"; } : () => string +>f : () => "something" +>function() { return "something"; } : () => "something" return "something"; >"something" : "something" @@ -62,11 +62,11 @@ define("lib/ExtendedClass", ["deps/BaseClass"], >{} : {} module.exports = ExtendedClass ->module.exports = ExtendedClass : any +>module.exports = ExtendedClass : new () => { f: () => "something"; } & BaseClass >module.exports : any >module : {} >exports : any ->ExtendedClass : any +>ExtendedClass : new () => { f: () => "something"; } & BaseClass return module.exports; >module.exports : any diff --git a/testdata/baselines/reference/submodule/compiler/argumentsObjectCreatesRestForJs.types b/testdata/baselines/reference/submodule/compiler/argumentsObjectCreatesRestForJs.types index c975abf862..eefa62c814 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsObjectCreatesRestForJs.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsObjectCreatesRestForJs.types @@ -37,13 +37,13 @@ someRest(1, 2, 3); * @param {number} x - a thing */ function jsdocced(x) { arguments; } ->jsdocced : (x: any) => void ->x : any +>jsdocced : (x: number) => void +>x : number >arguments : IArguments jsdocced(1); >jsdocced(1) : void ->jsdocced : (x: any) => void +>jsdocced : (x: number) => void >1 : 1 function dontDoubleRest(x, ...y) { arguments; } diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor1_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor1_Js.types index 750afc8aa6..3c02f4aa76 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor1_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor1_Js.types @@ -10,18 +10,18 @@ class A { * @param {object} [foo={}] */ constructor(foo = {}) { ->foo : {} +>foo : any >{} : {} /** * @type object */ this.arguments = foo; ->this.arguments = foo : {} +>this.arguments = foo : any >this.arguments : any >this : this >arguments : any ->foo : {} +>foo : any } } diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor2_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor2_Js.types index 9e405aa310..8e1333a737 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor2_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor2_Js.types @@ -10,18 +10,18 @@ class A { * @param {object} [foo={}] */ constructor(foo = {}) { ->foo : {} +>foo : any >{} : {} /** * @type object */ this["arguments"] = foo; ->this["arguments"] = foo : {} +>this["arguments"] = foo : any >this["arguments"] : any >this : this >"arguments" : "arguments" ->foo : {} +>foo : any } } diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor3_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor3_Js.types index f1bff002bd..1d4ef25097 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor3_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor3_Js.types @@ -24,7 +24,7 @@ class B extends A { * @param {object} [foo={}] */ constructor(foo = {}) { ->foo : {} +>foo : any >{} : {} super(); @@ -35,11 +35,11 @@ class B extends A { * @type object */ this.foo = foo; ->this.foo = foo : {} +>this.foo = foo : any >this.foo : any >this : this >foo : any ->foo : {} +>foo : any /** * @type object diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.types index e725166520..7ab9056758 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.types @@ -10,7 +10,7 @@ class A { * @param {object} [foo={}] */ constructor(foo = {}) { ->foo : {} +>foo : any >{} : {} const key = "bar"; @@ -21,17 +21,17 @@ class A { * @type object */ this.foo = foo; ->this.foo = foo : {} +>this.foo = foo : any >this.foo : any >this : this >foo : any ->foo : {} +>foo : any /** * @type object */ const arguments = this.arguments; ->arguments : { bar: {}; } +>arguments : any >this.arguments : { bar: {}; } >this : this >arguments : { bar: {}; } @@ -40,35 +40,35 @@ class A { * @type object */ this.bar = arguments.bar; ->this.bar = arguments.bar : {} +>this.bar = arguments.bar : any >this.bar : any >this : this >bar : any ->arguments.bar : {} ->arguments : { bar: {}; } ->bar : {} +>arguments.bar : any +>arguments : any +>bar : any /** * @type object */ this.baz = arguments[key]; ->this.baz = arguments[key] : {} +>this.baz = arguments[key] : any >this.baz : any >this : this >baz : any ->arguments[key] : {} ->arguments : { bar: {}; } +>arguments[key] : any +>arguments : any >key : "bar" /** * @type object */ this.options = arguments; ->this.options = arguments : { bar: {}; } +>this.options = arguments : any >this.options : any >this : this >options : any ->arguments : { bar: {}; } +>arguments : any } get arguments() { diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor5_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor5_Js.types index 3f82b27a26..f1072a762b 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor5_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor5_Js.types @@ -19,18 +19,18 @@ class A { * @param {object} [foo={}] */ constructor(foo = {}) { ->foo : {} +>foo : any >{} : {} /** * @type object */ this.foo = foo; ->this.foo = foo : {} +>this.foo = foo : any >this.foo : any >this : this >foo : any ->foo : {} +>foo : any /** * @type object diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod1_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod1_Js.types index 1c832ae2d5..72b228c366 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod1_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod1_Js.types @@ -8,19 +8,19 @@ class A { * @param {object} [foo={}] */ m(foo = {}) { ->m : (foo?: {}) => void ->foo : {} +>m : (foo?: any) => void +>foo : any >{} : {} /** * @type object */ this.arguments = foo; ->this.arguments = foo : {} +>this.arguments = foo : any >this.arguments : any >this : this >arguments : any ->foo : {} +>foo : any } } diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod2_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod2_Js.types index 5303eb500e..c027df1933 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod2_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod2_Js.types @@ -8,19 +8,19 @@ class A { * @param {object} [foo={}] */ m(foo = {}) { ->m : (foo?: {}) => void ->foo : {} +>m : (foo?: any) => void +>foo : any >{} : {} /** * @type object */ this["arguments"] = foo; ->this["arguments"] = foo : {} +>this["arguments"] = foo : any >this["arguments"] : any >this : this >"arguments" : "arguments" ->foo : {} +>foo : any } } diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod3_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod3_Js.types index 41d13788ba..79b0bed3d5 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod3_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod3_Js.types @@ -22,19 +22,19 @@ class B extends A { * @param {object} [foo={}] */ m(foo = {}) { ->m : (foo?: {}) => void ->foo : {} +>m : (foo?: any) => void +>foo : any >{} : {} /** * @type object */ this.x = foo; ->this.x = foo : {} +>this.x = foo : any >this.x : any >this : this >x : any ->foo : {} +>foo : any /** * @type object diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.types index c0439ed232..719a0e7a2c 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.types @@ -8,8 +8,8 @@ class A { * @param {object} [foo={}] */ m(foo = {}) { ->m : (foo?: {}) => void ->foo : {} +>m : (foo?: any) => void +>foo : any >{} : {} const key = "bar"; @@ -20,17 +20,17 @@ class A { * @type object */ this.foo = foo; ->this.foo = foo : {} +>this.foo = foo : any >this.foo : any >this : this >foo : any ->foo : {} +>foo : any /** * @type object */ const arguments = this.arguments; ->arguments : { bar: {}; } +>arguments : any >this.arguments : { bar: {}; } >this : this >arguments : { bar: {}; } @@ -39,35 +39,35 @@ class A { * @type object */ this.bar = arguments.bar; ->this.bar = arguments.bar : {} +>this.bar = arguments.bar : any >this.bar : any >this : this >bar : any ->arguments.bar : {} ->arguments : { bar: {}; } ->bar : {} +>arguments.bar : any +>arguments : any +>bar : any /** * @type object */ this.baz = arguments[key]; ->this.baz = arguments[key] : {} +>this.baz = arguments[key] : any >this.baz : any >this : this >baz : any ->arguments[key] : {} ->arguments : { bar: {}; } +>arguments[key] : any +>arguments : any >key : "bar" /** * @type object */ this.options = arguments; ->this.options = arguments : { bar: {}; } +>this.options = arguments : any >this.options : any >this : this >options : any ->arguments : { bar: {}; } +>arguments : any } get arguments() { diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod5_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod5_Js.types index 8e4c25ed66..ca0dbe7f59 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod5_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod5_Js.types @@ -17,19 +17,19 @@ class A { * @param {object} [foo={}] */ m(foo = {}) { ->m : (foo?: {}) => void ->foo : {} +>m : (foo?: any) => void +>foo : any >{} : {} /** * @type object */ this.foo = foo; ->this.foo = foo : {} +>this.foo = foo : any >this.foo : any >this : this >foo : any ->foo : {} +>foo : any /** * @type object diff --git a/testdata/baselines/reference/submodule/compiler/arrowFunctionJSDocAnnotation.types b/testdata/baselines/reference/submodule/compiler/arrowFunctionJSDocAnnotation.types index 8adc8041cf..962a6582b5 100644 --- a/testdata/baselines/reference/submodule/compiler/arrowFunctionJSDocAnnotation.types +++ b/testdata/baselines/reference/submodule/compiler/arrowFunctionJSDocAnnotation.types @@ -22,9 +22,9 @@ const x = identity( * @returns {number=} */ param => param ->param => param : (param: any) => any ->param : any ->param : any +>param => param : (param: number) => number | undefined +>param : number +>param : number ); diff --git a/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt new file mode 100644 index 0000000000..50e261254c --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt @@ -0,0 +1,18 @@ +file.js(11,1): error TS2322: Type '"z"' is not assignable to type '"x" | "y"'. + + +==== file.js (1 errors) ==== + // @ts-check + const obj = { + x: 1, + y: 2 + }; + + /** + * @type {keyof typeof obj} + */ + let selected = "x"; + selected = "z"; // should fail + ~~~~~~~~ +!!! error TS2322: Type '"z"' is not assignable to type '"x" | "y"'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.types b/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.types index a05fb67308..c8b0666cfc 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsObjectLiteralHasCheckedKeyof.types @@ -20,11 +20,11 @@ const obj = { * @type {keyof typeof obj} */ let selected = "x"; ->selected : string +>selected : "x" | "y" >"x" : "x" selected = "z"; // should fail >selected = "z" : "z" ->selected : string +>selected : "x" | "y" >"z" : "z" diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols index 7d77ac61c1..85b419e608 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols @@ -23,8 +23,9 @@ export = Foo; /** @typedef {(foo: Foo) => string} FooFun */ >foo : Symbol(foo, Decl(something.js, 2, 15)) ->Foo : Symbol(Foo) +>Foo : Symbol(Foo, Decl(something.js, 4, 47)) module.exports = /** @type {FooFun} */(void 0); >module : Symbol(module, Decl(file.ts, 5, 7)) +>FooFun : Symbol(FooFun, Decl(something.js, 4, 47)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff index d6f1070c6a..3a6c75588a 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff @@ -14,11 +14,12 @@ /** @typedef {(foo: Foo) => string} FooFun */ +>foo : Symbol(foo, Decl(something.js, 2, 15)) -+>Foo : Symbol(Foo) ++>Foo : Symbol(Foo, Decl(something.js, 4, 47)) module.exports = /** @type {FooFun} */(void 0); ->module.exports : Symbol(module.exports, Decl(something.js, 0, 0)) ->module : Symbol(export=, Decl(something.js, 0, 0)) ->exports : Symbol(export=, Decl(something.js, 0, 0)) +>module : Symbol(module, Decl(file.ts, 5, 7)) ++>FooFun : Symbol(FooFun, Decl(something.js, 4, 47)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types index dcce2a86e6..9f8cb54598 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types @@ -20,15 +20,19 @@ export = Foo; === something.js === /** @typedef {typeof import("./file")} Foo */ +>Foo : any /** @typedef {(foo: Foo) => string} FooFun */ +>FooFun : any +>foo : typeof Foo module.exports = /** @type {FooFun} */(void 0); ->module.exports = /** @type {FooFun} */(void 0) : undefined +>module.exports = /** @type {FooFun} */(void 0) : (foo: typeof Foo) => string >module.exports : any >module : any >exports : any ->(void 0) : undefined +>(void 0) : (foo: typeof Foo) => string +>void 0 : (foo: typeof Foo) => string >void 0 : undefined >0 : 0 diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt new file mode 100644 index 0000000000..5b7f3af8e4 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt @@ -0,0 +1,19 @@ +a.js(8,16): error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b + + +==== a.js (1 errors) ==== + /** + * @typedef {Object} Foo + * @property {boolean} a + * @property {boolean} b + */ + + /** @type {Foo} */ + export default { c: false }; + ~~~~~~~~~~~~ +!!! error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b + +==== b.js (0 errors) ==== + import a from "./a"; + a; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols index df8b662a25..f7c628c471 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols @@ -10,7 +10,7 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo) +>Foo : Symbol(Foo, Decl(a.js, 7, 28)) export default { c: false }; >c : Symbol(c, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff index eaaf5c4453..2cb0989496 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff @@ -4,7 +4,7 @@ */ /** @type {Foo} */ -+>Foo : Symbol(Foo) ++>Foo : Symbol(Foo, Decl(a.js, 7, 28)) + export default { c: false }; >c : Symbol(c, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.types index 64817d9e4c..fbf2b1f948 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.types @@ -5,20 +5,27 @@ === a.js === /** * @typedef {Object} Foo +>Foo : any + * @property {boolean} a +>a : any + * @property {boolean} b +>b : any + */ /** @type {Foo} */ export default { c: false }; +>{ c: false } : Foo >{ c: false } : { c: boolean; } >c : boolean >false : false === b.js === import a from "./a"; ->a : { c: boolean; } +>a : Foo a; ->a : { c: boolean; } +>a : Foo diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt new file mode 100644 index 0000000000..9b6f314703 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt @@ -0,0 +1,19 @@ +b.js(2,16): error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b + + +==== a.ts (0 errors) ==== + export interface Foo { + a: number; + b: number; + } + +==== b.js (1 errors) ==== + /** @type {import("./a").Foo} */ + export default { c: false }; + ~~~~~~~~~~~~ +!!! error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b + +==== c.js (0 errors) ==== + import b from "./b"; + b; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.types index 0a84f62bfb..3e5351e9ba 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.types @@ -14,14 +14,15 @@ export interface Foo { === b.js === /** @type {import("./a").Foo} */ export default { c: false }; +>{ c: false } : Foo >{ c: false } : { c: boolean; } >c : boolean >false : false === c.js === import b from "./b"; ->b : { c: boolean; } +>b : Foo b; ->b : { c: boolean; } +>b : Foo diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt new file mode 100644 index 0000000000..3938bc6f29 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt @@ -0,0 +1,21 @@ +a.js(10,16): error TS2739: Type '{ c: number; }' is missing the following properties from type 'Foo': a, b + + +==== a.js (1 errors) ==== + /** + * @typedef {Object} Foo + * @property {boolean} a + * @property {boolean} b + */ + + const bar = { c: 1 }; + + /** @type {Foo} */ + export default bar; + ~~~ +!!! error TS2739: Type '{ c: number; }' is missing the following properties from type 'Foo': a, b + +==== b.js (0 errors) ==== + import a from "./a"; + a; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols index 98c268bf38..f478826e83 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols @@ -14,7 +14,7 @@ const bar = { c: 1 }; >c : Symbol(c, Decl(a.js, 6, 13)) /** @type {Foo} */ ->Foo : Symbol(Foo) +>Foo : Symbol(Foo, Decl(a.js, 6, 21)) export default bar; >bar : Symbol(bar, Decl(a.js, 6, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff index 027c03a16f..0de6c3b6b3 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff @@ -4,7 +4,7 @@ >c : Symbol(c, Decl(a.js, 6, 13)) /** @type {Foo} */ -+>Foo : Symbol(Foo) ++>Foo : Symbol(Foo, Decl(a.js, 6, 21)) + export default bar; >bar : Symbol(bar, Decl(a.js, 6, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.types index d74c8372b9..472f1f9e39 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.types @@ -5,8 +5,14 @@ === a.js === /** * @typedef {Object} Foo +>Foo : any + * @property {boolean} a +>a : any + * @property {boolean} b +>b : any + */ const bar = { c: 1 }; @@ -17,12 +23,13 @@ const bar = { c: 1 }; /** @type {Foo} */ export default bar; +>bar : Foo >bar : { c: number; } === b.js === import a from "./a"; ->a : { c: number; } +>a : Foo a; ->a : { c: number; } +>a : Foo diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt new file mode 100644 index 0000000000..f7ce3b5548 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt @@ -0,0 +1,14 @@ +a.js(6,16): error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. + + +==== a.js (1 errors) ==== + /** + * @typedef {number} Foo + */ + + /** @type {Foo} */ + export default ""; + ~~ +!!! error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols index 8515c3b151..a4cdb4aa24 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols @@ -8,7 +8,7 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo) +>Foo : Symbol(Foo, Decl(a.js, 5, 18)) export default ""; diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff index dd5ff7099f..267d68ece8 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff @@ -10,7 +10,7 @@ */ /** @type {Foo} */ -+>Foo : Symbol(Foo) ++>Foo : Symbol(Foo, Decl(a.js, 5, 18)) + export default ""; diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.types index 0a31928944..ffe0cd121c 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.types @@ -3,12 +3,15 @@ === checkJsdocTypeTagOnExportAssignment4.js === === a.js === - /** * @typedef {number} Foo +>Foo : any + */ /** @type {Foo} */ export default ""; +>"" : number +>"" : "" diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols index c395ff57f6..d35080a8e7 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols @@ -10,7 +10,7 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo) +>Foo : Symbol(Foo, Decl(a.js, 7, 30)) export default { a: 1, b: 1 }; >a : Symbol(a, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff index 0285760f0d..cc3892dce9 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff @@ -4,7 +4,7 @@ */ /** @type {Foo} */ -+>Foo : Symbol(Foo) ++>Foo : Symbol(Foo, Decl(a.js, 7, 30)) + export default { a: 1, b: 1 }; >a : Symbol(a, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.types index 2ea78c1003..0f6a37eeb8 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.types @@ -5,12 +5,19 @@ === a.js === /** * @typedef {Object} Foo +>Foo : any + * @property {number} a +>a : any + * @property {number} b +>b : any + */ /** @type {Foo} */ export default { a: 1, b: 1 }; +>{ a: 1, b: 1 } : Foo >{ a: 1, b: 1 } : { a: number; b: number; } >a : number >1 : 1 @@ -19,8 +26,8 @@ export default { a: 1, b: 1 }; === b.js === import a from "./a"; ->a : { a: number; b: number; } +>a : Foo a; ->a : { a: number; b: number; } +>a : Foo diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols index b197ce6e43..1ded111234 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols @@ -10,7 +10,7 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo) +>Foo : Symbol(Foo, Decl(a.js, 7, 36)) export default { a: 1, b: 1, c: 1 }; >a : Symbol(a, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff index 8419849105..3bcc91f392 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff @@ -4,7 +4,7 @@ */ /** @type {Foo} */ -+>Foo : Symbol(Foo) ++>Foo : Symbol(Foo, Decl(a.js, 7, 36)) + export default { a: 1, b: 1, c: 1 }; >a : Symbol(a, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.types index 7c62aad49d..f13666367e 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.types @@ -5,12 +5,19 @@ === a.js === /** * @typedef {Object} Foo +>Foo : any + * @property {number} a +>a : any + * @property {number} b +>b : any + */ /** @type {Foo} */ export default { a: 1, b: 1, c: 1 }; +>{ a: 1, b: 1, c: 1 } : Foo >{ a: 1, b: 1, c: 1 } : { a: number; b: number; c: number; } >a : number >1 : 1 @@ -21,8 +28,8 @@ export default { a: 1, b: 1, c: 1 }; === b.js === import a from "./a"; ->a : { a: number; b: number; c: number; } +>a : Foo a; ->a : { a: number; b: number; c: number; } +>a : Foo diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols index 27a46d588e..8403bfccb8 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols @@ -16,7 +16,7 @@ const abc = { a: 1, b: 1, c: 1 }; >c : Symbol(c, Decl(a.js, 6, 25)) /** @type {Foo} */ ->Foo : Symbol(Foo) +>Foo : Symbol(Foo, Decl(a.js, 6, 33)) export default abc; >abc : Symbol(abc, Decl(a.js, 6, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff index aef2f4d6ce..7455da0598 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff @@ -4,7 +4,7 @@ >c : Symbol(c, Decl(a.js, 6, 25)) /** @type {Foo} */ -+>Foo : Symbol(Foo) ++>Foo : Symbol(Foo, Decl(a.js, 6, 33)) + export default abc; >abc : Symbol(abc, Decl(a.js, 6, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.types index b7766d4109..fba666e3db 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.types @@ -5,8 +5,14 @@ === a.js === /** * @typedef {Object} Foo +>Foo : any + * @property {number} a +>a : any + * @property {number} b +>b : any + */ const abc = { a: 1, b: 1, c: 1 }; @@ -21,12 +27,13 @@ const abc = { a: 1, b: 1, c: 1 }; /** @type {Foo} */ export default abc; +>abc : Foo >abc : { a: number; b: number; c: number; } === b.js === import a from "./a"; ->a : { a: number; b: number; c: number; } +>a : Foo a; ->a : { a: number; b: number; c: number; } +>a : Foo diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols index afe5a7da4f..5d3601dc5f 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols @@ -10,7 +10,7 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo) +>Foo : Symbol(Foo, Decl(a.js, 10, 1)) export default { a: 'a', diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff index b86b9ae397..9708171c07 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff @@ -4,7 +4,7 @@ */ /** @type {Foo} */ -+>Foo : Symbol(Foo) ++>Foo : Symbol(Foo, Decl(a.js, 10, 1)) + export default { a: 'a', diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.types index b8c62e6b5f..0360a6c914 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.types @@ -5,12 +5,19 @@ === a.js === /** * @typedef Foo +>Foo : any + * @property {string} a +>a : any + * @property {'b'} b +>b : any + */ /** @type {Foo} */ export default { +>{ a: 'a', b: 'b'} : Foo >{ a: 'a', b: 'b'} : { a: string; b: string; } a: 'a', diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt index 784c7e1822..dbf4731034 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt @@ -1,11 +1,10 @@ -index.js(16,17): error TS7006: Parameter 'a' implicitly has an 'any' type. -index.js(16,20): error TS7006: Parameter 'b' implicitly has an 'any' type. -index.js(18,5): error TS2554: Expected 2 arguments, but got 1. -index.js(27,17): error TS7006: Parameter 'a' implicitly has an 'any' type. -index.js(29,5): error TS2554: Expected 2 arguments, but got 1. +index.js(17,15): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. + Type 'undefined' is not assignable to type 'number'. +index.js(28,15): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. + Type 'undefined' is not assignable to type 'number'. -==== index.js (5 errors) ==== +==== index.js (2 errors) ==== /** * * @param {number} num @@ -22,15 +21,11 @@ index.js(29,5): error TS2554: Expected 2 arguments, but got 1. * @param [b] */ function self(a, b) { - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'b' implicitly has an 'any' type. acceptNum(b); // error + ~ +!!! error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. +!!! error TS2345: Type 'undefined' is not assignable to type 'number'. self(""); - ~~~~ -!!! error TS2554: Expected 2 arguments, but got 1. -!!! related TS6210 index.js:16:20: An argument for 'b' was not provided. self("", undefined); }; @@ -40,13 +35,11 @@ index.js(29,5): error TS2554: Expected 2 arguments, but got 1. * @param {number} [b] */ function self(a, b) { - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. acceptNum(b); // error + ~ +!!! error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. +!!! error TS2345: Type 'undefined' is not assignable to type 'number'. self(""); - ~~~~ -!!! error TS2554: Expected 2 arguments, but got 1. -!!! related TS6210 index.js:27:20: An argument for 'b' was not provided. self("", undefined); }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.types b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.types index de660c400e..6da5e45104 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.types +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.types @@ -6,39 +6,43 @@ * @param {number} num */ function acceptNum(num) {} ->acceptNum : (num: any) => void ->num : any +>acceptNum : (num: number) => void +>num : number /** * @typedef {(a: string, b: number) => void} Fn +>Fn : any +>a : string +>b : number + */ /** @type {Fn} */ const fn1 = ->fn1 : (a: any, b: any) => void +>fn1 : (a: string, b: number) => void /** * @param [b] */ function self(a, b) { ->function self(a, b) { acceptNum(b); // error self(""); self("", undefined); } : (a: any, b: any) => void ->self : (a: any, b: any) => void ->a : any ->b : any +>function self(a, b) { acceptNum(b); // error self(""); self("", undefined); } : (a: string, b?: number | undefined) => void +>self : (a: string, b?: number | undefined) => void +>a : string +>b : number | undefined acceptNum(b); // error >acceptNum(b) : void ->acceptNum : (num: any) => void ->b : any +>acceptNum : (num: number) => void +>b : number | undefined self(""); >self("") : void ->self : (a: any, b: any) => void +>self : (a: string, b?: number | undefined) => void >"" : "" self("", undefined); >self("", undefined) : void ->self : (a: any, b: any) => void +>self : (a: string, b?: number | undefined) => void >"" : "" >undefined : undefined @@ -46,30 +50,30 @@ const fn1 = /** @type {Fn} */ const fn2 = ->fn2 : (a: any, b: any) => void +>fn2 : (a: string, b: number) => void /** * @param {number} [b] */ function self(a, b) { ->function self(a, b) { acceptNum(b); // error self(""); self("", undefined); } : (a: any, b: any) => void ->self : (a: any, b: any) => void ->a : any ->b : any +>function self(a, b) { acceptNum(b); // error self(""); self("", undefined); } : (a: string, b?: number | undefined) => void +>self : (a: string, b?: number | undefined) => void +>a : string +>b : number | undefined acceptNum(b); // error >acceptNum(b) : void ->acceptNum : (num: any) => void ->b : any +>acceptNum : (num: number) => void +>b : number | undefined self(""); >self("") : void ->self : (a: any, b: any) => void +>self : (a: string, b?: number | undefined) => void >"" : "" self("", undefined); >self("", undefined) : void ->self : (a: any, b: any) => void +>self : (a: string, b?: number | undefined) => void >"" : "" >undefined : undefined diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols index 02ea1aa643..9ab915f497 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols @@ -3,19 +3,15 @@ === index.js === /** * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs ->K : Symbol(K, Decl(index.js, 1, 16)) ->B : Symbol(B) ->fn : Symbol(fn, Decl(index.js, 1, 32)) ->a : Symbol(a, Decl(index.js, 1, 38)) ->A : Symbol(A) ->b : Symbol(b, Decl(index.js, 1, 43)) ->B : Symbol(B) ->thing : Symbol(thing, Decl(index.js, 1, 58)) ->B : Symbol(B) ->K : Symbol(K, Decl(index.js, 1, 16)) +>Funcs : Symbol(Funcs, Decl(index.js, 14, 1)) * @template A +>A : Symbol(A, Decl(index.js, 14, 1)) + * @template {Record} B +>B : Symbol(B, Decl(index.js, 14, 1)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) + */ /** diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff index 4d2498d9e1..a681e0dea7 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff @@ -4,17 +4,15 @@ === index.js === /** * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs -+>K : Symbol(K, Decl(index.js, 1, 16)) -+>B : Symbol(B) -+>fn : Symbol(fn, Decl(index.js, 1, 32)) -+>a : Symbol(a, Decl(index.js, 1, 38)) -+>A : Symbol(A) -+>b : Symbol(b, Decl(index.js, 1, 43)) -+>B : Symbol(B) -+>thing : Symbol(thing, Decl(index.js, 1, 58)) -+>B : Symbol(B) -+>K : Symbol(K, Decl(index.js, 1, 16)) ++>Funcs : Symbol(Funcs, Decl(index.js, 14, 1)) + * @template A ++>A : Symbol(A, Decl(index.js, 14, 1)) ++ * @template {Record} B ++>B : Symbol(B, Decl(index.js, 14, 1)) ++>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) ++ */ + + /** diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types index b329e74838..d1a366ae78 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types @@ -3,6 +3,12 @@ === index.js === /** * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs +>Funcs : Funcs +>fn : (a: A, b: B) => void +>a : A +>b : B +>thing : B[K] + * @template A * @template {Record} B */ @@ -14,30 +20,31 @@ * @returns {[A, B]} */ function foo(fns) { ->foo : (fns: any) => null ->fns : any +>foo : >(fns: Funcs) => [A, B] +>fns : Funcs return /** @type {any} */ (null); ->(null) : null +>(null) : any +>null : any } const result = foo({ ->result : null ->foo({ bar: { fn: /** @param {string} a */ (a) => {}, thing: "asd", },}) : null ->foo : (fns: any) => null ->{ bar: { fn: /** @param {string} a */ (a) => {}, thing: "asd", },} : { bar: { fn: (a: any) => void; thing: string; }; } +>result : [string, { bar: string; }] +>foo({ bar: { fn: /** @param {string} a */ (a) => {}, thing: "asd", },}) : [string, { bar: string; }] +>foo : >(fns: Funcs) => [A, B] +>{ bar: { fn: /** @param {string} a */ (a) => {}, thing: "asd", },} : { bar: { fn: (a: string) => void; thing: string; }; } bar: { ->bar : { fn: (a: any) => void; thing: string; } ->{ fn: /** @param {string} a */ (a) => {}, thing: "asd", } : { fn: (a: any) => void; thing: string; } +>bar : { fn: (a: string) => void; thing: string; } +>{ fn: /** @param {string} a */ (a) => {}, thing: "asd", } : { fn: (a: string) => void; thing: string; } fn: ->fn : (a: any) => void +>fn : (a: string) => void /** @param {string} a */ (a) => {}, ->(a) => {} : (a: any) => void ->a : any +>(a) => {} : (a: string) => void +>a : string thing: "asd", >thing : string diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types index 5fce33cb18..87ac4ac308 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types @@ -7,41 +7,42 @@ * @returns {T} */ function filter(predicate) { ->filter : (predicate: any) => null ->predicate : any +>filter : (predicate: (value: T, index: number) => boolean) => T +>predicate : (value: T, index: number) => boolean return /** @type {any} */ (null); ->(null) : null +>(null) : any +>null : any } const a = filter( ->a : null ->filter( /** * @param {number} [pose] */ (pose) => true) : null ->filter : (predicate: any) => null +>a : number | undefined +>filter( /** * @param {number} [pose] */ (pose) => true) : number | undefined +>filter : (predicate: (value: T, index: number) => boolean) => T /** * @param {number} [pose] */ (pose) => true ->(pose) => true : (pose: any) => boolean ->pose : any +>(pose) => true : (pose?: number | undefined) => true +>pose : number | undefined >true : true ); const b = filter( ->b : null ->filter( /** * @param {number} [pose] * @param {number} [_] */ (pose, _) => true) : null ->filter : (predicate: any) => null +>b : number | undefined +>filter( /** * @param {number} [pose] * @param {number} [_] */ (pose, _) => true) : number | undefined +>filter : (predicate: (value: T, index: number) => boolean) => T /** * @param {number} [pose] * @param {number} [_] */ (pose, _) => true ->(pose, _) => true : (pose: any, _: any) => boolean ->pose : any ->_ : any +>(pose, _) => true : (pose?: number | undefined, _?: number | undefined) => true +>pose : number | undefined +>_ : number | undefined >true : true ); diff --git a/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.types b/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.types index a86984c6cd..517ac36f3b 100644 --- a/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.types +++ b/testdata/baselines/reference/submodule/compiler/controlFlowInstanceof.types @@ -276,17 +276,17 @@ function AtTop(val) { this.val = val } /** @type {*} */ var v = 1; ->v : number +>v : any >1 : 1 if (v instanceof AtTop) { >v instanceof AtTop : boolean ->v : number +>v : any >AtTop : (val: any) => void v.val >v.val : any ->v : number +>v : {} >val : any } diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt deleted file mode 100644 index 53a0231319..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt +++ /dev/null @@ -1,43 +0,0 @@ -input.js(5,7): error TS7005: Variable 'something' implicitly has an 'any' type. - - -==== input.js (1 errors) ==== - /** - * @typedef {{ } & { name?: string }} P - */ - - const something = /** @type {*} */(null); - ~~~~~~~~~ -!!! error TS7005: Variable 'something' implicitly has an 'any' type. - - export let vLet = /** @type {P} */(something); - export const vConst = /** @type {P} */(something); - - export function fn(p = /** @type {P} */(something)) {} - - /** @param {number} req */ - export function fnWithRequiredDefaultParam(p = /** @type {P} */(something), req) {} - - export class C { - field = /** @type {P} */(something); - /** @optional */ optField = /** @type {P} */(something); // not a thing - /** @readonly */ roFiled = /** @type {P} */(something); - method(p = /** @type {P} */(something)) {} - /** @param {number} req */ - methodWithRequiredDefault(p = /** @type {P} */(something), req) {} - - constructor(ctorField = /** @type {P} */(something)) {} - - get x() { return /** @type {P} */(something) } - set x(v) { } - } - - export default /** @type {P} */(something); - - // allows `undefined` on the input side, thanks to the initializer - /** - * - * @param {P} x - * @param {number} b - */ - export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitClassAccessorsJs1.types b/testdata/baselines/reference/submodule/compiler/declarationEmitClassAccessorsJs1.types index df731ebadf..e8ac74c47f 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitClassAccessorsJs1.types +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitClassAccessorsJs1.types @@ -21,7 +21,7 @@ export class VFile { */ set path(path) { >path : string ->path : string +>path : string | URL } } diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitClassSetAccessorParamNameInJs.types b/testdata/baselines/reference/submodule/compiler/declarationEmitClassSetAccessorParamNameInJs.types index dd5665f03f..be39b7f5a6 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitClassSetAccessorParamNameInJs.types +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitClassSetAccessorParamNameInJs.types @@ -12,7 +12,7 @@ export class Foo { * @param {string} baz Baz. */ set bar(baz) {} ->bar : any ->baz : any +>bar : string +>baz : string } diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.types b/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.types index 602610b8d4..1217753d64 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.types +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessorsJs1.types @@ -49,7 +49,7 @@ export const obj2 = { */ set x(a) {}, >x : string ->a : string +>a : number }; @@ -71,16 +71,16 @@ export const obj3 = { }; export const obj4 = { ->obj4 : { x: any; } ->{ /** * my awesome setter * @param {number} a */ set x(a) {},} : { x: any; } +>obj4 : { x: number; } +>{ /** * my awesome setter * @param {number} a */ set x(a) {},} : { x: number; } /** * my awesome setter * @param {number} a */ set x(a) {}, ->x : any ->a : any +>x : number +>a : number }; diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt index 602c5117a3..f18be0c0f6 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt @@ -1,13 +1,16 @@ +input.js(5,48): error TS2304: Cannot find name 'P'. input.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== input.js (2 errors) ==== +==== input.js (3 errors) ==== /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ /** * @template P * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ + ~ +!!! error TS2304: Cannot find name 'P'. /** * @type {StatelessComponent} diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols index 87f6849fb7..1108ab436e 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols @@ -18,7 +18,9 @@ const MyComponent = () => /* @type {any} */(null); >MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5)) MyComponent.defaultProps = { +>MyComponent.defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23)) >MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5)) +>defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23)) color: "red" >color : Symbol(color, Decl(input.js, 11, 28)) diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff index 35201bad83..4a522827b0 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff @@ -21,14 +21,13 @@ +>MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5)) MyComponent.defaultProps = { -->MyComponent.defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23)) + >MyComponent.defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23)) ->MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5), Decl(input.js, 9, 50)) -->defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23)) +>MyComponent : Symbol(MyComponent, Decl(input.js, 9, 5)) + >defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23)) color: "red" - >color : Symbol(color, Decl(input.js, 11, 28)) -@@= skipped -22, +24 lines =@@ +@@= skipped -22, +26 lines =@@ }; const MyComponent2 = () => null; diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types index e83844de53..6168f17d72 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types @@ -2,24 +2,28 @@ === input.js === /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ +>MyComponentProps : any +>color : "blue" | "red" /** * @template P * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ +>StatelessComponent : any +>defaultProps : P /** * @type {StatelessComponent} */ const MyComponent = () => /* @type {any} */(null); ->MyComponent : { (): any; defaultProps: { color: string; }; } +>MyComponent : { (): any; defaultProps?: P; } >() => /* @type {any} */(null) : { (): any; defaultProps: { color: string; }; } >(null) : null MyComponent.defaultProps = { >MyComponent.defaultProps = { color: "red"} : { color: string; } ->MyComponent.defaultProps : { color: string; } ->MyComponent : { (): any; defaultProps: { color: string; }; } ->defaultProps : { color: string; } +>MyComponent.defaultProps : P +>MyComponent : { (): any; defaultProps?: P; } +>defaultProps : P >{ color: "red"} : { color: string; } color: "red" @@ -51,7 +55,7 @@ MyComponent2.defaultProps = { * @type {StatelessComponent} */ const check = MyComponent2; ->check : { (): any; defaultProps: { color: string; }; } +>check : { (): any; defaultProps?: P; } >MyComponent2 : { (): any; defaultProps: { color: string; }; } /** @@ -59,8 +63,8 @@ const check = MyComponent2; * @param {{ props: MyComponentProps }} p */ function expectLiteral(p) {} ->expectLiteral : (p: any) => void ->p : any +>expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void +>p : { props: { color: "blue" | "red"; }; } function foo() { >foo : () => void @@ -79,7 +83,7 @@ function foo() { expectLiteral(this); >expectLiteral(this) : void ->expectLiteral : (p: any) => void +>expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void >this : any } @@ -100,7 +104,7 @@ module.exports = { expectLiteral({ props: module.exports }); >expectLiteral({ props: module.exports }) : void ->expectLiteral : (p: any) => void +>expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void >{ props: module.exports } : { props: any; } >props : any >module.exports : any diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionSymbolPropertyJs.types b/testdata/baselines/reference/submodule/compiler/expandoFunctionSymbolPropertyJs.types index 40716d3972..82846722f7 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionSymbolPropertyJs.types +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionSymbolPropertyJs.types @@ -21,7 +21,7 @@ import { symb } from "./types"; * @returns {import("./types").TestSymb} */ export function test() { ->test : () => { (): void; inner[symb]: boolean; } +>test : () => TestSymb function inner() {} >inner : { (): void; inner[symb]: boolean; } diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols index 99e6ed71b5..111f4d447d 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols @@ -7,7 +7,7 @@ */ /** @type {NumberLike[]} */export default ([ ]); ->NumberLike : Symbol(NumberLike) +>NumberLike : Symbol(NumberLike, Decl(a.js, 5, 48)) === b.ts === import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff index 57d8df4129..3d847d134a 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff @@ -11,7 +11,7 @@ */ /** @type {NumberLike[]} */export default ([ ]); -+>NumberLike : Symbol(NumberLike) ++>NumberLike : Symbol(NumberLike, Decl(a.js, 5, 48)) === b.ts === import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types index 8f0db308a6..f135d8d52e 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types @@ -4,18 +4,21 @@ /** * A number, or a string containing a number. * @typedef {(number|string)} NumberLike +>NumberLike : any + */ /** @type {NumberLike[]} */export default ([ ]); +>([ ]) : (string | number)[] >([ ]) : undefined[] >[ ] : undefined[] === b.ts === import A from './a' ->A : any[] +>A : (string | number)[] A[0] ->A[0] : any ->A : any[] +>A[0] : string | number +>A : (string | number)[] >0 : 0 diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols index fe525263a6..846041b992 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols @@ -1,13 +1,13 @@ //// [tests/cases/compiler/exportDefaultWithJSDoc2.ts] //// === a.js === - /** * A number, or a string containing a number. * @typedef {(number|string)} NumberLike */ export default /** @type {NumberLike[]} */([ ]); +>NumberLike : Symbol(NumberLike, Decl(a.js, 5, 48)) === b.ts === import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols.diff new file mode 100644 index 0000000000..28dc2ea488 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols.diff @@ -0,0 +1,17 @@ +--- old.exportDefaultWithJSDoc2.symbols ++++ new.exportDefaultWithJSDoc2.symbols +@@= skipped -0, +0 lines =@@ + //// [tests/cases/compiler/exportDefaultWithJSDoc2.ts] //// + + === a.js === +- + /** + * A number, or a string containing a number. + * @typedef {(number|string)} NumberLike + */ + + export default /** @type {NumberLike[]} */([ ]); ++>NumberLike : Symbol(NumberLike, Decl(a.js, 5, 48)) + + === b.ts === + import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types index 8347487f4e..157888535f 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types @@ -4,18 +4,21 @@ /** * A number, or a string containing a number. * @typedef {(number|string)} NumberLike +>NumberLike : any + */ export default /** @type {NumberLike[]} */([ ]); ->([ ]) : undefined[] +>([ ]) : (string | number)[] +>[ ] : (string | number)[] >[ ] : undefined[] === b.ts === import A from './a' ->A : any[] +>A : (string | number)[] A[0] ->A[0] : any ->A : any[] +>A[0] : string | number +>A : (string | number)[] >0 : 0 diff --git a/testdata/baselines/reference/submodule/compiler/extendedUnicodePlaneIdentifiersJSDoc.types b/testdata/baselines/reference/submodule/compiler/extendedUnicodePlaneIdentifiersJSDoc.types index d8a79b3b31..859dc355e0 100644 --- a/testdata/baselines/reference/submodule/compiler/extendedUnicodePlaneIdentifiersJSDoc.types +++ b/testdata/baselines/reference/submodule/compiler/extendedUnicodePlaneIdentifiersJSDoc.types @@ -7,16 +7,16 @@ * @param {number} 𝑀 */ function foo(𝑚, 𝑀) { ->foo : (𝑚: any, 𝑀: any) => void ->𝑚 : any ->𝑀 : any +>foo : (𝑚: number, 𝑀: number) => void +>𝑚 : number +>𝑀 : number console.log(𝑀 + 𝑚); >console.log(𝑀 + 𝑚) : void >console.log : (...data: any[]) => void >console : Console >log : (...data: any[]) => void ->𝑀 + 𝑚 : any ->𝑀 : any ->𝑚 : any +>𝑀 + 𝑚 : number +>𝑀 : number +>𝑚 : number } diff --git a/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt new file mode 100644 index 0000000000..3f5fe39172 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.errors.txt @@ -0,0 +1,15 @@ +usage.js(1,12): error TS2304: Cannot find name 'Bar'. + + +==== interfaces.d.ts (0 errors) ==== + export interface Bar { + prop: string + } + +==== usage.js (1 errors) ==== + /** @type {Bar} */ + ~~~ +!!! error TS2304: Cannot find name 'Bar'. + export let bar; + + /** @typedef {import('./interfaces').Bar} Bar */ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.types b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.types index 8ac7c588a1..fad53ca758 100644 --- a/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.types +++ b/testdata/baselines/reference/submodule/compiler/importTypeResolutionJSDocEOF.types @@ -9,6 +9,6 @@ export interface Bar { === usage.js === /** @type {Bar} */ export let bar; ->bar : any +>bar : Bar /** @typedef {import('./interfaces').Bar} Bar */ diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols index 7e036a0b6a..17370bd147 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols @@ -41,11 +41,15 @@ class X extends Test { >super : Symbol(Test, Decl(Test.js, 0, 0)) if (options.test) { +>options.test : Symbol(test, Decl(index.js, 17, 1)) >options : Symbol(options, Decl(index.js, 11, 16)) +>test : Symbol(test, Decl(index.js, 17, 1)) this.test = new options.test(); >this : Symbol(X, Decl(index.js, 0, 33)) +>options.test : Symbol(test, Decl(index.js, 17, 1)) >options : Symbol(options, Decl(index.js, 11, 16)) +>test : Symbol(test, Decl(index.js, 17, 1)) } } } diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff index f0271ba9a4..60a2335ef1 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff @@ -14,16 +14,20 @@ if (options.test) { ->options.test : Symbol(test, Decl(index.js, 4, 3)) ++>options.test : Symbol(test, Decl(index.js, 17, 1)) >options : Symbol(options, Decl(index.js, 11, 16)) ->test : Symbol(test, Decl(index.js, 4, 3)) ++>test : Symbol(test, Decl(index.js, 17, 1)) this.test = new options.test(); ->this.test : Symbol(X.test, Decl(index.js, 13, 27)) >this : Symbol(X, Decl(index.js, 0, 33)) ->test : Symbol(X.test, Decl(index.js, 13, 27)) ->options.test : Symbol(test, Decl(index.js, 4, 3)) ++>options.test : Symbol(test, Decl(index.js, 17, 1)) >options : Symbol(options, Decl(index.js, 11, 16)) ->test : Symbol(test, Decl(index.js, 4, 3)) ++>test : Symbol(test, Decl(index.js, 17, 1)) } } } diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.types b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.types index 380b84a5d6..f25e100567 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.types +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.types @@ -22,7 +22,12 @@ import Test from './test/Test.js' /** * @typedef {Object} Options +>Options : any + * @property {typeof import("./Test.js").default} [test] +>test : any +>default : any + */ class X extends Test { @@ -33,7 +38,7 @@ class X extends Test { * @param {Options} options */ constructor(options) { ->options : any +>options : Options super(); >super() : void @@ -41,7 +46,7 @@ class X extends Test { if (options.test) { >options.test : any ->options : any +>options : Options >test : any this.test = new options.test(); @@ -51,7 +56,7 @@ class X extends Test { >test : any >new options.test() : any >options.test : any ->options : any +>options : Options >test : any } } diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types index 3297612520..37be3d3b60 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types @@ -3,7 +3,11 @@ === index.js === /** * @typedef Options +>Options : any + * @property {string} opt +>opt : any + */ /** diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.types b/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.types index 72943a7e96..22dc7e1940 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.types +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.types @@ -3,12 +3,20 @@ === a.js === /** * @typedef A +>A : any + * @property {string} a +>a : any + */ /** * @typedef B +>B : any + * @property {number} b +>b : any + */ class C1 { @@ -18,7 +26,7 @@ * @type {A} */ value; ->value : any +>value : A } class C2 extends C1 { @@ -29,7 +37,7 @@ class C2 extends C1 { * @type {A} */ value; ->value : any +>value : A } class C3 extends C1 { @@ -40,6 +48,6 @@ class C3 extends C1 { * @type {A & B} */ value; ->value : any +>value : A & B } diff --git a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types index e7f00dd9c5..9cfdb8fa8f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types +++ b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types @@ -12,6 +12,8 @@ export interface LionRequestInit { === index.js === /** * @typedef {import('@lion/ajax').LionRequestInit} LionRequestInit +>LionRequestInit : any + */ export class NewAjax { @@ -21,8 +23,8 @@ export class NewAjax { * @param {LionRequestInit} [init] */ case5_unexpectedlyResolvesPathToNodeModules(init) {} ->case5_unexpectedlyResolvesPathToNodeModules : (init: any) => void ->init : any +>case5_unexpectedlyResolvesPathToNodeModules : (init?: LionRequestInit | undefined) => void +>init : LionRequestInit | undefined } /** diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt index 0ee31e5c1f..313ac6eb7b 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt @@ -2,7 +2,10 @@ enumDef.js(2,6): error TS2339: Property 'UserMetrics' does not exist on type '{} enumDef.js(4,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'. enumDef.js(16,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'. index.js(2,7): error TS2339: Property 'Cls' does not exist on type '{}'. +index.js(4,17): error TS2503: Cannot find namespace 'Host'. index.js(8,21): error TS2304: Cannot find name 'Host'. +index.js(13,11): error TS2503: Cannot find namespace 'Host'. +index.js(18,11): error TS2503: Cannot find namespace 'Host'. ==== enumDef.js (3 errors) ==== @@ -30,13 +33,15 @@ index.js(8,21): error TS2304: Cannot find name 'Host'. !!! error TS2339: Property 'UserMetrics' does not exist on type '{}'. x: 12 } -==== index.js (2 errors) ==== +==== index.js (5 errors) ==== var Other = {}; Other.Cls = class { ~~~ !!! error TS2339: Property 'Cls' does not exist on type '{}'. /** * @param {!Host.UserMetrics.Action} p + ~~~~ +!!! error TS2503: Cannot find namespace 'Host'. */ method(p) {} usage() { @@ -48,11 +53,15 @@ index.js(8,21): error TS2304: Cannot find name 'Host'. /** * @type {Host.UserMetrics.Bargh} + ~~~~ +!!! error TS2503: Cannot find namespace 'Host'. */ var x = "ok"; /** * @type {Host.UserMetrics.Blah} + ~~~~ +!!! error TS2503: Cannot find namespace 'Host'. */ var y = "ok"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols index 0c7b90f5c3..24c166f1f3 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols @@ -2,14 +2,14 @@ === enumDef.js === var Host = {}; ->Host : Symbol(Host, Decl(enumDef.js, 0, 3)) +>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) Host.UserMetrics = {}; ->Host : Symbol(Host, Decl(enumDef.js, 0, 3)) +>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) /** @enum {number} */ Host.UserMetrics.Action = { ->Host : Symbol(Host, Decl(enumDef.js, 0, 3)) +>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) WindowDocked: 1, >WindowDocked : Symbol(WindowDocked, Decl(enumDef.js, 3, 27)) @@ -31,7 +31,7 @@ Host.UserMetrics.Action = { * @typedef {string} */ Host.UserMetrics.Blah = { ->Host : Symbol(Host, Decl(enumDef.js, 0, 3)) +>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) x: 12 >x : Symbol(x, Decl(enumDef.js, 15, 25)) diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff index 45f10f6995..40818b7f44 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff @@ -5,13 +5,13 @@ === enumDef.js === var Host = {}; ->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 0, 14), Decl(enumDef.js, 1, 22), Decl(enumDef.js, 8, 2), Decl(enumDef.js, 10, 21)) -+>Host : Symbol(Host, Decl(enumDef.js, 0, 3)) ++>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) Host.UserMetrics = {}; ->Host.UserMetrics : Symbol(Host.UserMetrics, Decl(enumDef.js, 0, 14), Decl(enumDef.js, 3, 5), Decl(enumDef.js, 15, 5), Decl(enumDef.js, 10, 26)) ->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 0, 14), Decl(enumDef.js, 1, 22), Decl(enumDef.js, 8, 2), Decl(enumDef.js, 10, 21)) ->UserMetrics : Symbol(Host.UserMetrics, Decl(enumDef.js, 0, 14), Decl(enumDef.js, 3, 5), Decl(enumDef.js, 15, 5), Decl(enumDef.js, 10, 26)) -+>Host : Symbol(Host, Decl(enumDef.js, 0, 3)) ++>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) /** @enum {number} */ Host.UserMetrics.Action = { @@ -20,7 +20,7 @@ ->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 0, 14), Decl(enumDef.js, 1, 22), Decl(enumDef.js, 8, 2), Decl(enumDef.js, 10, 21)) ->UserMetrics : Symbol(Host.UserMetrics, Decl(enumDef.js, 0, 14), Decl(enumDef.js, 3, 5), Decl(enumDef.js, 15, 5), Decl(enumDef.js, 10, 26)) ->Action : Symbol(Host.UserMetrics.Action, Decl(enumDef.js, 1, 22), Decl(enumDef.js, 3, 17), Decl(enumDef.js, 2, 4)) -+>Host : Symbol(Host, Decl(enumDef.js, 0, 3)) ++>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) WindowDocked: 1, >WindowDocked : Symbol(WindowDocked, Decl(enumDef.js, 3, 27)) @@ -33,7 +33,7 @@ ->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 0, 14), Decl(enumDef.js, 1, 22), Decl(enumDef.js, 8, 2), Decl(enumDef.js, 10, 21)) ->UserMetrics : Symbol(Host.UserMetrics, Decl(enumDef.js, 0, 14), Decl(enumDef.js, 3, 5), Decl(enumDef.js, 15, 5), Decl(enumDef.js, 10, 26)) ->Blah : Symbol(Host.UserMetrics.Blah, Decl(enumDef.js, 8, 2), Decl(enumDef.js, 15, 17), Decl(enumDef.js, 13, 3)) -+>Host : Symbol(Host, Decl(enumDef.js, 0, 3)) ++>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) x: 12 >x : Symbol(x, Decl(enumDef.js, 15, 25)) diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types index 3a053ba851..b28e537bba 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types @@ -41,10 +41,14 @@ Host.UserMetrics.Action = { }; /** * @typedef {string} Host.UserMetrics.Bargh +>Host : any + */ /** * @typedef {string} */ +> : any + Host.UserMetrics.Blah = { >Host.UserMetrics.Blah = { x: 12} : { x: number; } >Host.UserMetrics.Blah : any @@ -74,21 +78,21 @@ Other.Cls = class { * @param {!Host.UserMetrics.Action} p */ method(p) {} ->method : (p: any) => void ->p : any +>method : (p: Action) => void +>p : Action usage() { >usage : () => void this.method(Host.UserMetrics.Action.WindowDocked); >this.method(Host.UserMetrics.Action.WindowDocked) : void ->this.method : (p: any) => void +>this.method : (p: Action) => void >this : this ->method : (p: any) => void +>method : (p: Action) => void >Host.UserMetrics.Action.WindowDocked : any >Host.UserMetrics.Action : any >Host.UserMetrics : any ->Host : {} +>Host : any >UserMetrics : any >Action : any >WindowDocked : any @@ -99,13 +103,13 @@ Other.Cls = class { * @type {Host.UserMetrics.Bargh} */ var x = "ok"; ->x : string +>x : Bargh >"ok" : "ok" /** * @type {Host.UserMetrics.Blah} */ var y = "ok"; ->y : string +>y : Blah >"ok" : "ok" diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types index f17480103c..83333f0cb4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types @@ -18,8 +18,14 @@ useThing(Thing.a); /** * @typedef {Object} LogEntry +>LogEntry : any + * @property {string} type +>type : any + * @property {number} time +>time : any + */ cbThing(type => { @@ -30,7 +36,7 @@ cbThing(type => { /** @type {LogEntry} */ const logEntry = { ->logEntry : { time: number; type: any; } +>logEntry : LogEntry >{ time: Date.now(), type, } : { time: number; type: any; } time: Date.now(), diff --git a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation.types b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation.types index 5f2e6574f4..da00b8944d 100644 --- a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation.types +++ b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation.types @@ -6,7 +6,7 @@ class Abcde { /** @type {string} */ x; ->x : any +>x : string } module.exports = { diff --git a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols index 2544ae315c..e3f8506167 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols @@ -19,35 +19,47 @@ function apply(func, thisArg, ...args) { var length = args.length; >length : Symbol(length, Decl(_apply.js, 11, 7)) +>args.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >args : Symbol(args, Decl(_apply.js, 10, 29)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) switch (length) { >length : Symbol(length, Decl(_apply.js, 11, 7)) case 0: return func.call(thisArg); +>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) +>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) case 1: return func.call(thisArg, args[0]); +>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) +>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) case 2: return func.call(thisArg, args[0], args[1]); +>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) +>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) case 3: return func.call(thisArg, args[0], args[1], args[2]); +>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) +>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) } return func.apply(thisArg, args); +>func.apply : Symbol(apply, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) +>apply : Symbol(apply, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff index 64b1ff90ba..b6fe49ba6d 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.symbols.diff @@ -5,37 +5,47 @@ var length = args.length; >length : Symbol(length, Decl(_apply.js, 11, 7)) ->args.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>args.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >args : Symbol(args, Decl(_apply.js, 10, 29)) ->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) switch (length) { >length : Symbol(length, Decl(_apply.js, 11, 7)) case 0: return func.call(thisArg); ->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) case 1: return func.call(thisArg, args[0]); ->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) case 2: return func.call(thisArg, args[0], args[1]); ->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) case 3: return func.call(thisArg, args[0], args[1], args[2]); ->func.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>func.call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --)) ++>call : Symbol(call, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) >args : Symbol(args, Decl(_apply.js, 10, 29)) @@ -43,8 +53,10 @@ } return func.apply(thisArg, args); ->func.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) ++>func.apply : Symbol(apply, Decl(lib.es5.d.ts, --, --)) >func : Symbol(func, Decl(_apply.js, 10, 15)) ->apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) ++>apply : Symbol(apply, Decl(lib.es5.d.ts, --, --)) >thisArg : Symbol(thisArg, Decl(_apply.js, 10, 20)) >args : Symbol(args, Decl(_apply.js, 10, 29)) } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.types b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.types index 35f0505a2b..11f050890a 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.types +++ b/testdata/baselines/reference/submodule/compiler/jsFileCompilationRestParamJsDocFunction.types @@ -12,8 +12,8 @@ * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, ...args) { ->apply : (func: any, thisArg: any, ...args: any[]) => any ->func : any +>apply : (func: Function, thisArg: any, ...args: any[]) => any +>func : Function >thisArg : any >args : any[] @@ -29,17 +29,17 @@ function apply(func, thisArg, ...args) { case 0: return func.call(thisArg); >0 : 0 >func.call(thisArg) : any ->func.call : any ->func : any ->call : any +>func.call : (thisArg: any, ...argArray: any[]) => any +>func : Function +>call : (thisArg: any, ...argArray: any[]) => any >thisArg : any case 1: return func.call(thisArg, args[0]); >1 : 1 >func.call(thisArg, args[0]) : any ->func.call : any ->func : any ->call : any +>func.call : (thisArg: any, ...argArray: any[]) => any +>func : Function +>call : (thisArg: any, ...argArray: any[]) => any >thisArg : any >args[0] : any >args : any[] @@ -48,9 +48,9 @@ function apply(func, thisArg, ...args) { case 2: return func.call(thisArg, args[0], args[1]); >2 : 2 >func.call(thisArg, args[0], args[1]) : any ->func.call : any ->func : any ->call : any +>func.call : (thisArg: any, ...argArray: any[]) => any +>func : Function +>call : (thisArg: any, ...argArray: any[]) => any >thisArg : any >args[0] : any >args : any[] @@ -62,9 +62,9 @@ function apply(func, thisArg, ...args) { case 3: return func.call(thisArg, args[0], args[1], args[2]); >3 : 3 >func.call(thisArg, args[0], args[1], args[2]) : any ->func.call : any ->func : any ->call : any +>func.call : (thisArg: any, ...argArray: any[]) => any +>func : Function +>call : (thisArg: any, ...argArray: any[]) => any >thisArg : any >args[0] : any >args : any[] @@ -78,13 +78,13 @@ function apply(func, thisArg, ...args) { } return func.apply(thisArg, args); >func.apply(thisArg, args) : any ->func.apply : any ->func : any ->apply : any +>func.apply : (thisArg: any, argArray?: any) => any +>func : Function +>apply : (thisArg: any, argArray?: any) => any >thisArg : any >args : any[] } export default apply; ->apply : (func: any, thisArg: any, ...args: any[]) => any +>apply : (func: Function, thisArg: any, ...args: any[]) => any diff --git a/testdata/baselines/reference/submodule/compiler/jsFileCompilationSyntaxError.types b/testdata/baselines/reference/submodule/compiler/jsFileCompilationSyntaxError.types index 7e106890a7..42c5386bac 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileCompilationSyntaxError.types +++ b/testdata/baselines/reference/submodule/compiler/jsFileCompilationSyntaxError.types @@ -6,5 +6,5 @@ * @type {string} */ var v; ->v : any +>v : number diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt new file mode 100644 index 0000000000..c6c7b6c8e6 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt @@ -0,0 +1,67 @@ +jsFileFunctionOverloads.js(26,12): error TS2304: Cannot find name 'T'. +jsFileFunctionOverloads.js(27,14): error TS2304: Cannot find name 'T'. + + +==== jsFileFunctionOverloads.js (2 errors) ==== + /** + * @overload + * @param {number} x + * @returns {'number'} + */ + /** + * @overload + * @param {string} x + * @returns {'string'} + */ + /** + * @overload + * @param {boolean} x + * @returns {'boolean'} + */ + /** + * @param {unknown} x + * @returns {string} + */ + function getTypeName(x) { + return typeof x; + } + + /** + * @template T + * @param {T} x + ~ +!!! error TS2304: Cannot find name 'T'. + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + const identity = x => x; + + /** + * @template T + * @template U + * @overload + * @param {T[]} array + * @param {(x: T) => U[]} iterable + * @returns {U[]} + */ + /** + * @template T + * @overload + * @param {T[][]} array + * @returns {T[]} + */ + /** + * @param {unknown[]} array + * @param {(x: unknown) => unknown} iterable + * @returns {unknown[]} + */ + function flatMap(array, iterable = identity) { + /** @type {unknown[]} */ + const result = []; + for (let i = 0; i < array.length; i += 1) { + result.push(.../** @type {unknown[]} */(iterable(array[i]))); + } + return result; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols index ab94d8fda5..06d3e43822 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols @@ -70,11 +70,15 @@ function flatMap(array, iterable = identity) { for (let i = 0; i < array.length; i += 1) { >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) +>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(jsFileFunctionOverloads.js, 49, 17)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); +>result.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(jsFileFunctionOverloads.js, 51, 7)) +>push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >iterable : Symbol(iterable, Decl(jsFileFunctionOverloads.js, 49, 23)) >array : Symbol(array, Decl(jsFileFunctionOverloads.js, 49, 17)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff index a27e87d408..f653c587e3 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.symbols.diff @@ -5,14 +5,18 @@ >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) ->array.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(jsFileFunctionOverloads.js, 49, 17)) ->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); ->result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) ++>result.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(jsFileFunctionOverloads.js, 51, 7)) ->push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) ++>push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >iterable : Symbol(iterable, Decl(jsFileFunctionOverloads.js, 49, 23)) >array : Symbol(array, Decl(jsFileFunctionOverloads.js, 49, 17)) >i : Symbol(i, Decl(jsFileFunctionOverloads.js, 52, 10)) diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.types b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.types index b38bffc913..112ad7ff6f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.types +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.types @@ -21,12 +21,12 @@ * @returns {string} */ function getTypeName(x) { ->getTypeName : (x: any) => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ->x : any +>getTypeName : (x: unknown) => string +>x : unknown return typeof x; >typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ->x : any +>x : unknown } /** @@ -35,10 +35,10 @@ * @returns {T} */ const identity = x => x; ->identity : (x: any) => any ->x => x : (x: any) => any ->x : any ->x : any +>identity : (x: T) => T +>x => x : (x: T) => T +>x : T +>x : T /** * @template T @@ -60,14 +60,14 @@ const identity = x => x; * @returns {unknown[]} */ function flatMap(array, iterable = identity) { ->flatMap : (array: any, iterable?: (x: any) => any) => any[] ->array : any ->iterable : (x: any) => any ->identity : (x: any) => any +>flatMap : (array: unknown[], iterable?: (x: unknown) => unknown) => unknown[] +>array : unknown[] +>iterable : (x: unknown) => unknown +>identity : (x: T) => T /** @type {unknown[]} */ const result = []; ->result : any[] +>result : unknown[] >[] : undefined[] for (let i = 0; i < array.length; i += 1) { @@ -75,27 +75,28 @@ function flatMap(array, iterable = identity) { >0 : 0 >i < array.length : boolean >i : number ->array.length : any ->array : any ->length : any +>array.length : number +>array : unknown[] +>length : number >i += 1 : number >i : number >1 : 1 result.push(.../** @type {unknown[]} */(iterable(array[i]))); >result.push(.../** @type {unknown[]} */(iterable(array[i]))) : number ->result.push : (...items: any[]) => number ->result : any[] ->push : (...items: any[]) => number ->.../** @type {unknown[]} */(iterable(array[i])) : any ->(iterable(array[i])) : any ->iterable(array[i]) : any ->iterable : (x: any) => any ->array[i] : any ->array : any +>result.push : (...items: unknown[]) => number +>result : unknown[] +>push : (...items: unknown[]) => number +>.../** @type {unknown[]} */(iterable(array[i])) : unknown +>(iterable(array[i])) : unknown[] +>iterable(array[i]) : unknown[] +>iterable(array[i]) : unknown +>iterable : (x: unknown) => unknown +>array[i] : unknown +>array : unknown[] >i : number } return result; ->result : any[] +>result : unknown[] } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt new file mode 100644 index 0000000000..5b3c661435 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt @@ -0,0 +1,62 @@ +jsFileFunctionOverloads2.js(24,12): error TS2304: Cannot find name 'T'. +jsFileFunctionOverloads2.js(25,14): error TS2304: Cannot find name 'T'. + + +==== jsFileFunctionOverloads2.js (2 errors) ==== + // Also works if all @overload tags are combined in one comment. + /** + * @overload + * @param {number} x + * @returns {'number'} + * + * @overload + * @param {string} x + * @returns {'string'} + * + * @overload + * @param {boolean} x + * @returns {'boolean'} + * + * @param {unknown} x + * @returns {string} + */ + function getTypeName(x) { + return typeof x; + } + + /** + * @template T + * @param {T} x + ~ +!!! error TS2304: Cannot find name 'T'. + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + const identity = x => x; + + /** + * @template T + * @template U + * @overload + * @param {T[]} array + * @param {(x: T) => U[]} iterable + * @returns {U[]} + * + * @overload + * @param {T[][]} array + * @returns {T[]} + * + * @param {unknown[]} array + * @param {(x: unknown) => unknown} iterable + * @returns {unknown[]} + */ + function flatMap(array, iterable = identity) { + /** @type {unknown[]} */ + const result = []; + for (let i = 0; i < array.length; i += 1) { + result.push(.../** @type {unknown[]} */(iterable(array[i]))); + } + return result; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols index 134ec539b9..226798dfdc 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols @@ -65,11 +65,15 @@ function flatMap(array, iterable = identity) { for (let i = 0; i < array.length; i += 1) { >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) +>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(jsFileFunctionOverloads2.js, 44, 17)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); +>result.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(jsFileFunctionOverloads2.js, 46, 7)) +>push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >iterable : Symbol(iterable, Decl(jsFileFunctionOverloads2.js, 44, 23)) >array : Symbol(array, Decl(jsFileFunctionOverloads2.js, 44, 17)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff index e83c7b9946..3a61f98336 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.symbols.diff @@ -5,14 +5,18 @@ >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) ->array.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(jsFileFunctionOverloads2.js, 44, 17)) ->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); ->result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) ++>result.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(jsFileFunctionOverloads2.js, 46, 7)) ->push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) ++>push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >iterable : Symbol(iterable, Decl(jsFileFunctionOverloads2.js, 44, 23)) >array : Symbol(array, Decl(jsFileFunctionOverloads2.js, 44, 17)) >i : Symbol(i, Decl(jsFileFunctionOverloads2.js, 47, 10)) diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.types b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.types index ea16329399..240501cb14 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.types +++ b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.types @@ -19,12 +19,12 @@ * @returns {string} */ function getTypeName(x) { ->getTypeName : (x: any) => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ->x : any +>getTypeName : (x: unknown) => string +>x : unknown return typeof x; >typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ->x : any +>x : unknown } /** @@ -33,10 +33,10 @@ * @returns {T} */ const identity = x => x; ->identity : (x: any) => any ->x => x : (x: any) => any ->x : any ->x : any +>identity : (x: T) => T +>x => x : (x: T) => T +>x : T +>x : T /** * @template T @@ -55,14 +55,14 @@ const identity = x => x; * @returns {unknown[]} */ function flatMap(array, iterable = identity) { ->flatMap : (array: any, iterable?: (x: any) => any) => any[] ->array : any ->iterable : (x: any) => any ->identity : (x: any) => any +>flatMap : (array: unknown[], iterable?: (x: unknown) => unknown) => unknown[] +>array : unknown[] +>iterable : (x: unknown) => unknown +>identity : (x: T) => T /** @type {unknown[]} */ const result = []; ->result : any[] +>result : unknown[] >[] : undefined[] for (let i = 0; i < array.length; i += 1) { @@ -70,27 +70,28 @@ function flatMap(array, iterable = identity) { >0 : 0 >i < array.length : boolean >i : number ->array.length : any ->array : any ->length : any +>array.length : number +>array : unknown[] +>length : number >i += 1 : number >i : number >1 : 1 result.push(.../** @type {unknown[]} */(iterable(array[i]))); >result.push(.../** @type {unknown[]} */(iterable(array[i]))) : number ->result.push : (...items: any[]) => number ->result : any[] ->push : (...items: any[]) => number ->.../** @type {unknown[]} */(iterable(array[i])) : any ->(iterable(array[i])) : any ->iterable(array[i]) : any ->iterable : (x: any) => any ->array[i] : any ->array : any +>result.push : (...items: unknown[]) => number +>result : unknown[] +>push : (...items: unknown[]) => number +>.../** @type {unknown[]} */(iterable(array[i])) : unknown +>(iterable(array[i])) : unknown[] +>iterable(array[i]) : unknown[] +>iterable(array[i]) : unknown +>iterable : (x: unknown) => unknown +>array[i] : unknown +>array : unknown[] >i : number } return result; ->result : any[] +>result : unknown[] } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt new file mode 100644 index 0000000000..afd42d87b7 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.errors.txt @@ -0,0 +1,35 @@ +index.js(11,12): error TS2339: Property 'objects' does not exist on type 'object'. +index.js(13,26): error TS2698: Spread types may only be created from object types. + + +==== dash.d.ts (0 errors) ==== + type ObjectIterator = (value: TObject[keyof TObject], key: string, collection: TObject) => TResult; + + interface LoDashStatic { + mapValues(obj: T | null | undefined, callback: ObjectIterator): { [P in keyof T]: TResult }; + } + declare const _: LoDashStatic; + export = _; +==== Consts.ts (0 errors) ==== + export const INDEX_FIELD = '__INDEX'; +==== index.js (2 errors) ==== + import * as _ from './dash'; + import { INDEX_FIELD } from './Consts'; + + export class Test { + /** + * @param {object} obj + * @param {object} vm + */ + test(obj, vm) { + let index = 0; + vm.objects = _.mapValues( + ~~~~~~~ +!!! error TS2339: Property 'objects' does not exist on type 'object'. + obj, + object => ({ ...object, [INDEX_FIELD]: index++ }), + ~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + ); + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.types b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.types index 8a551b19a5..30e32e1474 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.types +++ b/testdata/baselines/reference/submodule/compiler/jsFileImportPreservedWhenUsed.types @@ -39,33 +39,33 @@ export class Test { * @param {object} vm */ test(obj, vm) { ->test : (obj: any, vm: any) => void ->obj : any ->vm : any +>test : (obj: object, vm: object) => void +>obj : object +>vm : object let index = 0; >index : number >0 : 0 vm.objects = _.mapValues( ->vm.objects = _.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : { [x: string]: any; } +>vm.objects = _.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : object >vm.objects : any ->vm : any +>vm : object >objects : any ->_.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : { [x: string]: any; } +>_.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : object >_.mapValues : (obj: T | null | undefined, callback: ObjectIterator) => { [P in keyof T]: TResult } >_ : LoDashStatic >mapValues : (obj: T | null | undefined, callback: ObjectIterator) => { [P in keyof T]: TResult } obj, ->obj : any +>obj : object object => ({ ...object, [INDEX_FIELD]: index++ }), ->object => ({ ...object, [INDEX_FIELD]: index++ }) : (object: any) => any ->object : any +>object => ({ ...object, [INDEX_FIELD]: index++ }) : (object: never) => any +>object : never >({ ...object, [INDEX_FIELD]: index++ }) : any >{ ...object, [INDEX_FIELD]: index++ } : any ->object : any +>object : never >[INDEX_FIELD] : number >INDEX_FIELD : "__INDEX" >index++ : number diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt index 942187b6f0..89bd8e1449 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.errors.txt @@ -1,7 +1,7 @@ -jsFileMethodOverloads.js(9,10): error TS2339: Property 'value' does not exist on type 'Example'. -jsFileMethodOverloads.js(26,24): error TS2339: Property 'value' does not exist on type 'Example'. -jsFileMethodOverloads.js(44,25): error TS2339: Property 'value' does not exist on type 'Example'. -jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads.js(9,10): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads.js(26,24): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads.js(44,25): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist on type 'Example'. ==== jsFileMethodOverloads.js (4 errors) ==== @@ -15,7 +15,7 @@ jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist o constructor(value) { this.value = value; ~~~~~ -!!! error TS2339: Property 'value' does not exist on type 'Example'. +!!! error TS2339: Property 'value' does not exist on type 'Example'. } /** @@ -34,7 +34,7 @@ jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist o getTypeName() { return typeof this.value; ~~~~~ -!!! error TS2339: Property 'value' does not exist on type 'Example'. +!!! error TS2339: Property 'value' does not exist on type 'Example'. } /** @@ -54,9 +54,9 @@ jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist o transform(fn) { return fn ? fn(this.value) : this.value; ~~~~~ -!!! error TS2339: Property 'value' does not exist on type 'Example'. +!!! error TS2339: Property 'value' does not exist on type 'Example'. ~~~~~ -!!! error TS2339: Property 'value' does not exist on type 'Example'. +!!! error TS2339: Property 'value' does not exist on type 'Example'. } } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.types b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.types index 45753f8947..bc65bc8731 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.types +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads.types @@ -5,20 +5,20 @@ * @template T */ class Example { ->Example : Example +>Example : Example /** * @param {T} value */ constructor(value) { ->value : any +>value : T this.value = value; ->this.value = value : any +>this.value = value : T >this.value : any >this : this >value : any ->value : any +>value : T } /** @@ -35,7 +35,7 @@ * @returns {string} */ getTypeName() { ->getTypeName : () => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" +>getTypeName : () => string return typeof this.value; >typeof this.value : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" @@ -59,14 +59,14 @@ * @returns {unknown} */ transform(fn) { ->transform : (fn: any) => any ->fn : any +>transform : (fn?: (y: T) => unknown) => unknown +>fn : (y: T) => unknown return fn ? fn(this.value) : this.value; >fn ? fn(this.value) : this.value : any ->fn : any ->fn(this.value) : any ->fn : any +>fn : (y: T) => unknown +>fn(this.value) : unknown +>fn : (y: T) => unknown >this.value : any >this : this >value : any diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt index 4e6cf1d02b..1a58e0d84c 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.errors.txt @@ -1,7 +1,7 @@ -jsFileMethodOverloads2.js(10,10): error TS2339: Property 'value' does not exist on type 'Example'. -jsFileMethodOverloads2.js(25,24): error TS2339: Property 'value' does not exist on type 'Example'. -jsFileMethodOverloads2.js(41,25): error TS2339: Property 'value' does not exist on type 'Example'. -jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads2.js(10,10): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads2.js(25,24): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads2.js(41,25): error TS2339: Property 'value' does not exist on type 'Example'. +jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist on type 'Example'. ==== jsFileMethodOverloads2.js (4 errors) ==== @@ -16,7 +16,7 @@ jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist constructor(value) { this.value = value; ~~~~~ -!!! error TS2339: Property 'value' does not exist on type 'Example'. +!!! error TS2339: Property 'value' does not exist on type 'Example'. } /** @@ -33,7 +33,7 @@ jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist getTypeName() { return typeof this.value; ~~~~~ -!!! error TS2339: Property 'value' does not exist on type 'Example'. +!!! error TS2339: Property 'value' does not exist on type 'Example'. } /** @@ -51,9 +51,9 @@ jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist transform(fn) { return fn ? fn(this.value) : this.value; ~~~~~ -!!! error TS2339: Property 'value' does not exist on type 'Example'. +!!! error TS2339: Property 'value' does not exist on type 'Example'. ~~~~~ -!!! error TS2339: Property 'value' does not exist on type 'Example'. +!!! error TS2339: Property 'value' does not exist on type 'Example'. } } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.types b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.types index ec63a0dce3..070ca77f5a 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.types +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads2.types @@ -6,20 +6,20 @@ * @template T */ class Example { ->Example : Example +>Example : Example /** * @param {T} value */ constructor(value) { ->value : any +>value : T this.value = value; ->this.value = value : any +>this.value = value : T >this.value : any >this : this >value : any ->value : any +>value : T } /** @@ -34,7 +34,7 @@ * @returns {string} */ getTypeName() { ->getTypeName : () => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" +>getTypeName : () => string return typeof this.value; >typeof this.value : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" @@ -56,14 +56,14 @@ * @returns {unknown} */ transform(fn) { ->transform : (fn: any) => any ->fn : any +>transform : (fn?: (y: T) => unknown) => unknown +>fn : (y: T) => unknown return fn ? fn(this.value) : this.value; >fn ? fn(this.value) : this.value : any ->fn : any ->fn(this.value) : any ->fn : any +>fn : (y: T) => unknown +>fn(this.value) : unknown +>fn : (y: T) => unknown >this.value : any >this : this >value : any diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.types b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.types index e1287e3d94..ce1d43bf3e 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.types +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads3.types @@ -16,22 +16,22 @@ * @returns {string | number} */ function id(x) { ->id : (x: any) => any ->x : any +>id : (x: string | number) => string | number +>x : string | number return x; ->x : any +>x : string | number } export let a = id(123); ->a : any ->id(123) : any ->id : (x: any) => any +>a : string | number +>id(123) : string | number +>id : (x: string | number) => string | number >123 : 123 export let b = id("hello"); ->b : any ->id("hello") : any ->id : (x: any) => any +>b : string | number +>id("hello") : string | number +>id : (x: string | number) => string | number >"hello" : "hello" diff --git a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads5.types b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads5.types index 3fa2a07bb4..ac868dedf5 100644 --- a/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads5.types +++ b/testdata/baselines/reference/submodule/compiler/jsFileMethodOverloads5.types @@ -19,8 +19,8 @@ * @param {number} [b] */ export const foo = function (a, b) { } ->foo : (a: any, b: any) => void ->function (a, b) { } : (a: any, b: any) => void ->a : any ->b : any +>foo : (a: string | number, b?: number) => void +>function (a, b) { } : (a: string | number, b?: number) => void +>a : string | number +>b : number diff --git a/testdata/baselines/reference/submodule/compiler/jsdocAccessEnumType.types b/testdata/baselines/reference/submodule/compiler/jsdocAccessEnumType.types index b2876f7741..19126cb8a8 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocAccessEnumType.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocAccessEnumType.types @@ -11,7 +11,7 @@ import { E } from "./a"; /** @type {E} */ const e = E.A; ->e : E.A +>e : E >E.A : E >E : typeof E >A : E diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt new file mode 100644 index 0000000000..1d9b3df6af --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt @@ -0,0 +1,69 @@ +jsdocArrayObjectPromiseImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(30,18): error TS2322: Type 'number' is not assignable to type '() => Object'. +jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. + + +==== jsdocArrayObjectPromiseImplicitAny.js (8 errors) ==== + /** @type {Array} */ + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + var anyArray = [5]; + + /** @type {Array} */ + var numberArray = [5]; + + /** + * @param {Array} arr + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + * @return {Array} + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + */ + function returnAnyArray(arr) { + return arr; + } + + /** @type {Promise} */ + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + var anyPromise = Promise.resolve(5); + + /** @type {Promise} */ + var numberPromise = Promise.resolve(5); + + /** + * @param {Promise} pr + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + * @return {Promise} + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + */ + function returnAnyPromise(pr) { + return pr; + } + + /** @type {Object} */ + var anyObject = {valueOf: 1}; // not an error since assigning to any. + ~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type '() => Object'. + + /** @type {Object} */ + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + var paramedObject = {valueOf: 1}; + + /** + * @param {Object} obj + * @return {Object} + */ + function returnAnyObject(obj) { + return obj; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.types b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.types index 297a113198..bc48d858c0 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.types @@ -3,7 +3,7 @@ === jsdocArrayObjectPromiseImplicitAny.js === /** @type {Array} */ var anyArray = [5]; ->anyArray : number[] +>anyArray : any >[5] : number[] >5 : 5 @@ -27,7 +27,7 @@ function returnAnyArray(arr) { /** @type {Promise} */ var anyPromise = Promise.resolve(5); ->anyPromise : Promise +>anyPromise : any >Promise.resolve(5) : Promise >Promise.resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; } >Promise : PromiseConstructor @@ -57,14 +57,14 @@ function returnAnyPromise(pr) { /** @type {Object} */ var anyObject = {valueOf: 1}; // not an error since assigning to any. ->anyObject : { valueOf: number; } +>anyObject : Object >{valueOf: 1} : { valueOf: number; } >valueOf : number >1 : 1 /** @type {Object} */ var paramedObject = {valueOf: 1}; ->paramedObject : { valueOf: number; } +>paramedObject : any >{valueOf: 1} : { valueOf: number; } >valueOf : number >1 : 1 @@ -74,10 +74,10 @@ var paramedObject = {valueOf: 1}; * @return {Object} */ function returnAnyObject(obj) { ->returnAnyObject : (obj: any) => any ->obj : any +>returnAnyObject : (obj: Object) => Object +>obj : Object return obj; ->obj : any +>obj : Object } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt new file mode 100644 index 0000000000..c88b521e45 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt @@ -0,0 +1,69 @@ +jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(30,21): error TS2322: Type 'number' is not assignable to type '() => Object'. +jsdocArrayObjectPromiseNoImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. + + +==== jsdocArrayObjectPromiseNoImplicitAny.js (8 errors) ==== + /** @type {Array} */ + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + var notAnyArray = [5]; + + /** @type {Array} */ + var numberArray = [5]; + + /** + * @param {Array} arr + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + * @return {Array} + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + */ + function returnNotAnyArray(arr) { + return arr; + } + + /** @type {Promise} */ + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + var notAnyPromise = Promise.resolve(5); + + /** @type {Promise} */ + var numberPromise = Promise.resolve(5); + + /** + * @param {Promise} pr + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + * @return {Promise} + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + */ + function returnNotAnyPromise(pr) { + return pr; + } + + /** @type {Object} */ + var notAnyObject = {valueOf: 1}; // error since assigning to Object, not any. + ~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type '() => Object'. + + /** @type {Object} */ + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + var paramedObject = {valueOf: 1}; + + /** + * @param {Object} obj + * @return {Object} + */ + function returnNotAnyObject(obj) { + return obj; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.types b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.types index 86c778286f..87eee09470 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.types @@ -3,7 +3,7 @@ === jsdocArrayObjectPromiseNoImplicitAny.js === /** @type {Array} */ var notAnyArray = [5]; ->notAnyArray : number[] +>notAnyArray : any >[5] : number[] >5 : 5 @@ -27,7 +27,7 @@ function returnNotAnyArray(arr) { /** @type {Promise} */ var notAnyPromise = Promise.resolve(5); ->notAnyPromise : Promise +>notAnyPromise : any >Promise.resolve(5) : Promise >Promise.resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; } >Promise : PromiseConstructor @@ -57,14 +57,14 @@ function returnNotAnyPromise(pr) { /** @type {Object} */ var notAnyObject = {valueOf: 1}; // error since assigning to Object, not any. ->notAnyObject : { valueOf: number; } +>notAnyObject : Object >{valueOf: 1} : { valueOf: number; } >valueOf : number >1 : 1 /** @type {Object} */ var paramedObject = {valueOf: 1}; ->paramedObject : { valueOf: number; } +>paramedObject : any >{valueOf: 1} : { valueOf: number; } >valueOf : number >1 : 1 @@ -74,10 +74,10 @@ var paramedObject = {valueOf: 1}; * @return {Object} */ function returnNotAnyObject(obj) { ->returnNotAnyObject : (obj: any) => any ->obj : any +>returnNotAnyObject : (obj: Object) => Object +>obj : Object return obj; ->obj : any +>obj : Object } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt index 9697d6f2aa..d8a5fdf957 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.errors.txt @@ -1,7 +1,8 @@ index.js(12,14): error TS7006: Parameter 'arg' implicitly has an 'any' type. +index.js(20,16): error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'. -==== index.js (1 errors) ==== +==== index.js (2 errors) ==== /** @type () => string */ function fn1() { return 42; @@ -24,4 +25,7 @@ index.js(12,14): error TS7006: Parameter 'arg' implicitly has an 'any' type. /** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */ const obj2 = { type: "other", prop: 10 }; + ~~~~ +!!! error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'. +!!! related TS6500 index.js:19:14: The expected type comes from property 'type' which is declared here on type '({ type: "foo"; } | { type: "bar"; }) & { prop: number; }' \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.types b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.types index 3ac9df5434..7b33e57538 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocBracelessTypeTag1.types @@ -28,18 +28,18 @@ function fn3(arg) { /** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */ const obj1 = { type: "foo", prop: 10 }; ->obj1 : { type: string; prop: number; } ->{ type: "foo", prop: 10 } : { type: string; prop: number; } ->type : string +>obj1 : ({ type: "foo"; } | { type: "bar"; }) & { prop: number; } +>{ type: "foo", prop: 10 } : { type: "foo"; prop: number; } +>type : "foo" >"foo" : "foo" >prop : number >10 : 10 /** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */ const obj2 = { type: "other", prop: 10 }; ->obj2 : { type: string; prop: number; } ->{ type: "other", prop: 10 } : { type: string; prop: number; } ->type : string +>obj2 : ({ type: "foo"; } | { type: "bar"; }) & { prop: number; } +>{ type: "other", prop: 10 } : { type: "other"; prop: number; } +>type : "other" >"other" : "other" >prop : number >10 : 10 diff --git a/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt new file mode 100644 index 0000000000..79546958ff --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.errors.txt @@ -0,0 +1,15 @@ +/a.js(5,12): error TS2304: Cannot find name 'B'. + + +==== /a.js (1 errors) ==== + /** + * @template T + * @callback B + */ + /** @type {B} */ + ~ +!!! error TS2304: Cannot find name 'B'. + let b; + b(); + b(1); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.types b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.types index bf983c11a3..c4f0ae9435 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocCallbackAndType.types @@ -7,14 +7,14 @@ */ /** @type {B} */ let b; ->b : any +>b : B b(); >b() : any ->b : any +>b : B b(1); >b(1) : any ->b : any +>b : B >1 : 1 diff --git a/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt new file mode 100644 index 0000000000..ae966c3990 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.errors.txt @@ -0,0 +1,12 @@ +/a.js(4,13): error TS2314: Generic type 'C' requires 1 type argument(s). + + +==== /a.js (1 errors) ==== + /** @template T */ + class C {} + + /** @param {C} p */ + ~ +!!! error TS2314: Generic type 'C' requires 1 type argument(s). + function f(p) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.types b/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.types index b458dedce9..4ea043d906 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.types @@ -3,7 +3,7 @@ === /a.js === /** @template T */ class C {} ->C : C +>C : C /** @param {C} p */ function f(p) {} diff --git a/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.types b/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.types index 63a9c61048..a39bf86359 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocFunctionClassPropertiesDeclaration.types @@ -6,35 +6,35 @@ * @param {number | undefined} y */ export function Foo(x, y) { ->Foo : (x: any, y: any) => any ->x : any ->y : any +>Foo : (x: number | undefined, y: number | undefined) => any +>x : number | undefined +>y : number | undefined if (!(this instanceof Foo)) { >!(this instanceof Foo) : boolean >(this instanceof Foo) : boolean >this instanceof Foo : boolean >this : any ->Foo : (x: any, y: any) => any +>Foo : (x: number | undefined, y: number | undefined) => any return new Foo(x, y); >new Foo(x, y) : any ->Foo : (x: any, y: any) => any ->x : any ->y : any +>Foo : (x: number | undefined, y: number | undefined) => any +>x : number | undefined +>y : number | undefined } this.x = x; ->this.x = x : any +>this.x = x : number | undefined >this.x : any >this : any >x : any ->x : any +>x : number | undefined this.y = y; ->this.y = y : any +>this.y = y : number | undefined >this.y : any >this : any >y : any ->y : any +>y : number | undefined } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt new file mode 100644 index 0000000000..4147bce1d5 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt @@ -0,0 +1,9 @@ +/a.js(1,13): error TS1098: Type parameter list cannot be empty. + + +==== /a.js (1 errors) ==== + /** @param {<} x */ + ~~ +!!! error TS1098: Type parameter list cannot be empty. + function f(x) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.types b/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.types index 6c6737f256..022619f274 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.types @@ -3,6 +3,6 @@ === /a.js === /** @param {<} x */ function f(x) {} ->f : (x: any) => void ->x : any +>f : (x: () => any) => void +>x : () => any diff --git a/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt index a0b46cd948..16acaa3f0c 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt @@ -1,14 +1,17 @@ -/a.js(6,17): error TS1093: Type annotation cannot appear on a constructor declaration. +/a.js(3,5): error TS1092: Type parameters cannot appear on a constructor declaration. +/a.js(6,18): error TS1093: Type annotation cannot appear on a constructor declaration. -==== /a.js (1 errors) ==== +==== /a.js (2 errors) ==== class C { /** @template T */ constructor() { } + ~~~~~~~~~~~~~~~~~ +!!! error TS1092: Type parameters cannot appear on a constructor declaration. } class D { /** @return {number} */ - ~~~~~~~~ + ~~~~~~ !!! error TS1093: Type annotation cannot appear on a constructor declaration. constructor() {} } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.errors.txt new file mode 100644 index 0000000000..ba53f8f4d7 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.errors.txt @@ -0,0 +1,16 @@ +Main.js(2,49): error TS2694: Namespace '"GeometryType"' has no exported member 'default'. + + +==== GeometryType.d.ts (0 errors) ==== + declare namespace _default { + export const POINT: string; + } + export default _default; + +==== Main.js (1 errors) ==== + export default function () { + return /** @type {import('./GeometryType.js').default} */ ('Point'); + ~~~~~~~ +!!! error TS2694: Namespace '"GeometryType"' has no exported member 'default'. + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.types b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.types index 61a78c7d38..c851fa7232 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeNodeNamespace.types @@ -13,7 +13,8 @@ export default _default; === Main.js === export default function () { return /** @type {import('./GeometryType.js').default} */ ('Point'); ->('Point') : "Point" +>('Point') : any +>'Point' : any >'Point' : "Point" } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.types b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.types index 71d6a2daa6..30790eb71a 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.types @@ -8,9 +8,13 @@ export class MyClass { === usage.js === /** * @typedef {Object} options +>options : any + * @property {import("./module").MyClass} option +>option : any + */ /** @type {options} */ let v; ->v : any +>v : options diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols index 45e5696a1a..8e62ab992a 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols @@ -8,6 +8,8 @@ class Foo { m = x => x.toLowerCase(); >m : Symbol(m, Decl(a.js, 0, 11)) >x : Symbol(x, Decl(a.js, 2, 7)) +>x.toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(a.js, 2, 7)) +>toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --)) } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff index 9d7a20e19d..da85b80884 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.symbols.diff @@ -8,7 +8,9 @@ +>m : Symbol(m, Decl(a.js, 0, 11)) >x : Symbol(x, Decl(a.js, 2, 7)) ->x.toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) ++>x.toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(a.js, 2, 7)) ->toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) ++>toLowerCase : Symbol(toLowerCase, Decl(lib.es5.d.ts, --, --)) } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.types b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.types index f70e8dc78c..9602588f55 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocParamTagOnPropertyInitializer.types @@ -6,12 +6,12 @@ class Foo { /**@param {string} x */ m = x => x.toLowerCase(); ->m : (x: any) => any ->x => x.toLowerCase() : (x: any) => any ->x : any ->x.toLowerCase() : any ->x.toLowerCase : any ->x : any ->toLowerCase : any +>m : (x: string) => string +>x => x.toLowerCase() : (x: string) => string +>x : string +>x.toLowerCase() : string +>x.toLowerCase : () => string +>x : string +>toLowerCase : () => string } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt new file mode 100644 index 0000000000..1b0b2a8cd2 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt @@ -0,0 +1,12 @@ +example.js(3,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + +==== example.js (1 errors) ==== + // @ts-check + /** + * @type {function(@foo)} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + */ + let x; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.types b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.types index 314873b882..3d6f8823f8 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.types @@ -6,5 +6,5 @@ * @type {function(@foo)} */ let x; ->x : any +>x : function diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols index 3fa31ac817..802c84dfae 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols @@ -3,7 +3,10 @@ === /a.js === /** * @typedef MyType +>MyType : Symbol(MyType, Decl(a.js, 6, 24)) + * @property {sting} [x] +>x : Symbol(x, Decl(a.js, 6, 24)) >sting : Symbol(sting) */ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff index 0ef450803a..b79f3f0a5b 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff @@ -1,9 +1,13 @@ --- old.jsdocPropertyTagInvalid.symbols +++ new.jsdocPropertyTagInvalid.symbols -@@= skipped -3, +3 lines =@@ +@@= skipped -2, +2 lines =@@ + === /a.js === /** * @typedef MyType ++>MyType : Symbol(MyType, Decl(a.js, 6, 24)) ++ * @property {sting} [x] ++>x : Symbol(x, Decl(a.js, 6, 24)) +>sting : Symbol(sting) + */ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.types b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.types index 597373ce56..896580c8ba 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.types @@ -3,21 +3,25 @@ === /a.js === /** * @typedef MyType +>MyType : MyType + * @property {sting} [x] +>x : any + */ /** @param {MyType} p */ export function f(p) { } ->f : (p: any) => void ->p : any +>f : (p: MyType) => void +>p : MyType === /b.js === import { f } from "./a.js" ->f : (p: any) => void +>f : (p: MyType) => void f({ x: 42 }) >f({ x: 42 }) : void ->f : (p: any) => void +>f : (p: MyType) => void >{ x: 42 } : { x: number; } >x : number >42 : 42 diff --git a/testdata/baselines/reference/submodule/compiler/jsdocReferenceGlobalTypeInCommonJs.types b/testdata/baselines/reference/submodule/compiler/jsdocReferenceGlobalTypeInCommonJs.types index 8300ebe55f..8df103b0e1 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocReferenceGlobalTypeInCommonJs.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocReferenceGlobalTypeInCommonJs.types @@ -9,7 +9,7 @@ const other = require('./other'); /** @type {Puppeteer.Keyboard} */ var ppk; ->ppk : any +>ppk : Keyboard Puppeteer.connect; >Puppeteer.connect : (name: string) => void diff --git a/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt new file mode 100644 index 0000000000..6c3a675c1e --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.errors.txt @@ -0,0 +1,15 @@ +/a.js(2,12): error TS2304: Cannot find name 'Ty'. + + +==== /a.js (1 errors) ==== + /** + * @param {Ty} x + ~~ +!!! error TS2304: Cannot find name 'Ty'. + */ + function f(x) {} + + /** + * @typedef {CantResolveThis} Ty + */ + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.types b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.types index 901d06a344..475bea13be 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocResolveNameFailureInTypedef.types @@ -5,8 +5,8 @@ * @param {Ty} x */ function f(x) {} ->f : (x: any) => void ->x : any +>f : (x: Ty) => void +>x : Ty /** * @typedef {CantResolveThis} Ty diff --git a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.types b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.types index d9826557ab..21e6295150 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter.types @@ -3,11 +3,11 @@ === /a.js === /** @param {...number} a */ function f(a) { ->f : (a: any) => void ->a : any +>f : (a: number[]) => void +>a : number[] a; // number | undefined ->a : any +>a : number[] // Ideally this would be a number. But currently checker.ts has only one `argumentsSymbol`, so it's `any`. arguments[0]; @@ -17,20 +17,20 @@ function f(a) { } f([1, 2]); // Error >f([1, 2]) : void ->f : (a: any) => void +>f : (a: number[]) => void >[1, 2] : number[] >1 : 1 >2 : 2 f(1, "2"); // Error >f(1, "2") : void ->f : (a: any) => void +>f : (a: number[]) => void >1 : 1 >"2" : "2" f(1, 2); >f(1, 2) : void ->f : (a: any) => void +>f : (a: number[]) => void >1 : 1 >2 : 2 diff --git a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.types b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.types index cd5374a8c5..f452668a53 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocRestParameter_es6.types @@ -3,10 +3,10 @@ === /a.js === /** @param {...number} a */ function f(...a) { ->f : (...a: any[]) => void ->a : any[] +>f : (...a: number[]) => void +>a : number[] a; // number[] ->a : any[] +>a : number[] } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt new file mode 100644 index 0000000000..c104964181 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.errors.txt @@ -0,0 +1,26 @@ +jsdocTypeCast.js(6,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. +jsdocTypeCast.js(10,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. + + +==== jsdocTypeCast.js (2 errors) ==== + /** + * @param {string} x + */ + function f(x) { + /** @type {'a' | 'b'} */ + let a = (x); // Error + ~ +!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. + a; + + /** @type {'a' | 'b'} */ + let b = (((x))); // Error + ~ +!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. + b; + + /** @type {'a' | 'b'} */ + let c = /** @type {'a' | 'b'} */ (x); // Ok + c; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.types b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.types index 7a4cf5b041..1ba298ee22 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeCast.types @@ -5,36 +5,37 @@ * @param {string} x */ function f(x) { ->f : (x: any) => void ->x : any +>f : (x: string) => void +>x : string /** @type {'a' | 'b'} */ let a = (x); // Error ->a : any ->(x) : any ->x : any +>a : "a" | "b" +>(x) : string +>x : string a; ->a : any +>a : "a" | "b" /** @type {'a' | 'b'} */ let b = (((x))); // Error ->b : any ->(((x))) : any ->((x)) : any ->(x) : any ->x : any +>b : "a" | "b" +>(((x))) : string +>((x)) : string +>(x) : string +>x : string b; ->b : any +>b : "a" | "b" /** @type {'a' | 'b'} */ let c = /** @type {'a' | 'b'} */ (x); // Ok ->c : any ->(x) : any ->x : any +>c : "a" | "b" +>(x) : "a" | "b" +>x : "a" | "b" +>x : string c; ->c : any +>c : "a" | "b" } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeGenericInstantiationAttempt.types b/testdata/baselines/reference/submodule/compiler/jsdocTypeGenericInstantiationAttempt.types index e3a8cd07d7..e4bf7c2750 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypeGenericInstantiationAttempt.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeGenericInstantiationAttempt.types @@ -5,10 +5,10 @@ * @param {Array<*>} list */ function thing(list) { ->thing : (list: any) => any ->list : any +>thing : (list: any[]) => any[] +>list : any[] return list; ->list : any +>list : any[] } diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt new file mode 100644 index 0000000000..2bb4e07c0e --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt @@ -0,0 +1,118 @@ +index.js(2,19): error TS2315: Type 'Boolean' is not generic. +index.js(2,27): error TS2304: Cannot find name 'T'. +index2.js(2,19): error TS2304: Cannot find name 'Void'. +index2.js(2,24): error TS2304: Cannot find name 'T'. +index3.js(2,19): error TS2304: Cannot find name 'Undefined'. +index3.js(2,29): error TS2304: Cannot find name 'T'. +index4.js(2,19): error TS2315: Type 'Function' is not generic. +index4.js(2,28): error TS2304: Cannot find name 'T'. +index5.js(2,19): error TS2315: Type 'String' is not generic. +index5.js(2,26): error TS2304: Cannot find name 'T'. +index6.js(2,19): error TS2315: Type 'Number' is not generic. +index6.js(2,26): error TS2304: Cannot find name 'T'. +index7.js(2,19): error TS2315: Type 'Object' is not generic. +index7.js(2,26): error TS2304: Cannot find name 'T'. +index8.js(4,12): error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? +index8.js(4,15): error TS2304: Cannot find name 'T'. + + +==== index.js (2 errors) ==== + /** + * @param {(m: Boolean) => string} somebody + ~~~~~~~~~~ +!!! error TS2315: Type 'Boolean' is not generic. + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function sayHello(somebody) { + return 'Hello ' + somebody; + } + +==== index2.js (2 errors) ==== + /** + * @param {(m: Void) => string} somebody + ~~~~ +!!! error TS2304: Cannot find name 'Void'. + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function sayHello2(somebody) { + return 'Hello ' + somebody; + } + + +==== index3.js (2 errors) ==== + /** + * @param {(m: Undefined) => string} somebody + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'Undefined'. + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function sayHello3(somebody) { + return 'Hello ' + somebody; + } + + +==== index4.js (2 errors) ==== + /** + * @param {(m: Function) => string} somebody + ~~~~~~~~~~~ +!!! error TS2315: Type 'Function' is not generic. + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function sayHello4(somebody) { + return 'Hello ' + somebody; + } + + +==== index5.js (2 errors) ==== + /** + * @param {(m: String) => string} somebody + ~~~~~~~~~ +!!! error TS2315: Type 'String' is not generic. + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function sayHello5(somebody) { + return 'Hello ' + somebody; + } + + +==== index6.js (2 errors) ==== + /** + * @param {(m: Number) => string} somebody + ~~~~~~~~~ +!!! error TS2315: Type 'Number' is not generic. + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function sayHello6(somebody) { + return 'Hello ' + somebody; + } + + +==== index7.js (2 errors) ==== + /** + * @param {(m: Object) => string} somebody + ~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function sayHello7(somebody) { + return 'Hello ' + somebody; + } + +==== index8.js (2 errors) ==== + function fn() {} + + /** + * @param {fn} somebody + ~~ +!!! error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function sayHello8(somebody) { } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.types b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.types index 946d5fc1c8..1783c242b0 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypeNongenericInstantiationAttempt.types @@ -5,13 +5,13 @@ * @param {(m: Boolean) => string} somebody */ function sayHello(somebody) { ->sayHello : (somebody: any) => string ->somebody : any +>sayHello : (somebody: (m: any) => string) => string +>somebody : (m: any) => string return 'Hello ' + somebody; >'Hello ' + somebody : string >'Hello ' : "Hello " ->somebody : any +>somebody : (m: any) => string } === index2.js === @@ -19,13 +19,13 @@ function sayHello(somebody) { * @param {(m: Void) => string} somebody */ function sayHello2(somebody) { ->sayHello2 : (somebody: any) => string ->somebody : any +>sayHello2 : (somebody: (m: Void) => string) => string +>somebody : (m: Void) => string return 'Hello ' + somebody; >'Hello ' + somebody : string >'Hello ' : "Hello " ->somebody : any +>somebody : (m: Void) => string } @@ -34,13 +34,13 @@ function sayHello2(somebody) { * @param {(m: Undefined) => string} somebody */ function sayHello3(somebody) { ->sayHello3 : (somebody: any) => string ->somebody : any +>sayHello3 : (somebody: (m: Undefined) => string) => string +>somebody : (m: Undefined) => string return 'Hello ' + somebody; >'Hello ' + somebody : string >'Hello ' : "Hello " ->somebody : any +>somebody : (m: Undefined) => string } @@ -49,13 +49,13 @@ function sayHello3(somebody) { * @param {(m: Function) => string} somebody */ function sayHello4(somebody) { ->sayHello4 : (somebody: any) => string ->somebody : any +>sayHello4 : (somebody: (m: any) => string) => string +>somebody : (m: any) => string return 'Hello ' + somebody; >'Hello ' + somebody : string >'Hello ' : "Hello " ->somebody : any +>somebody : (m: any) => string } @@ -64,13 +64,13 @@ function sayHello4(somebody) { * @param {(m: String) => string} somebody */ function sayHello5(somebody) { ->sayHello5 : (somebody: any) => string ->somebody : any +>sayHello5 : (somebody: (m: any) => string) => string +>somebody : (m: any) => string return 'Hello ' + somebody; >'Hello ' + somebody : string >'Hello ' : "Hello " ->somebody : any +>somebody : (m: any) => string } @@ -79,13 +79,13 @@ function sayHello5(somebody) { * @param {(m: Number) => string} somebody */ function sayHello6(somebody) { ->sayHello6 : (somebody: any) => string ->somebody : any +>sayHello6 : (somebody: (m: any) => string) => string +>somebody : (m: any) => string return 'Hello ' + somebody; >'Hello ' + somebody : string >'Hello ' : "Hello " ->somebody : any +>somebody : (m: any) => string } @@ -94,13 +94,13 @@ function sayHello6(somebody) { * @param {(m: Object) => string} somebody */ function sayHello7(somebody) { ->sayHello7 : (somebody: any) => string ->somebody : any +>sayHello7 : (somebody: (m: any) => string) => string +>somebody : (m: any) => string return 'Hello ' + somebody; >'Hello ' + somebody : string >'Hello ' : "Hello " ->somebody : any +>somebody : (m: any) => string } === index8.js === @@ -111,6 +111,6 @@ function fn() {} * @param {fn} somebody */ function sayHello8(somebody) { } ->sayHello8 : (somebody: any) => void ->somebody : any +>sayHello8 : (somebody: fn) => void +>somebody : fn diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.types b/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.types index 0e21514ee4..8971fa2a51 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.types @@ -3,6 +3,7 @@ === test.js === // @ts-check /** @typedef {number} NotADuplicateIdentifier */ +>NotADuplicateIdentifier : any (2 * 2); >(2 * 2) : number @@ -11,6 +12,7 @@ >2 : 2 /** @typedef {number} AlsoNotADuplicate */ +>AlsoNotADuplicate : any (2 * 2) + 1; >(2 * 2) + 1 : number @@ -27,7 +29,7 @@ * @param b {AlsoNotADuplicate} */ function makeSureTypedefsAreStillRecognized(a, b) {} ->makeSureTypedefsAreStillRecognized : (a: any, b: any) => void ->a : any ->b : any +>makeSureTypedefsAreStillRecognized : (a: number, b: number) => void +>a : number +>b : number diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.types b/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.types index 71b185202a..6632c27319 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.types @@ -11,12 +11,16 @@ const t = 0; // OK: missing a type, but have property tags. /** * @typedef Person +>Person : any + * @property {string} name +>name : any + */ /** @type Person */ const person = { name: "" }; ->person : { name: string; } +>person : Person >{ name: "" } : { name: string; } >name : string >"" : "" diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash.types b/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash.types index 6ec8528809..f6c2cab92f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash.types @@ -5,6 +5,8 @@ * @typedef {{ * }} */ +> : any + export const foo = 5; >foo : 5 >5 : 5 diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash2.types b/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash2.types index 52022acf9f..f02a712c37 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash2.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash2.types @@ -8,6 +8,8 @@ export type foo = 5; * @typedef {{ * }} */ +> : any + export const foo = 5; >foo : 5 >5 : 5 diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.types b/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.types index d82a1e6fd1..464ba9c003 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.types @@ -3,12 +3,16 @@ === /a.js === /** * @typedef Foo +>Foo : any + * @property foo +>foo : any + */ /** @type {Foo} */ const x = { foo: 0 }; ->x : { foo: number; } +>x : Foo >{ foo: 0 } : { foo: number; } >foo : number >0 : 0 diff --git a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.errors.txt b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.errors.txt index de941a86d5..3f08e2966f 100644 --- a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.errors.txt @@ -1,14 +1,17 @@ a.js(2,11): error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. +a.js(4,48): error TS2304: Cannot find name 'B'. a.js(5,11): error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. -==== a.js (2 errors) ==== +==== a.js (3 errors) ==== /** @typedef {{ endTime: number, screenshots: number}} A.*/ Animation.AnimationModel.ScreenshotCapture.Request; ~~~~~~~~~~~~~~ !!! error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. /** @typedef {{ endTime: number, screenshots: !B.}} */ + ~ +!!! error TS2304: Cannot find name 'B'. Animation.AnimationModel.ScreenshotCapture.Request; ~~~~~~~~~~~~~~ !!! error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.types b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.types index a9510d2efc..9fc00e5e93 100644 --- a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.types +++ b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.types @@ -2,6 +2,10 @@ === a.js === /** @typedef {{ endTime: number, screenshots: number}} A.*/ +>A : any +>endTime : number +>screenshots : number + Animation.AnimationModel.ScreenshotCapture.Request; >Animation.AnimationModel.ScreenshotCapture.Request : any >Animation.AnimationModel.ScreenshotCapture : any @@ -12,6 +16,10 @@ Animation.AnimationModel.ScreenshotCapture.Request; >Request : any /** @typedef {{ endTime: number, screenshots: !B.}} */ +> : any +>endTime : number +>screenshots : B + Animation.AnimationModel.ScreenshotCapture.Request; >Animation.AnimationModel.ScreenshotCapture.Request : any >Animation.AnimationModel.ScreenshotCapture : any diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols index 0cf1309b93..3acb7e7680 100644 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols +++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols @@ -16,7 +16,9 @@ const getStringGetter = (key) => { return () => { return /** @type {string} */ (cache.get(key)) +>cache.get : Symbol(get, Decl(lib.es2015.collection.d.ts, --, --)) >cache : Symbol(cache, Decl(index.js, 1, 5)) +>get : Symbol(get, Decl(lib.es2015.collection.d.ts, --, --)) >key : Symbol(key, Decl(index.js, 7, 25)) } } diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols.diff b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols.diff index 719418e59e..2bd63ad02b 100644 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.symbols.diff @@ -5,8 +5,10 @@ return () => { return /** @type {string} */ (cache.get(key)) ->cache.get : Symbol(Map.get, Decl(lib.es2015.collection.d.ts, --, --)) ++>cache.get : Symbol(get, Decl(lib.es2015.collection.d.ts, --, --)) >cache : Symbol(cache, Decl(index.js, 1, 5)) ->get : Symbol(Map.get, Decl(lib.es2015.collection.d.ts, --, --)) ++>get : Symbol(get, Decl(lib.es2015.collection.d.ts, --, --)) >key : Symbol(key, Decl(index.js, 7, 25)) } } diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.types b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.types index fa1dd127ea..ad819605f9 100644 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.types +++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastAtReturnStatement.types @@ -3,7 +3,7 @@ === index.js === /** @type {Map>} */ const cache = new Map() ->cache : Map +>cache : Map> >new Map() : Map >Map : MapConstructor @@ -12,20 +12,21 @@ const cache = new Map() * @returns {() => string} */ const getStringGetter = (key) => { ->getStringGetter : (key: any) => () => any ->(key) => { return () => { return /** @type {string} */ (cache.get(key)) }} : (key: any) => () => any ->key : any +>getStringGetter : (key: string) => () => string +>(key) => { return () => { return /** @type {string} */ (cache.get(key)) }} : (key: string) => () => string +>key : string return () => { ->() => { return /** @type {string} */ (cache.get(key)) } : () => any +>() => { return /** @type {string} */ (cache.get(key)) } : () => string return /** @type {string} */ (cache.get(key)) ->(cache.get(key)) : any ->cache.get(key) : any ->cache.get : (key: any) => any ->cache : Map ->get : (key: any) => any ->key : any +>(cache.get(key)) : string +>cache.get(key) : string +>cache.get(key) : string | Set | undefined +>cache.get : (key: string) => string | Set | undefined +>cache : Map> +>get : (key: string) => string | Set | undefined +>key : string } } diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.errors.txt b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.errors.txt new file mode 100644 index 0000000000..c50bcf83c9 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.errors.txt @@ -0,0 +1,22 @@ +index.js(12,8): error TS2678: Type '"invalid"' is not comparable to type '"bar" | "foo"'. + + +==== index.js (1 errors) ==== + let value = ""; + + switch (/** @type {"foo" | "bar"} */ (value)) { + case "bar": + value; + break; + + case "foo": + value; + break; + + case "invalid": + ~~~~~~~~~ +!!! error TS2678: Type '"invalid"' is not comparable to type '"bar" | "foo"'. + value; + break; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.types b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.types index 6b4d950d51..fd2f5c031c 100644 --- a/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.types +++ b/testdata/baselines/reference/submodule/compiler/parenthesizedJSDocCastDoesNotNarrow.types @@ -6,14 +6,15 @@ let value = ""; >"" : "" switch (/** @type {"foo" | "bar"} */ (value)) { ->(value) : string +>(value) : "bar" | "foo" +>value : "bar" | "foo" >value : string case "bar": >"bar" : "bar" value; ->value : "bar" +>value : string break; @@ -21,7 +22,7 @@ switch (/** @type {"foo" | "bar"} */ (value)) { >"foo" : "foo" value; ->value : "foo" +>value : string break; @@ -29,7 +30,7 @@ switch (/** @type {"foo" | "bar"} */ (value)) { >"invalid" : "invalid" value; ->value : "invalid" +>value : string break; } diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols index e68a2c1803..4d4e83f4f4 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols @@ -12,7 +12,9 @@ const json1 = require("./json.json"); // No error (bad) >json1 : Symbol(json1, Decl(user.js, 4, 5)) json1.b; // No error (OK since that's the type annotation) +>json1.b : Symbol(b, Decl(user.js, 3, 12)) >json1 : Symbol(json1, Decl(user.js, 4, 5)) +>b : Symbol(b, Decl(user.js, 3, 12)) const js0 = require("./js.js"); >js0 : Symbol(js0, Decl(user.js, 7, 5)) @@ -25,7 +27,9 @@ const js1 = require("./js.js"); // Error (good) >js1 : Symbol(js1, Decl(user.js, 11, 5)) js1.b; +>js1.b : Symbol(b, Decl(user.js, 10, 12)) >js1 : Symbol(js1, Decl(user.js, 11, 5)) +>b : Symbol(b, Decl(user.js, 10, 12)) === /json.json === { "a": 0 } diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff index 4a853f1c3a..99b69ac56e 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff @@ -17,9 +17,8 @@ ->"./json.json" : Symbol("/json", Decl(json.json, 0, 0)) json1.b; // No error (OK since that's the type annotation) -->json1.b : Symbol(b, Decl(user.js, 3, 12)) - >json1 : Symbol(json1, Decl(user.js, 4, 5)) -->b : Symbol(b, Decl(user.js, 3, 12)) + >json1.b : Symbol(b, Decl(user.js, 3, 12)) +@@= skipped -10, +8 lines =@@ const js0 = require("./js.js"); >js0 : Symbol(js0, Decl(user.js, 7, 5)) @@ -28,7 +27,7 @@ json0.b; // Error (good) >json0 : Symbol(json0, Decl(user.js, 0, 5)) -@@= skipped -19, +13 lines =@@ +@@= skipped -9, +7 lines =@@ /** @type {{ b: number }} */ const js1 = require("./js.js"); // Error (good) >js1 : Symbol(js1, Decl(user.js, 11, 5)) @@ -36,9 +35,8 @@ ->"./js.js" : Symbol("/js", Decl(js.js, 0, 0)) js1.b; -->js1.b : Symbol(b, Decl(user.js, 10, 12)) - >js1 : Symbol(js1, Decl(user.js, 11, 5)) -->b : Symbol(b, Decl(user.js, 10, 12)) + >js1.b : Symbol(b, Decl(user.js, 10, 12)) +@@= skipped -10, +8 lines =@@ === /json.json === { "a": 0 } diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types index af498ff59b..4afa7dc442 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types @@ -14,15 +14,15 @@ json0.b; // Error (good) /** @type {{ b: number }} */ const json1 = require("./json.json"); // No error (bad) ->json1 : any +>json1 : { b: number; } >require("./json.json") : any >require : any >"./json.json" : "./json.json" json1.b; // No error (OK since that's the type annotation) ->json1.b : any ->json1 : any ->b : any +>json1.b : number +>json1 : { b: number; } +>b : number const js0 = require("./js.js"); >js0 : any @@ -37,15 +37,15 @@ json0.b; // Error (good) /** @type {{ b: number }} */ const js1 = require("./js.js"); // Error (good) ->js1 : any +>js1 : { b: number; } >require("./js.js") : any >require : any >"./js.js" : "./js.js" js1.b; ->js1.b : any ->js1 : any ->b : any +>js1.b : number +>js1 : { b: number; } +>b : number === /json.json === { "a": 0 } diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt new file mode 100644 index 0000000000..ae46bda792 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.errors.txt @@ -0,0 +1,25 @@ +a.js(14,7): error TS2375: Type '{ value: undefined; }' is not assignable to type '{ value?: number; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. + Types of property 'value' are incompatible. + Type 'undefined' is not assignable to type 'number'. + + +==== a.js (1 errors) ==== + /** + * @typedef {object} A + * @property {number} [value] + */ + + /** @type {A} */ + const a = { value: undefined }; // error + + /** + * @typedef {{ value?: number }} B + */ + + /** @type {B} */ + const b = { value: undefined }; // error + ~ +!!! error TS2375: Type '{ value: undefined; }' is not assignable to type '{ value?: number; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. +!!! error TS2375: Types of property 'value' are incompatible. +!!! error TS2375: Type 'undefined' is not assignable to type 'number'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types index 2eb9d12c85..76173298d4 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types @@ -3,23 +3,30 @@ === a.js === /** * @typedef {object} A +>A : any + * @property {number} [value] +>value : any + */ /** @type {A} */ const a = { value: undefined }; // error ->a : { value: undefined; } +>a : A >{ value: undefined } : { value: undefined; } >value : undefined >undefined : undefined /** * @typedef {{ value?: number }} B +>B : any +>value : number | undefined + */ /** @type {B} */ const b = { value: undefined }; // error ->b : { value: undefined; } +>b : { value?: number; } >{ value: undefined } : { value: undefined; } >value : undefined >undefined : undefined diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.errors.txt b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.errors.txt deleted file mode 100644 index 768549149e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -a.js(7,3): error TS2339: Property 'foo' does not exist on type '{}'. -a.js(10,3): error TS2339: Property 'foo' does not exist on type '{}'. - - -==== a.js (2 errors) ==== - /** - * @typedef Foo - * @property {number} [foo] - */ - - const x = /** @type {Foo} */ ({}); - x.foo; // number | undefined - ~~~ -!!! error TS2339: Property 'foo' does not exist on type '{}'. - - const y = /** @type {Required} */ ({}); - y.foo; // number - ~~~ -!!! error TS2339: Property 'foo' does not exist on type '{}'. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols index 1499abdaf5..5a6fdae2ef 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols @@ -8,13 +8,20 @@ const x = /** @type {Foo} */ ({}); >x : Symbol(x, Decl(a.js, 5, 5)) +>Foo : Symbol(Foo, Decl(a.js, 5, 34)) x.foo; // number | undefined +>x.foo : Symbol(foo, Decl(a.js, 5, 34)) >x : Symbol(x, Decl(a.js, 5, 5)) +>foo : Symbol(foo, Decl(a.js, 5, 34)) const y = /** @type {Required} */ ({}); >y : Symbol(y, Decl(a.js, 8, 5)) +>Required : Symbol(Required, Decl(lib.es5.d.ts, --, --)) +>Foo : Symbol(Foo, Decl(a.js, 5, 34)) y.foo; // number +>y.foo : Symbol(foo, Decl(a.js, 5, 34)) >y : Symbol(y, Decl(a.js, 8, 5)) +>foo : Symbol(foo, Decl(a.js, 5, 34)) diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff index 4be70e1063..2fa051e115 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff @@ -1,18 +1,27 @@ --- old.strictOptionalProperties4.symbols +++ new.strictOptionalProperties4.symbols -@@= skipped -9, +9 lines =@@ +@@= skipped -7, +7 lines =@@ + + const x = /** @type {Foo} */ ({}); >x : Symbol(x, Decl(a.js, 5, 5)) ++>Foo : Symbol(Foo, Decl(a.js, 5, 34)) x.foo; // number | undefined ->x.foo : Symbol(foo, Decl(a.js, 2, 3)) ++>x.foo : Symbol(foo, Decl(a.js, 5, 34)) >x : Symbol(x, Decl(a.js, 5, 5)) ->foo : Symbol(foo, Decl(a.js, 2, 3)) ++>foo : Symbol(foo, Decl(a.js, 5, 34)) const y = /** @type {Required} */ ({}); >y : Symbol(y, Decl(a.js, 8, 5)) ++>Required : Symbol(Required, Decl(lib.es5.d.ts, --, --)) ++>Foo : Symbol(Foo, Decl(a.js, 5, 34)) y.foo; // number ->y.foo : Symbol(foo, Decl(a.js, 2, 3)) ++>y.foo : Symbol(foo, Decl(a.js, 5, 34)) >y : Symbol(y, Decl(a.js, 8, 5)) ->foo : Symbol(foo, Decl(a.js, 2, 3)) ++>foo : Symbol(foo, Decl(a.js, 5, 34)) diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types index 9063ffd4a2..94bd2ffabb 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types @@ -3,26 +3,32 @@ === a.js === /** * @typedef Foo +>Foo : any + * @property {number} [foo] +>foo : any + */ const x = /** @type {Foo} */ ({}); ->x : {} ->({}) : {} +>x : Foo +>({}) : Foo +>{} : Foo >{} : {} x.foo; // number | undefined >x.foo : any ->x : {} +>x : Foo >foo : any const y = /** @type {Required} */ ({}); ->y : {} ->({}) : {} +>y : Required +>({}) : Required +>{} : Required >{} : {} y.foo; // number >y.foo : any ->y : {} +>y : Required >foo : any diff --git a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt index 222af3b09f..e97bdfb5ac 100644 --- a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.errors.txt @@ -1,3 +1,5 @@ +file1.js(2,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent'. + Index signature for type 'number' is missing in type 'C'. tile1.ts(2,30): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. tile1.ts(6,81): error TS2744: Type parameter defaults can only reference previously declared type parameters. tile1.ts(11,40): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. @@ -56,7 +58,10 @@ tile1.ts(24,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent ~~~~~ !!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'. !!! error TS2322: Index signature for type 'number' is missing in type 'C'. -==== file1.js (0 errors) ==== +==== file1.js (1 errors) ==== /** @type {ClassComponent} */ const test9 = new C(); + ~~~~~ +!!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'. +!!! error TS2322: Index signature for type 'number' is missing in type 'C'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.types b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.types index 2ba991b5a7..f77769d45a 100644 --- a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.types +++ b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable01.types @@ -52,7 +52,7 @@ const test8: ClassComponent = new C(); === file1.js === /** @type {ClassComponent} */ const test9 = new C(); ->test9 : C +>test9 : ClassComponent >new C() : C >C : typeof C diff --git a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable02.types b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable02.types index f7c73195a3..448ba4755a 100644 --- a/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable02.types +++ b/testdata/baselines/reference/submodule/compiler/subclassThisTypeAssignable02.types @@ -57,7 +57,7 @@ const test8: ClassComponent = new C(); === file1.js === /** @type {ClassComponent} */ const test9 = new C(); ->test9 : C +>test9 : ClassComponent >new C() : C >C : typeof C diff --git a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols index 6cbefeb2fe..9e59702891 100644 --- a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols +++ b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols @@ -42,8 +42,14 @@ interface Person { // Creates a type { first:string, last: string } /** * @typedef {Object} Human - creates a new type named 'SpecialType' +>Human : Symbol(Human, Decl(check.js, 10, 32)) + * @property {string} first - a string property of SpecialType +>first : Symbol(first, Decl(check.js, 10, 32)) + * @property {string} last - a number property of SpecialType +>last : Symbol(last, Decl(check.js, 10, 32)) + */ /** diff --git a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols.diff b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols.diff index 4c70cc91e9..b1009db373 100644 --- a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols.diff @@ -42,7 +42,22 @@ const diceP: Person = dice; >diceP : Symbol(diceP, Decl(check.ts, 10, 7)) -@@= skipped -48, +48 lines =@@ +@@= skipped -36, +36 lines =@@ + // Creates a type { first:string, last: string } + /** + * @typedef {Object} Human - creates a new type named 'SpecialType' ++>Human : Symbol(Human, Decl(check.js, 10, 32)) ++ + * @property {string} first - a string property of SpecialType ++>first : Symbol(first, Decl(check.js, 10, 32)) ++ + * @property {string} last - a number property of SpecialType ++>last : Symbol(last, Decl(check.js, 10, 32)) ++ + */ + + /** +@@= skipped -12, +18 lines =@@ >param : Symbol(param, Decl(check.js, 10, 23)) const dice1 = () => Math.floor(Math.random() * 6); diff --git a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.types b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.types index 70ff3c3075..65a91cc07c 100644 --- a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.types +++ b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.types @@ -48,16 +48,22 @@ interface Person { // Creates a type { first:string, last: string } /** * @typedef {Object} Human - creates a new type named 'SpecialType' +>Human : Human + * @property {string} first - a string property of SpecialType +>first : any + * @property {string} last - a number property of SpecialType +>last : any + */ /** * @param {Human} param used as a validation tool */ function doHumanThings(param) {} ->doHumanThings : (param: any) => void ->param : any +>doHumanThings : (param: Human) => void +>param : Human const dice1 = () => Math.floor(Math.random() * 6); >dice1 : { (): number; last: string; } @@ -115,7 +121,7 @@ dice1.last = 'Calrissian'; doHumanThings(dice2) >doHumanThings(dice2) : void ->doHumanThings : (param: any) => void +>doHumanThings : (param: Human) => void >dice2 : { (): number; first: string; last: string; } } diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInJSDoc.types b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInJSDoc.types index 815c6a477a..363466c2f6 100644 --- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInJSDoc.types +++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInJSDoc.types @@ -6,18 +6,18 @@ * @param {number} a\u0061 */ function foo(a, aa) { ->foo : (a: any, aa: any) => void ->a : any ->aa : any +>foo : (a: number, aa: number) => void +>a : number +>aa : number console.log(a + aa); >console.log(a + aa) : void >console.log : (...data: any[]) => void >console : Console >log : (...data: any[]) => void ->a + aa : any ->a : any ->aa : any +>a + aa : number +>a : number +>aa : number } /** @@ -25,17 +25,17 @@ function foo(a, aa) { * @param {number} a\u{0061} */ function bar(a, aa) { ->bar : (a: any, aa: any) => void ->a : any ->aa : any +>bar : (a: number, aa: number) => void +>a : number +>aa : number console.log(a + aa); >console.log(a + aa) : void >console.log : (...data: any[]) => void >console : Console >log : (...data: any[]) => void ->a + aa : any ->a : any ->aa : any +>a + aa : number +>a : number +>aa : number } diff --git a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt new file mode 100644 index 0000000000..9e2a2f66c8 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt @@ -0,0 +1,19 @@ +file1.js(3,21): error TS2304: Cannot find name 'T'. + + +==== file1.js (1 errors) ==== + /** + * @template {string} T + * @typedef {{ foo: T }} Foo + ~ +!!! error TS2304: Cannot find name 'T'. + */ + + export default {}; + +==== file2.js (0 errors) ==== + /** + * @template T + * @typedef {import('./file1').Foo} Bar + */ + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.types b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.types index e954cca2fb..264a48a540 100644 --- a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.types +++ b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.types @@ -4,6 +4,9 @@ /** * @template {string} T * @typedef {{ foo: T }} Foo +>Foo : any +>foo : T + */ export default {}; diff --git a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.errors.txt b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.errors.txt new file mode 100644 index 0000000000..b8aec3b5b7 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.errors.txt @@ -0,0 +1,9 @@ +/a.js(2,1): error TS6196: 'T' is declared but never used. + + +==== /a.js (1 errors) ==== + /** @template T */ + function f() {} + ~~~~~~~~~~~~~~~ +!!! error TS6196: 'T' is declared but never used. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.types b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.types index 5e8dabf8aa..9123dc4771 100644 --- a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.types +++ b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.types @@ -3,5 +3,5 @@ === /a.js === /** @template T */ function f() {} ->f : () => void +>f : () => void diff --git a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.errors.txt b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.errors.txt index 4ba937de21..a88e77ffd9 100644 --- a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.errors.txt @@ -1,36 +1,81 @@ -/a.js(8,14): error TS2339: Property 'p' does not exist on type 'C1'. -/a.js(25,14): error TS2339: Property 'p' does not exist on type 'C3'. +/a.js(1,1): error TS6205: All type parameters are unused. +/a.js(8,14): error TS2339: Property 'p' does not exist on type 'C1'. +/a.js(10,1): error TS6205: All type parameters are unused. +/a.js(17,1): error TS6205: All type parameters are unused. +/a.js(25,14): error TS2339: Property 'p' does not exist on type 'C3'. -==== /a.js (2 errors) ==== +==== /a.js (5 errors) ==== /** + ~~~ * @template T + ~~~~~~~~~~~~~~ * @template V + ~~~~~~~~~~~~~~ */ + ~~~ class C1 { + ~~~~~~~~~~ constructor() { + ~~~~~~~~~~~~~~~~~~~ /** @type {T} */ + ~~~~~~~~~~~~~~~~~~~~~~~~ this.p; + ~~~~~~~~~~~~~~~ ~ -!!! error TS2339: Property 'p' does not exist on type 'C1'. +!!! error TS2339: Property 'p' does not exist on type 'C1'. } + ~~~~~ } + ~ + ~ + + /** + ~~~ + ~~~ * @template T,V + ~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~ */ + ~~~ + ~~~ class C2 { + ~ +!!! error TS6205: All type parameters are unused. + ~~~~~~~~~~ constructor() { } + ~~~~~~~~~~~~~~~~~~~~~ } + ~ + ~ + + /** + ~~~ + ~~~ * @template T,V,X + ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ */ + ~~~ + ~~~ class C3 { + ~ +!!! error TS6205: All type parameters are unused. + ~~~~~~~~~~ constructor() { + ~~~~~~~~~~~~~~~~~~~ /** @type {T} */ + ~~~~~~~~~~~~~~~~~~~~~~~~ this.p; + ~~~~~~~~~~~~~~~ ~ -!!! error TS2339: Property 'p' does not exist on type 'C3'. +!!! error TS2339: Property 'p' does not exist on type 'C3'. } - } \ No newline at end of file + ~~~~~ + } + ~ +!!! error TS6205: All type parameters are unused. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.types b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.types index 677e8b9729..79efeecbe1 100644 --- a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.types +++ b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.types @@ -6,7 +6,7 @@ * @template V */ class C1 { ->C1 : C1 +>C1 : C1 constructor() { /** @type {T} */ @@ -21,7 +21,7 @@ class C1 { * @template T,V */ class C2 { ->C2 : C2 +>C2 : C2 constructor() { } } @@ -30,7 +30,7 @@ class C2 { * @template T,V,X */ class C3 { ->C3 : C3 +>C3 : C3 constructor() { /** @type {T} */ diff --git a/testdata/baselines/reference/submodule/conformance/annotatedThisPropertyInitializerDoesntNarrow.types b/testdata/baselines/reference/submodule/conformance/annotatedThisPropertyInitializerDoesntNarrow.types index 1646c3be5a..6dfed7c6ed 100644 --- a/testdata/baselines/reference/submodule/conformance/annotatedThisPropertyInitializerDoesntNarrow.types +++ b/testdata/baselines/reference/submodule/conformance/annotatedThisPropertyInitializerDoesntNarrow.types @@ -4,8 +4,8 @@ // from webpack/lib/Compilation.js and filed at #26427 /** @param {{ [s: string]: number }} map */ function mappy(map) {} ->mappy : (map: any) => void ->map : any +>mappy : (map: { [s: string]: number; }) => void +>map : { [s: string]: number; } export class C { >C : C @@ -24,7 +24,7 @@ export class C { mappy(this.assets) >mappy(this.assets) : void ->mappy : (map: any) => void +>mappy : (map: { [s: string]: number; }) => void >this.assets : any >this : this >assets : any diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt new file mode 100644 index 0000000000..472f0246c4 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.errors.txt @@ -0,0 +1,33 @@ +assertionTypePredicates2.js(21,5): error TS2775: Assertions require every name in the call target to be declared with an explicit type annotation. +assertionTypePredicates2.js(21,5): error TS2775: Assertions require every name in the call target to be declared with an explicit type annotation. + + +==== assertionTypePredicates2.js (2 errors) ==== + /** + * @typedef {{ x: number }} A + */ + + /** + * @typedef { A & { y: number } } B + */ + + /** + * @param {A} a + * @returns { asserts a is B } + */ + const foo = (a) => { + if (/** @type { B } */ (a).y !== 0) throw TypeError(); + return undefined; + }; + + export const main = () => { + /** @type { A } */ + const a = { x: 1 }; + foo(a); + ~~~ +!!! error TS2775: Assertions require every name in the call target to be declared with an explicit type annotation. +!!! related TS2782 assertionTypePredicates2.js:13:7: 'foo' needs an explicit type annotation. + ~~~ +!!! error TS2775: Assertions require every name in the call target to be declared with an explicit type annotation. + }; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols index 15b3336e72..1b99348d4f 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols @@ -9,7 +9,7 @@ /** * @typedef { A & { y: number } } B ->A : Symbol(A) +>A : Symbol(A, Decl(assertionTypePredicates2.js, 15, 2)) >y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) */ @@ -23,7 +23,10 @@ const foo = (a) => { >a : Symbol(a, Decl(assertionTypePredicates2.js, 12, 13)) if (/** @type { B } */ (a).y !== 0) throw TypeError(); +>(a).y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) +>B : Symbol(B, Decl(assertionTypePredicates2.js, 15, 2)) >a : Symbol(a, Decl(assertionTypePredicates2.js, 12, 13)) +>y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) >TypeError : Symbol(TypeError, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) return undefined; diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff index 3336b72a38..b4549172a3 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff @@ -10,19 +10,17 @@ /** * @typedef { A & { y: number } } B -+>A : Symbol(A) ++>A : Symbol(A, Decl(assertionTypePredicates2.js, 15, 2)) +>y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) + */ /** -@@= skipped -15, +20 lines =@@ - >a : Symbol(a, Decl(assertionTypePredicates2.js, 12, 13)) +@@= skipped -16, +21 lines =@@ if (/** @type { B } */ (a).y !== 0) throw TypeError(); -->(a).y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) + >(a).y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) ++>B : Symbol(B, Decl(assertionTypePredicates2.js, 15, 2)) >a : Symbol(a, Decl(assertionTypePredicates2.js, 12, 13)) -->y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) + >y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) >TypeError : Symbol(TypeError, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - - return undefined; diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types index caa9f13697..d6c2d6f444 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types @@ -3,10 +3,16 @@ === assertionTypePredicates2.js === /** * @typedef {{ x: number }} A +>A : any +>x : number + */ /** * @typedef { A & { y: number } } B +>B : any +>y : number + */ /** @@ -14,16 +20,17 @@ * @returns { asserts a is B } */ const foo = (a) => { ->foo : (a: any) => any ->(a) => { if (/** @type { B } */ (a).y !== 0) throw TypeError(); return undefined;} : (a: any) => any ->a : any +>foo : (a: { x: number; }) => asserts a is { x: number; } & { y: number; } +>(a) => { if (/** @type { B } */ (a).y !== 0) throw TypeError(); return undefined;} : (a: { x: number; }) => asserts a is { x: number; } & { y: number; } +>a : { x: number; } if (/** @type { B } */ (a).y !== 0) throw TypeError(); >(a).y !== 0 : boolean ->(a).y : any ->(a) : any ->a : any ->y : any +>(a).y : number +>(a) : { x: number; } & { y: number; } +>a : { x: number; } & { y: number; } +>a : { x: number; } +>y : number >0 : 0 >TypeError() : TypeError >TypeError : TypeErrorConstructor @@ -45,8 +52,8 @@ export const main = () => { >1 : 1 foo(a); ->foo(a) : any ->foo : (a: any) => any +>foo(a) : void +>foo : (a: { x: number; }) => asserts a is { x: number; } & { y: number; } >a : { x: number; } }; diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt new file mode 100644 index 0000000000..7925bfb827 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.errors.txt @@ -0,0 +1,69 @@ +assertionsAndNonReturningFunctions.js(46,9): error TS7027: Unreachable code detected. +assertionsAndNonReturningFunctions.js(58,5): error TS7027: Unreachable code detected. + + +==== assertionsAndNonReturningFunctions.js (2 errors) ==== + /** @typedef {(check: boolean) => asserts check} AssertFunc */ + + /** @type {AssertFunc} */ + const assert = check => { + if (!check) throw new Error(); + } + + /** @type {(x: unknown) => asserts x is string } */ + function assertIsString(x) { + if (!(typeof x === "string")) throw new Error(); + } + + /** + * @param {boolean} check + * @returns {asserts check} + */ + function assert2(check) { + if (!check) throw new Error(); + } + + /** + * @returns {never} + */ + function fail() { + throw new Error(); + } + + /** + * @param {*} x + */ + function f1(x) { + if (!!true) { + assert(typeof x === "string"); + x.length; + } + if (!!true) { + assert2(typeof x === "string"); + x.length; + } + if (!!true) { + assertIsString(x); + x.length; + } + if (!!true) { + fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + } + + /** + * @param {boolean} b + */ + function f2(b) { + switch (b) { + case true: return 1; + case false: return 0; + } + b; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols index 50cde52438..62da319359 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols @@ -61,7 +61,9 @@ function f1(x) { >x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) x.length; +>x.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) } if (!!true) { assert2(typeof x === "string"); @@ -69,7 +71,9 @@ function f1(x) { >x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) x.length; +>x.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) } if (!!true) { assertIsString(x); diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff index 6e77437041..1348a4378f 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff @@ -14,22 +14,26 @@ x.length; ->x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ++>x.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) ->length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) } if (!!true) { assert2(typeof x === "string"); -@@= skipped -10, +8 lines =@@ +@@= skipped -10, +10 lines =@@ >x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) x.length; ->x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ++>x.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) ->length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) } if (!!true) { assertIsString(x); -@@= skipped -10, +8 lines =@@ +@@= skipped -10, +10 lines =@@ >x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) x.length; diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types index c2ac1067df..fddd606b3a 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types @@ -2,16 +2,18 @@ === assertionsAndNonReturningFunctions.js === /** @typedef {(check: boolean) => asserts check} AssertFunc */ +>AssertFunc : any +>check : boolean /** @type {AssertFunc} */ const assert = check => { ->assert : (check: any) => void ->check => { if (!check) throw new Error();} : (check: any) => void ->check : any +>assert : (check: boolean) => asserts check +>check => { if (!check) throw new Error();} : (check: boolean) => void +>check : boolean if (!check) throw new Error(); >!check : boolean ->check : any +>check : boolean >new Error() : Error >Error : ErrorConstructor } @@ -37,12 +39,12 @@ function assertIsString(x) { * @returns {asserts check} */ function assert2(check) { ->assert2 : (check: any) => void ->check : any +>assert2 : (check: boolean) => asserts check +>check : boolean if (!check) throw new Error(); >!check : boolean ->check : any +>check : boolean >new Error() : Error >Error : ErrorConstructor } @@ -51,7 +53,7 @@ function assert2(check) { * @returns {never} */ function fail() { ->fail : () => void +>fail : () => never throw new Error(); >new Error() : Error @@ -72,16 +74,16 @@ function f1(x) { assert(typeof x === "string"); >assert(typeof x === "string") : void ->assert : (check: any) => void +>assert : (check: boolean) => asserts check >typeof x === "string" : boolean >typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" >x : any >"string" : "string" x.length; ->x.length : any ->x : any ->length : any +>x.length : number +>x : string +>length : number } if (!!true) { >!!true : boolean @@ -90,16 +92,16 @@ function f1(x) { assert2(typeof x === "string"); >assert2(typeof x === "string") : void ->assert2 : (check: any) => void +>assert2 : (check: boolean) => asserts check >typeof x === "string" : boolean >typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" >x : any >"string" : "string" x.length; ->x.length : any ->x : any ->length : any +>x.length : number +>x : string +>length : number } if (!!true) { >!!true : boolean @@ -122,8 +124,8 @@ function f1(x) { >true : true fail(); ->fail() : void ->fail : () => void +>fail() : never +>fail : () => never x; // Unreachable >x : any @@ -134,11 +136,11 @@ function f1(x) { * @param {boolean} b */ function f2(b) { ->f2 : (b: any) => 0 | 1 ->b : any +>f2 : (b: boolean) => 0 | 1 +>b : boolean switch (b) { ->b : any +>b : boolean case true: return 1; >true : true @@ -149,6 +151,6 @@ function f2(b) { >0 : 0 } b; // Unreachable ->b : any +>b : never } diff --git a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt new file mode 100644 index 0000000000..6dc5427f14 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt @@ -0,0 +1,50 @@ +file.js(2,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(6,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + +==== file.js (5 errors) ==== + // Error (good) + /** @type {function(): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const a = () => 0 + + // Error (good) + /** @type {function(): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const b = async () => 0 + + // No error (bad) + /** @type {function(): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const c = async () => { + return 0 + } + + // Error (good) + /** @type {function(): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const d = async () => { + return "" + } + + /** @type {function(function(): string): void} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const f = (p) => {} + + // Error (good) + f(async () => { + return 0 + }) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.types b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.types index f54b0ced23..2e9f7ae259 100644 --- a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.types +++ b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.types @@ -4,21 +4,21 @@ // Error (good) /** @type {function(): string} */ const a = () => 0 ->a : () => number +>a : function >() => 0 : () => number >0 : 0 // Error (good) /** @type {function(): string} */ const b = async () => 0 ->b : () => Promise +>b : function >async () => 0 : () => Promise >0 : 0 // No error (bad) /** @type {function(): string} */ const c = async () => { ->c : () => Promise +>c : function >async () => { return 0} : () => Promise return 0 @@ -28,7 +28,7 @@ const c = async () => { // Error (good) /** @type {function(): string} */ const d = async () => { ->d : () => Promise +>d : function >async () => { return ""} : () => Promise return "" @@ -37,14 +37,14 @@ const d = async () => { /** @type {function(function(): string): void} */ const f = (p) => {} ->f : (p: any) => void +>f : function >(p) => {} : (p: any) => void >p : any // Error (good) f(async () => { ->f(async () => { return 0}) : void ->f : (p: any) => void +>f(async () => { return 0}) : any +>f : function >async () => { return 0} : () => Promise return 0 diff --git a/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt new file mode 100644 index 0000000000..18d3c442d6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.errors.txt @@ -0,0 +1,67 @@ +/a.js(21,14): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? +/a.js(27,12): error TS2304: Cannot find name 'T1'. +/a.js(40,12): error TS2304: Cannot find name 'T2'. +/a.js(45,12): error TS2304: Cannot find name 'T3'. + + +==== /types.d.ts (0 errors) ==== + declare class Thenable { then(): void; } + +==== /a.js (4 errors) ==== + /** + * @callback T1 + * @param {string} str + * @returns {string} + */ + + /** + * @callback T2 + * @param {string} str + * @returns {Promise} + */ + + /** + * @callback T3 + * @param {string} str + * @returns {Thenable} + */ + + /** + * @param {string} str + * @returns {string} + ~~~~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + */ + const f1 = async str => { + return str; + } + + /** @type {T1} */ + ~~ +!!! error TS2304: Cannot find name 'T1'. + const f2 = async str => { + return str; + } + + /** + * @param {string} str + * @returns {Promise} + */ + const f3 = async str => { + return str; + } + + /** @type {T2} */ + ~~ +!!! error TS2304: Cannot find name 'T2'. + const f4 = async str => { + return str; + } + + /** @type {T3} */ + ~~ +!!! error TS2304: Cannot find name 'T3'. + const f5 = async str => { + return str; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.types b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.types index 0e885cffb4..3a95e08bd6 100644 --- a/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.types +++ b/testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration16_es5.types @@ -29,17 +29,17 @@ declare class Thenable { then(): void; } * @returns {string} */ const f1 = async str => { ->f1 : (str: any) => Promise ->async str => { return str;} : (str: any) => Promise ->str : any +>f1 : (str: string) => string +>async str => { return str;} : (str: string) => string +>str : string return str; ->str : any +>str : string } /** @type {T1} */ const f2 = async str => { ->f2 : (str: any) => Promise +>f2 : T1 >async str => { return str;} : (str: any) => Promise >str : any @@ -52,17 +52,17 @@ const f2 = async str => { * @returns {Promise} */ const f3 = async str => { ->f3 : (str: any) => Promise ->async str => { return str;} : (str: any) => Promise ->str : any +>f3 : (str: string) => Promise +>async str => { return str;} : (str: string) => Promise +>str : string return str; ->str : any +>str : string } /** @type {T2} */ const f4 = async str => { ->f4 : (str: any) => Promise +>f4 : T2 >async str => { return str;} : (str: any) => Promise >str : any @@ -72,7 +72,7 @@ const f4 = async str => { /** @type {T3} */ const f5 = async str => { ->f5 : (str: any) => Promise +>f5 : T3 >async str => { return str;} : (str: any) => Promise >str : any diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt index 2994a55aa7..dbbbe1f34c 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt @@ -1,4 +1,5 @@ mod1.js(5,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +use.js(1,20): error TS2306: File 'mod1.js' is not a module. ==== mod1.js (1 errors) ==== @@ -13,8 +14,10 @@ mod1.js(5,1): error TS2580: Cannot find name 'module'. Do you need to install ty this.p = 1 } -==== use.js (0 errors) ==== +==== use.js (1 errors) ==== /** @param {import('./mod1').Con} k */ + ~~~~~~~~ +!!! error TS2306: File 'mod1.js' is not a module. function f(k) { if (1 === 2 - 1) { // I guess basic math works! diff --git a/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt new file mode 100644 index 0000000000..9b0c649c61 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.errors.txt @@ -0,0 +1,20 @@ +callbackOnConstructor.js(12,12): error TS2304: Cannot find name 'ValueGetter_2'. + + +==== callbackOnConstructor.js (1 errors) ==== + export class Preferences { + assignability = "no" + /** + * @callback ValueGetter_2 + * @param {string} name + * @returns {boolean|number|string|undefined} + */ + constructor() {} + } + + + /** @type {ValueGetter_2} */ + ~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'ValueGetter_2'. + var ooscope2 = s => s.length > 0 + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.types b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.types index 87c02bf622..448a21aa29 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.types +++ b/testdata/baselines/reference/submodule/conformance/callbackOnConstructor.types @@ -19,7 +19,7 @@ export class Preferences { /** @type {ValueGetter_2} */ var ooscope2 = s => s.length > 0 ->ooscope2 : (s: any) => boolean +>ooscope2 : ValueGetter_2 >s => s.length > 0 : (s: any) => boolean >s : any >s.length > 0 : boolean diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt new file mode 100644 index 0000000000..1ef41942a9 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/callbackTag1.errors.txt @@ -0,0 +1,27 @@ +cb.js(7,12): error TS2304: Cannot find name 'Sid'. +cb.js(11,12): error TS2304: Cannot find name 'NoReturn'. + + +==== cb.js (2 errors) ==== + /** @callback Sid + * @param {string} s + * @returns {string} What were you expecting + */ + var x = 1 + + /** @type {Sid} smallId */ + ~~~ +!!! error TS2304: Cannot find name 'Sid'. + var sid = s => s + "!"; + + + /** @type {NoReturn} */ + ~~~~~~~~ +!!! error TS2304: Cannot find name 'NoReturn'. + var noreturn = obj => void obj.title + + /** + * @callback NoReturn + * @param {{ e: number, m: number, title: string }} s - Knee deep, shores, etc + */ + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag1.types b/testdata/baselines/reference/submodule/conformance/callbackTag1.types index 2ebad26f87..43c91380f7 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag1.types +++ b/testdata/baselines/reference/submodule/conformance/callbackTag1.types @@ -11,7 +11,7 @@ var x = 1 /** @type {Sid} smallId */ var sid = s => s + "!"; ->sid : (s: any) => string +>sid : Sid >s => s + "!" : (s: any) => string >s : any >s + "!" : string @@ -21,7 +21,7 @@ var sid = s => s + "!"; /** @type {NoReturn} */ var noreturn = obj => void obj.title ->noreturn : (obj: any) => any +>noreturn : NoReturn >obj => void obj.title : (obj: any) => any >obj : any >void obj.title : undefined diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt index 2dbccc172d..c1bec010f7 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/callbackTag2.errors.txt @@ -1,7 +1,10 @@ -cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'. +cb.js(8,12): error TS2304: Cannot find name 'Id'. +cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'. +cb.js(22,12): error TS2304: Cannot find name 'SharedId'. +cb.js(25,12): error TS2304: Cannot find name 'Final'. -==== cb.js (1 errors) ==== +==== cb.js (4 errors) ==== /** @template T * @callback Id * @param {T} t @@ -10,6 +13,8 @@ cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'. var x = 1 /** @type {Id} I actually wanted to write `const "120"` */ + ~~ +!!! error TS2304: Cannot find name 'Id'. var one_twenty = s => "120"; /** @template S @@ -22,13 +27,17 @@ cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'. /** @type {SharedId} */ this.id; ~~ -!!! error TS2339: Property 'id' does not exist on type 'SharedClass'. +!!! error TS2339: Property 'id' does not exist on type 'SharedClass'. } } /** @type {SharedId} */ + ~~~~~~~~ +!!! error TS2304: Cannot find name 'SharedId'. var outside = n => n + 1; /** @type {Final<{ fantasy }, { heroes }>} */ + ~~~~~ +!!! error TS2304: Cannot find name 'Final'. var noreturn = (barts, tidus, noctis) => "cecil" /** diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag2.types b/testdata/baselines/reference/submodule/conformance/callbackTag2.types index 9480c8d69f..c6fb9fcc81 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag2.types +++ b/testdata/baselines/reference/submodule/conformance/callbackTag2.types @@ -12,7 +12,7 @@ var x = 1 /** @type {Id} I actually wanted to write `const "120"` */ var one_twenty = s => "120"; ->one_twenty : (s: any) => string +>one_twenty : Id >s => "120" : (s: any) => string >s : any >"120" : "120" @@ -23,7 +23,7 @@ var one_twenty = s => "120"; * @return {S} */ class SharedClass { ->SharedClass : SharedClass +>SharedClass : SharedClass constructor() { /** @type {SharedId} */ @@ -35,7 +35,7 @@ class SharedClass { } /** @type {SharedId} */ var outside = n => n + 1; ->outside : (n: any) => any +>outside : SharedId >n => n + 1 : (n: any) => any >n : any >n + 1 : any @@ -44,7 +44,7 @@ var outside = n => n + 1; /** @type {Final<{ fantasy }, { heroes }>} */ var noreturn = (barts, tidus, noctis) => "cecil" ->noreturn : (barts: any, tidus: any, noctis: any) => string +>noreturn : Final<{ fantasy: any; }, { heroes: any; }> >(barts, tidus, noctis) => "cecil" : (barts: any, tidus: any, noctis: any) => string >barts : any >tidus : any diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt new file mode 100644 index 0000000000..0ea6446b4b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/callbackTag3.errors.txt @@ -0,0 +1,13 @@ +cb.js(4,12): error TS2304: Cannot find name 'Miracle'. + + +==== cb.js (1 errors) ==== + /** @callback Miracle + * @returns {string} What were you expecting + */ + /** @type {Miracle} smallId */ + ~~~~~~~ +!!! error TS2304: Cannot find name 'Miracle'. + var sid = () => "!"; + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag3.types b/testdata/baselines/reference/submodule/conformance/callbackTag3.types index 087e6ac571..044d714993 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag3.types +++ b/testdata/baselines/reference/submodule/conformance/callbackTag3.types @@ -6,7 +6,7 @@ */ /** @type {Miracle} smallId */ var sid = () => "!"; ->sid : () => string +>sid : Miracle >() => "!" : () => string >"!" : "!" diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt index e4e4f3b568..654e48ca41 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/callbackTag4.errors.txt @@ -1,9 +1,10 @@ +a.js(9,12): error TS2304: Cannot find name 'C'. a.js(10,22): error TS7006: Parameter 'a' implicitly has an 'any' type. a.js(10,25): error TS7006: Parameter 'b' implicitly has an 'any' type. a.js(11,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== /** * @callback C * @this {{ a: string, b: number }} @@ -13,6 +14,8 @@ a.js(11,5): error TS2683: 'this' implicitly has type 'any' because it does not h */ /** @type {C} */ + ~ +!!! error TS2304: Cannot find name 'C'. const cb = function (a, b) { ~ !!! error TS7006: Parameter 'a' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/callbackTag4.types b/testdata/baselines/reference/submodule/conformance/callbackTag4.types index 759eb0650d..5e7d68b92d 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTag4.types +++ b/testdata/baselines/reference/submodule/conformance/callbackTag4.types @@ -11,7 +11,7 @@ /** @type {C} */ const cb = function (a, b) { ->cb : (a: any, b: any) => boolean +>cb : C >function (a, b) { this return true} : (a: any, b: any) => boolean >a : any >b : any diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt new file mode 100644 index 0000000000..fa694a91df --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.errors.txt @@ -0,0 +1,23 @@ +cb_nested.js(11,12): error TS2304: Cannot find name 'WorksWithPeopleCallback'. + + +==== cb_nested.js (1 errors) ==== + /** + * @callback WorksWithPeopleCallback + * @param {Object} person + * @param {string} person.name + * @param {number} [person.age] + * @returns {void} + */ + + /** + * For each person, calls your callback. + * @param {WorksWithPeopleCallback} callback + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'WorksWithPeopleCallback'. + * @returns {void} + */ + function eachPerson(callback) { + callback({ name: "Empty" }); + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.types b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.types index 09a041e0ca..f51212f4e6 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.types +++ b/testdata/baselines/reference/submodule/conformance/callbackTagNestedParameter.types @@ -15,12 +15,12 @@ * @returns {void} */ function eachPerson(callback) { ->eachPerson : (callback: any) => void ->callback : any +>eachPerson : (callback: WorksWithPeopleCallback) => void +>callback : WorksWithPeopleCallback callback({ name: "Empty" }); >callback({ name: "Empty" }) : any ->callback : any +>callback : WorksWithPeopleCallback >{ name: "Empty" } : { name: string; } >name : string >"Empty" : "Empty" diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt new file mode 100644 index 0000000000..79b28e665e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.errors.txt @@ -0,0 +1,16 @@ +callbackTagVariadicType.js(7,12): error TS2304: Cannot find name 'Foo'. + + +==== callbackTagVariadicType.js (1 errors) ==== + /** + * @callback Foo + * @param {...string} args + * @returns {number} + */ + + /** @type {Foo} */ + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + export const x = () => 1 + var res = x('a', 'b') + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.types b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.types index fb68217605..a80d7af3a7 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.types +++ b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.types @@ -9,14 +9,14 @@ /** @type {Foo} */ export const x = () => 1 ->x : () => number +>x : Foo >() => 1 : () => number >1 : 1 var res = x('a', 'b') ->res : number ->x('a', 'b') : number ->x : () => number +>res : any +>x('a', 'b') : any +>x : Foo >'a' : "a" >'b' : "b" diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.errors.txt new file mode 100644 index 0000000000..b29c988e17 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.errors.txt @@ -0,0 +1,14 @@ +0.js(7,20): error TS1016: A required parameter cannot follow an optional parameter. + + +==== 0.js (1 errors) ==== + // @ts-check + /** + * @param {number} a + * @param {number} [b] + * @param {number} c + */ + function foo(a, b, c) {} + ~ +!!! error TS1016: A required parameter cannot follow an optional parameter. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.types b/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.types index a487e8cda1..00c4c537df 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocOptionalParamOrder.types @@ -8,8 +8,8 @@ * @param {number} c */ function foo(a, b, c) {} ->foo : (a: any, b: any, c: any) => void ->a : any ->b : any ->c : any +>foo : (a: number, b: number, c: number) => void +>a : number +>b : number +>c : number diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types b/testdata/baselines/reference/submodule/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types index f797aaae7d..56bcad7bfb 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types @@ -7,11 +7,11 @@ * @param {string} [s] */ var x = function foo(n, s) {} ->x : (n: any, s: any) => void ->function foo(n, s) {} : (n: any, s: any) => void ->foo : (n: any, s: any) => void ->n : any ->s : any +>x : (n?: number, s?: string) => void +>function foo(n, s) {} : (n?: number, s?: string) => void +>foo : (n?: number, s?: string) => void +>n : number +>s : string var y; >y : any @@ -30,9 +30,9 @@ y = function bar(b) {} * @param {string} s */ var one = function (s) { }, two = function (untyped) { }; ->one : (s: any) => void ->function (s) { } : (s: any) => void ->s : any +>one : (s: string) => void +>function (s) { } : (s: string) => void +>s : string >two : (untyped: any) => void >function (untyped) { } : (untyped: any) => void >untyped : any diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.errors.txt deleted file mode 100644 index 6d58c39a5f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -0.js(8,1): error TS2554: Expected 2 arguments, but got 0. -0.js(9,1): error TS2554: Expected 2 arguments, but got 1. - - -==== 0.js (2 errors) ==== - // @ts-check - /** - * @param {number=} n - * @param {string} [s] - */ - function foo(n, s) {} - - foo(); - ~~~ -!!! error TS2554: Expected 2 arguments, but got 0. -!!! related TS6210 0.js:6:14: An argument for 'n' was not provided. - foo(1); - ~~~ -!!! error TS2554: Expected 2 arguments, but got 1. -!!! related TS6210 0.js:6:17: An argument for 's' was not provided. - foo(1, "hi"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.types index 4714ea7317..b5f97088c1 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocParamTag1.types @@ -7,22 +7,22 @@ * @param {string} [s] */ function foo(n, s) {} ->foo : (n: any, s: any) => void ->n : any ->s : any +>foo : (n?: number, s?: string) => void +>n : number +>s : string foo(); >foo() : void ->foo : (n: any, s: any) => void +>foo : (n?: number, s?: string) => void foo(1); >foo(1) : void ->foo : (n: any, s: any) => void +>foo : (n?: number, s?: string) => void >1 : 1 foo(1, "hi"); >foo(1, "hi") : void ->foo : (n: any, s: any) => void +>foo : (n?: number, s?: string) => void >1 : 1 >"hi" : "hi" diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag1.types index 6d52c3a702..39f1932261 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag1.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag1.types @@ -26,7 +26,7 @@ function f1() { * @returns {string|number} This comment is not currently exposed */ function f2() { ->f2 : () => "hello" | 5 +>f2 : () => string | number return 5 || "hello"; >5 || "hello" : "hello" | 5 diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt index ab240f6d40..c5ab204ed8 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.errors.txt @@ -1,13 +1,18 @@ +returns.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. +returns.js(13,5): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. + Type 'boolean' is not assignable to type 'string | number'. returns.js(13,12): error TS2872: This kind of expression is always truthy. -==== returns.js (1 errors) ==== +==== returns.js (3 errors) ==== // @ts-check /** * @returns {string} This comment is not currently exposed */ function f() { return 5; + ~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. } /** @@ -15,6 +20,9 @@ returns.js(13,12): error TS2872: This kind of expression is always truthy. */ function f1() { return 5 || true; + ~~~~~~ +!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. ~ !!! error TS2872: This kind of expression is always truthy. } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.types b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.types index bf6e5e53e5..6ad8c3fb20 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocReturnTag2.types @@ -6,7 +6,7 @@ * @returns {string} This comment is not currently exposed */ function f() { ->f : () => number +>f : () => string return 5; >5 : 5 @@ -16,7 +16,7 @@ function f() { * @returns {string | number} This comment is not currently exposed */ function f1() { ->f1 : () => 5 | true +>f1 : () => string | number return 5 || true; >5 || true : 5 | true diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols index 755f6ce45f..6d630c1741 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols @@ -43,7 +43,9 @@ const t4 = /** @satisfies {T2} */ ({ a: "a" }); const t5 = /** @satisfies {T3} */((m) => m.substring(0)); >t5 : Symbol(t5, Decl(a.js, 27, 5)) >m : Symbol(m, Decl(a.js, 27, 35)) +>m.substring : Symbol(substring, Decl(lib.es5.d.ts, --, --)) >m : Symbol(m, Decl(a.js, 27, 35)) +>substring : Symbol(substring, Decl(lib.es5.d.ts, --, --)) const t6 = /** @satisfies {[number, number]} */ ([1, 2]); >t6 : Symbol(t6, Decl(a.js, 28, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff index face8ef166..f794869a16 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff @@ -14,8 +14,10 @@ >t5 : Symbol(t5, Decl(a.js, 27, 5)) >m : Symbol(m, Decl(a.js, 27, 35)) ->m.substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --)) ++>m.substring : Symbol(substring, Decl(lib.es5.d.ts, --, --)) >m : Symbol(m, Decl(a.js, 27, 35)) ->substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --)) ++>substring : Symbol(substring, Decl(lib.es5.d.ts, --, --)) const t6 = /** @satisfies {[number, number]} */ ([1, 2]); >t6 : Symbol(t6, Decl(a.js, 28, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types index 9333923866..e634920431 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types @@ -3,21 +3,36 @@ === /a.js === /** * @typedef {Object} T1 +>T1 : any + * @property {number} a +>a : any + */ /** * @typedef {Object} T2 +>T2 : any + * @property {"a" | "b"} a +>a : any + */ /** * @typedef {(x: string) => string} T3 +>T3 : any +>x : string + */ /** * @typedef {Object} T4 +>T4 : any + * @property {string} a +>a : any + */ const t1 = /** @satisfies {T1} */ ({ a: 1 }); @@ -43,7 +58,7 @@ const t3 = /** @satisfies {T1} */ ({}); /** @type {T2} */ const t4 = /** @satisfies {T2} */ ({ a: "a" }); ->t4 : { a: string; } +>t4 : T2 >({ a: "a" }) : { a: string; } >{ a: "a" } : { a: string; } >a : string @@ -51,14 +66,14 @@ const t4 = /** @satisfies {T2} */ ({ a: "a" }); /** @type {(m: string) => string} */ const t5 = /** @satisfies {T3} */((m) => m.substring(0)); ->t5 : (m: any) => any ->((m) => m.substring(0)) : (m: any) => any ->(m) => m.substring(0) : (m: any) => any ->m : any ->m.substring(0) : any ->m.substring : any ->m : any ->substring : any +>t5 : (m: string) => string +>((m) => m.substring(0)) : (m: string) => string +>(m) => m.substring(0) : (m: string) => string +>m : string +>m.substring(0) : string +>m.substring : (start: number, end?: number) => string +>m : string +>substring : (start: number, end?: number) => string >0 : 0 const t6 = /** @satisfies {[number, number]} */ ([1, 2]); diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag10.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag10.types index 19bb42f761..f887551f83 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag10.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag10.types @@ -2,6 +2,7 @@ === /a.js === /** @typedef {"a" | "b" | "c" | "d"} Keys */ +>Keys : any const p = /** @satisfies {Partial>} */ ({ >p : { a: number; b: string; x: number; } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag11.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag11.types index a9dfcaf190..3a3cc9f3d5 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag11.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag11.types @@ -3,12 +3,20 @@ === /a.js === /** * @typedef {Object} T1 +>T1 : any + * @property {number} a +>a : any + */ /** * @typedef {Object} T2 +>T2 : any + * @property {number} a +>a : any + */ /** diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag12.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag12.types index fcfbd26652..2cdf70a246 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag12.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag12.types @@ -3,17 +3,29 @@ === /a.js === /** * @typedef {Object} T1 +>T1 : any + * @property {number} a +>a : any + */ /** * @typedef {Object} T2 +>T2 : any + * @property {string} a +>a : any + */ /** * @typedef {Object} T3 +>T3 : any + * @property {"a" | "b"} a +>a : any + */ /** diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.types index be25ed76fd..742c37edf6 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.types @@ -3,7 +3,11 @@ === /a.js === /** * @typedef {Object} T1 +>T1 : any + * @property {number} a +>a : any + */ /** diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.errors.txt new file mode 100644 index 0000000000..c3c65f4fb8 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.errors.txt @@ -0,0 +1,16 @@ +/a.js(1,15): error TS2315: Type 'Object' is not generic. +/a.js(1,21): error TS8020: JSDoc types can only be used inside documentation comments. + + +==== /a.js (2 errors) ==== + /** @typedef {Object. boolean>} Predicates */ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + ~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. + + const p = /** @satisfies {Predicates} */ ({ + isEven: n => n % 2 === 0, + isOdd: n => n % 2 === 1 + }); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.types index 8682c675f8..87511df84e 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.types @@ -2,6 +2,8 @@ === /a.js === /** @typedef {Object. boolean>} Predicates */ +>Predicates : any +>n : number const p = /** @satisfies {Predicates} */ ({ >p : { isEven: (n: any) => boolean; isOdd: (n: any) => boolean; } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt index ff2916a9e4..f41bb7633d 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.errors.txt @@ -1,14 +1,11 @@ -/a.js(3,7): error TS7006: Parameter 's' implicitly has an 'any' type. /a.js(4,7): error TS7006: Parameter 's' implicitly has an 'any' type. /a.js(8,49): error TS7006: Parameter 'x' implicitly has an 'any' type. -==== /a.js (3 errors) ==== +==== /a.js (2 errors) ==== /** @type {{ f(s: string): void } & Record }} */ let obj = /** @satisfies {{ g(s: string): void } & Record} */ ({ f(s) { }, // "incorrect" implicit any on 's' - ~ -!!! error TS7006: Parameter 's' implicitly has an 'any' type. g(s) { } ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.types index d25248b35d..7504a36f45 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag3.types @@ -3,13 +3,13 @@ === /a.js === /** @type {{ f(s: string): void } & Record }} */ let obj = /** @satisfies {{ g(s: string): void } & Record} */ ({ ->obj : { f: (s: any) => void; g: (s: any) => void; } ->({ f(s) { }, // "incorrect" implicit any on 's' g(s) { }}) : { f: (s: any) => void; g: (s: any) => void; } ->{ f(s) { }, // "incorrect" implicit any on 's' g(s) { }} : { f: (s: any) => void; g: (s: any) => void; } +>obj : { f: (s: string) => void; } & Record +>({ f(s) { }, // "incorrect" implicit any on 's' g(s) { }}) : { f: (s: string) => void; g: (s: any) => void; } +>{ f(s) { }, // "incorrect" implicit any on 's' g(s) { }} : { f: (s: string) => void; g: (s: any) => void; } f(s) { }, // "incorrect" implicit any on 's' ->f : (s: any) => void ->s : any +>f : (s: string) => void +>s : string g(s) { } >g : (s: any) => void diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag4.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag4.types index 0d01dd7d19..2763282f44 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag4.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag4.types @@ -3,7 +3,11 @@ === /a.js === /** * @typedef {Object} Foo +>Foo : any + * @property {number} a +>a : any + */ export default /** @satisfies {Foo} */ ({}); >({}) : {} @@ -12,7 +16,11 @@ export default /** @satisfies {Foo} */ ({}); === /b.js === /** * @typedef {Object} Foo +>Foo : any + * @property {number} a +>a : any + */ export default /** @satisfies {Foo} */ ({ a: 1 }); diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.types index 4c316ff692..c5d953e0fd 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.types @@ -2,6 +2,9 @@ === /a.js === /** @typedef {{ move(distance: number): void }} Movable */ +>Movable : any +>move : (distance: number) => void +>distance : number const car = /** @satisfies {Movable & Record} */ ({ >car : { start: () => void; move: (d: any) => void; stop: () => void; } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag6.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag6.types index 27731e2ff5..8d53affe53 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag6.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag6.types @@ -3,8 +3,14 @@ === /a.js === /** * @typedef {Object} Point2d +>Point2d : any + * @property {number} x +>x : any + * @property {number} y +>y : any + */ // Undesirable behavior today with type annotation diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag7.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag7.types index e5a245e579..934ae0d22d 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag7.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag7.types @@ -2,6 +2,7 @@ === /a.js === /** @typedef {"a" | "b" | "c" | "d"} Keys */ +>Keys : any const p = /** @satisfies {Record} */ ({ >p : { a: number; b: string; x: number; } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.errors.txt new file mode 100644 index 0000000000..cc59dca024 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.errors.txt @@ -0,0 +1,17 @@ +/a.js(1,15): error TS2315: Type 'Object' is not generic. +/a.js(1,21): error TS8020: JSDoc types can only be used inside documentation comments. + + +==== /a.js (2 errors) ==== + /** @typedef {Object.} Facts */ + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + ~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. + + // Should be able to detect a failure here + const x = /** @satisfies {Facts} */ ({ + m: true, + s: "false" + }) + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.types index 201e3b22d0..71cf68353b 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.types @@ -2,6 +2,7 @@ === /a.js === /** @typedef {Object.} Facts */ +>Facts : any // Should be able to detect a failure here const x = /** @satisfies {Facts} */ ({ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag9.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag9.types index 98fe398fad..4f81b91674 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag9.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag9.types @@ -3,9 +3,17 @@ === /a.js === /** * @typedef {Object} Color +>Color : any + * @property {number} r +>r : any + * @property {number} g +>g : any + * @property {number} b +>b : any + */ // All of these should be Colors, but I only use some of them here. diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt new file mode 100644 index 0000000000..3523f4ecbe --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt @@ -0,0 +1,60 @@ +0.js(20,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(24,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(28,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. + + +==== 0.js (4 errors) ==== + // @ts-check + /** @type {String} */ + var S = "hello world"; + + /** @type {number} */ + var n = 10; + + /** @type {*} */ + var anyT = 2; + anyT = "hello"; + + /** @type {?} */ + var anyT1 = 2; + anyT1 = "hi"; + + /** @type {Function} */ + const x = (a) => a + 1; + x(1); + + /** @type {function} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const y = (a) => a + 1; + y(1); + + /** @type {function (number)} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x1 = (a) => a + 1; + x1(0); + + /** @type {function (number): number} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x2 = (a) => a + 1; + x2(0); + + /** + * @type {object} + */ + var props = {}; + + /** + * @type {Object} + */ + var props = {}; + ~~~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. +!!! related TS6203 0.js:35:5: 'props' was also declared here. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.types index f9016dbaac..d6326f0bf5 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.types @@ -4,7 +4,7 @@ // @ts-check /** @type {String} */ var S = "hello world"; ->S : string +>S : String >"hello world" : "hello world" /** @type {number} */ @@ -14,27 +14,27 @@ var n = 10; /** @type {*} */ var anyT = 2; ->anyT : number +>anyT : any >2 : 2 anyT = "hello"; >anyT = "hello" : "hello" ->anyT : number +>anyT : any >"hello" : "hello" /** @type {?} */ var anyT1 = 2; ->anyT1 : number +>anyT1 : any >2 : 2 anyT1 = "hi"; >anyT1 = "hi" : "hi" ->anyT1 : number +>anyT1 : any >"hi" : "hi" /** @type {Function} */ const x = (a) => a + 1; ->x : (a: any) => any +>x : Function >(a) => a + 1 : (a: any) => any >a : any >a + 1 : any @@ -43,12 +43,12 @@ const x = (a) => a + 1; x(1); >x(1) : any ->x : (a: any) => any +>x : Function >1 : 1 /** @type {function} */ const y = (a) => a + 1; ->y : (a: any) => any +>y : function >(a) => a + 1 : (a: any) => any >a : any >a + 1 : any @@ -57,12 +57,12 @@ const y = (a) => a + 1; y(1); >y(1) : any ->y : (a: any) => any +>y : function >1 : 1 /** @type {function (number)} */ const x1 = (a) => a + 1; ->x1 : (a: any) => any +>x1 : function >(a) => a + 1 : (a: any) => any >a : any >a + 1 : any @@ -71,12 +71,12 @@ const x1 = (a) => a + 1; x1(0); >x1(0) : any ->x1 : (a: any) => any +>x1 : function >0 : 0 /** @type {function (number): number} */ const x2 = (a) => a + 1; ->x2 : (a: any) => any +>x2 : function >(a) => a + 1 : (a: any) => any >a : any >a + 1 : any @@ -85,20 +85,20 @@ const x2 = (a) => a + 1; x2(0); >x2(0) : any ->x2 : (a: any) => any +>x2 : function >0 : 0 /** * @type {object} */ var props = {}; ->props : {} +>props : any >{} : {} /** * @type {Object} */ var props = {}; ->props : {} +>props : any >{} : {} diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt new file mode 100644 index 0000000000..76933dc06a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt @@ -0,0 +1,50 @@ +0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'String'. +0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'. +0.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(12,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(23,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + +==== 0.js (6 errors) ==== + // @ts-check + /** @type {String} */ + var S = true; + ~ +!!! error TS2322: Type 'boolean' is not assignable to type 'String'. + + /** @type {number} */ + var n = "hello"; + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + + /** @type {function (number)} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x1 = (a) => a + 1; + x1("string"); + + /** @type {function (number): number} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x2 = (a) => a + 1; + + /** @type {string} */ + var a; + a = x2(0); + + /** @type {function (number): number} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x3 = (a) => a.concat("hi"); + x3(0); + + /** @type {function (number): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x4 = (a) => a + 1; + x4(0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.types index a60c701770..7fc0f656f2 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.types @@ -4,17 +4,17 @@ // @ts-check /** @type {String} */ var S = true; ->S : boolean +>S : String >true : true /** @type {number} */ var n = "hello"; ->n : string +>n : number >"hello" : "hello" /** @type {function (number)} */ const x1 = (a) => a + 1; ->x1 : (a: any) => any +>x1 : function >(a) => a + 1 : (a: any) => any >a : any >a + 1 : any @@ -23,12 +23,12 @@ const x1 = (a) => a + 1; x1("string"); >x1("string") : any ->x1 : (a: any) => any +>x1 : function >"string" : "string" /** @type {function (number): number} */ const x2 = (a) => a + 1; ->x2 : (a: any) => any +>x2 : function >(a) => a + 1 : (a: any) => any >a : any >a + 1 : any @@ -37,18 +37,18 @@ const x2 = (a) => a + 1; /** @type {string} */ var a; ->a : any +>a : string a = x2(0); >a = x2(0) : any ->a : any +>a : string >x2(0) : any ->x2 : (a: any) => any +>x2 : function >0 : 0 /** @type {function (number): number} */ const x3 = (a) => a.concat("hi"); ->x3 : (a: any) => any +>x3 : function >(a) => a.concat("hi") : (a: any) => any >a : any >a.concat("hi") : any @@ -59,12 +59,12 @@ const x3 = (a) => a.concat("hi"); x3(0); >x3(0) : any ->x3 : (a: any) => any +>x3 : function >0 : 0 /** @type {function (number): string} */ const x4 = (a) => a + 1; ->x4 : (a: any) => any +>x4 : function >(a) => a + 1 : (a: any) => any >a : any >a + 1 : any @@ -73,6 +73,6 @@ const x4 = (a) => a + 1; x4(0); >x4(0) : any ->x4 : (a: any) => any +>x4 : function >0 : 0 diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag3.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag3.types index eb35563b92..593bac0790 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag3.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag3.types @@ -3,5 +3,5 @@ === test.js === /** @type {Array} */ var nns; ->nns : any +>nns : number[] diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt new file mode 100644 index 0000000000..1120047dc2 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.errors.txt @@ -0,0 +1,24 @@ +test.js(3,19): error TS2304: Cannot find name 'U'. +test.js(5,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. +test.js(7,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. + + +==== t.d.ts (0 errors) ==== + type A = { a: T } + +==== test.js (3 errors) ==== + /** Also should error for jsdoc typedefs + * @template {string} U + * @typedef {{ b: U }} B + ~ +!!! error TS2304: Cannot find name 'U'. + */ + /** @type {A} */ + ~~~~~~ +!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. + var a; + /** @type {B} */ + ~~~~~~ +!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. + var b; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types index dbf09e07c0..be90ea7133 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types @@ -9,12 +9,15 @@ type A = { a: T } /** Also should error for jsdoc typedefs * @template {string} U * @typedef {{ b: U }} B +>B : any +>b : U + */ /** @type {A} */ var a; ->a : any +>a : A /** @type {B} */ var b; ->b : any +>b : { b: U; } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt new file mode 100644 index 0000000000..285e2ac7c4 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.errors.txt @@ -0,0 +1,64 @@ +test.js(5,14): error TS2322: Type 'number' is not assignable to type 'string'. +test.js(7,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. + Type 'number' is not assignable to type 'string'. +test.js(12,14): error TS2322: Type 'number' is not assignable to type 'string'. +test.js(14,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. + Type 'number' is not assignable to type 'string'. +test.js(24,5): error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'. +test.js(34,5): error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. + Type '1' is not assignable to type '2 | 3'. + + +==== test.js (6 errors) ==== + // all 6 should error on return statement/expression + /** @type {(x: number) => string} */ + function h(x) { return x } + /** @type {(x: number) => string} */ + var f = x => x + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6502 test.js:4:12: The expected type comes from the return type of this signature. + /** @type {(x: number) => string} */ + var g = function (x) { return x } + ~ +!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + + /** @type {{ (x: number): string }} */ + function i(x) { return x } + /** @type {{ (x: number): string }} */ + var j = x => x + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6502 test.js:11:12: The expected type comes from the return type of this signature. + /** @type {{ (x: number): string }} */ + var k = function (x) { return x } + ~ +!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + + + /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ + /** @type {Argle} */ + function blargle(s) { + return 0; + } + + /** @type {0 | 1 | 2} - assignment should not error */ + var zeroonetwo = blargle('hi') + ~~~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'. + + /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ + + /** @type {Gioconda} */ + function monaLisa(sb) { + return typeof sb === 'string' ? 1 : 2; + } + + /** @type {2 | 3} - overloads are not supported, so there will be an error */ + var twothree = monaLisa(false); + ~~~~~~~~ +!!! error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. +!!! error TS2322: Type '1' is not assignable to type '2 | 3'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols index 261c84c85b..58b8eff2b9 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols @@ -40,6 +40,7 @@ var k = function (x) { return x } /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ +>Argle : Symbol(Argle, Decl(test.js, 20, 1)) >x : Symbol(x, Decl(test.js, 16, 15)) /** @type {Argle} */ @@ -56,6 +57,7 @@ var zeroonetwo = blargle('hi') >blargle : Symbol(blargle, Decl(test.js, 13, 33)) /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ +>Gioconda : Symbol(Gioconda, Decl(test.js, 30, 1)) >s : Symbol(s, Decl(test.js, 25, 16)) >b : Symbol(b, Decl(test.js, 25, 36)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff index f94d15324d..d10dbedd7f 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff @@ -4,15 +4,17 @@ /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ ++>Argle : Symbol(Argle, Decl(test.js, 20, 1)) +>x : Symbol(x, Decl(test.js, 16, 15)) + /** @type {Argle} */ function blargle(s) { >blargle : Symbol(blargle, Decl(test.js, 13, 33)) -@@= skipped -14, +16 lines =@@ +@@= skipped -14, +17 lines =@@ >blargle : Symbol(blargle, Decl(test.js, 13, 33)) /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ ++>Gioconda : Symbol(Gioconda, Decl(test.js, 30, 1)) +>s : Symbol(s, Decl(test.js, 25, 16)) +>b : Symbol(b, Decl(test.js, 25, 36)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types index 0f3aa5e20d..2ceaceedc7 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types @@ -10,17 +10,17 @@ function h(x) { return x } /** @type {(x: number) => string} */ var f = x => x ->f : (x: any) => any ->x => x : (x: any) => any ->x : any ->x : any +>f : (x: number) => string +>x => x : (x: number) => number +>x : number +>x : number /** @type {(x: number) => string} */ var g = function (x) { return x } ->g : (x: any) => any ->function (x) { return x } : (x: any) => any ->x : any ->x : any +>g : (x: number) => string +>function (x) { return x } : (x: number) => number +>x : number +>x : number /** @type {{ (x: number): string }} */ function i(x) { return x } @@ -30,20 +30,23 @@ function i(x) { return x } /** @type {{ (x: number): string }} */ var j = x => x ->j : (x: any) => any ->x => x : (x: any) => any ->x : any ->x : any +>j : (x: number) => string +>x => x : (x: number) => number +>x : number +>x : number /** @type {{ (x: number): string }} */ var k = function (x) { return x } ->k : (x: any) => any ->function (x) { return x } : (x: any) => any ->x : any ->x : any +>k : (x: number) => string +>function (x) { return x } : (x: number) => number +>x : number +>x : number /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ +>Argle : Argle +>x : "bye" | "hi" + /** @type {Argle} */ function blargle(s) { >blargle : (s: any) => number @@ -55,12 +58,15 @@ function blargle(s) { /** @type {0 | 1 | 2} - assignment should not error */ var zeroonetwo = blargle('hi') ->zeroonetwo : number +>zeroonetwo : 0 | 1 | 2 >blargle('hi') : number >blargle : (s: any) => number >'hi' : "hi" /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ +>Gioconda : Gioconda +>s : string +>b : boolean /** @type {Gioconda} */ function monaLisa(sb) { @@ -79,7 +85,7 @@ function monaLisa(sb) { /** @type {2 | 3} - overloads are not supported, so there will be an error */ var twothree = monaLisa(false); ->twothree : number +>twothree : 2 | 3 >monaLisa(false) : 1 | 2 >monaLisa : (sb: any) => 1 | 2 >false : false diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt new file mode 100644 index 0000000000..34a62935d5 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.errors.txt @@ -0,0 +1,52 @@ +test.js(7,5): error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. +test.js(27,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. + Target signature provides too few arguments. Expected 1 or more, but got 0. +test.js(30,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. + Target signature provides too few arguments. Expected 1 or more, but got 0. + + +==== test.js (3 errors) ==== + /** @type {number} */ + function f() { + return 1 + } + + /** @type {{ prop: string }} */ + var g = function (prop) { + ~ +!!! error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. + } + + /** @type {(a: number) => number} */ + function add1(a, b) { return a + b; } + + /** @type {(a: number, b: number) => number} */ + function add2(a, b) { return a + b; } + + // TODO: Should be an error since signature doesn't match. + /** @type {(a: number, b: number, c: number) => number} */ + function add3(a, b) { return a + b; } + + // Confirm initializers are compatible. + // They can't have more parameters than the type/context. + + /** @type {() => void} */ + function funcWithMoreParameters(more) {} // error + + /** @type {() => void} */ + const variableWithMoreParameters = function (more) {}; // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. + + /** @type {() => void} */ + const arrowWithMoreParameters = (more) => {}; // error + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. + + ({ + /** @type {() => void} */ + methodWithMoreParameters(more) {}, // error + }); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.types index 66a0efe8a4..f965842389 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.types @@ -11,7 +11,7 @@ function f() { /** @type {{ prop: string }} */ var g = function (prop) { ->g : (prop: any) => void +>g : { prop: string; } >function (prop) {} : (prop: any) => void >prop : any } @@ -54,13 +54,13 @@ function funcWithMoreParameters(more) {} // error /** @type {() => void} */ const variableWithMoreParameters = function (more) {}; // error ->variableWithMoreParameters : (more: any) => void +>variableWithMoreParameters : () => void >function (more) {} : (more: any) => void >more : any /** @type {() => void} */ const arrowWithMoreParameters = (more) => {}; // error ->arrowWithMoreParameters : (more: any) => void +>arrowWithMoreParameters : () => void >(more) => {} : (more: any) => void >more : any diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.types index d1ecda7ac4..e25a2799ef 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.types @@ -3,6 +3,10 @@ === test.js === /** * @typedef {(a: string, b: number) => void} Foo +>Foo : any +>a : string +>b : number + */ class C { diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt new file mode 100644 index 0000000000..35c7d11f52 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt @@ -0,0 +1,31 @@ +0.js(16,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + +==== 0.js (1 errors) ==== + // @ts-check + var lol = "hello Lol" + const obj = { + /** @type {string|undefined} */ + foo: undefined, + /** @type {string|undefined} */ + bar: "42", + /** @type {function(number): number} */ + method1(n1) { + return n1 + 42; + }, + /** @type {string} */ + lol, + /** @type {number} */ + ['b' + 'ar1']: 42, + /** @type {function(number): number} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + arrowFunc: (num) => num + 42 + } + obj.foo = 'string' + obj.lol + obj.bar = undefined; + var k = obj.method1(0); + obj.bar1 = "42"; + obj.arrowFunc(0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.types index 1ac5c17ea0..e62fd337bd 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.types @@ -7,17 +7,19 @@ var lol = "hello Lol" >"hello Lol" : "hello Lol" const obj = { ->obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } ->{ /** @type {string|undefined} */ foo: undefined, /** @type {string|undefined} */ bar: "42", /** @type {function(number): number} */ method1(n1) { return n1 + 42; }, /** @type {string} */ lol, /** @type {number} */ ['b' + 'ar1']: 42, /** @type {function(number): number} */ arrowFunc: (num) => num + 42} : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } +>{ /** @type {string|undefined} */ foo: undefined, /** @type {string|undefined} */ bar: "42", /** @type {function(number): number} */ method1(n1) { return n1 + 42; }, /** @type {string} */ lol, /** @type {number} */ ['b' + 'ar1']: 42, /** @type {function(number): number} */ arrowFunc: (num) => num + 42} : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } /** @type {string|undefined} */ foo: undefined, ->foo : undefined +>foo : string | undefined +>undefined : string | undefined >undefined : undefined /** @type {string|undefined} */ bar: "42", ->bar : string +>bar : string | undefined +>"42" : string | undefined >"42" : "42" /** @type {function(number): number} */ @@ -41,11 +43,13 @@ const obj = { >'b' + 'ar1' : string >'b' : "b" >'ar1' : "ar1" +>42 : number >42 : 42 /** @type {function(number): number} */ arrowFunc: (num) => num + 42 ->arrowFunc : (num: any) => any +>arrowFunc : function +>(num) => num + 42 : function >(num) => num + 42 : (num: any) => any >num : any >num + 42 : any @@ -54,42 +58,42 @@ const obj = { } obj.foo = 'string' >obj.foo = 'string' : "string" ->obj.foo : undefined ->obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } ->foo : undefined +>obj.foo : string | undefined +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } +>foo : string | undefined >'string' : "string" obj.lol >obj.lol : string ->obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } >lol : string obj.bar = undefined; >obj.bar = undefined : undefined ->obj.bar : string ->obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } ->bar : string +>obj.bar : string | undefined +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } +>bar : string | undefined >undefined : undefined var k = obj.method1(0); >k : any >obj.method1(0) : any >obj.method1 : (n1: any) => any ->obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } >method1 : (n1: any) => any >0 : 0 obj.bar1 = "42"; >obj.bar1 = "42" : "42" ->obj.bar1 : string | number | (n1: any) => any | undefined ->obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } ->bar1 : string | number | (n1: any) => any | undefined +>obj.bar1 : any +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } +>bar1 : any >"42" : "42" obj.arrowFunc(0); >obj.arrowFunc(0) : any ->obj.arrowFunc : (num: any) => any ->obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } ->arrowFunc : (num: any) => any +>obj.arrowFunc : function +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } +>arrowFunc : function >0 : 0 diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt new file mode 100644 index 0000000000..579a296c34 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt @@ -0,0 +1,36 @@ +0.js(5,8): error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. +0.js(10,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(12,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + +==== 0.js (3 errors) ==== + // @ts-check + var lol; + const obj = { + /** @type {string|undefined} */ + bar: 42, + ~~ +!!! error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. + /** @type {function(number): number} */ + method1(n1) { + return "42"; + }, + /** @type {function(number): number} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + method2: (n1) => "lol", + /** @type {function(number): number} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + arrowFunc: (num="0") => num + 42, + /** @type {string} */ + lol + } + lol = "string" + /** @type {string} */ + var s = obj.method1(0); + + /** @type {string} */ + var s1 = obj.method2("0"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.types index 0976ecc6c6..442a08a945 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.types @@ -6,12 +6,13 @@ var lol; >lol : any const obj = { ->obj : { bar: number; method1: (n1: any) => string; method2: (n1: any) => string; arrowFunc: (num?: string) => string; lol: any; } ->{ /** @type {string|undefined} */ bar: 42, /** @type {function(number): number} */ method1(n1) { return "42"; }, /** @type {function(number): number} */ method2: (n1) => "lol", /** @type {function(number): number} */ arrowFunc: (num="0") => num + 42, /** @type {string} */ lol} : { bar: number; method1: (n1: any) => string; method2: (n1: any) => string; arrowFunc: (num?: string) => string; lol: any; } +>obj : { bar: string | undefined; method1: (n1: any) => string; method2: function; arrowFunc: function; lol: any; } +>{ /** @type {string|undefined} */ bar: 42, /** @type {function(number): number} */ method1(n1) { return "42"; }, /** @type {function(number): number} */ method2: (n1) => "lol", /** @type {function(number): number} */ arrowFunc: (num="0") => num + 42, /** @type {string} */ lol} : { bar: string | undefined; method1: (n1: any) => string; method2: function; arrowFunc: function; lol: any; } /** @type {string|undefined} */ bar: 42, ->bar : number +>bar : string | undefined +>42 : string | undefined >42 : 42 /** @type {function(number): number} */ @@ -25,14 +26,16 @@ const obj = { }, /** @type {function(number): number} */ method2: (n1) => "lol", ->method2 : (n1: any) => string +>method2 : function +>(n1) => "lol" : function >(n1) => "lol" : (n1: any) => string >n1 : any >"lol" : "lol" /** @type {function(number): number} */ arrowFunc: (num="0") => num + 42, ->arrowFunc : (num?: string) => string +>arrowFunc : function +>(num="0") => num + 42 : function >(num="0") => num + 42 : (num?: string) => string >num : string >"0" : "0" @@ -54,16 +57,16 @@ var s = obj.method1(0); >s : string >obj.method1(0) : string >obj.method1 : (n1: any) => string ->obj : { bar: number; method1: (n1: any) => string; method2: (n1: any) => string; arrowFunc: (num?: string) => string; lol: any; } +>obj : { bar: string | undefined; method1: (n1: any) => string; method2: function; arrowFunc: function; lol: any; } >method1 : (n1: any) => string >0 : 0 /** @type {string} */ var s1 = obj.method2("0"); >s1 : string ->obj.method2("0") : string ->obj.method2 : (n1: any) => string ->obj : { bar: number; method1: (n1: any) => string; method2: (n1: any) => string; arrowFunc: (num?: string) => string; lol: any; } ->method2 : (n1: any) => string +>obj.method2("0") : any +>obj.method2 : function +>obj : { bar: string | undefined; method1: (n1: any) => string; method2: function; arrowFunc: function; lol: any; } +>method2 : function >"0" : "0" diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt new file mode 100644 index 0000000000..233ec17f1c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt @@ -0,0 +1,56 @@ +0.js(15,5): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': w, y, z +0.js(28,6): error TS2741: Property 'anotherY' is missing in type '{ anotherX: string; }' but required in type 'AnotherOpts'. +0.js(42,6): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': w, y, z + + +==== 0.js (3 errors) ==== + // @ts-check + /** + * @typedef {Object} Opts + * @property {string} x + * @property {string=} y + * @property {string} [z] + * @property {string} [w="hi"] + * + * @param {Opts} opts + */ + function foo(opts) { + opts.x; + } + + foo({x: 'abc'}); + ~~~~~~~~~~ +!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': w, y, z + + /** + * @typedef {Object} AnotherOpts + * @property anotherX {string} + * @property anotherY {string=} + * + * @param {AnotherOpts} opts + */ + function foo1(opts) { + opts.anotherX; + } + + foo1({anotherX: "world"}); + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2741: Property 'anotherY' is missing in type '{ anotherX: string; }' but required in type 'AnotherOpts'. +!!! related TS2728 0.js:20:14: 'anotherY' is declared here. + + /** + * @typedef {object} Opts1 + * @property {string} x + * @property {string=} y + * @property {string} [z] + * @property {string} [w="hi"] + * + * @param {Opts1} opts + */ + function foo2(opts) { + opts.x; + } + foo2({x: 'abc'}); + ~~~~~~~~~~ +!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': w, y, z + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols index 66488bb0b1..ec8369bf1d 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols @@ -4,10 +4,20 @@ // @ts-check /** * @typedef {Object} Opts +>Opts : Symbol(Opts, Decl(0.js, 12, 1)) + * @property {string} x +>x : Symbol(x, Decl(0.js, 12, 1)) + * @property {string=} y +>y : Symbol(y, Decl(0.js, 12, 1)) + * @property {string} [z] +>z : Symbol(z, Decl(0.js, 12, 1)) + * @property {string} [w="hi"] +>w : Symbol(w, Decl(0.js, 12, 1)) + * * @param {Opts} opts */ @@ -16,7 +26,9 @@ function foo(opts) { >opts : Symbol(opts, Decl(0.js, 10, 13)) opts.x; +>opts.x : Symbol(x, Decl(0.js, 12, 1)) >opts : Symbol(opts, Decl(0.js, 10, 13)) +>x : Symbol(x, Decl(0.js, 12, 1)) } foo({x: 'abc'}); @@ -25,8 +37,14 @@ foo({x: 'abc'}); /** * @typedef {Object} AnotherOpts +>AnotherOpts : Symbol(AnotherOpts, Decl(0.js, 25, 1)) + * @property anotherX {string} +>anotherX : Symbol(anotherX, Decl(0.js, 25, 1)) + * @property anotherY {string=} +>anotherY : Symbol(anotherY, Decl(0.js, 25, 1)) + * * @param {AnotherOpts} opts */ @@ -35,7 +53,9 @@ function foo1(opts) { >opts : Symbol(opts, Decl(0.js, 23, 14)) opts.anotherX; +>opts.anotherX : Symbol(anotherX, Decl(0.js, 25, 1)) >opts : Symbol(opts, Decl(0.js, 23, 14)) +>anotherX : Symbol(anotherX, Decl(0.js, 25, 1)) } foo1({anotherX: "world"}); @@ -44,10 +64,20 @@ foo1({anotherX: "world"}); /** * @typedef {object} Opts1 +>Opts1 : Symbol(Opts1, Decl(0.js, 40, 1)) + * @property {string} x +>x : Symbol(x, Decl(0.js, 40, 1)) + * @property {string=} y +>y : Symbol(y, Decl(0.js, 40, 1)) + * @property {string} [z] +>z : Symbol(z, Decl(0.js, 40, 1)) + * @property {string} [w="hi"] +>w : Symbol(w, Decl(0.js, 40, 1)) + * * @param {Opts1} opts */ @@ -56,7 +86,9 @@ function foo2(opts) { >opts : Symbol(opts, Decl(0.js, 38, 14)) opts.x; +>opts.x : Symbol(x, Decl(0.js, 40, 1)) >opts : Symbol(opts, Decl(0.js, 38, 14)) +>x : Symbol(x, Decl(0.js, 40, 1)) } foo2({x: 'abc'}); >foo2 : Symbol(foo2, Decl(0.js, 27, 26)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff index 3da9dac730..cf5e555700 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff @@ -1,32 +1,95 @@ --- old.checkJsdocTypedefInParamTag1.symbols +++ new.checkJsdocTypedefInParamTag1.symbols -@@= skipped -15, +15 lines =@@ +@@= skipped -3, +3 lines =@@ + // @ts-check + /** + * @typedef {Object} Opts ++>Opts : Symbol(Opts, Decl(0.js, 12, 1)) ++ + * @property {string} x ++>x : Symbol(x, Decl(0.js, 12, 1)) ++ + * @property {string=} y ++>y : Symbol(y, Decl(0.js, 12, 1)) ++ + * @property {string} [z] ++>z : Symbol(z, Decl(0.js, 12, 1)) ++ + * @property {string} [w="hi"] ++>w : Symbol(w, Decl(0.js, 12, 1)) ++ + * + * @param {Opts} opts + */ +@@= skipped -12, +22 lines =@@ >opts : Symbol(opts, Decl(0.js, 10, 13)) opts.x; ->opts.x : Symbol(x, Decl(0.js, 3, 3)) ++>opts.x : Symbol(x, Decl(0.js, 12, 1)) >opts : Symbol(opts, Decl(0.js, 10, 13)) ->x : Symbol(x, Decl(0.js, 3, 3)) ++>x : Symbol(x, Decl(0.js, 12, 1)) } foo({x: 'abc'}); -@@= skipped -21, +19 lines =@@ +@@= skipped -11, +11 lines =@@ + + /** + * @typedef {Object} AnotherOpts ++>AnotherOpts : Symbol(AnotherOpts, Decl(0.js, 25, 1)) ++ + * @property anotherX {string} ++>anotherX : Symbol(anotherX, Decl(0.js, 25, 1)) ++ + * @property anotherY {string=} ++>anotherY : Symbol(anotherY, Decl(0.js, 25, 1)) ++ + * + * @param {AnotherOpts} opts + */ +@@= skipped -10, +16 lines =@@ >opts : Symbol(opts, Decl(0.js, 23, 14)) opts.anotherX; ->opts.anotherX : Symbol(anotherX, Decl(0.js, 18, 3)) ++>opts.anotherX : Symbol(anotherX, Decl(0.js, 25, 1)) >opts : Symbol(opts, Decl(0.js, 23, 14)) ->anotherX : Symbol(anotherX, Decl(0.js, 18, 3)) ++>anotherX : Symbol(anotherX, Decl(0.js, 25, 1)) } foo1({anotherX: "world"}); -@@= skipped -23, +21 lines =@@ +@@= skipped -11, +11 lines =@@ + + /** + * @typedef {object} Opts1 ++>Opts1 : Symbol(Opts1, Decl(0.js, 40, 1)) ++ + * @property {string} x ++>x : Symbol(x, Decl(0.js, 40, 1)) ++ + * @property {string=} y ++>y : Symbol(y, Decl(0.js, 40, 1)) ++ + * @property {string} [z] ++>z : Symbol(z, Decl(0.js, 40, 1)) ++ + * @property {string} [w="hi"] ++>w : Symbol(w, Decl(0.js, 40, 1)) ++ + * + * @param {Opts1} opts + */ +@@= skipped -12, +22 lines =@@ >opts : Symbol(opts, Decl(0.js, 38, 14)) opts.x; ->opts.x : Symbol(x, Decl(0.js, 31, 3)) ++>opts.x : Symbol(x, Decl(0.js, 40, 1)) >opts : Symbol(opts, Decl(0.js, 38, 14)) ->x : Symbol(x, Decl(0.js, 31, 3)) ++>x : Symbol(x, Decl(0.js, 40, 1)) } foo2({x: 'abc'}); >foo2 : Symbol(foo2, Decl(0.js, 27, 26)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.types index f92d9126fb..cf4ec7993f 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.types @@ -4,75 +4,101 @@ // @ts-check /** * @typedef {Object} Opts +>Opts : Opts + * @property {string} x +>x : any + * @property {string=} y +>y : any + * @property {string} [z] +>z : any + * @property {string} [w="hi"] +>w : any + * * @param {Opts} opts */ function foo(opts) { ->foo : (opts: any) => void ->opts : any +>foo : (opts: Opts) => void +>opts : Opts opts.x; >opts.x : any ->opts : any +>opts : Opts >x : any } foo({x: 'abc'}); >foo({x: 'abc'}) : void ->foo : (opts: any) => void +>foo : (opts: Opts) => void >{x: 'abc'} : { x: string; } >x : string >'abc' : "abc" /** * @typedef {Object} AnotherOpts +>AnotherOpts : AnotherOpts + * @property anotherX {string} +>anotherX : any + * @property anotherY {string=} +>anotherY : any + * * @param {AnotherOpts} opts */ function foo1(opts) { ->foo1 : (opts: any) => void ->opts : any +>foo1 : (opts: AnotherOpts) => void +>opts : AnotherOpts opts.anotherX; >opts.anotherX : any ->opts : any +>opts : AnotherOpts >anotherX : any } foo1({anotherX: "world"}); >foo1({anotherX: "world"}) : void ->foo1 : (opts: any) => void +>foo1 : (opts: AnotherOpts) => void >{anotherX: "world"} : { anotherX: string; } >anotherX : string >"world" : "world" /** * @typedef {object} Opts1 +>Opts1 : Opts1 + * @property {string} x +>x : any + * @property {string=} y +>y : any + * @property {string} [z] +>z : any + * @property {string} [w="hi"] +>w : any + * * @param {Opts1} opts */ function foo2(opts) { ->foo2 : (opts: any) => void ->opts : any +>foo2 : (opts: Opts1) => void +>opts : Opts1 opts.x; >opts.x : any ->opts : any +>opts : Opts1 >x : any } foo2({x: 'abc'}); >foo2({x: 'abc'}) : void ->foo2 : (opts: any) => void +>foo2 : (opts: Opts1) => void >{x: 'abc'} : { x: string; } >x : string >'abc' : "abc" diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt index 719537df87..7cb22b9170 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt @@ -1,8 +1,9 @@ 0.js(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. 0.js(8,9): error TS2339: Property 'SomeName' does not exist on type '{}'. +0.js(10,12): error TS2503: Cannot find namespace 'exports'. -==== 0.js (2 errors) ==== +==== 0.js (3 errors) ==== // @ts-check var exports = {}; @@ -17,5 +18,7 @@ !!! error TS2339: Property 'SomeName' does not exist on type '{}'. /** @type {exports.SomeName} */ + ~~~~~~~ +!!! error TS2503: Cannot find namespace 'exports'. const myString = 'str'; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.types index 79e4c53da7..4fdfe4e89a 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.types @@ -10,6 +10,8 @@ var exports = {}; /** * @typedef {string} */ +> : any + exports.SomeName; >exports.SomeName : any >exports : {} @@ -17,6 +19,6 @@ exports.SomeName; /** @type {exports.SomeName} */ const myString = 'str'; ->myString : "str" +>myString : SomeName >'str' : "str" diff --git a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt index 9e51e0e0f0..f2698865d7 100644 --- a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.errors.txt @@ -1,7 +1,9 @@ bug24252.js(2,3): error TS2339: Property 'B' does not exist on type '{}'. +bug24252.js(8,9): error TS2322: Type 'string[]' is not assignable to type 'number[]'. + Type 'string' is not assignable to type 'number'. -==== bug24252.js (1 errors) ==== +==== bug24252.js (2 errors) ==== var A = {}; A.B = class { ~ @@ -12,6 +14,9 @@ bug24252.js(2,3): error TS2339: Property 'B' does not exist on type '{}'. /** @type {number[]} */ var y; y = x; + ~ +!!! error TS2322: Type 'string[]' is not assignable to type 'number[]'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. } }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.types b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.types index 686e32f361..fdb014f9a0 100644 --- a/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.types +++ b/testdata/baselines/reference/submodule/conformance/checkSpecialPropertyAssignments.types @@ -17,17 +17,17 @@ A.B = class { /** @type {string[]} */ var x = []; ->x : any[] +>x : string[] >[] : undefined[] /** @type {number[]} */ var y; ->y : any +>y : number[] y = x; ->y = x : any[] ->y : any ->x : any[] +>y = x : string[] +>y : number[] +>x : string[] } }; diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt index 212636b13a..89f4bc9ab8 100644 --- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.errors.txt @@ -1,19 +1,20 @@ -first.js(21,19): error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. +first.js(21,19): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. first.js(24,14): error TS2339: Property 'foonly' does not exist on type 'Sql'. +first.js(27,21): error TS8020: JSDoc types can only be used inside documentation comments. first.js(44,4): error TS2339: Property 'numberOxen' does not exist on type 'Sql'. first.js(44,20): error TS2339: Property 'foonly' does not exist on type 'Sql'. first.js(47,24): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. -generic.js(9,23): error TS2507: Type '(flavour: any) => void' is not a constructor function type. +generic.js(9,23): error TS2507: Type '(flavour: T) => void' is not a constructor function type. generic.js(11,21): error TS2339: Property 'flavour' does not exist on type 'Chowder'. generic.js(17,27): error TS2554: Expected 0 arguments, but got 1. generic.js(18,9): error TS2339: Property 'flavour' does not exist on type 'Chowder'. generic.js(20,32): error TS2554: Expected 0 arguments, but got 1. second.ts(8,25): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. -second.ts(14,25): error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. +second.ts(14,25): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Conestoga'. -==== first.js (5 errors) ==== +==== first.js (6 errors) ==== /** * @constructor * @param {number} numberOxen @@ -36,7 +37,7 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con // ok class Sql extends Wagon { ~~~~~ -!!! error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. +!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. constructor() { super(); // error: not enough arguments this.foonly = 12 @@ -45,6 +46,8 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con } /** * @param {Array.} files + ~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. * @param {"csv" | "json" | "xmlolololol"} format * This is not assignable, so should have a type error */ @@ -92,7 +95,7 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con // ok class Conestoga extends Wagon { ~~~~~ -!!! error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. +!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. constructor(public drunkOO: true) { // error: wrong type super('nope'); @@ -119,7 +122,7 @@ second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Con /** @extends {Soup<{ claim: "ignorant" | "malicious" }>} */ class Chowder extends Soup { ~~~~ -!!! error TS2507: Type '(flavour: any) => void' is not a constructor function type. +!!! error TS2507: Type '(flavour: T) => void' is not a constructor function type. log() { return this.flavour ~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types index 18242382b7..ff87ed7d40 100644 --- a/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types +++ b/testdata/baselines/reference/submodule/conformance/classCanExtendConstructorFunction.types @@ -6,21 +6,21 @@ * @param {number} numberOxen */ function Wagon(numberOxen) { ->Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } ->numberOxen : any +>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } +>numberOxen : number this.numberOxen = numberOxen ->this.numberOxen = numberOxen : any +>this.numberOxen = numberOxen : number >this.numberOxen : any >this : any >numberOxen : any ->numberOxen : any +>numberOxen : number } /** @param {Wagon[]=} wagons */ Wagon.circle = function (wagons) { >Wagon.circle = function (wagons) { return wagons ? wagons.length : 3.14;} : (wagons: any) => any >Wagon.circle : (wagons: any) => any ->Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } +>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } >circle : (wagons: any) => any >function (wagons) { return wagons ? wagons.length : 3.14;} : (wagons: any) => any >wagons : any @@ -38,7 +38,7 @@ Wagon.prototype.load = function (supplies) { >Wagon.prototype.load = function (supplies) {} : (supplies: any) => void >Wagon.prototype.load : any >Wagon.prototype : any ->Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } +>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } >prototype : any >load : any >function (supplies) {} : (supplies: any) => void @@ -49,7 +49,7 @@ Wagon.prototype.weight = supplies => supplies ? supplies.length : -1 >Wagon.prototype.weight = supplies => supplies ? supplies.length : -1 : (supplies: any) => any >Wagon.prototype.weight : any >Wagon.prototype : any ->Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } +>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } >prototype : any >weight : any >supplies => supplies ? supplies.length : -1 : (supplies: any) => any @@ -66,7 +66,7 @@ Wagon.prototype.speed = function () { >Wagon.prototype.speed = function () { return this.numberOxen / this.weight()} : () => number >Wagon.prototype.speed : any >Wagon.prototype : any ->Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } +>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } >prototype : any >speed : any >function () { return this.numberOxen / this.weight()} : () => number @@ -84,7 +84,7 @@ Wagon.prototype.speed = function () { // ok class Sql extends Wagon { >Sql : Sql ->Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } +>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } constructor() { super(); // error: not enough arguments @@ -104,13 +104,13 @@ class Sql extends Wagon { * This is not assignable, so should have a type error */ load(files, format) { ->load : (files: any, format: any) => void ->files : any ->format : any +>load : (files: string[], format: "csv" | "json" | "xmlolololol") => void +>files : string[] +>format : "csv" | "json" | "xmlolololol" if (format === "xmlolololol") { >format === "xmlolololol" : boolean ->format : any +>format : "csv" | "json" | "xmlolololol" >"xmlolololol" : "xmlolololol" throw new Error("please do not use XML. It was a joke."); @@ -188,7 +188,7 @@ class Firedrake extends Dragon { // ok class Conestoga extends Wagon { >Conestoga : Conestoga ->Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } +>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } constructor(public drunkOO: true) { >drunkOO : true @@ -202,13 +202,13 @@ class Conestoga extends Wagon { } // should error since others is not optional static circle(others: (typeof Wagon)[]) { ->circle : (others: { (numberOxen: any): void; circle: (wagons: any) => any; }[]) => number ->others : { (numberOxen: any): void; circle: (wagons: any) => any; }[] ->Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } +>circle : (others: { (numberOxen: number): void; circle: (wagons: any) => any; }[]) => number +>others : { (numberOxen: number): void; circle: (wagons: any) => any; }[] +>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } return others.length >others.length : number ->others : { (numberOxen: any): void; circle: (wagons: any) => any; }[] +>others : { (numberOxen: number): void; circle: (wagons: any) => any; }[] >length : number } } @@ -234,20 +234,20 @@ c.numberOxen * @param {T} flavour */ function Soup(flavour) { ->Soup : (flavour: any) => void ->flavour : any +>Soup : (flavour: T) => void +>flavour : T this.flavour = flavour ->this.flavour = flavour : any +>this.flavour = flavour : T >this.flavour : any >this : any >flavour : any ->flavour : any +>flavour : T } /** @extends {Soup<{ claim: "ignorant" | "malicious" }>} */ class Chowder extends Soup { >Chowder : Chowder ->Soup : (flavour: any) => void +>Soup : (flavour: T) => void log() { >log : () => any @@ -262,7 +262,7 @@ class Chowder extends Soup { var soup = new Soup(1); >soup : any >new Soup(1) : any ->Soup : (flavour: any) => void +>Soup : (flavour: T) => void >1 : 1 soup.flavour diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types index 53e5d345b8..cc0fc9ebc6 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types @@ -9,10 +9,10 @@ const { funky } = require('./commonJSAliasedExport'); /** @type {boolean} */ var diddy ->diddy : any +>diddy : boolean var diddy = funky(1) ->diddy : any +>diddy : boolean >funky(1) : any >funky : any >1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt index d5df7b8226..04d5cfd894 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.errors.txt @@ -1,10 +1,11 @@ main.js(1,9): error TS2451: Cannot redeclare block-scoped variable 'K'. main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? mod1.js(1,7): error TS2451: Cannot redeclare block-scoped variable 'K'. mod1.js(6,1): error TS2304: Cannot find name 'exports'. -==== main.js (2 errors) ==== +==== main.js (3 errors) ==== const { K } = require("./mod1"); ~ !!! error TS2451: Cannot redeclare block-scoped variable 'K'. @@ -12,6 +13,8 @@ mod1.js(6,1): error TS2304: Cannot find name 'exports'. ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @param {K} k */ + ~ +!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? function f(k) { k.values() } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types index 98958f7c45..03ded8a6a7 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types @@ -9,13 +9,13 @@ const { K } = require("./mod1"); /** @param {K} k */ function f(k) { ->f : (k: any) => void ->k : any +>f : (k: K) => void +>k : K k.values() >k.values() : any >k.values : any ->k : any +>k : K >values : any } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt index d50a8f4124..eb50cc5891 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.errors.txt @@ -1,12 +1,15 @@ main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? mod1.js(1,1): error TS2304: Cannot find name 'exports'. -==== main.js (1 errors) ==== +==== main.js (2 errors) ==== const { K } = require("./mod1"); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @param {K} k */ + ~ +!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? function f(k) { k.values() } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types index a91436eab1..271bca849a 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types @@ -9,13 +9,13 @@ const { K } = require("./mod1"); /** @param {K} k */ function f(k) { ->f : (k: any) => void ->k : any +>f : (k: K) => void +>k : K k.values() >k.values() : any >k.values : any ->k : any +>k : K >values : any } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt index 4276b855f5..0444e83a7f 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.errors.txt @@ -1,15 +1,18 @@ main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? mod1.js(2,4): error TS2339: Property 'K' does not exist on type '{}'. mod1.js(4,23): error TS2339: Property 'K' does not exist on type '{}'. mod1.js(7,1): error TS2304: Cannot find name 'exports'. mod1.js(7,16): error TS2339: Property 'K' does not exist on type '{}'. -==== main.js (1 errors) ==== +==== main.js (2 errors) ==== const { K } = require("./mod1"); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @param {K} k */ + ~ +!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? function f(k) { k.values() } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types index 14f792ae09..7176fdf016 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types @@ -9,13 +9,13 @@ const { K } = require("./mod1"); /** @param {K} k */ function f(k) { ->f : (k: any) => void ->k : any +>f : (k: K) => void +>k : K k.values() >k.values() : any >k.values : any ->k : any +>k : K >values : any } diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt new file mode 100644 index 0000000000..051cf5113e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.errors.txt @@ -0,0 +1,43 @@ +constructorFunctionMethodTypeParameters.js(22,16): error TS2304: Cannot find name 'T'. +constructorFunctionMethodTypeParameters.js(24,17): error TS2304: Cannot find name 'T'. + + +==== constructorFunctionMethodTypeParameters.js (2 errors) ==== + /** + * @template {string} T + * @param {T} t + */ + function Cls(t) { + this.t = t; + } + + /** + * @template {string} V + * @param {T} t + * @param {V} v + * @return {V} + */ + Cls.prototype.topLevelComment = function (t, v) { + return v + }; + + Cls.prototype.nestedComment = + /** + * @template {string} U + * @param {T} t + ~ +!!! error TS2304: Cannot find name 'T'. + * @param {U} u + * @return {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + function (t, u) { + return t + }; + + var c = new Cls('a'); + const s = c.topLevelComment('a', 'b'); + const t = c.nestedComment('a', 'b'); + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types index b7173f4d71..3c44273775 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionMethodTypeParameters.types @@ -6,15 +6,15 @@ * @param {T} t */ function Cls(t) { ->Cls : (t: any) => void ->t : any +>Cls : (t: T) => void +>t : T this.t = t; ->this.t = t : any +>this.t = t : T >this.t : any >this : any >t : any ->t : any +>t : T } /** @@ -27,7 +27,7 @@ Cls.prototype.topLevelComment = function (t, v) { >Cls.prototype.topLevelComment = function (t, v) { return v} : (t: any, v: any) => any >Cls.prototype.topLevelComment : any >Cls.prototype : any ->Cls : (t: any) => void +>Cls : (t: T) => void >prototype : any >topLevelComment : any >function (t, v) { return v} : (t: any, v: any) => any @@ -40,10 +40,10 @@ Cls.prototype.topLevelComment = function (t, v) { }; Cls.prototype.nestedComment = ->Cls.prototype.nestedComment = /** * @template {string} U * @param {T} t * @param {U} u * @return {T} */ function (t, u) { return t } : (t: any, u: any) => any +>Cls.prototype.nestedComment = /** * @template {string} U * @param {T} t * @param {U} u * @return {T} */ function (t, u) { return t } : (t: T, u: U) => T >Cls.prototype.nestedComment : any >Cls.prototype : any ->Cls : (t: any) => void +>Cls : (t: T) => void >prototype : any >nestedComment : any @@ -54,19 +54,19 @@ Cls.prototype.nestedComment = * @return {T} */ function (t, u) { ->function (t, u) { return t } : (t: any, u: any) => any ->t : any ->u : any +>function (t, u) { return t } : (t: T, u: U) => T +>t : T +>u : U return t ->t : any +>t : T }; var c = new Cls('a'); >c : any >new Cls('a') : any ->Cls : (t: any) => void +>Cls : (t: T) => void >'a' : "a" const s = c.topLevelComment('a', 'b'); diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctions.types b/testdata/baselines/reference/submodule/conformance/constructorFunctions.types index e31be64d7b..ee204d9754 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctions.types +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctions.types @@ -176,11 +176,11 @@ var c6_v1 = new C6(); * @param {number} num */ function C7(num) {} ->C7 : (num: any) => void ->num : any +>C7 : (num: number) => void +>num : number var c7_v1 = new C7(); >c7_v1 : any >new C7() : any ->C7 : (num: any) => void +>C7 : (num: number) => void diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.types b/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.types index db8c347c84..1740c1a364 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.types +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctionsStrict.types @@ -3,21 +3,21 @@ === a.js === /** @param {number} x */ function C(x) { ->C : (x: any) => void ->x : any +>C : (x: number) => void +>x : number this.x = x ->this.x = x : any +>this.x = x : number >this.x : any >this : any >x : any ->x : any +>x : number } C.prototype.m = function() { >C.prototype.m = function() { this.y = 12} : () => void >C.prototype.m : any >C.prototype : any ->C : (x: any) => void +>C : (x: number) => void >prototype : any >m : any >function() { this.y = 12} : () => void @@ -32,7 +32,7 @@ C.prototype.m = function() { var c = new C(1) >c : any >new C(1) : any ->C : (x: any) => void +>C : (x: number) => void >1 : 1 c.x = undefined // should error @@ -51,38 +51,38 @@ c.y = undefined // ok /** @param {number} x */ function A(x) { ->A : (x: any) => any ->x : any +>A : (x: number) => any +>x : number if (!(this instanceof A)) { >!(this instanceof A) : boolean >(this instanceof A) : boolean >this instanceof A : boolean >this : any ->A : (x: any) => any +>A : (x: number) => any return new A(x) >new A(x) : any ->A : (x: any) => any ->x : any +>A : (x: number) => any +>x : number } this.x = x ->this.x = x : any +>this.x = x : number >this.x : any >this : any >x : any ->x : any +>x : number } var k = A(1) >k : any >A(1) : any ->A : (x: any) => any +>A : (x: number) => any >1 : 1 var j = new A(2) >j : any >new A(2) : any ->A : (x: any) => any +>A : (x: number) => any >2 : 2 k.x === j.x diff --git a/testdata/baselines/reference/submodule/conformance/contextualTypeFromJSDoc.types b/testdata/baselines/reference/submodule/conformance/contextualTypeFromJSDoc.types index e5b823c60c..82c90c7c6c 100644 --- a/testdata/baselines/reference/submodule/conformance/contextualTypeFromJSDoc.types +++ b/testdata/baselines/reference/submodule/conformance/contextualTypeFromJSDoc.types @@ -3,18 +3,18 @@ === index.js === /** @type {Array<[string, {x?:number, y?:number}]>} */ const arr = [ ->arr : ((string | { x: number; })[] | (string | { y: number; })[])[] ->[ ['a', { x: 1 }], ['b', { y: 2 }]] : ((string | { x: number; })[] | (string | { y: number; })[])[] +>arr : [string, { x?: number; y?: number; }][] +>[ ['a', { x: 1 }], ['b', { y: 2 }]] : ([string, { x: number; }] | [string, { y: number; }])[] ['a', { x: 1 }], ->['a', { x: 1 }] : (string | { x: number; })[] +>['a', { x: 1 }] : [string, { x: number; }] >'a' : "a" >{ x: 1 } : { x: number; } >x : number >1 : 1 ['b', { y: 2 }] ->['b', { y: 2 }] : (string | { y: number; })[] +>['b', { y: 2 }] : [string, { y: number; }] >'b' : "b" >{ y: 2 } : { y: number; } >y : number @@ -24,20 +24,20 @@ const arr = [ /** @return {Array<[string, {x?:number, y?:number}]>} */ function f() { ->f : () => ((string | { x: number; })[] | (string | { y: number; })[])[] +>f : () => [string, { x?: number; y?: number; }][] return [ ->[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ((string | { x: number; })[] | (string | { y: number; })[])[] +>[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ([string, { x: number; }] | [string, { y: number; }])[] ['a', { x: 1 }], ->['a', { x: 1 }] : (string | { x: number; })[] +>['a', { x: 1 }] : [string, { x: number; }] >'a' : "a" >{ x: 1 } : { x: number; } >x : number >1 : 1 ['b', { y: 2 }] ->['b', { y: 2 }] : (string | { y: number; })[] +>['b', { y: 2 }] : [string, { y: number; }] >'b' : "b" >{ y: 2 } : { y: number; } >y : number @@ -51,24 +51,24 @@ class C { /** @param {Array<[string, {x?:number, y?:number}]>} value */ set x(value) { } ->x : ((string | { x: number; })[] | (string | { y: number; })[])[] ->value : ((string | { x: number; })[] | (string | { y: number; })[])[] +>x : [string, { x?: number; y?: number; }][] +>value : [string, { x?: number; y?: number; }][] get x() { ->x : ((string | { x: number; })[] | (string | { y: number; })[])[] +>x : [string, { x?: number; y?: number; }][] return [ ->[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ((string | { x: number; })[] | (string | { y: number; })[])[] +>[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ([string, { x: number; }] | [string, { y: number; }])[] ['a', { x: 1 }], ->['a', { x: 1 }] : (string | { x: number; })[] +>['a', { x: 1 }] : [string, { x: number; }] >'a' : "a" >{ x: 1 } : { x: number; } >x : number >1 : 1 ['b', { y: 2 }] ->['b', { y: 2 }] : (string | { y: number; })[] +>['b', { y: 2 }] : [string, { y: number; }] >'b' : "b" >{ y: 2 } : { y: number; } >y : number diff --git a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.types b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.types index 1a662b4fb9..7a472a474b 100644 --- a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.types @@ -5,6 +5,7 @@ status: 'done' m(n: number): void }} DoneStatus */ +>DoneStatus : any // property assignment var ns = {} diff --git a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt index 473e3b85dd..800958af53 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/enumTag.errors.txt @@ -1,7 +1,11 @@ -a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: any; }'. +a.js(24,13): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? +a.js(25,12): error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? +a.js(26,12): error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? +a.js(35,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? +a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. -==== a.js (1 errors) ==== +==== a.js (5 errors) ==== /** @enum {string} */ const Target = { START: "start", @@ -26,8 +30,14 @@ a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: s } /** @param {Target} t + ~~~~~~ +!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? * @param {Second} s + ~~~~~~ +!!! error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? * @param {Fs} f + ~~ +!!! error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? */ function consume(t,s,f) { /** @type {string} */ @@ -37,10 +47,12 @@ a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: s /** @type {(n: number) => number} */ var fun = f /** @type {Target} */ + ~~~~~~ +!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? var v = Target.START v = Target.UNKNOWN // error, can't find 'UNKNOWN' ~~~~~~~ -!!! error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: any; }'. +!!! error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. v = Second.MISTAKE // meh..ok, I guess? v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums } diff --git a/testdata/baselines/reference/submodule/conformance/enumTag.types b/testdata/baselines/reference/submodule/conformance/enumTag.types index 14215c159e..e8fa8e9905 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTag.types +++ b/testdata/baselines/reference/submodule/conformance/enumTag.types @@ -25,6 +25,7 @@ const Target = { /** @type {number} */ OK_I_GUESS: 2 >OK_I_GUESS : number +>2 : number >2 : 2 } /** @enum number */ @@ -43,6 +44,7 @@ const Second = { /** @type {number} */ FINE: 2, >FINE : number +>2 : number >2 : 2 } /** @enum {function(number): number} */ @@ -78,63 +80,63 @@ const Fs = { * @param {Fs} f */ function consume(t,s,f) { ->consume : (t: any, s: any, f: any) => void ->t : any ->s : any ->f : any +>consume : (t: Target, s: Second, f: Fs) => void +>t : Target +>s : Second +>f : Fs /** @type {string} */ var str = t ->str : any ->t : any +>str : string +>t : Target /** @type {number} */ var num = s ->num : any ->s : any +>num : number +>s : Second /** @type {(n: number) => number} */ var fun = f ->fun : any ->f : any +>fun : (n: number) => number +>f : Fs /** @type {Target} */ var v = Target.START ->v : string +>v : Target >Target.START : string >Target : { START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; } >START : string v = Target.UNKNOWN // error, can't find 'UNKNOWN' >v = Target.UNKNOWN : any ->v : string +>v : Target >Target.UNKNOWN : any >Target : { START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; } >UNKNOWN : any v = Second.MISTAKE // meh..ok, I guess? >v = Second.MISTAKE : string ->v : string +>v : Target >Second.MISTAKE : string >Second : { MISTAKE: string; OK: number; FINE: number; } >MISTAKE : string v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums >v = 'something else' : "something else" ->v : string +>v : Target >'something else' : "something else" } /** @param {string} s */ function ff(s) { ->ff : (s: any) => any ->s : any +>ff : (s: string) => any +>s : string // element access with arbitrary string is an error only with noImplicitAny if (!Target[s]) { >!Target[s] : boolean >Target[s] : any >Target : { START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; } ->s : any +>s : string return null } @@ -142,7 +144,7 @@ function ff(s) { return Target[s] >Target[s] : any >Target : { START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; } ->s : any +>s : string } } diff --git a/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt b/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt new file mode 100644 index 0000000000..5180e90595 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/enumTagImported.errors.txt @@ -0,0 +1,31 @@ +type.js(1,32): error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'. +type.js(4,29): error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'. +value.js(2,12): error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'? + + +==== type.js (2 errors) ==== + /** @typedef {import("./mod1").TestEnum} TE */ + ~~~~~~~~ +!!! error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'. + /** @type {TE} */ + const test = 'add' + /** @type {import("./mod1").TestEnum} */ + ~~~~~~~~ +!!! error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'. + const tost = 'remove' + +==== value.js (1 errors) ==== + import { TestEnum } from "./mod1" + /** @type {TestEnum} */ + ~~~~~~~~ +!!! error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'? + const tist = TestEnum.ADD + + +==== mod1.js (0 errors) ==== + /** @enum {string} */ + export const TestEnum = { + ADD: 'add', + REMOVE: 'remove' + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/enumTagImported.types b/testdata/baselines/reference/submodule/conformance/enumTagImported.types index 361a32f1be..be1f86a3e1 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTagImported.types +++ b/testdata/baselines/reference/submodule/conformance/enumTagImported.types @@ -2,14 +2,16 @@ === type.js === /** @typedef {import("./mod1").TestEnum} TE */ +>TE : any + /** @type {TE} */ const test = 'add' ->test : "add" +>test : any >'add' : "add" /** @type {import("./mod1").TestEnum} */ const tost = 'remove' ->tost : "remove" +>tost : any >'remove' : "remove" === value.js === @@ -18,7 +20,7 @@ import { TestEnum } from "./mod1" /** @type {TestEnum} */ const tist = TestEnum.ADD ->tist : string +>tist : TestEnum >TestEnum.ADD : string >TestEnum : { ADD: string; REMOVE: string; } >ADD : string diff --git a/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt new file mode 100644 index 0000000000..5aebbf567d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.errors.txt @@ -0,0 +1,16 @@ +bug27134.js(7,11): error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? + + +==== bug27134.js (1 errors) ==== + /** + * @enum {number} + */ + var foo = { }; + + /** + * @type {foo} + ~~~ +!!! error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? + */ + var s; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.types b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.types index 2468c5b902..09e308a994 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.types +++ b/testdata/baselines/reference/submodule/conformance/enumTagUseBeforeDefCrash.types @@ -12,5 +12,5 @@ var foo = { }; * @type {foo} */ var s; ->s : any +>s : foo diff --git a/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt new file mode 100644 index 0000000000..35cf4728a3 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.errors.txt @@ -0,0 +1,56 @@ +foo.js(20,12): error TS2304: Cannot find name 'FunctionReturningPromise'. +foo.js(44,12): error TS2304: Cannot find name 'FunctionReturningNever'. + + +==== foo.js (2 errors) ==== + /** + * @callback FunctionReturningPromise + * @returns {Promise} + */ + + /** @type {FunctionReturningPromise} */ + function testPromise1() { + console.log("Nope"); + } + + /** @type {FunctionReturningPromise} */ + async function testPromise2() { + return "asd"; + } + + var testPromise3 = /** @type {FunctionReturningPromise} */ function() { + console.log("test") + } + + /** @type {FunctionReturningPromise} */ + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'FunctionReturningPromise'. + var testPromise4 = function() { + console.log("test") + } + + /** + * @callback FunctionReturningNever + * @returns {never} + */ + + /** @type {FunctionReturningNever} */ + function testNever1() { + + } + + /** @type {FunctionReturningNever} */ + async function testNever2() { + return "asd"; + } + + var testNever3 = /** @type {FunctionReturningNever} */ function() { + console.log("test") + } + + /** @type {FunctionReturningNever} */ + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'FunctionReturningNever'. + var testNever4 = function() { + console.log("test") + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.types b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.types index 4f06c52f86..4a72817f54 100644 --- a/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.types +++ b/testdata/baselines/reference/submodule/conformance/errorOnFunctionReturnType.types @@ -40,7 +40,7 @@ var testPromise3 = /** @type {FunctionReturningPromise} */ function() { /** @type {FunctionReturningPromise} */ var testPromise4 = function() { ->testPromise4 : () => void +>testPromise4 : FunctionReturningPromise >function() { console.log("test")} : () => void console.log("test") @@ -84,7 +84,7 @@ var testNever3 = /** @type {FunctionReturningNever} */ function() { /** @type {FunctionReturningNever} */ var testNever4 = function() { ->testNever4 : () => void +>testNever4 : FunctionReturningNever >function() { console.log("test")} : () => void console.log("test") diff --git a/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.types b/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.types index d7d5f0ab53..b984114ef5 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.types +++ b/testdata/baselines/reference/submodule/conformance/exportNestedNamespaces.types @@ -70,18 +70,18 @@ var classic = new s.Classic() /** @param {s.n.K} c @param {s.Classic} classic */ function f(c, classic) { ->f : (c: any, classic: any) => void ->c : any ->classic : any +>f : (c: K, classic: Classic) => void +>c : K +>classic : Classic c.x >c.x : any ->c : any +>c : K >x : any classic.p >classic.p : any ->classic : any +>classic : Classic >p : any } diff --git a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt new file mode 100644 index 0000000000..3e7597d212 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.errors.txt @@ -0,0 +1,19 @@ +use.js(3,12): error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'? + + +==== def.js (0 errors) ==== + /** @enum {number} */ + const MyEnum = { + a: 1, + b: 2 + }; + export default MyEnum; + +==== use.js (1 errors) ==== + import MyEnum from "./def"; + + /** @type {MyEnum} */ + ~~~~~~ +!!! error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'? + const v = MyEnum.b; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types index 2742f18d3c..ac3b962eb8 100644 --- a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types +++ b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types @@ -24,7 +24,7 @@ import MyEnum from "./def"; /** @type {MyEnum} */ const v = MyEnum.b; ->v : number +>v : MyEnum >MyEnum.b : number >MyEnum : { a: number; b: number; } >b : number diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag1.types b/testdata/baselines/reference/submodule/conformance/extendsTag1.types index a96398b3ed..1fe7b48839 100644 --- a/testdata/baselines/reference/submodule/conformance/extendsTag1.types +++ b/testdata/baselines/reference/submodule/conformance/extendsTag1.types @@ -6,6 +6,6 @@ * @extends {Set} Should prefer this Set, not the Set in the heritage clause */ class My extends Set {} ->My : My +>My : My >Set : Set diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt new file mode 100644 index 0000000000..8e78b2b91f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt @@ -0,0 +1,60 @@ +/a.js(26,17): error TS2314: Generic type 'A' requires 1 type argument(s). +/a.js(34,17): error TS2314: Generic type 'A' requires 1 type argument(s). +/a.js(39,17): error TS2314: Generic type 'A' requires 1 type argument(s). +/a.js(44,17): error TS2314: Generic type 'A' requires 1 type argument(s). + + +==== /a.js (4 errors) ==== + /** + * @typedef {{ + * a: number | string; + * b: boolean | string[]; + * }} Foo + */ + + /** + * @template {Foo} T + */ + class A { + /** + * @param {T} a + */ + constructor(a) { + return a + } + } + + /** + * @extends {A<{ + * a: string, + * b: string[] + * }>} + */ + class B extends A {} + ~ +!!! error TS2314: Generic type 'A' requires 1 type argument(s). + + /** + * @extends {A<{ + * a: string, + * b: string + * }>} + */ + class C extends A {} + ~ +!!! error TS2314: Generic type 'A' requires 1 type argument(s). + + /** + * @extends {A<{a: string, b: string[]}>} + */ + class D extends A {} + ~ +!!! error TS2314: Generic type 'A' requires 1 type argument(s). + + /** + * @extends {A<{a: string, b: string}>} + */ + class E extends A {} + ~ +!!! error TS2314: Generic type 'A' requires 1 type argument(s). + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.types b/testdata/baselines/reference/submodule/conformance/extendsTag5.types index e09b74e91d..d5e4753447 100644 --- a/testdata/baselines/reference/submodule/conformance/extendsTag5.types +++ b/testdata/baselines/reference/submodule/conformance/extendsTag5.types @@ -6,22 +6,24 @@ * a: number | string; * b: boolean | string[]; * }} Foo +>Foo : any + */ /** * @template {Foo} T */ class A { ->A : A +>A : A /** * @param {T} a */ constructor(a) { ->a : any +>a : T return a ->a : any +>a : T } } @@ -33,7 +35,7 @@ class A { */ class B extends A {} >B : B ->A : A +>A : typeof A /** * @extends {A<{ @@ -43,19 +45,19 @@ class B extends A {} */ class C extends A {} >C : C ->A : A +>A : typeof A /** * @extends {A<{a: string, b: string[]}>} */ class D extends A {} >D : D ->A : A +>A : typeof A /** * @extends {A<{a: string, b: string}>} */ class E extends A {} >E : E ->A : A +>A : typeof A diff --git a/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.types b/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.types index 71259ab7ca..0ebdb3058f 100644 --- a/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.types +++ b/testdata/baselines/reference/submodule/conformance/genericSetterInClassTypeJsDoc.types @@ -5,20 +5,20 @@ * @template T */ class Box { ->Box : Box +>Box : Box #value; >#value : any /** @param {T} initialValue */ constructor(initialValue) { ->initialValue : any +>initialValue : T this.#value = initialValue; ->this.#value = initialValue : any +>this.#value = initialValue : T >this.#value : any >this : this ->initialValue : any +>initialValue : T } /** @type {T} */ @@ -45,7 +45,7 @@ new Box(3).value = 3; >new Box(3).value = 3 : 3 >new Box(3).value : any ->new Box(3) : Box +>new Box(3) : Box >Box : typeof Box >3 : 3 >value : any diff --git a/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt new file mode 100644 index 0000000000..bfac61ad4a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag1.errors.txt @@ -0,0 +1,20 @@ +/foo.js(6,13): error TS2304: Cannot find name 'Foo'. + + +==== /types.ts (0 errors) ==== + export interface Foo { + a: number; + } + +==== /foo.js (1 errors) ==== + /** + * @import { Foo } from "./types" + */ + + /** + * @param { Foo } foo + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + function f(foo) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag1.types b/testdata/baselines/reference/submodule/conformance/importTag1.types index 93665333bd..b442a09696 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag1.types +++ b/testdata/baselines/reference/submodule/conformance/importTag1.types @@ -15,6 +15,6 @@ export interface Foo { * @param { Foo } foo */ function f(foo) {} ->f : (foo: any) => void ->foo : any +>f : (foo: Foo) => void +>foo : Foo diff --git a/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt b/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt new file mode 100644 index 0000000000..021e5864c6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).errors.txt @@ -0,0 +1,15 @@ +1.js(4,13): error TS2304: Cannot find name 'I'. + + +==== 0.ts (0 errors) ==== + export interface I { } + +==== 1.js (1 errors) ==== + /** @import { I } from './0' with { type: "json" } */ + /** @import * as foo from './0' with { type: "json" } */ + + /** @param {I} a */ + ~ +!!! error TS2304: Cannot find name 'I'. + function f(a) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).types b/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).types index 839112d6c3..fb18e6928b 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).types +++ b/testdata/baselines/reference/submodule/conformance/importTag15(module=es2015).types @@ -10,6 +10,6 @@ export interface I { } /** @param {I} a */ function f(a) {} ->f : (a: any) => void ->a : any +>f : (a: I) => void +>a : I diff --git a/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt b/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt new file mode 100644 index 0000000000..021e5864c6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).errors.txt @@ -0,0 +1,15 @@ +1.js(4,13): error TS2304: Cannot find name 'I'. + + +==== 0.ts (0 errors) ==== + export interface I { } + +==== 1.js (1 errors) ==== + /** @import { I } from './0' with { type: "json" } */ + /** @import * as foo from './0' with { type: "json" } */ + + /** @param {I} a */ + ~ +!!! error TS2304: Cannot find name 'I'. + function f(a) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).types b/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).types index 839112d6c3..fb18e6928b 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).types +++ b/testdata/baselines/reference/submodule/conformance/importTag15(module=esnext).types @@ -10,6 +10,6 @@ export interface I { } /** @param {I} a */ function f(a) {} ->f : (a: any) => void ->a : any +>f : (a: I) => void +>a : I diff --git a/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt new file mode 100644 index 0000000000..152fcdec23 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag16.errors.txt @@ -0,0 +1,21 @@ +b.js(4,12): error TS2304: Cannot find name 'Foo'. +b.js(5,12): error TS2304: Cannot find name 'I'. + + +==== a.ts (0 errors) ==== + export default interface Foo {} + export interface I {} + +==== b.js (2 errors) ==== + /** @import Foo, { I } from "./a" */ + + /** + * @param {Foo} a + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + * @param {I} b + ~ +!!! error TS2304: Cannot find name 'I'. + */ + export function foo(a, b) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag16.types b/testdata/baselines/reference/submodule/conformance/importTag16.types index fca85aeb20..13356e92a7 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag16.types +++ b/testdata/baselines/reference/submodule/conformance/importTag16.types @@ -13,7 +13,7 @@ export interface I {} * @param {I} b */ export function foo(a, b) {} ->foo : (a: any, b: any) => void ->a : any ->b : any +>foo : (a: Foo, b: I) => void +>a : Foo +>b : I diff --git a/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt new file mode 100644 index 0000000000..049012688d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag17.errors.txt @@ -0,0 +1,44 @@ +/a.js(5,15): error TS2304: Cannot find name 'Import'. +/a.js(12,15): error TS2552: Cannot find name 'Require'. Did you mean 'Required'? + + +==== /node_modules/@types/foo/package.json (0 errors) ==== + { + "name": "@types/foo", + "version": "1.0.0", + "exports": { + ".": { + "import": "./index.d.mts", + "require": "./index.d.cts" + } + } + } + +==== /node_modules/@types/foo/index.d.mts (0 errors) ==== + export declare const Import: "module"; + +==== /node_modules/@types/foo/index.d.cts (0 errors) ==== + export declare const Require: "script"; + +==== /a.js (2 errors) ==== + /** @import { Import } from 'foo' with { 'resolution-mode': 'import' } */ + /** @import { Require } from 'foo' with { 'resolution-mode': 'require' } */ + + /** + * @returns { Import } + ~~~~~~ +!!! error TS2304: Cannot find name 'Import'. + */ + export function f1() { + return 1; + } + + /** + * @returns { Require } + ~~~~~~~ +!!! error TS2552: Cannot find name 'Require'. Did you mean 'Required'? + */ + export function f2() { + return 1; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag17.types b/testdata/baselines/reference/submodule/conformance/importTag17.types index 3023630ace..1a4f3c365f 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag17.types +++ b/testdata/baselines/reference/submodule/conformance/importTag17.types @@ -16,7 +16,7 @@ export declare const Require: "script"; * @returns { Import } */ export function f1() { ->f1 : () => number +>f1 : () => Import return 1; >1 : 1 @@ -26,7 +26,7 @@ export function f1() { * @returns { Require } */ export function f2() { ->f2 : () => number +>f2 : () => Require return 1; >1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt new file mode 100644 index 0000000000..843e5470b9 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag18.errors.txt @@ -0,0 +1,20 @@ +b.js(8,12): error TS2304: Cannot find name 'Foo'. + + +==== a.ts (0 errors) ==== + export interface Foo {} + +==== b.js (1 errors) ==== + /** + * @import { + * Foo + * } from "./a" + */ + + /** + * @param {Foo} a + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + export function foo(a) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag18.types b/testdata/baselines/reference/submodule/conformance/importTag18.types index 3e9c1e14d3..71e2cc8b58 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag18.types +++ b/testdata/baselines/reference/submodule/conformance/importTag18.types @@ -15,6 +15,6 @@ export interface Foo {} * @param {Foo} a */ export function foo(a) {} ->foo : (a: any) => void ->a : any +>foo : (a: Foo) => void +>a : Foo diff --git a/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt new file mode 100644 index 0000000000..1adc07dfbe --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag19.errors.txt @@ -0,0 +1,19 @@ +b.js(7,12): error TS2304: Cannot find name 'Foo'. + + +==== a.ts (0 errors) ==== + export interface Foo {} + +==== b.js (1 errors) ==== + /** + * @import { Foo } + * from "./a" + */ + + /** + * @param {Foo} a + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + export function foo(a) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag19.types b/testdata/baselines/reference/submodule/conformance/importTag19.types index 54bc1fbc9e..16ffb8480e 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag19.types +++ b/testdata/baselines/reference/submodule/conformance/importTag19.types @@ -14,6 +14,6 @@ export interface Foo {} * @param {Foo} a */ export function foo(a) {} ->foo : (a: any) => void ->a : any +>foo : (a: Foo) => void +>a : Foo diff --git a/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt new file mode 100644 index 0000000000..75e50ed132 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag2.errors.txt @@ -0,0 +1,20 @@ +/foo.js(6,13): error TS2503: Cannot find namespace 'types'. + + +==== /types.ts (0 errors) ==== + export interface Foo { + a: number; + } + +==== /foo.js (1 errors) ==== + /** + * @import * as types from "./types" + */ + + /** + * @param { types.Foo } foo + ~~~~~ +!!! error TS2503: Cannot find namespace 'types'. + */ + export function f(foo) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag2.types b/testdata/baselines/reference/submodule/conformance/importTag2.types index 5902e0b9fa..a8fd4d1a8e 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag2.types +++ b/testdata/baselines/reference/submodule/conformance/importTag2.types @@ -15,6 +15,6 @@ export interface Foo { * @param { types.Foo } foo */ export function f(foo) {} ->f : (foo: any) => void ->foo : any +>f : (foo: Foo) => void +>foo : Foo diff --git a/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt new file mode 100644 index 0000000000..2ec34959d1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag20.errors.txt @@ -0,0 +1,20 @@ +b.js(8,12): error TS2304: Cannot find name 'Foo'. + + +==== a.ts (0 errors) ==== + export interface Foo {} + +==== b.js (1 errors) ==== + /** + * @import + * { Foo + * } from './a' + */ + + /** + * @param {Foo} a + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + export function foo(a) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag20.types b/testdata/baselines/reference/submodule/conformance/importTag20.types index bd476769bc..40d8da038c 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag20.types +++ b/testdata/baselines/reference/submodule/conformance/importTag20.types @@ -15,6 +15,6 @@ export interface Foo {} * @param {Foo} a */ export function foo(a) {} ->foo : (a: any) => void ->a : any +>foo : (a: Foo) => void +>a : Foo diff --git a/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt new file mode 100644 index 0000000000..74ccb4534f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag3.errors.txt @@ -0,0 +1,20 @@ +/foo.js(6,13): error TS2304: Cannot find name 'Foo'. + + +==== /types.ts (0 errors) ==== + export default interface Foo { + a: number; + } + +==== /foo.js (1 errors) ==== + /** + * @import Foo from "./types" + */ + + /** + * @param { Foo } foo + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + export function f(foo) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag3.types b/testdata/baselines/reference/submodule/conformance/importTag3.types index 5272282eb7..da6d62466d 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag3.types +++ b/testdata/baselines/reference/submodule/conformance/importTag3.types @@ -15,6 +15,6 @@ export default interface Foo { * @param { Foo } foo */ export function f(foo) {} ->f : (foo: any) => void ->foo : any +>f : (foo: Foo) => void +>foo : Foo diff --git a/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt new file mode 100644 index 0000000000..23e58203fa --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag4.errors.txt @@ -0,0 +1,24 @@ +/foo.js(10,13): error TS2304: Cannot find name 'Foo'. + + +==== /types.ts (0 errors) ==== + export interface Foo { + a: number; + } + +==== /foo.js (1 errors) ==== + /** + * @import { Foo } from "./types" + */ + + /** + * @import { Foo } from "./types" + */ + + /** + * @param { Foo } foo + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + function f(foo) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag4.types b/testdata/baselines/reference/submodule/conformance/importTag4.types index 601f5a039e..473a932a89 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag4.types +++ b/testdata/baselines/reference/submodule/conformance/importTag4.types @@ -19,6 +19,6 @@ export interface Foo { * @param { Foo } foo */ function f(foo) {} ->f : (foo: any) => void ->foo : any +>f : (foo: Foo) => void +>foo : Foo diff --git a/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt new file mode 100644 index 0000000000..bfac61ad4a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag5.errors.txt @@ -0,0 +1,20 @@ +/foo.js(6,13): error TS2304: Cannot find name 'Foo'. + + +==== /types.ts (0 errors) ==== + export interface Foo { + a: number; + } + +==== /foo.js (1 errors) ==== + /** + * @import { Foo } from "./types" + */ + + /** + * @param { Foo } foo + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + */ + function f(foo) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag5.types b/testdata/baselines/reference/submodule/conformance/importTag5.types index 1bc075eb04..7d9641be55 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag5.types +++ b/testdata/baselines/reference/submodule/conformance/importTag5.types @@ -15,6 +15,6 @@ export interface Foo { * @param { Foo } foo */ function f(foo) {} ->f : (foo: any) => void ->foo : any +>f : (foo: Foo) => void +>foo : Foo diff --git a/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt new file mode 100644 index 0000000000..6a1ec95ceb --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag6.errors.txt @@ -0,0 +1,30 @@ +/foo.js(9,13): error TS2304: Cannot find name 'A'. +/foo.js(10,13): error TS2304: Cannot find name 'B'. + + +==== /types.ts (0 errors) ==== + export interface A { + a: number; + } + export interface B { + a: number; + } + +==== /foo.js (2 errors) ==== + /** + * @import { + * A, + * B, + * } from "./types" + */ + + /** + * @param { A } a + ~ +!!! error TS2304: Cannot find name 'A'. + * @param { B } b + ~ +!!! error TS2304: Cannot find name 'B'. + */ + function f(a, b) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag6.types b/testdata/baselines/reference/submodule/conformance/importTag6.types index 8d3e010dbc..0fd85537cd 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag6.types +++ b/testdata/baselines/reference/submodule/conformance/importTag6.types @@ -23,7 +23,7 @@ export interface B { * @param { B } b */ function f(a, b) {} ->f : (a: any, b: any) => void ->a : any ->b : any +>f : (a: A, b: B) => void +>a : A +>b : B diff --git a/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt new file mode 100644 index 0000000000..90936c1814 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag7.errors.txt @@ -0,0 +1,29 @@ +/foo.js(8,13): error TS2304: Cannot find name 'A'. +/foo.js(9,13): error TS2304: Cannot find name 'B'. + + +==== /types.ts (0 errors) ==== + export interface A { + a: number; + } + export interface B { + a: number; + } + +==== /foo.js (2 errors) ==== + /** + * @import { + * A, + * B } from "./types" + */ + + /** + * @param { A } a + ~ +!!! error TS2304: Cannot find name 'A'. + * @param { B } b + ~ +!!! error TS2304: Cannot find name 'B'. + */ + function f(a, b) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag7.types b/testdata/baselines/reference/submodule/conformance/importTag7.types index 1030a0467c..c4def0aa93 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag7.types +++ b/testdata/baselines/reference/submodule/conformance/importTag7.types @@ -22,7 +22,7 @@ export interface B { * @param { B } b */ function f(a, b) {} ->f : (a: any, b: any) => void ->a : any ->b : any +>f : (a: A, b: B) => void +>a : A +>b : B diff --git a/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt new file mode 100644 index 0000000000..dadfa9424e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag8.errors.txt @@ -0,0 +1,29 @@ +/foo.js(8,13): error TS2304: Cannot find name 'A'. +/foo.js(9,13): error TS2304: Cannot find name 'B'. + + +==== /types.ts (0 errors) ==== + export interface A { + a: number; + } + export interface B { + a: number; + } + +==== /foo.js (2 errors) ==== + /** + * @import + * { A, B } + * from "./types" + */ + + /** + * @param { A } a + ~ +!!! error TS2304: Cannot find name 'A'. + * @param { B } b + ~ +!!! error TS2304: Cannot find name 'B'. + */ + function f(a, b) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag8.types b/testdata/baselines/reference/submodule/conformance/importTag8.types index 717ac5a40a..8494d7cb28 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag8.types +++ b/testdata/baselines/reference/submodule/conformance/importTag8.types @@ -22,7 +22,7 @@ export interface B { * @param { B } b */ function f(a, b) {} ->f : (a: any, b: any) => void ->a : any ->b : any +>f : (a: A, b: B) => void +>a : A +>b : B diff --git a/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt new file mode 100644 index 0000000000..44b7a7c5ba --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag9.errors.txt @@ -0,0 +1,29 @@ +/foo.js(8,13): error TS2503: Cannot find namespace 'types'. +/foo.js(9,13): error TS2503: Cannot find namespace 'types'. + + +==== /types.ts (0 errors) ==== + export interface A { + a: number; + } + export interface B { + a: number; + } + +==== /foo.js (2 errors) ==== + /** + * @import + * * as types + * from "./types" + */ + + /** + * @param { types.A } a + ~~~~~ +!!! error TS2503: Cannot find namespace 'types'. + * @param { types.B } b + ~~~~~ +!!! error TS2503: Cannot find namespace 'types'. + */ + function f(a, b) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag9.types b/testdata/baselines/reference/submodule/conformance/importTag9.types index c84ac65f52..994366bb98 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag9.types +++ b/testdata/baselines/reference/submodule/conformance/importTag9.types @@ -22,7 +22,7 @@ export interface B { * @param { types.B } b */ function f(a, b) {} ->f : (a: any, b: any) => void ->a : any ->b : any +>f : (a: A, b: B) => void +>a : A +>b : B diff --git a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols index 708cd0edc7..33bb5418f1 100644 --- a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols +++ b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols @@ -45,6 +45,7 @@ export = MyClass; let a = /** @type {Foo} */(/** @type {*} */(undefined)); >a : Symbol(a, Decl(index.js, 4, 3)) +>Foo : Symbol(Foo, Decl(index.js, 4, 56)) >undefined : Symbol(undefined) a = new Foo({doer: Foo.Bar}); @@ -57,12 +58,14 @@ a = new Foo({doer: Foo.Bar}); const q = /** @type {import("./externs").Bar} */({ doer: q => q }); >q : Symbol(q, Decl(index.js, 6, 5)) +>Bar : Symbol(Bar, Decl(externs.d.ts, 0, 27), Decl(externs.d.ts, 6, 18)) >doer : Symbol(doer, Decl(index.js, 6, 50)) >q : Symbol(q, Decl(index.js, 6, 56)) >q : Symbol(q, Decl(index.js, 6, 56)) const r = /** @type {typeof import("./externs").Bar} */(r => r); >r : Symbol(r, Decl(index.js, 7, 5)) +>Bar : Symbol(Bar, Decl(externs.d.ts, 0, 27), Decl(externs.d.ts, 6, 18)) >r : Symbol(r, Decl(index.js, 7, 56)) >r : Symbol(r, Decl(index.js, 7, 56)) diff --git a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols.diff b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols.diff index 7cddf0f690..98d81bb38f 100644 --- a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols.diff @@ -37,7 +37,12 @@ >MyClass : Symbol(MyClass, Decl(externs.d.ts, 0, 0), Decl(externs.d.ts, 4, 1)) } export = MyClass; -@@= skipped -33, +33 lines =@@ +@@= skipped -29, +29 lines =@@ + + let a = /** @type {Foo} */(/** @type {*} */(undefined)); + >a : Symbol(a, Decl(index.js, 4, 3)) ++>Foo : Symbol(Foo, Decl(index.js, 4, 56)) + >undefined : Symbol(undefined) a = new Foo({doer: Foo.Bar}); >a : Symbol(a, Decl(index.js, 4, 3)) @@ -53,3 +58,14 @@ const q = /** @type {import("./externs").Bar} */({ doer: q => q }); >q : Symbol(q, Decl(index.js, 6, 5)) ++>Bar : Symbol(Bar, Decl(externs.d.ts, 0, 27), Decl(externs.d.ts, 6, 18)) + >doer : Symbol(doer, Decl(index.js, 6, 50)) + >q : Symbol(q, Decl(index.js, 6, 56)) + >q : Symbol(q, Decl(index.js, 6, 56)) + + const r = /** @type {typeof import("./externs").Bar} */(r => r); + >r : Symbol(r, Decl(index.js, 7, 5)) ++>Bar : Symbol(Bar, Decl(externs.d.ts, 0, 27), Decl(externs.d.ts, 6, 18)) + >r : Symbol(r, Decl(index.js, 7, 56)) + >r : Symbol(r, Decl(index.js, 7, 56)) + diff --git a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.types b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.types index 987261934e..16b792520a 100644 --- a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.types +++ b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.types @@ -36,17 +36,21 @@ export = MyClass; === index.js === /** * @typedef {import("./externs")} Foo +>Foo : any + */ let a = /** @type {Foo} */(/** @type {*} */(undefined)); ->a : any ->(/** @type {*} */(undefined)) : undefined ->(undefined) : undefined +>a : MyClass +>(/** @type {*} */(undefined)) : MyClass +>(undefined) : MyClass +>(undefined) : any +>undefined : any >undefined : undefined a = new Foo({doer: Foo.Bar}); >a = new Foo({doer: Foo.Bar}) : MyClass ->a : any +>a : MyClass >new Foo({doer: Foo.Bar}) : MyClass >Foo : typeof MyClass >{doer: Foo.Bar} : { doer: (x: string, y?: number) => void; } @@ -56,18 +60,21 @@ a = new Foo({doer: Foo.Bar}); >Bar : (x: string, y?: number) => void const q = /** @type {import("./externs").Bar} */({ doer: q => q }); ->q : { doer: (q: any) => any; } ->({ doer: q => q }) : { doer: (q: any) => any; } ->{ doer: q => q } : { doer: (q: any) => any; } ->doer : (q: any) => any ->q => q : (q: any) => any ->q : any ->q : any +>q : Bar +>({ doer: q => q }) : Bar +>{ doer: q => q } : Bar +>{ doer: q => q } : { doer: (q: string) => string; } +>doer : (q: string) => string +>q => q : (q: string) => string +>q : string +>q : string const r = /** @type {typeof import("./externs").Bar} */(r => r); ->r : (r: any) => any ->(r => r) : (r: any) => any ->r => r : (r: any) => any ->r : any ->r : any +>r : (x: string, y?: number) => void +>(r => r) : (x: string, y?: number) => void +>r => r : (x: string, y?: number) => void +>Bar : any +>r => r : (r: string) => string +>r : string +>r : string diff --git a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.errors.txt index 1ed803ee47..38f2dac63d 100644 --- a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.errors.txt @@ -1,5 +1,4 @@ -/index.js(5,10): error TS2304: Cannot find name 'JSDocType'. -/index.js(6,10): error TS2304: Cannot find name 'JSDocType'. +/index.js(5,10): error TS2484: Export declaration conflicts with exported declaration of 'JSDocType'. ==== /node_modules/@types/node/index.d.ts (0 errors) ==== @@ -8,16 +7,14 @@ export function writeFile(path: string, data: any, options: WriteFileOptions, callback: (err: Error) => void): void; } -==== /index.js (2 errors) ==== +==== /index.js (1 errors) ==== import { writeFile, WriteFileOptions, WriteFileOptions as OtherName } from "fs"; /** @typedef {{ x: any }} JSDocType */ export { JSDocType }; ~~~~~~~~~ -!!! error TS2304: Cannot find name 'JSDocType'. +!!! error TS2484: Export declaration conflicts with exported declaration of 'JSDocType'. export { JSDocType as ThisIsFine }; - ~~~~~~~~~ -!!! error TS2304: Cannot find name 'JSDocType'. export { WriteFileOptions }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols index 3cdc6da6e7..387a98964b 100644 --- a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols +++ b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols @@ -29,9 +29,10 @@ import { writeFile, WriteFileOptions, WriteFileOptions as OtherName } from "fs"; >x : Symbol(x, Decl(index.js, 2, 15)) export { JSDocType }; ->JSDocType : Symbol(JSDocType, Decl(index.js, 4, 8)) +>JSDocType : Symbol(JSDocType, Decl(index.js, 4, 21), Decl(index.js, 4, 8)) export { JSDocType as ThisIsFine }; +>JSDocType : Symbol(JSDocType, Decl(index.js, 4, 21), Decl(index.js, 4, 8)) >ThisIsFine : Symbol(ThisIsFine, Decl(index.js, 5, 8)) export { WriteFileOptions }; diff --git a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff index 543ceb9cb7..3528e1c5db 100644 --- a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff @@ -8,10 +8,11 @@ export { JSDocType }; ->JSDocType : Symbol(JSDocType, Decl(index.js, 4, 8), Decl(index.js, 2, 4)) -+>JSDocType : Symbol(JSDocType, Decl(index.js, 4, 8)) ++>JSDocType : Symbol(JSDocType, Decl(index.js, 4, 21), Decl(index.js, 4, 8)) export { JSDocType as ThisIsFine }; ->JSDocType : Symbol(JSDocType, Decl(index.js, 4, 8), Decl(index.js, 2, 4)) ++>JSDocType : Symbol(JSDocType, Decl(index.js, 4, 21), Decl(index.js, 4, 8)) >ThisIsFine : Symbol(ThisIsFine, Decl(index.js, 5, 8)) export { WriteFileOptions }; diff --git a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.types b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.types index a760c64ad3..85e2ea8e3b 100644 --- a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.types +++ b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.types @@ -22,6 +22,8 @@ import { writeFile, WriteFileOptions, WriteFileOptions as OtherName } from "fs"; >OtherName : any /** @typedef {{ x: any }} JSDocType */ +>JSDocType : any +>x : any export { JSDocType }; >JSDocType : any diff --git a/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt b/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt new file mode 100644 index 0000000000..fcb93bba30 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/inferThis.errors.txt @@ -0,0 +1,40 @@ +/a.js(8,9): error TS2322: Type 'typeof C' is not assignable to type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'typeof C'. +/a.js(17,9): error TS2322: Type 'this' is not assignable to type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'this'. + + +==== /a.js (2 errors) ==== + export class C { + /** + * @template T + * @this {T} + * @return {T} + */ + static a() { + return this; + ~~~~~~ +!!! error TS2322: Type 'typeof C' is not assignable to type 'T'. +!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'typeof C'. + } + + /** + * @template T + * @this {T} + * @return {T} + */ + b() { + return this; + ~~~~~~ +!!! error TS2322: Type 'this' is not assignable to type 'T'. +!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'this'. + } + } + + const a = C.a(); + a; // typeof C + + const c = new C(); + const b = c.b(); + b; // C + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/inferThis.types b/testdata/baselines/reference/submodule/conformance/inferThis.types index fbdc443de5..2a0f14878e 100644 --- a/testdata/baselines/reference/submodule/conformance/inferThis.types +++ b/testdata/baselines/reference/submodule/conformance/inferThis.types @@ -10,7 +10,7 @@ export class C { * @return {T} */ static a() { ->a : () => typeof C +>a : () => T return this; >this : typeof C @@ -22,7 +22,7 @@ export class C { * @return {T} */ b() { ->b : () => this +>b : () => T return this; >this : this @@ -30,14 +30,14 @@ export class C { } const a = C.a(); ->a : typeof C ->C.a() : typeof C ->C.a : () => typeof C +>a : unknown +>C.a() : unknown +>C.a : () => T >C : typeof C ->a : () => typeof C +>a : () => T a; // typeof C ->a : typeof C +>a : unknown const c = new C(); >c : C @@ -45,12 +45,12 @@ const c = new C(); >C : typeof C const b = c.b(); ->b : C ->c.b() : C ->c.b : () => C +>b : unknown +>c.b() : unknown +>c.b : () => T >c : C ->b : () => C +>b : () => T b; // C ->b : C +>b : unknown diff --git a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt new file mode 100644 index 0000000000..bd258156de --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt @@ -0,0 +1,25 @@ +instantiateTemplateTagTypeParameterOnVariableStatement.js(3,12): error TS2304: Cannot find name 'T'. +instantiateTemplateTagTypeParameterOnVariableStatement.js(4,18): error TS2304: Cannot find name 'T'. +instantiateTemplateTagTypeParameterOnVariableStatement.js(4,24): error TS2304: Cannot find name 'T'. + + +==== instantiateTemplateTagTypeParameterOnVariableStatement.js (3 errors) ==== + /** + * @template T + * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. + * @returns {(b: T) => T} + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'T'. + */ + const seq = a => b => b; + + const text1 = "hello"; + const text2 = "world"; + + /** @type {string} */ + var text3 = seq(text1)(text2); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types index 64b2da41db..3c17660135 100644 --- a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types +++ b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types @@ -7,12 +7,12 @@ * @returns {(b: T) => T} */ const seq = a => b => b; ->seq : (a: any) => (b: any) => any ->a => b => b : (a: any) => (b: any) => any ->a : any ->b => b : (b: any) => any ->b : any ->b : any +>seq : (a: T) => (b: T) => T +>a => b => b : (a: T) => (b: T) => T +>a : T +>b => b : (b: T) => T +>b : T +>b : T const text1 = "hello"; >text1 : "hello" @@ -24,10 +24,10 @@ const text2 = "world"; /** @type {string} */ var text3 = seq(text1)(text2); ->text3 : any ->seq(text1)(text2) : any ->seq(text1) : (b: any) => any ->seq : (a: any) => (b: any) => any +>text3 : string +>seq(text1)(text2) : T +>seq(text1) : (b: T) => T +>seq : (a: T) => (b: T) => T >text1 : "hello" >text2 : "world" diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.types index 86041f5542..03bd1597c7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.types @@ -12,14 +12,14 @@ export interface Encoder { * @implements {IEncoder} */ export class Encoder { ->Encoder : Encoder +>Encoder : Encoder /** * @param {T} value */ encode(value) { ->encode : (value: any) => Uint8Array ->value : any +>encode : (value: T) => Uint8Array +>value : T return new Uint8Array(0) >new Uint8Array(0) : Uint8Array diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.types index 285d0b527d..2ebdc39cc9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.types @@ -80,14 +80,14 @@ class C2 { * @returns {number} */ method1(x, y) { ->method1 : (x: any, y: any) => any ->x : any ->y : any +>method1 : (x: number, y: number) => number +>x : number +>y : number return x + y; ->x + y : any ->x : any ->y : any +>x + y : number +>x : number +>y : number } } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt index 6a70384f9a..06fa15c729 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt @@ -2,11 +2,12 @@ index.js(138,14): error TS2339: Property 'p1' does not exist on type 'K'. index.js(139,14): error TS2339: Property 'p2' does not exist on type 'K'. index.js(143,21): error TS2339: Property 'p1' does not exist on type 'K'. index.js(151,14): error TS2339: Property 'prop' does not exist on type 'M'. -index.js(165,14): error TS2339: Property 'another' does not exist on type 'N'. -index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. +index.js(165,14): error TS2339: Property 'another' does not exist on type 'N'. +index.js(173,24): error TS2314: Generic type 'N' requires 1 type argument(s). +index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. -==== index.js (6 errors) ==== +==== index.js (7 errors) ==== export class A {} export class B { @@ -181,7 +182,7 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. super(); this.another = param; ~~~~~~~ -!!! error TS2339: Property 'another' does not exist on type 'N'. +!!! error TS2339: Property 'another' does not exist on type 'N'. } } @@ -190,6 +191,8 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. * @extends {N} */ export class O extends N { + ~ +!!! error TS2314: Generic type 'N' requires 1 type argument(s). /** * @param {U} param */ @@ -197,7 +200,7 @@ index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. super(param); this.another2 = param; ~~~~~~~~ -!!! error TS2339: Property 'another2' does not exist on type 'O'. +!!! error TS2339: Property 'another2' does not exist on type 'O'. } } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols index e4f5dad2a0..cca7d7f567 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols @@ -264,7 +264,6 @@ export class O extends N { >param : Symbol(param, Decl(index.js, 176, 16)) super(param); ->super : Symbol(N, Decl(index.js, 152, 1)) >param : Symbol(param, Decl(index.js, 176, 16)) this.another2 = param; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols.diff index 2579a19ff3..f3c9432a46 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols.diff @@ -182,7 +182,11 @@ >param : Symbol(param, Decl(index.js, 162, 16)) } } -@@= skipped -26, +24 lines =@@ +@@= skipped -22, +20 lines =@@ + >param : Symbol(param, Decl(index.js, 176, 16)) + + super(param); +->super : Symbol(N, Decl(index.js, 152, 1)) >param : Symbol(param, Decl(index.js, 176, 16)) this.another2 = param; @@ -192,7 +196,7 @@ >param : Symbol(param, Decl(index.js, 176, 16)) } } -@@= skipped -18, +16 lines =@@ +@@= skipped -22, +19 lines =@@ >HasStatics : Symbol(HasStatics, Decl(index.js, 184, 38)) static staticMethod() {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.types index 49af892548..c91b52d442 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.types @@ -28,21 +28,21 @@ export class D { * @param {number} b */ constructor(a, b) {} ->a : any ->b : any +>a : number +>b : number } /** * @template T,U */ export class E { ->E : E +>E : E /** * @type {T & U} */ field; ->field : any +>field : T & U // @readonly is currently unsupported, it seems - included here just in case that changes /** @@ -50,7 +50,7 @@ export class E { * @readonly */ readonlyField; ->readonlyField : any +>readonlyField : T & U initializedField = 12; >initializedField : number @@ -60,44 +60,46 @@ export class E { * @return {U} */ get f1() { return /** @type {*} */(null); } ->f1 : any ->(null) : null +>f1 : U +>(null) : any +>null : any /** * @param {U} _p */ set f1(_p) {} ->f1 : any ->_p : any +>f1 : U +>_p : U /** * @return {U} */ get f2() { return /** @type {*} */(null); } ->f2 : any ->(null) : null +>f2 : U +>(null) : any +>null : any /** * @param {U} _p */ set f3(_p) {} ->f3 : any ->_p : any +>f3 : U +>_p : U /** * @param {T} a * @param {U} b */ constructor(a, b) {} ->a : any ->b : any +>a : T +>b : U /** * @type {string} */ static staticField; ->staticField : any +>staticField : string // @readonly is currently unsupported, it seems - included here just in case that changes /** @@ -105,7 +107,7 @@ export class E { * @readonly */ static staticReadonlyField; ->staticReadonlyField : any +>staticReadonlyField : string static staticInitializedField = 12; >staticInitializedField : number @@ -136,29 +138,29 @@ export class E { * @param {string} _p */ static set s3(_p) {} ->s3 : any ->_p : any +>s3 : string +>_p : string } /** * @template T,U */ export class F { ->F : F +>F : F /** * @type {T & U} */ field; ->field : any +>field : T & U /** * @param {T} a * @param {U} b */ constructor(a, b) {} ->a : any ->b : any +>a : T +>b : U /** * @template A,B @@ -166,13 +168,13 @@ export class F { * @param {B} b */ static create(a, b) { return new F(a, b); } ->create : (a: any, b: any) => F ->a : any ->b : any ->new F(a, b) : F +>create : (a: A, b: B) => F +>a : A +>b : B +>new F(a, b) : F >F : typeof F ->a : any ->b : any +>a : A +>b : B } class G {} @@ -254,25 +256,25 @@ export class M extends null { * @template T */ export class N extends L { ->N : N +>N : N >L : L /** * @param {T} param */ constructor(param) { ->param : any +>param : T super(); >super() : void >super : typeof L this.another = param; ->this.another = param : any +>this.another = param : T >this.another : any >this : this >another : any ->param : any +>param : T } } @@ -281,32 +283,33 @@ export class N extends L { * @extends {N} */ export class O extends N { ->O : O ->N : N +>O : O +>N : typeof N /** * @param {U} param */ constructor(param) { ->param : any +>param : U super(param); >super(param) : void ->super : typeof N ->param : any +>super : any +>param : U this.another2 = param; ->this.another2 = param : any +>this.another2 = param : U >this.another2 : any >this : this >another2 : any ->param : any +>param : U } } var x = /** @type {*} */(null); >x : any ->(null) : null +>(null) : any +>null : any export class VariableBase extends x {} >VariableBase : VariableBase diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsComputedNames.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsComputedNames.types index d9f0e168db..9365514b93 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsComputedNames.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsComputedNames.types @@ -74,7 +74,7 @@ export class MyClass { * @param {typeof TopLevelSym | typeof InnerSym} _p */ constructor(_p = InnerSym) { ->_p : symbol +>_p : unique symbol | unique symbol >InnerSym : unique symbol // switch on _p diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols index fd8d6c99cb..840e1b395c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols @@ -25,6 +25,7 @@ export default class Foo { a = /** @type {Foo} */(null); >a : Symbol(a, Decl(index3.js, 0, 26)) +>Foo : Symbol(default, Decl(index3.js, 0, 0)) }; export const X = Foo; @@ -45,6 +46,7 @@ class Bar extends Fab { x = /** @type {Bar} */(null); >x : Symbol(x, Decl(index4.js, 1, 23)) +>Bar : Symbol(Bar, Decl(index4.js, 0, 27)) } export default Bar; >Bar : Symbol(Bar, Decl(index4.js, 0, 27)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols.diff index 7dd86f096f..327d53525f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols.diff @@ -29,6 +29,7 @@ a = /** @type {Foo} */(null); ->a : Symbol(Foo.a, Decl(index3.js, 0, 26)) +>a : Symbol(a, Decl(index3.js, 0, 26)) ++>Foo : Symbol(default, Decl(index3.js, 0, 0)) }; export const X = Foo; @@ -42,16 +43,17 @@ >Bar : Symbol(Bar, Decl(index3.js, 4, 8)) === index4.js === -@@= skipped -38, +38 lines =@@ +@@= skipped -38, +39 lines =@@ >Fab : Symbol(Fab, Decl(index4.js, 0, 6)) x = /** @type {Bar} */(null); ->x : Symbol(Bar.x, Decl(index4.js, 1, 23)) +>x : Symbol(x, Decl(index4.js, 1, 23)) ++>Bar : Symbol(Bar, Decl(index4.js, 0, 27)) } export default Bar; >Bar : Symbol(Bar, Decl(index4.js, 0, 27)) -@@= skipped -16, +16 lines =@@ +@@= skipped -16, +17 lines =@@ === index6.js === // merge type alias and function (OK) export default function func() {}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.types index b9e91dd72e..968cb61dbf 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.types @@ -24,8 +24,9 @@ export default class Foo { >Foo : default a = /** @type {Foo} */(null); ->a : any ->(null) : null +>a : default +>(null) : default +>null : default }; export const X = Foo; @@ -45,8 +46,9 @@ class Bar extends Fab { >Fab : default x = /** @type {Bar} */(null); ->x : any ->(null) : null +>x : Bar +>(null) : Bar +>null : Bar } export default Bar; >Bar : Bar diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt new file mode 100644 index 0000000000..7312ed2c66 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.errors.txt @@ -0,0 +1,63 @@ +index.js(23,12): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? +index.js(24,12): error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? +index.js(25,12): error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? +index.js(34,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? + + +==== index.js (4 errors) ==== + /** @enum {string} */ + export const Target = { + START: "start", + MIDDLE: "middle", + END: "end", + /** @type {number} */ + OK_I_GUESS: 2 + } + /** @enum number */ + export const Second = { + OK: 1, + /** @type {number} */ + FINE: 2, + } + /** @enum {function(number): number} */ + export const Fs = { + ADD1: n => n + 1, + ID: n => n, + SUB1: n => n - 1 + } + + /** + * @param {Target} t + ~~~~~~ +!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? + * @param {Second} s + ~~~~~~ +!!! error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? + * @param {Fs} f + ~~ +!!! error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? + */ + export function consume(t,s,f) { + /** @type {string} */ + var str = t + /** @type {number} */ + var num = s + /** @type {(n: number) => number} */ + var fun = f + /** @type {Target} */ + ~~~~~~ +!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? + var v = Target.START + v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums + } + /** @param {string} s */ + export function ff(s) { + // element access with arbitrary string is an error only with noImplicitAny + if (!Target[s]) { + return null + } + else { + return Target[s] + } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.types index 98ede7df05..3bb4eed24e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnumTag.types @@ -21,6 +21,7 @@ export const Target = { /** @type {number} */ OK_I_GUESS: 2 >OK_I_GUESS : number +>2 : number >2 : 2 } /** @enum number */ @@ -35,6 +36,7 @@ export const Second = { /** @type {number} */ FINE: 2, >FINE : number +>2 : number >2 : 2 } /** @enum {function(number): number} */ @@ -71,49 +73,49 @@ export const Fs = { * @param {Fs} f */ export function consume(t,s,f) { ->consume : (t: any, s: any, f: any) => void ->t : any ->s : any ->f : any +>consume : (t: Target, s: Second, f: Fs) => void +>t : Target +>s : Second +>f : Fs /** @type {string} */ var str = t ->str : any ->t : any +>str : string +>t : Target /** @type {number} */ var num = s ->num : any ->s : any +>num : number +>s : Second /** @type {(n: number) => number} */ var fun = f ->fun : any ->f : any +>fun : (n: number) => number +>f : Fs /** @type {Target} */ var v = Target.START ->v : string +>v : Target >Target.START : string >Target : { START: string; MIDDLE: string; END: string; OK_I_GUESS: number; } >START : string v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums >v = 'something else' : "something else" ->v : string +>v : Target >'something else' : "something else" } /** @param {string} s */ export function ff(s) { ->ff : (s: any) => any ->s : any +>ff : (s: string) => any +>s : string // element access with arbitrary string is an error only with noImplicitAny if (!Target[s]) { >!Target[s] : boolean >Target[s] : any >Target : { START: string; MIDDLE: string; END: string; OK_I_GUESS: number; } ->s : any +>s : string return null } @@ -121,7 +123,7 @@ export function ff(s) { return Target[s] >Target[s] : any >Target : { START: string; MIDDLE: string; END: string; OK_I_GUESS: number; } ->s : any +>s : string } } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.types index 794c743867..a2ae5632d8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.types @@ -13,15 +13,15 @@ module.exports = class Thing { * @param {number} p */ constructor(p) { ->p : any +>p : number this.t = 12 + p; ->this.t = 12 + p : any +>this.t = 12 + p : number >this.t : any >this : this >t : any ->12 + p : any +>12 + p : number >12 : 12 ->p : any +>p : number } } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types index 7c5d44494f..5974c5c456 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types @@ -12,15 +12,15 @@ module.exports = class { * @param {number} p */ constructor(p) { ->p : any +>p : number this.t = 12 + p; ->this.t = 12 + p : any +>this.t = 12 + p : number >this.t : any >this : this >t : any ->12 + p : any +>12 + p : number >12 : 12 ->p : any +>p : number } } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types index 6b40743fae..42c61e6f57 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types @@ -12,16 +12,16 @@ module.exports = class { * @param {number} p */ constructor(p) { ->p : any +>p : number this.t = 12 + p; ->this.t = 12 + p : any +>this.t = 12 + p : number >this.t : any >this : this >t : any ->12 + p : any +>12 + p : number >12 : 12 ->p : any +>p : number } } module.exports.Sub = class { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt index 6445eae929..fbb512e76b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt @@ -6,7 +6,9 @@ index.js(22,23): error TS2580: Cannot find name 'module'. Do you need to install index.js(31,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(32,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(32,58): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(36,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(41,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(46,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(51,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(53,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(54,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -16,7 +18,7 @@ index.js(57,54): error TS2580: Cannot find name 'module'. Do you need to install index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== index.js (16 errors) ==== +==== index.js (18 errors) ==== Object.defineProperty(module.exports, "a", { value: function a() {} }); ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -69,6 +71,8 @@ index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. */ function g(a, b) { return a.x && b.y(); @@ -81,6 +85,8 @@ index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. */ function hh(a, b) { return a.x && b.y(); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols index 2af33397b3..c042f1a5a8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols @@ -91,8 +91,12 @@ function g(a, b) { >b : Symbol(b, Decl(index.js, 37, 13)) return a.x && b.y(); +>a.x : Symbol(x, Decl(index.js, 34, 12)) >a : Symbol(a, Decl(index.js, 37, 11)) +>x : Symbol(x, Decl(index.js, 34, 12)) +>b.y : Symbol(y, Decl(index.js, 35, 12)) >b : Symbol(b, Decl(index.js, 37, 13)) +>y : Symbol(y, Decl(index.js, 35, 12)) } Object.defineProperty(module.exports, "g", { value: g }); >Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) @@ -112,8 +116,12 @@ function hh(a, b) { >b : Symbol(b, Decl(index.js, 47, 14)) return a.x && b.y(); +>a.x : Symbol(x, Decl(index.js, 44, 12)) >a : Symbol(a, Decl(index.js, 47, 12)) +>x : Symbol(x, Decl(index.js, 44, 12)) +>b.y : Symbol(y, Decl(index.js, 45, 12)) >b : Symbol(b, Decl(index.js, 47, 14)) +>y : Symbol(y, Decl(index.js, 45, 12)) } Object.defineProperty(module.exports, "h", { value: hh }); >Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols.diff index a83909aa88..a07682c725 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.symbols.diff @@ -113,16 +113,8 @@ /** * @param {{x: string}} a -@@= skipped -37, +22 lines =@@ - >b : Symbol(b, Decl(index.js, 37, 13)) - - return a.x && b.y(); -->a.x : Symbol(x, Decl(index.js, 34, 12)) - >a : Symbol(a, Decl(index.js, 37, 11)) -->x : Symbol(x, Decl(index.js, 34, 12)) -->b.y : Symbol(y, Decl(index.js, 35, 12)) - >b : Symbol(b, Decl(index.js, 37, 13)) -->y : Symbol(y, Decl(index.js, 35, 12)) +@@= skipped -45, +30 lines =@@ + >y : Symbol(y, Decl(index.js, 35, 12)) } Object.defineProperty(module.exports, "g", { value: g }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) @@ -137,16 +129,8 @@ >value : Symbol(value, Decl(index.js, 40, 44)) >g : Symbol(g, Decl(index.js, 31, 77)) -@@= skipped -29, +21 lines =@@ - >b : Symbol(b, Decl(index.js, 47, 14)) - - return a.x && b.y(); -->a.x : Symbol(x, Decl(index.js, 44, 12)) - >a : Symbol(a, Decl(index.js, 47, 12)) -->x : Symbol(x, Decl(index.js, 44, 12)) -->b.y : Symbol(y, Decl(index.js, 45, 12)) - >b : Symbol(b, Decl(index.js, 47, 14)) -->y : Symbol(y, Decl(index.js, 45, 12)) +@@= skipped -29, +25 lines =@@ + >y : Symbol(y, Decl(index.js, 45, 12)) } Object.defineProperty(module.exports, "h", { value: hh }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.types index d09542d31a..6006082d96 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDefinePropertyEmit.types @@ -50,10 +50,11 @@ Object.defineProperty(module.exports.b, "cat", { value: "cat" }); * @return {string} */ function d(a, b) { return /** @type {*} */(null); } ->d : (a: any, b: any) => any ->a : any ->b : any ->(null) : null +>d : (a: number, b: number) => string +>a : number +>b : number +>(null) : any +>null : any Object.defineProperty(module.exports, "d", { value: d }); >Object.defineProperty(module.exports, "d", { value: d }) : any @@ -64,9 +65,9 @@ Object.defineProperty(module.exports, "d", { value: d }); >module : any >exports : any >"d" : "d" ->{ value: d } : { value: (a: any, b: any) => any; } ->value : (a: any, b: any) => any ->d : (a: any, b: any) => any +>{ value: d } : { value: (a: number, b: number) => string; } +>value : (a: number, b: number) => string +>d : (a: number, b: number) => string /** @@ -76,10 +77,11 @@ Object.defineProperty(module.exports, "d", { value: d }); * @return {T & U} */ function e(a, b) { return /** @type {*} */(null); } ->e : (a: any, b: any) => any ->a : any ->b : any ->(null) : null +>e : (a: T, b: U) => T & U +>a : T +>b : U +>(null) : any +>null : any Object.defineProperty(module.exports, "e", { value: e }); >Object.defineProperty(module.exports, "e", { value: e }) : any @@ -90,20 +92,20 @@ Object.defineProperty(module.exports, "e", { value: e }); >module : any >exports : any >"e" : "e" ->{ value: e } : { value: (a: any, b: any) => any; } ->value : (a: any, b: any) => any ->e : (a: any, b: any) => any +>{ value: e } : { value: (a: T, b: U) => T & U; } +>value : (a: T, b: U) => T & U +>e : (a: T, b: U) => T & U /** * @template T * @param {T} a */ function f(a) { ->f : (a: any) => any ->a : any +>f : (a: T) => T +>a : T return a; ->a : any +>a : T } Object.defineProperty(module.exports, "f", { value: f }); >Object.defineProperty(module.exports, "f", { value: f }) : any @@ -114,9 +116,9 @@ Object.defineProperty(module.exports, "f", { value: f }); >module : any >exports : any >"f" : "f" ->{ value: f } : { value: (a: any) => any; } ->value : (a: any) => any ->f : (a: any) => any +>{ value: f } : { value: (a: T) => T; } +>value : (a: T) => T +>f : (a: T) => T Object.defineProperty(module.exports.f, "self", { value: module.exports.f }); >Object.defineProperty(module.exports.f, "self", { value: module.exports.f }) : any @@ -142,18 +144,18 @@ Object.defineProperty(module.exports.f, "self", { value: module.exports.f }); * @param {{y: typeof module.exports.b}} b */ function g(a, b) { ->g : (a: any, b: any) => any ->a : any ->b : any +>g : (a: { x: string; }, b: { y: any; }) => any +>a : { x: string; } +>b : { y: any; } return a.x && b.y(); >a.x && b.y() : any ->a.x : any ->a : any ->x : any +>a.x : string +>a : { x: string; } +>x : string >b.y() : any >b.y : any ->b : any +>b : { y: any; } >y : any } Object.defineProperty(module.exports, "g", { value: g }); @@ -165,9 +167,9 @@ Object.defineProperty(module.exports, "g", { value: g }); >module : any >exports : any >"g" : "g" ->{ value: g } : { value: (a: any, b: any) => any; } ->value : (a: any, b: any) => any ->g : (a: any, b: any) => any +>{ value: g } : { value: (a: { x: string; }, b: { y: any; }) => any; } +>value : (a: { x: string; }, b: { y: any; }) => any +>g : (a: { x: string; }, b: { y: any; }) => any /** @@ -175,18 +177,18 @@ Object.defineProperty(module.exports, "g", { value: g }); * @param {{y: typeof module.exports.b}} b */ function hh(a, b) { ->hh : (a: any, b: any) => any ->a : any ->b : any +>hh : (a: { x: string; }, b: { y: any; }) => any +>a : { x: string; } +>b : { y: any; } return a.x && b.y(); >a.x && b.y() : any ->a.x : any ->a : any ->x : any +>a.x : string +>a : { x: string; } +>x : string >b.y() : any >b.y : any ->b : any +>b : { y: any; } >y : any } Object.defineProperty(module.exports, "h", { value: hh }); @@ -198,9 +200,9 @@ Object.defineProperty(module.exports, "h", { value: hh }); >module : any >exports : any >"h" : "h" ->{ value: hh } : { value: (a: any, b: any) => any; } ->value : (a: any, b: any) => any ->hh : (a: any, b: any) => any +>{ value: hh } : { value: (a: { x: string; }, b: { y: any; }) => any; } +>value : (a: { x: string; }, b: { y: any; }) => any +>hh : (a: { x: string; }, b: { y: any; }) => any Object.defineProperty(module.exports, "i", { value: function i(){} }); >Object.defineProperty(module.exports, "i", { value: function i(){} }) : any diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt index d61c510933..e7e6110d7a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt @@ -1,5 +1,8 @@ +context.js(4,21): error TS2306: File 'timer.js' is not a module. +context.js(5,14): error TS1340: Module './hook' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./hook')'? context.js(34,14): error TS2350: Only a void function can be called with the 'new' keyword. context.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +hook.js(2,20): error TS1340: Module './context' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./context')'? hook.js(10,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -14,9 +17,11 @@ timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install t module.exports = Timer; ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== hook.js (1 errors) ==== +==== hook.js (2 errors) ==== /** * @typedef {(arg: import("./context")) => void} HookHandler + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1340: Module './context' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./context')'? */ /** * @param {HookHandler} handle @@ -28,12 +33,16 @@ timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install t ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== context.js (2 errors) ==== +==== context.js (4 errors) ==== /** * Imports * * @typedef {import("./timer")} Timer + ~~~~~~~~~ +!!! error TS2306: File 'timer.js' is not a module. * @typedef {import("./hook")} Hook + ~~~~~~~~~~~~~~~~ +!!! error TS1340: Module './hook' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./hook')'? * @typedef {import("./hook").HookHandler} HookHandler */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols index e6f2038355..945f3efcda 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols @@ -17,6 +17,7 @@ module.exports = Timer; === hook.js === /** * @typedef {(arg: import("./context")) => void} HookHandler +>HookHandler : Symbol(HookHandler, Decl(hook.js, 8, 1)) >arg : Symbol(arg, Decl(hook.js, 1, 14)) */ @@ -38,19 +39,30 @@ module.exports = Hook; * Imports * * @typedef {import("./timer")} Timer +>Timer : Symbol(Timer, Decl(context.js, 36, 1)) + * @typedef {import("./hook")} Hook +>Hook : Symbol(Hook, Decl(context.js, 36, 1)) + * @typedef {import("./hook").HookHandler} HookHandler +>HookHandler : Symbol(HookHandler, Decl(context.js, 36, 1)) +>HookHandler : Symbol(HookHandler, Decl(hook.js, 8, 1)) + */ /** * Input type definition * * @typedef {Object} Input +>Input : Symbol(Input, Decl(context.js, 36, 1)) + * @prop {Timer} timer ->Timer : Symbol(Timer) +>timer : Symbol(timer, Decl(context.js, 36, 1)) +>Timer : Symbol(Timer, Decl(context.js, 36, 1)) * @prop {Hook} hook ->Hook : Symbol(Hook) +>hook : Symbol(hook, Decl(context.js, 36, 1)) +>Hook : Symbol(Hook, Decl(context.js, 36, 1)) */ @@ -58,11 +70,15 @@ module.exports = Hook; * State type definition * * @typedef {Object} State +>State : Symbol(State, Decl(context.js, 36, 1)) + * @prop {Timer} timer ->Timer : Symbol(Timer) +>timer : Symbol(timer, Decl(context.js, 36, 1)) +>Timer : Symbol(Timer, Decl(context.js, 36, 1)) * @prop {Hook} hook ->Hook : Symbol(Hook) +>hook : Symbol(hook, Decl(context.js, 36, 1)) +>Hook : Symbol(Hook, Decl(context.js, 36, 1)) */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff index 54527982ea..b319aa57e1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff @@ -18,12 +18,13 @@ === hook.js === /** * @typedef {(arg: import("./context")) => void} HookHandler ++>HookHandler : Symbol(HookHandler, Decl(hook.js, 8, 1)) +>arg : Symbol(arg, Decl(hook.js, 1, 14)) + */ /** * @param {HookHandler} handle -@@= skipped -23, +19 lines =@@ +@@= skipped -23, +20 lines =@@ >handle : Symbol(handle, Decl(hook.js, 6, 14)) this.handle = handle; @@ -39,31 +40,55 @@ >Hook : Symbol(Hook, Decl(hook.js, 0, 0)) === context.js === -@@= skipped -25, +19 lines =@@ +@@= skipped -16, +10 lines =@@ + * Imports + * + * @typedef {import("./timer")} Timer ++>Timer : Symbol(Timer, Decl(context.js, 36, 1)) ++ + * @typedef {import("./hook")} Hook ++>Hook : Symbol(Hook, Decl(context.js, 36, 1)) ++ + * @typedef {import("./hook").HookHandler} HookHandler ++>HookHandler : Symbol(HookHandler, Decl(context.js, 36, 1)) ++>HookHandler : Symbol(HookHandler, Decl(hook.js, 8, 1)) ++ + */ + + /** + * Input type definition * * @typedef {Object} Input ++>Input : Symbol(Input, Decl(context.js, 36, 1)) ++ * @prop {Timer} timer -+>Timer : Symbol(Timer) ++>timer : Symbol(timer, Decl(context.js, 36, 1)) ++>Timer : Symbol(Timer, Decl(context.js, 36, 1)) + * @prop {Hook} hook -+>Hook : Symbol(Hook) ++>hook : Symbol(hook, Decl(context.js, 36, 1)) ++>Hook : Symbol(Hook, Decl(context.js, 36, 1)) + */ /** -@@= skipped -8, +12 lines =@@ + * State type definition * * @typedef {Object} State ++>State : Symbol(State, Decl(context.js, 36, 1)) ++ * @prop {Timer} timer -+>Timer : Symbol(Timer) ++>timer : Symbol(timer, Decl(context.js, 36, 1)) ++>Timer : Symbol(Timer, Decl(context.js, 36, 1)) + * @prop {Hook} hook -+>Hook : Symbol(Hook) ++>hook : Symbol(hook, Decl(context.js, 36, 1)) ++>Hook : Symbol(Hook, Decl(context.js, 36, 1)) + */ /** -@@= skipped -11, +15 lines =@@ +@@= skipped -28, +51 lines =@@ */ function Context(input) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types index 7afb8afe3a..e729c73dcb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types @@ -5,71 +5,92 @@ * @param {number} timeout */ function Timer(timeout) { ->Timer : (timeout: any) => void ->timeout : any +>Timer : (timeout: number) => void +>timeout : number this.timeout = timeout; ->this.timeout = timeout : any +>this.timeout = timeout : number >this.timeout : any >this : any >timeout : any ->timeout : any +>timeout : number } module.exports = Timer; ->module.exports = Timer : (timeout: any) => void +>module.exports = Timer : (timeout: number) => void >module.exports : any >module : any >exports : any ->Timer : (timeout: any) => void +>Timer : (timeout: number) => void === hook.js === /** * @typedef {(arg: import("./context")) => void} HookHandler +>HookHandler : HookHandler +>arg : any + */ /** * @param {HookHandler} handle */ function Hook(handle) { ->Hook : (handle: any) => void ->handle : any +>Hook : (handle: HookHandler) => void +>handle : HookHandler this.handle = handle; ->this.handle = handle : any +>this.handle = handle : HookHandler >this.handle : any >this : any >handle : any ->handle : any +>handle : HookHandler } module.exports = Hook; ->module.exports = Hook : (handle: any) => void +>module.exports = Hook : (handle: HookHandler) => void >module.exports : any >module : any >exports : any ->Hook : (handle: any) => void +>Hook : (handle: HookHandler) => void === context.js === /** * Imports * * @typedef {import("./timer")} Timer +>Timer : any + * @typedef {import("./hook")} Hook +>Hook : any + * @typedef {import("./hook").HookHandler} HookHandler +>HookHandler : HookHandler + */ /** * Input type definition * * @typedef {Object} Input +>Input : Input + * @prop {Timer} timer +>timer : any + * @prop {Hook} hook +>hook : any + */ /** * State type definition * * @typedef {Object} State +>State : State + * @prop {Timer} timer +>timer : any + * @prop {Hook} hook +>hook : any + */ /** @@ -80,20 +101,20 @@ module.exports = Hook; */ function Context(input) { ->Context : { (input: any): any; prototype: { construct: (input: any, handle?: () => any) => any; }; } ->input : any +>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } +>input : Input if (!(this instanceof Context)) { >!(this instanceof Context) : boolean >(this instanceof Context) : boolean >this instanceof Context : boolean >this : any ->Context : { (input: any): any; prototype: { construct: (input: any, handle?: () => any) => any; }; } +>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } return new Context(input) >new Context(input) : any ->Context : { (input: any): any; prototype: { construct: (input: any, handle?: () => any) => any; }; } ->input : any +>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } +>input : Input } this.state = this.construct(input); >this.state = this.construct(input) : any @@ -104,14 +125,14 @@ function Context(input) { >this.construct : any >this : any >construct : any ->input : any +>input : Input } Context.prototype = { ->Context.prototype = { /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: any, handle?: () => any) => any; } ->Context.prototype : { construct: (input: any, handle?: () => any) => any; } ->Context : { (input: any): any; prototype: { construct: (input: any, handle?: () => any) => any; }; } ->prototype : { construct: (input: any, handle?: () => any) => any; } ->{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: any, handle?: () => any) => any; } +>Context.prototype = { /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: Input, handle?: HookHandler) => State; } +>Context.prototype : { construct: (input: Input, handle?: HookHandler) => State; } +>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } +>prototype : { construct: (input: Input, handle?: HookHandler) => State; } +>{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: Input, handle?: HookHandler) => State; } /** * @param {Input} input @@ -119,21 +140,21 @@ Context.prototype = { * @returns {State} */ construct(input, handle = () => void 0) { ->construct : (input: any, handle?: () => any) => any ->input : any ->handle : () => any +>construct : (input: Input, handle?: HookHandler) => State +>input : Input +>handle : HookHandler >() => void 0 : () => any >void 0 : undefined >0 : 0 return input; ->input : any +>input : Input } } module.exports = Context; ->module.exports = Context : { (input: any): any; prototype: { construct: (input: any, handle?: () => any) => any; }; } +>module.exports = Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } >module.exports : any >module : any >exports : any ->Context : { (input: any): any; prototype: { construct: (input: any, handle?: () => any) => any; }; } +>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionJSDoc.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionJSDoc.types index cb4b7873be..981b176d05 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionJSDoc.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionJSDoc.types @@ -7,9 +7,9 @@ * @param {string} b */ export function foo(a, b) {} ->foo : (a: any, b: any) => void ->a : any ->b : any +>foo : (a: number, b: string) => void +>a : number +>b : string /** * Legacy - DO NOT USE @@ -23,18 +23,18 @@ export class Aleph { * @param {null} b */ constructor(a, b) { ->a : any ->b : any +>a : Aleph +>b : null /** * Field is always null */ this.field = b; ->this.field = b : any +>this.field = b : null >this.field : any >this : this >field : any ->b : any +>b : null } /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt index 4257e9ac23..cd9c5cdf28 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.errors.txt @@ -1,3 +1,4 @@ +referencer.js(4,12): error TS2749: 'Point' refers to a value, but is being used as a type here. Did you mean 'typeof Point'? source.js(7,16): error TS2350: Only a void function can be called with the 'new' keyword. @@ -16,11 +17,13 @@ source.js(7,16): error TS2350: Only a void function can be called with the 'new' this.y = y; } -==== referencer.js (0 errors) ==== +==== referencer.js (1 errors) ==== import {Point} from "./source"; /** * @param {Point} p + ~~~~~ +!!! error TS2749: 'Point' refers to a value, but is being used as a type here. Did you mean 'typeof Point'? */ export function magnitude(p) { return Math.sqrt(p.x ** 2 + p.y ** 2); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.types index 4f75013fb3..8946c4eb88 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.types @@ -6,48 +6,48 @@ * @param {number} y */ export function Point(x, y) { ->Point : (x: any, y: any) => any ->x : any ->y : any +>Point : (x: number, y: number) => any +>x : number +>y : number if (!(this instanceof Point)) { >!(this instanceof Point) : boolean >(this instanceof Point) : boolean >this instanceof Point : boolean >this : any ->Point : (x: any, y: any) => any +>Point : (x: number, y: number) => any return new Point(x, y); >new Point(x, y) : any ->Point : (x: any, y: any) => any ->x : any ->y : any +>Point : (x: number, y: number) => any +>x : number +>y : number } this.x = x; ->this.x = x : any +>this.x = x : number >this.x : any >this : any >x : any ->x : any +>x : number this.y = y; ->this.y = y : any +>this.y = y : number >this.y : any >this : any >y : any ->y : any +>y : number } === referencer.js === import {Point} from "./source"; ->Point : (x: any, y: any) => any +>Point : (x: number, y: number) => any /** * @param {Point} p */ export function magnitude(p) { ->magnitude : (p: any) => number ->p : any +>magnitude : (p: Point) => number +>p : Point return Math.sqrt(p.x ** 2 + p.y ** 2); >Math.sqrt(p.x ** 2 + p.y ** 2) : number @@ -57,12 +57,12 @@ export function magnitude(p) { >p.x ** 2 + p.y ** 2 : number >p.x ** 2 : number >p.x : any ->p : any +>p : Point >x : any >2 : 2 >p.y ** 2 : number >p.y : any ->p : any +>p : Point >y : any >2 : 2 } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt index 3aedf38175..ab252908a8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt @@ -1,8 +1,9 @@ referencer.js(3,23): error TS2350: Only a void function can be called with the 'new' keyword. +source.js(13,16): error TS2749: 'Vec' refers to a value, but is being used as a type here. Did you mean 'typeof Vec'? source.js(40,16): error TS2350: Only a void function can be called with the 'new' keyword. -==== source.js (1 errors) ==== +==== source.js (2 errors) ==== /** * @param {number} len */ @@ -16,6 +17,8 @@ source.js(40,16): error TS2350: Only a void function can be called with the 'new Vec.prototype = { /** * @param {Vec} other + ~~~ +!!! error TS2749: 'Vec' refers to a value, but is being used as a type here. Did you mean 'typeof Vec'? */ dot(other) { if (other.storage.length !== this.storage.length) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.types index ff03949d11..08caab2393 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.types @@ -5,8 +5,8 @@ * @param {number} len */ export function Vec(len) { ->Vec : { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; } ->len : any +>Vec : { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; } +>len : number /** * @type {number[]} @@ -18,28 +18,28 @@ export function Vec(len) { >storage : any >new Array(len) : any[] >Array : ArrayConstructor ->len : any +>len : number } Vec.prototype = { ->Vec.prototype = { /** * @param {Vec} other */ dot(other) { if (other.storage.length !== this.storage.length) { throw new Error(`Dot product only applicable for vectors of equal length`); } let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] * other.storage[i]); } return sum; }, magnitude() { let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] ** 2); } return Math.sqrt(sum); }} : { dot: (other: any) => number; magnitude: () => number; } ->Vec.prototype : { dot: (other: any) => number; magnitude: () => number; } ->Vec : { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; } ->prototype : { dot: (other: any) => number; magnitude: () => number; } ->{ /** * @param {Vec} other */ dot(other) { if (other.storage.length !== this.storage.length) { throw new Error(`Dot product only applicable for vectors of equal length`); } let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] * other.storage[i]); } return sum; }, magnitude() { let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] ** 2); } return Math.sqrt(sum); }} : { dot: (other: any) => number; magnitude: () => number; } +>Vec.prototype = { /** * @param {Vec} other */ dot(other) { if (other.storage.length !== this.storage.length) { throw new Error(`Dot product only applicable for vectors of equal length`); } let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] * other.storage[i]); } return sum; }, magnitude() { let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] ** 2); } return Math.sqrt(sum); }} : { dot: (other: Vec) => number; magnitude: () => number; } +>Vec.prototype : { dot: (other: Vec) => number; magnitude: () => number; } +>Vec : { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; } +>prototype : { dot: (other: Vec) => number; magnitude: () => number; } +>{ /** * @param {Vec} other */ dot(other) { if (other.storage.length !== this.storage.length) { throw new Error(`Dot product only applicable for vectors of equal length`); } let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] * other.storage[i]); } return sum; }, magnitude() { let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] ** 2); } return Math.sqrt(sum); }} : { dot: (other: Vec) => number; magnitude: () => number; } /** * @param {Vec} other */ dot(other) { ->dot : (other: any) => number ->other : any +>dot : (other: Vec) => number +>other : Vec if (other.storage.length !== this.storage.length) { >other.storage.length !== this.storage.length : boolean >other.storage.length : any >other.storage : any ->other : any +>other : Vec >storage : any >length : any >this.storage.length : any @@ -82,7 +82,7 @@ Vec.prototype = { >i : number >other.storage[i] : any >other.storage : any ->other : any +>other : Vec >storage : any >i : number } @@ -136,59 +136,59 @@ Vec.prototype = { * @param {number} y */ export function Point2D(x, y) { ->Point2D : { (x: any, y: any): any; prototype: { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; }; } ->x : any ->y : any +>Point2D : { (x: number, y: number): any; prototype: { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; }; } +>x : number +>y : number if (!(this instanceof Point2D)) { >!(this instanceof Point2D) : boolean >(this instanceof Point2D) : boolean >this instanceof Point2D : boolean >this : any ->Point2D : { (x: any, y: any): any; prototype: { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; }; } +>Point2D : { (x: number, y: number): any; prototype: { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; }; } return new Point2D(x, y); >new Point2D(x, y) : any ->Point2D : { (x: any, y: any): any; prototype: { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; }; } ->x : any ->y : any +>Point2D : { (x: number, y: number): any; prototype: { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; }; } +>x : number +>y : number } Vec.call(this, 2); >Vec.call(this, 2) : any >Vec.call : (thisArg: any, ...argArray: any[]) => any ->Vec : { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; } +>Vec : { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; } >call : (thisArg: any, ...argArray: any[]) => any >this : any >2 : 2 this.x = x; ->this.x = x : any +>this.x = x : number >this.x : any >this : any >x : any ->x : any +>x : number this.y = y; ->this.y = y : any +>this.y = y : number >this.y : any >this : any >y : any ->y : any +>y : number } Point2D.prototype = { ->Point2D.prototype = { __proto__: Vec, get x() { return this.storage[0]; }, /** * @param {number} x */ set x(x) { this.storage[0] = x; }, get y() { return this.storage[1]; }, /** * @param {number} y */ set y(y) { this.storage[1] = y; }} : { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; } ->Point2D.prototype : { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; } ->Point2D : { (x: any, y: any): any; prototype: { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; }; } ->prototype : { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; } ->{ __proto__: Vec, get x() { return this.storage[0]; }, /** * @param {number} x */ set x(x) { this.storage[0] = x; }, get y() { return this.storage[1]; }, /** * @param {number} y */ set y(y) { this.storage[1] = y; }} : { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; } +>Point2D.prototype = { __proto__: Vec, get x() { return this.storage[0]; }, /** * @param {number} x */ set x(x) { this.storage[0] = x; }, get y() { return this.storage[1]; }, /** * @param {number} y */ set y(y) { this.storage[1] = y; }} : { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; } +>Point2D.prototype : { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; } +>Point2D : { (x: number, y: number): any; prototype: { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; }; } +>prototype : { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; } +>{ __proto__: Vec, get x() { return this.storage[0]; }, /** * @param {number} x */ set x(x) { this.storage[0] = x; }, get y() { return this.storage[1]; }, /** * @param {number} y */ set y(y) { this.storage[1] = y; }} : { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; } __proto__: Vec, ->__proto__ : { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; } ->Vec : { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; } +>__proto__ : { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; } +>Vec : { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; } get x() { ->x : any +>x : number return this.storage[0]; >this.storage[0] : any @@ -202,21 +202,21 @@ Point2D.prototype = { * @param {number} x */ set x(x) { ->x : any ->x : any +>x : number +>x : number this.storage[0] = x; ->this.storage[0] = x : any +>this.storage[0] = x : number >this.storage[0] : any >this.storage : any >this : any >storage : any >0 : 0 ->x : any +>x : number }, get y() { ->y : any +>y : number return this.storage[1]; >this.storage[1] : any @@ -230,28 +230,28 @@ Point2D.prototype = { * @param {number} y */ set y(y) { ->y : any ->y : any +>y : number +>y : number this.storage[1] = y; ->this.storage[1] = y : any +>this.storage[1] = y : number >this.storage[1] : any >this.storage : any >this : any >storage : any >1 : 1 ->y : any +>y : number } }; === referencer.js === import {Point2D} from "./source"; ->Point2D : { (x: any, y: any): any; prototype: { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; }; } +>Point2D : { (x: number, y: number): any; prototype: { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; }; } export const origin = new Point2D(0, 0); >origin : any >new Point2D(0, 0) : any ->Point2D : { (x: any, y: any): any; prototype: { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; }; } +>Point2D : { (x: number, y: number): any; prototype: { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; }; } >0 : 0 >0 : 0 diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols index 4722a46367..7c366d06b6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols @@ -68,8 +68,12 @@ function g(a, b) { >b : Symbol(b, Decl(index.js, 36, 13)) return a.x && b.y(); +>a.x : Symbol(x, Decl(index.js, 33, 12)) >a : Symbol(a, Decl(index.js, 36, 11)) +>x : Symbol(x, Decl(index.js, 33, 12)) +>b.y : Symbol(y, Decl(index.js, 34, 12)) >b : Symbol(b, Decl(index.js, 36, 13)) +>y : Symbol(y, Decl(index.js, 34, 12)) } export { g }; @@ -85,8 +89,12 @@ function hh(a, b) { >b : Symbol(b, Decl(index.js, 46, 14)) return a.x && b.y(); +>a.x : Symbol(x, Decl(index.js, 43, 12)) >a : Symbol(a, Decl(index.js, 46, 12)) +>x : Symbol(x, Decl(index.js, 43, 12)) +>b.y : Symbol(y, Decl(index.js, 44, 12)) >b : Symbol(b, Decl(index.js, 46, 14)) +>y : Symbol(y, Decl(index.js, 44, 12)) } export { hh as h }; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols.diff index 2035423afc..7b851080df 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.symbols.diff @@ -52,29 +52,3 @@ /** * @param {{x: string}} a -@@= skipped -22, +22 lines =@@ - >b : Symbol(b, Decl(index.js, 36, 13)) - - return a.x && b.y(); -->a.x : Symbol(x, Decl(index.js, 33, 12)) - >a : Symbol(a, Decl(index.js, 36, 11)) -->x : Symbol(x, Decl(index.js, 33, 12)) -->b.y : Symbol(y, Decl(index.js, 34, 12)) - >b : Symbol(b, Decl(index.js, 36, 13)) -->y : Symbol(y, Decl(index.js, 34, 12)) - } - - export { g }; -@@= skipped -21, +17 lines =@@ - >b : Symbol(b, Decl(index.js, 46, 14)) - - return a.x && b.y(); -->a.x : Symbol(x, Decl(index.js, 43, 12)) - >a : Symbol(a, Decl(index.js, 46, 12)) -->x : Symbol(x, Decl(index.js, 43, 12)) -->b.y : Symbol(y, Decl(index.js, 44, 12)) - >b : Symbol(b, Decl(index.js, 46, 14)) -->y : Symbol(y, Decl(index.js, 44, 12)) - } - - export { hh as h }; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.types index b8521d732b..e5dda8b3cf 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.types @@ -30,10 +30,11 @@ c.Cls = class {} * @return {string} */ export function d(a, b) { return /** @type {*} */(null); } ->d : (a: any, b: any) => any ->a : any ->b : any ->(null) : null +>d : (a: number, b: number) => string +>a : number +>b : number +>(null) : any +>null : any /** * @template T,U @@ -42,75 +43,76 @@ export function d(a, b) { return /** @type {*} */(null); } * @return {T & U} */ export function e(a, b) { return /** @type {*} */(null); } ->e : (a: any, b: any) => any ->a : any ->b : any ->(null) : null +>e : (a: T, b: U) => T & U +>a : T +>b : U +>(null) : any +>null : any /** * @template T * @param {T} a */ export function f(a) { ->f : { (a: any): any; self: ???; } ->a : any +>f : { (a: T): T; self: ???; } +>a : T return a; ->a : any +>a : T } f.self = f; ->f.self = f : { (a: any): any; self: ???; } ->f.self : { (a: any): any; self: ???; } ->f : { (a: any): any; self: ???; } ->self : { (a: any): any; self: ???; } ->f : { (a: any): any; self: ???; } +>f.self = f : { (a: T): T; self: ???; } +>f.self : { (a: T): T; self: ???; } +>f : { (a: T): T; self: ???; } +>self : { (a: T): T; self: ???; } +>f : { (a: T): T; self: ???; } /** * @param {{x: string}} a * @param {{y: typeof b}} b */ function g(a, b) { ->g : (a: any, b: any) => any ->a : any ->b : any +>g : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void +>a : { x: string; } +>b : { y: { (): void; cat: string; }; } return a.x && b.y(); ->a.x && b.y() : any ->a.x : any ->a : any ->x : any ->b.y() : any ->b.y : any ->b : any ->y : any +>a.x && b.y() : void +>a.x : string +>a : { x: string; } +>x : string +>b.y() : void +>b.y : { (): void; cat: string; } +>b : { y: { (): void; cat: string; }; } +>y : { (): void; cat: string; } } export { g }; ->g : (a: any, b: any) => any +>g : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void /** * @param {{x: string}} a * @param {{y: typeof b}} b */ function hh(a, b) { ->hh : (a: any, b: any) => any ->a : any ->b : any +>hh : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void +>a : { x: string; } +>b : { y: { (): void; cat: string; }; } return a.x && b.y(); ->a.x && b.y() : any ->a.x : any ->a : any ->x : any ->b.y() : any ->b.y : any ->b : any ->y : any +>a.x && b.y() : void +>a.x : string +>a : { x: string; } +>x : string +>b.y() : void +>b.y : { (): void; cat: string; } +>b : { y: { (): void; cat: string; }; } +>y : { (): void; cat: string; } } export { hh as h }; ->hh : (a: any, b: any) => any ->h : (a: any, b: any) => any +>hh : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void +>h : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void export function i() {} >i : () => void diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt index 11aee39fcc..263140ef38 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.errors.txt @@ -8,7 +8,9 @@ index.js(22,1): error TS2580: Cannot find name 'module'. Do you need to install index.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(31,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(31,25): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(35,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(41,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(45,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(51,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(53,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(54,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -18,7 +20,7 @@ index.js(57,21): error TS2580: Cannot find name 'module'. Do you need to install index.js(58,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== index.js (18 errors) ==== +==== index.js (20 errors) ==== module.exports.a = function a() {} ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -74,6 +76,8 @@ index.js(58,1): error TS2580: Cannot find name 'module'. Do you need to install /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. */ function g(a, b) { return a.x && b.y(); @@ -86,6 +90,8 @@ index.js(58,1): error TS2580: Cannot find name 'module'. Do you need to install /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. */ function hh(a, b) { return a.x && b.y(); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols index 23c01b990e..2d71c847d6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols @@ -58,8 +58,12 @@ function g(a, b) { >b : Symbol(b, Decl(index.js, 36, 13)) return a.x && b.y(); +>a.x : Symbol(x, Decl(index.js, 33, 12)) >a : Symbol(a, Decl(index.js, 36, 11)) +>x : Symbol(x, Decl(index.js, 33, 12)) +>b.y : Symbol(y, Decl(index.js, 34, 12)) >b : Symbol(b, Decl(index.js, 36, 13)) +>y : Symbol(y, Decl(index.js, 34, 12)) } module.exports.g = g; @@ -75,8 +79,12 @@ function hh(a, b) { >b : Symbol(b, Decl(index.js, 46, 14)) return a.x && b.y(); +>a.x : Symbol(x, Decl(index.js, 43, 12)) >a : Symbol(a, Decl(index.js, 46, 12)) +>x : Symbol(x, Decl(index.js, 43, 12)) +>b.y : Symbol(y, Decl(index.js, 44, 12)) >b : Symbol(b, Decl(index.js, 46, 14)) +>y : Symbol(y, Decl(index.js, 44, 12)) } module.exports.h = hh; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols.diff index 15a1c0b4c3..495b153c83 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.symbols.diff @@ -102,16 +102,7 @@ /** * @param {{x: string}} a -@@= skipped -23, +11 lines =@@ - >b : Symbol(b, Decl(index.js, 36, 13)) - - return a.x && b.y(); -->a.x : Symbol(x, Decl(index.js, 33, 12)) - >a : Symbol(a, Decl(index.js, 36, 11)) -->x : Symbol(x, Decl(index.js, 33, 12)) -->b.y : Symbol(y, Decl(index.js, 34, 12)) - >b : Symbol(b, Decl(index.js, 36, 13)) -->y : Symbol(y, Decl(index.js, 34, 12)) +@@= skipped -32, +20 lines =@@ } module.exports.g = g; @@ -123,16 +114,7 @@ >g : Symbol(g, Decl(index.js, 30, 41)) /** -@@= skipped -26, +17 lines =@@ - >b : Symbol(b, Decl(index.js, 46, 14)) - - return a.x && b.y(); -->a.x : Symbol(x, Decl(index.js, 43, 12)) - >a : Symbol(a, Decl(index.js, 46, 12)) -->x : Symbol(x, Decl(index.js, 43, 12)) -->b.y : Symbol(y, Decl(index.js, 44, 12)) - >b : Symbol(b, Decl(index.js, 46, 14)) -->y : Symbol(y, Decl(index.js, 44, 12)) +@@= skipped -26, +21 lines =@@ } module.exports.h = hh; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types index 0a57322ea0..12fca3dd8f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionsCjs.types @@ -69,7 +69,8 @@ module.exports.d = function d(a, b) { return /** @type {*} */(null); } >d : (a: any, b: any) => any >a : any >b : any ->(null) : null +>(null) : any +>null : any /** * @template T,U @@ -88,7 +89,8 @@ module.exports.e = function e(a, b) { return /** @type {*} */(null); } >e : (a: any, b: any) => any >a : any >b : any ->(null) : null +>(null) : any +>null : any /** * @template T @@ -128,58 +130,58 @@ module.exports.f.self = module.exports.f; * @param {{y: typeof module.exports.b}} b */ function g(a, b) { ->g : (a: any, b: any) => any ->a : any ->b : any +>g : (a: { x: string; }, b: { y: any; }) => any +>a : { x: string; } +>b : { y: any; } return a.x && b.y(); >a.x && b.y() : any ->a.x : any ->a : any ->x : any +>a.x : string +>a : { x: string; } +>x : string >b.y() : any >b.y : any ->b : any +>b : { y: any; } >y : any } module.exports.g = g; ->module.exports.g = g : (a: any, b: any) => any +>module.exports.g = g : (a: { x: string; }, b: { y: any; }) => any >module.exports.g : any >module.exports : any >module : any >exports : any >g : any ->g : (a: any, b: any) => any +>g : (a: { x: string; }, b: { y: any; }) => any /** * @param {{x: string}} a * @param {{y: typeof module.exports.b}} b */ function hh(a, b) { ->hh : (a: any, b: any) => any ->a : any ->b : any +>hh : (a: { x: string; }, b: { y: any; }) => any +>a : { x: string; } +>b : { y: any; } return a.x && b.y(); >a.x && b.y() : any ->a.x : any ->a : any ->x : any +>a.x : string +>a : { x: string; } +>x : string >b.y() : any >b.y : any ->b : any +>b : { y: any; } >y : any } module.exports.h = hh; ->module.exports.h = hh : (a: any, b: any) => any +>module.exports.h = hh : (a: { x: string; }, b: { y: any; }) => any >module.exports.h : any >module.exports : any >module : any >exports : any >h : any ->hh : (a: any, b: any) => any +>hh : (a: { x: string; }, b: { y: any; }) => any module.exports.i = function i() {} >module.exports.i = function i() {} : () => void diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsGetterSetter.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsGetterSetter.types index d47ed18c02..0a6a0c7c99 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsGetterSetter.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsGetterSetter.types @@ -19,8 +19,8 @@ export class B { * @param {number} _arg */ set x(_arg) { ->x : any ->_arg : any +>x : number +>_arg : number } } @@ -73,14 +73,14 @@ Object.defineProperty(E.prototype, "x", { >E : typeof E >prototype : E >"x" : "x" ->{ /** * @param {number} _arg */ set(_arg) {}} : { set: (_arg: any) => void; } +>{ /** * @param {number} _arg */ set(_arg) {}} : { set: (_arg: number) => void; } /** * @param {number} _arg */ set(_arg) {} ->set : (_arg: any) => void ->_arg : any +>set : (_arg: number) => void +>_arg : number }); @@ -96,7 +96,7 @@ Object.defineProperty(F.prototype, "x", { >F : typeof F >prototype : F >"x" : "x" ->{ get() { return 12; }, /** * @param {number} _arg */ set(_arg) {}} : { get: () => number; set: (_arg: any) => void; } +>{ get() { return 12; }, /** * @param {number} _arg */ set(_arg) {}} : { get: () => number; set: (_arg: number) => void; } get() { >get : () => number @@ -109,8 +109,8 @@ Object.defineProperty(F.prototype, "x", { * @param {number} _arg */ set(_arg) {} ->set : (_arg: any) => void ->_arg : any +>set : (_arg: number) => void +>_arg : number }); @@ -126,14 +126,14 @@ Object.defineProperty(G.prototype, "x", { >G : typeof G >prototype : G >"x" : "x" ->{ /** * @param {number[]} args */ set(...args) {}} : { set: (...args: [v: any]) => void; } +>{ /** * @param {number[]} args */ set(...args) {}} : { set: (...args: number[]) => void; } /** * @param {number[]} args */ set(...args) {} ->set : (...args: [v: any]) => void ->args : [v: any] +>set : (...args: number[]) => void +>args : number[] }); @@ -169,15 +169,15 @@ Object.defineProperty(I.prototype, "x", { >I : typeof I >prototype : I >"x" : "x" ->{ /** * @param {number} v */ set: (v) => {}} : { set: (v: any) => void; } +>{ /** * @param {number} v */ set: (v) => {}} : { set: (v: number) => void; } /** * @param {number} v */ set: (v) => {} ->set : (v: any) => void ->(v) => {} : (v: any) => void ->v : any +>set : (v: number) => void +>(v) => {} : (v: number) => void +>v : number }); @@ -185,9 +185,9 @@ Object.defineProperty(I.prototype, "x", { * @param {number} v */ const jSetter = (v) => {} ->jSetter : (v: any) => void ->(v) => {} : (v: any) => void ->v : any +>jSetter : (v: number) => void +>(v) => {} : (v: number) => void +>v : number export class J {} >J : J @@ -201,11 +201,11 @@ Object.defineProperty(J.prototype, "x", { >J : typeof J >prototype : J >"x" : "x" ->{ set: jSetter} : { set: (v: any) => void; } +>{ set: jSetter} : { set: (v: number) => void; } set: jSetter ->set : (v: any) => void ->jSetter : (v: any) => void +>set : (v: number) => void +>jSetter : (v: number) => void }); @@ -213,17 +213,17 @@ Object.defineProperty(J.prototype, "x", { * @param {number} v */ const kSetter1 = (v) => {} ->kSetter1 : (v: any) => void ->(v) => {} : (v: any) => void ->v : any +>kSetter1 : (v: number) => void +>(v) => {} : (v: number) => void +>v : number /** * @param {number} v */ const kSetter2 = (v) => {} ->kSetter2 : (v: any) => void ->(v) => {} : (v: any) => void ->v : any +>kSetter2 : (v: number) => void +>(v) => {} : (v: number) => void +>v : number export class K {} >K : K @@ -237,17 +237,17 @@ Object.defineProperty(K.prototype, "x", { >K : typeof K >prototype : K >"x" : "x" ->{ set: Math.random() ? kSetter1 : kSetter2} : { set: (v: any) => void; } +>{ set: Math.random() ? kSetter1 : kSetter2} : { set: (v: number) => void; } set: Math.random() ? kSetter1 : kSetter2 ->set : (v: any) => void ->Math.random() ? kSetter1 : kSetter2 : (v: any) => void +>set : (v: number) => void +>Math.random() ? kSetter1 : kSetter2 : (v: number) => void >Math.random() : number >Math.random : () => number >Math : Math >random : () => number ->kSetter1 : (v: any) => void ->kSetter2 : (v: any) => void +>kSetter1 : (v: number) => void +>kSetter2 : (v: number) => void }); @@ -255,17 +255,17 @@ Object.defineProperty(K.prototype, "x", { * @param {number} v */ const lSetter1 = (v) => {} ->lSetter1 : (v: any) => void ->(v) => {} : (v: any) => void ->v : any +>lSetter1 : (v: number) => void +>(v) => {} : (v: number) => void +>v : number /** * @param {string} v */ const lSetter2 = (v) => {} ->lSetter2 : (v: any) => void ->(v) => {} : (v: any) => void ->v : any +>lSetter2 : (v: string) => void +>(v) => {} : (v: string) => void +>v : string export class L {} >L : L @@ -279,17 +279,17 @@ Object.defineProperty(L.prototype, "x", { >L : typeof L >prototype : L >"x" : "x" ->{ set: Math.random() ? lSetter1 : lSetter2} : { set: (v: any) => void; } +>{ set: Math.random() ? lSetter1 : lSetter2} : { set: (v: number) => void | (v: string) => void; } set: Math.random() ? lSetter1 : lSetter2 ->set : (v: any) => void ->Math.random() ? lSetter1 : lSetter2 : (v: any) => void +>set : (v: number) => void | (v: string) => void +>Math.random() ? lSetter1 : lSetter2 : (v: number) => void | (v: string) => void >Math.random() : number >Math.random : () => number >Math : Math >random : () => number ->lSetter1 : (v: any) => void ->lSetter2 : (v: any) => void +>lSetter1 : (v: number) => void +>lSetter2 : (v: string) => void }); @@ -297,17 +297,17 @@ Object.defineProperty(L.prototype, "x", { * @param {number | boolean} v */ const mSetter1 = (v) => {} ->mSetter1 : (v: any) => void ->(v) => {} : (v: any) => void ->v : any +>mSetter1 : (v: number | boolean) => void +>(v) => {} : (v: number | boolean) => void +>v : number | boolean /** * @param {string | boolean} v */ const mSetter2 = (v) => {} ->mSetter2 : (v: any) => void ->(v) => {} : (v: any) => void ->v : any +>mSetter2 : (v: string | boolean) => void +>(v) => {} : (v: string | boolean) => void +>v : string | boolean export class M {} >M : M @@ -321,17 +321,17 @@ Object.defineProperty(M.prototype, "x", { >M : typeof M >prototype : M >"x" : "x" ->{ set: Math.random() ? mSetter1 : mSetter2} : { set: (v: any) => void; } +>{ set: Math.random() ? mSetter1 : mSetter2} : { set: (v: number | boolean) => void | (v: string | boolean) => void; } set: Math.random() ? mSetter1 : mSetter2 ->set : (v: any) => void ->Math.random() ? mSetter1 : mSetter2 : (v: any) => void +>set : (v: number | boolean) => void | (v: string | boolean) => void +>Math.random() ? mSetter1 : mSetter2 : (v: number | boolean) => void | (v: string | boolean) => void >Math.random() : number >Math.random : () => number >Math : Math >random : () => number ->mSetter1 : (v: any) => void ->mSetter2 : (v: any) => void +>mSetter1 : (v: number | boolean) => void +>mSetter2 : (v: string | boolean) => void }); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt new file mode 100644 index 0000000000..339f44b69d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt @@ -0,0 +1,76 @@ +file.js(4,11): error TS2315: Type 'Object' is not generic. +file.js(10,51): error TS2300: Duplicate identifier 'myTypes'. +file.js(13,13): error TS2300: Duplicate identifier 'myTypes'. +file.js(18,15): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. +file.js(18,39): error TS2300: Duplicate identifier 'myTypes'. +file2.js(6,11): error TS2315: Type 'Object' is not generic. +file2.js(12,23): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. +file2.js(17,12): error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. + + +==== file.js (5 errors) ==== + /** + * @namespace myTypes + * @global + * @type {Object} + ~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + */ + const myTypes = { + // SOME PROPS HERE + }; + + /** @typedef {string|RegExp|Array} myTypes.typeA */ + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'myTypes'. + + /** + * @typedef myTypes.typeB + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'myTypes'. + * @property {myTypes.typeA} prop1 - Prop 1. + * @property {string} prop2 - Prop 2. + */ + + /** @typedef {myTypes.typeB|Function} myTypes.typeC */ + ~~~~~~~ +!!! error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'myTypes'. + + export {myTypes}; +==== file2.js (3 errors) ==== + import {myTypes} from './file.js'; + + /** + * @namespace testFnTypes + * @global + * @type {Object} + ~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + */ + const testFnTypes = { + // SOME PROPS HERE + }; + + /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ + ~~~~~~~ +!!! error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. + + /** + * @function testFn + * @description A test function. + * @param {testFnTypes.input} input - Input. + ~~~~~~~~~~~ +!!! error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. + * @returns {number|null} Result. + */ + function testFn(input) { + if (typeof input === 'number') { + return 2 * input; + } else { + return null; + } + } + + export {testFn, testFnTypes}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols index bf07a2414f..481eba3d4a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols @@ -7,7 +7,7 @@ * @type {Object} */ const myTypes = { ->myTypes : Symbol(myTypes, Decl(file.js, 5, 5)) +>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 19, 17), Decl(file.js, 19, 17), Decl(file.js, 19, 17)) // SOME PROPS HERE }; @@ -32,7 +32,7 @@ const myTypes = { >Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) export {myTypes}; ->myTypes : Symbol(myTypes, Decl(file.js, 19, 8)) +>myTypes : Symbol(myTypes, Decl(file.js, 19, 17), Decl(file.js, 19, 8)) === file2.js === import {myTypes} from './file.js'; @@ -44,12 +44,13 @@ import {myTypes} from './file.js'; * @type {Object} */ const testFnTypes = { ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5)) +>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 25, 1)) // SOME PROPS HERE }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ +>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 25, 1), Decl(file2.js, 27, 15)) >myTypes : Symbol(myTypes) >typeC : Symbol(typeC) @@ -76,5 +77,5 @@ function testFn(input) { export {testFn, testFnTypes}; >testFn : Symbol(testFn, Decl(file2.js, 27, 8)) ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 27, 15)) +>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 25, 1), Decl(file2.js, 27, 15)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff index 592365622d..00436bd325 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff @@ -5,7 +5,7 @@ */ const myTypes = { ->myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 50), Decl(file.js, 12, 12), Decl(file.js, 17, 38)) -+>myTypes : Symbol(myTypes, Decl(file.js, 5, 5)) ++>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 19, 17), Decl(file.js, 19, 17), Decl(file.js, 19, 17)) // SOME PROPS HERE }; @@ -31,7 +31,7 @@ export {myTypes}; ->myTypes : Symbol(myTypes, Decl(file.js, 19, 8), Decl(file.js, 9, 50), Decl(file.js, 12, 12), Decl(file.js, 17, 38)) -+>myTypes : Symbol(myTypes, Decl(file.js, 19, 8)) ++>myTypes : Symbol(myTypes, Decl(file.js, 19, 17), Decl(file.js, 19, 8)) === file2.js === import {myTypes} from './file.js'; @@ -40,21 +40,22 @@ */ const testFnTypes = { ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 11, 37)) -+>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5)) ++>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 25, 1)) // SOME PROPS HERE }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ++>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 25, 1), Decl(file2.js, 27, 15)) +>myTypes : Symbol(myTypes) +>typeC : Symbol(typeC) /** * @function testFn -@@= skipped -30, +32 lines =@@ +@@= skipped -30, +33 lines =@@ export {testFn, testFnTypes}; >testFn : Symbol(testFn, Decl(file2.js, 27, 8)) ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 27, 15), Decl(file2.js, 11, 37)) -+>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 27, 15)) ++>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 25, 1), Decl(file2.js, 27, 15)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types index 1a0e70cabf..b8f870c932 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types @@ -7,28 +7,38 @@ * @type {Object} */ const myTypes = { ->myTypes : {} +>myTypes : any >{ // SOME PROPS HERE} : {} // SOME PROPS HERE }; /** @typedef {string|RegExp|Array} myTypes.typeA */ +>myTypes : any /** * @typedef myTypes.typeB +>myTypes : any + * @property {myTypes.typeA} prop1 - Prop 1. +>prop1 : any +>myTypes : any + * @property {string} prop2 - Prop 2. +>prop2 : any + */ /** @typedef {myTypes.typeB|Function} myTypes.typeC */ +>myTypes : any +>myTypes : any export {myTypes}; ->myTypes : {} +>myTypes : any === file2.js === import {myTypes} from './file.js'; ->myTypes : {} +>myTypes : any /** * @namespace testFnTypes @@ -36,13 +46,15 @@ import {myTypes} from './file.js'; * @type {Object} */ const testFnTypes = { ->testFnTypes : {} +>testFnTypes : any >{ // SOME PROPS HERE} : {} // SOME PROPS HERE }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ +>testFnTypes : any +>myTypes : any /** * @function testFn @@ -51,13 +63,13 @@ const testFnTypes = { * @returns {number|null} Result. */ function testFn(input) { ->testFn : (input: any) => number ->input : any +>testFn : (input: input) => number +>input : input if (typeof input === 'number') { >typeof input === 'number' : boolean >typeof input : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ->input : any +>input : input >'number' : "number" return 2 * input; @@ -71,6 +83,6 @@ function testFn(input) { } export {testFn, testFnTypes}; ->testFn : (input: any) => number ->testFnTypes : {} +>testFn : (input: input) => number +>testFnTypes : any diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt index 927a6ecac4..f3c038d0f7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt @@ -1,8 +1,11 @@ file2.js(1,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +file2.js(6,11): error TS2315: Type 'Object' is not generic. +file2.js(12,23): error TS2503: Cannot find namespace 'myTypes'. +file2.js(17,12): error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== file2.js (2 errors) ==== +==== file2.js (5 errors) ==== const {myTypes} = require('./file.js'); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -11,17 +14,23 @@ file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install * @namespace testFnTypes * @global * @type {Object} + ~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. */ const testFnTypes = { // SOME PROPS HERE }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ + ~~~~~~~ +!!! error TS2503: Cannot find namespace 'myTypes'. /** * @function testFn * @description A test function. * @param {testFnTypes.input} input - Input. + ~~~~~~~~~~~ +!!! error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. * @returns {number|null} Result. */ function testFn(input) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols index c4007470cd..94d4ce8fad 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols @@ -10,12 +10,13 @@ const {myTypes} = require('./file.js'); * @type {Object} */ const testFnTypes = { ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5)) +>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 25, 1)) // SOME PROPS HERE }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ +>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 25, 1)) >myTypes : Symbol(myTypes) >typeC : Symbol(typeC) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff index 39f50edfe5..2e8561f631 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff @@ -14,18 +14,19 @@ */ const testFnTypes = { ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 11, 37)) -+>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5)) ++>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 25, 1)) // SOME PROPS HERE }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ++>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 25, 1)) +>myTypes : Symbol(myTypes) +>typeC : Symbol(typeC) /** * @function testFn -@@= skipped -29, +31 lines =@@ +@@= skipped -29, +32 lines =@@ } module.exports = {testFn, testFnTypes}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types index bbdde03d12..718fde9ae5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types @@ -13,13 +13,15 @@ const {myTypes} = require('./file.js'); * @type {Object} */ const testFnTypes = { ->testFnTypes : {} +>testFnTypes : any >{ // SOME PROPS HERE} : {} // SOME PROPS HERE }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ +>testFnTypes : any +>myTypes : any /** * @function testFn @@ -28,13 +30,13 @@ const testFnTypes = { * @returns {number|null} Result. */ function testFn(input) { ->testFn : (input: any) => number ->input : any +>testFn : (input: input) => number +>input : input if (typeof input === 'number') { >typeof input === 'number' : boolean >typeof input : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ->input : any +>input : input >'number' : "number" return 2 * input; @@ -48,11 +50,11 @@ function testFn(input) { } module.exports = {testFn, testFnTypes}; ->module.exports = {testFn, testFnTypes} : { testFn: (input: any) => number; testFnTypes: {}; } +>module.exports = {testFn, testFnTypes} : { testFn: (input: input) => number; testFnTypes: any; } >module.exports : any >module : any >exports : any ->{testFn, testFnTypes} : { testFn: (input: any) => number; testFnTypes: {}; } ->testFn : (input: any) => number ->testFnTypes : {} +>{testFn, testFnTypes} : { testFn: (input: input) => number; testFnTypes: any; } +>testFn : (input: input) => number +>testFnTypes : any diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt new file mode 100644 index 0000000000..8634dc2259 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.errors.txt @@ -0,0 +1,14 @@ +file.js(2,29): error TS2694: Namespace '"mod1"' has no exported member 'Dotted'. + + +==== file.js (1 errors) ==== + import { dummy } from './mod1' + /** @type {import('./mod1').Dotted.Name} - should work */ + ~~~~~~ +!!! error TS2694: Namespace '"mod1"' has no exported member 'Dotted'. + var dot2 + +==== mod1.js (0 errors) ==== + /** @typedef {number} Dotted.Name */ + export var dummy = 1 + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.types index 29e2531a50..659dbd397c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.types @@ -10,6 +10,8 @@ var dot2 === mod1.js === /** @typedef {number} Dotted.Name */ +>Dotted : any + export var dummy = 1 >dummy : number >1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types index aff1e11ef1..9b7a644242 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types @@ -3,6 +3,9 @@ === folder/mod1.js === /** * @typedef {{x: number}} Item +>Item : any +>x : number + */ /** * @type {Item}; @@ -23,16 +26,16 @@ module.exports = x; === index.js === /** @type {(typeof import("./folder/mod1"))[]} */ const items = [{x: 12}]; ->items : { x: number; }[] +>items : typeof import("folder/mod1")[] >[{x: 12}] : { x: number; }[] >{x: 12} : { x: number; } >x : number >12 : 12 module.exports = items; ->module.exports = items : { x: number; }[] +>module.exports = items : typeof import("folder/mod1")[] >module.exports : any >module : any >exports : any ->items : { x: number; }[] +>items : typeof import("folder/mod1")[] diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt new file mode 100644 index 0000000000..38ff884b7d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt @@ -0,0 +1,60 @@ +index.js(5,12): error TS2304: Cannot find name 'Void'. +index.js(6,12): error TS2304: Cannot find name 'Undefined'. +index.js(7,12): error TS2304: Cannot find name 'Null'. +index.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +index.js(11,12): error TS2552: Cannot find name 'array'. Did you mean 'Array'? +index.js(12,12): error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? +index.js(13,12): error TS2315: Type 'Object' is not generic. +index.js(30,12): error TS2749: 'event' refers to a value, but is being used as a type here. Did you mean 'typeof event'? + + +==== index.js (8 errors) ==== + // these are recognized as TS concepts by the checker + /** @type {String} */const a = ""; + /** @type {Number} */const b = 0; + /** @type {Boolean} */const c = true; + /** @type {Void} */const d = undefined; + ~~~~ +!!! error TS2304: Cannot find name 'Void'. + /** @type {Undefined} */const e = undefined; + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'Undefined'. + /** @type {Null} */const f = null; + ~~~~ +!!! error TS2304: Cannot find name 'Null'. + + /** @type {Function} */const g = () => void 0; + /** @type {function} */const h = () => void 0; + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + /** @type {array} */const i = []; + ~~~~~ +!!! error TS2552: Cannot find name 'array'. Did you mean 'Array'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Array' is declared here. + /** @type {promise} */const j = Promise.resolve(0); + ~~~~~~~ +!!! error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? +!!! related TS2728 lib.es2015.promise.d.ts:--:--: 'Promise' is declared here. + /** @type {Object} */const k = {x: "x"}; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + + + // these are not recognized as anything and should just be lookup failures + // ignore the errors to try to ensure they're emitted as `any` in declaration emit + // @ts-ignore + /** @type {class} */const l = true; + // @ts-ignore + /** @type {bool} */const m = true; + // @ts-ignore + /** @type {int} */const n = true; + // @ts-ignore + /** @type {float} */const o = true; + // @ts-ignore + /** @type {integer} */const p = true; + + // or, in the case of `event` likely erroneously refers to the type of the global Event object + /** @type {event} */const q = undefined; + ~~~~~ +!!! error TS2749: 'event' refers to a value, but is being used as a type here. Did you mean 'typeof event'? \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.types index 2f40433de1..28e870e0c7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.types @@ -3,46 +3,46 @@ === index.js === // these are recognized as TS concepts by the checker /** @type {String} */const a = ""; ->a : "" +>a : String >"" : "" /** @type {Number} */const b = 0; ->b : 0 +>b : Number >0 : 0 /** @type {Boolean} */const c = true; ->c : true +>c : Boolean >true : true /** @type {Void} */const d = undefined; ->d : undefined +>d : Void >undefined : undefined /** @type {Undefined} */const e = undefined; ->e : undefined +>e : Undefined >undefined : undefined /** @type {Null} */const f = null; ->f : null +>f : Null /** @type {Function} */const g = () => void 0; ->g : () => undefined +>g : Function >() => void 0 : () => undefined >void 0 : undefined >0 : 0 /** @type {function} */const h = () => void 0; ->h : () => undefined +>h : function >() => void 0 : () => undefined >void 0 : undefined >0 : 0 /** @type {array} */const i = []; ->i : never[] +>i : array >[] : never[] /** @type {promise} */const j = Promise.resolve(0); ->j : Promise +>j : promise >Promise.resolve(0) : Promise >Promise.resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; } >Promise : PromiseConstructor @@ -50,7 +50,7 @@ >0 : 0 /** @type {Object} */const k = {x: "x"}; ->k : { x: string; } +>k : any >{x: "x"} : { x: string; } >x : string >"x" : "x" @@ -60,31 +60,31 @@ // ignore the errors to try to ensure they're emitted as `any` in declaration emit // @ts-ignore /** @type {class} */const l = true; ->l : true +>l : class >true : true // @ts-ignore /** @type {bool} */const m = true; ->m : true +>m : bool >true : true // @ts-ignore /** @type {int} */const n = true; ->n : true +>n : int >true : true // @ts-ignore /** @type {float} */const o = true; ->o : true +>o : float >true : true // @ts-ignore /** @type {integer} */const p = true; ->p : true +>p : integer >true : true // or, in the case of `event` likely erroneously refers to the type of the global Event object /** @type {event} */const q = undefined; ->q : undefined +>q : event >undefined : undefined diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt new file mode 100644 index 0000000000..d4557d9119 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt @@ -0,0 +1,17 @@ +file.js(2,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +file.js(6,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). + + +==== file.js (2 errors) ==== + /** + * @param {Array} x + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + */ + function x(x) {} + /** + * @param {Promise} x + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + */ + function y(x) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt new file mode 100644 index 0000000000..809ccf10b2 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt @@ -0,0 +1,38 @@ +file.js(2,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). +file.js(12,14): error TS2314: Generic type 'T[]' requires 1 type argument(s). +file.js(12,19): error TS8020: JSDoc types can only be used inside documentation comments. +file.js(12,20): error TS1099: Type argument list cannot be empty. +file.js(18,14): error TS2314: Generic type 'Promise' requires 1 type argument(s). + + +==== file.js (5 errors) ==== + /** + * @param {Array=} y desc + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + */ + function x(y) { } + + // @ts-ignore + /** @param {function (Array)} func Invoked + */ + function y(func) { return; } + + /** + * @return {(Array.<> | null)} list of devices + ~~~~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + ~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. + ~~ +!!! error TS1099: Type argument list cannot be empty. + */ + function z() { return null ;} + + /** + * + * @return {?Promise} A promise + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + */ + function w() { return null; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.types index 7f6d87d961..d93c648b87 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.types @@ -5,7 +5,7 @@ * @param {Array=} y desc */ function x(y) { } ->x : (y: any) => void +>x : (y?: any) => void >y : any // @ts-ignore diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt new file mode 100644 index 0000000000..30a9f935a7 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt @@ -0,0 +1,19 @@ +index.js(9,11): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + +==== index.js (1 errors) ==== + /** + * @module A + */ + class A {} + + + /** + * Target element + * @type {module:A} + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + export let el = null; + + export default A; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.types index 84dd46ae3a..80523f88f9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.types @@ -13,7 +13,7 @@ class A {} * @type {module:A} */ export let el = null; ->el : any +>el : module export default A; >A : A diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.errors.txt new file mode 100644 index 0000000000..6874eb5fa6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.errors.txt @@ -0,0 +1,33 @@ +file.js(7,26): error TS8020: JSDoc types can only be used inside documentation comments. +file.js(20,26): error TS8020: JSDoc types can only be used inside documentation comments. + + +==== file.js (2 errors) ==== + class X { + /** + * Cancels the request, sending a cancellation to the other party + * @param {Object} error __auto_generated__ + * @param {string?} error.reason the error reason to send the cancellation with + * @param {string?} error.code the error code to send the cancellation with + * @returns {Promise.<*>} resolves when the event has been sent. + ~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. + */ + async cancel({reason, code}) {} + } + + class Y { + /** + * Cancels the request, sending a cancellation to the other party + * @param {Object} error __auto_generated__ + * @param {string?} error.reason the error reason to send the cancellation with + * @param {Object} error.suberr + * @param {string?} error.suberr.reason the error reason to send the cancellation with + * @param {string?} error.suberr.code the error code to send the cancellation with + * @returns {Promise.<*>} resolves when the event has been sent. + ~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. + */ + async cancel({reason, suberr}) {} + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.types index 1d4d04d185..5a1dd2d22e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsNestedParams.types @@ -12,7 +12,7 @@ class X { * @returns {Promise.<*>} resolves when the event has been sent. */ async cancel({reason, code}) {} ->cancel : (__0: { code: any; reason: any; }) => Promise +>cancel : (__0: { code: any; reason: any; }) => Promise >reason : any >code : any } @@ -30,7 +30,7 @@ class Y { * @returns {Promise.<*>} resolves when the event has been sent. */ async cancel({reason, suberr}) {} ->cancel : (__0: { reason: any; suberr: any; }) => Promise +>cancel : (__0: { reason: any; suberr: any; }) => Promise >reason : any >suberr : any } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsOptionalTypeLiteralProps1.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsOptionalTypeLiteralProps1.types index 03d234dfe0..4e6a7ad504 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsOptionalTypeLiteralProps1.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsOptionalTypeLiteralProps1.types @@ -12,7 +12,7 @@ * @returns {number} */ function foo({ a, b, c }) { ->foo : (__0: { a: any; b: any; c: any; }) => any +>foo : (__0: { a: any; b: any; c: any; }) => number >a : any >b : any >c : any diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsOptionalTypeLiteralProps2.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsOptionalTypeLiteralProps2.types index 2118e4d8d4..e2b0f903d3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsOptionalTypeLiteralProps2.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsOptionalTypeLiteralProps2.types @@ -12,7 +12,7 @@ * @returns {number} */ function foo({ a, b, c }) { ->foo : (__0: { a: any; b: any; c: any; }) => any +>foo : (__0: { a: any; b: any; c: any; }) => number >a : any >b : any >c : any diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt index f19f51ad05..df03f90c0b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt @@ -1,4 +1,5 @@ base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +file.js(1,22): error TS2306: File 'base.js' is not a module. ==== base.js (1 errors) ==== @@ -16,8 +17,10 @@ base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install t ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== file.js (0 errors) ==== +==== file.js (1 errors) ==== /** @typedef {import('./base')} BaseFactory */ + ~~~~~~~~ +!!! error TS2306: File 'base.js' is not a module. /** * @callback BaseFactoryFactory * @param {import('./base')} factory diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types index 706b7ca980..4adcc56813 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types @@ -33,6 +33,8 @@ module.exports = BaseFactory; === file.js === /** @typedef {import('./base')} BaseFactory */ +>BaseFactory : any + /** * @callback BaseFactoryFactory * @param {import('./base')} factory diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt index ad61ed984b..73a374df92 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt @@ -1,4 +1,5 @@ base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +file.js(1,29): error TS2306: File 'base.js' is not a module. ==== base.js (1 errors) ==== @@ -16,8 +17,10 @@ base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install t ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== file.js (0 errors) ==== +==== file.js (1 errors) ==== /** @typedef {typeof import('./base')} BaseFactory */ + ~~~~~~~~ +!!! error TS2306: File 'base.js' is not a module. /** * diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types index cec99d135f..8ee4d28ead 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types @@ -33,6 +33,7 @@ module.exports = BaseFactory; === file.js === /** @typedef {typeof import('./base')} BaseFactory */ +>BaseFactory : any /** * diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt index 3dc32347aa..0925027326 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt @@ -2,6 +2,7 @@ jsDeclarationsReactComponents1.jsx(2,19): error TS2307: Cannot find module 'reac jsDeclarationsReactComponents1.jsx(3,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. jsDeclarationsReactComponents2.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. jsDeclarationsReactComponents3.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. +jsDeclarationsReactComponents3.jsx(3,73): error TS2503: Cannot find namespace 'JSX'. jsDeclarationsReactComponents4.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. jsDeclarationsReactComponents5.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. jsDeclarationsReactComponents5.jsx(2,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. @@ -55,12 +56,14 @@ jsDeclarationsReactComponents5.jsx(2,23): error TS2307: Cannot find module 'prop export default TabbedShowLayout; -==== jsDeclarationsReactComponents3.jsx (1 errors) ==== +==== jsDeclarationsReactComponents3.jsx (2 errors) ==== import React from "react"; ~~~~~~~ !!! error TS2307: Cannot find module 'react' or its corresponding type declarations. /** * @type {{defaultProps: {tabs: string}} & ((props?: {elem: string}) => JSX.Element)} + ~~~ +!!! error TS2503: Cannot find namespace 'JSX'. */ const TabbedShowLayout = () => { return ( diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols index 7f520e1d80..7c1a3b5659 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols @@ -94,7 +94,9 @@ const TabbedShowLayout = () => { }; TabbedShowLayout.defaultProps = { +>TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) >TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents3.jsx, 4, 5)) +>defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) tabs: "default value" >tabs : Symbol(tabs, Decl(jsDeclarationsReactComponents3.jsx, 12, 33)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff index 98ae603506..fd956083bf 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff @@ -108,14 +108,13 @@ }; TabbedShowLayout.defaultProps = { -->TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) + >TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) ->TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents3.jsx, 4, 5), Decl(jsDeclarationsReactComponents3.jsx, 10, 2)) -->defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) +>TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents3.jsx, 4, 5)) + >defaultProps : Symbol(defaultProps, Decl(jsDeclarationsReactComponents3.jsx, 2, 11)) tabs: "default value" - >tabs : Symbol(tabs, Decl(jsDeclarationsReactComponents3.jsx, 12, 33)) -@@= skipped -26, +21 lines =@@ +@@= skipped -26, +23 lines =@@ }; export default TabbedShowLayout; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.types index b9938baaa0..477210261a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.types @@ -62,7 +62,7 @@ import React from "react"; * @type {React.SFC} */ const TabbedShowLayout = () => { ->TabbedShowLayout : { (): any; defaultProps: { tabs: string; }; } +>TabbedShowLayout : SFC >() => { return (

);} : { (): any; defaultProps: { tabs: string; }; } return ( @@ -83,9 +83,9 @@ const TabbedShowLayout = () => { TabbedShowLayout.defaultProps = { >TabbedShowLayout.defaultProps = { tabs: "default value"} : { tabs: string; } ->TabbedShowLayout.defaultProps : { tabs: string; } ->TabbedShowLayout : { (): any; defaultProps: { tabs: string; }; } ->defaultProps : { tabs: string; } +>TabbedShowLayout.defaultProps : any +>TabbedShowLayout : SFC +>defaultProps : any >{ tabs: "default value"} : { tabs: string; } tabs: "default value" @@ -95,7 +95,7 @@ TabbedShowLayout.defaultProps = { }; export default TabbedShowLayout; ->TabbedShowLayout : { (): any; defaultProps: { tabs: string; }; } +>TabbedShowLayout : SFC === jsDeclarationsReactComponents3.jsx === import React from "react"; @@ -105,7 +105,7 @@ import React from "react"; * @type {{defaultProps: {tabs: string}} & ((props?: {elem: string}) => JSX.Element)} */ const TabbedShowLayout = () => { ->TabbedShowLayout : { (): any; defaultProps: { tabs: string; }; } +>TabbedShowLayout : { defaultProps: { tabs: string; }; } & (props?: { elem: string; } | undefined) => Element >() => { return (
ok
);} : { (): any; defaultProps: { tabs: string; }; } return ( @@ -127,7 +127,7 @@ const TabbedShowLayout = () => { TabbedShowLayout.defaultProps = { >TabbedShowLayout.defaultProps = { tabs: "default value"} : { tabs: string; } >TabbedShowLayout.defaultProps : { tabs: string; } ->TabbedShowLayout : { (): any; defaultProps: { tabs: string; }; } +>TabbedShowLayout : { defaultProps: { tabs: string; }; } & (props?: { elem: string; } | undefined) => Element >defaultProps : { tabs: string; } >{ tabs: "default value"} : { tabs: string; } @@ -138,7 +138,7 @@ TabbedShowLayout.defaultProps = { }; export default TabbedShowLayout; ->TabbedShowLayout : { (): any; defaultProps: { tabs: string; }; } +>TabbedShowLayout : { defaultProps: { tabs: string; }; } & (props?: { elem: string; } | undefined) => Element === jsDeclarationsReactComponents4.jsx === import React from "react"; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt new file mode 100644 index 0000000000..42bdb51664 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt @@ -0,0 +1,41 @@ +index.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +index.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +index.js(22,12): error TS2315: Type 'Object' is not generic. +index.js(22,18): error TS8020: JSDoc types can only be used inside documentation comments. + + +==== index.js (4 errors) ==== + /** @type {?} */ + export const a = null; + + /** @type {*} */ + export const b = null; + + /** @type {string?} */ + export const c = null; + + /** @type {string=} */ + export const d = null; + + /** @type {string!} */ + export const e = null; + + /** @type {function(string, number): object} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + export const f = null; + + /** @type {function(new: object, string, number)} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + export const g = null; + + /** @type {Object.} */ + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + ~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. + export const h = null; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.types index ebe72681c5..9ec66ea875 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.types @@ -11,23 +11,23 @@ export const b = null; /** @type {string?} */ export const c = null; ->c : any +>c : string /** @type {string=} */ export const d = null; ->d : any +>d : string /** @type {string!} */ export const e = null; ->e : any +>e : string /** @type {function(string, number): object} */ export const f = null; ->f : any +>f : function /** @type {function(new: object, string, number)} */ export const g = null; ->g : any +>g : function /** @type {Object.} */ export const h = null; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt new file mode 100644 index 0000000000..e605616373 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt @@ -0,0 +1,111 @@ +index.js(45,17): error TS1051: A 'set' accessor cannot have an optional parameter. +index.js(83,17): error TS1051: A 'set' accessor cannot have an optional parameter. + + +==== index.js (2 errors) ==== + class С1 { + /** @type {string=} */ + p1 = undefined; + + /** @type {string | undefined} */ + p2 = undefined; + + /** @type {?string} */ + p3 = null; + + /** @type {string | null} */ + p4 = null; + } + + class С2 { + /** @type {string=} */ + get p1() { + return undefined; + } + + /** @type {string | undefined} */ + get p2() { + return undefined; + } + + /** @type {?string} */ + get p3() { + return null; + } + + /** @type {string | null} */ + get p4() { + return null; + } + } + + + class С3 { + /** @type {string=} */ + get p1() { + return undefined; + } + + /** @param {string=} value */ + set p1(value) { + +!!! error TS1051: A 'set' accessor cannot have an optional parameter. + this.p1 = value; + } + + /** @type {string | undefined} */ + get p2() { + return undefined; + } + + /** @param {string | undefined} value */ + set p2(value) { + this.p2 = value; + } + + /** @type {?string} */ + get p3() { + return null; + } + + /** @param {?string} value */ + set p3(value) { + this.p3 = value; + } + + /** @type {string | null} */ + get p4() { + return null; + } + + /** @param {string | null} value */ + set p4(value) { + this.p4 = value; + } + } + + + class С4 { + /** @param {string=} value */ + set p1(value) { + +!!! error TS1051: A 'set' accessor cannot have an optional parameter. + this.p1 = value; + } + + /** @param {string | undefined} value */ + set p2(value) { + this.p2 = value; + } + + /** @param {?string} value */ + set p3(value) { + this.p3 = value; + } + + /** @param {string | null} value */ + set p4(value) { + this.p4 = value; + } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.types index 1e04c16e23..ba682b2010 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingTypeAnnotations.types @@ -6,21 +6,21 @@ class С1 { /** @type {string=} */ p1 = undefined; ->p1 : undefined +>p1 : string | undefined >undefined : undefined /** @type {string | undefined} */ p2 = undefined; ->p2 : undefined +>p2 : string | undefined >undefined : undefined /** @type {?string} */ p3 = null; ->p3 : null +>p3 : string | null /** @type {string | null} */ p4 = null; ->p4 : null +>p4 : string | null } class С2 { @@ -63,7 +63,7 @@ class С3 { /** @type {string=} */ get p1() { ->p1 : undefined +>p1 : string | undefined return undefined; >undefined : undefined @@ -71,20 +71,20 @@ class С3 { /** @param {string=} value */ set p1(value) { ->p1 : undefined ->value : undefined +>p1 : string | undefined +>value : string | undefined this.p1 = value; ->this.p1 = value : undefined ->this.p1 : undefined +>this.p1 = value : string | undefined +>this.p1 : string | undefined >this : this ->p1 : undefined ->value : undefined +>p1 : string | undefined +>value : string | undefined } /** @type {string | undefined} */ get p2() { ->p2 : undefined +>p2 : string | undefined return undefined; >undefined : undefined @@ -92,55 +92,55 @@ class С3 { /** @param {string | undefined} value */ set p2(value) { ->p2 : undefined ->value : undefined +>p2 : string | undefined +>value : string | undefined this.p2 = value; ->this.p2 = value : undefined ->this.p2 : undefined +>this.p2 = value : string | undefined +>this.p2 : string | undefined >this : this ->p2 : undefined ->value : undefined +>p2 : string | undefined +>value : string | undefined } /** @type {?string} */ get p3() { ->p3 : null +>p3 : string | null return null; } /** @param {?string} value */ set p3(value) { ->p3 : null ->value : null +>p3 : string | null +>value : string | null this.p3 = value; ->this.p3 = value : null ->this.p3 : null +>this.p3 = value : string | null +>this.p3 : string | null >this : this ->p3 : null ->value : null +>p3 : string | null +>value : string | null } /** @type {string | null} */ get p4() { ->p4 : null +>p4 : string | null return null; } /** @param {string | null} value */ set p4(value) { ->p4 : null ->value : null +>p4 : string | null +>value : string | null this.p4 = value; ->this.p4 = value : null ->this.p4 : null +>this.p4 = value : string | null +>this.p4 : string | null >this : this ->p4 : null ->value : null +>p4 : string | null +>value : string | null } } @@ -150,54 +150,54 @@ class С4 { /** @param {string=} value */ set p1(value) { ->p1 : any ->value : any +>p1 : string | undefined +>value : string | undefined this.p1 = value; ->this.p1 = value : any ->this.p1 : any +>this.p1 = value : string | undefined +>this.p1 : string | undefined >this : this ->p1 : any ->value : any +>p1 : string | undefined +>value : string | undefined } /** @param {string | undefined} value */ set p2(value) { ->p2 : any ->value : any +>p2 : string | undefined +>value : string | undefined this.p2 = value; ->this.p2 = value : any ->this.p2 : any +>this.p2 = value : string | undefined +>this.p2 : string | undefined >this : this ->p2 : any ->value : any +>p2 : string | undefined +>value : string | undefined } /** @param {?string} value */ set p3(value) { ->p3 : any ->value : any +>p3 : string | null +>value : string | null this.p3 = value; ->this.p3 = value : any ->this.p3 : any +>this.p3 = value : string | null +>this.p3 : string | null >this : this ->p3 : any ->value : any +>p3 : string | null +>value : string | null } /** @param {string | null} value */ set p4(value) { ->p4 : any ->value : any +>p4 : string | null +>value : string | null this.p4 = value; ->this.p4 = value : any ->this.p4 : any +>this.p4 = value : string | null +>this.p4 : string | null >this : this ->p4 : any ->value : any +>p4 : string | null +>value : string | null } } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsSubclassWithExplicitNoArgumentConstructor.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsSubclassWithExplicitNoArgumentConstructor.types index 9c3811023f..d3328c449a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsSubclassWithExplicitNoArgumentConstructor.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsSubclassWithExplicitNoArgumentConstructor.types @@ -9,8 +9,8 @@ export class Super { * @param {string} secondArg */ constructor(firstArg, secondArg) { } ->firstArg : any ->secondArg : any +>firstArg : string +>secondArg : string } export class Sub extends Super { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols index d2fa51821d..8c505d2e21 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols @@ -32,6 +32,7 @@ export {}; // flag file as module === mixed.js === /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType +>SomeType : Symbol(SomeType, Decl(mixed.js, 9, 1)) >x : Symbol(x, Decl(mixed.js, 1, 14)) >LocalThing : Symbol(LocalThing, Decl(mixed.js, 16, 2)) >ExportedThing : Symbol(ExportedThing, Decl(mixed.js, 9, 1)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff index a9f2e25ef6..dab2d9a560 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff @@ -4,6 +4,7 @@ === mixed.js === /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType ++>SomeType : Symbol(SomeType, Decl(mixed.js, 9, 1)) +>x : Symbol(x, Decl(mixed.js, 1, 14)) +>LocalThing : Symbol(LocalThing, Decl(mixed.js, 16, 2)) +>ExportedThing : Symbol(ExportedThing, Decl(mixed.js, 9, 1)) @@ -11,7 +12,7 @@ */ /** * @param {number} x -@@= skipped -17, +21 lines =@@ +@@= skipped -17, +22 lines =@@ >ExportedThing : Symbol(ExportedThing, Decl(mixed.js, 9, 1)) z = "ok" diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.types index d3486e1930..87a7692655 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.types @@ -32,21 +32,24 @@ export {}; // flag file as module === mixed.js === /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType +>SomeType : SomeType +>x : string + */ /** * @param {number} x * @returns {SomeType} */ function doTheThing(x) { ->doTheThing : (x: any) => { x: string; } ->x : any +>doTheThing : (x: number) => SomeType +>x : number return {x: ""+x}; >{x: ""+x} : { x: string; } >x : string >""+x : string >"" : "" ->x : any +>x : number } class ExportedThing { >ExportedThing : ExportedThing @@ -56,14 +59,14 @@ class ExportedThing { >"ok" : "ok" } module.exports = { ->module.exports = { doTheThing, ExportedThing,} : { doTheThing: (x: any) => { x: string; }; ExportedThing: typeof ExportedThing; } +>module.exports = { doTheThing, ExportedThing,} : { doTheThing: (x: number) => SomeType; ExportedThing: typeof ExportedThing; } >module.exports : any >module : any >exports : any ->{ doTheThing, ExportedThing,} : { doTheThing: (x: any) => { x: string; }; ExportedThing: typeof ExportedThing; } +>{ doTheThing, ExportedThing,} : { doTheThing: (x: number) => SomeType; ExportedThing: typeof ExportedThing; } doTheThing, ->doTheThing : (x: any) => { x: string; } +>doTheThing : (x: number) => SomeType ExportedThing, >ExportedThing : typeof ExportedThing diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types index 3c99b2bc50..99b586db29 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types @@ -14,13 +14,13 @@ export = items; === index.js === /** @type {typeof import("/some-mod")} */ const items = []; ->items : any[] +>items : Item[] >[] : undefined[] module.exports = items; ->module.exports = items : any[] +>module.exports = items : Item[] >module.exports : any >module : any >exports : any ->items : any[] +>items : Item[] diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt index c077de5eb6..0add975d32 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt @@ -1,4 +1,5 @@ conn.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +usage.js(2,14): error TS1340: Module './conn' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./conn')'? usage.js(10,14): error TS2339: Property 'connItem' does not exist on type 'Wrap'. usage.js(12,14): error TS2339: Property 'another' does not exist on type 'Wrap'. usage.js(16,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -19,9 +20,11 @@ usage.js(16,1): error TS2580: Cannot find name 'module'. Do you need to install ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== usage.js (3 errors) ==== +==== usage.js (4 errors) ==== /** * @typedef {import("./conn")} Conn + ~~~~~~~~~~~~~~~~ +!!! error TS1340: Module './conn' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./conn')'? */ class Wrap { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types index d384caf838..abf877d245 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types @@ -3,6 +3,8 @@ === conn.js === /** * @typedef {string | number} Whatever +>Whatever : any + */ class Conn { @@ -27,6 +29,8 @@ module.exports = Conn; === usage.js === /** * @typedef {import("./conn")} Conn +>Conn : any + */ class Wrap { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt index a550fd267d..48fc6a2824 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt @@ -1,13 +1,16 @@ LazySet.js(13,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(1,17): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(3,12): error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? -==== index.js (1 errors) ==== +==== index.js (2 errors) ==== const LazySet = require("./LazySet"); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @type {LazySet} */ + ~~~~~~~ +!!! error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? const stringSet = undefined; stringSet.addAll(stringSet); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types index 0c30209717..80a77ea98a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types @@ -9,21 +9,23 @@ const LazySet = require("./LazySet"); /** @type {LazySet} */ const stringSet = undefined; ->stringSet : any +>stringSet : LazySet >undefined : undefined stringSet.addAll(stringSet); >stringSet.addAll(stringSet) : any >stringSet.addAll : any ->stringSet : any +>stringSet : LazySet >addAll : any ->stringSet : any +>stringSet : LazySet === LazySet.js === // Comment out this JSDoc, and note that the errors index.js go away. /** * @typedef {Object} SomeObject +>SomeObject : any + */ class LazySet { >LazySet : LazySet @@ -32,8 +34,8 @@ class LazySet { * @param {LazySet} iterable */ addAll(iterable) {} ->addAll : (iterable: any) => void ->iterable : any +>addAll : (iterable: LazySet) => void +>iterable : LazySet [Symbol.iterator]() {} >[Symbol.iterator] : () => void @@ -43,9 +45,9 @@ class LazySet { } module.exports = LazySet; ->module.exports = LazySet : any +>module.exports = LazySet : typeof LazySet >module.exports : any >module : any >exports : any ->LazySet : any +>LazySet : typeof LazySet diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.types index cf3ed17f8f..b2a9a3d802 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.types @@ -5,6 +5,8 @@ * @typedef {{ * [id: string]: [Function, Function]; * }} ResolveRejectMap +>ResolveRejectMap : any + */ let id = 0 @@ -16,23 +18,23 @@ let id = 0 * @returns {Promise} */ const send = handlers => new Promise((resolve, reject) => { ->send : (handlers: any) => Promise ->handlers => new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : (handlers: any) => Promise ->handlers : any ->new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : Promise +>send : (handlers: { [id: string]: [Function, Function]; }) => Promise +>handlers => new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : (handlers: { [id: string]: [Function, Function]; }) => Promise +>handlers : { [id: string]: [Function, Function]; } +>new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : Promise >Promise : PromiseConstructor ->(resolve, reject) => { handlers[++id] = [resolve, reject]} : (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void ->resolve : (value: unknown) => void +>(resolve, reject) => { handlers[++id] = [resolve, reject]} : (resolve: (value: any) => void, reject: (reason?: any) => void) => void +>resolve : (value: any) => void >reject : (reason?: any) => void handlers[++id] = [resolve, reject] ->handlers[++id] = [resolve, reject] : (value: unknown) => void[] ->handlers[++id] : any ->handlers : any +>handlers[++id] = [resolve, reject] : [(value: any) => void, (reason?: any) => void] +>handlers[++id] : [Function, Function] +>handlers : { [id: string]: [Function, Function]; } >++id : number >id : number ->[resolve, reject] : (value: unknown) => void[] ->resolve : (value: unknown) => void +>[resolve, reject] : [(value: any) => void, (reason?: any) => void] +>resolve : (value: any) => void >reject : (reason?: any) => void }) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt index 871a4cb6f7..26e7eee074 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt @@ -1,13 +1,16 @@ index.js(1,39): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(3,22): error TS2307: Cannot find module './module.js' or its corresponding type declarations. index.js(21,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== index.js (2 errors) ==== +==== index.js (3 errors) ==== const {taskGroups, taskNameToGroup} = require('./module.js'); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @typedef {import('./module.js').TaskGroup} TaskGroup */ + ~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './module.js' or its corresponding type declarations. /** * @typedef TaskNode diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols index 124611b867..86fdbbc8ac 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols @@ -10,20 +10,20 @@ const {taskGroups, taskNameToGroup} = require('./module.js'); /** * @typedef TaskNode * @prop {TaskNode[]} children ->TaskNode : Symbol(TaskNode) +>TaskNode : Symbol(TaskNode, Decl(index.js, 18, 1)) * @prop {TaskNode|undefined} parent ->TaskNode : Symbol(TaskNode) +>TaskNode : Symbol(TaskNode, Decl(index.js, 18, 1)) * @prop {TaskGroup} group ->TaskGroup : Symbol(TaskGroup) +>TaskGroup : Symbol(TaskGroup, Decl(index.js, 18, 1)) */ /** @typedef {{timers: Map}} PriorTaskData */ >timers : Symbol(timers, Decl(index.js, 11, 15)) >Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ->TaskNode : Symbol(TaskNode) +>TaskNode : Symbol(TaskNode, Decl(index.js, 18, 1)) class MainThreadTasks { >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff index 2a6bb3e4ad..8bc14f9bc0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff @@ -12,20 +12,20 @@ /** * @typedef TaskNode * @prop {TaskNode[]} children -+>TaskNode : Symbol(TaskNode) ++>TaskNode : Symbol(TaskNode, Decl(index.js, 18, 1)) + * @prop {TaskNode|undefined} parent -+>TaskNode : Symbol(TaskNode) ++>TaskNode : Symbol(TaskNode, Decl(index.js, 18, 1)) + * @prop {TaskGroup} group -+>TaskGroup : Symbol(TaskGroup) ++>TaskGroup : Symbol(TaskGroup, Decl(index.js, 18, 1)) + */ /** @typedef {{timers: Map}} PriorTaskData */ +>timers : Symbol(timers, Decl(index.js, 11, 15)) +>Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -+>TaskNode : Symbol(TaskNode) ++>TaskNode : Symbol(TaskNode, Decl(index.js, 18, 1)) + class MainThreadTasks { >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types index f6ff1ad6bf..61457d18ff 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types @@ -9,15 +9,27 @@ const {taskGroups, taskNameToGroup} = require('./module.js'); >'./module.js' : "./module.js" /** @typedef {import('./module.js').TaskGroup} TaskGroup */ +>TaskGroup : any /** * @typedef TaskNode +>TaskNode : any + * @prop {TaskNode[]} children +>children : any + * @prop {TaskNode|undefined} parent +>parent : any + * @prop {TaskGroup} group +>group : any + */ /** @typedef {{timers: Map}} PriorTaskData */ +>PriorTaskData : any +>timers : Map + class MainThreadTasks { >MainThreadTasks : MainThreadTasks @@ -27,7 +39,7 @@ class MainThreadTasks { */ constructor(x, y){} >x : any ->y : any +>y : TaskNode } module.exports = MainThreadTasks; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt new file mode 100644 index 0000000000..4903c8be4b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt @@ -0,0 +1,23 @@ +b.js(2,28): error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. +b.js(3,26): error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. + + +==== a.js (0 errors) ==== + export const kSymbol = Symbol("my-symbol"); + + /** + * @typedef {{[kSymbol]: true}} WithSymbol + */ +==== b.js (2 errors) ==== + /** + * @returns {import('./a').WithSymbol} + ~~~~~~~~~~ +!!! error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. + * @param {import('./a').WithSymbol} value + ~~~~~~~~~~ +!!! error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. + */ + export function b(value) { + return value; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocBindingInUnreachableCode.types b/testdata/baselines/reference/submodule/conformance/jsdocBindingInUnreachableCode.types index 737e775ad2..5591a1a997 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocBindingInUnreachableCode.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocBindingInUnreachableCode.types @@ -8,9 +8,9 @@ if (false) { * @param {string} s */ const x = function (s) { ->x : (s: any) => void ->function (s) { } : (s: any) => void ->s : any +>x : (s: string) => void +>function (s) { } : (s: string) => void +>s : string }; } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols index 60c6893c1b..701095964e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols @@ -3,10 +3,14 @@ === foo.js === /** * @typedef {any} Any +>Any : Symbol(Any, Decl(foo.js, 49, 1)) + */ /** * @typedef {unknown} Unknown +>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) + */ function fn() { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff index 78b7464469..33cd135a03 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff @@ -1,6 +1,21 @@ --- old.jsdocCatchClauseWithTypeAnnotation.symbols +++ new.jsdocCatchClauseWithTypeAnnotation.symbols -@@= skipped -40, +40 lines =@@ +@@= skipped -2, +2 lines =@@ + === foo.js === + /** + * @typedef {any} Any ++>Any : Symbol(Any, Decl(foo.js, 49, 1)) ++ + */ + + /** + * @typedef {unknown} Unknown ++>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) ++ + */ + + function fn() { +@@= skipped -38, +42 lines =@@ try { } catch (/** @type {unknown} */ err) { console.log(err); } // should be OK >err : Symbol(err, Decl(foo.js, 17, 19)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.types b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.types index 70f5280760..cd5dc2a483 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.types @@ -3,10 +3,14 @@ === foo.js === /** * @typedef {any} Any +>Any : any + */ /** * @typedef {unknown} Unknown +>Unknown : unknown + */ function fn() { @@ -107,7 +111,7 @@ function fn() { /** @type {string} */ let err; ->err : any +>err : string } try { } catch (err) { @@ -115,7 +119,7 @@ function fn() { /** @type {boolean} */ var err; ->err : any +>err : boolean } try { } catch ({ x }) { } // should be OK diff --git a/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt new file mode 100644 index 0000000000..0ecef16650 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.errors.txt @@ -0,0 +1,20 @@ +jsdocConstructorFunctionTypeReference.js(8,12): error TS2749: 'Validator' refers to a value, but is being used as a type here. Did you mean 'typeof Validator'? + + +==== jsdocConstructorFunctionTypeReference.js (1 errors) ==== + var Validator = function VFunc() { + this.flags = "gim" + }; + + Validator.prototype.num = 12 + + /** + * @param {Validator} state + ~~~~~~~~~ +!!! error TS2749: 'Validator' refers to a value, but is being used as a type here. Did you mean 'typeof Validator'? + */ + var validateRegExpFlags = function(state) { + return state.flags + }; + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.types b/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.types index 08173d3720..71e17e4733 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocConstructorFunctionTypeReference.types @@ -28,13 +28,13 @@ Validator.prototype.num = 12 * @param {Validator} state */ var validateRegExpFlags = function(state) { ->validateRegExpFlags : (state: any) => any ->function(state) { return state.flags} : (state: any) => any ->state : any +>validateRegExpFlags : (state: Validator) => any +>function(state) { return state.flags} : (state: Validator) => any +>state : Validator return state.flags >state.flags : any ->state : any +>state : Validator >flags : any }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt index daecd7a134..47d91d1ee9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt @@ -1,17 +1,24 @@ +functions.js(3,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? functions.js(5,14): error TS7006: Parameter 'c' implicitly has an 'any' type. functions.js(9,23): error TS7006: Parameter 'n' implicitly has an 'any' type. +functions.js(13,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? functions.js(15,14): error TS7006: Parameter 'c' implicitly has an 'any' type. functions.js(22,14): error TS2339: Property 'length' does not exist on type 'C'. +functions.js(30,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? functions.js(31,19): error TS7006: Parameter 'ab' implicitly has an 'any' type. functions.js(31,23): error TS7006: Parameter 'onetwo' implicitly has an 'any' type. +functions.js(49,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type. functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. -==== functions.js (8 errors) ==== +==== functions.js (12 errors) ==== /** * @param {function(this: string, number): number} c is just passing on through * @return {function(this: string, number): number} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function id1(c) { ~ @@ -26,6 +33,9 @@ functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[ /** * @param {function(new: { length: number }, number): number} c is just passing on through * @return {function(new: { length: number }, number): number} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function id2(c) { ~ @@ -47,6 +57,9 @@ functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[ z.length; /** @type {function ("a" | "b", 1 | 2): 3 | 4} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. var f = function (ab, onetwo) { return ab === "a" ? 3 : 4; } ~~ !!! error TS7006: Parameter 'ab' implicitly has an 'any' type. @@ -70,6 +83,8 @@ functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[ /** * @param {function(new: D, number)} dref * @return {D} + ~ +!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? */ var construct = function(dref) { return new dref(33); } ~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.types b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.types index ef73f9235a..c58ccc8fdc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.types @@ -6,7 +6,7 @@ * @return {function(this: string, number): number} */ function id1(c) { ->id1 : (c: any) => any +>id1 : (c: any) => function >c : any return c @@ -14,9 +14,9 @@ function id1(c) { } var x = id1(function (n) { return this.length + n }); ->x : any ->id1(function (n) { return this.length + n }) : any ->id1 : (c: any) => any +>x : function +>id1(function (n) { return this.length + n }) : function +>id1 : (c: any) => function >function (n) { return this.length + n } : (n: any) => any >n : any >this.length + n : any @@ -30,7 +30,7 @@ var x = id1(function (n) { return this.length + n }); * @return {function(new: { length: number }, number): number} */ function id2(c) { ->id2 : (c: any) => any +>id2 : (c: any) => function >c : any return c @@ -42,27 +42,27 @@ class C { /** @param {number} n */ constructor(n) { ->n : any +>n : number this.length = n; ->this.length = n : any +>this.length = n : number >this.length : any >this : this >length : any ->n : any +>n : number } } var y = id2(C); ->y : any ->id2(C) : any ->id2 : (c: any) => any +>y : function +>id2(C) : function +>id2 : (c: any) => function >C : typeof C var z = new y(12); >z : any >new y(12) : any ->y : any +>y : function >12 : 12 z.length; @@ -72,7 +72,7 @@ z.length; /** @type {function ("a" | "b", 1 | 2): 3 | 4} */ var f = function (ab, onetwo) { return ab === "a" ? 3 : 4; } ->f : (ab: any, onetwo: any) => 3 | 4 +>f : function >function (ab, onetwo) { return ab === "a" ? 3 : 4; } : (ab: any, onetwo: any) => 3 | 4 >ab : any >onetwo : any @@ -89,27 +89,27 @@ var f = function (ab, onetwo) { return ab === "a" ? 3 : 4; } * @param {number} n */ function D(n) { ->D : (n: any) => void ->n : any +>D : (n: number) => void +>n : number this.length = n; ->this.length = n : any +>this.length = n : number >this.length : any >this : any >length : any ->n : any +>n : number } var y2 = id2(D); ->y2 : any ->id2(D) : any ->id2 : (c: any) => any ->D : (n: any) => void +>y2 : function +>id2(D) : function +>id2 : (c: any) => function +>D : (n: number) => void var z2 = new y2(33); >z2 : any >new y2(33) : any ->y2 : any +>y2 : function >33 : 33 z2.length; @@ -123,22 +123,22 @@ z2.length; * @return {D} */ var construct = function(dref) { return new dref(33); } ->construct : (dref: any) => any ->function(dref) { return new dref(33); } : (dref: any) => any +>construct : (dref: any) => D +>function(dref) { return new dref(33); } : (dref: any) => D >dref : any >new dref(33) : any >dref : any >33 : 33 var z3 = construct(D); ->z3 : any ->construct(D) : any ->construct : (dref: any) => any ->D : (n: any) => void +>z3 : D +>construct(D) : D +>construct : (dref: any) => D +>D : (n: number) => void z3.length; >z3.length : any ->z3 : any +>z3 : D >length : any @@ -147,25 +147,25 @@ z3.length; * @param {number} n */ var E = function(n) { ->E : (n: any) => void ->function(n) { this.not_length_on_purpose = n;} : (n: any) => void ->n : any +>E : (n: number) => void +>function(n) { this.not_length_on_purpose = n;} : (n: number) => void +>n : number this.not_length_on_purpose = n; ->this.not_length_on_purpose = n : any +>this.not_length_on_purpose = n : number >this.not_length_on_purpose : any >this : any >not_length_on_purpose : any ->n : any +>n : number }; var y3 = id2(E); ->y3 : any ->id2(E) : any ->id2 : (c: any) => any ->E : (n: any) => void +>y3 : function +>id2(E) : function +>id2 : (c: any) => function +>E : (n: number) => void // Repro from #39229 diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.types b/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.types index b203944689..e0d94ab856 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.types @@ -6,7 +6,7 @@ class A { /** @return {number} */ method() { throw new Error(); } ->method : () => void +>method : () => number >new Error() : Error >Error : ErrorConstructor } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt new file mode 100644 index 0000000000..b203c22a1c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt @@ -0,0 +1,33 @@ +use.js(2,22): error TS2307: Cannot find module './mod1' or its corresponding type declarations. +use.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + + +==== use.js (2 errors) ==== + /// + /** @typedef {import("./mod1")} C + ~~~~~~~~ +!!! error TS2307: Cannot find module './mod1' or its corresponding type declarations. + * @type {C} */ + var c; + c.chunk; + + const D = require("./mod1"); + /** @type {D} */ + ~ +!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + var d; + d.chunk; + +==== types.d.ts (0 errors) ==== + declare function require(name: string): any; + declare var exports: any; + declare var module: { exports: any }; +==== mod1.js (0 errors) ==== + /// + class Chunk { + constructor() { + this.chunk = 1; + } + } + module.exports = Chunk; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.types b/testdata/baselines/reference/submodule/conformance/jsdocImportType.types index ecc408657b..5caeeb2fcd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.types @@ -3,6 +3,8 @@ === use.js === /// /** @typedef {import("./mod1")} C +>C : any + * @type {C} */ var c; >c : any @@ -20,11 +22,11 @@ const D = require("./mod1"); /** @type {D} */ var d; ->d : any +>d : D d.chunk; >d.chunk : any ->d : any +>d : D >chunk : any === types.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt new file mode 100644 index 0000000000..c05368aaf8 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt @@ -0,0 +1,32 @@ +use.js(2,22): error TS2307: Cannot find module './mod1' or its corresponding type declarations. +use.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + + +==== use.js (2 errors) ==== + /// + /** @typedef {import("./mod1")} C + ~~~~~~~~ +!!! error TS2307: Cannot find module './mod1' or its corresponding type declarations. + * @type {C} */ + var c; + c.chunk; + + const D = require("./mod1"); + /** @type {D} */ + ~ +!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + var d; + d.chunk; + +==== types.d.ts (0 errors) ==== + declare function require(name: string): any; + declare var exports: any; + declare var module: { exports: any }; +==== mod1.js (0 errors) ==== + /// + module.exports = class Chunk { + constructor() { + this.chunk = 1; + } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types index 50ce547859..f253db4008 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types @@ -3,6 +3,8 @@ === use.js === /// /** @typedef {import("./mod1")} C +>C : any + * @type {C} */ var c; >c : any @@ -20,11 +22,11 @@ const D = require("./mod1"); /** @type {D} */ var d; ->d : any +>d : D d.chunk; >d.chunk : any ->d : any +>d : D >chunk : any === types.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt index 679391ceef..5555cf2cf6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt @@ -1,4 +1,5 @@ mod1.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +test.js(1,22): error TS2306: File 'mod1.js' is not a module. ==== mod1.js (1 errors) ==== @@ -9,8 +10,10 @@ mod1.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install ty ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== test.js (0 errors) ==== +==== test.js (1 errors) ==== /** @typedef {import('./mod1').C} X */ + ~~~~~~~~ +!!! error TS2306: File 'mod1.js' is not a module. /** @param {X} c */ function demo(c) { c.s diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols index ad46e0cc6f..db400879f2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols @@ -12,6 +12,8 @@ module.exports.C = C === test.js === /** @typedef {import('./mod1').C} X */ +>X : Symbol(X, Decl(test.js, 4, 1)) + /** @param {X} c */ function demo(c) { >demo : Symbol(demo, Decl(test.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols.diff index 729ff3ce9d..7f9a315b72 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols.diff @@ -16,7 +16,12 @@ >C : Symbol(C, Decl(mod1.js, 0, 0)) === test.js === -@@= skipped -18, +13 lines =@@ + /** @typedef {import('./mod1').C} X */ ++>X : Symbol(X, Decl(test.js, 4, 1)) ++ + /** @param {X} c */ + function demo(c) { + >demo : Symbol(demo, Decl(test.js, 0, 0)) >c : Symbol(c, Decl(test.js, 2, 14)) c.s diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.types b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.types index 708c0cd094..fbfd1623f1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.types @@ -18,6 +18,8 @@ module.exports.C = C === test.js === /** @typedef {import('./mod1').C} X */ +>X : any + /** @param {X} c */ function demo(c) { >demo : (c: any) => void diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt new file mode 100644 index 0000000000..7cfc65e1df --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt @@ -0,0 +1,17 @@ +test.js(1,13): error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? + + +==== ex.d.ts (0 errors) ==== + declare var config: { + fix: boolean + } + export = config; + +==== test.js (1 errors) ==== + /** @param {import('./ex')} a */ + ~~~~~~~~~~~~~~ +!!! error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? + function demo(a) { + a.fix + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt new file mode 100644 index 0000000000..b5f2e2a2bf --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToESModule.errors.txt @@ -0,0 +1,14 @@ +test.js(1,13): error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? + + +==== ex.d.ts (0 errors) ==== + export var config: {} + +==== test.js (1 errors) ==== + /** @param {import('./ex')} a */ + ~~~~~~~~~~~~~~ +!!! error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? + function demo(a) { + a.config + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt new file mode 100644 index 0000000000..84a4804709 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt @@ -0,0 +1,12 @@ +a.js(1,26): error TS2694: Namespace '"b"' has no exported member 'FOO'. + + +==== b.js (0 errors) ==== + export const FOO = "foo"; + +==== a.js (1 errors) ==== + /** @type {import('./b').FOO} */ + ~~~ +!!! error TS2694: Namespace '"b"' has no exported member 'FOO'. + let x; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt new file mode 100644 index 0000000000..0572ee15d8 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocIndexSignature.errors.txt @@ -0,0 +1,39 @@ +indices.js(1,12): error TS2315: Type 'Object' is not generic. +indices.js(1,18): error TS8020: JSDoc types can only be used inside documentation comments. +indices.js(3,12): error TS2315: Type 'Object' is not generic. +indices.js(3,18): error TS8020: JSDoc types can only be used inside documentation comments. +indices.js(5,12): error TS2315: Type 'Object' is not generic. +indices.js(5,18): error TS8020: JSDoc types can only be used inside documentation comments. +indices.js(7,13): error TS2315: Type 'Object' is not generic. +indices.js(7,19): error TS8020: JSDoc types can only be used inside documentation comments. + + +==== indices.js (8 errors) ==== + /** @type {Object.} */ + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + ~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. + var o1; + /** @type {Object.} */ + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + ~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. + var o2; + /** @type {Object.} */ + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + ~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. + var o3; + /** @param {Object.} o */ + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + ~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. + function f(o) { + o.foo = 1; // error + o.bar = false; // ok + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocLiteral.types b/testdata/baselines/reference/submodule/conformance/jsdocLiteral.types index ad8279a6fb..9420cd1887 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocLiteral.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocLiteral.types @@ -9,24 +9,24 @@ * @param {12 | true | 'str'} p5 */ function f(p1, p2, p3, p4, p5) { ->f : (p1: any, p2: any, p3: any, p4: any, p5: any) => string ->p1 : any ->p2 : any ->p3 : any ->p4 : any ->p5 : any +>f : (p1: "literal", p2: "literal", p3: "literal" | "other", p4: number | "literal", p5: "str" | 12 | true) => string +>p1 : "literal" +>p2 : "literal" +>p3 : "literal" | "other" +>p4 : number | "literal" +>p5 : "str" | 12 | true return p1 + p2 + p3 + p4 + p5 + '.'; >p1 + p2 + p3 + p4 + p5 + '.' : string ->p1 + p2 + p3 + p4 + p5 : any ->p1 + p2 + p3 + p4 : any ->p1 + p2 + p3 : any ->p1 + p2 : any ->p1 : any ->p2 : any ->p3 : any ->p4 : any ->p5 : any +>p1 + p2 + p3 + p4 + p5 : string +>p1 + p2 + p3 + p4 : string +>p1 + p2 + p3 : string +>p1 + p2 : string +>p1 : "literal" +>p2 : "literal" +>p3 : "literal" | "other" +>p4 : number | "literal" +>p5 : "str" | 12 | true >'.' : "." } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocNeverUndefinedNull.types b/testdata/baselines/reference/submodule/conformance/jsdocNeverUndefinedNull.types index 226c7093b9..2a8baa91ff 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocNeverUndefinedNull.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocNeverUndefinedNull.types @@ -8,9 +8,9 @@ * @returns {void} nothing */ function f(p1, p2, p3) { ->f : (p1: any, p2: any, p3: any) => void ->p1 : any ->p2 : any ->p3 : any +>f : (p1: never, p2: undefined, p3: null) => void +>p1 : never +>p2 : undefined +>p3 : null } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt index 9246cf7e70..c0a05d7652 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt @@ -1,8 +1,11 @@ +jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. -==== jsdocOuterTypeParameters1.js (1 errors) ==== +==== jsdocOuterTypeParameters1.js (2 errors) ==== /** @return {T} */ + ~ +!!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template {T} */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.types b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.types index 1e0de37aed..3909401472 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.types @@ -3,15 +3,15 @@ === jsdocOuterTypeParameters1.js === /** @return {T} */ const dedupingMixin = function(mixin) {}; ->dedupingMixin : (mixin: any) => void ->function(mixin) {} : (mixin: any) => void +>dedupingMixin : (mixin: any) => T +>function(mixin) {} : (mixin: any) => T >mixin : any /** @template {T} */ const PropertyAccessors = dedupingMixin(() => { ->PropertyAccessors : void ->dedupingMixin(() => { class Bar { static bar() { this.prototype.foo(); } }}) : void ->dedupingMixin : (mixin: any) => void +>PropertyAccessors : T +>dedupingMixin(() => { class Bar { static bar() { this.prototype.foo(); } }}) : T +>dedupingMixin : (mixin: any) => T >() => { class Bar { static bar() { this.prototype.foo(); } }} : () => void class Bar { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt index f48b72dc8a..f78e45da6b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.errors.txt @@ -1,8 +1,11 @@ +jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. -==== jsdocOuterTypeParameters1.js (1 errors) ==== +==== jsdocOuterTypeParameters1.js (2 errors) ==== /** @return {T} */ + ~ +!!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template T */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.types b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.types index ceb322ad3f..8089797bf0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters2.types @@ -3,15 +3,15 @@ === jsdocOuterTypeParameters1.js === /** @return {T} */ const dedupingMixin = function(mixin) {}; ->dedupingMixin : (mixin: any) => void ->function(mixin) {} : (mixin: any) => void +>dedupingMixin : (mixin: any) => T +>function(mixin) {} : (mixin: any) => T >mixin : any /** @template T */ const PropertyAccessors = dedupingMixin(() => { ->PropertyAccessors : void ->dedupingMixin(() => { class Bar { static bar() { this.prototype.foo(); } }}) : void ->dedupingMixin : (mixin: any) => void +>PropertyAccessors : T +>dedupingMixin(() => { class Bar { static bar() { this.prototype.foo(); } }}) : T +>dedupingMixin : (mixin: any) => T >() => { class Bar { static bar() { this.prototype.foo(); } }} : () => void class Bar { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOverrideTag1.types b/testdata/baselines/reference/submodule/conformance/jsdocOverrideTag1.types index 83f0c93f72..fb37e4caac 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOverrideTag1.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocOverrideTag1.types @@ -10,13 +10,13 @@ class A { * @returns {boolean} */ foo (a) { ->foo : (a: any) => a is string ->a : any +>foo : (a: string | number) => boolean +>a : string | number return typeof a === 'string' >typeof a === 'string' : boolean >typeof a : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ->a : any +>a : string | number >'string' : "string" } bar () { @@ -36,15 +36,15 @@ class B extends A { * @returns {boolean} */ foo (a) { ->foo : (a: any) => a is string ->a : any +>foo : (a: string | number) => boolean +>a : string | number return super.foo(a) >super.foo(a) : boolean ->super.foo : (a: any) => a is string +>super.foo : (a: string | number) => boolean >super : A ->foo : (a: any) => a is string ->a : any +>foo : (a: string | number) => boolean +>a : string | number } bar () { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParamTag2.types b/testdata/baselines/reference/submodule/conformance/jsdocParamTag2.types index 3e8043a4b1..54335d1106 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParamTag2.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocParamTag2.types @@ -7,10 +7,10 @@ * @param {string} x */ function good1({a, b}, x) {} ->good1 : (__0: { a: any; b: any; }, x: any) => void +>good1 : (__0: { a: any; b: any; }, x: string) => void >a : any >b : any ->x : any +>x : string /** * @param {{a: string, b: string}} obj @@ -29,11 +29,11 @@ function good2({a, b}, {c, d}) {} * @param {string} y */ function good3(x, {a, b}, y) {} ->good3 : (x: any, __1: { a: any; b: any; }, y: any) => void ->x : any +>good3 : (x: number, __1: { a: any; b: any; }, y: string) => void +>x : number >a : any >b : any ->y : any +>y : string /** * @param {{a: string, b: string}} obj @@ -51,10 +51,10 @@ function good4({a, b}) {} * @param {string} x */ function good5({a, b}, x) {} ->good5 : (__0: { a: any; b: any; }, x: any) => void +>good5 : (__0: { a: any; b: any; }, x: string) => void >a : any >b : any ->x : any +>x : string /** * @param {Object} obj @@ -79,11 +79,11 @@ function good6({a, b}, {c, d}) {} * @param {string} y */ function good7(x, {a, b}, y) {} ->good7 : (x: any, __1: { a: any; b: any; }, y: any) => void ->x : any +>good7 : (x: number, __1: { a: any; b: any; }, y: string) => void +>x : number >a : any >b : any ->y : any +>y : string /** * @param {Object} obj @@ -118,8 +118,8 @@ function good9({ a }) { * @param {string} x */ function bad1(x, {a, b}) {} ->bad1 : (x: any, __1: { a: any; b: any; }) => void ->x : any +>bad1 : (x: string, __1: { a: any; b: any; }) => void +>x : string >a : any >b : any diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParamTagTypeLiteral.types b/testdata/baselines/reference/submodule/conformance/jsdocParamTagTypeLiteral.types index 24ff356ae2..470a8300aa 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParamTagTypeLiteral.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocParamTagTypeLiteral.types @@ -6,15 +6,15 @@ * @param {string} unrelated - not actually related because it's not notSpecial.unrelated */ function normal(notSpecial) { ->normal : (notSpecial: any) => void ->notSpecial : any +>normal : (notSpecial: Object) => void +>notSpecial : Object notSpecial; // should just be 'Object' ->notSpecial : any +>notSpecial : Object } normal(12); >normal(12) : void ->normal : (notSpecial: any) => void +>normal : (notSpecial: Object) => void >12 : 12 /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.errors.txt new file mode 100644 index 0000000000..4a853ebcdf --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.errors.txt @@ -0,0 +1,20 @@ +a.js(5,18): error TS1016: A required parameter cannot follow an optional parameter. + + +==== a.js (1 errors) ==== + /** + * @param {string=} `args` + * @param `bwarg` {?number?} + */ + function f(args, bwarg) { + ~~~~~ +!!! error TS1016: A required parameter cannot follow an optional parameter. + } + +==== ts.ts (0 errors) ==== + /** + * @param `arg` - this is fine + */ + function g(arg: string) { + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.types b/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.types index d5e4bea0c0..f714bf0844 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseBackquotedParamName.types @@ -6,9 +6,9 @@ * @param `bwarg` {?number?} */ function f(args, bwarg) { ->f : (args: any, bwarg: any) => void ->args : any ->bwarg : any +>f : (args: string | undefined, bwarg: number | null) => void +>args : string | undefined +>bwarg : number | null } === ts.ts === diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt index ff761ca257..4d4beab51f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt @@ -1,7 +1,8 @@ a.js(3,12): error TS7006: Parameter 'callback' implicitly has an 'any' type. +a.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -==== a.js (1 errors) ==== +==== a.js (2 errors) ==== // from bcryptjs /** @param {function(...[*])} callback */ function g(callback) { @@ -12,6 +13,9 @@ a.js(3,12): error TS7006: Parameter 'callback' implicitly has an 'any' type. /** * @type {!function(...number):string} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. * @inner */ var stringFromCharCode = String.fromCharCode; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.types b/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.types index 39f2689475..f310e7ed1e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.types @@ -23,7 +23,7 @@ function g(callback) { * @inner */ var stringFromCharCode = String.fromCharCode; ->stringFromCharCode : (...codes: number[]) => string +>stringFromCharCode : function >String.fromCharCode : (...codes: number[]) => string >String : StringConstructor >fromCharCode : (...codes: number[]) => string diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt index 5fc557919c..ff420a46d1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt @@ -1,9 +1,13 @@ +paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? paren.js(2,10): error TS7006: Parameter 's' implicitly has an 'any' type. paren.js(2,13): error TS7006: Parameter 'id' implicitly has an 'any' type. -==== paren.js (2 errors) ==== +==== paren.js (3 errors) ==== /** @type {function((string), function((string)): string): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. var x = (s, id) => id(s) ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.types b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.types index 3582d5fcb2..83cf505482 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.types @@ -3,7 +3,7 @@ === paren.js === /** @type {function((string), function((string)): string): string} */ var x = (s, id) => id(s) ->x : (s: any, id: any) => any +>x : function >(s, id) => id(s) : (s: any, id: any) => any >s : any >id : any diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseMatchingBackticks.types b/testdata/baselines/reference/submodule/conformance/jsdocParseMatchingBackticks.types index 3bbdcd9b06..b7835c0c6d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseMatchingBackticks.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseMatchingBackticks.types @@ -13,25 +13,25 @@ * @param {string} gamma */ export function f(x, y, z, alpha, beta, gamma) { ->f : (x: any, y: any, z: any, alpha: any, beta: any, gamma: any) => any ->x : any ->y : any ->z : any ->alpha : any ->beta : any ->gamma : any +>f : (x: string, y: string, z: string, alpha: string, beta: string, gamma: string) => string +>x : string +>y : string +>z : string +>alpha : string +>beta : string +>gamma : string return x + y + z + alpha + beta + gamma ->x + y + z + alpha + beta + gamma : any ->x + y + z + alpha + beta : any ->x + y + z + alpha : any ->x + y + z : any ->x + y : any ->x : any ->y : any ->z : any ->alpha : any ->beta : any ->gamma : any +>x + y + z + alpha + beta + gamma : string +>x + y + z + alpha + beta : string +>x + y + z + alpha : string +>x + y + z : string +>x + y : string +>x : string +>y : string +>z : string +>alpha : string +>beta : string +>gamma : string } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt index 8b239e96fe..89b948713c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt @@ -1,8 +1,12 @@ +paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? paren.js(2,9): error TS7006: Parameter 's' implicitly has an 'any' type. -==== paren.js (1 errors) ==== +==== paren.js (2 errors) ==== /** @type {function((string)): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. var x = s => s.toString() ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.types b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.types index fe3b681113..c3576d3ded 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.types @@ -3,7 +3,7 @@ === paren.js === /** @type {function((string)): string} */ var x = s => s.toString() ->x : (s: any) => any +>x : function >s => s.toString() : (s: any) => any >s : any >s.toString() : any diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt index 41b724802d..0774af10ea 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt @@ -1,10 +1,16 @@ +a.js(3,12): error TS2370: A rest parameter must be of an array type. +a.js(3,19): error TS1047: A rest parameter cannot be optional. a.js(12,14): error TS7006: Parameter 'f' implicitly has an 'any' type. -==== a.js (1 errors) ==== +==== a.js (3 errors) ==== /** @param {...*=} args @return {*=} */ function f(...args) { + ~~~~~~~ +!!! error TS2370: A rest parameter must be of an array type. + +!!! error TS1047: A rest parameter cannot be optional. return null } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.types b/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.types index 0e7aa5b915..b48d0f1ee8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.types @@ -4,8 +4,8 @@ /** @param {...*=} args @return {*=} */ function f(...args) { ->f : (...args: any[]) => null ->args : any[] +>f : (...args: any[] | undefined) => any +>args : any[] | undefined return null } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt index cad84a8210..e683fb2f2d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt @@ -1,20 +1,22 @@ -a.js(7,1): error TS2554: Expected 1 arguments, but got 0. +a.js(4,5): error TS2322: Type 'null' is not assignable to type 'number | undefined'. +a.js(8,3): error TS2345: Argument of type 'null' is not assignable to parameter of type 'number | undefined'. a.js(13,12): error TS7006: Parameter 'a' implicitly has an 'any' type. a.js(18,1): error TS2554: Expected 1 arguments, but got 0. -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== /** @param {number=} a */ function f(a) { a = 1 a = null // should not be allowed + ~ +!!! error TS2322: Type 'null' is not assignable to type 'number | undefined'. a = undefined } f() - ~ -!!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 a.js:2:12: An argument for 'a' was not provided. f(null) // should not be allowed + ~~~~ +!!! error TS2345: Argument of type 'null' is not assignable to parameter of type 'number | undefined'. f(undefined) f(1) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.types b/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.types index a3e62a9313..4c487015fd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocPostfixEqualsAddsOptionality.types @@ -3,39 +3,39 @@ === a.js === /** @param {number=} a */ function f(a) { ->f : (a: any) => void ->a : any +>f : (a?: number | undefined) => void +>a : number | undefined a = 1 >a = 1 : 1 ->a : any +>a : number | undefined >1 : 1 a = null // should not be allowed >a = null : null ->a : any +>a : number | undefined a = undefined >a = undefined : undefined ->a : any +>a : number | undefined >undefined : undefined } f() >f() : void ->f : (a: any) => void +>f : (a?: number | undefined) => void f(null) // should not be allowed >f(null) : void ->f : (a: any) => void +>f : (a?: number | undefined) => void f(undefined) >f(undefined) : void ->f : (a: any) => void +>f : (a?: number | undefined) => void >undefined : undefined f(1) >f(1) : void ->f : (a: any) => void +>f : (a?: number | undefined) => void >1 : 1 /** @param {???!?number?=} a */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.types b/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.types index 584275c4b6..17030fe29f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.types @@ -19,21 +19,21 @@ * @param {[number, number?]} m - [number, (number | undefined)?] */ function f(x, y, z, a, b, c, e, f, g, h, i, j, k, l, m) { ->f : (x: any, y: any, z: any, a: any, b: any, c: any, e: any, f: any, g: any, h: any, i: any, j: any, k: any, l: any, m: any) => void +>f : (x: any, y: number[], z: any, a: any, b: number[] | null, c: any, e: (number | null)[], f: any, g: any, h: any, i: number[][], j: any, k: any, l: true, m: [number, (number | undefined)?]) => void >x : any ->y : any +>y : number[] >z : any >a : any ->b : any +>b : number[] | null >c : any ->e : any +>e : (number | null)[] >f : any >g : any >h : any ->i : any +>i : number[][] >j : any >k : any ->l : any ->m : any +>l : true +>m : [number, (number | undefined)?] } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt new file mode 100644 index 0000000000..d6c7a99ac5 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.errors.txt @@ -0,0 +1,11 @@ +jsdocPrivateName1.js(3,5): error TS2322: Type 'number' is not assignable to type 'boolean'. + + +==== jsdocPrivateName1.js (1 errors) ==== + class A { + /** @type {boolean} some number value */ + #foo = 3 // Error because not assignable to boolean + ~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'boolean'. + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.types b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.types index 4c83a9466f..a361284063 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName1.types @@ -6,7 +6,7 @@ class A { /** @type {boolean} some number value */ #foo = 3 // Error because not assignable to boolean ->#foo : number +>#foo : boolean >3 : 3 } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt index fa5f1759a3..1648125f5e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.errors.txt @@ -1,12 +1,16 @@ +returns.js(5,5): error TS2322: Type 'number' is not assignable to type 'string'. +returns.js(12,5): error TS2322: Type 'number' is not assignable to type 'string'. returns.js(19,12): error TS2872: This kind of expression is always truthy. -==== returns.js (1 errors) ==== +==== returns.js (3 errors) ==== /** * @returns {string} This comment is not currently exposed */ function f() { return 5; + ~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. } /** @@ -14,6 +18,8 @@ returns.js(19,12): error TS2872: This kind of expression is always truthy. */ function f1() { return 5; + ~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. } /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.types b/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.types index 250bad9456..e6c327cbb4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocReturnTag1.types @@ -5,7 +5,7 @@ * @returns {string} This comment is not currently exposed */ function f() { ->f : () => number +>f : () => string return 5; >5 : 5 @@ -15,7 +15,7 @@ function f() { * @returns {string=} This comment is not currently exposed */ function f1() { ->f1 : () => number +>f1 : () => string return 5; >5 : 5 @@ -25,7 +25,7 @@ function f1() { * @returns {string|number} This comment is not currently exposed */ function f2() { ->f2 : () => "hello" | 5 +>f2 : () => string | number return 5 || "hello"; >5 || "hello" : "hello" | 5 diff --git a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt deleted file mode 100644 index 3bd3c736a4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.errors.txt +++ /dev/null @@ -1,51 +0,0 @@ -jsdocSignatureOnReturnedFunction.js(25,13): error TS7006: Parameter 'a' implicitly has an 'any' type. -jsdocSignatureOnReturnedFunction.js(25,16): error TS7006: Parameter 'b' implicitly has an 'any' type. -jsdocSignatureOnReturnedFunction.js(32,22): error TS7006: Parameter 'a' implicitly has an 'any' type. -jsdocSignatureOnReturnedFunction.js(32,25): error TS7006: Parameter 'b' implicitly has an 'any' type. - - -==== jsdocSignatureOnReturnedFunction.js (4 errors) ==== - function f1() { - /** - * @param {number} a - * @param {number} b - * @returns {number} - */ - return (a, b) => { - return a + b; - } - } - - function f2() { - /** - * @param {number} a - * @param {number} b - * @returns {number} - */ - return function (a, b){ - return a + b; - } - } - - function f3() { - /** @type {(a: number, b: number) => number} */ - return (a, b) => { - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'b' implicitly has an 'any' type. - return a + b; - } - } - - function f4() { - /** @type {(a: number, b: number) => number} */ - return function (a, b){ - ~ -!!! error TS7006: Parameter 'a' implicitly has an 'any' type. - ~ -!!! error TS7006: Parameter 'b' implicitly has an 'any' type. - return a + b; - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.types b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.types index 7499e38dde..d496efe380 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.types @@ -2,7 +2,7 @@ === jsdocSignatureOnReturnedFunction.js === function f1() { ->f1 : () => (a: any, b: any) => any +>f1 : () => (a: number, b: number) => number /** * @param {number} a @@ -10,19 +10,19 @@ function f1() { * @returns {number} */ return (a, b) => { ->(a, b) => { return a + b; } : (a: any, b: any) => any ->a : any ->b : any +>(a, b) => { return a + b; } : (a: number, b: number) => number +>a : number +>b : number return a + b; ->a + b : any ->a : any ->b : any +>a + b : number +>a : number +>b : number } } function f2() { ->f2 : () => (a: any, b: any) => any +>f2 : () => (a: number, b: number) => number /** * @param {number} a @@ -30,46 +30,48 @@ function f2() { * @returns {number} */ return function (a, b){ ->function (a, b){ return a + b; } : (a: any, b: any) => any ->a : any ->b : any +>function (a, b){ return a + b; } : (a: number, b: number) => number +>a : number +>b : number return a + b; ->a + b : any ->a : any ->b : any +>a + b : number +>a : number +>b : number } } function f3() { ->f3 : () => (a: any, b: any) => any +>f3 : () => (a: number, b: number) => number /** @type {(a: number, b: number) => number} */ return (a, b) => { ->(a, b) => { return a + b; } : (a: any, b: any) => any ->a : any ->b : any +>(a, b) => { return a + b; } : (a: number, b: number) => number +>(a, b) => { return a + b; } : (a: number, b: number) => number +>a : number +>b : number return a + b; ->a + b : any ->a : any ->b : any +>a + b : number +>a : number +>b : number } } function f4() { ->f4 : () => (a: any, b: any) => any +>f4 : () => (a: number, b: number) => number /** @type {(a: number, b: number) => number} */ return function (a, b){ ->function (a, b){ return a + b; } : (a: any, b: any) => any ->a : any ->b : any +>function (a, b){ return a + b; } : (a: number, b: number) => number +>function (a, b){ return a + b; } : (a: number, b: number) => number +>a : number +>b : number return a + b; ->a + b : any ->a : any ->b : any +>a + b : number +>a : number +>b : number } } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt index ec71f9db75..82d9a6ba3a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.errors.txt @@ -1,6 +1,6 @@ -templateTagOnClasses.js(10,14): error TS2339: Property 'a' does not exist on type 'Foo'. -templateTagOnClasses.js(25,3): error TS2339: Property 'a' does not exist on type 'Foo'. -templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type 'Foo'. +templateTagOnClasses.js(10,14): error TS2339: Property 'a' does not exist on type 'Foo'. +templateTagOnClasses.js(25,3): error TS2339: Property 'a' does not exist on type 'Foo'. +templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type 'Foo'. ==== templateTagOnClasses.js (3 errors) ==== @@ -15,7 +15,7 @@ templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type constructor (x) { this.a = x ~ -!!! error TS2339: Property 'a' does not exist on type 'Foo'. +!!! error TS2339: Property 'a' does not exist on type 'Foo'. } /** * @@ -32,7 +32,7 @@ templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type var g = new Foo(false) f.a = g.a ~ -!!! error TS2339: Property 'a' does not exist on type 'Foo'. +!!! error TS2339: Property 'a' does not exist on type 'Foo'. ~ -!!! error TS2339: Property 'a' does not exist on type 'Foo'. +!!! error TS2339: Property 'a' does not exist on type 'Foo'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols index bad5d6e2f2..a38a774188 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols @@ -5,8 +5,8 @@ * @template T * @typedef {(t: T) => T} Id >t : Symbol(t, Decl(templateTagOnClasses.js, 2, 14)) ->T : Symbol(T) ->T : Symbol(T) +>T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) +>T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) */ /** @template T */ @@ -15,8 +15,8 @@ class Foo { /** @typedef {(t: T) => T} Id2 */ >t : Symbol(t, Decl(templateTagOnClasses.js, 6, 19)) ->T : Symbol(T) ->T : Symbol(T) +>T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) +>T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) /** @param {T} x */ constructor (x) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff index 108cc9a934..0208bb60f8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff @@ -5,8 +5,8 @@ * @template T * @typedef {(t: T) => T} Id +>t : Symbol(t, Decl(templateTagOnClasses.js, 2, 14)) -+>T : Symbol(T) -+>T : Symbol(T) ++>T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) ++>T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) + */ /** @template T */ @@ -15,8 +15,8 @@ /** @typedef {(t: T) => T} Id2 */ +>t : Symbol(t, Decl(templateTagOnClasses.js, 6, 19)) -+>T : Symbol(T) -+>T : Symbol(T) ++>T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) ++>T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) + /** @param {T} x */ constructor (x) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.types index 4b11f84bab..0861a80600 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.types @@ -4,22 +4,28 @@ /** * @template T * @typedef {(t: T) => T} Id +>Id : any +>t : T + */ /** @template T */ class Foo { ->Foo : Foo +>Foo : Foo /** @typedef {(t: T) => T} Id2 */ +>Id2 : any +>t : T + /** @param {T} x */ constructor (x) { ->x : any +>x : T this.a = x ->this.a = x : any +>this.a = x : T >this.a : any >this : this >a : any ->x : any +>x : T } /** * @@ -29,37 +35,37 @@ class Foo { * @return {T} */ foo(x, y, alpha) { ->foo : (x: any, y: any, alpha: any) => any ->x : any ->y : any ->alpha : any +>foo : (x: T, y: (t: T) => T, alpha: (t: T) => T) => T +>x : T +>y : (t: T) => T +>alpha : (t: T) => T return alpha(y(x)) ->alpha(y(x)) : any ->alpha : any ->y(x) : any ->y : any ->x : any +>alpha(y(x)) : T +>alpha : (t: T) => T +>y(x) : T +>y : (t: T) => T +>x : T } } var f = new Foo(1) ->f : Foo ->new Foo(1) : Foo +>f : Foo +>new Foo(1) : Foo >Foo : typeof Foo >1 : 1 var g = new Foo(false) ->g : Foo ->new Foo(false) : Foo +>g : Foo +>new Foo(false) : Foo >Foo : typeof Foo >false : false f.a = g.a >f.a = g.a : any >f.a : any ->f : Foo +>f : Foo >a : any >g.a : any ->g : Foo +>g : Foo >a : any diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols index 46eca8fe8f..7966eb39c4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols @@ -4,9 +4,10 @@ /** * @template U * @typedef {(u: U) => U} Id +>Id : Symbol(Id, Decl(templateTagOnConstructorFunctions.js, 12, 1)) >u : Symbol(u, Decl(templateTagOnConstructorFunctions.js, 2, 14)) ->U : Symbol(U) ->U : Symbol(U) +>U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 12, 1)) +>U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 12, 1)) */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff index c828738a3a..95f7db6caa 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff @@ -4,14 +4,15 @@ /** * @template U * @typedef {(u: U) => U} Id ++>Id : Symbol(Id, Decl(templateTagOnConstructorFunctions.js, 12, 1)) +>u : Symbol(u, Decl(templateTagOnConstructorFunctions.js, 2, 14)) -+>U : Symbol(U) -+>U : Symbol(U) ++>U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 12, 1)) ++>U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 12, 1)) + */ /** * @param {T} t -@@= skipped -11, +15 lines =@@ +@@= skipped -11, +16 lines =@@ /** @type {T} */ this.u diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types index 785fa91765..2ade37b48f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types @@ -4,14 +4,17 @@ /** * @template U * @typedef {(u: U) => U} Id +>Id : Id +>u : U + */ /** * @param {T} t * @template T */ function Zet(t) { ->Zet : (t: any) => void ->t : any +>Zet : (t: T) => void +>t : T /** @type {T} */ this.u @@ -20,11 +23,11 @@ function Zet(t) { >u : any this.t = t ->this.t = t : any +>this.t = t : T >this.t : any >this : any >t : any ->t : any +>t : T } /** * @param {T} v @@ -34,7 +37,7 @@ Zet.prototype.add = function(v, id) { >Zet.prototype.add = function(v, id) { this.u = v || this.t return id(this.u)} : (v: any, id: any) => any >Zet.prototype.add : any >Zet.prototype : any ->Zet : (t: any) => void +>Zet : (t: T) => void >prototype : any >add : any >function(v, id) { this.u = v || this.t return id(this.u)} : (v: any, id: any) => any @@ -62,7 +65,7 @@ Zet.prototype.add = function(v, id) { var z = new Zet(1) >z : any >new Zet(1) : any ->Zet : (t: any) => void +>Zet : (t: T) => void >1 : 1 z.t = 2 diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types index e7dd5794a9..244e78e0ac 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types @@ -6,8 +6,8 @@ * @template T */ function Zet(t) { ->Zet : (t: any) => void ->t : any +>Zet : (t: T) => void +>t : T /** @type {T} */ this.u @@ -16,11 +16,11 @@ function Zet(t) { >u : any this.t = t ->this.t = t : any +>this.t = t : T >this.t : any >this : any >t : any ->t : any +>t : T } /** * @param {T} v @@ -31,7 +31,7 @@ Zet.prototype.add = function(v, o) { >Zet.prototype.add = function(v, o) { this.u = v || o.nested return this.u} : (v: any, o: any) => any >Zet.prototype.add : any >Zet.prototype : any ->Zet : (t: any) => void +>Zet : (t: T) => void >prototype : any >add : any >function(v, o) { this.u = v || o.nested return this.u} : (v: any, o: any) => any @@ -57,7 +57,7 @@ Zet.prototype.add = function(v, o) { var z = new Zet(1) >z : any >new Zet(1) : any ->Zet : (t: any) => void +>Zet : (t: T) => void >1 : 1 z.t = 2 @@ -76,7 +76,7 @@ z.u = false /** @type {number} */ let answer = z.add(3, { nested: 4 }) ->answer : any +>answer : number >z.add(3, { nested: 4 }) : any >z.add : any >z : any @@ -89,11 +89,15 @@ let answer = z.add(3, { nested: 4 }) // lookup in typedef should not crash the compiler, even when the type is unknown /** * @typedef {Object} A +>A : any + * @property {T} value +>value : any + */ /** @type {A} */ const options = { value: null }; ->options : { value: any; } +>options : A >{ value: null } : { value: null; } >value : null diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt index 9078b6efa4..b60487ba5b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt @@ -1,8 +1,9 @@ +forgot.js(13,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. Type 'void' is not assignable to type 'Animation'. -==== forgot.js (1 errors) ==== +==== forgot.js (2 errors) ==== /** * @param {T} a * @template T @@ -16,6 +17,9 @@ forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKey * @param {T} a * @template T * @returns {function(): T} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function g(a) { return () => a diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.types index 913255d202..7ad6085463 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.types @@ -6,18 +6,18 @@ * @template T */ function f(a) { ->f : (a: any) => () => any ->a : any +>f : (a: T) => () => T +>a : T return () => a ->() => a : () => any ->a : any +>() => a : () => T +>a : T } let n = f(1)() ->n : any ->f(1)() : any ->f(1) : () => any ->f : (a: any) => () => any +>n : number +>f(1)() : number +>f(1) : () => number +>f : (a: T) => () => T >1 : 1 /** @@ -26,18 +26,18 @@ let n = f(1)() * @returns {function(): T} */ function g(a) { ->g : (a: any) => () => any ->a : any +>g : (a: T) => function +>a : T return () => a ->() => a : () => any ->a : any +>() => a : () => T +>a : T } let s = g('hi')() >s : any >g('hi')() : any ->g('hi') : () => any ->g : (a: any) => () => any +>g('hi') : function +>g : (a: T) => function >'hi' : "hi" /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt new file mode 100644 index 0000000000..5513f1c711 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt @@ -0,0 +1,20 @@ +github17339.js(4,13): error TS2304: Cannot find name 'T'. +github17339.js(5,15): error TS2304: Cannot find name 'T'. + + +==== github17339.js (2 errors) ==== + var obj = { + /** + * @template T + * @param {T} a + ~ +!!! error TS2304: Cannot find name 'T'. + * @returns {T} + ~ +!!! error TS2304: Cannot find name 'T'. + */ + x: function (a) { + return a; + }, + }; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.types index 4f4362f8e4..1827468150 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.types @@ -2,8 +2,8 @@ === github17339.js === var obj = { ->obj : { x: (a: any) => any; } ->{ /** * @template T * @param {T} a * @returns {T} */ x: function (a) { return a; },} : { x: (a: any) => any; } +>obj : { x: (a: T) => T; } +>{ /** * @template T * @param {T} a * @returns {T} */ x: function (a) { return a; },} : { x: (a: T) => T; } /** * @template T @@ -11,12 +11,12 @@ var obj = { * @returns {T} */ x: function (a) { ->x : (a: any) => any ->function (a) { return a; } : (a: any) => any ->a : any +>x : (a: T) => T +>function (a) { return a; } : (a: T) => T +>a : T return a; ->a : any +>a : T }, }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt new file mode 100644 index 0000000000..f503b09c3b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt @@ -0,0 +1,37 @@ +a.js(21,3): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. + + +==== a.js (1 errors) ==== + /** + * @template {{ a: number, b: string }} T,U A Comment + * @template {{ c: boolean }} V uh ... are comments even supported?? + * @template W + * @template X That last one had no comment + * @param {T} t + * @param {U} u + * @param {V} v + * @param {W} w + * @param {X} x + * @return {W | X} + */ + function f(t, u, v, w, x) { + if(t.a + t.b.length > u.a - u.b.length && v.c) { + return w; + } + return x; + } + + f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); + f({ a: 12 }, undefined, undefined, 101, 'nope'); + ~~~~~~~~~~ +!!! error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. +!!! related TS2728 a.js:2:28: 'b' is declared here. + + /** + * @template {NoLongerAllowed} + * @template T preceding line's syntax is no longer allowed + * @param {T} x + */ + function g(x) { } + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.symbols index ce3017dca3..4488412bdb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.symbols @@ -22,11 +22,25 @@ function f(t, u, v, w, x) { >x : Symbol(x, Decl(a.js, 12, 22)) if(t.a + t.b.length > u.a - u.b.length && v.c) { +>t.a : Symbol(a, Decl(a.js, 1, 15)) >t : Symbol(t, Decl(a.js, 12, 11)) +>a : Symbol(a, Decl(a.js, 1, 15)) +>t.b.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) +>t.b : Symbol(b, Decl(a.js, 1, 26)) >t : Symbol(t, Decl(a.js, 12, 11)) +>b : Symbol(b, Decl(a.js, 1, 26)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) +>u.a : Symbol(a, Decl(a.js, 1, 15)) >u : Symbol(u, Decl(a.js, 12, 13)) +>a : Symbol(a, Decl(a.js, 1, 15)) +>u.b.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) +>u.b : Symbol(b, Decl(a.js, 1, 26)) >u : Symbol(u, Decl(a.js, 12, 13)) +>b : Symbol(b, Decl(a.js, 1, 26)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) +>v.c : Symbol(c, Decl(a.js, 2, 15)) >v : Symbol(v, Decl(a.js, 12, 16)) +>c : Symbol(c, Decl(a.js, 2, 15)) return w; >w : Symbol(w, Decl(a.js, 12, 19)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.symbols.diff index 57d785ee2f..29cb4c4712 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.symbols.diff @@ -1,22 +1,24 @@ --- old.jsdocTemplateTag3.symbols +++ new.jsdocTemplateTag3.symbols -@@= skipped -21, +21 lines =@@ - >x : Symbol(x, Decl(a.js, 12, 22)) - - if(t.a + t.b.length > u.a - u.b.length && v.c) { -->t.a : Symbol(a, Decl(a.js, 1, 15)) +@@= skipped -24, +24 lines =@@ + >t.a : Symbol(a, Decl(a.js, 1, 15)) >t : Symbol(t, Decl(a.js, 12, 11)) -->a : Symbol(a, Decl(a.js, 1, 15)) + >a : Symbol(a, Decl(a.js, 1, 15)) ->t.b.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) -->t.b : Symbol(b, Decl(a.js, 1, 26)) ++>t.b.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) + >t.b : Symbol(b, Decl(a.js, 1, 26)) >t : Symbol(t, Decl(a.js, 12, 11)) -->b : Symbol(b, Decl(a.js, 1, 26)) + >b : Symbol(b, Decl(a.js, 1, 26)) ->length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) ++>u.a : Symbol(a, Decl(a.js, 1, 15)) >u : Symbol(u, Decl(a.js, 12, 13)) ++>a : Symbol(a, Decl(a.js, 1, 15)) ++>u.b.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) ++>u.b : Symbol(b, Decl(a.js, 1, 26)) >u : Symbol(u, Decl(a.js, 12, 13)) -->v.c : Symbol(c, Decl(a.js, 2, 15)) ++>b : Symbol(b, Decl(a.js, 1, 26)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) + >v.c : Symbol(c, Decl(a.js, 2, 15)) >v : Symbol(v, Decl(a.js, 12, 16)) -->c : Symbol(c, Decl(a.js, 2, 15)) - - return w; - >w : Symbol(w, Decl(a.js, 12, 19)) + >c : Symbol(c, Decl(a.js, 2, 15)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.types index bf35076edb..5d9b438876 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.types @@ -14,48 +14,48 @@ * @return {W | X} */ function f(t, u, v, w, x) { ->f : (t: any, u: any, v: any, w: any, x: any) => any ->t : any ->u : any ->v : any ->w : any ->x : any +>f : (t: T, u: U, v: V, w: W, x: X) => W | X +>t : T +>u : U +>v : V +>w : W +>x : X if(t.a + t.b.length > u.a - u.b.length && v.c) { ->t.a + t.b.length > u.a - u.b.length && v.c : any +>t.a + t.b.length > u.a - u.b.length && v.c : boolean >t.a + t.b.length > u.a - u.b.length : boolean ->t.a + t.b.length : any ->t.a : any ->t : any ->a : any ->t.b.length : any ->t.b : any ->t : any ->b : any ->length : any +>t.a + t.b.length : number +>t.a : number +>t : T +>a : number +>t.b.length : number +>t.b : string +>t : T +>b : string +>length : number >u.a - u.b.length : number ->u.a : any ->u : any ->a : any ->u.b.length : any ->u.b : any ->u : any ->b : any ->length : any ->v.c : any ->v : any ->c : any +>u.a : number +>u : U +>a : number +>u.b.length : number +>u.b : string +>u : U +>b : string +>length : number +>v.c : boolean +>v : V +>c : boolean return w; ->w : any +>w : W } return x; ->x : any +>x : X } f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); ->f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope') : any ->f : (t: any, u: any, v: any, w: any, x: any) => any +>f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope') : "nope" | 101 +>f : (t: T, u: U, v: V, w: W, x: X) => W | X >{ a: 12, b: 'hi', c: null } : { a: number; b: string; c: null; } >a : number >12 : 12 @@ -63,8 +63,8 @@ f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101 >'hi' : "hi" >c : null >undefined : undefined ->{ c: false, d: 12, b: undefined } : { c: boolean; d: number; b: undefined; } ->c : boolean +>{ c: false, d: 12, b: undefined } : { c: false; d: number; b: undefined; } +>c : false >false : false >d : number >12 : 12 @@ -74,8 +74,8 @@ f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101 >'nope' : "nope" f({ a: 12 }, undefined, undefined, 101, 'nope'); ->f({ a: 12 }, undefined, undefined, 101, 'nope') : any ->f : (t: any, u: any, v: any, w: any, x: any) => any +>f({ a: 12 }, undefined, undefined, 101, 'nope') : "nope" | 101 +>f : (t: T, u: U, v: V, w: W, x: X) => W | X >{ a: 12 } : { a: number; } >a : number >12 : 12 @@ -90,7 +90,7 @@ f({ a: 12 }, undefined, undefined, 101, 'nope'); * @param {T} x */ function g(x) { } ->g : (x: any) => void ->x : any +>g : (x: T) => void +>x : T diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.types index 78ce5cb9d5..21efece73b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag4.types @@ -8,7 +8,7 @@ * @template V */ function Multimap() { ->Multimap : () => void +>Multimap : () => void /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {}; @@ -28,7 +28,7 @@ Multimap.prototype.get = function (key) { >Multimap.prototype.get = function (key) { return this._map[key + ''];} : (key: any) => any >Multimap.prototype.get : any >Multimap.prototype : any ->Multimap : () => void +>Multimap : () => void >prototype : any >get : any >function (key) { return this._map[key + ''];} : (key: any) => any @@ -51,8 +51,8 @@ Multimap.prototype.get = function (key) { * @template V */ var Multimap2 = function() { ->Multimap2 : () => void ->function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void +>Multimap2 : () => void +>function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {}; @@ -72,7 +72,7 @@ Multimap2.prototype.get = function (key) { >Multimap2.prototype.get = function (key) { return this._map[key + ''];} : (key: any) => any >Multimap2.prototype.get : any >Multimap2.prototype : any ->Multimap2 : () => void +>Multimap2 : () => void >prototype : any >get : any >function (key) { return this._map[key + ''];} : (key: any) => any diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt index 4abd3d42f7..3327c8ae09 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.errors.txt @@ -1,12 +1,18 @@ a.js(9,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. +a.js(14,16): error TS2304: Cannot find name 'K'. +a.js(15,18): error TS2304: Cannot find name 'V'. +a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. a.js(30,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. +a.js(35,16): error TS2304: Cannot find name 'K'. +a.js(36,18): error TS2304: Cannot find name 'V'. a.js(50,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. a.js(52,10): error TS2339: Property '_map' does not exist on type '{}'. a.js(55,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. +a.js(57,16): error TS2304: Cannot find name 'K'. +a.js(58,18): error TS2304: Cannot find name 'V'. -==== a.js (6 errors) ==== +==== a.js (12 errors) ==== /** * Should work for function declarations * @constructor @@ -23,12 +29,16 @@ a.js(55,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. Multimap.prototype = { /** * @param {K} key the key ok + ~ +!!! error TS2304: Cannot find name 'K'. * @returns {V} the value ok + ~ +!!! error TS2304: Cannot find name 'V'. */ get(key) { return this._map[key + '']; ~~~~ -!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. +!!! error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. } } @@ -48,7 +58,11 @@ a.js(55,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. Multimap2.prototype = { /** * @param {K} key the key ok + ~ +!!! error TS2304: Cannot find name 'K'. * @returns {V} the value ok + ~ +!!! error TS2304: Cannot find name 'V'. */ get: function(key) { return this._map[key + '']; @@ -76,7 +90,11 @@ a.js(55,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. !!! error TS2339: Property 'Multimap3' does not exist on type '{}'. /** * @param {K} key the key ok + ~ +!!! error TS2304: Cannot find name 'K'. * @returns {V} the value ok + ~ +!!! error TS2304: Cannot find name 'V'. */ get(key) { return this._map[key + '']; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.types index 928925bb55..345d3bf137 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag5.types @@ -8,7 +8,7 @@ * @template V */ function Multimap() { ->Multimap : { (): void; prototype: { get: (key: any) => any; }; } +>Multimap : { (): void; prototype: { get: (key: K) => V; }; } /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {}; @@ -21,27 +21,27 @@ function Multimap() { }; Multimap.prototype = { ->Multimap.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } ->Multimap.prototype : { get: (key: any) => any; } ->Multimap : { (): void; prototype: { get: (key: any) => any; }; } ->prototype : { get: (key: any) => any; } ->{ /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } +>Multimap.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: K) => V; } +>Multimap.prototype : { get: (key: K) => V; } +>Multimap : { (): void; prototype: { get: (key: K) => V; }; } +>prototype : { get: (key: K) => V; } +>{ /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: K) => V; } /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { ->get : (key: any) => any ->key : any +>get : (key: K) => V +>key : K return this._map[key + '']; >this._map[key + ''] : any >this._map : any ->this : { get: (key: any) => any; } +>this : { get: (key: K) => V; } >_map : any >key + '' : string ->key : any +>key : K >'' : "" } } @@ -53,8 +53,8 @@ Multimap.prototype = { * @template V */ var Multimap2 = function() { ->Multimap2 : () => void ->function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void +>Multimap2 : () => void +>function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {}; @@ -67,20 +67,20 @@ var Multimap2 = function() { }; Multimap2.prototype = { ->Multimap2.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get: function(key) { return this._map[key + '']; }} : { get: (key: any) => any; } +>Multimap2.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get: function(key) { return this._map[key + '']; }} : { get: (key: K) => V; } >Multimap2.prototype : any ->Multimap2 : () => void +>Multimap2 : () => void >prototype : any ->{ /** * @param {K} key the key ok * @returns {V} the value ok */ get: function(key) { return this._map[key + '']; }} : { get: (key: any) => any; } +>{ /** * @param {K} key the key ok * @returns {V} the value ok */ get: function(key) { return this._map[key + '']; }} : { get: (key: K) => V; } /** * @param {K} key the key ok * @returns {V} the value ok */ get: function(key) { ->get : (key: any) => any ->function(key) { return this._map[key + '']; } : (key: any) => any ->key : any +>get : (key: K) => V +>function(key) { return this._map[key + '']; } : (key: K) => V +>key : K return this._map[key + '']; >this._map[key + ''] : any @@ -88,7 +88,7 @@ Multimap2.prototype = { >this : any >_map : any >key + '' : string ->key : any +>key : K >'' : "" } } @@ -121,21 +121,21 @@ Ns.Multimap3 = function() { }; Ns.Multimap3.prototype = { ->Ns.Multimap3.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } +>Ns.Multimap3.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: K) => V; } >Ns.Multimap3.prototype : any >Ns.Multimap3 : any >Ns : {} >Multimap3 : any >prototype : any ->{ /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } +>{ /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: K) => V; } /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { ->get : (key: any) => any ->key : any +>get : (key: K) => V +>key : K return this._map[key + '']; >this._map[key + ''] : any @@ -143,7 +143,7 @@ Ns.Multimap3.prototype = { >this : any >_map : any >key + '' : string ->key : any +>key : K >'' : "" } } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols index e885cba37e..ab292c55c2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols @@ -89,6 +89,7 @@ function f4(x) { return x[0]; >x : Symbol(x, Decl(a.js, 40, 12)) +>0 : Symbol(0) } const t9 = f4([[1, "x"], [2, "y"]]); >t9 : Symbol(t9, Decl(a.js, 43, 5)) @@ -112,7 +113,9 @@ function f5(obj) { >obj : Symbol(obj, Decl(a.js, 51, 12)) return obj.x; +>obj.x : Symbol(x, Decl(a.js, 48, 12)) >obj : Symbol(obj, Decl(a.js, 51, 12)) +>x : Symbol(x, Decl(a.js, 48, 12)) } const t11 = f5({ x: [1, "x"], y: [2, "y"] }); >t11 : Symbol(t11, Decl(a.js, 54, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols.diff index 78d72ec4b2..c00aee2b03 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.symbols.diff @@ -1,24 +1,6 @@ --- old.jsdocTemplateTag6.symbols +++ new.jsdocTemplateTag6.symbols -@@= skipped -88, +88 lines =@@ - - return x[0]; - >x : Symbol(x, Decl(a.js, 40, 12)) -->0 : Symbol(0) - } - const t9 = f4([[1, "x"], [2, "y"]]); - >t9 : Symbol(t9, Decl(a.js, 43, 5)) -@@= skipped -24, +23 lines =@@ - >obj : Symbol(obj, Decl(a.js, 51, 12)) - - return obj.x; -->obj.x : Symbol(x, Decl(a.js, 48, 12)) - >obj : Symbol(obj, Decl(a.js, 51, 12)) -->x : Symbol(x, Decl(a.js, 48, 12)) - } - const t11 = f5({ x: [1, "x"], y: [2, "y"] }); - >t11 : Symbol(t11, Decl(a.js, 54, 5)) -@@= skipped -37, +35 lines =@@ +@@= skipped -149, +149 lines =@@ * @param {U} x */ foo(x) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.types index b439a702d9..c1916c5cf0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag6.types @@ -7,44 +7,44 @@ * @returns {T} */ function f1(x) { ->f1 : (x: any) => any ->x : any +>f1 : (x: T) => T +>x : T return x; ->x : any +>x : T } const t1 = f1("a"); ->t1 : any ->f1("a") : any ->f1 : (x: any) => any +>t1 : "a" +>f1("a") : "a" +>f1 : (x: T) => T >"a" : "a" const t2 = f1(["a", ["b", "c"]]); ->t2 : any ->f1(["a", ["b", "c"]]) : any ->f1 : (x: any) => any ->["a", ["b", "c"]] : (string | string[])[] +>t2 : readonly ["a", readonly ["b", "c"]] +>f1(["a", ["b", "c"]]) : readonly ["a", readonly ["b", "c"]] +>f1 : (x: T) => T +>["a", ["b", "c"]] : ["a", ["b", "c"]] >"a" : "a" ->["b", "c"] : string[] +>["b", "c"] : ["b", "c"] >"b" : "b" >"c" : "c" const t3 = f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); ->t3 : any ->f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : any ->f1 : (x: any) => any ->{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: number; b: string; d: (string | number | boolean | { f: string; })[]; } ->a : number +>t3 : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } +>f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } +>f1 : (x: T) => T +>{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: 1; b: "c"; d: ["e", 2, true, { f: "g"; }]; } +>a : 1 >1 : 1 ->b : string +>b : "c" >"c" : "c" ->d : (string | number | boolean | { f: string; })[] ->["e", 2, true, { f: "g" }] : (string | number | boolean | { f: string; })[] +>d : ["e", 2, true, { f: "g"; }] +>["e", 2, true, { f: "g" }] : ["e", 2, true, { f: "g"; }] >"e" : "e" >2 : 2 >true : true ->{ f: "g" } : { f: string; } ->f : string +>{ f: "g" } : { f: "g"; } +>f : "g" >"g" : "g" /** @@ -53,45 +53,45 @@ const t3 = f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); * @returns {T} */ function f2(x) { ->f2 : (x: any) => any ->x : any +>f2 : (x: T) => T +>x : T return x; ->x : any +>x : T }; const t4 = f2('a'); ->t4 : any ->f2('a') : any ->f2 : (x: any) => any +>t4 : "a" +>f2('a') : "a" +>f2 : (x: T) => T >'a' : "a" const t5 = f2(['a', ['b', 'c']]); ->t5 : any ->f2(['a', ['b', 'c']]) : any ->f2 : (x: any) => any ->['a', ['b', 'c']] : (string | string[])[] +>t5 : readonly ["a", readonly ["b", "c"]] +>f2(['a', ['b', 'c']]) : readonly ["a", readonly ["b", "c"]] +>f2 : (x: T) => T +>['a', ['b', 'c']] : ["a", ["b", "c"]] >'a' : "a" ->['b', 'c'] : string[] +>['b', 'c'] : ["b", "c"] >'b' : "b" >'c' : "c" const t6 = f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); ->t6 : any ->f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : any ->f2 : (x: any) => any ->{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: number; b: string; d: (string | number | boolean | { f: string; })[]; } ->a : number +>t6 : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } +>f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } +>f2 : (x: T) => T +>{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: 1; b: "c"; d: ["e", 2, true, { f: "g"; }]; } +>a : 1 >1 : 1 ->b : string +>b : "c" >"c" : "c" ->d : (string | number | boolean | { f: string; })[] ->["e", 2, true, { f: "g" }] : (string | number | boolean | { f: string; })[] +>d : ["e", 2, true, { f: "g"; }] +>["e", 2, true, { f: "g" }] : ["e", 2, true, { f: "g"; }] >"e" : "e" >2 : 2 >true : true ->{ f: "g" } : { f: string; } ->f : string +>{ f: "g" } : { f: "g"; } +>f : "g" >"g" : "g" /** @@ -100,23 +100,23 @@ const t6 = f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); * @returns {T[]} */ function f3(x) { ->f3 : (x: any) => any[] ->x : any +>f3 : (x: T) => T[] +>x : T return [x]; ->[x] : any[] ->x : any +>[x] : T[] +>x : T } const t7 = f3("hello"); ->t7 : any[] ->f3("hello") : any[] ->f3 : (x: any) => any[] +>t7 : "hello"[] +>f3("hello") : "hello"[] +>f3 : (x: T) => T[] >"hello" : "hello" const t8 = f3("hello"); ->t8 : any[] ->f3("hello") : any[] ->f3 : (x: any) => any[] +>t8 : "hello"[] +>f3("hello") : "hello"[] +>f3 : (x: T) => T[] >"hello" : "hello" /** @@ -125,40 +125,40 @@ const t8 = f3("hello"); * @returns {T} */ function f4(x) { ->f4 : (x: any) => any ->x : any +>f4 : (x: [T, T]) => T +>x : [T, T] return x[0]; ->x[0] : any ->x : any +>x[0] : T +>x : [T, T] >0 : 0 } const t9 = f4([[1, "x"], [2, "y"]]); ->t9 : any ->f4([[1, "x"], [2, "y"]]) : any ->f4 : (x: any) => any ->[[1, "x"], [2, "y"]] : (string | number)[][] ->[1, "x"] : (string | number)[] +>t9 : readonly [1, "x"] | readonly [2, "y"] +>f4([[1, "x"], [2, "y"]]) : readonly [1, "x"] | readonly [2, "y"] +>f4 : (x: [T, T]) => T +>[[1, "x"], [2, "y"]] : [[1, "x"], [2, "y"]] +>[1, "x"] : [1, "x"] >1 : 1 >"x" : "x" ->[2, "y"] : (string | number)[] +>[2, "y"] : [2, "y"] >2 : 2 >"y" : "y" const t10 = f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]); ->t10 : any ->f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]) : any ->f4 : (x: any) => any ->[{ a: 1, b: "x" }, { a: 2, b: "y" }] : { a: number; b: string; }[] ->{ a: 1, b: "x" } : { a: number; b: string; } ->a : number +>t10 : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } +>f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]) : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } +>f4 : (x: [T, T]) => T +>[{ a: 1, b: "x" }, { a: 2, b: "y" }] : [{ a: 1; b: "x"; }, { a: 2; b: "y"; }] +>{ a: 1, b: "x" } : { a: 1; b: "x"; } +>a : 1 >1 : 1 ->b : string +>b : "x" >"x" : "x" ->{ a: 2, b: "y" } : { a: number; b: string; } ->a : number +>{ a: 2, b: "y" } : { a: 2; b: "y"; } +>a : 2 >2 : 2 ->b : string +>b : "y" >"y" : "y" /** @@ -167,98 +167,98 @@ const t10 = f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]); * @returns {T} */ function f5(obj) { ->f5 : (obj: any) => any ->obj : any +>f5 : (obj: { x: T; y: T; }) => T +>obj : { x: T; y: T; } return obj.x; ->obj.x : any ->obj : any ->x : any +>obj.x : T +>obj : { x: T; y: T; } +>x : T } const t11 = f5({ x: [1, "x"], y: [2, "y"] }); ->t11 : any ->f5({ x: [1, "x"], y: [2, "y"] }) : any ->f5 : (obj: any) => any ->{ x: [1, "x"], y: [2, "y"] } : { x: (string | number)[]; y: (string | number)[]; } ->x : (string | number)[] ->[1, "x"] : (string | number)[] +>t11 : readonly [1, "x"] | readonly [2, "y"] +>f5({ x: [1, "x"], y: [2, "y"] }) : readonly [1, "x"] | readonly [2, "y"] +>f5 : (obj: { x: T; y: T; }) => T +>{ x: [1, "x"], y: [2, "y"] } : { x: [1, "x"]; y: [2, "y"]; } +>x : [1, "x"] +>[1, "x"] : [1, "x"] >1 : 1 >"x" : "x" ->y : (string | number)[] ->[2, "y"] : (string | number)[] +>y : [2, "y"] +>[2, "y"] : [2, "y"] >2 : 2 >"y" : "y" const t12 = f5({ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } }); ->t12 : any ->f5({ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } }) : any ->f5 : (obj: any) => any ->{ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } } : { x: { a: number; b: string; }; y: { a: number; b: string; }; } ->x : { a: number; b: string; } ->{ a: 1, b: "x" } : { a: number; b: string; } ->a : number +>t12 : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } +>f5({ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } }) : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } +>f5 : (obj: { x: T; y: T; }) => T +>{ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } } : { x: { a: 1; b: "x"; }; y: { a: 2; b: "y"; }; } +>x : { a: 1; b: "x"; } +>{ a: 1, b: "x" } : { a: 1; b: "x"; } +>a : 1 >1 : 1 ->b : string +>b : "x" >"x" : "x" ->y : { a: number; b: string; } ->{ a: 2, b: "y" } : { a: number; b: string; } ->a : number +>y : { a: 2; b: "y"; } +>{ a: 2, b: "y" } : { a: 2; b: "y"; } +>a : 2 >2 : 2 ->b : string +>b : "y" >"y" : "y" /** * @template const T */ class C { ->C : C +>C : C /** * @param {T} x */ constructor(x) {} ->x : any +>x : T /** * @template const U * @param {U} x */ foo(x) { ->foo : (x: any) => any ->x : any +>foo : (x: U) => U +>x : U return x; ->x : any +>x : U } } const t13 = new C({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); ->t13 : C ->new C({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : C +>t13 : C<{ readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; }> +>new C({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : C<{ readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; }> >C : typeof C ->{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: number; b: string; d: (string | number | boolean | { f: string; })[]; } ->a : number +>{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: 1; b: "c"; d: ["e", 2, true, { f: "g"; }]; } +>a : 1 >1 : 1 ->b : string +>b : "c" >"c" : "c" ->d : (string | number | boolean | { f: string; })[] ->["e", 2, true, { f: "g" }] : (string | number | boolean | { f: string; })[] +>d : ["e", 2, true, { f: "g"; }] +>["e", 2, true, { f: "g" }] : ["e", 2, true, { f: "g"; }] >"e" : "e" >2 : 2 >true : true ->{ f: "g" } : { f: string; } ->f : string +>{ f: "g" } : { f: "g"; } +>f : "g" >"g" : "g" const t14 = t13.foo(["a", ["b", "c"]]); ->t14 : any ->t13.foo(["a", ["b", "c"]]) : any ->t13.foo : (x: any) => any ->t13 : C ->foo : (x: any) => any ->["a", ["b", "c"]] : (string | string[])[] +>t14 : readonly ["a", readonly ["b", "c"]] +>t13.foo(["a", ["b", "c"]]) : readonly ["a", readonly ["b", "c"]] +>t13.foo : (x: U) => U +>t13 : C<{ readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; }> +>foo : (x: U) => U +>["a", ["b", "c"]] : ["a", ["b", "c"]] >"a" : "a" ->["b", "c"] : string[] +>["b", "c"] : ["b", "c"] >"b" : "b" >"c" : "c" @@ -268,21 +268,21 @@ const t14 = t13.foo(["a", ["b", "c"]]); * @returns {T} */ function f6(...args) { ->f6 : (...args: any[]) => any[] ->args : any[] +>f6 : (...args: T) => T +>args : T return args; ->args : any[] +>args : T } const t15 = f6(1, 'b', { a: 1, b: 'x' }); ->t15 : any[] ->f6(1, 'b', { a: 1, b: 'x' }) : any[] ->f6 : (...args: any[]) => any[] +>t15 : readonly [1, "b", { readonly a: 1; readonly b: "x"; }] +>f6(1, 'b', { a: 1, b: 'x' }) : readonly [1, "b", { readonly a: 1; readonly b: "x"; }] +>f6 : (...args: T) => T >1 : 1 >'b' : "b" ->{ a: 1, b: 'x' } : { a: number; b: string; } ->a : number +>{ a: 1, b: 'x' } : { a: 1; b: "x"; } +>a : 1 >1 : 1 ->b : string +>b : "x" >'x' : "x" diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt new file mode 100644 index 0000000000..6d5770242e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.errors.txt @@ -0,0 +1,28 @@ +a.js(2,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) ==== + /** + * @template const T + ~~~~~ +!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class + * @typedef {[T]} X + */ + + /** + * @template const T + */ + class C { } + + /** + * @template private T + ~~~~~~~ +!!! error TS1273: 'private' modifier cannot appear on a type parameter + * @param {T} x + * @returns {T} + */ + function f(x) { + return x; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols index 3f1baaa218..2f758249d0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols @@ -4,7 +4,7 @@ /** * @template const T * @typedef {[T]} X ->T : Symbol(T) +>T : Symbol(T, Decl(a.js, 0, 0)) */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff index 6c68548995..ac2a205e82 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff @@ -4,7 +4,7 @@ /** * @template const T * @typedef {[T]} X -+>T : Symbol(T) ++>T : Symbol(T, Decl(a.js, 0, 0)) + */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.types index a1eca4340e..dba307f980 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.types @@ -4,13 +4,15 @@ /** * @template const T * @typedef {[T]} X +>X : any + */ /** * @template const T */ class C { } ->C : C +>C : C /** * @template private T @@ -18,10 +20,10 @@ class C { } * @returns {T} */ function f(x) { ->f : (x: any) => any ->x : any +>f : (x: T) => T +>x : T return x; ->x : any +>x : T } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt index fa41333755..348848a9e7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.errors.txt @@ -1,12 +1,26 @@ +a.js(2,14): error TS1274: 'out' modifier can only appear on a type parameter of a class, interface or type alias +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(29,33): error TS7006: Parameter 'x' implicitly has an 'any' type. a.js(34,31): error TS7006: Parameter 'x' implicitly has an 'any' type. +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(48,29): error TS7006: Parameter 'x' implicitly has an 'any' type. a.js(53,27): error TS7006: Parameter 'x' implicitly has an 'any' type. +a.js(55,1): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. + 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'. +a.js(59,14): error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias -==== a.js (4 errors) ==== +==== a.js (12 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 */ @@ -23,9 +37,14 @@ a.js(53,27): error TS7006: Parameter 'x' implicitly has an 'any' type. super_covariant = sub_covariant; sub_covariant = super_covariant; // Error + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'Covariant' is not assignable to type 'Covariant'. +!!! error TS2322: Type 'unknown' is not assignable to type 'string'. /** * @template in T + ~~ +!!! 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 */ @@ -45,10 +64,15 @@ a.js(53,27): error TS7006: Parameter 'x' implicitly has an 'any' type. !!! error TS7006: Parameter 'x' implicitly has an 'any' type. super_contravariant = sub_contravariant; // Error + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Contravariant' is not assignable to type 'Contravariant'. +!!! error TS2322: Type 'unknown' is not assignable to type 'string'. sub_contravariant = super_contravariant; /** * @template in out T + ~~ +!!! 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 */ @@ -68,10 +92,18 @@ a.js(53,27): error TS7006: Parameter 'x' implicitly has an 'any' type. !!! error TS7006: Parameter 'x' implicitly has an 'any' type. 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'. 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'. /** * @template in T + ~~ +!!! error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias * @param {T} x */ function f(x) {} diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.types index f194e5d4d7..638bed4f39 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.types @@ -4,14 +4,18 @@ /** * @template out T * @typedef {Object} Covariant +>Covariant : any + * @property {T} x +>x : any + */ /** * @type {Covariant} */ let super_covariant = { x: 1 }; ->super_covariant : { x: number; } +>super_covariant : Covariant >{ x: 1 } : { x: number; } >x : number >1 : 1 @@ -20,32 +24,37 @@ let super_covariant = { x: 1 }; * @type {Covariant} */ let sub_covariant = { x: '' }; ->sub_covariant : { x: string; } +>sub_covariant : Covariant >{ x: '' } : { x: string; } >x : string >'' : "" super_covariant = sub_covariant; ->super_covariant = sub_covariant : { x: string; } ->super_covariant : { x: number; } ->sub_covariant : { x: string; } +>super_covariant = sub_covariant : Covariant +>super_covariant : Covariant +>sub_covariant : Covariant sub_covariant = super_covariant; // Error ->sub_covariant = super_covariant : { x: number; } ->sub_covariant : { x: string; } ->super_covariant : { x: number; } +>sub_covariant = super_covariant : Covariant +>sub_covariant : Covariant +>super_covariant : Covariant /** * @template in T * @typedef {Object} Contravariant +>Contravariant : any + * @property {(x: T) => void} f +>f : any +>x : T + */ /** * @type {Contravariant} */ let super_contravariant = { f: (x) => {} }; ->super_contravariant : { f: (x: any) => void; } +>super_contravariant : Contravariant >{ f: (x) => {} } : { f: (x: any) => void; } >f : (x: any) => void >(x) => {} : (x: any) => void @@ -55,33 +64,38 @@ let super_contravariant = { f: (x) => {} }; * @type {Contravariant} */ let sub_contravariant = { f: (x) => {} }; ->sub_contravariant : { f: (x: any) => void; } +>sub_contravariant : Contravariant >{ f: (x) => {} } : { f: (x: any) => void; } >f : (x: any) => void >(x) => {} : (x: any) => void >x : any super_contravariant = sub_contravariant; // Error ->super_contravariant = sub_contravariant : { f: (x: any) => void; } ->super_contravariant : { f: (x: any) => void; } ->sub_contravariant : { f: (x: any) => void; } +>super_contravariant = sub_contravariant : Contravariant +>super_contravariant : Contravariant +>sub_contravariant : Contravariant sub_contravariant = super_contravariant; ->sub_contravariant = super_contravariant : { f: (x: any) => void; } ->sub_contravariant : { f: (x: any) => void; } ->super_contravariant : { f: (x: any) => void; } +>sub_contravariant = super_contravariant : Contravariant +>sub_contravariant : Contravariant +>super_contravariant : Contravariant /** * @template in out T * @typedef {Object} Invariant +>Invariant : any + * @property {(x: T) => T} f +>f : any +>x : T + */ /** * @type {Invariant} */ let super_invariant = { f: (x) => {} }; ->super_invariant : { f: (x: any) => void; } +>super_invariant : Invariant >{ f: (x) => {} } : { f: (x: any) => void; } >f : (x: any) => void >(x) => {} : (x: any) => void @@ -91,7 +105,7 @@ let super_invariant = { f: (x) => {} }; * @type {Invariant} */ let sub_invariant = { f: (x) => { return "" } }; ->sub_invariant : { f: (x: any) => string; } +>sub_invariant : Invariant >{ f: (x) => { return "" } } : { f: (x: any) => string; } >f : (x: any) => string >(x) => { return "" } : (x: any) => string @@ -99,20 +113,20 @@ let sub_invariant = { f: (x) => { return "" } }; >"" : "" super_invariant = sub_invariant; // Error ->super_invariant = sub_invariant : { f: (x: any) => string; } ->super_invariant : { f: (x: any) => void; } ->sub_invariant : { f: (x: any) => string; } +>super_invariant = sub_invariant : Invariant +>super_invariant : Invariant +>sub_invariant : Invariant sub_invariant = super_invariant; // Error ->sub_invariant = super_invariant : { f: (x: any) => void; } ->sub_invariant : { f: (x: any) => string; } ->super_invariant : { f: (x: any) => void; } +>sub_invariant = super_invariant : Invariant +>sub_invariant : Invariant +>super_invariant : Invariant /** * @template in T * @param {T} x */ function f(x) {} ->f : (x: any) => void ->x : any +>f : (x: T) => void +>x : T diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt new file mode 100644 index 0000000000..2d72bf6032 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt @@ -0,0 +1,84 @@ +file.js(3,15): error TS2304: Cannot find name 'T'. +file.js(38,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. +file.js(49,21): error TS2706: Required type parameters may not follow optional type parameters. +file.js(57,1): error TS2706: Required type parameters may not follow optional type parameters. +file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. + + +==== file.js (5 errors) ==== + /** + * @template {string | number} [T=string] - ok: defaults are permitted + * @typedef {[T]} A + ~ +!!! error TS2304: Cannot find name 'T'. + */ + + /** @type {A} */ // ok, default for `T` in `A` is `string` + const aDefault1 = [""]; + /** @type {A} */ // error: `number` is not assignable to string` + const aDefault2 = [0]; + /** @type {A} */ // ok, `T` is provided for `A` + const aString = [""]; + /** @type {A} */ // ok, `T` is provided for `A` + const aNumber = [0]; + + /** + * @template T + * @template [U=T] - ok: default can reference earlier type parameter + * @typedef {[T, U]} B + */ + + /** + * @template {string | number} [T] - error: default requires an `=type` + * @typedef {[T]} C + */ + + /** + * @template {string | number} [T=] - error: default requires a `type` + * @typedef {[T]} D + */ + + /** + * @template {string | number} [T=string] + * @template U - error: Required type parameters cannot follow optional type parameters + * @typedef {[T, U]} E + */ + + /** + * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. + ~ +!!! error TS2744: Type parameter defaults can only reference previously declared type parameters. + * @template [U=T] + * @typedef {[T, U]} G + */ + + /** + * @template T + * @template [U=T] - ok: default can reference earlier type parameter + * @param {T} a + * @param {U} b + */ + function f1(a, b) {} + +!!! error TS2706: Required type parameters may not follow optional type parameters. + + /** + * @template {string | number} [T=string] + * @template U - error: Required type parameters cannot follow optional type parameters + * @param {T} a + * @param {U} b + */ + function f2(a, b) {} + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2706: Required type parameters may not follow optional type parameters. + + /** + * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. + ~ +!!! error TS2744: Type parameter defaults can only reference previously declared type parameters. + * @template [U=T] + * @param {T} a + * @param {U} b + */ + function f3(a, b) {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols index 12687d3c15..897ba41cdf 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols @@ -28,22 +28,25 @@ const aNumber = [0]; * @template T * @template [U=T] - ok: default can reference earlier type parameter * @typedef {[T, U]} B ->T : Symbol(T) ->U : Symbol(U) +>B : Symbol(B, Decl(file.js, 48, 20)) +>T : Symbol(T, Decl(file.js, 48, 20)) +>U : Symbol(U, Decl(file.js, 48, 20)) */ /** * @template {string | number} [T] - error: default requires an `=type` * @typedef {[T]} C ->T : Symbol(T) +>C : Symbol(C, Decl(file.js, 48, 20)) +>T : Symbol(T, Decl(file.js, 48, 20)) */ /** * @template {string | number} [T=] - error: default requires a `type` * @typedef {[T]} D ->T : Symbol(T) +>D : Symbol(D, Decl(file.js, 48, 20)) +>T : Symbol(T, Decl(file.js, 48, 20)) */ @@ -51,8 +54,9 @@ const aNumber = [0]; * @template {string | number} [T=string] * @template U - error: Required type parameters cannot follow optional type parameters * @typedef {[T, U]} E ->T : Symbol(T) ->U : Symbol(U) +>E : Symbol(E, Decl(file.js, 48, 20)) +>T : Symbol(T, Decl(file.js, 48, 20)) +>U : Symbol(U, Decl(file.js, 48, 20)) */ @@ -60,8 +64,9 @@ const aNumber = [0]; * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. * @template [U=T] * @typedef {[T, U]} G ->T : Symbol(T) ->U : Symbol(U) +>G : Symbol(G, Decl(file.js, 48, 20)) +>T : Symbol(T, Decl(file.js, 48, 20)) +>U : Symbol(U, Decl(file.js, 48, 20)) */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff index 0e2a36680b..0e09ce59fe 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff @@ -13,22 +13,25 @@ * @template T * @template [U=T] - ok: default can reference earlier type parameter * @typedef {[T, U]} B -+>T : Symbol(T) -+>U : Symbol(U) ++>B : Symbol(B, Decl(file.js, 48, 20)) ++>T : Symbol(T, Decl(file.js, 48, 20)) ++>U : Symbol(U, Decl(file.js, 48, 20)) + */ /** * @template {string | number} [T] - error: default requires an `=type` * @typedef {[T]} C -+>T : Symbol(T) ++>C : Symbol(C, Decl(file.js, 48, 20)) ++>T : Symbol(T, Decl(file.js, 48, 20)) + */ /** * @template {string | number} [T=] - error: default requires a `type` * @typedef {[T]} D -+>T : Symbol(T) ++>D : Symbol(D, Decl(file.js, 48, 20)) ++>T : Symbol(T, Decl(file.js, 48, 20)) + */ @@ -36,8 +39,9 @@ * @template {string | number} [T=string] * @template U - error: Required type parameters cannot follow optional type parameters * @typedef {[T, U]} E -+>T : Symbol(T) -+>U : Symbol(U) ++>E : Symbol(E, Decl(file.js, 48, 20)) ++>T : Symbol(T, Decl(file.js, 48, 20)) ++>U : Symbol(U, Decl(file.js, 48, 20)) + */ @@ -45,8 +49,9 @@ * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. * @template [U=T] * @typedef {[T, U]} G -+>T : Symbol(T) -+>U : Symbol(U) ++>G : Symbol(G, Decl(file.js, 48, 20)) ++>T : Symbol(T, Decl(file.js, 48, 20)) ++>U : Symbol(U, Decl(file.js, 48, 20)) + */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.types index 841f1a4dea..bfd0ce0999 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.types @@ -4,58 +4,70 @@ /** * @template {string | number} [T=string] - ok: defaults are permitted * @typedef {[T]} A +>A : any + */ /** @type {A} */ // ok, default for `T` in `A` is `string` const aDefault1 = [""]; ->aDefault1 : string[] ->[""] : string[] +>aDefault1 : [T] +>[""] : [string] >"" : "" /** @type {A} */ // error: `number` is not assignable to string` const aDefault2 = [0]; ->aDefault2 : number[] ->[0] : number[] +>aDefault2 : [T] +>[0] : [number] >0 : 0 /** @type {A} */ // ok, `T` is provided for `A` const aString = [""]; ->aString : string[] ->[""] : string[] +>aString : [T] +>[""] : [string] >"" : "" /** @type {A} */ // ok, `T` is provided for `A` const aNumber = [0]; ->aNumber : number[] ->[0] : number[] +>aNumber : [T] +>[0] : [number] >0 : 0 /** * @template T * @template [U=T] - ok: default can reference earlier type parameter * @typedef {[T, U]} B +>B : B + */ /** * @template {string | number} [T] - error: default requires an `=type` * @typedef {[T]} C +>C : C + */ /** * @template {string | number} [T=] - error: default requires a `type` * @typedef {[T]} D +>D : D + */ /** * @template {string | number} [T=string] * @template U - error: Required type parameters cannot follow optional type parameters * @typedef {[T, U]} E +>E : E + */ /** * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. * @template [U=T] * @typedef {[T, U]} G +>G : G + */ /** @@ -65,9 +77,9 @@ const aNumber = [0]; * @param {U} b */ function f1(a, b) {} ->f1 : (a: any, b: any) => void ->a : any ->b : any +>f1 : (a: T, b: U) => void +>a : T +>b : U /** * @template {string | number} [T=string] @@ -76,9 +88,9 @@ function f1(a, b) {} * @param {U} b */ function f2(a, b) {} ->f2 : (a: any, b: any) => void ->a : any ->b : any +>f2 : (a: T, b: U) => void +>a : T +>b : U /** * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. @@ -87,7 +99,7 @@ function f2(a, b) {} * @param {U} b */ function f3(a, b) {} ->f3 : (a: any, b: any) => void ->a : any ->b : any +>f3 : (a: T, b: U) => void +>a : T +>b : U diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt new file mode 100644 index 0000000000..5aa1f20558 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.errors.txt @@ -0,0 +1,22 @@ +file.js(3,21): error TS2304: Cannot find name 'T'. +file.js(4,14): error TS2304: Cannot find name 'T'. +file.js(4,16): error TS2304: Cannot find name 'K'. + + +==== file.js (3 errors) ==== + /** + * @template T + * @template {keyof T} K + ~ +!!! error TS2304: Cannot find name 'T'. + * @typedef {T[K]} Foo + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'K'. + */ + + const x = { a: 1 }; + + /** @type {Foo} */ + const y = "a"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols index a65a7c4a62..805f1eb548 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols @@ -4,6 +4,8 @@ /** * @template T * @template {keyof T} K +>T : Symbol(T) + * @typedef {T[K]} Foo >T : Symbol(T) >K : Symbol(K) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols.diff index 2e9a386cb4..ec4f6357fe 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols.diff @@ -1,8 +1,11 @@ --- old.jsdocTemplateTagNameResolution.symbols +++ new.jsdocTemplateTagNameResolution.symbols -@@= skipped -4, +4 lines =@@ +@@= skipped -3, +3 lines =@@ + /** * @template T * @template {keyof T} K ++>T : Symbol(T) ++ * @typedef {T[K]} Foo +>T : Symbol(T) +>K : Symbol(K) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.types index 1579d9800d..f7c72457bc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.types @@ -5,6 +5,8 @@ * @template T * @template {keyof T} K * @typedef {T[K]} Foo +>Foo : any + */ const x = { a: 1 }; @@ -15,6 +17,6 @@ const x = { a: 1 }; /** @type {Foo} */ const y = "a"; ->y : "a" +>y : T >"a" : "a" diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt new file mode 100644 index 0000000000..94ee1d5f47 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt @@ -0,0 +1,50 @@ +/a.js(3,10): error TS2339: Property 'test' does not exist on type 'Foo'. +/a.js(13,10): error TS2339: Property 'test' does not exist on type 'Foo'. +/a.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + +==== /types.d.ts (0 errors) ==== + export interface Foo { + foo: () => void; + } + + export type M = (this: Foo) => void; + +==== /a.js (3 errors) ==== + /** @type {import('./types').M} */ + export const f1 = function() { + this.test(); + ~~~~ +!!! error TS2339: Property 'test' does not exist on type 'Foo'. + } + + /** @type {import('./types').M} */ + export function f2() { + this.test(); + } + + /** @type {(this: import('./types').Foo) => void} */ + export const f3 = function() { + this.test(); + ~~~~ +!!! error TS2339: Property 'test' does not exist on type 'Foo'. + } + + /** @type {(this: import('./types').Foo) => void} */ + export function f4() { + this.test(); + } + + /** @type {function(this: import('./types').Foo): void} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + export const f5 = function() { + this.test(); + } + + /** @type {function(this: import('./types').Foo): void} */ + export function f6() { + this.test(); + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols b/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols index 308da31e12..f9fd5bc328 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols @@ -19,6 +19,7 @@ export const f1 = function() { >f1 : Symbol(f1, Decl(a.js, 1, 12)) this.test(); +>this : Symbol(this, Decl(types.d.ts, 4, 17)) } /** @type {import('./types').M} */ @@ -33,6 +34,7 @@ export const f3 = function() { >f3 : Symbol(f3, Decl(a.js, 11, 12)) this.test(); +>this : Symbol(this, Decl(a.js, 10, 12)) } /** @type {(this: import('./types').Foo) => void} */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols.diff index c988aae3fa..9b62092c66 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.symbols.diff @@ -9,15 +9,7 @@ } export type M = (this: Foo) => void; -@@= skipped -14, +14 lines =@@ - >f1 : Symbol(f1, Decl(a.js, 1, 12)) - - this.test(); -->this : Symbol(this, Decl(types.d.ts, 4, 17)) - } - - /** @type {import('./types').M} */ -@@= skipped -8, +7 lines =@@ +@@= skipped -22, +22 lines =@@ >f2 : Symbol(f2, Decl(a.js, 3, 1)) this.test(); @@ -25,15 +17,7 @@ } /** @type {(this: import('./types').Foo) => void} */ -@@= skipped -8, +7 lines =@@ - >f3 : Symbol(f3, Decl(a.js, 11, 12)) - - this.test(); -->this : Symbol(this, Decl(a.js, 10, 12)) - } - - /** @type {(this: import('./types').Foo) => void} */ -@@= skipped -8, +7 lines =@@ +@@= skipped -16, +15 lines =@@ >f4 : Symbol(f4, Decl(a.js, 13, 1)) this.test(); diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.types b/testdata/baselines/reference/submodule/conformance/jsdocThisType.types index 2596e8b37d..3f57935a27 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocThisType.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.types @@ -13,13 +13,13 @@ export type M = (this: Foo) => void; === /a.js === /** @type {import('./types').M} */ export const f1 = function() { ->f1 : () => void +>f1 : M >function() { this.test();} : () => void this.test(); >this.test() : any >this.test : any ->this : any +>this : Foo >test : any } @@ -42,7 +42,7 @@ export const f3 = function() { this.test(); >this.test() : any >this.test : any ->this : any +>this : Foo >test : any } @@ -59,7 +59,7 @@ export function f4() { /** @type {function(this: import('./types').Foo): void} */ export const f5 = function() { ->f5 : () => void +>f5 : function >function() { this.test();} : () => void this.test(); diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt new file mode 100644 index 0000000000..be8a7c7817 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.errors.txt @@ -0,0 +1,17 @@ +index.js(1,12): error TS2304: Cannot find name 'AnyEffect'. +index.js(3,12): error TS2304: Cannot find name 'Third'. + + +==== dtsEquivalent.js (0 errors) ==== + /** @typedef {{[k: string]: any}} AnyEffect */ + /** @typedef {number} Third */ +==== index.js (2 errors) ==== + /** @type {AnyEffect} */ + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'AnyEffect'. + let b; + /** @type {Third} */ + ~~~~~ +!!! error TS2304: Cannot find name 'Third'. + let c; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.types index 43c7280932..d3c40ce2ed 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeDefAtStartOfFile.types @@ -7,9 +7,9 @@ === index.js === /** @type {AnyEffect} */ let b; ->b : any +>b : AnyEffect /** @type {Third} */ let c; ->c : any +>c : Third diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt index 4bd269ce21..4b1d9f2cb3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt @@ -1,12 +1,15 @@ bug27342.js(1,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +bug27342.js(3,11): error TS2304: Cannot find name 'exports'. -==== bug27342.js (1 errors) ==== +==== bug27342.js (2 errors) ==== module.exports = {} ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** * @type {exports} + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. */ var x diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.types index 7824eedfab..541485d3a9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.types @@ -12,6 +12,6 @@ module.exports = {} * @type {exports} */ var x ->x : any +>x : exports diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt index e7cbf8fc04..a7f7b62b4e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.errors.txt @@ -1,8 +1,10 @@ jsdocTypeReferenceToImport.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. jsdocTypeReferenceToImport.js(2,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +jsdocTypeReferenceToImport.js(3,12): error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? +jsdocTypeReferenceToImport.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? -==== jsdocTypeReferenceToImport.js (2 errors) ==== +==== jsdocTypeReferenceToImport.js (4 errors) ==== const C = require('./ex').C; ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -10,11 +12,15 @@ jsdocTypeReferenceToImport.js(2,11): error TS2580: Cannot find name 'require'. D ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @type {C} c */ + ~ +!!! error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? var c = new C() c.start c.end /** @type {D} c */ + ~ +!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? var d = new D() d.start d.end diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.types index c544827ab4..1250d4da7e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImport.types @@ -19,34 +19,34 @@ const D = require('./ex')?.C; /** @type {C} c */ var c = new C() ->c : any +>c : C >new C() : any >C : any c.start >c.start : any ->c : any +>c : C >start : any c.end >c.end : any ->c : any +>c : C >end : any /** @type {D} c */ var d = new D() ->d : any +>d : D >new D() : any >D : any d.start >d.start : any ->d : any +>d : D >start : any d.end >d.end : any ->d : any +>d : D >end : any === ex.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types index e0b15c5774..8416315b49 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types @@ -8,6 +8,7 @@ const MW = require("./MW"); >"./MW" : "./MW" /** @typedef {number} Cictema */ +>Cictema : any module.exports = class MC { >module.exports = class MC { watch() { return new MW(this); }} : typeof MC diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types index 09304d9d02..fc8eeeecf5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types @@ -8,6 +8,7 @@ const MW = require("./MW"); >"./MW" : "./MW" /** @typedef {number} Meyerhauser */ +>Meyerhauser : any /** @class */ module.exports = function MC() { @@ -20,13 +21,13 @@ module.exports = function MC() { /** @type {any} */ var x = {} ->x : {} +>x : any >{} : {} return new MW(x); >new MW(x) : any >MW : any ->x : {} +>x : any }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt index 87c84ddade..a820680442 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.errors.txt @@ -1,10 +1,13 @@ +jsdocTypeReferenceToMergedClass.js(2,12): error TS2503: Cannot find namespace 'Workspace'. jsdocTypeReferenceToMergedClass.js(6,11): error TS2339: Property 'Project' does not exist on type '{}'. jsdocTypeReferenceToMergedClass.js(7,11): error TS2339: Property 'Project' does not exist on type '{}'. -==== jsdocTypeReferenceToMergedClass.js (2 errors) ==== +==== jsdocTypeReferenceToMergedClass.js (3 errors) ==== var Workspace = {} /** @type {Workspace.Project} */ + ~~~~~~~~~ +!!! error TS2503: Cannot find namespace 'Workspace'. var p; p.isServiceProject() diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.types index 1fe6e733a2..785994e30f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToMergedClass.types @@ -7,12 +7,12 @@ var Workspace = {} /** @type {Workspace.Project} */ var p; ->p : any +>p : Project p.isServiceProject() >p.isServiceProject() : any >p.isServiceProject : any ->p : any +>p : Project >isServiceProject : any Workspace.Project = function wp() { } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt new file mode 100644 index 0000000000..bee4d86738 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.errors.txt @@ -0,0 +1,11 @@ +foo.js(1,13): error TS2749: 'Image' refers to a value, but is being used as a type here. Did you mean 'typeof Image'? + + +==== foo.js (1 errors) ==== + /** @param {Image} image */ + ~~~~~ +!!! error TS2749: 'Image' refers to a value, but is being used as a type here. Did you mean 'typeof Image'? + function process(image) { + return new image(1, 1) + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.types index 3d0eab1009..4a2961cc36 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToValue.types @@ -3,12 +3,12 @@ === foo.js === /** @param {Image} image */ function process(image) { ->process : (image: any) => any ->image : any +>process : (image: Image) => any +>image : Image return new image(1, 1) >new image(1, 1) : any ->image : any +>image : Image >1 : 1 >1 : 1 } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceUseBeforeDef.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceUseBeforeDef.types index b75db888d1..b70447a0bb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceUseBeforeDef.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceUseBeforeDef.types @@ -3,7 +3,7 @@ === bug25097.js === /** @type {C | null} */ const c = null ->c : any +>c : C class C { >C : C diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt new file mode 100644 index 0000000000..8ef37b875d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt @@ -0,0 +1,131 @@ +a.js(19,12): error TS2304: Cannot find name 'Void'. +a.js(25,12): error TS2304: Cannot find name 'Undefined'. +a.js(31,12): error TS2304: Cannot find name 'Null'. +a.js(37,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). +a.js(40,12): error TS2552: Cannot find name 'array'. Did you mean 'Array'? +a.js(43,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +a.js(46,12): error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? +b.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. +b.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. +b.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. +b.ts(18,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. + + +==== a.js (7 errors) ==== + /** @type {String} */ + var S; + + /** @type {string} */ + var s; + + /** @type {Number} */ + var N; + + /** @type {number} */ + var n; + + /** @type {Boolean} */ + var B; + + /** @type {boolean} */ + var b; + + /** @type {Void} */ + ~~~~ +!!! error TS2304: Cannot find name 'Void'. + var V; + + /** @type {void} */ + var v; + + /** @type {Undefined} */ + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'Undefined'. + var U; + + /** @type {undefined} */ + var u; + + /** @type {Null} */ + ~~~~ +!!! error TS2304: Cannot find name 'Null'. + var Nl; + + /** @type {null} */ + var nl; + + /** @type {Array} */ + ~~~~~ +!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + var A; + + /** @type {array} */ + ~~~~~ +!!! error TS2552: Cannot find name 'array'. Did you mean 'Array'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Array' is declared here. + var a; + + /** @type {Promise} */ + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + var P; + + /** @type {promise} */ + ~~~~~~~ +!!! error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? + var p; + + /** @type {?number} */ + var nullable; + + /** @type {Object} */ + var Obj; + + /** @type {object} */ + var obj; + + /** @type {Function} */ + var Func; + + /** @type {(s: string) => number} */ + var f; + + /** @type {new (s: string) => { s: string }} */ + var ctor; + +==== b.ts (4 errors) ==== + var S: string; + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. +!!! related TS6203 a.js:2:5: 'S' was also declared here. + var s: string; + var N: number; + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. +!!! related TS6203 a.js:8:5: 'N' was also declared here. + var n: number + var B: boolean; + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. +!!! related TS6203 a.js:14:5: 'B' was also declared here. + var b: boolean; + var V :void; + var v: void; + var U: undefined; + var u: undefined; + var Nl: null; + var nl: null; + var A: any[]; + var a: any[]; + var P: Promise; + var p: Promise; + var nullable: number | null; + var Obj: any; + ~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. +!!! related TS6203 a.js:53:5: 'Obj' was also declared here. + var obj: any; + var Func: Function; + var f: (s: string) => number; + var ctor: new (s: string) => { s: string }; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.types index fcf3d57cf5..a7588de06b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.types @@ -3,51 +3,51 @@ === a.js === /** @type {String} */ var S; ->S : any +>S : String /** @type {string} */ var s; ->s : any +>s : string /** @type {Number} */ var N; ->N : any +>N : Number /** @type {number} */ var n; ->n : any +>n : number /** @type {Boolean} */ var B; ->B : any +>B : Boolean /** @type {boolean} */ var b; ->b : any +>b : boolean /** @type {Void} */ var V; ->V : any +>V : Void /** @type {void} */ var v; ->v : any +>v : void /** @type {Undefined} */ var U; ->U : any +>U : Undefined /** @type {undefined} */ var u; ->u : any +>u : undefined /** @type {Null} */ var Nl; ->Nl : any +>Nl : Null /** @type {null} */ var nl; ->nl : any +>nl : null /** @type {Array} */ var A; @@ -55,7 +55,7 @@ var A; /** @type {array} */ var a; ->a : any +>a : array /** @type {Promise} */ var P; @@ -63,15 +63,15 @@ var P; /** @type {promise} */ var p; ->p : any +>p : promise /** @type {?number} */ var nullable; ->nullable : any +>nullable : number | null /** @type {Object} */ var Obj; ->Obj : any +>Obj : Object /** @type {object} */ var obj; @@ -79,83 +79,83 @@ var obj; /** @type {Function} */ var Func; ->Func : any +>Func : Function /** @type {(s: string) => number} */ var f; ->f : any +>f : (s: string) => number /** @type {new (s: string) => { s: string }} */ var ctor; ->ctor : any +>ctor : new (s: string) => { s: string; } === b.ts === var S: string; ->S : any +>S : String var s: string; ->s : any +>s : string var N: number; ->N : any +>N : Number var n: number ->n : any +>n : number var B: boolean; ->B : any +>B : Boolean var b: boolean; ->b : any +>b : boolean var V :void; ->V : any +>V : Void var v: void; ->v : any +>v : void var U: undefined; ->U : any +>U : Undefined var u: undefined; ->u : any +>u : undefined var Nl: null; ->Nl : any +>Nl : Null var nl: null; ->nl : any +>nl : null var A: any[]; >A : any var a: any[]; ->a : any +>a : array var P: Promise; >P : any var p: Promise; ->p : any +>p : promise var nullable: number | null; ->nullable : any +>nullable : number | null var Obj: any; ->Obj : any +>Obj : Object var obj: any; >obj : any var Func: Function; ->Func : any +>Func : Function var f: (s: string) => number; ->f : any +>f : (s: string) => number >s : string var ctor: new (s: string) => { s: string }; ->ctor : any +>ctor : new (s: string) => { s: string; } >s : string >s : string diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt index 1ec09afcfc..2cac730ae2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.errors.txt @@ -1,24 +1,24 @@ -b.js(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. -b.js(4,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. +b.js(4,31): error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. b.js(17,14): error TS2339: Property 'p' does not exist on type 'SomeBase'. b.js(23,14): error TS2339: Property 'x' does not exist on type 'SomeDerived'. b.js(28,14): error TS2339: Property 'q' does not exist on type 'SomeOther'. +b.js(66,15): error TS1228: A type predicate is only allowed in return type position for functions and methods. +b.js(66,38): error TS2454: Variable 'numOrStr' is used before being assigned. +b.js(67,2): error TS2322: Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. +b.js(67,8): error TS2454: Variable 'numOrStr' is used before being assigned. ==== a.ts (0 errors) ==== var W: string; -==== b.js (5 errors) ==== +==== b.js (8 errors) ==== // @ts-check var W = /** @type {string} */(/** @type {*} */ (4)); - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. -!!! related TS6203 a.ts:1:5: 'W' was also declared here. var W = /** @type {string} */(4); // Error - ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. -!!! related TS6203 a.ts:1:5: 'W' was also declared here. + ~ +!!! error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. /** @type {*} */ var a; @@ -87,7 +87,16 @@ b.js(28,14): error TS2339: Property 'q' does not exist on type 'SomeOther'. /** @type {string} */ var str; if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error + ~~~~~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + ~~~~~~~~ +!!! error TS2454: Variable 'numOrStr' is used before being assigned. str = numOrStr; // Error, no narrowing occurred + ~~~ +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~~~~~~~~ +!!! error TS2454: Variable 'numOrStr' is used before being assigned. } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols index ac5f84655a..6fff15f1fa 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols @@ -81,38 +81,47 @@ var someFakeClass = new SomeFakeClass(); someBase = /** @type {SomeBase} */(someDerived); >someBase : Symbol(someBase, Decl(b.js, 37, 3)) +>SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) someBase = /** @type {SomeBase} */(someBase); >someBase : Symbol(someBase, Decl(b.js, 37, 3)) +>SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) >someBase : Symbol(someBase, Decl(b.js, 37, 3)) someBase = /** @type {SomeBase} */(someOther); // Error >someBase : Symbol(someBase, Decl(b.js, 37, 3)) +>SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) >someOther : Symbol(someOther, Decl(b.js, 39, 3)) someDerived = /** @type {SomeDerived} */(someDerived); >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) +>SomeDerived : Symbol(SomeDerived, Decl(b.js, 18, 1)) >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) someDerived = /** @type {SomeDerived} */(someBase); >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) +>SomeDerived : Symbol(SomeDerived, Decl(b.js, 18, 1)) >someBase : Symbol(someBase, Decl(b.js, 37, 3)) someDerived = /** @type {SomeDerived} */(someOther); // Error >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) +>SomeDerived : Symbol(SomeDerived, Decl(b.js, 18, 1)) >someOther : Symbol(someOther, Decl(b.js, 39, 3)) someOther = /** @type {SomeOther} */(someDerived); // Error >someOther : Symbol(someOther, Decl(b.js, 39, 3)) +>SomeOther : Symbol(SomeOther, Decl(b.js, 24, 1)) >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) someOther = /** @type {SomeOther} */(someBase); // Error >someOther : Symbol(someOther, Decl(b.js, 39, 3)) +>SomeOther : Symbol(SomeOther, Decl(b.js, 24, 1)) >someBase : Symbol(someBase, Decl(b.js, 37, 3)) someOther = /** @type {SomeOther} */(someOther); >someOther : Symbol(someOther, Decl(b.js, 39, 3)) +>SomeOther : Symbol(SomeOther, Decl(b.js, 24, 1)) >someOther : Symbol(someOther, Decl(b.js, 39, 3)) someFakeClass = someBase; @@ -129,6 +138,7 @@ someBase = someFakeClass; // Error someBase = /** @type {SomeBase} */(someFakeClass); >someBase : Symbol(someBase, Decl(b.js, 37, 3)) +>SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) >someFakeClass : Symbol(someFakeClass, Decl(b.js, 40, 3)) // Type assertion cannot be a type-predicate type @@ -142,6 +152,7 @@ var str; if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error >numOrStr : Symbol(numOrStr, Decl(b.js, 62, 3)) +>numOrStr : Symbol(numOrStr, Decl(b.js, 62, 3)) >undefined : Symbol(undefined) str = numOrStr; // Error, no narrowing occurred @@ -152,9 +163,11 @@ if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error var asConst1 = /** @type {const} */(1); >asConst1 : Symbol(asConst1, Decl(b.js, 70, 3)) +>const : Symbol(const) var asConst2 = /** @type {const} */({ >asConst2 : Symbol(asConst2, Decl(b.js, 71, 3)) +>const : Symbol(const) x: 1 >x : Symbol(x, Decl(b.js, 71, 37)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols.diff index 336a326137..5e1684c4c8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols.diff @@ -40,3 +40,79 @@ } // Type assertion should check for assignability in either direction +@@= skipped -24, +21 lines =@@ + + someBase = /** @type {SomeBase} */(someDerived); + >someBase : Symbol(someBase, Decl(b.js, 37, 3)) ++>SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) + >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) + + someBase = /** @type {SomeBase} */(someBase); + >someBase : Symbol(someBase, Decl(b.js, 37, 3)) ++>SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) + >someBase : Symbol(someBase, Decl(b.js, 37, 3)) + + someBase = /** @type {SomeBase} */(someOther); // Error + >someBase : Symbol(someBase, Decl(b.js, 37, 3)) ++>SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) + >someOther : Symbol(someOther, Decl(b.js, 39, 3)) + + someDerived = /** @type {SomeDerived} */(someDerived); + >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) ++>SomeDerived : Symbol(SomeDerived, Decl(b.js, 18, 1)) + >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) + + someDerived = /** @type {SomeDerived} */(someBase); + >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) ++>SomeDerived : Symbol(SomeDerived, Decl(b.js, 18, 1)) + >someBase : Symbol(someBase, Decl(b.js, 37, 3)) + + someDerived = /** @type {SomeDerived} */(someOther); // Error + >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) ++>SomeDerived : Symbol(SomeDerived, Decl(b.js, 18, 1)) + >someOther : Symbol(someOther, Decl(b.js, 39, 3)) + + someOther = /** @type {SomeOther} */(someDerived); // Error + >someOther : Symbol(someOther, Decl(b.js, 39, 3)) ++>SomeOther : Symbol(SomeOther, Decl(b.js, 24, 1)) + >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) + + someOther = /** @type {SomeOther} */(someBase); // Error + >someOther : Symbol(someOther, Decl(b.js, 39, 3)) ++>SomeOther : Symbol(SomeOther, Decl(b.js, 24, 1)) + >someBase : Symbol(someBase, Decl(b.js, 37, 3)) + + someOther = /** @type {SomeOther} */(someOther); + >someOther : Symbol(someOther, Decl(b.js, 39, 3)) ++>SomeOther : Symbol(SomeOther, Decl(b.js, 24, 1)) + >someOther : Symbol(someOther, Decl(b.js, 39, 3)) + + someFakeClass = someBase; +@@= skipped -48, +57 lines =@@ + + someBase = /** @type {SomeBase} */(someFakeClass); + >someBase : Symbol(someBase, Decl(b.js, 37, 3)) ++>SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) + >someFakeClass : Symbol(someFakeClass, Decl(b.js, 40, 3)) + + // Type assertion cannot be a type-predicate type +@@= skipped -13, +14 lines =@@ + + if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error + >numOrStr : Symbol(numOrStr, Decl(b.js, 62, 3)) ++>numOrStr : Symbol(numOrStr, Decl(b.js, 62, 3)) + >undefined : Symbol(undefined) + + str = numOrStr; // Error, no narrowing occurred +@@= skipped -10, +11 lines =@@ + + var asConst1 = /** @type {const} */(1); + >asConst1 : Symbol(asConst1, Decl(b.js, 70, 3)) ++>const : Symbol(const) + + var asConst2 = /** @type {const} */({ + >asConst2 : Symbol(asConst2, Decl(b.js, 71, 3)) ++>const : Symbol(const) + + x: 1 + >x : Symbol(x, Decl(b.js, 71, 37)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.types index 0cb37af450..8ae90144ab 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.types @@ -8,13 +8,16 @@ var W: string; // @ts-check var W = /** @type {string} */(/** @type {*} */ (4)); >W : string ->(/** @type {*} */ (4)) : 4 ->(4) : 4 +>(/** @type {*} */ (4)) : string +>(4) : string +>(4) : any +>4 : any >4 : 4 var W = /** @type {string} */(4); // Error >W : string ->(4) : 4 +>(4) : string +>4 : string >4 : 4 /** @type {*} */ @@ -23,20 +26,22 @@ var a; /** @type {string} */ var s; ->s : any +>s : string var a = /** @type {*} */("" + 4); >a : any ->("" + 4) : string +>("" + 4) : any +>"" + 4 : any >"" + 4 : string >"" : "" >4 : 4 var s = "" + /** @type {*} */(4); ->s : any +>s : string >"" + /** @type {*} */(4) : string >"" : "" ->(4) : 4 +>(4) : any +>4 : any >4 : 4 class SomeBase { @@ -115,9 +120,10 @@ var someFakeClass = new SomeFakeClass(); >SomeFakeClass : () => void someBase = /** @type {SomeBase} */(someDerived); ->someBase = /** @type {SomeBase} */(someDerived) : SomeDerived +>someBase = /** @type {SomeBase} */(someDerived) : SomeBase >someBase : SomeBase ->(someDerived) : SomeDerived +>(someDerived) : SomeBase +>someDerived : SomeBase >someDerived : SomeDerived someBase = /** @type {SomeBase} */(someBase); @@ -125,11 +131,13 @@ someBase = /** @type {SomeBase} */(someBase); >someBase : SomeBase >(someBase) : SomeBase >someBase : SomeBase +>someBase : SomeBase someBase = /** @type {SomeBase} */(someOther); // Error ->someBase = /** @type {SomeBase} */(someOther) : SomeOther +>someBase = /** @type {SomeBase} */(someOther) : SomeBase >someBase : SomeBase ->(someOther) : SomeOther +>(someOther) : SomeBase +>someOther : SomeBase >someOther : SomeOther someDerived = /** @type {SomeDerived} */(someDerived); @@ -137,29 +145,34 @@ someDerived = /** @type {SomeDerived} */(someDerived); >someDerived : SomeDerived >(someDerived) : SomeDerived >someDerived : SomeDerived +>someDerived : SomeDerived someDerived = /** @type {SomeDerived} */(someBase); ->someDerived = /** @type {SomeDerived} */(someBase) : SomeBase +>someDerived = /** @type {SomeDerived} */(someBase) : SomeDerived >someDerived : SomeDerived ->(someBase) : SomeBase +>(someBase) : SomeDerived +>someBase : SomeDerived >someBase : SomeBase someDerived = /** @type {SomeDerived} */(someOther); // Error ->someDerived = /** @type {SomeDerived} */(someOther) : SomeOther +>someDerived = /** @type {SomeDerived} */(someOther) : SomeDerived >someDerived : SomeDerived ->(someOther) : SomeOther +>(someOther) : SomeDerived +>someOther : SomeDerived >someOther : SomeOther someOther = /** @type {SomeOther} */(someDerived); // Error ->someOther = /** @type {SomeOther} */(someDerived) : SomeDerived +>someOther = /** @type {SomeOther} */(someDerived) : SomeOther >someOther : SomeOther ->(someDerived) : SomeDerived +>(someDerived) : SomeOther +>someDerived : SomeOther >someDerived : SomeDerived someOther = /** @type {SomeOther} */(someBase); // Error ->someOther = /** @type {SomeOther} */(someBase) : SomeBase +>someOther = /** @type {SomeOther} */(someBase) : SomeOther >someOther : SomeOther ->(someBase) : SomeBase +>(someBase) : SomeOther +>someBase : SomeOther >someBase : SomeBase someOther = /** @type {SomeOther} */(someOther); @@ -167,6 +180,7 @@ someOther = /** @type {SomeOther} */(someOther); >someOther : SomeOther >(someOther) : SomeOther >someOther : SomeOther +>someOther : SomeOther someFakeClass = someBase; >someFakeClass = someBase : SomeBase @@ -184,45 +198,49 @@ someBase = someFakeClass; // Error >someFakeClass : any someBase = /** @type {SomeBase} */(someFakeClass); ->someBase = /** @type {SomeBase} */(someFakeClass) : any +>someBase = /** @type {SomeBase} */(someFakeClass) : SomeBase >someBase : SomeBase ->(someFakeClass) : any +>(someFakeClass) : SomeBase +>someFakeClass : SomeBase >someFakeClass : any // Type assertion cannot be a type-predicate type /** @type {number | string} */ var numOrStr; ->numOrStr : any +>numOrStr : string | number /** @type {string} */ var str; ->str : any +>str : string if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error >(numOrStr === undefined) : boolean >numOrStr === undefined : boolean ->numOrStr : any +>numOrStr === undefined : boolean +>numOrStr : string | number >undefined : undefined str = numOrStr; // Error, no narrowing occurred ->str = numOrStr : any ->str : any ->numOrStr : any +>str = numOrStr : string | number +>str : string +>numOrStr : string | number } var asConst1 = /** @type {const} */(1); ->asConst1 : number +>asConst1 : 1 >(1) : 1 >1 : 1 +>1 : 1 var asConst2 = /** @type {const} */({ ->asConst2 : { x: number; } ->({ x: 1}) : { x: number; } ->{ x: 1} : { x: number; } +>asConst2 : { readonly x: 1; } +>({ x: 1}) : { readonly x: 1; } +>{ x: 1} : { readonly x: 1; } +>{ x: 1} : { readonly x: 1; } x: 1 ->x : number +>x : 1 >1 : 1 }); diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt index 6d33f5168c..4b79a3d468 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt @@ -1,9 +1,13 @@ +a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. a.js(6,12): error TS7006: Parameter 's' implicitly has an 'any' type. -==== a.js (2 errors) ==== +==== a.js (3 errors) ==== /** @type {function(string): void} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const f = (value) => { ~~~~~ !!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.types index 03ebe0a901..fc9b78da8e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.types @@ -3,7 +3,7 @@ === a.js === /** @type {function(string): void} */ const f = (value) => { ->f : (value: any) => void +>f : function >(value) => { value = 1 // should error} : (value: any) => void >value : any diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt index daf530d84c..96a1ffda77 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt @@ -1,3 +1,4 @@ +a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. a.js(5,12): error TS7006: Parameter 's' implicitly has an 'any' type. a.js(8,12): error TS7006: Parameter 's' implicitly has an 'any' type. @@ -5,8 +6,11 @@ a.js(12,1): error TS2554: Expected 1 arguments, but got 0. a.js(13,1): error TS2554: Expected 1 arguments, but got 0. -==== a.js (5 errors) ==== +==== a.js (6 errors) ==== /** @type {function(string): void} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const f = (value) => { ~~~~~ !!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.types index 9d88dc7b3c..9c3065edcb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.types @@ -3,7 +3,7 @@ === a.js === /** @type {function(string): void} */ const f = (value) => { ->f : (value: any) => void +>f : function >(value) => {} : (value: any) => void >value : any @@ -20,8 +20,8 @@ function h(s) { } f() // should error ->f() : void ->f : (value: any) => void +>f() : any +>f : function g() // should error >g() : void diff --git a/testdata/baselines/reference/submodule/conformance/jsdocVariableDeclarationWithTypeAnnotation.types b/testdata/baselines/reference/submodule/conformance/jsdocVariableDeclarationWithTypeAnnotation.types index 51baa75342..cc479bff05 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocVariableDeclarationWithTypeAnnotation.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocVariableDeclarationWithTypeAnnotation.types @@ -3,8 +3,8 @@ === foo.js === /** @type {boolean} */ var /** @type {string} */ x, ->x : any +>x : boolean /** @type {number} */ y; ->y : any +>y : boolean diff --git a/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt new file mode 100644 index 0000000000..908bca4dda --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt @@ -0,0 +1,15 @@ +a.js(2,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + +==== a.js (1 errors) ==== + /** + * @type {function(boolean, string, ...*):void} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + */ + const foo = function (a, b, ...r) { }; + +==== b.ts (0 errors) ==== + foo(false, ''); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.types b/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.types index aa93e280e2..55ec62eca7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.types @@ -5,7 +5,7 @@ * @type {function(boolean, string, ...*):void} */ const foo = function (a, b, ...r) { }; ->foo : (a: any, b: any, ...r: any[]) => void +>foo : function >function (a, b, ...r) { } : (a: any, b: any, ...r: any[]) => void >a : any >b : any @@ -13,8 +13,8 @@ const foo = function (a, b, ...r) { }; === b.ts === foo(false, ''); ->foo(false, '') : void ->foo : (a: any, b: any, ...r: any[]) => void +>foo(false, '') : any +>foo : function >false : false >'' : "" diff --git a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols index ce83e60743..44627e7d25 100644 --- a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols +++ b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols @@ -9,13 +9,22 @@ declare namespace NS { } === linkTagEmit1.js === /** @typedef {number} N */ +>N : Symbol(N, Decl(linkTagEmit1.js, 14, 1)) + /** * @typedef {Object} D1 +>D1 : Symbol(D1, Decl(linkTagEmit1.js, 14, 1)) + * @property {1} e Just link to {@link NS.R} this time +>e : Symbol(e, Decl(linkTagEmit1.js, 14, 1)) + * @property {1} m Wyatt Earp loved {@link N integers} I bet. +>m : Symbol(m, Decl(linkTagEmit1.js, 14, 1)) + */ /** @typedef {number} Z @see N {@link N} */ +>Z : Symbol(Z, Decl(linkTagEmit1.js, 14, 1)) /** * @param {number} integer {@link Z} diff --git a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols.diff b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols.diff new file mode 100644 index 0000000000..aa124be68a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols.diff @@ -0,0 +1,25 @@ +--- old.linkTagEmit1.symbols ++++ new.linkTagEmit1.symbols +@@= skipped -8, +8 lines =@@ + } + === linkTagEmit1.js === + /** @typedef {number} N */ ++>N : Symbol(N, Decl(linkTagEmit1.js, 14, 1)) ++ + /** + * @typedef {Object} D1 ++>D1 : Symbol(D1, Decl(linkTagEmit1.js, 14, 1)) ++ + * @property {1} e Just link to {@link NS.R} this time ++>e : Symbol(e, Decl(linkTagEmit1.js, 14, 1)) ++ + * @property {1} m Wyatt Earp loved {@link N integers} I bet. ++>m : Symbol(m, Decl(linkTagEmit1.js, 14, 1)) ++ + */ + + /** @typedef {number} Z @see N {@link N} */ ++>Z : Symbol(Z, Decl(linkTagEmit1.js, 14, 1)) + + /** + * @param {number} integer {@link Z} diff --git a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.types b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.types index bb442e5264..0f26e10682 100644 --- a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.types +++ b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.types @@ -7,24 +7,33 @@ declare namespace NS { } === linkTagEmit1.js === /** @typedef {number} N */ +>N : number + /** * @typedef {Object} D1 +>D1 : D1 + * @property {1} e Just link to {@link NS.R} this time +>e : any + * @property {1} m Wyatt Earp loved {@link N integers} I bet. +>m : any + */ /** @typedef {number} Z @see N {@link N} */ +>Z : number /** * @param {number} integer {@link Z} */ function computeCommonSourceDirectoryOfFilenames(integer) { ->computeCommonSourceDirectoryOfFilenames : (integer: any) => any ->integer : any +>computeCommonSourceDirectoryOfFilenames : (integer: number) => number +>integer : number return integer + 1 // pls pls pls ->integer + 1 : any ->integer : any +>integer + 1 : number +>integer : number >1 : 1 } diff --git a/testdata/baselines/reference/submodule/conformance/malformedTags.types b/testdata/baselines/reference/submodule/conformance/malformedTags.types index 93bde05262..d8a66740cf 100644 --- a/testdata/baselines/reference/submodule/conformance/malformedTags.types +++ b/testdata/baselines/reference/submodule/conformance/malformedTags.types @@ -7,7 +7,7 @@ * @type Function */ var isArray = Array.isArray; ->isArray : (arg: any) => arg is any[] +>isArray : Function >Array.isArray : (arg: any) => arg is any[] >Array : ArrayConstructor >isArray : (arg: any) => arg is any[] diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment6.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment6.types index 30c84713e9..9d5dbdd72a 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment6.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment6.types @@ -6,34 +6,34 @@ class C { /** @param {number} x */ constructor(x) { ->x : any +>x : number this.x = x ->this.x = x : any +>this.x = x : number >this.x : any >this : this >x : any ->x : any +>x : number this.exports = [x] ->this.exports = [x] : any[] +>this.exports = [x] : number[] >this.exports : any >this : this >exports : any ->[x] : any[] ->x : any +>[x] : number[] +>x : number } /** @param {number} y */ m(y) { ->m : (y: any) => any ->y : any +>m : (y: number) => any +>y : number return this.x + y >this.x + y : any >this.x : any >this : this >x : any ->y : any +>y : number } } function exec() { diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt index 65b4903c8a..bc5363672c 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt @@ -3,7 +3,6 @@ index.ts(3,24): error TS2694: Namespace '"mod"' has no exported member 'AnotherT index.ts(4,24): error TS2694: Namespace '"mod"' has no exported member 'foo'. index.ts(5,24): error TS2694: Namespace '"mod"' has no exported member 'qux'. index.ts(6,24): error TS2694: Namespace '"mod"' has no exported member 'baz'. -index.ts(7,24): error TS2694: Namespace '"mod"' has no exported member 'buz'. index.ts(8,24): error TS2694: Namespace '"mod"' has no exported member 'literal'. index.ts(14,31): error TS2694: Namespace '"mod"' has no exported member 'Thing'. index.ts(15,31): error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. @@ -12,6 +11,19 @@ index.ts(17,31): error TS2694: Namespace '"mod"' has no exported member 'qux'. index.ts(18,31): error TS2694: Namespace '"mod"' has no exported member 'baz'. index.ts(19,31): error TS2694: Namespace '"mod"' has no exported member 'buz'. index.ts(20,31): error TS2694: Namespace '"mod"' has no exported member 'literal'. +main.js(2,28): error TS2694: Namespace '"mod"' has no exported member 'Thing'. +main.js(3,28): error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. +main.js(4,28): error TS2694: Namespace '"mod"' has no exported member 'foo'. +main.js(5,28): error TS2694: Namespace '"mod"' has no exported member 'qux'. +main.js(6,28): error TS2694: Namespace '"mod"' has no exported member 'baz'. +main.js(8,28): error TS2694: Namespace '"mod"' has no exported member 'literal'. +main.js(15,35): error TS2694: Namespace '"mod"' has no exported member 'Thing'. +main.js(16,35): error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. +main.js(17,35): error TS2694: Namespace '"mod"' has no exported member 'foo'. +main.js(18,35): error TS2694: Namespace '"mod"' has no exported member 'qux'. +main.js(19,35): error TS2694: Namespace '"mod"' has no exported member 'baz'. +main.js(20,35): error TS2694: Namespace '"mod"' has no exported member 'buz'. +main.js(21,35): error TS2694: Namespace '"mod"' has no exported member 'literal'. mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -31,15 +43,27 @@ mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install typ baz() { return 5 }, literal: "", } -==== main.js (0 errors) ==== +==== main.js (13 errors) ==== /** * @param {import("./mod").Thing} a + ~~~~~ +!!! error TS2694: Namespace '"mod"' has no exported member 'Thing'. * @param {import("./mod").AnotherThing} b + ~~~~~~~~~~~~ +!!! error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. * @param {import("./mod").foo} c + ~~~ +!!! error TS2694: Namespace '"mod"' has no exported member 'foo'. * @param {import("./mod").qux} d + ~~~ +!!! error TS2694: Namespace '"mod"' has no exported member 'qux'. * @param {import("./mod").baz} e + ~~~ +!!! error TS2694: Namespace '"mod"' has no exported member 'baz'. * @param {import("./mod").buz} f * @param {import("./mod").literal} g + ~~~~~~~ +!!! error TS2694: Namespace '"mod"' has no exported member 'literal'. */ function jstypes(a, b, c, d, e, f, g) { return a.x + b.y + c() + d() + e() + f() + g.length @@ -47,18 +71,32 @@ mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install typ /** * @param {typeof import("./mod").Thing} a + ~~~~~ +!!! error TS2694: Namespace '"mod"' has no exported member 'Thing'. * @param {typeof import("./mod").AnotherThing} b + ~~~~~~~~~~~~ +!!! error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. * @param {typeof import("./mod").foo} c + ~~~ +!!! error TS2694: Namespace '"mod"' has no exported member 'foo'. * @param {typeof import("./mod").qux} d + ~~~ +!!! error TS2694: Namespace '"mod"' has no exported member 'qux'. * @param {typeof import("./mod").baz} e + ~~~ +!!! error TS2694: Namespace '"mod"' has no exported member 'baz'. * @param {typeof import("./mod").buz} f + ~~~ +!!! error TS2694: Namespace '"mod"' has no exported member 'buz'. * @param {typeof import("./mod").literal} g + ~~~~~~~ +!!! error TS2694: Namespace '"mod"' has no exported member 'literal'. */ function jsvalues(a, b, c, d, e, f, g) { return a.length + b.length + c() + d() + e() + f() + g.length } -==== index.ts (14 errors) ==== +==== index.ts (13 errors) ==== function types( a: import('./mod').Thing, ~~~~~ @@ -76,8 +114,6 @@ mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install typ ~~~ !!! error TS2694: Namespace '"mod"' has no exported member 'baz'. f: import('./mod').buz, - ~~~ -!!! error TS2694: Namespace '"mod"' has no exported member 'buz'. g: import('./mod').literal, ~~~~~~~ !!! error TS2694: Namespace '"mod"' has no exported member 'literal'. diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols index 2b7400dd6c..558400d848 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols @@ -116,6 +116,7 @@ function types( f: import('./mod').buz, >f : Symbol(f, Decl(index.ts, 5, 27)) +>buz : Symbol(buz, Decl(mod.js, 12, 1)) g: import('./mod').literal, >g : Symbol(g, Decl(index.ts, 6, 27)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff index 65b0a77627..5c1793231e 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff @@ -70,10 +70,11 @@ f: import('./mod').buz, >f : Symbol(f, Decl(index.ts, 5, 27)) ->buz : Symbol(buz, Decl(mod.js, 4, 4)) ++>buz : Symbol(buz, Decl(mod.js, 12, 1)) g: import('./mod').literal, >g : Symbol(g, Decl(index.ts, 6, 27)) -@@= skipped -21, +20 lines =@@ +@@= skipped -21, +21 lines =@@ a: typeof import('./mod').Thing, >a : Symbol(a, Decl(index.ts, 12, 16)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types index 75020c101b..f44f63f114 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types @@ -20,6 +20,8 @@ function bar() { return 4 } >4 : 4 /** @typedef {() => number} buz */ +>buz : any + module.exports = { >module.exports = { Thing, AnotherThing, foo, qux: bar, baz() { return 5 }, literal: "",} : { Thing: typeof Thing; AnotherThing: typeof AnotherThing; foo: () => number; qux: () => number; baz: () => number; literal: string; } >module.exports : any @@ -59,13 +61,13 @@ module.exports = { * @param {import("./mod").literal} g */ function jstypes(a, b, c, d, e, f, g) { ->jstypes : (a: any, b: any, c: any, d: any, e: any, f: any, g: any) => any +>jstypes : (a: any, b: any, c: any, d: any, e: any, f: () => number, g: any) => any >a : any >b : any >c : any >d : any >e : any ->f : any +>f : () => number >g : any return a.x + b.y + c() + d() + e() + f() + g.length @@ -87,8 +89,8 @@ function jstypes(a, b, c, d, e, f, g) { >d : any >e() : any >e : any ->f() : any ->f : any +>f() : number +>f : () => number >g.length : any >g : any >length : any @@ -141,7 +143,7 @@ function jsvalues(a, b, c, d, e, f, g) { === index.ts === function types( ->types : (a: any, b: any, c: any, d: any, e: any, f: any, g: any) => any +>types : (a: any, b: any, c: any, d: any, e: any, f: () => number, g: any) => any a: import('./mod').Thing, >a : any @@ -159,7 +161,7 @@ function types( >e : any f: import('./mod').buz, ->f : any +>f : () => number g: import('./mod').literal, >g : any @@ -184,8 +186,8 @@ function types( >d : any >e() : any >e : any ->f() : any ->f : any +>f() : number +>f : () => number >g.length : any >g : any >length : any diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportNestedNamespaces.types b/testdata/baselines/reference/submodule/conformance/moduleExportNestedNamespaces.types index 6ba5c1ee31..ea97d76e1d 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportNestedNamespaces.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportNestedNamespaces.types @@ -77,18 +77,18 @@ var classic = new s.Classic() /** @param {s.n.K} c @param {s.Classic} classic */ function f(c, classic) { ->f : (c: any, classic: any) => void ->c : any ->classic : any +>f : (c: K, classic: Classic) => void +>c : K +>classic : Classic c.x >c.x : any ->c : any +>c : K >x : any classic.p >classic.p : any ->classic : any +>classic : Classic >p : any } diff --git a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.errors.txt b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.errors.txt index 6f70960c4a..e71c8f9b2d 100644 --- a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.errors.txt @@ -1,8 +1,11 @@ +bug26693.js(1,15): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. bug26693.js(2,22): error TS2307: Cannot find module 'nope' or its corresponding type declarations. -==== bug26693.js (1 errors) ==== +==== bug26693.js (2 errors) ==== /** @typedef {module:locale} hi */ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. import { nope } from 'nope'; ~~~~~~ !!! error TS2307: Cannot find module 'nope' or its corresponding type declarations. diff --git a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.types b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.types index 1348f93ae0..a9cf0bfb34 100644 --- a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.types +++ b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.types @@ -2,6 +2,8 @@ === bug26693.js === /** @typedef {module:locale} hi */ +> : any + import { nope } from 'nope'; >nope : any diff --git a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols index bad0a065a3..f404fbce17 100644 --- a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols +++ b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols @@ -3,7 +3,11 @@ === /a.js === /** * @typedef Foo +>Foo : Symbol(Foo, Decl(a.js, 8, 26)) + * @property {string} a +>a : Symbol(a, Decl(a.js, 8, 26)) + */ /** diff --git a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols.diff b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols.diff new file mode 100644 index 0000000000..316f1b59e1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols.diff @@ -0,0 +1,14 @@ +--- old.optionalBindingParameters3.symbols ++++ new.optionalBindingParameters3.symbols +@@= skipped -2, +2 lines =@@ + === /a.js === + /** + * @typedef Foo ++>Foo : Symbol(Foo, Decl(a.js, 8, 26)) ++ + * @property {string} a ++>a : Symbol(a, Decl(a.js, 8, 26)) ++ + */ + + /** diff --git a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.types b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.types index bda26722ba..68c1199f1e 100644 --- a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.types +++ b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.types @@ -3,7 +3,11 @@ === /a.js === /** * @typedef Foo +>Foo : Foo + * @property {string} a +>a : any + */ /** diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt new file mode 100644 index 0000000000..c9b3fb4a96 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/overloadTag1.errors.txt @@ -0,0 +1,50 @@ +overloadTag1.js(26,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. + + +==== overloadTag1.js (1 errors) ==== + /** + * @overload + * @param {number} a + * @param {number} b + * @returns {number} + * + * @overload + * @param {string} a + * @param {boolean} b + * @returns {string} + * + * @param {string | number} a + * @param {string | number} b + * @returns {string | number} + */ + export function overloaded(a,b) { + if (typeof a === "string" && typeof b === "string") { + return a + b; + } else if (typeof a === "number" && typeof b === "number") { + return a + b; + } + throw new Error("Invalid arguments"); + } + var o1 = overloaded(1,2) + var o2 = overloaded("zero", "one") + var o3 = overloaded("a",false) + ~~~~~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. + + /** + * @overload + * @param {number} a + * @param {number} b + * @returns {number} + * + * @overload + * @param {string} a + * @param {boolean} b + * @returns {string} + */ + export function uncheckedInternally(a, b) { + return a + b; + } + uncheckedInternally(1,2) + uncheckedInternally("zero", "one") + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag1.types b/testdata/baselines/reference/submodule/conformance/overloadTag1.types index 8738361a21..da3231b55a 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag1.types +++ b/testdata/baselines/reference/submodule/conformance/overloadTag1.types @@ -17,19 +17,19 @@ * @returns {string | number} */ export function overloaded(a,b) { ->overloaded : (a: any, b: any) => string | number ->a : any ->b : any +>overloaded : (a: string | number, b: string | number) => string | number +>a : string | number +>b : string | number if (typeof a === "string" && typeof b === "string") { >typeof a === "string" && typeof b === "string" : boolean >typeof a === "string" : boolean >typeof a : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ->a : any +>a : string | number >"string" : "string" >typeof b === "string" : boolean >typeof b : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ->b : any +>b : string | number >"string" : "string" return a + b; @@ -41,11 +41,11 @@ export function overloaded(a,b) { >typeof a === "number" && typeof b === "number" : boolean >typeof a === "number" : boolean >typeof a : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ->a : any +>a : string | number >"number" : "number" >typeof b === "number" : boolean >typeof b : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ->b : any +>b : string | number >"number" : "number" return a + b; @@ -61,21 +61,21 @@ export function overloaded(a,b) { var o1 = overloaded(1,2) >o1 : string | number >overloaded(1,2) : string | number ->overloaded : (a: any, b: any) => string | number +>overloaded : (a: string | number, b: string | number) => string | number >1 : 1 >2 : 2 var o2 = overloaded("zero", "one") >o2 : string | number >overloaded("zero", "one") : string | number ->overloaded : (a: any, b: any) => string | number +>overloaded : (a: string | number, b: string | number) => string | number >"zero" : "zero" >"one" : "one" var o3 = overloaded("a",false) >o3 : string | number >overloaded("a",false) : string | number ->overloaded : (a: any, b: any) => string | number +>overloaded : (a: string | number, b: string | number) => string | number >"a" : "a" >false : false diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag2.types b/testdata/baselines/reference/submodule/conformance/overloadTag2.types index 4ece744a70..a4d987da70 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag2.types +++ b/testdata/baselines/reference/submodule/conformance/overloadTag2.types @@ -35,14 +35,14 @@ export class Foo { * @param {number | string} a */ constructor(a, b) { ->a : any +>a : string | number >b : any this.#a = a ->this.#a = a : any +>this.#a = a : string | number >this.#a : string | number >this : this ->a : any +>a : string | number this.#b = b >this.#b = b : any diff --git a/testdata/baselines/reference/submodule/conformance/overloadTag3.types b/testdata/baselines/reference/submodule/conformance/overloadTag3.types index 72c9b5f33b..1f7db75036 100644 --- a/testdata/baselines/reference/submodule/conformance/overloadTag3.types +++ b/testdata/baselines/reference/submodule/conformance/overloadTag3.types @@ -5,7 +5,7 @@ * @template T */ export class Foo { ->Foo : Foo +>Foo : Foo /** * @constructor @@ -17,17 +17,17 @@ export class Foo { * @param {T} value */ bar(value) { } ->bar : (value: any) => void ->value : any +>bar : (value: T) => void +>value : T } /** @type {Foo} */ let foo; ->foo : any +>foo : Foo foo = new Foo(); ->foo = new Foo() : Foo ->foo : any ->new Foo() : Foo +>foo = new Foo() : Foo +>foo : Foo +>new Foo() : Foo >Foo : typeof Foo diff --git a/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt b/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt deleted file mode 100644 index bb89418ac5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -a.js(13,1): error TS2554: Expected 3 arguments, but got 0. - - -==== a.js (1 errors) ==== - /** - * @param {number} [p] - * @param {number=} q - * @param {number} [r=101] - */ - function f(p, q, r) { - p = undefined - q = undefined - // note that, unlike TS, JSDOC [r=101] retains | undefined because - // there's no code emitted to get rid of it. - r = undefined - } - f() - ~ -!!! error TS2554: Expected 3 arguments, but got 0. -!!! related TS6210 a.js:6:12: An argument for 'p' was not provided. - f(undefined, undefined, undefined) - f(1, 2, 3) - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.types b/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.types index 6ae6930d0a..d0cc84ac6a 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.types +++ b/testdata/baselines/reference/submodule/conformance/paramTagBracketsAddOptionalUndefined.types @@ -7,42 +7,42 @@ * @param {number} [r=101] */ function f(p, q, r) { ->f : (p: any, q: any, r: any) => void ->p : any ->q : any ->r : any +>f : (p?: number | undefined, q?: number | undefined, r?: number | undefined) => void +>p : number | undefined +>q : number | undefined +>r : number | undefined p = undefined >p = undefined : undefined ->p : any +>p : number | undefined >undefined : undefined q = undefined >q = undefined : undefined ->q : any +>q : number | undefined >undefined : undefined // note that, unlike TS, JSDOC [r=101] retains | undefined because // there's no code emitted to get rid of it. r = undefined >r = undefined : undefined ->r : any +>r : number | undefined >undefined : undefined } f() >f() : void ->f : (p: any, q: any, r: any) => void +>f : (p?: number | undefined, q?: number | undefined, r?: number | undefined) => void f(undefined, undefined, undefined) >f(undefined, undefined, undefined) : void ->f : (p: any, q: any, r: any) => void +>f : (p?: number | undefined, q?: number | undefined, r?: number | undefined) => void >undefined : undefined >undefined : undefined >undefined : undefined f(1, 2, 3) >f(1, 2, 3) : void ->f : (p: any, q: any, r: any) => void +>f : (p?: number | undefined, q?: number | undefined, r?: number | undefined) => void >1 : 1 >2 : 2 >3 : 3 diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt new file mode 100644 index 0000000000..992effe5ec --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.errors.txt @@ -0,0 +1,16 @@ +38572.js(4,39): error TS2304: Cannot find name 'K'. + + +==== 38572.js (1 errors) ==== + /** + * @template T + * @param {T} a + * @param {{[K in keyof T]: (value: T[K]) => void }} b + ~ +!!! error TS2304: Cannot find name 'K'. + */ + function f(a, b) { + } + + f({ x: 42 }, { x(param) { param.toFixed() } }); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.types b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.types index ac9c0da985..b89d468197 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.types +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution2.types @@ -7,22 +7,22 @@ * @param {{[K in keyof T]: (value: T[K]) => void }} b */ function f(a, b) { ->f : (a: any, b: any) => void ->a : any ->b : any +>f : (a: T, b: { [K in keyof T]: (value: T[K]) => void }) => void +>a : T +>b : { [K in keyof T]: (value: T[K]) => void } } f({ x: 42 }, { x(param) { param.toFixed() } }); >f({ x: 42 }, { x(param) { param.toFixed() } }) : void ->f : (a: any, b: any) => void +>f : (a: T, b: { [K in keyof T]: (value: T[K]) => void }) => void >{ x: 42 } : { x: number; } >x : number >42 : 42 ->{ x(param) { param.toFixed() } } : { x: (param: any) => void; } ->x : (param: any) => void ->param : any +>{ x(param) { param.toFixed() } } : { x: (param: K) => void; } +>x : (param: K) => void +>param : K >param.toFixed() : any >param.toFixed : any ->param : any +>param : K >toFixed : any diff --git a/testdata/baselines/reference/submodule/conformance/paramTagWrapping.types b/testdata/baselines/reference/submodule/conformance/paramTagWrapping.types index 28649e313b..dacf722c05 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagWrapping.types +++ b/testdata/baselines/reference/submodule/conformance/paramTagWrapping.types @@ -10,15 +10,15 @@ * Arg z. */ function good(x, y, z) { ->good : (x: any, y: any, z: any) => void ->x : any ->y : any ->z : any +>good : (x: number, y: number, z: number) => void +>x : number +>y : number +>z : number } good(1, 2, 3) >good(1, 2, 3) : void ->good : (x: any, y: any, z: any) => void +>good : (x: number, y: number, z: number) => void >1 : 1 >2 : 2 >3 : 3 diff --git a/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt new file mode 100644 index 0000000000..ccc2bc954c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.errors.txt @@ -0,0 +1,58 @@ +propertiesOfGenericConstructorFunctions.js(14,12): error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? + + +==== propertiesOfGenericConstructorFunctions.js (1 errors) ==== + /** + * @template {string} K + * @template V + * @param {string} ik + * @param {V} iv + */ + function Multimap(ik, iv) { + /** @type {{ [s: string]: V }} */ + this._map = {}; + // without type annotation + this._map2 = { [ik]: iv }; + }; + + /** @type {Multimap<"a" | "b", number>} with type annotation */ + ~~~~~~~~ +!!! error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? + const map = new Multimap("a", 1); + // without type annotation + const map2 = new Multimap("m", 2); + + /** @type {number} */ + var n = map._map['hi'] + /** @type {number} */ + var n = map._map2['hi'] + /** @type {number} */ + var n = map2._map['hi'] + /** @type {number} */ + var n = map._map2['hi'] + + /** + * @class + * @template T + * @param {T} t + */ + function Cp(t) { + this.x = 1 + this.y = t + } + Cp.prototype = { + m1() { return this.x }, + m2() { this.z = this.x + 1; return this.y } + } + var cp = new Cp(1) + + /** @type {number} */ + var n = cp.x + /** @type {number} */ + var n = cp.y + /** @type {number} */ + var n = cp.m1() + /** @type {number} */ + var n = cp.m2() + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.types b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.types index a124bc6d44..ac0d1e4700 100644 --- a/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.types +++ b/testdata/baselines/reference/submodule/conformance/propertiesOfGenericConstructorFunctions.types @@ -8,9 +8,9 @@ * @param {V} iv */ function Multimap(ik, iv) { ->Multimap : (ik: any, iv: any) => void ->ik : any ->iv : any +>Multimap : (ik: string, iv: V) => void +>ik : string +>iv : V /** @type {{ [s: string]: V }} */ this._map = {}; @@ -22,22 +22,22 @@ function Multimap(ik, iv) { // without type annotation this._map2 = { [ik]: iv }; ->this._map2 = { [ik]: iv } : { [x: number]: any; } +>this._map2 = { [ik]: iv } : { [x: string]: V; } >this._map2 : any >this : any >_map2 : any ->{ [ik]: iv } : { [x: number]: any; } ->[ik] : any ->ik : any ->iv : any +>{ [ik]: iv } : { [x: string]: V; } +>[ik] : V +>ik : string +>iv : V }; /** @type {Multimap<"a" | "b", number>} with type annotation */ const map = new Multimap("a", 1); ->map : any +>map : Multimap<"a" | "b", number> >new Multimap("a", 1) : any ->Multimap : (ik: any, iv: any) => void +>Multimap : (ik: string, iv: V) => void >"a" : "a" >1 : 1 @@ -45,31 +45,31 @@ const map = new Multimap("a", 1); const map2 = new Multimap("m", 2); >map2 : any >new Multimap("m", 2) : any ->Multimap : (ik: any, iv: any) => void +>Multimap : (ik: string, iv: V) => void >"m" : "m" >2 : 2 /** @type {number} */ var n = map._map['hi'] ->n : any +>n : number >map._map['hi'] : any >map._map : any ->map : any +>map : Multimap<"a" | "b", number> >_map : any >'hi' : "hi" /** @type {number} */ var n = map._map2['hi'] ->n : any +>n : number >map._map2['hi'] : any >map._map2 : any ->map : any +>map : Multimap<"a" | "b", number> >_map2 : any >'hi' : "hi" /** @type {number} */ var n = map2._map['hi'] ->n : any +>n : number >map2._map['hi'] : any >map2._map : any >map2 : any @@ -78,10 +78,10 @@ var n = map2._map['hi'] /** @type {number} */ var n = map._map2['hi'] ->n : any +>n : number >map._map2['hi'] : any >map._map2 : any ->map : any +>map : Multimap<"a" | "b", number> >_map2 : any >'hi' : "hi" @@ -91,8 +91,8 @@ var n = map._map2['hi'] * @param {T} t */ function Cp(t) { ->Cp : { (t: any): void; prototype: { m1: () => any; m2: () => any; }; } ->t : any +>Cp : { (t: T): void; prototype: { m1: () => any; m2: () => any; }; } +>t : T this.x = 1 >this.x = 1 : 1 @@ -102,16 +102,16 @@ function Cp(t) { >1 : 1 this.y = t ->this.y = t : any +>this.y = t : T >this.y : any >this : any >y : any ->t : any +>t : T } Cp.prototype = { >Cp.prototype = { m1() { return this.x }, m2() { this.z = this.x + 1; return this.y }} : { m1: () => any; m2: () => any; } >Cp.prototype : { m1: () => any; m2: () => any; } ->Cp : { (t: any): void; prototype: { m1: () => any; m2: () => any; }; } +>Cp : { (t: T): void; prototype: { m1: () => any; m2: () => any; }; } >prototype : { m1: () => any; m2: () => any; } >{ m1() { return this.x }, m2() { this.z = this.x + 1; return this.y }} : { m1: () => any; m2: () => any; } @@ -139,26 +139,26 @@ Cp.prototype = { var cp = new Cp(1) >cp : any >new Cp(1) : any ->Cp : { (t: any): void; prototype: { m1: () => any; m2: () => any; }; } +>Cp : { (t: T): void; prototype: { m1: () => any; m2: () => any; }; } >1 : 1 /** @type {number} */ var n = cp.x ->n : any +>n : number >cp.x : any >cp : any >x : any /** @type {number} */ var n = cp.y ->n : any +>n : number >cp.y : any >cp : any >y : any /** @type {number} */ var n = cp.m1() ->n : any +>n : number >cp.m1() : any >cp.m1 : any >cp : any @@ -166,7 +166,7 @@ var n = cp.m1() /** @type {number} */ var n = cp.m2() ->n : any +>n : number >cp.m2() : any >cp.m2 : any >cp : any diff --git a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt new file mode 100644 index 0000000000..16c899bde3 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.errors.txt @@ -0,0 +1,38 @@ +propertyAssignmentUseParentType2.js(2,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. + Types of property 'nuo' are incompatible. + Type 'number' is not assignable to type '789'. +propertyAssignmentUseParentType2.js(6,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. + Types of property 'nuo' are incompatible. + Type 'number' is not assignable to type '789'. +propertyAssignmentUseParentType2.js(11,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. + Types of property 'nuo' are incompatible. + Type 'number' is not assignable to type '789'. + + +==== propertyAssignmentUseParentType2.js (3 errors) ==== + /** @type {{ (): boolean; nuo: 789 }} */ + export const inlined = () => true + ~~~~~~~ +!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. +!!! error TS2322: Types of property 'nuo' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type '789'. + inlined.nuo = 789 + + /** @type {{ (): boolean; nuo: 789 }} */ + export const duplicated = () => true + ~~~~~~~~~~ +!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. +!!! error TS2322: Types of property 'nuo' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type '789'. + /** @type {789} */ + duplicated.nuo = 789 + + /** @type {{ (): boolean; nuo: 789 }} */ + export const conflictingDuplicated = () => true + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. +!!! error TS2322: Types of property 'nuo' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type '789'. + /** @type {1000} */ + conflictingDuplicated.nuo = 789 + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols index 5f2b102aed..f0708a96c2 100644 --- a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols +++ b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols @@ -6,7 +6,9 @@ export const inlined = () => true >inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12)) inlined.nuo = 789 +>inlined.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) >inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12)) +>nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) /** @type {{ (): boolean; nuo: 789 }} */ export const duplicated = () => true @@ -14,7 +16,9 @@ export const duplicated = () => true /** @type {789} */ duplicated.nuo = 789 +>duplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) >duplicated : Symbol(duplicated, Decl(propertyAssignmentUseParentType2.js, 5, 12)) +>nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) /** @type {{ (): boolean; nuo: 789 }} */ export const conflictingDuplicated = () => true @@ -22,5 +26,7 @@ export const conflictingDuplicated = () => true /** @type {1000} */ conflictingDuplicated.nuo = 789 +>conflictingDuplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) >conflictingDuplicated : Symbol(conflictingDuplicated, Decl(propertyAssignmentUseParentType2.js, 10, 12)) +>nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) diff --git a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols.diff b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols.diff index 1d99f592e7..4bc4b1c28b 100644 --- a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.symbols.diff @@ -8,10 +8,10 @@ +>inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12)) inlined.nuo = 789 -->inlined.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) + >inlined.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) ->inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12), Decl(propertyAssignmentUseParentType2.js, 1, 33)) -->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) +>inlined : Symbol(inlined, Decl(propertyAssignmentUseParentType2.js, 1, 12)) + >nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 0, 25)) /** @type {{ (): boolean; nuo: 789 }} */ export const duplicated = () => true @@ -20,10 +20,10 @@ /** @type {789} */ duplicated.nuo = 789 -->duplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) + >duplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) ->duplicated : Symbol(duplicated, Decl(propertyAssignmentUseParentType2.js, 5, 12), Decl(propertyAssignmentUseParentType2.js, 5, 36)) -->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) +>duplicated : Symbol(duplicated, Decl(propertyAssignmentUseParentType2.js, 5, 12)) + >nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 4, 25)) /** @type {{ (): boolean; nuo: 789 }} */ export const conflictingDuplicated = () => true @@ -32,8 +32,8 @@ /** @type {1000} */ conflictingDuplicated.nuo = 789 -->conflictingDuplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) + >conflictingDuplicated.nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) ->conflictingDuplicated : Symbol(conflictingDuplicated, Decl(propertyAssignmentUseParentType2.js, 10, 12), Decl(propertyAssignmentUseParentType2.js, 10, 47)) -->nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) +>conflictingDuplicated : Symbol(conflictingDuplicated, Decl(propertyAssignmentUseParentType2.js, 10, 12)) + >nuo : Symbol(nuo, Decl(propertyAssignmentUseParentType2.js, 9, 25)) diff --git a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.types b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.types index 54a0b6710d..3693a89fb3 100644 --- a/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.types +++ b/testdata/baselines/reference/submodule/conformance/propertyAssignmentUseParentType2.types @@ -3,42 +3,42 @@ === propertyAssignmentUseParentType2.js === /** @type {{ (): boolean; nuo: 789 }} */ export const inlined = () => true ->inlined : { (): boolean; nuo: number; } ->() => true : { (): boolean; nuo: number; } +>inlined : { (): boolean; nuo: 789; } +>() => true : { (): true; nuo: number; } >true : true inlined.nuo = 789 >inlined.nuo = 789 : 789 ->inlined.nuo : number ->inlined : { (): boolean; nuo: number; } ->nuo : number +>inlined.nuo : 789 +>inlined : { (): boolean; nuo: 789; } +>nuo : 789 >789 : 789 /** @type {{ (): boolean; nuo: 789 }} */ export const duplicated = () => true ->duplicated : { (): boolean; nuo: number; } ->() => true : { (): boolean; nuo: number; } +>duplicated : { (): boolean; nuo: 789; } +>() => true : { (): true; nuo: number; } >true : true /** @type {789} */ duplicated.nuo = 789 >duplicated.nuo = 789 : 789 ->duplicated.nuo : number ->duplicated : { (): boolean; nuo: number; } ->nuo : number +>duplicated.nuo : 789 +>duplicated : { (): boolean; nuo: 789; } +>nuo : 789 >789 : 789 /** @type {{ (): boolean; nuo: 789 }} */ export const conflictingDuplicated = () => true ->conflictingDuplicated : { (): boolean; nuo: number; } ->() => true : { (): boolean; nuo: number; } +>conflictingDuplicated : { (): boolean; nuo: 789; } +>() => true : { (): true; nuo: number; } >true : true /** @type {1000} */ conflictingDuplicated.nuo = 789 >conflictingDuplicated.nuo = 789 : 789 ->conflictingDuplicated.nuo : number ->conflictingDuplicated : { (): boolean; nuo: number; } ->nuo : number +>conflictingDuplicated.nuo : 789 +>conflictingDuplicated : { (): boolean; nuo: 789; } +>nuo : 789 >789 : 789 diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt index 2ac8d5ec6b..29eab95b99 100644 --- a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt @@ -1,3 +1,5 @@ +other.js(2,11): error TS2503: Cannot find namespace 'Ns'. +other.js(7,11): error TS2503: Cannot find namespace 'Ns'. prototypePropertyAssignmentMergeAcrossFiles2.js(2,4): error TS2339: Property 'One' does not exist on type '{}'. prototypePropertyAssignmentMergeAcrossFiles2.js(3,4): error TS2339: Property 'Two' does not exist on type '{}'. prototypePropertyAssignmentMergeAcrossFiles2.js(5,4): error TS2339: Property 'One' does not exist on type '{}'. @@ -23,14 +25,18 @@ prototypePropertyAssignmentMergeAcrossFiles2.js(8,4): error TS2339: Property 'Tw !!! error TS2339: Property 'Two' does not exist on type '{}'. } -==== other.js (0 errors) ==== +==== other.js (2 errors) ==== /** * @type {Ns.One} + ~~ +!!! error TS2503: Cannot find namespace 'Ns'. */ var one; one.wat; /** * @type {Ns.Two} + ~~ +!!! error TS2503: Cannot find namespace 'Ns'. */ var two; two.wat; diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.types b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.types index 70342f12e8..e174c55c41 100644 --- a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.types +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergeAcrossFiles2.types @@ -47,21 +47,21 @@ Ns.Two.prototype = { * @type {Ns.One} */ var one; ->one : any +>one : One one.wat; >one.wat : any ->one : any +>one : One >wat : any /** * @type {Ns.Two} */ var two; ->two : any +>two : Two two.wat; >two.wat : any ->two : any +>two : Two >wat : any diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt new file mode 100644 index 0000000000..fcf4d43ce1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt @@ -0,0 +1,21 @@ +prototypePropertyAssignmentMergedTypeReference.js(7,22): error TS2749: 'f' refers to a value, but is being used as a type here. Did you mean 'typeof f'? +prototypePropertyAssignmentMergedTypeReference.js(8,5): error TS2322: Type '() => number' is not assignable to type 'new () => f'. + Type '() => number' provides no match for the signature 'new (): f'. + + +==== prototypePropertyAssignmentMergedTypeReference.js (2 errors) ==== + var f = function() { + return 12; + }; + + f.prototype.a = "a"; + + /** @type {new () => f} */ + ~ +!!! error TS2749: 'f' refers to a value, but is being used as a type here. Did you mean 'typeof f'? + var x = f; + ~ +!!! error TS2322: Type '() => number' is not assignable to type 'new () => f'. +!!! error TS2322: Type '() => number' provides no match for the signature 'new (): f'. + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.types b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.types index 4280178c41..00bc5dad5a 100644 --- a/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.types +++ b/testdata/baselines/reference/submodule/conformance/prototypePropertyAssignmentMergedTypeReference.types @@ -21,7 +21,7 @@ f.prototype.a = "a"; /** @type {new () => f} */ var x = f; ->x : () => number +>x : new () => f >f : () => number diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt new file mode 100644 index 0000000000..af20fbb5f1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.errors.txt @@ -0,0 +1,64 @@ +bug39372.js(1,36): error TS2456: Type alias 'JsonArray' circularly references itself. +bug39372.js(3,88): error TS2456: Type alias 'Json' circularly references itself. +bug39372.js(9,17): error TS2304: Cannot find name 'T'. +bug39372.js(9,32): error TS2304: Cannot find name 'T'. +bug39372.js(12,17): error TS2304: Cannot find name 'T'. +bug39372.js(14,10): error TS2304: Cannot find name 'T'. +bug39372.js(14,55): error TS2304: Cannot find name 'T'. +bug39372.js(18,15): error TS2304: Cannot find name 'T'. +bug39372.js(19,5): error TS2304: Cannot find name 'T'. +bug39372.js(20,19): error TS2304: Cannot find name 'T'. +bug39372.js(25,7): error TS2322: Type '{}' is not assignable to type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; } & { [x: string]: string | { $A: { [x: string]: (??? & ???)[]; }; $O: { [x: string]: { $$?: Record; } & (??? | ??? & ???); }; $$?: Record; } & ???; }'. + Type '{}' is missing the following properties from type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; }': $A, $O + + +==== bug39372.js (11 errors) ==== + /** @typedef {ReadonlyArray} JsonArray */ + ~~~~~~~~~ +!!! error TS2456: Type alias 'JsonArray' circularly references itself. + /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ + /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ + ~~~~ +!!! error TS2456: Type alias 'Json' circularly references itself. + + /** + * @template T + * @typedef {{ + $A: { + [K in keyof T]?: XMLObject[] + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'T'. + }, + $O: { + [K in keyof T]?: { + ~ +!!! error TS2304: Cannot find name 'T'. + $$?: Record + } & (T[K] extends string ? {$:string} : XMLObject) + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'T'. + }, + $$?: Record, + } & { + [K in keyof T]?: ( + ~ +!!! error TS2304: Cannot find name 'T'. + T[K] extends string ? string + ~ +!!! error TS2304: Cannot find name 'T'. + : XMLObject + ~ +!!! error TS2304: Cannot find name 'T'. + ) + }} XMLObject */ + + /** @type {XMLObject<{foo:string}>} */ + const p = {}; + ~ +!!! error TS2322: Type '{}' is not assignable to type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; } & { [x: string]: string | { $A: { [x: string]: (??? & ???)[]; }; $O: { [x: string]: { $$?: Record; } & (??? | ??? & ???); }; $$?: Record; } & ???; }'. +!!! error TS2322: Type '{}' is missing the following properties from type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; }': $A, $O + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols index ad8ecb807c..5bf80899b6 100644 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols @@ -3,15 +3,15 @@ === bug39372.js === /** @typedef {ReadonlyArray} JsonArray */ >ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --)) ->Json : Symbol(Json) +>Json : Symbol(Json, Decl(bug39372.js, 24, 13)) /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ >key : Symbol(key, Decl(bug39372.js, 1, 26)) ->Json : Symbol(Json) +>Json : Symbol(Json, Decl(bug39372.js, 24, 13)) /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ ->JsonRecord : Symbol(JsonRecord) ->JsonArray : Symbol(JsonArray) +>JsonRecord : Symbol(JsonRecord, Decl(bug39372.js, 24, 13)) +>JsonArray : Symbol(JsonArray, Decl(bug39372.js, 24, 13)) /** * @template T @@ -22,7 +22,7 @@ [K in keyof T]?: XMLObject[] >K : Symbol(K, Decl(bug39372.js, 8, 5)) >T : Symbol(T) ->XMLObject : Symbol(XMLObject) +>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 24, 13)) >T : Symbol(T) >K : Symbol(K, Decl(bug39372.js, 8, 5)) @@ -42,7 +42,7 @@ >T : Symbol(T) >K : Symbol(K, Decl(bug39372.js, 11, 5)) >$ : Symbol($, Decl(bug39372.js, 13, 32)) ->XMLObject : Symbol(XMLObject) +>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 24, 13)) >T : Symbol(T) >K : Symbol(K, Decl(bug39372.js, 11, 5)) @@ -61,7 +61,7 @@ >K : Symbol(K, Decl(bug39372.js, 17, 3)) : XMLObject ->XMLObject : Symbol(XMLObject) +>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 24, 13)) >T : Symbol(T) >K : Symbol(K, Decl(bug39372.js, 17, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff index 75728fa5dc..e07255cdb2 100644 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff @@ -5,15 +5,15 @@ === bug39372.js === /** @typedef {ReadonlyArray} JsonArray */ +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --)) -+>Json : Symbol(Json) ++>Json : Symbol(Json, Decl(bug39372.js, 24, 13)) + /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ +>key : Symbol(key, Decl(bug39372.js, 1, 26)) -+>Json : Symbol(Json) ++>Json : Symbol(Json, Decl(bug39372.js, 24, 13)) + /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ -+>JsonRecord : Symbol(JsonRecord) -+>JsonArray : Symbol(JsonArray) ++>JsonRecord : Symbol(JsonRecord, Decl(bug39372.js, 24, 13)) ++>JsonArray : Symbol(JsonArray, Decl(bug39372.js, 24, 13)) /** * @template T @@ -24,7 +24,7 @@ [K in keyof T]?: XMLObject[] +>K : Symbol(K, Decl(bug39372.js, 8, 5)) +>T : Symbol(T) -+>XMLObject : Symbol(XMLObject) ++>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 24, 13)) +>T : Symbol(T) +>K : Symbol(K, Decl(bug39372.js, 8, 5)) + @@ -44,7 +44,7 @@ +>T : Symbol(T) +>K : Symbol(K, Decl(bug39372.js, 11, 5)) +>$ : Symbol($, Decl(bug39372.js, 13, 32)) -+>XMLObject : Symbol(XMLObject) ++>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 24, 13)) +>T : Symbol(T) +>K : Symbol(K, Decl(bug39372.js, 11, 5)) + @@ -63,7 +63,7 @@ +>K : Symbol(K, Decl(bug39372.js, 17, 3)) + : XMLObject -+>XMLObject : Symbol(XMLObject) ++>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 24, 13)) +>T : Symbol(T) +>K : Symbol(K, Decl(bug39372.js, 17, 3)) + diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.types b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.types index d9bc2172ac..36970d4b65 100644 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.types +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.types @@ -2,8 +2,14 @@ === bug39372.js === /** @typedef {ReadonlyArray} JsonArray */ +>JsonArray : any + /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ +>JsonRecord : any +>key : string + /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ +>Json : any /** * @template T @@ -23,9 +29,10 @@ : XMLObject ) }} XMLObject */ +>XMLObject : any /** @type {XMLObject<{foo:string}>} */ const p = {}; ->p : {} +>p : { $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; } & { [x: string]: string | { $A: { [x: string]: (??? & ???)[]; }; $O: { [x: string]: { $$?: Record; } & (??? | ??? & ???); }; $$?: Record; } & ???; } >{} : {} diff --git a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt index 3b7364ece6..d052558419 100644 --- a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.errors.txt @@ -1,8 +1,10 @@ bug25127.js(3,14): error TS2339: Property 'c' does not exist on type 'Entry'. bug25127.js(15,14): error TS2339: Property 'd' does not exist on type 'Group'. +bug25127.js(27,41): error TS2339: Property 'c' does not exist on type 'Entry'. +bug25127.js(27,51): error TS2339: Property 'd' does not exist on type 'Group'. -==== bug25127.js (2 errors) ==== +==== bug25127.js (4 errors) ==== class Entry { constructor() { this.c = 1 @@ -34,6 +36,10 @@ bug25127.js(15,14): error TS2339: Property 'd' does not exist on type 'Group'. /** @param {Entry | Group} chunk */ function f(chunk) { let x = chunk.isInit(chunk) ? chunk.c : chunk.d + ~ +!!! error TS2339: Property 'c' does not exist on type 'Entry'. + ~ +!!! error TS2339: Property 'd' does not exist on type 'Group'. return x } diff --git a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols index 15303022d0..62dda0ebe8 100644 --- a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols +++ b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols @@ -44,7 +44,9 @@ function f(chunk) { let x = chunk.isInit(chunk) ? chunk.c : chunk.d >x : Symbol(x, Decl(bug25127.js, 26, 7)) +>chunk.isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) +>isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) diff --git a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols.diff b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols.diff index 954ef40c70..1d4c21c5a9 100644 --- a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.symbols.diff @@ -36,13 +36,9 @@ >x : Symbol(x, Decl(bug25127.js, 20, 11)) return false -@@= skipped -22, +20 lines =@@ - - let x = chunk.isInit(chunk) ? chunk.c : chunk.d - >x : Symbol(x, Decl(bug25127.js, 26, 7)) -->chunk.isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) +@@= skipped -26, +24 lines =@@ >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) -->isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) + >isInit : Symbol(isInit, Decl(bug25127.js, 3, 5), Decl(bug25127.js, 15, 5)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) ->chunk.c : Symbol(Entry.c, Decl(bug25127.js, 1, 19)) >chunk : Symbol(chunk, Decl(bug25127.js, 25, 11)) diff --git a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.types b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.types index e7f1e04775..b288c328ad 100644 --- a/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.types +++ b/testdata/baselines/reference/submodule/conformance/returnTagTypeGuard.types @@ -17,7 +17,7 @@ class Entry { * @return {this is Entry} */ isInit(x) { ->isInit : (x: any) => boolean +>isInit : (x: any) => this is Entry >x : any return true @@ -40,7 +40,7 @@ class Group { * @return {false} */ isInit(x) { ->isInit : (x: any) => boolean +>isInit : (x: any) => false >x : any return false @@ -49,22 +49,22 @@ class Group { } /** @param {Entry | Group} chunk */ function f(chunk) { ->f : (chunk: any) => any ->chunk : any +>f : (chunk: Entry | Group) => any +>chunk : Entry | Group let x = chunk.isInit(chunk) ? chunk.c : chunk.d >x : any >chunk.isInit(chunk) ? chunk.c : chunk.d : any ->chunk.isInit(chunk) : any ->chunk.isInit : any ->chunk : any ->isInit : any ->chunk : any +>chunk.isInit(chunk) : boolean +>chunk.isInit : (x: any) => this is Entry | (x: any) => false +>chunk : Entry | Group +>isInit : (x: any) => this is Entry | (x: any) => false +>chunk : Entry | Group >chunk.c : any ->chunk : any +>chunk : Entry >c : any >chunk.d : any ->chunk : any +>chunk : Group >d : any return x @@ -88,13 +88,13 @@ function isBoolean(value) { /** @param {boolean | number} val */ function foo(val) { ->foo : (val: any) => void ->val : any +>foo : (val: number | boolean) => void +>val : number | boolean if (isBoolean(val)) { >isBoolean(val) : boolean >isBoolean : (value: any) => value is boolean ->val : any +>val : number | boolean val; >val : boolean @@ -118,13 +118,13 @@ function isNumber(x) { return typeof x === "number" } /** @param {unknown} x */ function g(x) { ->g : (x: any) => void ->x : any +>g : (x: unknown) => void +>x : unknown if (isNumber(x)) { >isNumber(x) : boolean >isNumber : (x: any) => x is number ->x : any +>x : unknown x * 2; >x * 2 : number diff --git a/testdata/baselines/reference/submodule/conformance/seeTag4.types b/testdata/baselines/reference/submodule/conformance/seeTag4.types index 3d11dc5b50..3ca51fe2f0 100644 --- a/testdata/baselines/reference/submodule/conformance/seeTag4.types +++ b/testdata/baselines/reference/submodule/conformance/seeTag4.types @@ -3,6 +3,8 @@ === seeTag4.js === /** * @typedef {any} A +>A : any + */ /** diff --git a/testdata/baselines/reference/submodule/conformance/syntaxErrors.types b/testdata/baselines/reference/submodule/conformance/syntaxErrors.types index cd06fcf234..52e43cddb3 100644 --- a/testdata/baselines/reference/submodule/conformance/syntaxErrors.types +++ b/testdata/baselines/reference/submodule/conformance/syntaxErrors.types @@ -11,10 +11,10 @@ declare class C { t: T } // @ts-ignore /** @param {C.} skipped */ function f(x, y, skipped) { ->f : (x: any, y: any, skipped: any) => any +>f : (x: any, y: any, skipped: C) => any >x : any >y : any ->skipped : any +>skipped : C return x.t + y.t; >x.t + y.t : any @@ -28,7 +28,7 @@ function f(x, y, skipped) { var x = f({ t: 1000 }, { t: 3000 }, { t: 5000 }); >x : any >f({ t: 1000 }, { t: 3000 }, { t: 5000 }) : any ->f : (x: any, y: any, skipped: any) => any +>f : (x: any, y: any, skipped: C) => any >{ t: 1000 } : { t: number; } >t : number >1000 : 1000 diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt index e0215e5259..3675effd28 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt @@ -1,7 +1,9 @@ +templateInsideCallback.js(15,11): error TS2304: Cannot find name 'Call'. +templateInsideCallback.js(15,16): error TS2304: Cannot find name 'T'. templateInsideCallback.js(17,18): error TS7006: Parameter 'x' implicitly has an 'any' type. -==== templateInsideCallback.js (1 errors) ==== +==== templateInsideCallback.js (3 errors) ==== /** * @typedef Oops * @template T @@ -17,6 +19,10 @@ templateInsideCallback.js(17,18): error TS7006: Parameter 'x' implicitly has an /** * @template T * @type {Call} + ~~~~ +!!! error TS2304: Cannot find name 'Call'. + ~ +!!! error TS2304: Cannot find name 'T'. */ const identity = x => x; ~ diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols index 241be94711..a961128c84 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols @@ -24,7 +24,11 @@ const identity = x => x; /** * @typedef Nested +>Nested : Symbol(Nested, Decl(templateInsideCallback.js, 53, 1)) + * @property {Object} oh +>oh : Symbol(oh, Decl(templateInsideCallback.js, 53, 1)) + * @property {number} oh.no * @template T * @property {string} oh.noooooo @@ -63,11 +67,15 @@ function flatMap(array, iterable = identity) { for (let i = 0; i < array.length; i += 1) { >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) +>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(templateInsideCallback.js, 46, 17)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); +>result.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(templateInsideCallback.js, 48, 7)) +>push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >iterable : Symbol(iterable, Decl(templateInsideCallback.js, 46, 23)) >array : Symbol(array, Decl(templateInsideCallback.js, 46, 17)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff index 6f68c0bd3d..e5ca168a18 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff @@ -1,18 +1,34 @@ --- old.templateInsideCallback.symbols +++ new.templateInsideCallback.symbols -@@= skipped -62, +62 lines =@@ +@@= skipped -23, +23 lines =@@ + + /** + * @typedef Nested ++>Nested : Symbol(Nested, Decl(templateInsideCallback.js, 53, 1)) ++ + * @property {Object} oh ++>oh : Symbol(oh, Decl(templateInsideCallback.js, 53, 1)) ++ + * @property {number} oh.no + * @template T + * @property {string} oh.noooooo +@@= skipped -39, +43 lines =@@ for (let i = 0; i < array.length; i += 1) { >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) ->array.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>array.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(templateInsideCallback.js, 46, 17)) ->length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) result.push(.../** @type {unknown[]} */(iterable(array[i]))); ->result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) ++>result.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(templateInsideCallback.js, 48, 7)) ->push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) ++>push : Symbol(push, Decl(lib.es5.d.ts, --, --)) >iterable : Symbol(iterable, Decl(templateInsideCallback.js, 46, 23)) >array : Symbol(array, Decl(templateInsideCallback.js, 46, 17)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.types b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.types index 60c05a7b25..43abf90b75 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.types +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.types @@ -18,17 +18,29 @@ * @type {Call} */ const identity = x => x; ->identity : (x: any) => any ->x => x : (x: any) => any +>identity : Call +>x => x : (x: any) => any >x : any >x : any /** * @typedef Nested +>Nested : Nested + * @property {Object} oh +>oh : any + * @property {number} oh.no +>property : any +>oh : any +>no : any + * @template T * @property {string} oh.noooooo +>property : any +>oh : any +>noooooo : any + */ @@ -52,14 +64,14 @@ const identity = x => x; * @returns {unknown[]} */ function flatMap(array, iterable = identity) { ->flatMap : (array: any, iterable?: (x: any) => any) => any[] ->array : any ->iterable : (x: any) => any ->identity : (x: any) => any +>flatMap : (array: unknown[], iterable?: (x: unknown) => unknown) => unknown[] +>array : unknown[] +>iterable : (x: unknown) => unknown +>identity : Call /** @type {unknown[]} */ const result = []; ->result : any[] +>result : unknown[] >[] : never[] for (let i = 0; i < array.length; i += 1) { @@ -67,27 +79,28 @@ function flatMap(array, iterable = identity) { >0 : 0 >i < array.length : boolean >i : number ->array.length : any ->array : any ->length : any +>array.length : number +>array : unknown[] +>length : number >i += 1 : number >i : number >1 : 1 result.push(.../** @type {unknown[]} */(iterable(array[i]))); >result.push(.../** @type {unknown[]} */(iterable(array[i]))) : number ->result.push : (...items: any[]) => number ->result : any[] ->push : (...items: any[]) => number ->.../** @type {unknown[]} */(iterable(array[i])) : any ->(iterable(array[i])) : any ->iterable(array[i]) : any ->iterable : (x: any) => any ->array[i] : any ->array : any +>result.push : (...items: unknown[]) => number +>result : unknown[] +>push : (...items: unknown[]) => number +>.../** @type {unknown[]} */(iterable(array[i])) : unknown +>(iterable(array[i])) : unknown[] +>iterable(array[i]) : unknown[] +>iterable(array[i]) : unknown +>iterable : (x: unknown) => unknown +>array[i] : unknown +>array : unknown[] >i : number } return result; ->result : any[] +>result : unknown[] } diff --git a/testdata/baselines/reference/submodule/conformance/thisPropertyAssignmentInherited.types b/testdata/baselines/reference/submodule/conformance/thisPropertyAssignmentInherited.types index e1c5cc7591..c2d9c2495b 100644 --- a/testdata/baselines/reference/submodule/conformance/thisPropertyAssignmentInherited.types +++ b/testdata/baselines/reference/submodule/conformance/thisPropertyAssignmentInherited.types @@ -8,14 +8,14 @@ export class Element { * @returns {String} */ get textContent() { ->textContent : string +>textContent : String return '' >'' : "" } set textContent(x) {} ->textContent : string ->x : string +>textContent : String +>x : String cloneNode() { return this} >cloneNode : () => this @@ -30,19 +30,19 @@ export class TextElement extends HTMLElement { >HTMLElement : HTMLElement get innerHTML() { return this.textContent; } ->innerHTML : string ->this.textContent : string +>innerHTML : String +>this.textContent : String >this : this ->textContent : string +>textContent : String set innerHTML(html) { this.textContent = html; } ->innerHTML : string ->html : string ->this.textContent = html : string ->this.textContent : string +>innerHTML : String +>html : String +>this.textContent = html : String +>this.textContent : String >this : this ->textContent : string ->html : string +>textContent : String +>html : String toString() { >toString : () => void diff --git a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols index 13f51a6f5c..123d62d3cd 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols +++ b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols @@ -10,7 +10,9 @@ function f(s) { >s : Symbol(s, Decl(a.js, 4, 11)) return this.n + s.length +>s.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(a.js, 4, 11)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) } const o = { diff --git a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff index 50e7f941ca..2c28611217 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/thisTag1.symbols.diff @@ -8,8 +8,10 @@ ->this : Symbol(this) ->n : Symbol(n, Decl(a.js, 0, 12)) ->s.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ++>s.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(a.js, 4, 11)) ->length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) } const o = { diff --git a/testdata/baselines/reference/submodule/conformance/thisTag1.types b/testdata/baselines/reference/submodule/conformance/thisTag1.types index 8b5ae4145d..9643db11d1 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag1.types +++ b/testdata/baselines/reference/submodule/conformance/thisTag1.types @@ -6,34 +6,34 @@ * @return {number} */ function f(s) { ->f : (s: any) => any ->s : any +>f : (s: string) => number +>s : string return this.n + s.length >this.n + s.length : any >this.n : any >this : any >n : any ->s.length : any ->s : any ->length : any +>s.length : number +>s : string +>length : number } const o = { ->o : { f: (s: any) => any; n: number; } ->{ f, n: 1} : { f: (s: any) => any; n: number; } +>o : { f: (s: string) => number; n: number; } +>{ f, n: 1} : { f: (s: string) => number; n: number; } f, ->f : (s: any) => any +>f : (s: string) => number n: 1 >n : number >1 : 1 } o.f('hi') ->o.f('hi') : any ->o.f : (s: any) => any ->o : { f: (s: any) => any; n: number; } ->f : (s: any) => any +>o.f('hi') : number +>o.f : (s: string) => number +>o : { f: (s: string) => number; n: number; } +>f : (s: string) => number >'hi' : "hi" diff --git a/testdata/baselines/reference/submodule/conformance/thisTag3.types b/testdata/baselines/reference/submodule/conformance/thisTag3.types index ba47264596..3647527785 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag3.types +++ b/testdata/baselines/reference/submodule/conformance/thisTag3.types @@ -3,6 +3,10 @@ === /a.js === /** * @typedef {{fn(a: string): void}} T +>T : any +>fn : (a: string) => void +>a : string + */ class C { @@ -13,15 +17,15 @@ class C { * @param {string} a */ p = (a) => this.fn("" + a); ->p : (a: any) => any ->(a) => this.fn("" + a) : (a: any) => any ->a : any +>p : (a: string) => any +>(a) => this.fn("" + a) : (a: string) => any +>a : string >this.fn("" + a) : any >this.fn : any >this : this >fn : any >"" + a : string >"" : "" ->a : any +>a : string } diff --git a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt new file mode 100644 index 0000000000..0961be452d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.errors.txt @@ -0,0 +1,61 @@ +thisTypeOfConstructorFunctions.js(15,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface. +thisTypeOfConstructorFunctions.js(38,12): error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? +thisTypeOfConstructorFunctions.js(41,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? +thisTypeOfConstructorFunctions.js(43,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? + + +==== thisTypeOfConstructorFunctions.js (4 errors) ==== + /** + * @class + * @template T + * @param {T} t + */ + function Cp(t) { + /** @type {this} */ + this.dit = this + this.y = t + /** @return {this} */ + this.m3 = () => this + } + + Cp.prototype = { + /** @return {this} */ + ~~~~ +!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. + m4() { + this.z = this.y; return this + } + } + + /** + * @class + * @template T + * @param {T} t + */ + function Cpp(t) { + this.y = t + } + /** @return {this} */ + Cpp.prototype.m2 = function () { + this.z = this.y; return this + } + + var cp = new Cp(1) + var cpp = new Cpp(2) + cp.dit + + /** @type {Cpp} */ + ~~~ +!!! error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? + var cppn = cpp.m2() + + /** @type {Cp} */ + ~~ +!!! error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? + var cpn = cp.m3() + /** @type {Cp} */ + ~~ +!!! error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? + var cpn = cp.m4() + + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.types b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.types index bbb36e1abf..2af7c44ddc 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.types +++ b/testdata/baselines/reference/submodule/conformance/thisTypeOfConstructorFunctions.types @@ -7,8 +7,8 @@ * @param {T} t */ function Cp(t) { ->Cp : { (t: any): void; prototype: { m4: () => any; }; } ->t : any +>Cp : { (t: T): void; prototype: { m4: () => any; }; } +>t : T /** @type {this} */ this.dit = this @@ -19,11 +19,11 @@ function Cp(t) { >this : any this.y = t ->this.y = t : any +>this.y = t : T >this.y : any >this : any >y : any ->t : any +>t : T /** @return {this} */ this.m3 = () => this @@ -38,7 +38,7 @@ function Cp(t) { Cp.prototype = { >Cp.prototype = { /** @return {this} */ m4() { this.z = this.y; return this }} : { m4: () => any; } >Cp.prototype : { m4: () => any; } ->Cp : { (t: any): void; prototype: { m4: () => any; }; } +>Cp : { (t: T): void; prototype: { m4: () => any; }; } >prototype : { m4: () => any; } >{ /** @return {this} */ m4() { this.z = this.y; return this }} : { m4: () => any; } @@ -64,22 +64,22 @@ Cp.prototype = { * @param {T} t */ function Cpp(t) { ->Cpp : (t: any) => void ->t : any +>Cpp : (t: T) => void +>t : T this.y = t ->this.y = t : any +>this.y = t : T >this.y : any >this : any >y : any ->t : any +>t : T } /** @return {this} */ Cpp.prototype.m2 = function () { >Cpp.prototype.m2 = function () { this.z = this.y; return this} : () => any >Cpp.prototype.m2 : any >Cpp.prototype : any ->Cpp : (t: any) => void +>Cpp : (t: T) => void >prototype : any >m2 : any >function () { this.z = this.y; return this} : () => any @@ -98,13 +98,13 @@ Cpp.prototype.m2 = function () { var cp = new Cp(1) >cp : any >new Cp(1) : any ->Cp : { (t: any): void; prototype: { m4: () => any; }; } +>Cp : { (t: T): void; prototype: { m4: () => any; }; } >1 : 1 var cpp = new Cpp(2) >cpp : any >new Cpp(2) : any ->Cpp : (t: any) => void +>Cpp : (t: T) => void >2 : 2 cp.dit @@ -114,7 +114,7 @@ cp.dit /** @type {Cpp} */ var cppn = cpp.m2() ->cppn : any +>cppn : Cpp >cpp.m2() : any >cpp.m2 : any >cpp : any @@ -122,7 +122,7 @@ var cppn = cpp.m2() /** @type {Cp} */ var cpn = cp.m3() ->cpn : any +>cpn : Cp >cp.m3() : any >cp.m3 : any >cp : any @@ -130,7 +130,7 @@ var cpn = cp.m3() /** @type {Cp} */ var cpn = cp.m4() ->cpn : any +>cpn : Cp >cp.m4() : any >cp.m4 : any >cp : any diff --git a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt deleted file mode 100644 index 204843acf2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.errors.txt +++ /dev/null @@ -1,24 +0,0 @@ -bug25926.js(4,18): error TS7006: Parameter 'n' implicitly has an 'any' type. -bug25926.js(11,27): error TS7006: Parameter 'm' implicitly has an 'any' type. - - -==== bug25926.js (2 errors) ==== - /** @type {{ a(): void; b?(n: number): number; }} */ - const o1 = { - a() { - this.b = n => n; - ~ -!!! error TS7006: Parameter 'n' implicitly has an 'any' type. - } - }; - - /** @type {{ d(): void; e?(n: number): number; f?(n: number): number; g?: number }} */ - const o2 = { - d() { - this.e = this.f = m => this.g || m; - ~ -!!! error TS7006: Parameter 'm' implicitly has an 'any' type. - } - }; - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols index d0f3683e98..4400ed3a9c 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols @@ -9,6 +9,9 @@ const o1 = { >a : Symbol(a, Decl(bug25926.js, 1, 12)) this.b = n => n; +>this.b : Symbol(b, Decl(bug25926.js, 0, 23)) +>this : Symbol((Anonymous type), 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)) } @@ -22,7 +25,16 @@ const o2 = { >d : Symbol(d, Decl(bug25926.js, 8, 12)) this.e = this.f = m => this.g || m; +>this.e : Symbol(e, Decl(bug25926.js, 7, 23)) +>this : Symbol((Anonymous type), Decl(bug25926.js, 7, 11)) +>e : Symbol(e, Decl(bug25926.js, 7, 23)) +>this.f : Symbol(f, Decl(bug25926.js, 7, 46)) +>this : Symbol((Anonymous type), 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((Anonymous type), 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 c79bf20cf8..f39477cc81 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.symbols.diff @@ -1,29 +1,33 @@ --- old.typeFromContextualThisType.symbols +++ new.typeFromContextualThisType.symbols -@@= skipped -8, +8 lines =@@ - >a : Symbol(a, Decl(bug25926.js, 1, 12)) +@@= skipped -9, +9 lines =@@ this.b = n => n; -->this.b : Symbol(b, Decl(bug25926.js, 0, 23)) + >this.b : Symbol(b, Decl(bug25926.js, 0, 23)) ->this : Symbol(__type, Decl(bug25926.js, 0, 11)) ->b : Symbol(b, Decl(bug25926.js, 2, 9)) ++>this : Symbol((Anonymous type), 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, +13 lines =@@ - >d : Symbol(d, Decl(bug25926.js, 8, 12)) +@@= skipped -16, +16 lines =@@ this.e = this.f = m => this.g || m; -->this.e : Symbol(e, Decl(bug25926.js, 7, 23)) + >this.e : Symbol(e, Decl(bug25926.js, 7, 23)) ->this : Symbol(__type, Decl(bug25926.js, 7, 11)) ->e : Symbol(e, Decl(bug25926.js, 9, 9)) -->this.f : Symbol(f, Decl(bug25926.js, 7, 46)) ++>this : Symbol((Anonymous type), 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)) ->f : Symbol(f, Decl(bug25926.js, 10, 16)) ++>this : Symbol((Anonymous type), 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.g : Symbol(g, Decl(bug25926.js, 7, 69)) ->this : Symbol(__type, Decl(bug25926.js, 7, 11)) -->g : Symbol(g, Decl(bug25926.js, 7, 69)) ++>this : Symbol((Anonymous type), 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.types b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.types index 4231bc2eea..9ea3d125f3 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromContextualThisType.types @@ -3,47 +3,47 @@ === bug25926.js === /** @type {{ a(): void; b?(n: number): number; }} */ const o1 = { ->o1 : { a: () => void; } +>o1 : { a: () => void; b?: (n: number) => number | undefined; } >{ a() { this.b = n => n; }} : { a: () => void; } a() { >a : () => void this.b = n => n; ->this.b = n => n : (n: any) => any ->this.b : any ->this : { a: () => void; } ->b : any ->n => n : (n: any) => any ->n : any ->n : any +>this.b = n => n : (n: number) => number +>this.b : (n: number) => number | undefined +>this : { a: () => void; b?: (n: number) => number | undefined; } +>b : (n: number) => number | undefined +>n => n : (n: number) => number +>n : number +>n : number } }; /** @type {{ d(): void; e?(n: number): number; f?(n: number): number; g?: number }} */ const o2 = { ->o2 : { d: () => void; } +>o2 : { d: () => void; e?: (n: number) => number | undefined; f?: (n: number) => number | undefined; g?: number | undefined; } >{ d() { this.e = this.f = m => this.g || m; }} : { d: () => void; } d() { >d : () => void this.e = this.f = m => this.g || m; ->this.e = this.f = m => this.g || m : (m: any) => any ->this.e : any ->this : { d: () => void; } ->e : any ->this.f = m => this.g || m : (m: any) => any ->this.f : any ->this : { d: () => void; } ->f : any ->m => this.g || m : (m: any) => any ->m : any ->this.g || m : any ->this.g : any ->this : { d: () => void; } ->g : any ->m : any +>this.e = this.f = m => this.g || m : (m: number) => number +>this.e : (n: number) => number | undefined +>this : { d: () => void; e?: (n: number) => number | undefined; f?: (n: number) => number | undefined; g?: number | undefined; } +>e : (n: number) => number | undefined +>this.f = m => this.g || m : (m: number) => number +>this.f : (n: number) => number | undefined +>this : { d: () => void; e?: (n: number) => number | undefined; f?: (n: number) => number | undefined; g?: number | undefined; } +>f : (n: number) => number | undefined +>m => this.g || m : (m: number) => number +>m : number +>this.g || m : number +>this.g : number | undefined +>this : { d: () => void; e?: (n: number) => number | undefined; f?: (n: number) => number | undefined; g?: number | undefined; } +>g : number | undefined +>m : number } }; diff --git a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt index 71115a8cff..ecf3829086 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.errors.txt @@ -4,9 +4,9 @@ a.js(29,5): error TS2322: Type '1' is not assignable to type 'null'. a.js(30,5): error TS2322: Type 'true' is not assignable to type 'null'. a.js(31,5): error TS2322: Type '{}' is not assignable to type 'null'. a.js(32,5): error TS2322: Type '"ok"' is not assignable to type 'null'. +a.js(37,5): error TS2322: Type 'string' is not assignable to type 'number'. a.js(40,12): error TS2345: Argument of type '1' is not assignable to parameter of type 'never'. a.js(41,12): error TS2345: Argument of type '"ok"' is not assignable to parameter of type 'never'. -a.js(56,17): error TS7006: Parameter 'v' implicitly has an 'any' type. ==== a.js (9 errors) ==== @@ -59,6 +59,8 @@ a.js(56,17): error TS7006: Parameter 'v' implicitly has an 'any' type. b = 1 b = undefined b = 'error' + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. // l should be any[] l.push(1) @@ -82,8 +84,6 @@ a.js(56,17): error TS7006: Parameter 'v' implicitly has an 'any' type. /** @type {(v: unknown) => v is undefined} */ const isUndef = v => v === undefined; - ~ -!!! error TS7006: Parameter 'v' implicitly has an 'any' type. const e = [1, undefined]; // should be undefined[] diff --git a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.types b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.types index 9d0d60d503..dbcb1afd01 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer.types @@ -124,14 +124,14 @@ a.empty.push('hi') /** @type {number | undefined} */ var n; ->n : any +>n : number | undefined // should get any on parameter initialisers function f(a = null, b = n, l = []) { ->f : (a?: null, b?: any, l?: never[]) => void +>f : (a?: null, b?: number | undefined, l?: never[]) => void >a : null ->b : any ->n : any +>b : number | undefined +>n : number | undefined >l : never[] >[] : never[] @@ -168,17 +168,17 @@ function f(a = null, b = n, l = []) { // b should be number | undefined, not any b = 1 >b = 1 : 1 ->b : any +>b : number | undefined >1 : 1 b = undefined >b = undefined : undefined ->b : any +>b : number | undefined >undefined : undefined b = 'error' >b = 'error' : "error" ->b : any +>b : number | undefined >'error' : "error" // l should be any[] @@ -240,11 +240,11 @@ l.push('ok') /** @type {(v: unknown) => v is undefined} */ const isUndef = v => v === undefined; ->isUndef : (v: any) => boolean ->v => v === undefined : (v: any) => boolean ->v : any +>isUndef : (v: unknown) => v is undefined +>v => v === undefined : (v: unknown) => v is undefined +>v : unknown >v === undefined : boolean ->v : any +>v : unknown >undefined : undefined const e = [1, undefined]; @@ -255,10 +255,10 @@ const e = [1, undefined]; // should be undefined[] const g = e.filter(isUndef); ->g : (number | undefined)[] ->e.filter(isUndef) : (number | undefined)[] +>g : undefined[] +>e.filter(isUndef) : undefined[] >e.filter : { (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => unknown, thisArg?: any): (number | undefined)[]; } >e : (number | undefined)[] >filter : { (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => unknown, thisArg?: any): (number | undefined)[]; } ->isUndef : (v: any) => boolean +>isUndef : (v: unknown) => v is undefined diff --git a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt index 1e19ff1c3f..58532b712f 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.errors.txt @@ -1,8 +1,9 @@ a.js(5,12): error TS7006: Parameter 'a' implicitly has an 'any' type. a.js(5,29): error TS7006: Parameter 'l' implicitly has an 'any[]' type. +a.js(17,5): error TS2322: Type 'string' is not assignable to type 'number'. -==== a.js (2 errors) ==== +==== a.js (3 errors) ==== /** @type {number | undefined} */ var n; @@ -24,6 +25,8 @@ a.js(5,29): error TS7006: Parameter 'l' implicitly has an 'any[]' type. b = 1 b = undefined b = 'error' + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. // l should be any[] l.push(1) diff --git a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.types b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.types index 86a5e073c4..960829fc27 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromJSInitializer4.types @@ -3,14 +3,14 @@ === a.js === /** @type {number | undefined} */ var n; ->n : any +>n : number // should get any on parameter initialisers function f(a = null, b = n, l = []) { ->f : (a?: any, b?: any, l?: any[]) => void +>f : (a?: any, b?: number, l?: any[]) => void >a : any ->b : any ->n : any +>b : number +>n : number >l : any[] >[] : undefined[] @@ -47,17 +47,17 @@ function f(a = null, b = n, l = []) { // b should be number | undefined, not any b = 1 >b = 1 : 1 ->b : any +>b : number >1 : 1 b = undefined >b = undefined : undefined ->b : any +>b : number >undefined : undefined b = 'error' >b = 'error' : "error" ->b : any +>b : number >'error' : "error" // l should be any[] diff --git a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt index acff5629e9..631f5be936 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.errors.txt @@ -1,6 +1,14 @@ +a.js(3,13): error TS2749: 'A' refers to a value, but is being used as a type here. Did you mean 'typeof A'? b-ext.js(3,14): error TS2339: Property 'x' does not exist on type 'B'. +b.js(3,13): error TS2749: 'B' refers to a value, but is being used as a type here. Did you mean 'typeof B'? +c.js(3,13): error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? +d.js(3,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? e-ext.js(3,14): error TS2339: Property 'x' does not exist on type 'E'. +e.js(3,13): error TS2749: 'E' refers to a value, but is being used as a type here. Did you mean 'typeof E'? +f.js(5,13): error TS2749: 'F' refers to a value, but is being used as a type here. Did you mean 'typeof F'? +g.js(5,13): error TS2749: 'G' refers to a value, but is being used as a type here. Did you mean 'typeof G'? h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. +h.js(8,19): error TS2339: Property 'x' does not exist on type 'H'. ==== node.d.ts (0 errors) ==== @@ -12,10 +20,12 @@ h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. this.x = 1; }; -==== a.js (0 errors) ==== +==== a.js (1 errors) ==== const { A } = require("./a-ext"); /** @param {A} p */ + ~ +!!! error TS2749: 'A' refers to a value, but is being used as a type here. Did you mean 'typeof A'? function a(p) { p.x; } ==== b-ext.js (1 errors) ==== @@ -27,10 +37,12 @@ h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. } }; -==== b.js (0 errors) ==== +==== b.js (1 errors) ==== const { B } = require("./b-ext"); /** @param {B} p */ + ~ +!!! error TS2749: 'B' refers to a value, but is being used as a type here. Did you mean 'typeof B'? function b(p) { p.x; } ==== c-ext.js (0 errors) ==== @@ -38,10 +50,12 @@ h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. this.x = 1; } -==== c.js (0 errors) ==== +==== c.js (1 errors) ==== const { C } = require("./c-ext"); /** @param {C} p */ + ~ +!!! error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? function c(p) { p.x; } ==== d-ext.js (0 errors) ==== @@ -49,10 +63,12 @@ h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. this.x = 1; }; -==== d.js (0 errors) ==== +==== d.js (1 errors) ==== const { D } = require("./d-ext"); /** @param {D} p */ + ~ +!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? function d(p) { p.x; } ==== e-ext.js (1 errors) ==== @@ -64,29 +80,35 @@ h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. } } -==== e.js (0 errors) ==== +==== e.js (1 errors) ==== const { E } = require("./e-ext"); /** @param {E} p */ + ~ +!!! error TS2749: 'E' refers to a value, but is being used as a type here. Did you mean 'typeof E'? function e(p) { p.x; } -==== f.js (0 errors) ==== +==== f.js (1 errors) ==== var F = function () { this.x = 1; }; /** @param {F} p */ + ~ +!!! error TS2749: 'F' refers to a value, but is being used as a type here. Did you mean 'typeof F'? function f(p) { p.x; } -==== g.js (0 errors) ==== +==== g.js (1 errors) ==== function G() { this.x = 1; } /** @param {G} p */ + ~ +!!! error TS2749: 'G' refers to a value, but is being used as a type here. Did you mean 'typeof G'? function g(p) { p.x; } -==== h.js (1 errors) ==== +==== h.js (2 errors) ==== class H { constructor() { this.x = 1; @@ -96,4 +118,6 @@ h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. } /** @param {H} p */ - function h(p) { p.x; } \ No newline at end of file + function h(p) { p.x; } + ~ +!!! error TS2339: Property 'x' does not exist on type 'H'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types index 8aeaa9daa3..ebf78ebb4f 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types @@ -35,10 +35,10 @@ const { A } = require("./a-ext"); /** @param {A} p */ function a(p) { p.x; } ->a : (p: any) => void ->p : any +>a : (p: A) => void +>p : A >p.x : any ->p : any +>p : A >x : any === b-ext.js === @@ -68,10 +68,10 @@ const { B } = require("./b-ext"); /** @param {B} p */ function b(p) { p.x; } ->b : (p: any) => void ->p : any +>b : (p: B) => void +>p : B >p.x : any ->p : any +>p : B >x : any === c-ext.js === @@ -95,10 +95,10 @@ const { C } = require("./c-ext"); /** @param {C} p */ function c(p) { p.x; } ->c : (p: any) => void ->p : any +>c : (p: C) => void +>p : C >p.x : any ->p : any +>p : C >x : any === d-ext.js === @@ -124,10 +124,10 @@ const { D } = require("./d-ext"); /** @param {D} p */ function d(p) { p.x; } ->d : (p: any) => void ->p : any +>d : (p: D) => void +>p : D >p.x : any ->p : any +>p : D >x : any === e-ext.js === @@ -153,10 +153,10 @@ const { E } = require("./e-ext"); /** @param {E} p */ function e(p) { p.x; } ->e : (p: any) => void ->p : any +>e : (p: E) => void +>p : E >p.x : any ->p : any +>p : E >x : any === f.js === @@ -175,10 +175,10 @@ var F = function () { /** @param {F} p */ function f(p) { p.x; } ->f : (p: any) => void ->p : any +>f : (p: F) => void +>p : F >p.x : any ->p : any +>p : F >x : any === g.js === @@ -195,10 +195,10 @@ function G() { /** @param {G} p */ function g(p) { p.x; } ->g : (p: any) => void ->p : any +>g : (p: G) => void +>p : G >p.x : any ->p : any +>p : G >x : any === h.js === @@ -217,9 +217,9 @@ class H { /** @param {H} p */ function h(p) { p.x; } ->h : (p: any) => void ->p : any +>h : (p: H) => void +>p : H >p.x : any ->p : any +>p : H >x : any diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPrivatePropertyAssignmentJs.types b/testdata/baselines/reference/submodule/conformance/typeFromPrivatePropertyAssignmentJs.types index add27511ea..3957ca0f84 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPrivatePropertyAssignmentJs.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPrivatePropertyAssignmentJs.types @@ -8,28 +8,28 @@ class C { /** @type {{ foo?: string } | undefined } */ #a; ->#a : any +>#a : { foo?: string; } /** @type {{ foo?: string } | undefined } */ #b; ->#b : any +>#b : { foo?: string; } m() { >m : () => void const a = this.#a || {}; ->a : any ->this.#a || {} : any ->this.#a : any +>a : { foo?: string; } +>this.#a || {} : { foo?: string; } +>this.#a : { foo?: string; } >this : this >{} : {} this.#b = this.#b || {}; ->this.#b = this.#b || {} : any ->this.#b : any +>this.#b = this.#b || {} : { foo?: string; } +>this.#b : { foo?: string; } >this : this ->this.#b || {} : any ->this.#b : any +>this.#b || {} : { foo?: string; } +>this.#b : { foo?: string; } >this : this >{} : {} } diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt index 47fe9440fb..7a0891aa8f 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.errors.txt @@ -1,7 +1,9 @@ a.js(4,7): error TS2339: Property 'Inner' does not exist on type 'typeof O'. +a.js(8,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? +a.js(11,12): error TS2503: Cannot find namespace 'Outer'. -==== a.js (1 errors) ==== +==== a.js (3 errors) ==== var Outer = class O { m(x, y) { } } @@ -12,9 +14,13 @@ a.js(4,7): error TS2339: Property 'Inner' does not exist on type 'typeof O'. } /** @type {Outer} */ + ~~~~~ +!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? var si si.m /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var oi oi.n diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.types index a8bfcd05dd..0b589e5d68 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment.types @@ -27,20 +27,20 @@ Outer.Inner = class I { } /** @type {Outer} */ var si ->si : any +>si : Outer si.m >si.m : any ->si : any +>si : Outer >m : any /** @type {Outer.Inner} */ var oi ->oi : any +>oi : Inner oi.n >oi.n : any ->oi : any +>oi : Inner >n : any diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt index 579073d8b0..12557bce5a 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.errors.txt @@ -1,3 +1,4 @@ +main.js(4,12): error TS2503: Cannot find namespace 'Outer'. someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. @@ -39,11 +40,13 @@ someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. }; return Application; })(); -==== main.js (0 errors) ==== +==== main.js (1 errors) ==== var app = new Outer.app.Application(); var inner = new Outer.app.Inner(); inner.y; /** @type {Outer.app.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var x; x.y; Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.types index 14169a295b..67ced614c7 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10.types @@ -158,11 +158,11 @@ inner.y; /** @type {Outer.app.Inner} */ var x; ->x : any +>x : Inner x.y; >x.y : any ->x : any +>x : Inner >y : any Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt index 9726ce6c15..4c083f927a 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.errors.txt @@ -1,3 +1,4 @@ +main.js(4,12): error TS2503: Cannot find namespace 'Outer'. someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. @@ -39,11 +40,13 @@ someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. }; return Application; })(); -==== main.js (0 errors) ==== +==== main.js (1 errors) ==== var app = new Outer.app.Application(); var inner = new Outer.app.Inner(); inner.y; /** @type {Outer.app.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var x; x.y; Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.types index f829a19665..ddca325660 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment10_1.types @@ -158,11 +158,11 @@ inner.y; /** @type {Outer.app.Inner} */ var x; ->x : any +>x : Inner x.y; >x.y : any ->x : any +>x : Inner >y : any Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt index dc608b527e..aa43d4abec 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.errors.txt @@ -1,3 +1,4 @@ +use.js(1,12): error TS2503: Cannot find namespace 'Outer'. use.js(5,22): error TS2339: Property 'Inner' does not exist on type '{}'. work.js(1,7): error TS2339: Property 'Inner' does not exist on type '{}'. work.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. @@ -17,8 +18,10 @@ work.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. m() { } } -==== use.js (1 errors) ==== +==== use.js (2 errors) ==== /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var inner inner.x inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.types index 2b5bc0f7a6..a1c65551f3 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment14.types @@ -33,17 +33,17 @@ Outer.Inner.prototype = { === use.js === /** @type {Outer.Inner} */ var inner ->inner : any +>inner : Inner inner.x >inner.x : any ->inner : any +>inner : Inner >x : any inner.m() >inner.m() : any >inner.m : any ->inner : any +>inner : Inner >m : any var inno = new Outer.Inner() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt index 9a82edb3d4..fb4921e205 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.errors.txt @@ -1,9 +1,10 @@ a.js(3,7): error TS2339: Property 'Inner' does not exist on type '{}'. a.js(5,14): error TS2339: Property 'x' does not exist on type 'Inner'. +a.js(10,12): error TS2503: Cannot find namespace 'Outer'. a.js(14,22): error TS2339: Property 'Inner' does not exist on type '{}'. -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== var Outer = {}; Outer.Inner = class { @@ -18,6 +19,8 @@ a.js(14,22): error TS2339: Property 'Inner' does not exist on type '{}'. } /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var inner inner.x inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.types index 3eb8086081..e7fe47d659 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment15.types @@ -26,17 +26,17 @@ Outer.Inner = class { /** @type {Outer.Inner} */ var inner ->inner : any +>inner : Inner inner.x >inner.x : any ->inner : any +>inner : Inner >x : any inner.m() >inner.m() : any >inner.m : any ->inner : any +>inner : Inner >m : any var inno = new Outer.Inner() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt index 05184f45d8..c54db8a4a9 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.errors.txt @@ -1,9 +1,10 @@ a.js(3,7): error TS2339: Property 'Inner' does not exist on type '{}'. a.js(4,7): error TS2339: Property 'Inner' does not exist on type '{}'. +a.js(9,12): error TS2503: Cannot find namespace 'Outer'. a.js(13,22): error TS2339: Property 'Inner' does not exist on type '{}'. -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== var Outer = {}; Outer.Inner = function () {} @@ -17,6 +18,8 @@ a.js(13,22): error TS2339: Property 'Inner' does not exist on type '{}'. } /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var inner inner.x inner.m() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.types index af6a82e71d..68b7a9b039 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment16.types @@ -31,17 +31,17 @@ Outer.Inner.prototype = { /** @type {Outer.Inner} */ var inner ->inner : any +>inner : Inner inner.x >inner.x : any ->inner : any +>inner : Inner >x : any inner.m() >inner.m() : any >inner.m : any ->inner : any +>inner : Inner >m : any var inno = new Outer.Inner() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt index 477e317e0e..8cb50e996a 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.errors.txt @@ -1,7 +1,9 @@ a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. +a.js(9,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? +a.js(12,12): error TS2503: Cannot find namespace 'Outer'. -==== a.js (1 errors) ==== +==== a.js (3 errors) ==== function Outer() { this.y = 2 } @@ -13,9 +15,13 @@ a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. } } /** @type {Outer} */ + ~~~~~ +!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? var ok ok.y /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var oc oc.x \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.types index a5ed2732a2..5d2d486285 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment2.types @@ -30,19 +30,19 @@ Outer.Inner = class I { } /** @type {Outer} */ var ok ->ok : any +>ok : Outer ok.y >ok.y : any ->ok : any +>ok : Outer >y : any /** @type {Outer.Inner} */ var oc ->oc : any +>oc : Inner oc.x >oc.x : any ->oc : any +>oc : Inner >x : any diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt index d4e17911fb..4de02a5a06 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.errors.txt @@ -1,9 +1,10 @@ def.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. usage.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. usage.js(5,19): error TS2339: Property 'Inner' does not exist on type '{}'. +usage.js(7,12): error TS2503: Cannot find namespace 'Outer'. -==== usage.js (2 errors) ==== +==== usage.js (3 errors) ==== // note that usage is first in the compilation Outer.Inner.Message = function() { ~~~~~ @@ -15,6 +16,8 @@ usage.js(5,19): error TS2339: Property 'Inner' does not exist on type '{}'. !!! error TS2339: Property 'Inner' does not exist on type '{}'. y.name /** @type {Outer.Inner} should be instance type, not static type */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var x; x.name diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.types index 171a756889..3f23cf8e7e 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment24.types @@ -27,11 +27,11 @@ y.name /** @type {Outer.Inner} should be instance type, not static type */ var x; ->x : any +>x : Inner x.name >x.name : any ->x : any +>x : Inner >name : any === def.js === diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt index e9e2972b40..f02f8f9f4d 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.errors.txt @@ -1,8 +1,10 @@ a.js(4,7): error TS2339: Property 'Inner' does not exist on type '() => void'. a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. +a.js(9,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? +a.js(12,12): error TS2503: Cannot find namespace 'Outer'. -==== a.js (2 errors) ==== +==== a.js (4 errors) ==== var Outer = function O() { this.y = 2 } @@ -16,9 +18,13 @@ a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. } } /** @type {Outer} */ + ~~~~~ +!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? var ja ja.y /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var da da.x \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.types index 3528450433..66b50f5dd7 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment3.types @@ -32,19 +32,19 @@ Outer.Inner = class I { } /** @type {Outer} */ var ja ->ja : any +>ja : Outer ja.y >ja.y : any ->ja : any +>ja : Outer >y : any /** @type {Outer.Inner} */ var da ->da : any +>da : Inner da.x >da.x : any ->da : any +>da : Inner >x : any diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt index 08e085ad62..13dca3e156 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.errors.txt @@ -1,3 +1,4 @@ +bug26877.js(1,13): error TS2503: Cannot find namespace 'Emu'. bug26877.js(4,23): error TS2339: Property 'D' does not exist on type '{}'. bug26877.js(5,19): error TS2339: Property 'D' does not exist on type '{}'. bug26877.js(7,5): error TS2339: Property 'D' does not exist on type '{}'. @@ -5,8 +6,10 @@ bug26877.js(9,14): error TS2339: Property '_model' does not exist on type 'D'. second.js(3,5): error TS2339: Property 'D' does not exist on type '{}'. -==== bug26877.js (4 errors) ==== +==== bug26877.js (5 errors) ==== /** @param {Emu.D} x */ + ~~~ +!!! error TS2503: Cannot find namespace 'Emu'. function ollKorrect(x) { x._model const y = new Emu.D() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.types index 6265d58c28..1bac114802 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment35.types @@ -3,12 +3,12 @@ === bug26877.js === /** @param {Emu.D} x */ function ollKorrect(x) { ->ollKorrect : (x: any) => void ->x : any +>ollKorrect : (x: D) => void +>x : D x._model >x._model : any ->x : any +>x : D >_model : any const y = new Emu.D() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt index 91587b0f27..3b644b682e 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.errors.txt @@ -1,13 +1,15 @@ a.js(1,7): error TS2339: Property 'Inner' does not exist on type '{}'. a.js(4,14): error TS2339: Property 'y' does not exist on type 'Inner'. +a.js(8,12): error TS2503: Cannot find namespace 'Outer'. a.js(11,23): error TS2339: Property 'Inner' does not exist on type '{}'. +b.js(1,12): error TS2503: Cannot find namespace 'Outer'. b.js(4,19): error TS2339: Property 'Inner' does not exist on type '{}'. ==== def.js (0 errors) ==== var Outer = {}; -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== Outer.Inner = class { ~~~~~ !!! error TS2339: Property 'Inner' does not exist on type '{}'. @@ -20,6 +22,8 @@ b.js(4,19): error TS2339: Property 'Inner' does not exist on type '{}'. } /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var local local.y var inner = new Outer.Inner() @@ -27,8 +31,10 @@ b.js(4,19): error TS2339: Property 'Inner' does not exist on type '{}'. !!! error TS2339: Property 'Inner' does not exist on type '{}'. inner.y -==== b.js (1 errors) ==== +==== b.js (2 errors) ==== /** @type {Outer.Inner} */ + ~~~~~ +!!! error TS2503: Cannot find namespace 'Outer'. var x x.y var z = new Outer.Inner() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.types index b11991982b..a431f9b7a0 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment4.types @@ -26,11 +26,11 @@ Outer.Inner = class { /** @type {Outer.Inner} */ var local ->local : any +>local : Inner local.y >local.y : any ->local : any +>local : Inner >y : any var inner = new Outer.Inner() @@ -48,11 +48,11 @@ inner.y === b.js === /** @type {Outer.Inner} */ var x ->x : any +>x : Inner x.y >x.y : any ->x : any +>x : Inner >y : any var z = new Outer.Inner() diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt new file mode 100644 index 0000000000..9e6a8111a7 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.errors.txt @@ -0,0 +1,14 @@ +typeFromPropertyAssignment40.js(5,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? + + +==== typeFromPropertyAssignment40.js (1 errors) ==== + function Outer() { + var self = this + self.y = 2 + } + /** @type {Outer} */ + ~~~~~ +!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? + var ok + ok.y + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.types index 023749cf32..27e564b678 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment40.types @@ -17,10 +17,10 @@ function Outer() { } /** @type {Outer} */ var ok ->ok : any +>ok : Outer ok.y >ok.y : any ->ok : any +>ok : Outer >y : any diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt new file mode 100644 index 0000000000..d247630d9d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.errors.txt @@ -0,0 +1,18 @@ +b.js(3,12): error TS2503: Cannot find namespace 'MC'. + + +==== a.js (0 errors) ==== + export default function MyClass() { + } + MyClass.bar = class C { + } + MyClass.bar + +==== b.js (1 errors) ==== + import MC from './a' + MC.bar + /** @type {MC.bar} */ + ~~ +!!! error TS2503: Cannot find namespace 'MC'. + var x + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.types index 2a85aeab2e..11fbaadbd0 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment5.types @@ -28,5 +28,5 @@ MC.bar /** @type {MC.bar} */ var x ->x : any +>x : bar diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt index 1798238608..48dce5754d 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.errors.txt @@ -1,6 +1,7 @@ a.js(1,7): error TS2339: Property 'Inner' does not exist on type 'typeof Outer'. a.js(5,7): error TS2339: Property 'i' does not exist on type 'typeof Outer'. b.js(1,18): error TS2339: Property 'i' does not exist on type 'typeof Outer'. +b.js(3,13): error TS2702: 'Outer' only refers to a type, but is being used as a namespace here. ==== def.js (0 errors) ==== @@ -17,12 +18,14 @@ b.js(1,18): error TS2339: Property 'i' does not exist on type 'typeof Outer'. ~ !!! error TS2339: Property 'i' does not exist on type 'typeof Outer'. -==== b.js (1 errors) ==== +==== b.js (2 errors) ==== var msgs = Outer.i.messages() ~ !!! error TS2339: Property 'i' does not exist on type 'typeof Outer'. /** @param {Outer.Inner} inner */ + ~~~~~ +!!! error TS2702: 'Outer' only refers to a type, but is being used as a namespace here. function x(inner) { } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.types index c4180f9437..46c6709826 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment6.types @@ -35,7 +35,7 @@ var msgs = Outer.i.messages() /** @param {Outer.Inner} inner */ function x(inner) { ->x : (inner: any) => void ->inner : any +>x : (inner: Inner) => void +>inner : Inner } diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt index 594bf0fd6f..c10ea07ed6 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt @@ -3,9 +3,10 @@ index.js(2,8): error TS2339: Property 'Object' does not exist on type '{}'. index.js(2,37): error TS2339: Property 'Item' does not exist on type '{}'. index.js(4,11): error TS2339: Property 'Object' does not exist on type '{}'. index.js(4,41): error TS2339: Property 'Object' does not exist on type '{}'. +index.js(6,12): error TS2503: Cannot find namespace 'Workspace'. -==== index.js (5 errors) ==== +==== index.js (6 errors) ==== First.Item = class I {} ~~~~ !!! error TS2339: Property 'Item' does not exist on type '{}'. @@ -22,6 +23,8 @@ index.js(4,41): error TS2339: Property 'Object' does not exist on type '{}'. !!! error TS2339: Property 'Object' does not exist on type '{}'. /** @type {Workspace.Object} */ + ~~~~~~~~~ +!!! error TS2503: Cannot find namespace 'Workspace'. var am; ==== roots.js (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.types index 5c4d2e8157..4c65eed0ab 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentOutOfOrder.types @@ -31,7 +31,7 @@ Workspace.Object = class extends Common.Object {} /** @type {Workspace.Object} */ var am; ->am : any +>am : Object === roots.js === var First = {}; diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt index 384219bf48..03f06755e4 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.errors.txt @@ -1,9 +1,10 @@ bug26885.js(2,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. +bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: string) => number; }'. +bug26885.js(15,12): error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? bug26885.js(16,13): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -==== bug26885.js (3 errors) ==== +==== bug26885.js (4 errors) ==== function Multimap3() { this._map = {}; ~~~~ @@ -18,11 +19,13 @@ bug26885.js(16,13): error TS7009: 'new' expression, whose target lacks a constru get(key) { return this._map[key + '']; ~~~~ -!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. +!!! error TS2339: Property '_map' does not exist on type '{ get: (key: string) => number; }'. } } /** @type {Multimap3} */ + ~~~~~~~~~ +!!! error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? const map = new Multimap3(); ~~~~~~~~~~~~~~~ !!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.types b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.types index ec8abf02a3..86ee9d157f 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment3.types @@ -2,7 +2,7 @@ === bug26885.js === function Multimap3() { ->Multimap3 : { (): void; prototype: { get: (key: any) => any; }; } +>Multimap3 : { (): void; prototype: { get: (key: string) => number; }; } this._map = {}; >this._map = {} : {} @@ -14,42 +14,42 @@ function Multimap3() { }; Multimap3.prototype = { ->Multimap3.prototype = { /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } ->Multimap3.prototype : { get: (key: any) => any; } ->Multimap3 : { (): void; prototype: { get: (key: any) => any; }; } ->prototype : { get: (key: any) => any; } ->{ /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } +>Multimap3.prototype = { /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: string) => number; } +>Multimap3.prototype : { get: (key: string) => number; } +>Multimap3 : { (): void; prototype: { get: (key: string) => number; }; } +>prototype : { get: (key: string) => number; } +>{ /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: string) => number; } /** * @param {string} key * @returns {number} the value ok */ get(key) { ->get : (key: any) => any ->key : any +>get : (key: string) => number +>key : string return this._map[key + '']; >this._map[key + ''] : any >this._map : any ->this : { get: (key: any) => any; } +>this : { get: (key: string) => number; } >_map : any >key + '' : string ->key : any +>key : string >'' : "" } } /** @type {Multimap3} */ const map = new Multimap3(); ->map : any +>map : Multimap3 >new Multimap3() : any ->Multimap3 : { (): void; prototype: { get: (key: any) => any; }; } +>Multimap3 : { (): void; prototype: { get: (key: string) => number; }; } const n = map.get('hi') >n : any >map.get('hi') : any >map.get : any ->map : any +>map : Multimap3 >get : any >'hi' : "hi" diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment4.types b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment4.types index 11631672a8..23acb0371f 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment4.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment4.types @@ -2,7 +2,7 @@ === a.js === function Multimap4() { ->Multimap4 : { (): void; prototype: { get: (key: any) => any; }; } +>Multimap4 : { (): void; prototype: { get: (key: string) => number; }; } this._map = {}; >this._map = {} : {} @@ -14,19 +14,19 @@ function Multimap4() { }; Multimap4["prototype"] = { ->Multimap4["prototype"] = { /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } ->Multimap4["prototype"] : { get: (key: any) => any; } ->Multimap4 : { (): void; prototype: { get: (key: any) => any; }; } +>Multimap4["prototype"] = { /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: string) => number; } +>Multimap4["prototype"] : { get: (key: string) => number; } +>Multimap4 : { (): void; prototype: { get: (key: string) => number; }; } >"prototype" : "prototype" ->{ /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } +>{ /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: string) => number; } /** * @param {string} key * @returns {number} the value ok */ get(key) { ->get : (key: any) => any ->key : any +>get : (key: string) => number +>key : string return this._map[key + '']; >this._map[key + ''] : any @@ -34,7 +34,7 @@ Multimap4["prototype"] = { >this : any >_map : any >key + '' : string ->key : any +>key : string >'' : "" } }; @@ -42,8 +42,8 @@ Multimap4["prototype"] = { Multimap4["prototype"]["add-on"] = function() {}; >Multimap4["prototype"]["add-on"] = function() {} : () => void >Multimap4["prototype"]["add-on"] : any ->Multimap4["prototype"] : { get: (key: any) => any; } ->Multimap4 : { (): void; prototype: { get: (key: any) => any; }; } +>Multimap4["prototype"] : { get: (key: string) => number; } +>Multimap4 : { (): void; prototype: { get: (key: string) => number; }; } >"prototype" : "prototype" >"add-on" : "add-on" >function() {} : () => void @@ -51,8 +51,8 @@ Multimap4["prototype"]["add-on"] = function() {}; Multimap4["prototype"]["addon"] = function() {}; >Multimap4["prototype"]["addon"] = function() {} : () => void >Multimap4["prototype"]["addon"] : any ->Multimap4["prototype"] : { get: (key: any) => any; } ->Multimap4 : { (): void; prototype: { get: (key: any) => any; }; } +>Multimap4["prototype"] : { get: (key: string) => number; } +>Multimap4 : { (): void; prototype: { get: (key: string) => number; }; } >"prototype" : "prototype" >"addon" : "addon" >function() {} : () => void @@ -60,8 +60,8 @@ Multimap4["prototype"]["addon"] = function() {}; Multimap4["prototype"]["__underscores__"] = function() {}; >Multimap4["prototype"]["__underscores__"] = function() {} : () => void >Multimap4["prototype"]["__underscores__"] : any ->Multimap4["prototype"] : { get: (key: any) => any; } ->Multimap4 : { (): void; prototype: { get: (key: any) => any; }; } +>Multimap4["prototype"] : { get: (key: string) => number; } +>Multimap4 : { (): void; prototype: { get: (key: string) => number; }; } >"prototype" : "prototype" >"__underscores__" : "__underscores__" >function() {} : () => void @@ -69,7 +69,7 @@ Multimap4["prototype"]["__underscores__"] = function() {}; const map4 = new Multimap4(); >map4 : any >new Multimap4() : any ->Multimap4 : { (): void; prototype: { get: (key: any) => any; }; } +>Multimap4 : { (): void; prototype: { get: (key: string) => number; }; } map4.get(""); >map4.get("") : any diff --git a/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt b/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt new file mode 100644 index 0000000000..b8f89f9c63 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.errors.txt @@ -0,0 +1,11 @@ +a.js(3,12): error TS2503: Cannot find namespace 'ns'. + + +==== a.js (1 errors) ==== + // #22973 + var ns = (function() {})(); + /** @type {ns.NotFound} */ + ~~ +!!! error TS2503: Cannot find namespace 'ns'. + var crash; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.types b/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.types index 96858aef83..b9280c03ce 100644 --- a/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.types +++ b/testdata/baselines/reference/submodule/conformance/typeLookupInIIFE.types @@ -10,5 +10,5 @@ var ns = (function() {})(); /** @type {ns.NotFound} */ var crash; ->crash : any +>crash : NotFound diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt new file mode 100644 index 0000000000..71b0b2cce5 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.errors.txt @@ -0,0 +1,14 @@ +typeTagNoErasure.js(1,39): error TS2304: Cannot find name 'T'. + + +==== typeTagNoErasure.js (1 errors) ==== + /** @template T @typedef {(data: T1) => T1} Test */ + ~ +!!! error TS2304: Cannot find name 'T'. + + /** @type {Test} */ + const test = dibbity => dibbity + + test(1) // ok, T=1 + test('hi') // error, T=number + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.types b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.types index ccb3f5d161..26b0d0432d 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.types +++ b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.types @@ -2,21 +2,23 @@ === typeTagNoErasure.js === /** @template T @typedef {(data: T1) => T1} Test */ +>Test : any +>data : T1 /** @type {Test} */ const test = dibbity => dibbity ->test : (dibbity: any) => any ->dibbity => dibbity : (dibbity: any) => any ->dibbity : any ->dibbity : any +>test : (data: T1) => T1 +>dibbity => dibbity : (dibbity: T1) => T1 +>dibbity : T1 +>dibbity : T1 test(1) // ok, T=1 ->test(1) : any ->test : (dibbity: any) => any +>test(1) : 1 +>test : (data: T1) => T1 >1 : 1 test('hi') // error, T=number ->test('hi') : any ->test : (dibbity: any) => any +>test('hi') : "hi" +>test : (data: T1) => T1 >'hi' : "hi" diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols index 4ab7fac011..c9a011a4e0 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols @@ -3,6 +3,7 @@ === typeTagOnFunctionReferencesGeneric.js === /** * @typedef {(m : T) => T} IFn +>IFn : Symbol(IFn, Decl(typeTagOnFunctionReferencesGeneric.js, 7, 1)) >T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) >m : Symbol(m, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 17)) >T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff index 03b6a4fc40..19d91b2e52 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff @@ -4,6 +4,7 @@ === typeTagOnFunctionReferencesGeneric.js === /** * @typedef {(m : T) => T} IFn ++>IFn : Symbol(IFn, Decl(typeTagOnFunctionReferencesGeneric.js, 7, 1)) +>T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) +>m : Symbol(m, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 17)) +>T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types index 9ff1f2e75d..afa5001ced 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types @@ -3,6 +3,9 @@ === typeTagOnFunctionReferencesGeneric.js === /** * @typedef {(m : T) => T} IFn +>IFn : IFn +>m : T + */ /**@type {IFn}*/ @@ -20,15 +23,15 @@ inJs(1); // lints error. Why? /**@type {IFn}*/ const inJsArrow = (j) => { ->inJsArrow : (j: any) => any ->(j) => { return j;} : (j: any) => any ->j : any +>inJsArrow : IFn +>(j) => { return j;} : (j: T) => T +>j : T return j; ->j : any +>j : T } inJsArrow(2); // no error gets linted as expected ->inJsArrow(2) : any ->inJsArrow : (j: any) => any +>inJsArrow(2) : 2 +>inJsArrow : IFn >2 : 2 diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnPropertyAssignment.types b/testdata/baselines/reference/submodule/conformance/typeTagOnPropertyAssignment.types index 2a4bb163c7..7766f435ed 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnPropertyAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnPropertyAssignment.types @@ -2,30 +2,32 @@ === typeTagOnPropertyAssignment.js === const o = { ->o : { a: string; n: () => string; } ->{ /** * @type {"a"} */ a: "a", /** @type {() => 'b'} */ n: () => 'b'} : { a: string; n: () => string; } +>o : { a: "a"; n: () => "b"; } +>{ /** * @type {"a"} */ a: "a", /** @type {() => 'b'} */ n: () => 'b'} : { a: "a"; n: () => "b"; } /** * @type {"a"} */ a: "a", ->a : string +>a : "a" +>"a" : "a" >"a" : "a" /** @type {() => 'b'} */ n: () => 'b' ->n : () => string ->() => 'b' : () => string +>n : () => "b" +>() => 'b' : () => "b" +>() => 'b' : () => "b" >'b' : "b" }; o.a ->o.a : string ->o : { a: string; n: () => string; } ->a : string +>o.a : "a" +>o : { a: "a"; n: () => "b"; } +>a : "a" o.n ->o.n : () => string ->o : { a: string; n: () => string; } ->n : () => string +>o.n : () => "b" +>o : { a: "a"; n: () => "b"; } +>n : () => "b" diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols index 690bdfe4c3..0f2bc0d78c 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols @@ -16,8 +16,8 @@ declare var module: { exports: any}; >y : Symbol(y, Decl(mod1.js, 2, 26)) /** @typedef {A | B} Both */ ->A : Symbol(A) ->B : Symbol(B) +>A : Symbol(A, Decl(mod1.js, 4, 18)) +>B : Symbol(B, Decl(mod1.js, 4, 18)) module.exports = C >module.exports : Symbol(exports, Decl(commonjs.d.ts, 0, 21)) @@ -34,16 +34,19 @@ function C() { === mod2.js === /// /** @typedef {{ type: "a", x: 1 }} A */ +>A : Symbol(A, Decl(mod2.js, 7, 1)) >type : Symbol(type, Decl(mod2.js, 1, 15)) >x : Symbol(x, Decl(mod2.js, 1, 26)) /** @typedef {{ type: "b", y: 1 }} B */ +>B : Symbol(B, Decl(mod2.js, 7, 1)) >type : Symbol(type, Decl(mod2.js, 2, 15)) >y : Symbol(y, Decl(mod2.js, 2, 26)) /** @typedef {A | B} Both */ ->A : Symbol(A) ->B : Symbol(B) +>Both : Symbol(Both, Decl(mod2.js, 7, 1)) +>A : Symbol(A, Decl(mod2.js, 7, 1)) +>B : Symbol(B, Decl(mod2.js, 7, 1)) export function C() { >C : Symbol(C, Decl(mod2.js, 0, 0)) @@ -62,8 +65,8 @@ export function C() { >y : Symbol(y, Decl(mod3.js, 2, 26)) /** @typedef {A | B} Both */ ->A : Symbol(A) ->B : Symbol(B) +>A : Symbol(A, Decl(mod3.js, 7, 1)) +>B : Symbol(B, Decl(mod3.js, 7, 1)) exports.C = function() { this.p = 1 diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff index 4219663b1a..7552df24bd 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff @@ -12,8 +12,8 @@ +>y : Symbol(y, Decl(mod1.js, 2, 26)) + /** @typedef {A | B} Both */ -+>A : Symbol(A) -+>B : Symbol(B) ++>A : Symbol(A, Decl(mod1.js, 4, 18)) ++>B : Symbol(B, Decl(mod1.js, 4, 18)) + module.exports = C ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) @@ -36,16 +36,19 @@ === mod2.js === /// /** @typedef {{ type: "a", x: 1 }} A */ ++>A : Symbol(A, Decl(mod2.js, 7, 1)) +>type : Symbol(type, Decl(mod2.js, 1, 15)) +>x : Symbol(x, Decl(mod2.js, 1, 26)) + /** @typedef {{ type: "b", y: 1 }} B */ ++>B : Symbol(B, Decl(mod2.js, 7, 1)) +>type : Symbol(type, Decl(mod2.js, 2, 15)) +>y : Symbol(y, Decl(mod2.js, 2, 26)) + /** @typedef {A | B} Both */ -+>A : Symbol(A) -+>B : Symbol(B) ++>Both : Symbol(Both, Decl(mod2.js, 7, 1)) ++>A : Symbol(A, Decl(mod2.js, 7, 1)) ++>B : Symbol(B, Decl(mod2.js, 7, 1)) export function C() { >C : Symbol(C, Decl(mod2.js, 0, 0)) @@ -67,8 +70,8 @@ +>y : Symbol(y, Decl(mod3.js, 2, 26)) + /** @typedef {A | B} Both */ -+>A : Symbol(A) -+>B : Symbol(B) ++>A : Symbol(A, Decl(mod3.js, 7, 1)) ++>B : Symbol(B, Decl(mod3.js, 7, 1)) exports.C = function() { ->exports.C : Symbol(C, Decl(mod3.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types index 03a0b5fd15..6113ea2a09 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types @@ -8,8 +8,18 @@ declare var module: { exports: any}; === mod1.js === /// /** @typedef {{ type: "a", x: 1 }} A */ +>A : any +>type : "a" +>x : 1 + /** @typedef {{ type: "b", y: 1 }} B */ +>B : any +>type : "b" +>y : 1 + /** @typedef {A | B} Both */ +>Both : any + module.exports = C >module.exports = C : () => void >module.exports : any @@ -31,8 +41,17 @@ function C() { === mod2.js === /// /** @typedef {{ type: "a", x: 1 }} A */ +>A : A +>type : "a" +>x : 1 + /** @typedef {{ type: "b", y: 1 }} B */ +>B : B +>type : "b" +>y : 1 + /** @typedef {A | B} Both */ +>Both : Both export function C() { >C : () => void @@ -48,8 +67,17 @@ export function C() { === mod3.js === /// /** @typedef {{ type: "a", x: 1 }} A */ +>A : any +>type : "a" +>x : 1 + /** @typedef {{ type: "b", y: 1 }} B */ +>B : any +>type : "b" +>y : 1 + /** @typedef {A | B} Both */ +>Both : any exports.C = function() { >exports.C = function() { this.p = 1} : () => void @@ -69,22 +97,22 @@ exports.C = function() { === use.js === /** @type {import('./mod1').Both} */ var both1 = { type: 'a', x: 1 }; ->both1 : { type: string; x: number; } ->{ type: 'a', x: 1 } : { type: string; x: number; } ->type : string +>both1 : { type: "a"; x: 1; } | { type: "b"; y: 1; } +>{ type: 'a', x: 1 } : { type: "a"; x: 1; } +>type : "a" >'a' : "a" ->x : number +>x : 1 >1 : 1 /** @type {import('./mod2').Both} */ var both2 = both1; ->both2 : { type: string; x: number; } ->both1 : { type: string; x: number; } +>both2 : Both +>both1 : { type: "a"; x: 1; } /** @type {import('./mod3').Both} */ var both3 = both2; ->both3 : { type: string; x: number; } ->both2 : { type: string; x: number; } +>both3 : { type: "a"; x: 1; } | { type: "b"; y: 1; } +>both2 : A diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt index bdbed02782..98a50caafd 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt @@ -1,13 +1,19 @@ use.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +use.js(2,19): error TS2307: Cannot find module './mod1.js' or its corresponding type declarations. +use.js(4,12): error TS2503: Cannot find namespace 'mod'. -==== use.js (1 errors) ==== +==== use.js (3 errors) ==== var mod = require('./mod1.js'); ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @type {import("./mod1.js").Baz} */ + ~~~~~~~~~~~ +!!! error TS2307: Cannot find module './mod1.js' or its corresponding type declarations. var b; /** @type {mod.Baz} */ + ~~~ +!!! error TS2503: Cannot find namespace 'mod'. var bb; var bbb = new mod.Baz(); diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types index 2b2b4ef2e0..053aa0751b 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types @@ -13,7 +13,7 @@ var b; /** @type {mod.Baz} */ var bb; ->bb : any +>bb : Baz var bbb = new mod.Baz(); >bbb : any diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types index bf416ab331..9255806d04 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types @@ -2,6 +2,8 @@ === mod2.js === /** @typedef {number} Foo */ +>Foo : any + const ns = {}; >ns : {} >{} : {} diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.types index 38aefb1251..8bbb10da7b 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.types @@ -2,6 +2,8 @@ === mod3.js === /** @typedef {number} Foo */ +>Foo : any + class Bar { } >Bar : Bar diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.types index 918c2c7544..40758a5176 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.types @@ -2,6 +2,8 @@ === mod1.js === /** @typedef {number} Foo */ +>Foo : any + class Bar {} >Bar : Bar diff --git a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols index f74e112d49..9194502e53 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols @@ -6,7 +6,7 @@ class C { /** * @typedef {C~A} C~B ->C : Symbol(C, Decl(bug25104.js, 0, 0)) +>C : Symbol(C, Decl(bug25104.js, 7, 5)) * @typedef {object} C~A */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff index 95dc4294f6..1c716492f9 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff @@ -4,7 +4,7 @@ /** * @typedef {C~A} C~B -+>C : Symbol(C, Decl(bug25104.js, 0, 0)) ++>C : Symbol(C, Decl(bug25104.js, 7, 5)) + * @typedef {object} C~A */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.types b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.types index 1f29af9dc3..d2254cb785 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.types +++ b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.types @@ -6,7 +6,11 @@ class C { /** * @typedef {C~A} C~B +> : any + * @typedef {object} C~A +>C : any + */ /** @param {C~A} o */ constructor(o) { diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt index 222260e5aa..5570c99ce3 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.errors.txt @@ -1,22 +1,44 @@ +a.js(6,19): error TS2304: Cannot find name 'T'. +a.js(6,25): error TS2304: Cannot find name 'U'. +a.js(6,31): error TS2304: Cannot find name 'V'. +a.js(6,37): error TS2304: Cannot find name 'W'. +a.js(6,43): error TS2304: Cannot find name 'X'. +a.js(12,23): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. +a.js(15,12): error TS2314: Generic type 'Everything' requires 5 type argument(s). test.ts(1,23): error TS2304: Cannot find name 'Everything'. -==== a.js (0 errors) ==== +==== a.js (7 errors) ==== /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? * @template W * @template X That last one had no comment * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything + ~ +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS2304: Cannot find name 'U'. + ~ +!!! error TS2304: Cannot find name 'V'. + ~ +!!! error TS2304: Cannot find name 'W'. + ~ +!!! error TS2304: Cannot find name 'X'. */ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ var tuvwx; /** @type {Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>} */ + ~~~~~~~~~~~~~~ +!!! error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. +!!! related TS2728 a.js:2:28: 'b' is declared here. var wrong; /** @type {Everything<{ a: number }>} */ + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2314: Generic type 'Everything' requires 5 type argument(s). var insufficient; ==== test.ts (1 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols index 4b84ef4c3b..84b375fd60 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols @@ -3,7 +3,14 @@ === a.js === /** * @template {{ a: number, b: string }} T,U A Comment +>a : Symbol(a, Decl(a.js, 1, 15)) +>b : Symbol(b, Decl(a.js, 1, 26)) +>a : Symbol(a, Decl(a.js, 1, 15)) +>b : Symbol(b, Decl(a.js, 1, 26)) + * @template {{ c: boolean }} V uh ... are comments even supported?? +>c : Symbol(c, Decl(a.js, 2, 15)) + * @template W * @template X That last one had no comment * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols.diff index 133422feaf..fb33b2b1ca 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols.diff @@ -1,6 +1,17 @@ --- old.typedefMultipleTypeParameters.symbols +++ new.typedefMultipleTypeParameters.symbols -@@= skipped -6, +6 lines =@@ +@@= skipped -2, +2 lines =@@ + === a.js === + /** + * @template {{ a: number, b: string }} T,U A Comment ++>a : Symbol(a, Decl(a.js, 1, 15)) ++>b : Symbol(b, Decl(a.js, 1, 26)) ++>a : Symbol(a, Decl(a.js, 1, 15)) ++>b : Symbol(b, Decl(a.js, 1, 26)) ++ + * @template {{ c: boolean }} V uh ... are comments even supported?? ++>c : Symbol(c, Decl(a.js, 2, 15)) ++ * @template W * @template X That last one had no comment * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything @@ -18,7 +29,7 @@ */ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ -@@= skipped -17, +28 lines =@@ +@@= skipped -21, +39 lines =@@ === test.ts === declare var actually: Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>; >actually : Symbol(actually, Decl(test.ts, 0, 11)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.types b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.types index f06d56ac40..18ce1e7b27 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.types +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.types @@ -7,15 +7,22 @@ * @template W * @template X That last one had no comment * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything +>Everything : any +>t : T +>u : U +>v : V +>w : W +>x : X + */ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ var tuvwx; ->tuvwx : any +>tuvwx : { t: T; u: U; v: V; w: W; x: X; } /** @type {Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>} */ var wrong; ->wrong : any +>wrong : { t: T; u: U; v: V; w: W; x: X; } /** @type {Everything<{ a: number }>} */ var insufficient; diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.types b/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.types index 0b6bc42c13..ff0e1e7203 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.types +++ b/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.types @@ -5,6 +5,8 @@ export class Preferences { >Preferences : Preferences /** @typedef {string} A */ +>A : any + ; /** @type {A} */ a = 'ok' diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt index 6ea62c841d..d6726678a1 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.errors.txt @@ -4,13 +4,7 @@ typedefOnStatements.js(33,1): error TS1101: 'with' statements are not allowed in typedefOnStatements.js(33,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. -<<<<<<< HEAD -==== typedefOnStatements.js (3 errors) ==== -||||||| 2904ecfed -==== typedefOnStatements.js (20 errors) ==== -======= -==== typedefOnStatements.js (21 errors) ==== ->>>>>>> main +==== typedefOnStatements.js (4 errors) ==== /** @typedef {{a: string}} A */ ; /** @typedef {{ b: string }} B */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols index 519263033c..617395d058 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols @@ -134,23 +134,57 @@ function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { >console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) +>a.a : Symbol(a, Decl(typedefOnStatements.js, 0, 15)) >a : Symbol(a, Decl(typedefOnStatements.js, 70, 16)) +>a : Symbol(a, Decl(typedefOnStatements.js, 0, 15)) +>b.b : Symbol(b, Decl(typedefOnStatements.js, 2, 15)) >b : Symbol(b, Decl(typedefOnStatements.js, 70, 18)) +>b : Symbol(b, Decl(typedefOnStatements.js, 2, 15)) +>c.c : Symbol(c, Decl(typedefOnStatements.js, 4, 15)) >c : Symbol(c, Decl(typedefOnStatements.js, 70, 20)) +>c : Symbol(c, Decl(typedefOnStatements.js, 4, 15)) +>d.d : Symbol(d, Decl(typedefOnStatements.js, 7, 15)) >d : Symbol(d, Decl(typedefOnStatements.js, 70, 22)) +>d : Symbol(d, Decl(typedefOnStatements.js, 7, 15)) +>e.e : Symbol(e, Decl(typedefOnStatements.js, 9, 15)) >e : Symbol(e, Decl(typedefOnStatements.js, 70, 24)) +>e : Symbol(e, Decl(typedefOnStatements.js, 9, 15)) +>f.f : Symbol(f, Decl(typedefOnStatements.js, 12, 15)) >f : Symbol(f, Decl(typedefOnStatements.js, 70, 26)) +>f : Symbol(f, Decl(typedefOnStatements.js, 12, 15)) +>g.g : Symbol(g, Decl(typedefOnStatements.js, 15, 15)) >g : Symbol(g, Decl(typedefOnStatements.js, 70, 28)) +>g : Symbol(g, Decl(typedefOnStatements.js, 15, 15)) +>h.h : Symbol(h, Decl(typedefOnStatements.js, 18, 15)) >h : Symbol(h, Decl(typedefOnStatements.js, 70, 30)) +>h : Symbol(h, Decl(typedefOnStatements.js, 18, 15)) +>i.i : Symbol(i, Decl(typedefOnStatements.js, 21, 15)) >i : Symbol(i, Decl(typedefOnStatements.js, 70, 32)) +>i : Symbol(i, Decl(typedefOnStatements.js, 21, 15)) +>j.j : Symbol(j, Decl(typedefOnStatements.js, 24, 15)) >j : Symbol(j, Decl(typedefOnStatements.js, 70, 34)) +>j : Symbol(j, Decl(typedefOnStatements.js, 24, 15)) +>k.k : Symbol(k, Decl(typedefOnStatements.js, 26, 15)) >k : Symbol(k, Decl(typedefOnStatements.js, 70, 36)) +>k : Symbol(k, Decl(typedefOnStatements.js, 26, 15)) +>l.l : Symbol(l, Decl(typedefOnStatements.js, 29, 15)) >l : Symbol(l, Decl(typedefOnStatements.js, 70, 38)) +>l : Symbol(l, Decl(typedefOnStatements.js, 29, 15)) +>m.m : Symbol(m, Decl(typedefOnStatements.js, 31, 15)) >m : Symbol(m, Decl(typedefOnStatements.js, 70, 40)) +>m : Symbol(m, Decl(typedefOnStatements.js, 31, 15)) +>n.n : Symbol(n, Decl(typedefOnStatements.js, 34, 15)) >n : Symbol(n, Decl(typedefOnStatements.js, 70, 42)) +>n : Symbol(n, Decl(typedefOnStatements.js, 34, 15)) +>o.o : Symbol(o, Decl(typedefOnStatements.js, 38, 15)) >o : Symbol(o, Decl(typedefOnStatements.js, 70, 44)) +>o : Symbol(o, Decl(typedefOnStatements.js, 38, 15)) +>p.p : Symbol(p, Decl(typedefOnStatements.js, 42, 15)) >p : Symbol(p, Decl(typedefOnStatements.js, 70, 46)) +>p : Symbol(p, Decl(typedefOnStatements.js, 42, 15)) +>q.q : Symbol(q, Decl(typedefOnStatements.js, 45, 15)) >q : Symbol(q, Decl(typedefOnStatements.js, 70, 48)) +>q : Symbol(q, Decl(typedefOnStatements.js, 45, 15)) /** @type {Alpha} */ var alpha = { alpha: "aleph" } diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols.diff index fadfb97490..88c3bc9a51 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols.diff @@ -98,62 +98,11 @@ +>console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) ->log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) -->a.a : Symbol(a, Decl(typedefOnStatements.js, 0, 15)) +>log : Symbol(log, Decl(lib.dom.d.ts, --, --)) + >a.a : Symbol(a, Decl(typedefOnStatements.js, 0, 15)) >a : Symbol(a, Decl(typedefOnStatements.js, 70, 16)) -->a : Symbol(a, Decl(typedefOnStatements.js, 0, 15)) -->b.b : Symbol(b, Decl(typedefOnStatements.js, 2, 15)) - >b : Symbol(b, Decl(typedefOnStatements.js, 70, 18)) -->b : Symbol(b, Decl(typedefOnStatements.js, 2, 15)) -->c.c : Symbol(c, Decl(typedefOnStatements.js, 4, 15)) - >c : Symbol(c, Decl(typedefOnStatements.js, 70, 20)) -->c : Symbol(c, Decl(typedefOnStatements.js, 4, 15)) -->d.d : Symbol(d, Decl(typedefOnStatements.js, 7, 15)) - >d : Symbol(d, Decl(typedefOnStatements.js, 70, 22)) -->d : Symbol(d, Decl(typedefOnStatements.js, 7, 15)) -->e.e : Symbol(e, Decl(typedefOnStatements.js, 9, 15)) - >e : Symbol(e, Decl(typedefOnStatements.js, 70, 24)) -->e : Symbol(e, Decl(typedefOnStatements.js, 9, 15)) -->f.f : Symbol(f, Decl(typedefOnStatements.js, 12, 15)) - >f : Symbol(f, Decl(typedefOnStatements.js, 70, 26)) -->f : Symbol(f, Decl(typedefOnStatements.js, 12, 15)) -->g.g : Symbol(g, Decl(typedefOnStatements.js, 15, 15)) - >g : Symbol(g, Decl(typedefOnStatements.js, 70, 28)) -->g : Symbol(g, Decl(typedefOnStatements.js, 15, 15)) -->h.h : Symbol(h, Decl(typedefOnStatements.js, 18, 15)) - >h : Symbol(h, Decl(typedefOnStatements.js, 70, 30)) -->h : Symbol(h, Decl(typedefOnStatements.js, 18, 15)) -->i.i : Symbol(i, Decl(typedefOnStatements.js, 21, 15)) - >i : Symbol(i, Decl(typedefOnStatements.js, 70, 32)) -->i : Symbol(i, Decl(typedefOnStatements.js, 21, 15)) -->j.j : Symbol(j, Decl(typedefOnStatements.js, 24, 15)) - >j : Symbol(j, Decl(typedefOnStatements.js, 70, 34)) -->j : Symbol(j, Decl(typedefOnStatements.js, 24, 15)) -->k.k : Symbol(k, Decl(typedefOnStatements.js, 26, 15)) - >k : Symbol(k, Decl(typedefOnStatements.js, 70, 36)) -->k : Symbol(k, Decl(typedefOnStatements.js, 26, 15)) -->l.l : Symbol(l, Decl(typedefOnStatements.js, 29, 15)) - >l : Symbol(l, Decl(typedefOnStatements.js, 70, 38)) -->l : Symbol(l, Decl(typedefOnStatements.js, 29, 15)) -->m.m : Symbol(m, Decl(typedefOnStatements.js, 31, 15)) - >m : Symbol(m, Decl(typedefOnStatements.js, 70, 40)) -->m : Symbol(m, Decl(typedefOnStatements.js, 31, 15)) -->n.n : Symbol(n, Decl(typedefOnStatements.js, 34, 15)) - >n : Symbol(n, Decl(typedefOnStatements.js, 70, 42)) -->n : Symbol(n, Decl(typedefOnStatements.js, 34, 15)) -->o.o : Symbol(o, Decl(typedefOnStatements.js, 38, 15)) - >o : Symbol(o, Decl(typedefOnStatements.js, 70, 44)) -->o : Symbol(o, Decl(typedefOnStatements.js, 38, 15)) -->p.p : Symbol(p, Decl(typedefOnStatements.js, 42, 15)) - >p : Symbol(p, Decl(typedefOnStatements.js, 70, 46)) -->p : Symbol(p, Decl(typedefOnStatements.js, 42, 15)) -->q.q : Symbol(q, Decl(typedefOnStatements.js, 45, 15)) - >q : Symbol(q, Decl(typedefOnStatements.js, 70, 48)) -->q : Symbol(q, Decl(typedefOnStatements.js, 45, 15)) - - /** @type {Alpha} */ - var alpha = { alpha: "aleph" } -@@= skipped -61, +27 lines =@@ + >a : Symbol(a, Decl(typedefOnStatements.js, 0, 15)) +@@= skipped -61, +61 lines =@@ >alpha : Symbol(alpha, Decl(typedefOnStatements.js, 73, 17)) /** @typedef {{ alpha: string }} Alpha */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.types b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.types index 8ccf3222f4..bb091bd092 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.types +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.types @@ -2,71 +2,121 @@ === typedefOnStatements.js === /** @typedef {{a: string}} A */ +>A : any +>a : string + ; /** @typedef {{ b: string }} B */ +>B : any +>b : string + debugger; /** @typedef {{ c: string }} C */ +>C : any +>c : string { } /** @typedef {{ d: string }} D */ +>D : any +>d : string + 1 + 1; >1 + 1 : number >1 : 1 >1 : 1 /** @typedef {{ e: string }} E */ +>E : any +>e : string + if (false) { >false : false } /** @typedef {{ f: string }} F */ +>F : any +>f : string + do { } while (false); >false : false /** @typedef {{ g: string }} G */ +>G : any +>g : string + while (false) { >false : false } /** @typedef {{ h: string }} H */ +>H : any +>h : string + for (;; false) { >false : false } /** @typedef {{ i: string }} I */ +>I : any +>i : string + for (let i in []) { >i : string >[] : never[] } /** @typedef {{ j: string }} J */ +>J : any +>j : string + break; /** @typedef {{ k: string }} K */ +>K : any +>k : string + for (let k of []) { >k : never >[] : never[] } /** @typedef {{ l: string }} L */ +>L : any +>l : string + continue; /** @typedef {{ m: string }} M */ +>M : any +>m : string + with (name) { >name : void } /** @typedef {{ n: string }} N */ +>N : any +>n : string + switch (name) { >name : void } /** @typedef {{ o: string }} O */ +>O : any +>o : string + fork: while (false) { >fork : any >false : false } /** @typedef {{ p: string }} P */ +>P : any +>p : string + throw new Error('Unreachable') >new Error('Unreachable') : Error >Error : ErrorConstructor >'Unreachable' : "Unreachable" /** @typedef {{ q: string }} Q */ +>Q : any +>q : string + try { } catch (e) { @@ -93,81 +143,81 @@ catch (e) { * @param {Q} q */ function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { ->proof : (a: any, b: any, c: any, d: any, e: any, f: any, g: any, h: any, i: any, j: any, k: any, l: any, m: any, n: any, o: any, p: any, q: any) => void ->a : any ->b : any ->c : any ->d : any ->e : any ->f : any ->g : any ->h : any ->i : any ->j : any ->k : any ->l : any ->m : any ->n : any ->o : any ->p : any ->q : any +>proof : (a: { a: string; }, b: { b: string; }, c: { c: string; }, d: { d: string; }, e: { e: string; }, f: { f: string; }, g: { g: string; }, h: { h: string; }, i: { i: string; }, j: { j: string; }, k: { k: string; }, l: { l: string; }, m: { m: string; }, n: { n: string; }, o: { o: string; }, p: { p: string; }, q: { q: string; }) => void +>a : { a: string; } +>b : { b: string; } +>c : { c: string; } +>d : { d: string; } +>e : { e: string; } +>f : { f: string; } +>g : { g: string; } +>h : { h: string; } +>i : { i: string; } +>j : { j: string; } +>k : { k: string; } +>l : { l: string; } +>m : { m: string; } +>n : { n: string; } +>o : { o: string; } +>p : { p: string; } +>q : { q: string; } console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) >console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) : void >console.log : (...data: any[]) => void >console : Console >log : (...data: any[]) => void ->a.a : any ->a : any ->a : any ->b.b : any ->b : any ->b : any ->c.c : any ->c : any ->c : any ->d.d : any ->d : any ->d : any ->e.e : any ->e : any ->e : any ->f.f : any ->f : any ->f : any ->g.g : any ->g : any ->g : any ->h.h : any ->h : any ->h : any ->i.i : any ->i : any ->i : any ->j.j : any ->j : any ->j : any ->k.k : any ->k : any ->k : any ->l.l : any ->l : any ->l : any ->m.m : any ->m : any ->m : any ->n.n : any ->n : any ->n : any ->o.o : any ->o : any ->o : any ->p.p : any ->p : any ->p : any ->q.q : any ->q : any ->q : any +>a.a : string +>a : { a: string; } +>a : string +>b.b : string +>b : { b: string; } +>b : string +>c.c : string +>c : { c: string; } +>c : string +>d.d : string +>d : { d: string; } +>d : string +>e.e : string +>e : { e: string; } +>e : string +>f.f : string +>f : { f: string; } +>f : string +>g.g : string +>g : { g: string; } +>g : string +>h.h : string +>h : { h: string; } +>h : string +>i.i : string +>i : { i: string; } +>i : string +>j.j : string +>j : { j: string; } +>j : string +>k.k : string +>k : { k: string; } +>k : string +>l.l : string +>l : { l: string; } +>l : string +>m.m : string +>m : { m: string; } +>m : string +>n.n : string +>n : { n: string; } +>n : string +>o.o : string +>o : { o: string; } +>o : string +>p.p : string +>p : { p: string; } +>p : string +>q.q : string +>q : { q: string; } +>q : string /** @type {Alpha} */ var alpha = { alpha: "aleph" } @@ -177,6 +227,9 @@ function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { >"aleph" : "aleph" /** @typedef {{ alpha: string }} Alpha */ +>Alpha : any +>alpha : string + return } diff --git a/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt new file mode 100644 index 0000000000..78efa2ed36 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefScope1.errors.txt @@ -0,0 +1,21 @@ +typedefScope1.js(13,12): error TS2304: Cannot find name 'B'. + + +==== typedefScope1.js (1 errors) ==== + function B1() { + /** @typedef {number} B */ + /** @type {B} */ + var ok1 = 0; + } + + function B2() { + /** @typedef {string} B */ + /** @type {B} */ + var ok2 = 'hi'; + } + + /** @type {B} */ + ~ +!!! error TS2304: Cannot find name 'B'. + var notOK = 0; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefScope1.types b/testdata/baselines/reference/submodule/conformance/typedefScope1.types index e39fc7c9c4..d968b4d867 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefScope1.types +++ b/testdata/baselines/reference/submodule/conformance/typedefScope1.types @@ -5,6 +5,8 @@ function B1() { >B1 : () => void /** @typedef {number} B */ +>B : any + /** @type {B} */ var ok1 = 0; >ok1 : number @@ -15,6 +17,8 @@ function B2() { >B2 : () => void /** @typedef {string} B */ +>B : any + /** @type {B} */ var ok2 = 'hi'; >ok2 : string @@ -23,6 +27,6 @@ function B2() { /** @type {B} */ var notOK = 0; ->notOK : number +>notOK : B >0 : 0 diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt new file mode 100644 index 0000000000..ab86dff568 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.errors.txt @@ -0,0 +1,19 @@ +typedefTagExtraneousProperty.js(1,15): error TS2315: Type 'Object' is not generic. +typedefTagExtraneousProperty.js(1,21): error TS8020: JSDoc types can only be used inside documentation comments. + + +==== typedefTagExtraneousProperty.js (2 errors) ==== + /** @typedef {Object.} Mmap + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. + ~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. + * @property {string} ignoreMe - should be ignored + */ + + /** @type {Mmap} */ + var y = { bye: "no" }; + y + y.ignoreMe = "ok but just because of the index signature" + y['hi'] = "yes" + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.types b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.types index db359d3ed0..b835272b05 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.types +++ b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.types @@ -2,30 +2,32 @@ === typedefTagExtraneousProperty.js === /** @typedef {Object.} Mmap +>Mmap : any + * @property {string} ignoreMe - should be ignored */ /** @type {Mmap} */ var y = { bye: "no" }; ->y : { bye: string; } +>y : any >{ bye: "no" } : { bye: string; } >bye : string >"no" : "no" y ->y : { bye: string; } +>y : any y.ignoreMe = "ok but just because of the index signature" >y.ignoreMe = "ok but just because of the index signature" : "ok but just because of the index signature" >y.ignoreMe : any ->y : { bye: string; } +>y : any >ignoreMe : any >"ok but just because of the index signature" : "ok but just because of the index signature" y['hi'] = "yes" >y['hi'] = "yes" : "yes" >y['hi'] : any ->y : { bye: string; } +>y : any >'hi' : "hi" >"yes" : "yes" diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols index 7ad06b9859..f5ce0d08e3 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols @@ -57,11 +57,17 @@ var sala = { name: 'uppsala', not: 0, nested: "ok" }; >nested : Symbol(nested, Decl(a.js, 35, 37)) sala.name +>sala.name : Symbol(name, Decl(a.js, 35, 53)) >sala : Symbol(sala, Decl(a.js, 35, 3)) +>name : Symbol(name, Decl(a.js, 35, 53)) sala.not +>sala.not : Symbol(not, Decl(a.js, 35, 53)) >sala : Symbol(sala, Decl(a.js, 35, 3)) +>not : Symbol(not, Decl(a.js, 35, 53)) sala.nested +>sala.nested : Symbol(nested, Decl(a.js, 35, 53)) >sala : Symbol(sala, Decl(a.js, 35, 3)) +>nested : Symbol(nested, Decl(a.js, 35, 53)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff index c5a96d1529..9a4ab0ea33 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff @@ -14,16 +14,22 @@ sala.name ->sala.name : Symbol(name, Decl(a.js, 29, 3)) ++>sala.name : Symbol(name, Decl(a.js, 35, 53)) >sala : Symbol(sala, Decl(a.js, 35, 3)) ->name : Symbol(name, Decl(a.js, 29, 3)) ++>name : Symbol(name, Decl(a.js, 35, 53)) sala.not ->sala.not : Symbol(not, Decl(a.js, 30, 3)) ++>sala.not : Symbol(not, Decl(a.js, 35, 53)) >sala : Symbol(sala, Decl(a.js, 35, 3)) ->not : Symbol(not, Decl(a.js, 30, 3)) ++>not : Symbol(not, Decl(a.js, 35, 53)) sala.nested ->sala.nested : Symbol(nested, Decl(a.js, 31, 3)) ++>sala.nested : Symbol(nested, Decl(a.js, 35, 53)) >sala : Symbol(sala, Decl(a.js, 35, 3)) ->nested : Symbol(nested, Decl(a.js, 31, 3)) ++>nested : Symbol(nested, Decl(a.js, 35, 53)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.types b/testdata/baselines/reference/submodule/conformance/typedefTagNested.types index bd7a914515..0dc0a03ef3 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.types +++ b/testdata/baselines/reference/submodule/conformance/typedefTagNested.types @@ -2,17 +2,31 @@ === a.js === /** @typedef {Object} App +>App : any + * @property {string} name +>name : any + * @property {Object} icons +>icons : any + * @property {string} icons.image32 +>property : any +>icons : any +>image32 : any + * @property {string} icons.image64 +>property : any +>icons : any +>image64 : any + */ var ex; >ex : any /** @type {App} */ const app = { ->app : { name: string; icons: { image32: string; image64: string; }; } +>app : App >{ name: 'name', icons: { image32: 'x.png', image64: 'y.png', }} : { name: string; icons: { image32: string; image64: string; }; } name: 'name', @@ -34,6 +48,8 @@ const app = { } /** @typedef {Object} Opp +>Opp : any + * @property {string} name * @property {Object} oops * @property {string} horrible @@ -45,17 +61,25 @@ var intercessor = 1 /** @type {Opp} */ var mistake; ->mistake : any +>mistake : string /** @typedef {Object} Upp +>Upp : any + * @property {string} name +>name : any + * @property {Object} not +>not : any + * @property {string} nested +>nested : any + */ /** @type {Upp} */ var sala = { name: 'uppsala', not: 0, nested: "ok" }; ->sala : { name: string; not: number; nested: string; } +>sala : Upp >{ name: 'uppsala', not: 0, nested: "ok" } : { name: string; not: number; nested: string; } >name : string >'uppsala' : "uppsala" @@ -65,17 +89,17 @@ var sala = { name: 'uppsala', not: 0, nested: "ok" }; >"ok" : "ok" sala.name ->sala.name : string ->sala : { name: string; not: number; nested: string; } ->name : string +>sala.name : any +>sala : Upp +>name : any sala.not ->sala.not : number ->sala : { name: string; not: number; nested: string; } ->not : number +>sala.not : any +>sala : Upp +>not : any sala.nested ->sala.nested : string ->sala : { name: string; not: number; nested: string; } ->nested : string +>sala.nested : any +>sala : Upp +>nested : any diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt new file mode 100644 index 0000000000..8d39add592 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.errors.txt @@ -0,0 +1,37 @@ +github20832.js(2,15): error TS2304: Cannot find name 'U'. +github20832.js(26,12): error TS2304: Cannot find name 'Cb'. + + +==== github20832.js (2 errors) ==== + // #20832 + /** @typedef {U} T - should be "error, can't find type named 'U' */ + ~ +!!! error TS2304: Cannot find name 'U'. + /** + * @template U + * @param {U} x + * @return {T} + */ + function f(x) { + return x; + } + + /** @type T - should be fine, since T will be any */ + const x = 3; + + /** + * @callback Cb + * @param {V} firstParam + */ + /** + * @template V + * @param {V} vvvvv + */ + function g(vvvvv) { + } + + /** @type {Cb} */ + ~~ +!!! error TS2304: Cannot find name 'Cb'. + const cb = x => {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols index 0f598dad6e..3edf1c0f5c 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols @@ -3,6 +3,7 @@ === github20832.js === // #20832 /** @typedef {U} T - should be "error, can't find type named 'U' */ +>T : Symbol(T, Decl(github20832.js, 9, 1)) >U : Symbol(U) /** diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff index 622fffa9cf..61fd07da00 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff @@ -4,6 +4,7 @@ === github20832.js === // #20832 /** @typedef {U} T - should be "error, can't find type named 'U' */ ++>T : Symbol(T, Decl(github20832.js, 9, 1)) +>U : Symbol(U) + /** diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.types b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.types index 612f378daa..a4e28afe57 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.types +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.types @@ -3,22 +3,24 @@ === github20832.js === // #20832 /** @typedef {U} T - should be "error, can't find type named 'U' */ +>T : U + /** * @template U * @param {U} x * @return {T} */ function f(x) { ->f : (x: any) => any ->x : any +>f : (x: U) => U +>x : U return x; ->x : any +>x : U } /** @type T - should be fine, since T will be any */ const x = 3; ->x : 3 +>x : U >3 : 3 /** @@ -30,13 +32,13 @@ const x = 3; * @param {V} vvvvv */ function g(vvvvv) { ->g : (vvvvv: any) => void ->vvvvv : any +>g : (vvvvv: V) => void +>vvvvv : V } /** @type {Cb} */ const cb = x => {} ->cb : (x: any) => void +>cb : Cb >x => {} : (x: any) => void >x : any diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt new file mode 100644 index 0000000000..6b2506e05c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt @@ -0,0 +1,151 @@ +mod1.js(2,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +mod1.js(9,12): error TS2304: Cannot find name 'Type1'. +mod3.js(4,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +mod3.js(10,12): error TS2304: Cannot find name 'StringOrNumber1'. +mod4.js(4,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. + + +==== mod1.js (2 errors) ==== + /** + * @typedef {function(string): boolean} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + * Type1 + */ + + /** + * Tries to use a type whose name is on a different + * line than the typedef tag. + * @param {Type1} func The function to call. + ~~~~~ +!!! error TS2304: Cannot find name 'Type1'. + * @param {string} arg The argument to call it with. + * @returns {boolean} The return. + */ + function callIt(func, arg) { + return func(arg); + } + +==== mod2.js (0 errors) ==== + /** + * @typedef {{ + * num: number, + * str: string, + * boo: boolean + * }} Type2 + */ + + /** + * Makes use of a type with a multiline type expression. + * @param {Type2} obj The object. + * @returns {string|number} The return. + */ + function check(obj) { + return obj.boo ? obj.num : obj.str; + } + +==== mod3.js (2 errors) ==== + /** + * A function whose signature is very long. + * + * @typedef {function(boolean, string, number): + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + * (string|number)} StringOrNumber1 + */ + + /** + * Makes use of a function type with a long signature. + * @param {StringOrNumber1} func The function. + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'StringOrNumber1'. + * @param {boolean} bool The condition. + * @param {string} str The string. + * @param {number} num The number. + * @returns {string|number} The return. + */ + function use1(func, bool, str, num) { + return func(bool, str, num) + } + +==== mod4.js (2 errors) ==== + /** + * A function whose signature is very long. + * + * @typedef {function(boolean, string, + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + * number): + * (string|number)} StringOrNumber2 + */ + + /** + * Makes use of a function type with a long signature. + * @param {StringOrNumber2} func The function. + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'StringOrNumber2'. + * @param {boolean} bool The condition. + * @param {string} str The string. + * @param {number} num The number. + * @returns {string|number} The return. + */ + function use2(func, bool, str, num) { + return func(bool, str, num) + } + +==== mod5.js (0 errors) ==== + /** + * @typedef {{ + * num: + * number, + * str: + * string, + * boo: + * boolean + * }} Type5 + */ + + /** + * Makes use of a type with a multiline type expression. + * @param {Type5} obj The object. + * @returns {string|number} The return. + */ + function check5(obj) { + return obj.boo ? obj.num : obj.str; + } + +==== mod6.js (0 errors) ==== + /** + * @typedef {{ + * foo: + * *, + * bar: + * * + * }} Type6 + */ + + /** + * Makes use of a type with a multiline type expression. + * @param {Type6} obj The object. + * @returns {*} The return. + */ + function check6(obj) { + return obj.foo; + } + + +==== mod7.js (0 errors) ==== + /** + Multiline type expressions in comments without leading * are not supported. + @typedef {{ + foo: + *, + bar: + * + }} Type7 + */ + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols index 328a57444e..6cc5f9d19b 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols @@ -3,6 +3,7 @@ === mod1.js === /** * @typedef {function(string): boolean} +> : Symbol(, Decl(mod1.js, 14, 1)) >function : Symbol(function) * Type1 @@ -29,15 +30,11 @@ function callIt(func, arg) { /** * @typedef {{ * num: number, ->num : Symbol(num, Decl(mod2.js, 1, 14)) - * str: string, ->str : Symbol(str, Decl(mod2.js, 2, 17)) - * boo: boolean ->boo : Symbol(boo, Decl(mod2.js, 3, 17)) - * }} Type2 +>Type2 : Symbol(Type2, Decl(mod2.js, 15, 1)) + */ /** @@ -50,9 +47,15 @@ function check(obj) { >obj : Symbol(obj, Decl(mod2.js, 13, 15)) return obj.boo ? obj.num : obj.str; +>obj.boo : Symbol(boo, Decl(mod2.js, 3, 17)) >obj : Symbol(obj, Decl(mod2.js, 13, 15)) +>boo : Symbol(boo, Decl(mod2.js, 3, 17)) +>obj.num : Symbol(num, Decl(mod2.js, 1, 14)) >obj : Symbol(obj, Decl(mod2.js, 13, 15)) +>num : Symbol(num, Decl(mod2.js, 1, 14)) +>obj.str : Symbol(str, Decl(mod2.js, 2, 17)) >obj : Symbol(obj, Decl(mod2.js, 13, 15)) +>str : Symbol(str, Decl(mod2.js, 2, 17)) } === mod3.js === @@ -60,6 +63,7 @@ function check(obj) { * A function whose signature is very long. * * @typedef {function(boolean, string, number): +> : Symbol(, Decl(mod3.js, 17, 1)) >function : Symbol(function) * (string|number)} StringOrNumber1 @@ -92,6 +96,7 @@ function use1(func, bool, str, num) { * A function whose signature is very long. * * @typedef {function(boolean, string, +> : Symbol(, Decl(mod4.js, 18, 1)) >function : Symbol(function) * number): @@ -124,18 +129,14 @@ function use2(func, bool, str, num) { /** * @typedef {{ * num: ->num : Symbol(num, Decl(mod5.js, 1, 14)) - * number, * str: ->str : Symbol(str, Decl(mod5.js, 3, 12)) - * string, * boo: ->boo : Symbol(boo, Decl(mod5.js, 5, 12)) - * boolean * }} Type5 +>Type5 : Symbol(Type5, Decl(mod5.js, 18, 1)) + */ /** @@ -148,23 +149,27 @@ function check5(obj) { >obj : Symbol(obj, Decl(mod5.js, 16, 16)) return obj.boo ? obj.num : obj.str; +>obj.boo : Symbol(boo, Decl(mod5.js, 5, 12)) >obj : Symbol(obj, Decl(mod5.js, 16, 16)) +>boo : Symbol(boo, Decl(mod5.js, 5, 12)) +>obj.num : Symbol(num, Decl(mod5.js, 1, 14)) >obj : Symbol(obj, Decl(mod5.js, 16, 16)) +>num : Symbol(num, Decl(mod5.js, 1, 14)) +>obj.str : Symbol(str, Decl(mod5.js, 3, 12)) >obj : Symbol(obj, Decl(mod5.js, 16, 16)) +>str : Symbol(str, Decl(mod5.js, 3, 12)) } === mod6.js === /** * @typedef {{ * foo: ->foo : Symbol(foo, Decl(mod6.js, 1, 14)) - * *, * bar: ->bar : Symbol(bar, Decl(mod6.js, 3, 7)) - * * * }} Type6 +>Type6 : Symbol(Type6, Decl(mod6.js, 16, 1)) + */ /** @@ -177,7 +182,9 @@ function check6(obj) { >obj : Symbol(obj, Decl(mod6.js, 14, 16)) return obj.foo; +>obj.foo : Symbol(foo, Decl(mod6.js, 1, 14)) >obj : Symbol(obj, Decl(mod6.js, 14, 16)) +>foo : Symbol(foo, Decl(mod6.js, 1, 14)) } diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff index 9b42db48cb..627c12d3da 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff @@ -4,112 +4,56 @@ === mod1.js === /** * @typedef {function(string): boolean} ++> : Symbol(, Decl(mod1.js, 14, 1)) +>function : Symbol(function) + * Type1 */ -@@= skipped -24, +26 lines =@@ - /** - * @typedef {{ - * num: number, -+>num : Symbol(num, Decl(mod2.js, 1, 14)) -+ +@@= skipped -27, +30 lines =@@ * str: string, -+>str : Symbol(str, Decl(mod2.js, 2, 17)) -+ * boo: boolean -+>boo : Symbol(boo, Decl(mod2.js, 3, 17)) -+ * }} Type2 ++>Type2 : Symbol(Type2, Decl(mod2.js, 15, 1)) ++ */ -@@= skipped -15, +21 lines =@@ - >obj : Symbol(obj, Decl(mod2.js, 13, 15)) - - return obj.boo ? obj.num : obj.str; -->obj.boo : Symbol(boo, Decl(mod2.js, 3, 17)) - >obj : Symbol(obj, Decl(mod2.js, 13, 15)) -->boo : Symbol(boo, Decl(mod2.js, 3, 17)) -->obj.num : Symbol(num, Decl(mod2.js, 1, 14)) - >obj : Symbol(obj, Decl(mod2.js, 13, 15)) -->num : Symbol(num, Decl(mod2.js, 1, 14)) -->obj.str : Symbol(str, Decl(mod2.js, 2, 17)) - >obj : Symbol(obj, Decl(mod2.js, 13, 15)) -->str : Symbol(str, Decl(mod2.js, 2, 17)) - } - - === mod3.js === -@@= skipped -16, +10 lines =@@ + /** +@@= skipped -28, +30 lines =@@ * A function whose signature is very long. * * @typedef {function(boolean, string, number): ++> : Symbol(, Decl(mod3.js, 17, 1)) +>function : Symbol(function) + * (string|number)} StringOrNumber1 */ -@@= skipped -30, +32 lines =@@ +@@= skipped -30, +33 lines =@@ * A function whose signature is very long. * * @typedef {function(boolean, string, ++> : Symbol(, Decl(mod4.js, 18, 1)) +>function : Symbol(function) + * number): * (string|number)} StringOrNumber2 */ -@@= skipped -30, +32 lines =@@ - /** - * @typedef {{ - * num: -+>num : Symbol(num, Decl(mod5.js, 1, 14)) -+ - * number, - * str: -+>str : Symbol(str, Decl(mod5.js, 3, 12)) -+ - * string, +@@= skipped -36, +39 lines =@@ * boo: -+>boo : Symbol(boo, Decl(mod5.js, 5, 12)) -+ * boolean * }} Type5 ++>Type5 : Symbol(Type5, Decl(mod5.js, 18, 1)) ++ */ -@@= skipped -18, +24 lines =@@ - >obj : Symbol(obj, Decl(mod5.js, 16, 16)) - - return obj.boo ? obj.num : obj.str; -->obj.boo : Symbol(boo, Decl(mod5.js, 5, 12)) - >obj : Symbol(obj, Decl(mod5.js, 16, 16)) -->boo : Symbol(boo, Decl(mod5.js, 5, 12)) -->obj.num : Symbol(num, Decl(mod5.js, 1, 14)) - >obj : Symbol(obj, Decl(mod5.js, 16, 16)) -->num : Symbol(num, Decl(mod5.js, 1, 14)) -->obj.str : Symbol(str, Decl(mod5.js, 3, 12)) - >obj : Symbol(obj, Decl(mod5.js, 16, 16)) -->str : Symbol(str, Decl(mod5.js, 3, 12)) - } - === mod6.js === - /** - * @typedef {{ - * foo: -+>foo : Symbol(foo, Decl(mod6.js, 1, 14)) -+ - * *, + /** +@@= skipped -31, +33 lines =@@ * bar: -+>bar : Symbol(bar, Decl(mod6.js, 3, 7)) -+ * * * }} Type6 ++>Type6 : Symbol(Type6, Decl(mod6.js, 16, 1)) ++ */ -@@= skipped -31, +29 lines =@@ - >obj : Symbol(obj, Decl(mod6.js, 14, 16)) - - return obj.foo; -->obj.foo : Symbol(foo, Decl(mod6.js, 1, 14)) - >obj : Symbol(obj, Decl(mod6.js, 14, 16)) -->foo : Symbol(foo, Decl(mod6.js, 1, 14)) - } - + /** diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.types b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.types index 57533db763..89baa116a0 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.types +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.types @@ -3,6 +3,8 @@ === mod1.js === /** * @typedef {function(string): boolean} +> : function + * Type1 */ @@ -14,14 +16,14 @@ * @returns {boolean} The return. */ function callIt(func, arg) { ->callIt : (func: any, arg: any) => any ->func : any ->arg : any +>callIt : (func: Type1, arg: string) => boolean +>func : Type1 +>arg : string return func(arg); >func(arg) : any ->func : any ->arg : any +>func : Type1 +>arg : string } === mod2.js === @@ -31,6 +33,8 @@ function callIt(func, arg) { * str: string, * boo: boolean * }} Type2 +>Type2 : Type2 + */ /** @@ -39,20 +43,20 @@ function callIt(func, arg) { * @returns {string|number} The return. */ function check(obj) { ->check : (obj: any) => any ->obj : any +>check : (obj: Type2) => string | number +>obj : Type2 return obj.boo ? obj.num : obj.str; ->obj.boo ? obj.num : obj.str : any ->obj.boo : any ->obj : any ->boo : any ->obj.num : any ->obj : any ->num : any ->obj.str : any ->obj : any ->str : any +>obj.boo ? obj.num : obj.str : string | number +>obj.boo : boolean +>obj : Type2 +>boo : boolean +>obj.num : number +>obj : Type2 +>num : number +>obj.str : string +>obj : Type2 +>str : string } === mod3.js === @@ -60,6 +64,8 @@ function check(obj) { * A function whose signature is very long. * * @typedef {function(boolean, string, number): +> : function + * (string|number)} StringOrNumber1 */ @@ -72,18 +78,18 @@ function check(obj) { * @returns {string|number} The return. */ function use1(func, bool, str, num) { ->use1 : (func: any, bool: any, str: any, num: any) => any ->func : any ->bool : any ->str : any ->num : any +>use1 : (func: StringOrNumber1, bool: boolean, str: string, num: number) => string | number +>func : StringOrNumber1 +>bool : boolean +>str : string +>num : number return func(bool, str, num) >func(bool, str, num) : any ->func : any ->bool : any ->str : any ->num : any +>func : StringOrNumber1 +>bool : boolean +>str : string +>num : number } === mod4.js === @@ -91,6 +97,8 @@ function use1(func, bool, str, num) { * A function whose signature is very long. * * @typedef {function(boolean, string, +> : function + * number): * (string|number)} StringOrNumber2 */ @@ -104,18 +112,18 @@ function use1(func, bool, str, num) { * @returns {string|number} The return. */ function use2(func, bool, str, num) { ->use2 : (func: any, bool: any, str: any, num: any) => any ->func : any ->bool : any ->str : any ->num : any +>use2 : (func: StringOrNumber2, bool: boolean, str: string, num: number) => string | number +>func : StringOrNumber2 +>bool : boolean +>str : string +>num : number return func(bool, str, num) >func(bool, str, num) : any ->func : any ->bool : any ->str : any ->num : any +>func : StringOrNumber2 +>bool : boolean +>str : string +>num : number } === mod5.js === @@ -128,6 +136,8 @@ function use2(func, bool, str, num) { * boo: * boolean * }} Type5 +>Type5 : Type5 + */ /** @@ -136,20 +146,20 @@ function use2(func, bool, str, num) { * @returns {string|number} The return. */ function check5(obj) { ->check5 : (obj: any) => any ->obj : any +>check5 : (obj: Type5) => string | number +>obj : Type5 return obj.boo ? obj.num : obj.str; ->obj.boo ? obj.num : obj.str : any ->obj.boo : any ->obj : any ->boo : any ->obj.num : any ->obj : any ->num : any ->obj.str : any ->obj : any ->str : any +>obj.boo ? obj.num : obj.str : string | number +>obj.boo : boolean +>obj : Type5 +>boo : boolean +>obj.num : number +>obj : Type5 +>num : number +>obj.str : string +>obj : Type5 +>str : string } === mod6.js === @@ -160,6 +170,8 @@ function check5(obj) { * bar: * * * }} Type6 +>Type6 : Type6 + */ /** @@ -168,12 +180,12 @@ function check5(obj) { * @returns {*} The return. */ function check6(obj) { ->check6 : (obj: any) => any ->obj : any +>check6 : (obj: Type6) => any +>obj : Type6 return obj.foo; >obj.foo : any ->obj : any +>obj : Type6 >foo : any } diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.errors.txt b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.errors.txt new file mode 100644 index 0000000000..2c2ac38279 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.errors.txt @@ -0,0 +1,37 @@ +uniqueSymbolsDeclarationsInJs.js(11,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. +uniqueSymbolsDeclarationsInJs.js(16,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + + +==== uniqueSymbolsDeclarationsInJs.js (2 errors) ==== + // classes + class C { + /** + * @readonly + */ + static readonlyStaticCall = Symbol(); + /** + * @type {unique symbol} + * @readonly + */ + static readonlyStaticType; + ~~~~~~~~~~~~~~~~~~ +!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + /** + * @type {unique symbol} + * @readonly + */ + static readonlyStaticTypeAndCall = Symbol(); + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + static readwriteStaticCall = Symbol(); + + /** + * @readonly + */ + readonlyCall = Symbol(); + readwriteCall = Symbol(); + } + + /** @type {unique symbol} */ + const a = Symbol(); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.types b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.types index c428356887..4b44b1dc5e 100644 --- a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.types +++ b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.types @@ -18,7 +18,7 @@ class C { * @readonly */ static readonlyStaticType; ->readonlyStaticType : any +>readonlyStaticType : symbol /** * @type {unique symbol} diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt new file mode 100644 index 0000000000..e7c5d274aa --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt @@ -0,0 +1,28 @@ +uniqueSymbolsDeclarationsInJsErrors.js(5,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. +uniqueSymbolsDeclarationsInJsErrors.js(10,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. +uniqueSymbolsDeclarationsInJsErrors.js(14,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + + +==== uniqueSymbolsDeclarationsInJsErrors.js (3 errors) ==== + class C { + /** + * @type {unique symbol} + */ + static readwriteStaticType; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + /** + * @type {unique symbol} + * @readonly + */ + static readonlyType; + ~~~~~~~~~~~~ +!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + /** + * @type {unique symbol} + */ + static readwriteType; + ~~~~~~~~~~~~~ +!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.types b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.types index a8c3d4e36f..f5a9ef8de0 100644 --- a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.types +++ b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.types @@ -8,19 +8,19 @@ class C { * @type {unique symbol} */ static readwriteStaticType; ->readwriteStaticType : any +>readwriteStaticType : symbol /** * @type {unique symbol} * @readonly */ static readonlyType; ->readonlyType : any +>readonlyType : symbol /** * @type {unique symbol} */ static readwriteType; ->readwriteType : any +>readwriteType : symbol } diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt index d6462527e5..d8c96807f4 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt @@ -1,7 +1,8 @@ use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +use.js(10,12): error TS2503: Cannot find namespace 'ex'. -==== use.js (1 errors) ==== +==== use.js (2 errors) ==== var ex = require('./ex') ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -14,6 +15,8 @@ use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install t // types work /** * @param {ex.Crunch} wrap + ~~ +!!! error TS2503: Cannot find namespace 'ex'. */ function f(wrap) { wrap.n diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.types b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.types index c267bc137a..139f19cb5f 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.types +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.types @@ -27,12 +27,12 @@ crunch.n * @param {ex.Crunch} wrap */ function f(wrap) { ->f : (wrap: any) => void ->wrap : any +>f : (wrap: Crunch) => void +>wrap : Crunch wrap.n >wrap.n : any ->wrap : any +>wrap : Crunch >n : any } diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt b/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt index adf3e8e93c..f53556abb1 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.errors.txt @@ -1,7 +1,9 @@ use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +use.js(10,12): error TS2503: Cannot find namespace 'ex'. +use.js(11,12): error TS2503: Cannot find namespace 'ex'. -==== use.js (1 errors) ==== +==== use.js (3 errors) ==== var ex = require('./ex') ~~~~~~~ !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -14,7 +16,11 @@ use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install t // types work /** * @param {ex.Greatest} greatest + ~~ +!!! error TS2503: Cannot find namespace 'ex'. * @param {ex.Crunch} wrap + ~~ +!!! error TS2503: Cannot find namespace 'ex'. */ function f(greatest, wrap) { greatest.day diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.types b/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.types index 80075bcd63..d0fa7caa43 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.types +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromTypescript.types @@ -28,18 +28,18 @@ crunch.n * @param {ex.Crunch} wrap */ function f(greatest, wrap) { ->f : (greatest: any, wrap: any) => void ->greatest : any ->wrap : any +>f : (greatest: Greatest, wrap: Crunch) => void +>greatest : Greatest +>wrap : Crunch greatest.day >greatest.day : any ->greatest : any +>greatest : Greatest >day : any wrap.n >wrap.n : any ->wrap : any +>wrap : Crunch >n : any } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.types.diff index 583a1708ec..df7286b7f1 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.types.diff @@ -24,8 +24,8 @@ (BaseClass) => { ->(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : (BaseClass: typeof import("deps/BaseClass")) => any ->BaseClass : typeof import("deps/BaseClass") -+>(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : (BaseClass: unknown) => any -+>BaseClass : unknown ++>(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : (BaseClass: typeof BaseClass) => any ++>BaseClass : typeof BaseClass const ExtendedClass = BaseClass.extends({ ->ExtendedClass : new () => { f: () => "something"; } & import("deps/BaseClass") @@ -33,28 +33,25 @@ ->BaseClass.extends :
(a: A) => new () => A & import("deps/BaseClass") ->BaseClass : typeof import("deps/BaseClass") ->extends : (a: A) => new () => A & import("deps/BaseClass") -->{ f: function() { return "something"; } } : { f: () => "something"; } -+>ExtendedClass : any -+>BaseClass.extends({ f: function() { return "something"; } }) : any -+>BaseClass.extends : any -+>BaseClass : unknown -+>extends : any -+>{ f: function() { return "something"; } } : { f: () => string; } ++>ExtendedClass : new () => { f: () => "something"; } & BaseClass ++>BaseClass.extends({ f: function() { return "something"; } }) : new () => { f: () => "something"; } & BaseClass ++>BaseClass.extends : (a: A) => new () => A & BaseClass ++>BaseClass : typeof BaseClass ++>extends : (a: A) => new () => A & BaseClass + >{ f: function() { return "something"; } } : { f: () => "something"; } f: function() { -->f : () => "something" -->function() { return "something"; } : () => "something" -+>f : () => string -+>function() { return "something"; } : () => string +@@= skipped -26, +26 lines =@@ + >{} : {} - return "something"; - >"something" : "something" -@@= skipped -30, +30 lines =@@ + module.exports = ExtendedClass +->module.exports = ExtendedClass : any ++>module.exports = ExtendedClass : new () => { f: () => "something"; } & BaseClass >module.exports : any >module : {} >exports : any ->ExtendedClass : new () => { f: () => "something"; } & import("deps/BaseClass") -+>ExtendedClass : any ++>ExtendedClass : new () => { f: () => "something"; } & BaseClass return module.exports; >module.exports : any diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsObjectCreatesRestForJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsObjectCreatesRestForJs.types.diff index 7719a14e7a..5f75ac737d 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsObjectCreatesRestForJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsObjectCreatesRestForJs.types.diff @@ -45,15 +45,14 @@ */ function jsdocced(x) { arguments; } ->jsdocced : (x: number, ...args: any[]) => void -->x : number -+>jsdocced : (x: any) => void -+>x : any ++>jsdocced : (x: number) => void + >x : number >arguments : IArguments jsdocced(1); >jsdocced(1) : void ->jsdocced : (x: number, ...args: any[]) => void -+>jsdocced : (x: any) => void ++>jsdocced : (x: number) => void >1 : 1 function dontDoubleRest(x, ...y) { arguments; } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor1_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor1_Js.types.diff deleted file mode 100644 index 37d9dadea2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor1_Js.types.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.argumentsReferenceInConstructor1_Js.types -+++ new.argumentsReferenceInConstructor1_Js.types -@@= skipped -9, +9 lines =@@ - * @param {object} [foo={}] - */ - constructor(foo = {}) { -->foo : any -+>foo : {} - >{} : {} - - /** - * @type object - */ - this.arguments = foo; -->this.arguments = foo : any -+>this.arguments = foo : {} - >this.arguments : any - >this : this - >arguments : any -->foo : any -+>foo : {} - } - } - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor2_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor2_Js.types.diff deleted file mode 100644 index 47e48afd29..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor2_Js.types.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.argumentsReferenceInConstructor2_Js.types -+++ new.argumentsReferenceInConstructor2_Js.types -@@= skipped -9, +9 lines =@@ - * @param {object} [foo={}] - */ - constructor(foo = {}) { -->foo : any -+>foo : {} - >{} : {} - - /** - * @type object - */ - this["arguments"] = foo; -->this["arguments"] = foo : any -+>this["arguments"] = foo : {} - >this["arguments"] : any - >this : this - >"arguments" : "arguments" -->foo : any -+>foo : {} - } - } - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor3_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor3_Js.types.diff index 7432d0182e..1a9b89c2d4 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor3_Js.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor3_Js.types.diff @@ -1,27 +1,6 @@ --- old.argumentsReferenceInConstructor3_Js.types +++ new.argumentsReferenceInConstructor3_Js.types -@@= skipped -23, +23 lines =@@ - * @param {object} [foo={}] - */ - constructor(foo = {}) { -->foo : any -+>foo : {} - >{} : {} - - super(); -@@= skipped -11, +11 lines =@@ - * @type object - */ - this.foo = foo; -->this.foo = foo : any -+>this.foo = foo : {} - >this.foo : any - >this : this - >foo : any -->foo : any -+>foo : {} - - /** +@@= skipped -44, +44 lines =@@ * @type object */ this.bar = super.arguments.foo; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor4_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor4_Js.types.diff deleted file mode 100644 index 5e1994bca4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor4_Js.types.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.argumentsReferenceInConstructor4_Js.types -+++ new.argumentsReferenceInConstructor4_Js.types -@@= skipped -9, +9 lines =@@ - * @param {object} [foo={}] - */ - constructor(foo = {}) { -->foo : any -+>foo : {} - >{} : {} - - const key = "bar"; -@@= skipped -11, +11 lines =@@ - * @type object - */ - this.foo = foo; -->this.foo = foo : any -+>this.foo = foo : {} - >this.foo : any - >this : this - >foo : any -->foo : any -+>foo : {} - - /** - * @type object - */ - const arguments = this.arguments; -->arguments : any -+>arguments : { bar: {}; } - >this.arguments : { bar: {}; } - >this : this - >arguments : { bar: {}; } -@@= skipped -19, +19 lines =@@ - * @type object - */ - this.bar = arguments.bar; -->this.bar = arguments.bar : any -+>this.bar = arguments.bar : {} - >this.bar : any - >this : this - >bar : any -->arguments.bar : any -->arguments : any -->bar : any -+>arguments.bar : {} -+>arguments : { bar: {}; } -+>bar : {} - - /** - * @type object - */ - this.baz = arguments[key]; -->this.baz = arguments[key] : any -+>this.baz = arguments[key] : {} - >this.baz : any - >this : this - >baz : any -->arguments[key] : any -->arguments : any -+>arguments[key] : {} -+>arguments : { bar: {}; } - >key : "bar" - - /** - * @type object - */ - this.options = arguments; -->this.options = arguments : any -+>this.options = arguments : { bar: {}; } - >this.options : any - >this : this - >options : any -->arguments : any -+>arguments : { bar: {}; } - } - - get arguments() { diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor5_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor5_Js.types.diff deleted file mode 100644 index 38163af1ab..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor5_Js.types.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.argumentsReferenceInConstructor5_Js.types -+++ new.argumentsReferenceInConstructor5_Js.types -@@= skipped -18, +18 lines =@@ - * @param {object} [foo={}] - */ - constructor(foo = {}) { -->foo : any -+>foo : {} - >{} : {} - - /** - * @type object - */ - this.foo = foo; -->this.foo = foo : any -+>this.foo = foo : {} - >this.foo : any - >this : this - >foo : any -->foo : any -+>foo : {} - - /** - * @type object diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod1_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod1_Js.types.diff index 0621ed945c..c426286efd 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod1_Js.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod1_Js.types.diff @@ -5,22 +5,7 @@ */ m(foo = {}) { ->m : (foo?: object) => void -->foo : any -+>m : (foo?: {}) => void -+>foo : {} ++>m : (foo?: any) => void + >foo : any >{} : {} - /** - * @type object - */ - this.arguments = foo; -->this.arguments = foo : any -+>this.arguments = foo : {} - >this.arguments : any - >this : this - >arguments : any -->foo : any -+>foo : {} - } - } - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod2_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod2_Js.types.diff index dea65c918a..f70895d5ee 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod2_Js.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod2_Js.types.diff @@ -5,22 +5,7 @@ */ m(foo = {}) { ->m : (foo?: object) => void -->foo : any -+>m : (foo?: {}) => void -+>foo : {} ++>m : (foo?: any) => void + >foo : any >{} : {} - /** - * @type object - */ - this["arguments"] = foo; -->this["arguments"] = foo : any -+>this["arguments"] = foo : {} - >this["arguments"] : any - >this : this - >"arguments" : "arguments" -->foo : any -+>foo : {} - } - } - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod3_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod3_Js.types.diff index 43cf046736..c99c256f0a 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod3_Js.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod3_Js.types.diff @@ -5,22 +5,7 @@ */ m(foo = {}) { ->m : (foo?: object) => void -->foo : any -+>m : (foo?: {}) => void -+>foo : {} ++>m : (foo?: any) => void + >foo : any >{} : {} - /** - * @type object - */ - this.x = foo; -->this.x = foo : any -+>this.x = foo : {} - >this.x : any - >this : this - >x : any -->foo : any -+>foo : {} - - /** - * @type object diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod4_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod4_Js.types.diff index d79ce1087d..887cf06749 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod4_Js.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod4_Js.types.diff @@ -5,75 +5,7 @@ */ m(foo = {}) { ->m : (foo?: object) => void -->foo : any -+>m : (foo?: {}) => void -+>foo : {} - >{} : {} - - const key = "bar"; -@@= skipped -12, +12 lines =@@ - * @type object - */ - this.foo = foo; -->this.foo = foo : any -+>this.foo = foo : {} - >this.foo : any - >this : this ++>m : (foo?: any) => void >foo : any -->foo : any -+>foo : {} - - /** - * @type object - */ - const arguments = this.arguments; -->arguments : any -+>arguments : { bar: {}; } - >this.arguments : { bar: {}; } - >this : this - >arguments : { bar: {}; } -@@= skipped -19, +19 lines =@@ - * @type object - */ - this.bar = arguments.bar; -->this.bar = arguments.bar : any -+>this.bar = arguments.bar : {} - >this.bar : any - >this : this - >bar : any -->arguments.bar : any -->arguments : any -->bar : any -+>arguments.bar : {} -+>arguments : { bar: {}; } -+>bar : {} - - /** - * @type object - */ - this.baz = arguments[key]; -->this.baz = arguments[key] : any -+>this.baz = arguments[key] : {} - >this.baz : any - >this : this - >baz : any -->arguments[key] : any -->arguments : any -+>arguments[key] : {} -+>arguments : { bar: {}; } - >key : "bar" - - /** - * @type object - */ - this.options = arguments; -->this.options = arguments : any -+>this.options = arguments : { bar: {}; } - >this.options : any - >this : this - >options : any -->arguments : any -+>arguments : { bar: {}; } - } + >{} : {} - get arguments() { diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod5_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod5_Js.types.diff index ade06040cf..7e0607bdaf 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod5_Js.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod5_Js.types.diff @@ -5,22 +5,7 @@ */ m(foo = {}) { ->m : (foo?: object) => void -->foo : any -+>m : (foo?: {}) => void -+>foo : {} - >{} : {} - - /** - * @type object - */ - this.foo = foo; -->this.foo = foo : any -+>this.foo = foo : {} - >this.foo : any - >this : this ++>m : (foo?: any) => void >foo : any -->foo : any -+>foo : {} + >{} : {} - /** - * @type object diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/arrowFunctionJSDocAnnotation.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/arrowFunctionJSDocAnnotation.errors.txt.diff deleted file mode 100644 index ba394c12dd..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/arrowFunctionJSDocAnnotation.errors.txt.diff +++ /dev/null @@ -1,29 +0,0 @@ ---- old.arrowFunctionJSDocAnnotation.errors.txt -+++ new.arrowFunctionJSDocAnnotation.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(4,19): error TS7006: Parameter 'v' implicitly has an 'any' type. -+index.js(13,5): error TS7006: Parameter 'param' implicitly has an 'any' type. -+ -+ -+==== index.js (2 errors) ==== -+ /** -+ * @param {any} v -+ */ -+ function identity(v) { -+ ~ -+!!! error TS7006: Parameter 'v' implicitly has an 'any' type. -+ return v; -+ } -+ -+ const x = identity( -+ /** -+ * @param {number} param -+ * @returns {number=} -+ */ -+ param => param -+ ~~~~~ -+!!! error TS7006: Parameter 'param' implicitly has an 'any' type. -+ ); -+ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/arrowFunctionJSDocAnnotation.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/arrowFunctionJSDocAnnotation.types.diff deleted file mode 100644 index c36a517902..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/arrowFunctionJSDocAnnotation.types.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.arrowFunctionJSDocAnnotation.types -+++ new.arrowFunctionJSDocAnnotation.types -@@= skipped -21, +21 lines =@@ - * @returns {number=} - */ - param => param -->param => param : (param: number) => number | undefined -->param : number -->param : number -+>param => param : (param: any) => any -+>param : any -+>param : any - - ); - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt.diff deleted file mode 100644 index f353883d9e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsObjectLiteralHasCheckedKeyof.errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.checkJsObjectLiteralHasCheckedKeyof.errors.txt -+++ new.checkJsObjectLiteralHasCheckedKeyof.errors.txt -@@= skipped -0, +-1 lines =@@ --file.js(11,1): error TS2322: Type '"z"' is not assignable to type '"x" | "y"'. -- -- --==== file.js (1 errors) ==== -- // @ts-check -- const obj = { -- x: 1, -- y: 2 -- }; -- -- /** -- * @type {keyof typeof obj} -- */ -- let selected = "x"; -- selected = "z"; // should fail -- ~~~~~~~~ --!!! error TS2322: Type '"z"' is not assignable to type '"x" | "y"'. -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsObjectLiteralHasCheckedKeyof.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsObjectLiteralHasCheckedKeyof.types.diff deleted file mode 100644 index 19f363c177..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsObjectLiteralHasCheckedKeyof.types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.checkJsObjectLiteralHasCheckedKeyof.types -+++ new.checkJsObjectLiteralHasCheckedKeyof.types -@@= skipped -19, +19 lines =@@ - * @type {keyof typeof obj} - */ - let selected = "x"; -->selected : "x" | "y" -+>selected : string - >"x" : "x" - - selected = "z"; // should fail - >selected = "z" : "z" -->selected : "x" | "y" -+>selected : string - >"z" : "z" - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff index 3a095582c9..f371d32ac5 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff @@ -1,7 +1,14 @@ --- old.checkJsTypeDefNoUnusedLocalMarked.types +++ new.checkJsTypeDefNoUnusedLocalMarked.types -@@= skipped -23, +23 lines =@@ +@@= skipped -19, +19 lines =@@ + + === something.js === + /** @typedef {typeof import("./file")} Foo */ ++>Foo : any + /** @typedef {(foo: Foo) => string} FooFun */ ++>FooFun : any ++>foo : typeof Foo module.exports = /** @type {FooFun} */(void 0); ->module.exports = /** @type {FooFun} */(void 0) : (foo: Foo) => string @@ -9,11 +16,12 @@ ->module : { exports: (foo: Foo) => string; } ->exports : (foo: Foo) => string ->(void 0) : FooFun -+>module.exports = /** @type {FooFun} */(void 0) : undefined ++>module.exports = /** @type {FooFun} */(void 0) : (foo: typeof Foo) => string +>module.exports : any +>module : any +>exports : any -+>(void 0) : undefined ++>(void 0) : (foo: typeof Foo) => string ++>void 0 : (foo: typeof Foo) => string >void 0 : undefined >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt.diff index 1e8ac76736..9ea3b3212f 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt.diff @@ -1,26 +1,23 @@ --- old.checkJsdocTypeTagOnExportAssignment1.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment1.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -a.js(8,18): error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. -- -- ++a.js(8,16): error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b + + -==== checkJsdocTypeTagOnExportAssignment1.js (0 errors) ==== - --==== a.js (1 errors) ==== -- /** -- * @typedef {Object} Foo -- * @property {boolean} a -- * @property {boolean} b -- */ -- -- /** @type {Foo} */ -- export default { c: false }; + ==== a.js (1 errors) ==== + /** + * @typedef {Object} Foo +@@= skipped -11, +9 lines =@@ + + /** @type {Foo} */ + export default { c: false }; - ~ -!!! error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. -- --==== b.js (0 errors) ==== -- import a from "./a"; -- a; -- -@@= skipped --1, +1 lines =@@ -+ ++ ~~~~~~~~~~~~ ++!!! error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b + + ==== b.js (0 errors) ==== + import a from "./a"; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment1.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment1.types.diff index 5ac4999981..96d4b65aab 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment1.types.diff @@ -1,13 +1,32 @@ --- old.checkJsdocTypeTagOnExportAssignment1.types +++ new.checkJsdocTypeTagOnExportAssignment1.types -@@= skipped -16, +16 lines =@@ +@@= skipped -4, +4 lines =@@ + === a.js === + /** + * @typedef {Object} Foo ++>Foo : any ++ + * @property {boolean} a ++>a : any ++ + * @property {boolean} b ++>b : any ++ + */ + + /** @type {Foo} */ + export default { c: false }; ++>{ c: false } : Foo + >{ c: false } : { c: boolean; } + >c : boolean + >false : false === b.js === import a from "./a"; ->a : import("a").Foo -+>a : { c: boolean; } ++>a : Foo a; ->a : import("a").Foo -+>a : { c: boolean; } ++>a : Foo diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt.diff index d5c9b8cf66..4002e30751 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt.diff @@ -1,26 +1,23 @@ --- old.checkJsdocTypeTagOnExportAssignment2.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment2.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -b.js(2,18): error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. -- -- ++b.js(2,16): error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b + + -==== checkJsdocTypeTagOnExportAssignment2.js (0 errors) ==== - --==== a.ts (0 errors) ==== -- export interface Foo { -- a: number; -- b: number; -- } -- --==== b.js (1 errors) ==== -- /** @type {import("./a").Foo} */ -- export default { c: false }; + ==== a.ts (0 errors) ==== + export interface Foo { + a: number; +@@= skipped -11, +9 lines =@@ + ==== b.js (1 errors) ==== + /** @type {import("./a").Foo} */ + export default { c: false }; - ~ -!!! error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'. -- --==== c.js (0 errors) ==== -- import b from "./b"; -- b; -- -@@= skipped --1, +1 lines =@@ -+ ++ ~~~~~~~~~~~~ ++!!! error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b + + ==== c.js (0 errors) ==== + import b from "./b"; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment2.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment2.types.diff index 7e43d56d17..e85a405370 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment2.types.diff @@ -1,13 +1,20 @@ --- old.checkJsdocTypeTagOnExportAssignment2.types +++ new.checkJsdocTypeTagOnExportAssignment2.types -@@= skipped -19, +19 lines =@@ +@@= skipped -13, +13 lines =@@ + === b.js === + /** @type {import("./a").Foo} */ + export default { c: false }; ++>{ c: false } : Foo + >{ c: false } : { c: boolean; } + >c : boolean + >false : false === c.js === import b from "./b"; ->b : import("a").Foo -+>b : { c: boolean; } ++>b : Foo b; ->b : import("a").Foo -+>b : { c: boolean; } ++>b : Foo diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt.diff index 5ff3a7c368..fabeb0dd5b 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt.diff @@ -1,28 +1,11 @@ --- old.checkJsdocTypeTagOnExportAssignment3.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment3.errors.txt -@@= skipped -0, +-1 lines =@@ --a.js(10,16): error TS2739: Type '{ c: number; }' is missing the following properties from type 'Foo': a, b -- -- +@@= skipped -0, +0 lines =@@ + a.js(10,16): error TS2739: Type '{ c: number; }' is missing the following properties from type 'Foo': a, b + + -==== checkJsdocTypeTagOnExportAssignment3.js (0 errors) ==== - --==== a.js (1 errors) ==== -- /** -- * @typedef {Object} Foo -- * @property {boolean} a -- * @property {boolean} b -- */ -- -- const bar = { c: 1 }; -- -- /** @type {Foo} */ -- export default bar; -- ~~~ --!!! error TS2739: Type '{ c: number; }' is missing the following properties from type 'Foo': a, b -- --==== b.js (0 errors) ==== -- import a from "./a"; -- a; -- -@@= skipped --1, +1 lines =@@ -+ + ==== a.js (1 errors) ==== + /** + * @typedef {Object} Foo diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment3.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment3.types.diff index 89fa452fa7..1b32944a54 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment3.types.diff @@ -1,13 +1,33 @@ --- old.checkJsdocTypeTagOnExportAssignment3.types +++ new.checkJsdocTypeTagOnExportAssignment3.types -@@= skipped -20, +20 lines =@@ +@@= skipped -4, +4 lines =@@ + === a.js === + /** + * @typedef {Object} Foo ++>Foo : any ++ + * @property {boolean} a ++>a : any ++ + * @property {boolean} b ++>b : any ++ + */ + + const bar = { c: 1 }; +@@= skipped -12, +18 lines =@@ + + /** @type {Foo} */ + export default bar; ++>bar : Foo + >bar : { c: number; } === b.js === import a from "./a"; ->a : import("a").Foo -+>a : { c: number; } ++>a : Foo a; ->a : import("a").Foo -+>a : { c: number; } ++>a : Foo diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt.diff index 32ddc1e69a..b163f012f0 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt.diff @@ -1,21 +1,20 @@ --- old.checkJsdocTypeTagOnExportAssignment4.errors.txt +++ new.checkJsdocTypeTagOnExportAssignment4.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -a.js(6,16): error TS2322: Type 'string' is not assignable to type 'number'. -- -- ++a.js(6,16): error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. + + -==== checkJsdocTypeTagOnExportAssignment4.js (0 errors) ==== - --==== a.js (1 errors) ==== -- /** -- * @typedef {number} Foo -- */ -- -- /** @type {Foo} */ -- export default ""; -- ~~ + ==== a.js (1 errors) ==== + /** + * @typedef {number} Foo +@@= skipped -10, +8 lines =@@ + /** @type {Foo} */ + export default ""; + ~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. -- -- -@@= skipped --1, +1 lines =@@ -+ ++!!! error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. + + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment4.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment4.types.diff new file mode 100644 index 0000000000..44f3fd6a7e --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment4.types.diff @@ -0,0 +1,19 @@ +--- old.checkJsdocTypeTagOnExportAssignment4.types ++++ new.checkJsdocTypeTagOnExportAssignment4.types +@@= skipped -2, +2 lines =@@ + === checkJsdocTypeTagOnExportAssignment4.js === + + === a.js === +- + /** + * @typedef {number} Foo ++>Foo : any ++ + */ + + /** @type {Foo} */ + export default ""; ++>"" : number ++>"" : "" + + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment5.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment5.types.diff index 673e35bb07..cf6d92f0f2 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment5.types.diff @@ -1,13 +1,33 @@ --- old.checkJsdocTypeTagOnExportAssignment5.types +++ new.checkJsdocTypeTagOnExportAssignment5.types -@@= skipped -18, +18 lines =@@ +@@= skipped -4, +4 lines =@@ + === a.js === + /** + * @typedef {Object} Foo ++>Foo : any ++ + * @property {number} a ++>a : any ++ + * @property {number} b ++>b : any ++ + */ + + /** @type {Foo} */ + export default { a: 1, b: 1 }; ++>{ a: 1, b: 1 } : Foo + >{ a: 1, b: 1 } : { a: number; b: number; } + >a : number + >1 : 1 +@@= skipped -14, +21 lines =@@ === b.js === import a from "./a"; ->a : import("a").Foo -+>a : { a: number; b: number; } ++>a : Foo a; ->a : import("a").Foo -+>a : { a: number; b: number; } ++>a : Foo diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment6.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment6.types.diff index 42f203cb3c..42631feb2b 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment6.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment6.types.diff @@ -1,13 +1,33 @@ --- old.checkJsdocTypeTagOnExportAssignment6.types +++ new.checkJsdocTypeTagOnExportAssignment6.types -@@= skipped -20, +20 lines =@@ +@@= skipped -4, +4 lines =@@ + === a.js === + /** + * @typedef {Object} Foo ++>Foo : any ++ + * @property {number} a ++>a : any ++ + * @property {number} b ++>b : any ++ + */ + + /** @type {Foo} */ + export default { a: 1, b: 1, c: 1 }; ++>{ a: 1, b: 1, c: 1 } : Foo + >{ a: 1, b: 1, c: 1 } : { a: number; b: number; c: number; } + >a : number + >1 : 1 +@@= skipped -16, +23 lines =@@ === b.js === import a from "./a"; ->a : import("a").Foo -+>a : { a: number; b: number; c: number; } ++>a : Foo a; ->a : import("a").Foo -+>a : { a: number; b: number; c: number; } ++>a : Foo diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment7.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment7.types.diff index b6c4a8026b..e19af3bc16 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment7.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment7.types.diff @@ -1,13 +1,33 @@ --- old.checkJsdocTypeTagOnExportAssignment7.types +++ new.checkJsdocTypeTagOnExportAssignment7.types -@@= skipped -24, +24 lines =@@ +@@= skipped -4, +4 lines =@@ + === a.js === + /** + * @typedef {Object} Foo ++>Foo : any ++ + * @property {number} a ++>a : any ++ + * @property {number} b ++>b : any ++ + */ + + const abc = { a: 1, b: 1, c: 1 }; +@@= skipped -16, +22 lines =@@ + + /** @type {Foo} */ + export default abc; ++>abc : Foo + >abc : { a: number; b: number; c: number; } === b.js === import a from "./a"; ->a : import("a").Foo -+>a : { a: number; b: number; c: number; } ++>a : Foo a; ->a : import("a").Foo -+>a : { a: number; b: number; c: number; } ++>a : Foo diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment8.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment8.types.diff index f5b0d64b85..cadb646896 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment8.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment8.types.diff @@ -1,10 +1,23 @@ --- old.checkJsdocTypeTagOnExportAssignment8.types +++ new.checkJsdocTypeTagOnExportAssignment8.types -@@= skipped -10, +10 lines =@@ +@@= skipped -4, +4 lines =@@ + === a.js === + /** + * @typedef Foo ++>Foo : any ++ + * @property {string} a ++>a : any ++ + * @property {'b'} b ++>b : any ++ + */ /** @type {Foo} */ export default { ->{ a: 'a', b: 'b'} : { a: string; b: "b"; } ++>{ a: 'a', b: 'b'} : Foo +>{ a: 'a', b: 'b'} : { a: string; b: string; } a: 'a', diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff deleted file mode 100644 index d33131fbc5..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.errors.txt.diff +++ /dev/null @@ -1,55 +0,0 @@ ---- old.contextuallyTypedParametersOptionalInJSDoc.errors.txt -+++ new.contextuallyTypedParametersOptionalInJSDoc.errors.txt -@@= skipped -0, +0 lines =@@ --index.js(17,15): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. -- Type 'undefined' is not assignable to type 'number'. --index.js(28,15): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. -- Type 'undefined' is not assignable to type 'number'. -+index.js(16,17): error TS7006: Parameter 'a' implicitly has an 'any' type. -+index.js(16,20): error TS7006: Parameter 'b' implicitly has an 'any' type. -+index.js(18,5): error TS2554: Expected 2 arguments, but got 1. -+index.js(27,17): error TS7006: Parameter 'a' implicitly has an 'any' type. -+index.js(29,5): error TS2554: Expected 2 arguments, but got 1. - - --==== index.js (2 errors) ==== -+==== index.js (5 errors) ==== - /** - * - * @param {number} num -@@= skipped -20, +21 lines =@@ - * @param [b] - */ - function self(a, b) { -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. - acceptNum(b); // error -- ~ --!!! error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. --!!! error TS2345: Type 'undefined' is not assignable to type 'number'. - self(""); -+ ~~~~ -+!!! error TS2554: Expected 2 arguments, but got 1. -+!!! related TS6210 index.js:16:20: An argument for 'b' was not provided. - self("", undefined); - }; - -@@= skipped -14, +18 lines =@@ - * @param {number} [b] - */ - function self(a, b) { -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. - acceptNum(b); // error -- ~ --!!! error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. --!!! error TS2345: Type 'undefined' is not assignable to type 'number'. - self(""); -+ ~~~~ -+!!! error TS2554: Expected 2 arguments, but got 1. -+!!! related TS6210 index.js:27:20: An argument for 'b' was not provided. - self("", undefined); - }; - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.types.diff index ef23d5f50c..316969bdcb 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.types.diff @@ -1,62 +1,28 @@ --- old.contextuallyTypedParametersOptionalInJSDoc.types +++ new.contextuallyTypedParametersOptionalInJSDoc.types -@@= skipped -5, +5 lines =@@ - * @param {number} num - */ - function acceptNum(num) {} -->acceptNum : (num: number) => void -->num : number -+>acceptNum : (num: any) => void -+>num : any +@@= skipped -10, +10 lines =@@ /** * @typedef {(a: string, b: number) => void} Fn -@@= skipped -9, +9 lines =@@ ++>Fn : any ++>a : string ++>b : number ++ + */ /** @type {Fn} */ const fn1 = ->fn1 : Fn -+>fn1 : (a: any, b: any) => void ++>fn1 : (a: string, b: number) => void /** * @param [b] - */ - function self(a, b) { -->function self(a, b) { acceptNum(b); // error self(""); self("", undefined); } : (a: string, b?: number | undefined) => void -->self : (a: string, b?: number | undefined) => void -->a : string -->b : number | undefined -+>function self(a, b) { acceptNum(b); // error self(""); self("", undefined); } : (a: any, b: any) => void -+>self : (a: any, b: any) => void -+>a : any -+>b : any - - acceptNum(b); // error - >acceptNum(b) : void -->acceptNum : (num: number) => void -->b : number | undefined -+>acceptNum : (num: any) => void -+>b : any - - self(""); - >self("") : void -->self : (a: string, b?: number | undefined) => void -+>self : (a: any, b: any) => void - >"" : "" - - self("", undefined); - >self("", undefined) : void -->self : (a: string, b?: number | undefined) => void -+>self : (a: any, b: any) => void - >"" : "" - >undefined : undefined - -@@= skipped -31, +31 lines =@@ +@@= skipped -35, +39 lines =@@ /** @type {Fn} */ const fn2 = ->fn2 : Fn -+>fn2 : (a: any, b: any) => void ++>fn2 : (a: string, b: number) => void /** * @param {number} [b] @@ -64,30 +30,23 @@ function self(a, b) { ->function self(a, b) { acceptNum(b); // error self(""); self("", undefined); } : (a: string, b?: number) => void ->self : (a: string, b?: number) => void -->a : string -->b : number | undefined -+>function self(a, b) { acceptNum(b); // error self(""); self("", undefined); } : (a: any, b: any) => void -+>self : (a: any, b: any) => void -+>a : any -+>b : any ++>function self(a, b) { acceptNum(b); // error self(""); self("", undefined); } : (a: string, b?: number | undefined) => void ++>self : (a: string, b?: number | undefined) => void + >a : string + >b : number | undefined - acceptNum(b); // error - >acceptNum(b) : void -->acceptNum : (num: number) => void -->b : number | undefined -+>acceptNum : (num: any) => void -+>b : any +@@= skipped -18, +18 lines =@@ self(""); >self("") : void ->self : (a: string, b?: number) => void -+>self : (a: any, b: any) => void ++>self : (a: string, b?: number | undefined) => void >"" : "" self("", undefined); >self("", undefined) : void ->self : (a: string, b?: number) => void -+>self : (a: any, b: any) => void ++>self : (a: string, b?: number | undefined) => void >"" : "" >undefined : undefined diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff deleted file mode 100644 index 1c6304dd5d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt -+++ new.contravariantOnlyInferenceFromAnnotatedFunctionJs.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(13,14): error TS7006: Parameter 'fns' implicitly has an 'any' type. -+index.js(21,8): error TS7006: Parameter 'a' implicitly has an 'any' type. -+ -+ -+==== index.js (2 errors) ==== -+ /** -+ * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs -+ * @template A -+ * @template {Record} B -+ */ -+ -+ /** -+ * @template A -+ * @template {Record} B -+ * @param {Funcs} fns -+ * @returns {[A, B]} -+ */ -+ function foo(fns) { -+ ~~~ -+!!! error TS7006: Parameter 'fns' implicitly has an 'any' type. -+ return /** @type {any} */ (null); -+ } -+ -+ const result = foo({ -+ bar: { -+ fn: -+ /** @param {string} a */ -+ (a) => {}, -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ thing: "asd", -+ }, -+ }); diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types.diff index c48ebde200..34ec02aa68 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types.diff @@ -1,45 +1,23 @@ --- old.contravariantOnlyInferenceFromAnnotatedFunctionJs.types +++ new.contravariantOnlyInferenceFromAnnotatedFunctionJs.types -@@= skipped -13, +13 lines =@@ - * @returns {[A, B]} +@@= skipped -2, +2 lines =@@ + === index.js === + /** + * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs ++>Funcs : Funcs ++>fn : (a: A, b: B) => void ++>a : A ++>b : B ++>thing : B[K] ++ + * @template A + * @template {Record} B */ - function foo(fns) { -->foo : >(fns: Funcs) => [A, B] -->fns : Funcs -+>foo : (fns: any) => null -+>fns : any +@@= skipped -16, +22 lines =@@ return /** @type {any} */ (null); -->(null) : any -+>(null) : null + >(null) : any ++>null : any } const result = foo({ -->result : [string, { bar: string; }] -->foo({ bar: { fn: /** @param {string} a */ (a) => {}, thing: "asd", },}) : [string, { bar: string; }] -->foo : >(fns: Funcs) => [A, B] -->{ bar: { fn: /** @param {string} a */ (a) => {}, thing: "asd", },} : { bar: { fn: (a: string) => void; thing: string; }; } -+>result : null -+>foo({ bar: { fn: /** @param {string} a */ (a) => {}, thing: "asd", },}) : null -+>foo : (fns: any) => null -+>{ bar: { fn: /** @param {string} a */ (a) => {}, thing: "asd", },} : { bar: { fn: (a: any) => void; thing: string; }; } - - bar: { -->bar : { fn: (a: string) => void; thing: string; } -->{ fn: /** @param {string} a */ (a) => {}, thing: "asd", } : { fn: (a: string) => void; thing: string; } -+>bar : { fn: (a: any) => void; thing: string; } -+>{ fn: /** @param {string} a */ (a) => {}, thing: "asd", } : { fn: (a: any) => void; thing: string; } - - fn: -->fn : (a: string) => void -+>fn : (a: any) => void - - /** @param {string} a */ - (a) => {}, -->(a) => {} : (a: string) => void -->a : string -+>(a) => {} : (a: any) => void -+>a : any - - thing: "asd", - >thing : string diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff deleted file mode 100644 index 7dd3b2988c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt.diff +++ /dev/null @@ -1,44 +0,0 @@ ---- old.contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt -+++ new.contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(6,17): error TS7006: Parameter 'predicate' implicitly has an 'any' type. -+index.js(14,4): error TS7006: Parameter 'pose' implicitly has an 'any' type. -+index.js(22,4): error TS7006: Parameter 'pose' implicitly has an 'any' type. -+index.js(22,10): error TS7006: Parameter '_' implicitly has an 'any' type. -+ -+ -+==== index.js (4 errors) ==== -+ /** -+ * @template T -+ * @param {(value: T, index: number) => boolean} predicate -+ * @returns {T} -+ */ -+ function filter(predicate) { -+ ~~~~~~~~~ -+!!! error TS7006: Parameter 'predicate' implicitly has an 'any' type. -+ return /** @type {any} */ (null); -+ } -+ -+ const a = filter( -+ /** -+ * @param {number} [pose] -+ */ -+ (pose) => true -+ ~~~~ -+!!! error TS7006: Parameter 'pose' implicitly has an 'any' type. -+ ); -+ -+ const b = filter( -+ /** -+ * @param {number} [pose] -+ * @param {number} [_] -+ */ -+ (pose, _) => true -+ ~~~~ -+!!! error TS7006: Parameter 'pose' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter '_' implicitly has an 'any' type. -+ ); -+ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types.diff index e0f29357b1..c1be129b9e 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types.diff @@ -1,58 +1,28 @@ --- old.contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types +++ new.contravariantOnlyInferenceWithAnnotatedOptionalParameterJs.types -@@= skipped -6, +6 lines =@@ - * @returns {T} - */ - function filter(predicate) { -->filter : (predicate: (value: T, index: number) => boolean) => T -->predicate : (value: T, index: number) => boolean -+>filter : (predicate: any) => null -+>predicate : any +@@= skipped -11, +11 lines =@@ return /** @type {any} */ (null); -->(null) : any -+>(null) : null + >(null) : any ++>null : any } const a = filter( -->a : number | undefined -->filter( /** * @param {number} [pose] */ (pose) => true) : number | undefined -->filter : (predicate: (value: T, index: number) => boolean) => T -+>a : null -+>filter( /** * @param {number} [pose] */ (pose) => true) : null -+>filter : (predicate: any) => null - - /** +@@= skipped -11, +12 lines =@@ * @param {number} [pose] */ (pose) => true ->(pose) => true : (pose?: number) => true -->pose : number | undefined -+>(pose) => true : (pose: any) => boolean -+>pose : any ++>(pose) => true : (pose?: number | undefined) => true + >pose : number | undefined >true : true - ); - - const b = filter( -->b : number | undefined -->filter( /** * @param {number} [pose] * @param {number} [_] */ (pose, _) => true) : number | undefined -->filter : (predicate: (value: T, index: number) => boolean) => T -+>b : null -+>filter( /** * @param {number} [pose] * @param {number} [_] */ (pose, _) => true) : null -+>filter : (predicate: any) => null - - /** - * @param {number} [pose] +@@= skipped -16, +16 lines =@@ * @param {number} [_] */ (pose, _) => true ->(pose, _) => true : (pose?: number, _?: number) => true -->pose : number | undefined -->_ : number | undefined -+>(pose, _) => true : (pose: any, _: any) => boolean -+>pose : any -+>_ : any ++>(pose, _) => true : (pose?: number | undefined, _?: number | undefined) => true + >pose : number | undefined + >_ : number | undefined >true : true - - ); diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/controlFlowInstanceof.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/controlFlowInstanceof.types.diff index 569daf34db..d4ff385d0c 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/controlFlowInstanceof.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/controlFlowInstanceof.types.diff @@ -31,23 +31,17 @@ >val : any >val : any - /** @type {*} */ - var v = 1; -->v : any -+>v : number - >1 : 1 - +@@= skipped -16, +16 lines =@@ if (v instanceof AtTop) { >v instanceof AtTop : boolean -->v : any + >v : any ->AtTop : typeof AtTop -+>v : number +>AtTop : (val: any) => void v.val >v.val : any ->v : AtTop -+>v : number ++>v : {} >val : any } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt.diff deleted file mode 100644 index 61298b1cc6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt.diff +++ /dev/null @@ -1,48 +0,0 @@ ---- old.declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt -+++ new.declarationEmitCastReusesTypeNode4(strictnullchecks=false).errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+input.js(5,7): error TS7005: Variable 'something' implicitly has an 'any' type. -+ -+ -+==== input.js (1 errors) ==== -+ /** -+ * @typedef {{ } & { name?: string }} P -+ */ -+ -+ const something = /** @type {*} */(null); -+ ~~~~~~~~~ -+!!! error TS7005: Variable 'something' implicitly has an 'any' type. -+ -+ export let vLet = /** @type {P} */(something); -+ export const vConst = /** @type {P} */(something); -+ -+ export function fn(p = /** @type {P} */(something)) {} -+ -+ /** @param {number} req */ -+ export function fnWithRequiredDefaultParam(p = /** @type {P} */(something), req) {} -+ -+ export class C { -+ field = /** @type {P} */(something); -+ /** @optional */ optField = /** @type {P} */(something); // not a thing -+ /** @readonly */ roFiled = /** @type {P} */(something); -+ method(p = /** @type {P} */(something)) {} -+ /** @param {number} req */ -+ methodWithRequiredDefault(p = /** @type {P} */(something), req) {} -+ -+ constructor(ctorField = /** @type {P} */(something)) {} -+ -+ get x() { return /** @type {P} */(something) } -+ set x(v) { } -+ } -+ -+ export default /** @type {P} */(something); -+ -+ // allows `undefined` on the input side, thanks to the initializer -+ /** -+ * -+ * @param {P} x -+ * @param {number} b -+ */ -+ export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt.diff deleted file mode 100644 index 44bdfc61d2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt.diff +++ /dev/null @@ -1,54 +0,0 @@ ---- old.declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt -+++ new.declarationEmitCastReusesTypeNode4(strictnullchecks=true).errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+input.js(13,77): error TS7006: Parameter 'req' implicitly has an 'any' type. -+input.js(21,64): error TS7006: Parameter 'req' implicitly has an 'any' type. -+input.js(37,88): error TS7006: Parameter 'b' implicitly has an 'any' type. -+ -+ -+==== input.js (3 errors) ==== -+ /** -+ * @typedef {{ } & { name?: string }} P -+ */ -+ -+ const something = /** @type {*} */(null); -+ -+ export let vLet = /** @type {P} */(something); -+ export const vConst = /** @type {P} */(something); -+ -+ export function fn(p = /** @type {P} */(something)) {} -+ -+ /** @param {number} req */ -+ export function fnWithRequiredDefaultParam(p = /** @type {P} */(something), req) {} -+ ~~~ -+!!! error TS7006: Parameter 'req' implicitly has an 'any' type. -+ -+ export class C { -+ field = /** @type {P} */(something); -+ /** @optional */ optField = /** @type {P} */(something); // not a thing -+ /** @readonly */ roFiled = /** @type {P} */(something); -+ method(p = /** @type {P} */(something)) {} -+ /** @param {number} req */ -+ methodWithRequiredDefault(p = /** @type {P} */(something), req) {} -+ ~~~ -+!!! error TS7006: Parameter 'req' implicitly has an 'any' type. -+ -+ constructor(ctorField = /** @type {P} */(something)) {} -+ -+ get x() { return /** @type {P} */(something) } -+ set x(v) { } -+ } -+ -+ export default /** @type {P} */(something); -+ -+ // allows `undefined` on the input side, thanks to the initializer -+ /** -+ * -+ * @param {P} x -+ * @param {number} b -+ */ -+ export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {} -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitClassAccessorsJs1.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitClassAccessorsJs1.types.diff deleted file mode 100644 index 767a0e1512..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitClassAccessorsJs1.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationEmitClassAccessorsJs1.types -+++ new.declarationEmitClassAccessorsJs1.types -@@= skipped -20, +20 lines =@@ - */ - set path(path) { - >path : string -->path : string | URL -+>path : string - } - } - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitClassSetAccessorParamNameInJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitClassSetAccessorParamNameInJs.types.diff deleted file mode 100644 index f17be3923d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitClassSetAccessorParamNameInJs.types.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.declarationEmitClassSetAccessorParamNameInJs.types -+++ new.declarationEmitClassSetAccessorParamNameInJs.types -@@= skipped -11, +11 lines =@@ - * @param {string} baz Baz. - */ - set bar(baz) {} -->bar : string -->baz : string -+>bar : any -+>baz : any - } - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt.diff deleted file mode 100644 index 970edf2a77..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitObjectLiteralAccessorsJs1.errors.txt.diff +++ /dev/null @@ -1,64 +0,0 @@ ---- old.declarationEmitObjectLiteralAccessorsJs1.errors.txt -+++ new.declarationEmitObjectLiteralAccessorsJs1.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(48,7): error TS7032: Property 'x' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+index.js(48,9): error TS7006: Parameter 'a' implicitly has an 'any' type. -+ -+ -+==== index.js (2 errors) ==== -+ // same type accessors -+ export const obj1 = { -+ /** -+ * my awesome getter (first in source order) -+ * @returns {string} -+ */ -+ get x() { -+ return ""; -+ }, -+ /** -+ * my awesome setter (second in source order) -+ * @param {string} a -+ */ -+ set x(a) {}, -+ }; -+ -+ // divergent accessors -+ export const obj2 = { -+ /** -+ * my awesome getter -+ * @returns {string} -+ */ -+ get x() { -+ return ""; -+ }, -+ /** -+ * my awesome setter -+ * @param {number} a -+ */ -+ set x(a) {}, -+ }; -+ -+ export const obj3 = { -+ /** -+ * my awesome getter -+ * @returns {string} -+ */ -+ get x() { -+ return ""; -+ }, -+ }; -+ -+ export const obj4 = { -+ /** -+ * my awesome setter -+ * @param {number} a -+ */ -+ set x(a) {}, -+ ~ -+!!! error TS7032: Property 'x' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ }; -+ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitObjectLiteralAccessorsJs1.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitObjectLiteralAccessorsJs1.types.diff index ecf89c190d..e1fa2701f4 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitObjectLiteralAccessorsJs1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitObjectLiteralAccessorsJs1.types.diff @@ -11,33 +11,3 @@ /** * my awesome getter -@@= skipped -20, +20 lines =@@ - */ - set x(a) {}, - >x : string -->a : number -+>a : string - - }; - -@@= skipped -22, +22 lines =@@ - }; - - export const obj4 = { -->obj4 : { x: number; } -->{ /** * my awesome setter * @param {number} a */ set x(a) {},} : { x: number; } -+>obj4 : { x: any; } -+>{ /** * my awesome setter * @param {number} a */ set x(a) {},} : { x: any; } - - /** - * my awesome setter - * @param {number} a - */ - set x(a) {}, -->x : number -->a : number -+>x : any -+>a : any - - }; - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff index 19326846f3..edb9efdfe1 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff @@ -3,16 +3,19 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++input.js(5,48): error TS2304: Cannot find name 'P'. +input.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +input.js(52,24): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== input.js (2 errors) ==== ++==== input.js (3 errors) ==== + /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ + + /** + * @template P + * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ ++ ~ ++!!! error TS2304: Cannot find name 'P'. + + /** + * @type {StatelessComponent} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.types.diff index 5d933061c9..097172a8b5 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.types.diff @@ -1,12 +1,25 @@ --- old.expandoFunctionContextualTypesJs.types +++ new.expandoFunctionContextualTypesJs.types -@@= skipped -10, +10 lines =@@ +@@= skipped -1, +1 lines =@@ + + === input.js === + /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ ++>MyComponentProps : any ++>color : "blue" | "red" + + /** + * @template P + * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ ++>StatelessComponent : any ++>defaultProps : P + + /** * @type {StatelessComponent} */ const MyComponent = () => /* @type {any} */(null); ->MyComponent : StatelessComponent ->() => /* @type {any} */(null) : { (): any; defaultProps: Partial; } -+>MyComponent : { (): any; defaultProps: { color: string; }; } ++>MyComponent : { (): any; defaultProps?: P; } +>() => /* @type {any} */(null) : { (): any; defaultProps: { color: string; }; } >(null) : null @@ -17,9 +30,9 @@ ->defaultProps : Partial ->{ color: "red"} : { color: "red"; } +>MyComponent.defaultProps = { color: "red"} : { color: string; } -+>MyComponent.defaultProps : { color: string; } -+>MyComponent : { (): any; defaultProps: { color: string; }; } -+>defaultProps : { color: string; } ++>MyComponent.defaultProps : P ++>MyComponent : { (): any; defaultProps?: P; } ++>defaultProps : P +>{ color: "red"} : { color: string; } color: "red" @@ -56,13 +69,13 @@ >"red" : "red" } -@@= skipped -40, +40 lines =@@ +@@= skipped -49, +53 lines =@@ * @type {StatelessComponent} */ const check = MyComponent2; ->check : StatelessComponent ->MyComponent2 : { (): any; defaultProps: MyComponentProps; } -+>check : { (): any; defaultProps: { color: string; }; } ++>check : { (): any; defaultProps?: P; } +>MyComponent2 : { (): any; defaultProps: { color: string; }; } /** @@ -72,8 +85,8 @@ function expectLiteral(p) {} ->expectLiteral : (p: { props: MyComponentProps; }) => void ->p : { props: MyComponentProps; } -+>expectLiteral : (p: any) => void -+>p : any ++>expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void ++>p : { props: { color: "blue" | "red"; }; } function foo() { ->foo : typeof foo @@ -101,7 +114,7 @@ >expectLiteral(this) : void ->expectLiteral : (p: { props: MyComponentProps; }) => void ->this : this -+>expectLiteral : (p: any) => void ++>expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void +>this : any } @@ -134,7 +147,7 @@ ->module.exports : MyComponentProps ->module : { exports: MyComponentProps; } ->exports : MyComponentProps -+>expectLiteral : (p: any) => void ++>expectLiteral : (p: { props: { color: "blue" | "red"; }; }) => void +>{ props: module.exports } : { props: any; } +>props : any +>module.exports : any diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionSymbolPropertyJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionSymbolPropertyJs.types.diff index 75475f1279..2332f14109 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionSymbolPropertyJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionSymbolPropertyJs.types.diff @@ -5,7 +5,7 @@ */ export function test() { ->test : () => import("./types").TestSymb -+>test : () => { (): void; inner[symb]: boolean; } ++>test : () => TestSymb function inner() {} ->inner : { (): void; [symb]: boolean; } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc1.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc1.types.diff index e778c128ec..eb9a50c806 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc1.types.diff @@ -1,22 +1,28 @@ --- old.exportDefaultWithJSDoc1.types +++ new.exportDefaultWithJSDoc1.types -@@= skipped -6, +6 lines =@@ +@@= skipped -3, +3 lines =@@ + /** + * A number, or a string containing a number. + * @typedef {(number|string)} NumberLike ++>NumberLike : any ++ */ /** @type {NumberLike[]} */export default ([ ]); ->([ ]) : NumberLike[] ++>([ ]) : (string | number)[] +>([ ]) : undefined[] >[ ] : undefined[] === b.ts === import A from './a' ->A : import("a").NumberLike[] -+>A : any[] ++>A : (string | number)[] A[0] ->A[0] : import("a").NumberLike ->A : import("a").NumberLike[] -+>A[0] : any -+>A : any[] ++>A[0] : string | number ++>A : (string | number)[] >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff index 0fae91fe0d..24ba584863 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff @@ -1,22 +1,28 @@ --- old.exportDefaultWithJSDoc2.types +++ new.exportDefaultWithJSDoc2.types -@@= skipped -6, +6 lines =@@ +@@= skipped -3, +3 lines =@@ + /** + * A number, or a string containing a number. + * @typedef {(number|string)} NumberLike ++>NumberLike : any ++ */ export default /** @type {NumberLike[]} */([ ]); ->([ ]) : NumberLike[] -+>([ ]) : undefined[] ++>([ ]) : (string | number)[] ++>[ ] : (string | number)[] >[ ] : undefined[] === b.ts === import A from './a' ->A : import("a").NumberLike[] -+>A : any[] ++>A : (string | number)[] A[0] ->A[0] : import("a").NumberLike ->A : import("a").NumberLike[] -+>A[0] : any -+>A : any[] ++>A[0] : string | number ++>A : (string | number)[] >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/extendedUnicodePlaneIdentifiersJSDoc.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/extendedUnicodePlaneIdentifiersJSDoc.types.diff deleted file mode 100644 index 915ac80b5c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/extendedUnicodePlaneIdentifiersJSDoc.types.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.extendedUnicodePlaneIdentifiersJSDoc.types -+++ new.extendedUnicodePlaneIdentifiersJSDoc.types -@@= skipped -6, +6 lines =@@ - * @param {number} 𝑀 - */ - function foo(𝑚, 𝑀) { -->foo : (𝑚: number, 𝑀: number) => void -->𝑚 : number -->𝑀 : number -+>foo : (𝑚: any, 𝑀: any) => void -+>𝑚 : any -+>𝑀 : any - - console.log(𝑀 + 𝑚); - >console.log(𝑀 + 𝑚) : void - >console.log : (...data: any[]) => void - >console : Console - >log : (...data: any[]) => void -->𝑀 + 𝑚 : number -->𝑀 : number -->𝑚 : number -+>𝑀 + 𝑚 : any -+>𝑀 : any -+>𝑚 : any - } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/importTypeResolutionJSDocEOF.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/importTypeResolutionJSDocEOF.errors.txt.diff new file mode 100644 index 0000000000..2f9a807d64 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/importTypeResolutionJSDocEOF.errors.txt.diff @@ -0,0 +1,20 @@ +--- old.importTypeResolutionJSDocEOF.errors.txt ++++ new.importTypeResolutionJSDocEOF.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++usage.js(1,12): error TS2304: Cannot find name 'Bar'. ++ ++ ++==== interfaces.d.ts (0 errors) ==== ++ export interface Bar { ++ prop: string ++ } ++ ++==== usage.js (1 errors) ==== ++ /** @type {Bar} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Bar'. ++ export let bar; ++ ++ /** @typedef {import('./interfaces').Bar} Bar */ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/importTypeResolutionJSDocEOF.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/importTypeResolutionJSDocEOF.types.diff index cc94917b48..aeb136fc3c 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/importTypeResolutionJSDocEOF.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/importTypeResolutionJSDocEOF.types.diff @@ -5,6 +5,6 @@ /** @type {Bar} */ export let bar; ->bar : import("interfaces").Bar -+>bar : any ++>bar : Bar /** @typedef {import('./interfaces').Bar} Bar */ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitDoesNotRenameImport.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitDoesNotRenameImport.types.diff index f60e5538c5..c4357f44ed 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitDoesNotRenameImport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitDoesNotRenameImport.types.diff @@ -1,22 +1,26 @@ --- old.jsDeclarationEmitDoesNotRenameImport.types +++ new.jsDeclarationEmitDoesNotRenameImport.types -@@= skipped -32, +32 lines =@@ - * @param {Options} options - */ - constructor(options) { -->options : Options -+>options : any +@@= skipped -21, +21 lines =@@ - super(); - >super() : void + /** + * @typedef {Object} Options ++>Options : any ++ + * @property {typeof import("./Test.js").default} [test] ++>test : any ++>default : any ++ + */ + + class X extends Test { +@@= skipped -18, +23 lines =@@ >super : typeof Test if (options.test) { ->options.test : typeof import("Test").default | undefined -->options : Options -->test : typeof import("Test").default | undefined +>options.test : any -+>options : any + >options : Options +->test : typeof import("Test").default | undefined +>test : any this.test = new options.test(); @@ -27,11 +31,10 @@ >test : any ->new options.test() : import("Test").default ->options.test : typeof import("Test").default -->options : Options -->test : typeof import("Test").default +>new options.test() : any +>options.test : any -+>options : any + >options : Options +->test : typeof import("Test").default +>test : any } } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types.diff index b1319ae885..762444e866 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types.diff @@ -1,6 +1,17 @@ --- old.jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types +++ new.jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types -@@= skipped -9, +9 lines =@@ +@@= skipped -2, +2 lines =@@ + === index.js === + /** + * @typedef Options ++>Options : any ++ + * @property {string} opt ++>opt : any ++ + */ + + /** * @param {Options} options */ module.exports = function loader(options) {} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationsInheritedTypes.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationsInheritedTypes.types.diff index c90655a08f..fefda54732 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationsInheritedTypes.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationsInheritedTypes.types.diff @@ -1,28 +1,23 @@ --- old.jsDeclarationsInheritedTypes.types +++ new.jsDeclarationsInheritedTypes.types -@@= skipped -17, +17 lines =@@ - * @type {A} - */ - value; -->value : A -+>value : any - } +@@= skipped -2, +2 lines =@@ + === a.js === + /** + * @typedef A ++>A : any ++ + * @property {string} a ++>a : any ++ + */ - class C2 extends C1 { -@@= skipped -11, +11 lines =@@ - * @type {A} - */ - value; -->value : A -+>value : any - } - - class C3 extends C1 { -@@= skipped -11, +11 lines =@@ - * @type {A & B} - */ - value; -->value : A & B -+>value : any - } + /** + * @typedef B ++>B : any ++ + * @property {number} b ++>b : any ++ + */ + class C1 { diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt.diff deleted file mode 100644 index 34acefb524..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt -+++ new.jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(9,49): error TS7006: Parameter 'init' implicitly has an 'any' type. -+ -+ -+==== package.json (0 errors) ==== -+ { -+ "name": "typescript-issue", -+ "private": true, -+ "version": "0.0.0", -+ "type": "module" -+ } -+==== node_modules/@lion/ajax/package.json (0 errors) ==== -+ { -+ "name": "@lion/ajax", -+ "version": "2.0.2", -+ "type": "module", -+ "exports": { -+ ".": { -+ "types": "./dist-types/src/index.d.ts", -+ "default": "./src/index.js" -+ }, -+ "./docs/*": "./docs/*" -+ } -+ } -+==== node_modules/@lion/ajax/dist-types/src/index.d.ts (0 errors) ==== -+ export type LionRequestInit = import('../types/types.js').LionRequestInit; -+==== node_modules/@lion/ajax/dist-types/types/types.d.ts (0 errors) ==== -+ export interface LionRequestInit { -+ body?: null | Object; -+ } -+==== index.js (1 errors) ==== -+ /** -+ * @typedef {import('@lion/ajax').LionRequestInit} LionRequestInit -+ */ -+ -+ export class NewAjax { -+ /** -+ * @param {LionRequestInit} [init] -+ */ -+ case5_unexpectedlyResolvesPathToNodeModules(init) {} -+ ~~~~ -+!!! error TS7006: Parameter 'init' implicitly has an 'any' type. -+ } -+ -+ /** -+ * @type {(init?: LionRequestInit) => void} -+ */ -+ // @ts-expect-error -+ NewAjax.prototype.case6_unexpectedlyResolvesPathToNodeModules; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types.diff index 2c686b8104..aa2bf401f7 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types.diff @@ -9,14 +9,23 @@ === node_modules/@lion/ajax/dist-types/types/types.d.ts === export interface LionRequestInit { -@@= skipped -19, +19 lines =@@ +@@= skipped -10, +10 lines =@@ + === index.js === + /** + * @typedef {import('@lion/ajax').LionRequestInit} LionRequestInit ++>LionRequestInit : any ++ + */ + + export class NewAjax { +@@= skipped -9, +11 lines =@@ * @param {LionRequestInit} [init] */ case5_unexpectedlyResolvesPathToNodeModules(init) {} ->case5_unexpectedlyResolvesPathToNodeModules : (init?: LionRequestInit) => void ->init : import("node_modules/@lion/ajax/dist-types/types/types").LionRequestInit | undefined -+>case5_unexpectedlyResolvesPathToNodeModules : (init: any) => void -+>init : any ++>case5_unexpectedlyResolvesPathToNodeModules : (init?: LionRequestInit | undefined) => void ++>init : LionRequestInit | undefined } /** diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.errors.txt.diff index 1a186c555d..0aa18b02f5 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.errors.txt.diff @@ -7,7 +7,10 @@ +enumDef.js(4,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'. +enumDef.js(16,6): error TS2339: Property 'UserMetrics' does not exist on type '{}'. +index.js(2,7): error TS2339: Property 'Cls' does not exist on type '{}'. ++index.js(4,17): error TS2503: Cannot find namespace 'Host'. +index.js(8,21): error TS2304: Cannot find name 'Host'. ++index.js(13,11): error TS2503: Cannot find namespace 'Host'. ++index.js(18,11): error TS2503: Cannot find namespace 'Host'. + + +==== enumDef.js (3 errors) ==== @@ -35,13 +38,15 @@ +!!! error TS2339: Property 'UserMetrics' does not exist on type '{}'. + x: 12 + } -+==== index.js (2 errors) ==== ++==== index.js (5 errors) ==== + var Other = {}; + Other.Cls = class { + ~~~ +!!! error TS2339: Property 'Cls' does not exist on type '{}'. + /** + * @param {!Host.UserMetrics.Action} p ++ ~~~~ ++!!! error TS2503: Cannot find namespace 'Host'. + */ + method(p) {} + usage() { @@ -53,11 +58,15 @@ + + /** + * @type {Host.UserMetrics.Bargh} ++ ~~~~ ++!!! error TS2503: Cannot find namespace 'Host'. + */ + var x = "ok"; + + /** + * @type {Host.UserMetrics.Blah} ++ ~~~~ ++!!! error TS2503: Cannot find namespace 'Host'. + */ + var y = "ok"; + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.types.diff index 9d99f2cb1e..018e32b22d 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.types.diff @@ -35,8 +35,18 @@ >{ WindowDocked: 1, WindowUndocked: 2, ScriptsBreakpointSet: 3, TimelineStarted: 4,} : { WindowDocked: number; WindowUndocked: number; ScriptsBreakpointSet: number; TimelineStarted: number; } WindowDocked: 1, -@@= skipped -45, +45 lines =@@ +@@= skipped -39, +39 lines =@@ + }; + /** + * @typedef {string} Host.UserMetrics.Bargh ++>Host : any ++ */ + /** + * @typedef {string} + */ ++> : any ++ Host.UserMetrics.Blah = { >Host.UserMetrics.Blah = { x: 12} : { x: number; } ->Host.UserMetrics.Blah : { x: number; } @@ -52,7 +62,7 @@ >{ x: 12} : { x: number; } x: 12 -@@= skipped -13, +13 lines =@@ +@@= skipped -19, +23 lines =@@ } === index.js === var Other = {}; @@ -76,8 +86,8 @@ method(p) {} ->method : (p: Host.UserMetrics.Action) => void ->p : number -+>method : (p: any) => void -+>p : any ++>method : (p: Action) => void ++>p : Action usage() { >usage : () => void @@ -85,7 +95,7 @@ this.method(Host.UserMetrics.Action.WindowDocked); >this.method(Host.UserMetrics.Action.WindowDocked) : void ->this.method : (p: Host.UserMetrics.Action) => void -+>this.method : (p: any) => void ++>this.method : (p: Action) => void >this : this ->method : (p: Host.UserMetrics.Action) => void ->Host.UserMetrics.Action.WindowDocked : number @@ -95,14 +105,30 @@ ->UserMetrics : typeof Host.UserMetrics ->Action : { WindowDocked: number; WindowUndocked: number; ScriptsBreakpointSet: number; TimelineStarted: number; } ->WindowDocked : number -+>method : (p: any) => void ++>method : (p: Action) => void +>Host.UserMetrics.Action.WindowDocked : any +>Host.UserMetrics.Action : any +>Host.UserMetrics : any -+>Host : {} ++>Host : any +>UserMetrics : any +>Action : any +>WindowDocked : any } } +@@= skipped -39, +39 lines =@@ + * @type {Host.UserMetrics.Bargh} + */ + var x = "ok"; +->x : string ++>x : Bargh + >"ok" : "ok" + + /** + * @type {Host.UserMetrics.Blah} + */ + var y = "ok"; +->y : string ++>y : Blah + >"ok" : "ok" + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff index 752048e690..dc944d4ab3 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff @@ -29,7 +29,14 @@ /** * @typedef {Object} LogEntry -@@= skipped -21, +21 lines =@@ ++>LogEntry : any ++ + * @property {string} type ++>type : any ++ + * @property {number} time ++>time : any ++ */ cbThing(type => { @@ -44,14 +51,13 @@ /** @type {LogEntry} */ const logEntry = { -->logEntry : LogEntry + >logEntry : LogEntry ->{ time: Date.now(), type, } : { time: number; type: string; } -+>logEntry : { time: number; type: any; } +>{ time: Date.now(), type, } : { time: number; type: any; } time: Date.now(), >time : number -@@= skipped -18, +18 lines =@@ +@@= skipped -39, +45 lines =@@ >now : () => number type, diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation.types.diff index c32881c2aa..75821d6038 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation.types.diff @@ -1,11 +1,6 @@ --- old.jsExportMemberMergedWithModuleAugmentation.types +++ new.jsExportMemberMergedWithModuleAugmentation.types -@@= skipped -5, +5 lines =@@ - - /** @type {string} */ - x; -->x : string -+>x : any +@@= skipped -9, +9 lines =@@ } module.exports = { @@ -20,7 +15,7 @@ >{ Abcde} : { Abcde: typeof Abcde; } Abcde -@@= skipped -17, +17 lines =@@ +@@= skipped -13, +13 lines =@@ === /index.ts === import { Abcde } from "./test"; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationRestParamJsDocFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationRestParamJsDocFunction.types.diff index 88feb90040..a9cbe6db73 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationRestParamJsDocFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationRestParamJsDocFunction.types.diff @@ -1,37 +1,24 @@ --- old.jsFileCompilationRestParamJsDocFunction.types +++ new.jsFileCompilationRestParamJsDocFunction.types -@@= skipped -11, +11 lines =@@ - * @returns {*} Returns the result of `func`. - */ - function apply(func, thisArg, ...args) { -->apply : (func: Function, thisArg: any, ...args: any[]) => any -->func : Function -+>apply : (func: any, thisArg: any, ...args: any[]) => any -+>func : any - >thisArg : any - >args : any[] - -@@= skipped -17, +17 lines =@@ +@@= skipped -28, +28 lines =@@ case 0: return func.call(thisArg); >0 : 0 >func.call(thisArg) : any ->func.call : (this: Function, thisArg: any, ...argArray: any[]) => any -->func : Function ++>func.call : (thisArg: any, ...argArray: any[]) => any + >func : Function ->call : (this: Function, thisArg: any, ...argArray: any[]) => any -+>func.call : any -+>func : any -+>call : any ++>call : (thisArg: any, ...argArray: any[]) => any >thisArg : any case 1: return func.call(thisArg, args[0]); >1 : 1 >func.call(thisArg, args[0]) : any ->func.call : (this: Function, thisArg: any, ...argArray: any[]) => any -->func : Function ++>func.call : (thisArg: any, ...argArray: any[]) => any + >func : Function ->call : (this: Function, thisArg: any, ...argArray: any[]) => any -+>func.call : any -+>func : any -+>call : any ++>call : (thisArg: any, ...argArray: any[]) => any >thisArg : any >args[0] : any >args : any[] @@ -40,11 +27,10 @@ >2 : 2 >func.call(thisArg, args[0], args[1]) : any ->func.call : (this: Function, thisArg: any, ...argArray: any[]) => any -->func : Function ++>func.call : (thisArg: any, ...argArray: any[]) => any + >func : Function ->call : (this: Function, thisArg: any, ...argArray: any[]) => any -+>func.call : any -+>func : any -+>call : any ++>call : (thisArg: any, ...argArray: any[]) => any >thisArg : any >args[0] : any >args : any[] @@ -53,11 +39,10 @@ >3 : 3 >func.call(thisArg, args[0], args[1], args[2]) : any ->func.call : (this: Function, thisArg: any, ...argArray: any[]) => any -->func : Function ++>func.call : (thisArg: any, ...argArray: any[]) => any + >func : Function ->call : (this: Function, thisArg: any, ...argArray: any[]) => any -+>func.call : any -+>func : any -+>call : any ++>call : (thisArg: any, ...argArray: any[]) => any >thisArg : any >args[0] : any >args : any[] @@ -66,16 +51,10 @@ return func.apply(thisArg, args); >func.apply(thisArg, args) : any ->func.apply : (this: Function, thisArg: any, argArray?: any) => any -->func : Function ++>func.apply : (thisArg: any, argArray?: any) => any + >func : Function ->apply : (this: Function, thisArg: any, argArray?: any) => any -+>func.apply : any -+>func : any -+>apply : any ++>apply : (thisArg: any, argArray?: any) => any >thisArg : any >args : any[] } - - export default apply; -->apply : (func: Function, thisArg: any, ...args: any[]) => any -+>apply : (func: any, thisArg: any, ...args: any[]) => any - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationSyntaxError.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationSyntaxError.types.diff deleted file mode 100644 index b86f4ec697..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationSyntaxError.types.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.jsFileCompilationSyntaxError.types -+++ new.jsFileCompilationSyntaxError.types -@@= skipped -5, +5 lines =@@ - * @type {string} - */ - var v; -->v : number -+>v : any - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.errors.txt.diff new file mode 100644 index 0000000000..1c31c374eb --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.errors.txt.diff @@ -0,0 +1,72 @@ +--- old.jsFileFunctionOverloads.errors.txt ++++ new.jsFileFunctionOverloads.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++jsFileFunctionOverloads.js(26,12): error TS2304: Cannot find name 'T'. ++jsFileFunctionOverloads.js(27,14): error TS2304: Cannot find name 'T'. ++ ++ ++==== jsFileFunctionOverloads.js (2 errors) ==== ++ /** ++ * @overload ++ * @param {number} x ++ * @returns {'number'} ++ */ ++ /** ++ * @overload ++ * @param {string} x ++ * @returns {'string'} ++ */ ++ /** ++ * @overload ++ * @param {boolean} x ++ * @returns {'boolean'} ++ */ ++ /** ++ * @param {unknown} x ++ * @returns {string} ++ */ ++ function getTypeName(x) { ++ return typeof x; ++ } ++ ++ /** ++ * @template T ++ * @param {T} x ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ * @returns {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ const identity = x => x; ++ ++ /** ++ * @template T ++ * @template U ++ * @overload ++ * @param {T[]} array ++ * @param {(x: T) => U[]} iterable ++ * @returns {U[]} ++ */ ++ /** ++ * @template T ++ * @overload ++ * @param {T[][]} array ++ * @returns {T[]} ++ */ ++ /** ++ * @param {unknown[]} array ++ * @param {(x: unknown) => unknown} iterable ++ * @returns {unknown[]} ++ */ ++ function flatMap(array, iterable = identity) { ++ /** @type {unknown[]} */ ++ const result = []; ++ for (let i = 0; i < array.length; i += 1) { ++ result.push(.../** @type {unknown[]} */(iterable(array[i]))); ++ } ++ return result; ++ } ++ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.types.diff index fb4c38abe5..289b97f5fc 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.types.diff @@ -5,91 +5,33 @@ */ function getTypeName(x) { ->getTypeName : { (x: number): "number"; (x: string): "string"; (x: boolean): "boolean"; } -->x : unknown -+>getTypeName : (x: any) => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" -+>x : any ++>getTypeName : (x: unknown) => string + >x : unknown return typeof x; ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" -->x : unknown +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" -+>x : any + >x : unknown } - /** -@@= skipped -14, +14 lines =@@ - * @returns {T} - */ - const identity = x => x; -->identity : (x: T) => T -->x => x : (x: T) => T -->x : T -->x : T -+>identity : (x: any) => any -+>x => x : (x: any) => any -+>x : any -+>x : any - - /** - * @template T -@@= skipped -25, +25 lines =@@ +@@= skipped -39, +39 lines =@@ * @returns {unknown[]} */ function flatMap(array, iterable = identity) { ->flatMap : { (array: T[], iterable: (x: T) => U[]): U[]; (array: T[][]): T[]; } -->array : unknown[] -->iterable : (x: unknown) => unknown ++>flatMap : (array: unknown[], iterable?: (x: unknown) => unknown) => unknown[] + >array : unknown[] + >iterable : (x: unknown) => unknown ->identity : (x: T_1) => T_1 -+>flatMap : (array: any, iterable?: (x: any) => any) => any[] -+>array : any -+>iterable : (x: any) => any -+>identity : (x: any) => any ++>identity : (x: T) => T /** @type {unknown[]} */ const result = []; -->result : unknown[] -+>result : any[] - >[] : undefined[] - - for (let i = 0; i < array.length; i += 1) { -@@= skipped -15, +15 lines =@@ - >0 : 0 - >i < array.length : boolean - >i : number -->array.length : number -->array : unknown[] -->length : number -+>array.length : any -+>array : any -+>length : any - >i += 1 : number - >i : number - >1 : 1 - - result.push(.../** @type {unknown[]} */(iterable(array[i]))); - >result.push(.../** @type {unknown[]} */(iterable(array[i]))) : number -->result.push : (...items: unknown[]) => number -->result : unknown[] -->push : (...items: unknown[]) => number -->.../** @type {unknown[]} */(iterable(array[i])) : unknown -->(iterable(array[i])) : unknown[] -->iterable(array[i]) : unknown -->iterable : (x: unknown) => unknown -->array[i] : unknown -->array : unknown[] -+>result.push : (...items: any[]) => number -+>result : any[] -+>push : (...items: any[]) => number -+>.../** @type {unknown[]} */(iterable(array[i])) : any -+>(iterable(array[i])) : any -+>iterable(array[i]) : any -+>iterable : (x: any) => any -+>array[i] : any -+>array : any - >i : number - } - return result; -->result : unknown[] -+>result : any[] - } - +@@= skipped -29, +29 lines =@@ + >push : (...items: unknown[]) => number + >.../** @type {unknown[]} */(iterable(array[i])) : unknown + >(iterable(array[i])) : unknown[] ++>iterable(array[i]) : unknown[] + >iterable(array[i]) : unknown + >iterable : (x: unknown) => unknown + >array[i] : unknown diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.errors.txt.diff new file mode 100644 index 0000000000..cd7137f8a7 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.errors.txt.diff @@ -0,0 +1,67 @@ +--- old.jsFileFunctionOverloads2.errors.txt ++++ new.jsFileFunctionOverloads2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++jsFileFunctionOverloads2.js(24,12): error TS2304: Cannot find name 'T'. ++jsFileFunctionOverloads2.js(25,14): error TS2304: Cannot find name 'T'. ++ ++ ++==== jsFileFunctionOverloads2.js (2 errors) ==== ++ // Also works if all @overload tags are combined in one comment. ++ /** ++ * @overload ++ * @param {number} x ++ * @returns {'number'} ++ * ++ * @overload ++ * @param {string} x ++ * @returns {'string'} ++ * ++ * @overload ++ * @param {boolean} x ++ * @returns {'boolean'} ++ * ++ * @param {unknown} x ++ * @returns {string} ++ */ ++ function getTypeName(x) { ++ return typeof x; ++ } ++ ++ /** ++ * @template T ++ * @param {T} x ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ * @returns {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ const identity = x => x; ++ ++ /** ++ * @template T ++ * @template U ++ * @overload ++ * @param {T[]} array ++ * @param {(x: T) => U[]} iterable ++ * @returns {U[]} ++ * ++ * @overload ++ * @param {T[][]} array ++ * @returns {T[]} ++ * ++ * @param {unknown[]} array ++ * @param {(x: unknown) => unknown} iterable ++ * @returns {unknown[]} ++ */ ++ function flatMap(array, iterable = identity) { ++ /** @type {unknown[]} */ ++ const result = []; ++ for (let i = 0; i < array.length; i += 1) { ++ result.push(.../** @type {unknown[]} */(iterable(array[i]))); ++ } ++ return result; ++ } ++ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.types.diff index f562eb66fd..83918301e7 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.types.diff @@ -5,91 +5,33 @@ */ function getTypeName(x) { ->getTypeName : { (x: number): "number"; (x: string): "string"; (x: boolean): "boolean"; } -->x : unknown -+>getTypeName : (x: any) => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" -+>x : any ++>getTypeName : (x: unknown) => string + >x : unknown return typeof x; ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" -->x : unknown +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" -+>x : any + >x : unknown } - /** -@@= skipped -14, +14 lines =@@ - * @returns {T} - */ - const identity = x => x; -->identity : (x: T) => T -->x => x : (x: T) => T -->x : T -->x : T -+>identity : (x: any) => any -+>x => x : (x: any) => any -+>x : any -+>x : any - - /** - * @template T -@@= skipped -22, +22 lines =@@ +@@= skipped -36, +36 lines =@@ * @returns {unknown[]} */ function flatMap(array, iterable = identity) { ->flatMap : { (array: T[], iterable: (x: T) => U[]): U[]; (array: T[][]): T[]; } -->array : unknown[] -->iterable : (x: unknown) => unknown ++>flatMap : (array: unknown[], iterable?: (x: unknown) => unknown) => unknown[] + >array : unknown[] + >iterable : (x: unknown) => unknown ->identity : (x: T_1) => T_1 -+>flatMap : (array: any, iterable?: (x: any) => any) => any[] -+>array : any -+>iterable : (x: any) => any -+>identity : (x: any) => any ++>identity : (x: T) => T /** @type {unknown[]} */ const result = []; -->result : unknown[] -+>result : any[] - >[] : undefined[] - - for (let i = 0; i < array.length; i += 1) { -@@= skipped -15, +15 lines =@@ - >0 : 0 - >i < array.length : boolean - >i : number -->array.length : number -->array : unknown[] -->length : number -+>array.length : any -+>array : any -+>length : any - >i += 1 : number - >i : number - >1 : 1 - - result.push(.../** @type {unknown[]} */(iterable(array[i]))); - >result.push(.../** @type {unknown[]} */(iterable(array[i]))) : number -->result.push : (...items: unknown[]) => number -->result : unknown[] -->push : (...items: unknown[]) => number -->.../** @type {unknown[]} */(iterable(array[i])) : unknown -->(iterable(array[i])) : unknown[] -->iterable(array[i]) : unknown -->iterable : (x: unknown) => unknown -->array[i] : unknown -->array : unknown[] -+>result.push : (...items: any[]) => number -+>result : any[] -+>push : (...items: any[]) => number -+>.../** @type {unknown[]} */(iterable(array[i])) : any -+>(iterable(array[i])) : any -+>iterable(array[i]) : any -+>iterable : (x: any) => any -+>array[i] : any -+>array : any - >i : number - } - return result; -->result : unknown[] -+>result : any[] - } - +@@= skipped -29, +29 lines =@@ + >push : (...items: unknown[]) => number + >.../** @type {unknown[]} */(iterable(array[i])) : unknown + >(iterable(array[i])) : unknown[] ++>iterable(array[i]) : unknown[] + >iterable(array[i]) : unknown + >iterable : (x: unknown) => unknown + >array[i] : unknown diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileImportPreservedWhenUsed.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileImportPreservedWhenUsed.errors.txt.diff index 689954c6eb..0cace8ce94 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileImportPreservedWhenUsed.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileImportPreservedWhenUsed.errors.txt.diff @@ -3,8 +3,8 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+index.js(9,10): error TS7006: Parameter 'obj' implicitly has an 'any' type. -+index.js(9,15): error TS7006: Parameter 'vm' implicitly has an 'any' type. ++index.js(11,12): error TS2339: Property 'objects' does not exist on type 'object'. ++index.js(13,26): error TS2698: Spread types may only be created from object types. + + +==== dash.d.ts (0 errors) ==== @@ -27,14 +27,14 @@ + * @param {object} vm + */ + test(obj, vm) { -+ ~~~ -+!!! error TS7006: Parameter 'obj' implicitly has an 'any' type. -+ ~~ -+!!! error TS7006: Parameter 'vm' implicitly has an 'any' type. + let index = 0; + vm.objects = _.mapValues( ++ ~~~~~~~ ++!!! error TS2339: Property 'objects' does not exist on type 'object'. + obj, + object => ({ ...object, [INDEX_FIELD]: index++ }), ++ ~~~~~~~~~ ++!!! error TS2698: Spread types may only be created from object types. + ); + } + } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileImportPreservedWhenUsed.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileImportPreservedWhenUsed.types.diff index 8dc53db3bb..5e22fcc896 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileImportPreservedWhenUsed.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileImportPreservedWhenUsed.types.diff @@ -9,52 +9,31 @@ >obj : T | null | undefined >callback : ObjectIterator } -@@= skipped -30, +30 lines =@@ - * @param {object} vm - */ - test(obj, vm) { -->test : (obj: object, vm: object) => void -->obj : object -->vm : object -+>test : (obj: any, vm: any) => void -+>obj : any -+>vm : any - - let index = 0; - >index : number - >0 : 0 +@@= skipped -40, +40 lines =@@ vm.objects = _.mapValues( -->vm.objects = _.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : object + >vm.objects = _.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : object ->vm.objects : error -->vm : object -+>vm.objects = _.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : { [x: string]: any; } +>vm.objects : any -+>vm : any + >vm : object >objects : any -->_.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : object + >_.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : object ->_.mapValues : (obj: T | null | undefined, callback: (value: T[keyof T], key: string, collection: T) => TResult) => { [P in keyof T]: TResult; } -+>_.mapValues( obj, object => ({ ...object, [INDEX_FIELD]: index++ }), ) : { [x: string]: any; } +>_.mapValues : (obj: T | null | undefined, callback: ObjectIterator) => { [P in keyof T]: TResult } >_ : LoDashStatic ->mapValues : (obj: T | null | undefined, callback: (value: T[keyof T], key: string, collection: T) => TResult) => { [P in keyof T]: TResult; } +>mapValues : (obj: T | null | undefined, callback: ObjectIterator) => { [P in keyof T]: TResult } obj, -->obj : object -+>obj : any - + >obj : object +@@= skipped -14, +14 lines =@@ object => ({ ...object, [INDEX_FIELD]: index++ }), -->object => ({ ...object, [INDEX_FIELD]: index++ }) : (object: never) => any -->object : never + >object => ({ ...object, [INDEX_FIELD]: index++ }) : (object: never) => any + >object : never ->({ ...object, [INDEX_FIELD]: index++ }) : error ->{ ...object, [INDEX_FIELD]: index++ } : error -->object : never -+>object => ({ ...object, [INDEX_FIELD]: index++ }) : (object: any) => any -+>object : any +>({ ...object, [INDEX_FIELD]: index++ }) : any +>{ ...object, [INDEX_FIELD]: index++ } : any -+>object : any + >object : never >[INDEX_FIELD] : number >INDEX_FIELD : "__INDEX" - >index++ : number diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads.errors.txt.diff index c7ba1d7958..3111d5f6b7 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads.errors.txt.diff @@ -3,10 +3,10 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+jsFileMethodOverloads.js(9,10): error TS2339: Property 'value' does not exist on type 'Example'. -+jsFileMethodOverloads.js(26,24): error TS2339: Property 'value' does not exist on type 'Example'. -+jsFileMethodOverloads.js(44,25): error TS2339: Property 'value' does not exist on type 'Example'. -+jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist on type 'Example'. ++jsFileMethodOverloads.js(9,10): error TS2339: Property 'value' does not exist on type 'Example'. ++jsFileMethodOverloads.js(26,24): error TS2339: Property 'value' does not exist on type 'Example'. ++jsFileMethodOverloads.js(44,25): error TS2339: Property 'value' does not exist on type 'Example'. ++jsFileMethodOverloads.js(44,39): error TS2339: Property 'value' does not exist on type 'Example'. + + +==== jsFileMethodOverloads.js (4 errors) ==== @@ -20,7 +20,7 @@ + constructor(value) { + this.value = value; + ~~~~~ -+!!! error TS2339: Property 'value' does not exist on type 'Example'. ++!!! error TS2339: Property 'value' does not exist on type 'Example'. + } + + /** @@ -39,7 +39,7 @@ + getTypeName() { + return typeof this.value; + ~~~~~ -+!!! error TS2339: Property 'value' does not exist on type 'Example'. ++!!! error TS2339: Property 'value' does not exist on type 'Example'. + } + + /** @@ -59,9 +59,9 @@ + transform(fn) { + return fn ? fn(this.value) : this.value; + ~~~~~ -+!!! error TS2339: Property 'value' does not exist on type 'Example'. ++!!! error TS2339: Property 'value' does not exist on type 'Example'. + ~~~~~ -+!!! error TS2339: Property 'value' does not exist on type 'Example'. ++!!! error TS2339: Property 'value' does not exist on type 'Example'. + } + } + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads.types.diff index fd7abfa320..29881dcb5a 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads.types.diff @@ -1,36 +1,11 @@ --- old.jsFileMethodOverloads.types +++ new.jsFileMethodOverloads.types -@@= skipped -4, +4 lines =@@ - * @template T - */ - class Example { -->Example : Example -+>Example : Example - - /** - * @param {T} value - */ - constructor(value) { -->value : T -+>value : any - - this.value = value; -->this.value = value : T -+>this.value = value : any - >this.value : any - >this : this - >value : any -->value : T -+>value : any - } - - /** -@@= skipped -30, +30 lines =@@ +@@= skipped -34, +34 lines =@@ * @returns {string} */ getTypeName() { ->getTypeName : { (this: Example): "number"; (this: Example): "string"; } -+>getTypeName : () => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ++>getTypeName : () => string return typeof this.value; ->typeof this.value : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" @@ -48,20 +23,16 @@ */ transform(fn) { ->transform : { (fn: (y: T) => U): U; (): T; } -->fn : (y: T) => unknown -+>transform : (fn: any) => any -+>fn : any ++>transform : (fn?: (y: T) => unknown) => unknown + >fn : (y: T) => unknown return fn ? fn(this.value) : this.value; ->fn ? fn(this.value) : this.value : unknown -->fn : (y: T) => unknown -->fn(this.value) : unknown -->fn : (y: T) => unknown -->this.value : T +>fn ? fn(this.value) : this.value : any -+>fn : any -+>fn(this.value) : any -+>fn : any + >fn : (y: T) => unknown + >fn(this.value) : unknown + >fn : (y: T) => unknown +->this.value : T +>this.value : any >this : this ->value : T diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads2.errors.txt.diff index 4b61d6f32c..fd3edaeb41 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads2.errors.txt.diff @@ -3,10 +3,10 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+jsFileMethodOverloads2.js(10,10): error TS2339: Property 'value' does not exist on type 'Example'. -+jsFileMethodOverloads2.js(25,24): error TS2339: Property 'value' does not exist on type 'Example'. -+jsFileMethodOverloads2.js(41,25): error TS2339: Property 'value' does not exist on type 'Example'. -+jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist on type 'Example'. ++jsFileMethodOverloads2.js(10,10): error TS2339: Property 'value' does not exist on type 'Example'. ++jsFileMethodOverloads2.js(25,24): error TS2339: Property 'value' does not exist on type 'Example'. ++jsFileMethodOverloads2.js(41,25): error TS2339: Property 'value' does not exist on type 'Example'. ++jsFileMethodOverloads2.js(41,39): error TS2339: Property 'value' does not exist on type 'Example'. + + +==== jsFileMethodOverloads2.js (4 errors) ==== @@ -21,7 +21,7 @@ + constructor(value) { + this.value = value; + ~~~~~ -+!!! error TS2339: Property 'value' does not exist on type 'Example'. ++!!! error TS2339: Property 'value' does not exist on type 'Example'. + } + + /** @@ -38,7 +38,7 @@ + getTypeName() { + return typeof this.value; + ~~~~~ -+!!! error TS2339: Property 'value' does not exist on type 'Example'. ++!!! error TS2339: Property 'value' does not exist on type 'Example'. + } + + /** @@ -56,9 +56,9 @@ + transform(fn) { + return fn ? fn(this.value) : this.value; + ~~~~~ -+!!! error TS2339: Property 'value' does not exist on type 'Example'. ++!!! error TS2339: Property 'value' does not exist on type 'Example'. + ~~~~~ -+!!! error TS2339: Property 'value' does not exist on type 'Example'. ++!!! error TS2339: Property 'value' does not exist on type 'Example'. + } + } + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads2.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads2.types.diff index 426183ba0c..f781c6acd9 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads2.types.diff @@ -1,36 +1,11 @@ --- old.jsFileMethodOverloads2.types +++ new.jsFileMethodOverloads2.types -@@= skipped -5, +5 lines =@@ - * @template T - */ - class Example { -->Example : Example -+>Example : Example - - /** - * @param {T} value - */ - constructor(value) { -->value : T -+>value : any - - this.value = value; -->this.value = value : T -+>this.value = value : any - >this.value : any - >this : this - >value : any -->value : T -+>value : any - } - - /** -@@= skipped -28, +28 lines =@@ +@@= skipped -33, +33 lines =@@ * @returns {string} */ getTypeName() { ->getTypeName : { (this: Example): "number"; (this: Example): "string"; } -+>getTypeName : () => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ++>getTypeName : () => string return typeof this.value; ->typeof this.value : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" @@ -48,20 +23,16 @@ */ transform(fn) { ->transform : { (fn: (y: T) => U): U; (): T; } -->fn : (y: T) => unknown -+>transform : (fn: any) => any -+>fn : any ++>transform : (fn?: (y: T) => unknown) => unknown + >fn : (y: T) => unknown return fn ? fn(this.value) : this.value; ->fn ? fn(this.value) : this.value : unknown -->fn : (y: T) => unknown -->fn(this.value) : unknown -->fn : (y: T) => unknown -->this.value : T +>fn ? fn(this.value) : this.value : any -+>fn : any -+>fn(this.value) : any -+>fn : any + >fn : (y: T) => unknown + >fn(this.value) : unknown + >fn : (y: T) => unknown +->this.value : T +>this.value : any >this : this ->value : T diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads3.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads3.types.diff index f12b6413e2..02cca06620 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads3.types.diff @@ -5,26 +5,28 @@ */ function id(x) { ->id : { (x: number): any; (x: string): any; } -->x : string | number -+>id : (x: any) => any -+>x : any ++>id : (x: string | number) => string | number + >x : string | number return x; -->x : string | number -+>x : any +@@= skipped -8, +8 lines =@@ } export let a = id(123); - >a : any - >id(123) : any +->a : any +->id(123) : any ->id : { (x: number): any; (x: string): any; } -+>id : (x: any) => any ++>a : string | number ++>id(123) : string | number ++>id : (x: string | number) => string | number >123 : 123 export let b = id("hello"); - >b : any - >id("hello") : any +->b : any +->id("hello") : any ->id : { (x: number): any; (x: string): any; } -+>id : (x: any) => any ++>b : string | number ++>id("hello") : string | number ++>id : (x: string | number) => string | number >"hello" : "hello" diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads5.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads5.types.diff index d92bba1afc..a85e8ff97e 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileMethodOverloads5.types.diff @@ -6,10 +6,8 @@ export const foo = function (a, b) { } ->foo : { (a: string): void; (a: number, b?: number): void; } ->function (a, b) { } : { (a: string): void; (a: number, b?: number): void; } -->a : string | number -->b : number -+>foo : (a: any, b: any) => void -+>function (a, b) { } : (a: any, b: any) => void -+>a : any -+>b : any ++>foo : (a: string | number, b?: number) => void ++>function (a, b) { } : (a: string | number, b?: number) => void + >a : string | number + >b : number diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocAccessEnumType.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocAccessEnumType.types.diff deleted file mode 100644 index 60058b346c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocAccessEnumType.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsdocAccessEnumType.types -+++ new.jsdocAccessEnumType.types -@@= skipped -10, +10 lines =@@ - - /** @type {E} */ - const e = E.A; -->e : E -+>e : E.A - >E.A : E - >E : typeof E - >A : E diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff new file mode 100644 index 0000000000..64a04b64c4 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff @@ -0,0 +1,74 @@ +--- old.jsdocArrayObjectPromiseImplicitAny.errors.txt ++++ new.jsdocArrayObjectPromiseImplicitAny.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++jsdocArrayObjectPromiseImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++jsdocArrayObjectPromiseImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++jsdocArrayObjectPromiseImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++jsdocArrayObjectPromiseImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). ++jsdocArrayObjectPromiseImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). ++jsdocArrayObjectPromiseImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). ++jsdocArrayObjectPromiseImplicitAny.js(30,18): error TS2322: Type 'number' is not assignable to type '() => Object'. ++jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. ++ ++ ++==== jsdocArrayObjectPromiseImplicitAny.js (8 errors) ==== ++ /** @type {Array} */ ++ ~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). ++ var anyArray = [5]; ++ ++ /** @type {Array} */ ++ var numberArray = [5]; ++ ++ /** ++ * @param {Array} arr ++ ~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). ++ * @return {Array} ++ ~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). ++ */ ++ function returnAnyArray(arr) { ++ return arr; ++ } ++ ++ /** @type {Promise} */ ++ ~~~~~~~ ++!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). ++ var anyPromise = Promise.resolve(5); ++ ++ /** @type {Promise} */ ++ var numberPromise = Promise.resolve(5); ++ ++ /** ++ * @param {Promise} pr ++ ~~~~~~~ ++!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). ++ * @return {Promise} ++ ~~~~~~~ ++!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). ++ */ ++ function returnAnyPromise(pr) { ++ return pr; ++ } ++ ++ /** @type {Object} */ ++ var anyObject = {valueOf: 1}; // not an error since assigning to any. ++ ~~~~~~~ ++!!! error TS2322: Type 'number' is not assignable to type '() => Object'. ++ ++ /** @type {Object} */ ++ ~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. ++ var paramedObject = {valueOf: 1}; ++ ++ /** ++ * @param {Object} obj ++ * @return {Object} ++ */ ++ function returnAnyObject(obj) { ++ return obj; ++ } ++ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.types.diff index 68f53b0ffc..392bc3b554 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.types.diff @@ -5,7 +5,7 @@ /** @type {Array} */ var anyArray = [5]; ->anyArray : any[] -+>anyArray : number[] ++>anyArray : any >[5] : number[] >5 : 5 @@ -26,7 +26,7 @@ /** @type {Promise} */ var anyPromise = Promise.resolve(5); ->anyPromise : Promise -+>anyPromise : Promise ++>anyPromise : any >Promise.resolve(5) : Promise >Promise.resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; } >Promise : PromiseConstructor @@ -47,7 +47,7 @@ /** @type {Object} */ var anyObject = {valueOf: 1}; // not an error since assigning to any. ->anyObject : any -+>anyObject : { valueOf: number; } ++>anyObject : Object >{valueOf: 1} : { valueOf: number; } >valueOf : number >1 : 1 @@ -55,7 +55,21 @@ /** @type {Object} */ var paramedObject = {valueOf: 1}; ->paramedObject : { [x: string]: number; } -+>paramedObject : { valueOf: number; } ++>paramedObject : any >{valueOf: 1} : { valueOf: number; } >valueOf : number >1 : 1 +@@= skipped -26, +26 lines =@@ + * @return {Object} + */ + function returnAnyObject(obj) { +->returnAnyObject : (obj: any) => any +->obj : any ++>returnAnyObject : (obj: Object) => Object ++>obj : Object + + return obj; +->obj : any ++>obj : Object + } + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff index dd54222c94..8907da0eca 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff @@ -1,71 +1,47 @@ --- old.jsdocArrayObjectPromiseNoImplicitAny.errors.txt +++ new.jsdocArrayObjectPromiseNoImplicitAny.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'Array' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'Array' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'Array' requires 1 type argument(s). --jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). --jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). --jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). --jsdocArrayObjectPromiseNoImplicitAny.js(30,21): error TS2322: Type 'number' is not assignable to type '() => Object'. -- -- ++jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). + jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). + jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). + jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). + jsdocArrayObjectPromiseNoImplicitAny.js(30,21): error TS2322: Type 'number' is not assignable to type '() => Object'. ++jsdocArrayObjectPromiseNoImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. + + -==== jsdocArrayObjectPromiseNoImplicitAny.js (7 errors) ==== -- /** @type {Array} */ -- ~~~~~ ++==== jsdocArrayObjectPromiseNoImplicitAny.js (8 errors) ==== + /** @type {Array} */ + ~~~~~ -!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -- var notAnyArray = [5]; -- -- /** @type {Array} */ -- var numberArray = [5]; -- -- /** -- * @param {Array} arr -- ~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + var notAnyArray = [5]; + + /** @type {Array} */ +@@= skipped -18, +19 lines =@@ + /** + * @param {Array} arr + ~~~~~ -!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -- * @return {Array} -- ~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + * @return {Array} + ~~~~~ -!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -- */ -- function returnNotAnyArray(arr) { -- return arr; -- } -- -- /** @type {Promise} */ -- ~~~~~~~ --!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). -- var notAnyPromise = Promise.resolve(5); -- -- /** @type {Promise} */ -- var numberPromise = Promise.resolve(5); -- -- /** -- * @param {Promise} pr -- ~~~~~~~ --!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). -- * @return {Promise} -- ~~~~~~~ --!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). -- */ -- function returnNotAnyPromise(pr) { -- return pr; -- } -- -- /** @type {Object} */ -- var notAnyObject = {valueOf: 1}; // error since assigning to Object, not any. -- ~~~~~~~ --!!! error TS2322: Type 'number' is not assignable to type '() => Object'. -- -- /** @type {Object} */ -- var paramedObject = {valueOf: 1}; -- -- /** -- * @param {Object} obj -- * @return {Object} -- */ -- function returnNotAnyObject(obj) { -- return obj; -- } -- -@@= skipped --1, +1 lines =@@ -+ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + */ + function returnNotAnyArray(arr) { + return arr; +@@= skipped -35, +35 lines =@@ + !!! error TS2322: Type 'number' is not assignable to type '() => Object'. + + /** @type {Object} */ ++ ~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. + var paramedObject = {valueOf: 1}; + + /** diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.types.diff index 1256f721e6..c26d884397 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.types.diff @@ -5,7 +5,7 @@ /** @type {Array} */ var notAnyArray = [5]; ->notAnyArray : any[] -+>notAnyArray : number[] ++>notAnyArray : any >[5] : number[] >5 : 5 @@ -26,7 +26,7 @@ /** @type {Promise} */ var notAnyPromise = Promise.resolve(5); ->notAnyPromise : Promise -+>notAnyPromise : Promise ++>notAnyPromise : any >Promise.resolve(5) : Promise >Promise.resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; } >Promise : PromiseConstructor @@ -45,31 +45,12 @@ } /** @type {Object} */ - var notAnyObject = {valueOf: 1}; // error since assigning to Object, not any. -->notAnyObject : Object -+>notAnyObject : { valueOf: number; } - >{valueOf: 1} : { valueOf: number; } - >valueOf : number - >1 : 1 +@@= skipped -16, +16 lines =@@ /** @type {Object} */ var paramedObject = {valueOf: 1}; ->paramedObject : { [x: string]: number; } -+>paramedObject : { valueOf: number; } ++>paramedObject : any >{valueOf: 1} : { valueOf: number; } >valueOf : number >1 : 1 -@@= skipped -26, +26 lines =@@ - * @return {Object} - */ - function returnNotAnyObject(obj) { -->returnNotAnyObject : (obj: Object) => Object -->obj : Object -+>returnNotAnyObject : (obj: any) => any -+>obj : any - - return obj; -->obj : Object -+>obj : any - } - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocBracelessTypeTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocBracelessTypeTag1.errors.txt.diff index d1d1cf09bd..fc65d1e9e5 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocBracelessTypeTag1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocBracelessTypeTag1.errors.txt.diff @@ -4,10 +4,10 @@ -index.js(3,3): error TS2322: Type 'number' is not assignable to type 'string'. -index.js(20,16): error TS2322: Type '"other"' is not assignable to type '"foo" | "bar"'. +index.js(12,14): error TS7006: Parameter 'arg' implicitly has an 'any' type. ++index.js(20,16): error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'. --==== index.js (2 errors) ==== -+==== index.js (1 errors) ==== + ==== index.js (2 errors) ==== /** @type () => string */ function fn1() { return 42; @@ -16,7 +16,7 @@ } /** @type () => string */ -@@= skipped -16, +13 lines =@@ +@@= skipped -16, +14 lines =@@ /** @type (arg: string) => string */ function fn3(arg) { @@ -25,11 +25,11 @@ return arg; } -@@= skipped -8, +10 lines =@@ - +@@= skipped -9, +11 lines =@@ /** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */ const obj2 = { type: "other", prop: 10 }; -- ~~~~ + ~~~~ -!!! error TS2322: Type '"other"' is not assignable to type '"foo" | "bar"'. --!!! related TS6500 index.js:19:14: The expected type comes from property 'type' which is declared here on type '({ type: "foo"; } | { type: "bar"; }) & { prop: number; }' ++!!! error TS2322: Type '"other"' is not assignable to type '"bar" | "foo"'. + !!! related TS6500 index.js:19:14: The expected type comes from property 'type' which is declared here on type '({ type: "foo"; } | { type: "bar"; }) & { prop: number; }' diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocBracelessTypeTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocBracelessTypeTag1.types.diff index 7957df75cd..fb8fca68cd 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocBracelessTypeTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocBracelessTypeTag1.types.diff @@ -24,25 +24,3 @@ } /** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */ - const obj1 = { type: "foo", prop: 10 }; -->obj1 : ({ type: "foo"; } | { type: "bar"; }) & { prop: number; } -->{ type: "foo", prop: 10 } : { type: "foo"; prop: number; } -->type : "foo" -+>obj1 : { type: string; prop: number; } -+>{ type: "foo", prop: 10 } : { type: string; prop: number; } -+>type : string - >"foo" : "foo" - >prop : number - >10 : 10 - - /** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */ - const obj2 = { type: "other", prop: 10 }; -->obj2 : ({ type: "foo"; } | { type: "bar"; }) & { prop: number; } -->{ type: "other", prop: 10 } : { type: "other"; prop: number; } -->type : "other" -+>obj2 : { type: string; prop: number; } -+>{ type: "other", prop: 10 } : { type: string; prop: number; } -+>type : string - >"other" : "other" - >prop : number - >10 : 10 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocCallbackAndType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocCallbackAndType.errors.txt.diff index 68509d8155..9f045ce14f 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocCallbackAndType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocCallbackAndType.errors.txt.diff @@ -1,20 +1,20 @@ --- old.jsdocCallbackAndType.errors.txt +++ new.jsdocCallbackAndType.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(8,3): error TS2554: Expected 0 arguments, but got 1. -- -- --==== /a.js (1 errors) ==== -- /** -- * @template T -- * @callback B -- */ -- /** @type {B} */ -- let b; -- b(); -- b(1); ++/a.js(5,12): error TS2304: Cannot find name 'B'. + + + ==== /a.js (1 errors) ==== +@@= skipped -6, +6 lines =@@ + * @callback B + */ + /** @type {B} */ ++ ~ ++!!! error TS2304: Cannot find name 'B'. + let b; + b(); + b(1); - ~ -!!! error TS2554: Expected 0 arguments, but got 1. -- -@@= skipped --1, +1 lines =@@ -+ + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocCallbackAndType.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocCallbackAndType.types.diff deleted file mode 100644 index 00a2610a27..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocCallbackAndType.types.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.jsdocCallbackAndType.types -+++ new.jsdocCallbackAndType.types -@@= skipped -6, +6 lines =@@ - */ - /** @type {B} */ - let b; -->b : B -+>b : any - - b(); - >b() : any -->b : B -+>b : any - - b(1); - >b(1) : any -->b : B -+>b : any - >1 : 1 - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocClassMissingTypeArguments.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocClassMissingTypeArguments.errors.txt.diff deleted file mode 100644 index 13944e2fbd..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocClassMissingTypeArguments.errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.jsdocClassMissingTypeArguments.errors.txt -+++ new.jsdocClassMissingTypeArguments.errors.txt -@@= skipped -0, +-1 lines =@@ --/a.js(4,13): error TS2314: Generic type 'C' requires 1 type argument(s). -- -- --==== /a.js (1 errors) ==== -- /** @template T */ -- class C {} -- -- /** @param {C} p */ -- ~ --!!! error TS2314: Generic type 'C' requires 1 type argument(s). -- function f(p) {} -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocClassMissingTypeArguments.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocClassMissingTypeArguments.types.diff index 5969ef1cbc..15b52eecbb 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocClassMissingTypeArguments.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocClassMissingTypeArguments.types.diff @@ -1,11 +1,6 @@ --- old.jsdocClassMissingTypeArguments.types +++ new.jsdocClassMissingTypeArguments.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** @template T */ - class C {} -->C : C -+>C : C +@@= skipped -6, +6 lines =@@ /** @param {C} p */ function f(p) {} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionClassPropertiesDeclaration.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionClassPropertiesDeclaration.types.diff index 862e3cf251..1a88902f9c 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionClassPropertiesDeclaration.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionClassPropertiesDeclaration.types.diff @@ -5,49 +5,40 @@ */ export function Foo(x, y) { ->Foo : typeof Foo -->x : number | undefined -->y : number | undefined -+>Foo : (x: any, y: any) => any -+>x : any -+>y : any ++>Foo : (x: number | undefined, y: number | undefined) => any + >x : number | undefined + >y : number | undefined - if (!(this instanceof Foo)) { +@@= skipped -8, +8 lines =@@ >!(this instanceof Foo) : boolean >(this instanceof Foo) : boolean >this instanceof Foo : boolean ->this : this ->Foo : typeof Foo +>this : any -+>Foo : (x: any, y: any) => any ++>Foo : (x: number | undefined, y: number | undefined) => any return new Foo(x, y); ->new Foo(x, y) : Foo ->Foo : typeof Foo -->x : number | undefined -->y : number | undefined +>new Foo(x, y) : any -+>Foo : (x: any, y: any) => any -+>x : any -+>y : any ++>Foo : (x: number | undefined, y: number | undefined) => any + >x : number | undefined + >y : number | undefined } this.x = x; -->this.x = x : number | undefined -+>this.x = x : any + >this.x = x : number | undefined >this.x : any ->this : this +>this : any >x : any -->x : number | undefined -+>x : any + >x : number | undefined this.y = y; -->this.y = y : number | undefined -+>this.y = y : any + >this.y = y : number | undefined >this.y : any ->this : this +>this : any >y : any -->y : number | undefined -+>y : any + >y : number | undefined } - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.errors.txt.diff index 67967f145e..0bd8003afb 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.errors.txt.diff @@ -1,17 +1,16 @@ --- old.jsdocFunctionTypeFalsePositive.errors.txt +++ new.jsdocFunctionTypeFalsePositive.errors.txt -@@= skipped -0, +-1 lines =@@ --/a.js(1,13): error TS1098: Type parameter list cannot be empty. +@@= skipped -0, +0 lines =@@ + /a.js(1,13): error TS1098: Type parameter list cannot be empty. -/a.js(1,14): error TS1139: Type parameter declaration expected. -- -- + + -==== /a.js (2 errors) ==== -- /** @param {<} x */ -- ~~ --!!! error TS1098: Type parameter list cannot be empty. ++==== /a.js (1 errors) ==== + /** @param {<} x */ + ~~ + !!! error TS1098: Type parameter list cannot be empty. - ~ -!!! error TS1139: Type parameter declaration expected. -- function f(x) {} -- -@@= skipped --1, +1 lines =@@ -+ + function f(x) {} + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.types.diff deleted file mode 100644 index 5c224bdbab..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsdocFunctionTypeFalsePositive.types -+++ new.jsdocFunctionTypeFalsePositive.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** @param {<} x */ - function f(x) {} -->f : (x: () => any) => void -->x : () => any -+>f : (x: any) => void -+>x : any - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocIllegalTags.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocIllegalTags.errors.txt.diff index 82630ab0ac..83cfa52421 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocIllegalTags.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocIllegalTags.errors.txt.diff @@ -2,22 +2,18 @@ +++ new.jsdocIllegalTags.errors.txt @@= skipped -0, +0 lines =@@ -/a.js(2,19): error TS1092: Type parameters cannot appear on a constructor declaration. --/a.js(6,18): error TS1093: Type annotation cannot appear on a constructor declaration. -+/a.js(6,17): error TS1093: Type annotation cannot appear on a constructor declaration. ++/a.js(3,5): error TS1092: Type parameters cannot appear on a constructor declaration. + /a.js(6,18): error TS1093: Type annotation cannot appear on a constructor declaration. --==== /a.js (2 errors) ==== -+==== /a.js (1 errors) ==== + ==== /a.js (2 errors) ==== class C { /** @template T */ - ~ -!!! error TS1092: Type parameters cannot appear on a constructor declaration. constructor() { } ++ ~~~~~~~~~~~~~~~~~ ++!!! error TS1092: Type parameters cannot appear on a constructor declaration. } class D { /** @return {number} */ -- ~~~~~~ -+ ~~~~~~~~ - !!! error TS1093: Type annotation cannot appear on a constructor declaration. - constructor() {} - } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeNodeNamespace.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeNodeNamespace.errors.txt.diff index ce72455d0a..a5f57dfca2 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeNodeNamespace.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeNodeNamespace.errors.txt.diff @@ -1,21 +1,18 @@ --- old.jsdocImportTypeNodeNamespace.errors.txt +++ new.jsdocImportTypeNodeNamespace.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -Main.js(2,21): error TS2352: Conversion of type 'string' to type 'typeof _default' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. -- -- --==== GeometryType.d.ts (0 errors) ==== -- declare namespace _default { -- export const POINT: string; -- } -- export default _default; -- --==== Main.js (1 errors) ==== -- export default function () { -- return /** @type {import('./GeometryType.js').default} */ ('Point'); ++Main.js(2,49): error TS2694: Namespace '"GeometryType"' has no exported member 'default'. + + + ==== GeometryType.d.ts (0 errors) ==== +@@= skipped -9, +9 lines =@@ + ==== Main.js (1 errors) ==== + export default function () { + return /** @type {import('./GeometryType.js').default} */ ('Point'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Conversion of type 'string' to type 'typeof _default' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. -- } -- -@@= skipped --1, +1 lines =@@ -+ ++ ~~~~~~~ ++!!! error TS2694: Namespace '"GeometryType"' has no exported member 'default'. + } + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeNodeNamespace.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeNodeNamespace.types.diff index bed110cb86..9b8fabf4c6 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeNodeNamespace.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeNodeNamespace.types.diff @@ -5,7 +5,8 @@ export default function () { return /** @type {import('./GeometryType.js').default} */ ('Point'); ->('Point') : typeof import("GeometryType").default -+>('Point') : "Point" ++>('Point') : any ++>'Point' : any >'Point' : "Point" } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeResolution.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeResolution.types.diff index 6dda424a15..264e7ad36f 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeResolution.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeResolution.types.diff @@ -1,9 +1,14 @@ --- old.jsdocImportTypeResolution.types +++ new.jsdocImportTypeResolution.types -@@= skipped -11, +11 lines =@@ +@@= skipped -7, +7 lines =@@ + === usage.js === + /** + * @typedef {Object} options ++>options : any ++ + * @property {import("./module").MyClass} option ++>option : any ++ */ /** @type {options} */ let v; -->v : options -+>v : any - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParamTagOnPropertyInitializer.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParamTagOnPropertyInitializer.errors.txt.diff deleted file mode 100644 index 314d1d1969..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParamTagOnPropertyInitializer.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.jsdocParamTagOnPropertyInitializer.errors.txt -+++ new.jsdocParamTagOnPropertyInitializer.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/a.js(3,9): error TS7006: Parameter 'x' implicitly has an 'any' type. -+ -+ -+==== /a.js (1 errors) ==== -+ class Foo { -+ /**@param {string} x */ -+ m = x => x.toLowerCase(); -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ } -+ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParamTagOnPropertyInitializer.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParamTagOnPropertyInitializer.types.diff deleted file mode 100644 index 7dfb483cf1..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParamTagOnPropertyInitializer.types.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.jsdocParamTagOnPropertyInitializer.types -+++ new.jsdocParamTagOnPropertyInitializer.types -@@= skipped -5, +5 lines =@@ - - /**@param {string} x */ - m = x => x.toLowerCase(); -->m : (x: string) => string -->x => x.toLowerCase() : (x: string) => string -->x : string -->x.toLowerCase() : string -->x.toLowerCase : () => string -->x : string -->toLowerCase : () => string -+>m : (x: any) => any -+>x => x.toLowerCase() : (x: any) => any -+>x : any -+>x.toLowerCase() : any -+>x.toLowerCase : any -+>x : any -+>toLowerCase : any - } - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff index 795b5d4d8d..02309368e5 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff @@ -1,22 +1,25 @@ --- old.jsdocParameterParsingInfiniteLoop.errors.txt +++ new.jsdocParameterParsingInfiniteLoop.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -example.js(3,11): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -example.js(3,20): error TS1110: Type expected. -example.js(3,21): error TS2304: Cannot find name 'foo'. -- -- ++example.js(3,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + -==== example.js (3 errors) ==== -- // @ts-check -- /** -- * @type {function(@foo)} ++==== example.js (1 errors) ==== + // @ts-check + /** + * @type {function(@foo)} - ~~~~~~~~~~~~~~ -!!! error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. - ~ -!!! error TS1110: Type expected. - ~~~ -!!! error TS2304: Cannot find name 'foo'. -- */ -- let x; -@@= skipped --1, +1 lines =@@ -+ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + */ + let x; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.types.diff index ce95d22415..1f501e7ba6 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.types.diff @@ -5,5 +5,5 @@ */ let x; ->x : (arg0: any, arg1: foo) => any -+>x : any ++>x : function diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocPropertyTagInvalid.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocPropertyTagInvalid.types.diff index 922db8114b..3aedcae965 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocPropertyTagInvalid.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocPropertyTagInvalid.types.diff @@ -1,23 +1,14 @@ --- old.jsdocPropertyTagInvalid.types +++ new.jsdocPropertyTagInvalid.types -@@= skipped -7, +7 lines =@@ +@@= skipped -2, +2 lines =@@ + === /a.js === + /** + * @typedef MyType ++>MyType : MyType ++ + * @property {sting} [x] ++>x : any ++ + */ /** @param {MyType} p */ - export function f(p) { } -->f : (p: MyType) => void -->p : MyType -+>f : (p: any) => void -+>p : any - - === /b.js === - import { f } from "./a.js" -->f : (p: MyType) => void -+>f : (p: any) => void - - f({ x: 42 }) - >f({ x: 42 }) : void -->f : (p: MyType) => void -+>f : (p: any) => void - >{ x: 42 } : { x: number; } - >x : number - >42 : 42 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocReferenceGlobalTypeInCommonJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocReferenceGlobalTypeInCommonJs.types.diff index 24508c8c9b..bc912162d7 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocReferenceGlobalTypeInCommonJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocReferenceGlobalTypeInCommonJs.types.diff @@ -14,7 +14,7 @@ /** @type {Puppeteer.Keyboard} */ var ppk; ->ppk : Puppeteer.Keyboard -+>ppk : any ++>ppk : Keyboard Puppeteer.connect; >Puppeteer.connect : (name: string) => void diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocResolveNameFailureInTypedef.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocResolveNameFailureInTypedef.errors.txt.diff index 4b568dd738..77654e6eef 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocResolveNameFailureInTypedef.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocResolveNameFailureInTypedef.errors.txt.diff @@ -1,20 +1,21 @@ --- old.jsdocResolveNameFailureInTypedef.errors.txt +++ new.jsdocResolveNameFailureInTypedef.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(7,14): error TS2304: Cannot find name 'CantResolveThis'. -- -- --==== /a.js (1 errors) ==== -- /** -- * @param {Ty} x -- */ -- function f(x) {} -- -- /** -- * @typedef {CantResolveThis} Ty ++/a.js(2,12): error TS2304: Cannot find name 'Ty'. + + + ==== /a.js (1 errors) ==== + /** + * @param {Ty} x ++ ~~ ++!!! error TS2304: Cannot find name 'Ty'. + */ + function f(x) {} + + /** + * @typedef {CantResolveThis} Ty - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'CantResolveThis'. -- */ -- -@@= skipped --1, +1 lines =@@ -+ + */ + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocResolveNameFailureInTypedef.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocResolveNameFailureInTypedef.types.diff index e7579dfbed..ce2247023a 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocResolveNameFailureInTypedef.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocResolveNameFailureInTypedef.types.diff @@ -1,13 +1,11 @@ --- old.jsdocResolveNameFailureInTypedef.types +++ new.jsdocResolveNameFailureInTypedef.types -@@= skipped -4, +4 lines =@@ - * @param {Ty} x +@@= skipped -5, +5 lines =@@ */ function f(x) {} -->f : (x: Ty) => void + >f : (x: Ty) => void ->x : CantResolveThis -+>f : (x: any) => void -+>x : any ++>x : Ty /** * @typedef {CantResolveThis} Ty diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocRestParameter.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocRestParameter.types.diff index aa401b01bf..c467d5e766 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocRestParameter.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocRestParameter.types.diff @@ -6,12 +6,12 @@ function f(a) { ->f : (...args: number[]) => void ->a : number | undefined -+>f : (a: any) => void -+>a : any ++>f : (a: number[]) => void ++>a : number[] a; // number | undefined ->a : number | undefined -+>a : any ++>a : number[] // Ideally this would be a number. But currently checker.ts has only one `argumentsSymbol`, so it's `any`. arguments[0]; @@ -20,7 +20,7 @@ f([1, 2]); // Error >f([1, 2]) : void ->f : (...args: number[]) => void -+>f : (a: any) => void ++>f : (a: number[]) => void >[1, 2] : number[] >1 : 1 >2 : 2 @@ -28,14 +28,14 @@ f(1, "2"); // Error >f(1, "2") : void ->f : (...args: number[]) => void -+>f : (a: any) => void ++>f : (a: number[]) => void >1 : 1 >"2" : "2" f(1, 2); >f(1, 2) : void ->f : (...args: number[]) => void -+>f : (a: any) => void ++>f : (a: number[]) => void >1 : 1 >2 : 2 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocRestParameter_es6.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocRestParameter_es6.errors.txt.diff deleted file mode 100644 index 79fa219903..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocRestParameter_es6.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.jsdocRestParameter_es6.errors.txt -+++ new.jsdocRestParameter_es6.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/a.js(2,12): error TS7019: Rest parameter 'a' implicitly has an 'any[]' type. -+ -+ -+==== /a.js (1 errors) ==== -+ /** @param {...number} a */ -+ function f(...a) { -+ ~~~~ -+!!! error TS7019: Rest parameter 'a' implicitly has an 'any[]' type. -+ a; // number[] -+ } -+ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocRestParameter_es6.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocRestParameter_es6.types.diff deleted file mode 100644 index 6ec6fe64b2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocRestParameter_es6.types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.jsdocRestParameter_es6.types -+++ new.jsdocRestParameter_es6.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** @param {...number} a */ - function f(...a) { -->f : (...a: number[]) => void -->a : number[] -+>f : (...a: any[]) => void -+>a : any[] - - a; // number[] -->a : number[] -+>a : any[] - } - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeCast.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeCast.errors.txt.diff deleted file mode 100644 index 0d143fd995..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeCast.errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.jsdocTypeCast.errors.txt -+++ new.jsdocTypeCast.errors.txt -@@= skipped -0, +-1 lines =@@ --jsdocTypeCast.js(6,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. --jsdocTypeCast.js(10,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'. -- -- --==== jsdocTypeCast.js (2 errors) ==== -- /** -- * @param {string} x -- */ -- function f(x) { -- /** @type {'a' | 'b'} */ -- let a = (x); // Error -- ~ --!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. -- a; -- -- /** @type {'a' | 'b'} */ -- let b = (((x))); // Error -- ~ --!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'. -- b; -- -- /** @type {'a' | 'b'} */ -- let c = /** @type {'a' | 'b'} */ (x); // Ok -- c; -- } -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeCast.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeCast.types.diff index 4a1517118b..443aeb47e0 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeCast.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeCast.types.diff @@ -1,55 +1,28 @@ --- old.jsdocTypeCast.types +++ new.jsdocTypeCast.types -@@= skipped -4, +4 lines =@@ - * @param {string} x - */ - function f(x) { -->f : (x: string) => void -->x : string -+>f : (x: any) => void -+>x : any - +@@= skipped -10, +10 lines =@@ /** @type {'a' | 'b'} */ let a = (x); // Error -->a : "a" | "b" + >a : "a" | "b" ->(x) : "a" | "b" -->x : string -+>a : any -+>(x) : any -+>x : any ++>(x) : string + >x : string a; -->a : "a" | "b" -+>a : any - +@@= skipped -9, +9 lines =@@ /** @type {'a' | 'b'} */ let b = (((x))); // Error -->b : "a" | "b" + >b : "a" | "b" ->(((x))) : "a" | "b" -->((x)) : string -->(x) : string -->x : string -+>b : any -+>(((x))) : any -+>((x)) : any -+>(x) : any -+>x : any - - b; -->b : "a" | "b" -+>b : any - - /** @type {'a' | 'b'} */ ++>(((x))) : string + >((x)) : string + >(x) : string + >x : string +@@= skipped -12, +12 lines =@@ let c = /** @type {'a' | 'b'} */ (x); // Ok -->c : "a" | "b" -->(x) : "a" | "b" -->x : string -+>c : any -+>(x) : any -+>x : any + >c : "a" | "b" + >(x) : "a" | "b" ++>x : "a" | "b" + >x : string c; -->c : "a" | "b" -+>c : any - } - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeGenericInstantiationAttempt.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeGenericInstantiationAttempt.types.diff index 99c91b3454..8f9e806f12 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeGenericInstantiationAttempt.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeGenericInstantiationAttempt.types.diff @@ -5,12 +5,7 @@ */ function thing(list) { ->thing : (list: Array) => any[] -->list : any[] -+>thing : (list: any) => any -+>list : any ++>thing : (list: any[]) => any[] + >list : any[] return list; -->list : any[] -+>list : any - } - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff index 0632a01195..718407d02f 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeNongenericInstantiationAttempt.errors.txt.diff @@ -1,99 +1,134 @@ --- old.jsdocTypeNongenericInstantiationAttempt.errors.txt +++ new.jsdocTypeNongenericInstantiationAttempt.errors.txt -@@= skipped -0, +-1 lines =@@ --index.js(2,19): error TS2315: Type 'Boolean' is not generic. +@@= skipped -0, +0 lines =@@ + index.js(2,19): error TS2315: Type 'Boolean' is not generic. -index2.js(2,19): error TS2315: Type 'Void' is not generic. -index3.js(2,19): error TS2315: Type 'Undefined' is not generic. --index4.js(2,19): error TS2315: Type 'Function' is not generic. --index5.js(2,19): error TS2315: Type 'String' is not generic. --index6.js(2,19): error TS2315: Type 'Number' is not generic. --index7.js(2,19): error TS2315: Type 'Object' is not generic. --index8.js(4,15): error TS2304: Cannot find name 'T'. -- -- ++index.js(2,27): error TS2304: Cannot find name 'T'. ++index2.js(2,19): error TS2304: Cannot find name 'Void'. ++index2.js(2,24): error TS2304: Cannot find name 'T'. ++index3.js(2,19): error TS2304: Cannot find name 'Undefined'. ++index3.js(2,29): error TS2304: Cannot find name 'T'. + index4.js(2,19): error TS2315: Type 'Function' is not generic. ++index4.js(2,28): error TS2304: Cannot find name 'T'. + index5.js(2,19): error TS2315: Type 'String' is not generic. ++index5.js(2,26): error TS2304: Cannot find name 'T'. + index6.js(2,19): error TS2315: Type 'Number' is not generic. ++index6.js(2,26): error TS2304: Cannot find name 'T'. + index7.js(2,19): error TS2315: Type 'Object' is not generic. ++index7.js(2,26): error TS2304: Cannot find name 'T'. ++index8.js(4,12): error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? + index8.js(4,15): error TS2304: Cannot find name 'T'. + + -==== index.js (1 errors) ==== -- /** -- * @param {(m: Boolean) => string} somebody -- ~~~~~~~~~~ --!!! error TS2315: Type 'Boolean' is not generic. -- */ -- function sayHello(somebody) { -- return 'Hello ' + somebody; -- } -- ++==== index.js (2 errors) ==== + /** + * @param {(m: Boolean) => string} somebody + ~~~~~~~~~~ + !!! error TS2315: Type 'Boolean' is not generic. ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function sayHello(somebody) { + return 'Hello ' + somebody; + } + -==== index2.js (1 errors) ==== -- /** -- * @param {(m: Void) => string} somebody ++==== index2.js (2 errors) ==== + /** + * @param {(m: Void) => string} somebody - ~~~~~~~ -!!! error TS2315: Type 'Void' is not generic. -- */ -- function sayHello2(somebody) { -- return 'Hello ' + somebody; -- } -- -- ++ ~~~~ ++!!! error TS2304: Cannot find name 'Void'. ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function sayHello2(somebody) { + return 'Hello ' + somebody; + } + + -==== index3.js (1 errors) ==== -- /** -- * @param {(m: Undefined) => string} somebody ++==== index3.js (2 errors) ==== + /** + * @param {(m: Undefined) => string} somebody - ~~~~~~~~~~~~ -!!! error TS2315: Type 'Undefined' is not generic. -- */ -- function sayHello3(somebody) { -- return 'Hello ' + somebody; -- } -- -- ++ ~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Undefined'. ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function sayHello3(somebody) { + return 'Hello ' + somebody; + } + + -==== index4.js (1 errors) ==== -- /** -- * @param {(m: Function) => string} somebody -- ~~~~~~~~~~~ --!!! error TS2315: Type 'Function' is not generic. -- */ -- function sayHello4(somebody) { -- return 'Hello ' + somebody; -- } -- -- ++==== index4.js (2 errors) ==== + /** + * @param {(m: Function) => string} somebody + ~~~~~~~~~~~ + !!! error TS2315: Type 'Function' is not generic. ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function sayHello4(somebody) { + return 'Hello ' + somebody; + } + + -==== index5.js (1 errors) ==== -- /** -- * @param {(m: String) => string} somebody -- ~~~~~~~~~ --!!! error TS2315: Type 'String' is not generic. -- */ -- function sayHello5(somebody) { -- return 'Hello ' + somebody; -- } -- -- ++==== index5.js (2 errors) ==== + /** + * @param {(m: String) => string} somebody + ~~~~~~~~~ + !!! error TS2315: Type 'String' is not generic. ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function sayHello5(somebody) { + return 'Hello ' + somebody; + } + + -==== index6.js (1 errors) ==== -- /** -- * @param {(m: Number) => string} somebody -- ~~~~~~~~~ --!!! error TS2315: Type 'Number' is not generic. -- */ -- function sayHello6(somebody) { -- return 'Hello ' + somebody; -- } -- -- ++==== index6.js (2 errors) ==== + /** + * @param {(m: Number) => string} somebody + ~~~~~~~~~ + !!! error TS2315: Type 'Number' is not generic. ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function sayHello6(somebody) { + return 'Hello ' + somebody; + } + + -==== index7.js (1 errors) ==== -- /** -- * @param {(m: Object) => string} somebody -- ~~~~~~~~~ --!!! error TS2315: Type 'Object' is not generic. -- */ -- function sayHello7(somebody) { -- return 'Hello ' + somebody; -- } -- ++==== index7.js (2 errors) ==== + /** + * @param {(m: Object) => string} somebody + ~~~~~~~~~ + !!! error TS2315: Type 'Object' is not generic. ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + function sayHello7(somebody) { + return 'Hello ' + somebody; + } + -==== index8.js (1 errors) ==== -- function fn() {} -- -- /** -- * @param {fn} somebody -- ~ --!!! error TS2304: Cannot find name 'T'. -- */ -- function sayHello8(somebody) { } -@@= skipped --1, +1 lines =@@ -+ ++==== index8.js (2 errors) ==== + function fn() {} + + /** + * @param {fn} somebody ++ ~~ ++!!! error TS2749: 'fn' refers to a value, but is being used as a type here. Did you mean 'typeof fn'? + ~ + !!! error TS2304: Cannot find name 'T'. + */ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeNongenericInstantiationAttempt.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeNongenericInstantiationAttempt.types.diff index e6def65a42..50544407b0 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeNongenericInstantiationAttempt.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypeNongenericInstantiationAttempt.types.diff @@ -6,14 +6,14 @@ function sayHello(somebody) { ->sayHello : (somebody: (m: boolean) => string) => string ->somebody : (m: boolean) => string -+>sayHello : (somebody: any) => string -+>somebody : any ++>sayHello : (somebody: (m: any) => string) => string ++>somebody : (m: any) => string return 'Hello ' + somebody; >'Hello ' + somebody : string >'Hello ' : "Hello " ->somebody : (m: boolean) => string -+>somebody : any ++>somebody : (m: any) => string } === index2.js === @@ -23,14 +23,14 @@ function sayHello2(somebody) { ->sayHello2 : (somebody: (m: void) => string) => string ->somebody : (m: void) => string -+>sayHello2 : (somebody: any) => string -+>somebody : any ++>sayHello2 : (somebody: (m: Void) => string) => string ++>somebody : (m: Void) => string return 'Hello ' + somebody; >'Hello ' + somebody : string >'Hello ' : "Hello " ->somebody : (m: void) => string -+>somebody : any ++>somebody : (m: Void) => string } @@ -40,14 +40,14 @@ function sayHello3(somebody) { ->sayHello3 : (somebody: (m: undefined) => string) => string ->somebody : (m: undefined) => string -+>sayHello3 : (somebody: any) => string -+>somebody : any ++>sayHello3 : (somebody: (m: Undefined) => string) => string ++>somebody : (m: Undefined) => string return 'Hello ' + somebody; >'Hello ' + somebody : string >'Hello ' : "Hello " ->somebody : (m: undefined) => string -+>somebody : any ++>somebody : (m: Undefined) => string } @@ -57,14 +57,14 @@ function sayHello4(somebody) { ->sayHello4 : (somebody: (m: Function) => string) => string ->somebody : (m: Function) => string -+>sayHello4 : (somebody: any) => string -+>somebody : any ++>sayHello4 : (somebody: (m: any) => string) => string ++>somebody : (m: any) => string return 'Hello ' + somebody; >'Hello ' + somebody : string >'Hello ' : "Hello " ->somebody : (m: Function) => string -+>somebody : any ++>somebody : (m: any) => string } @@ -74,14 +74,14 @@ function sayHello5(somebody) { ->sayHello5 : (somebody: (m: string) => string) => string ->somebody : (m: string) => string -+>sayHello5 : (somebody: any) => string -+>somebody : any ++>sayHello5 : (somebody: (m: any) => string) => string ++>somebody : (m: any) => string return 'Hello ' + somebody; >'Hello ' + somebody : string >'Hello ' : "Hello " ->somebody : (m: string) => string -+>somebody : any ++>somebody : (m: any) => string } @@ -91,40 +91,23 @@ function sayHello6(somebody) { ->sayHello6 : (somebody: (m: number) => string) => string ->somebody : (m: number) => string -+>sayHello6 : (somebody: any) => string -+>somebody : any ++>sayHello6 : (somebody: (m: any) => string) => string ++>somebody : (m: any) => string return 'Hello ' + somebody; >'Hello ' + somebody : string >'Hello ' : "Hello " ->somebody : (m: number) => string -+>somebody : any ++>somebody : (m: any) => string } -@@= skipped -15, +15 lines =@@ - * @param {(m: Object) => string} somebody - */ - function sayHello7(somebody) { -->sayHello7 : (somebody: (m: any) => string) => string -->somebody : (m: any) => string -+>sayHello7 : (somebody: any) => string -+>somebody : any - - return 'Hello ' + somebody; - >'Hello ' + somebody : string - >'Hello ' : "Hello " -->somebody : (m: any) => string -+>somebody : any - } - - === index8.js === -@@= skipped -17, +17 lines =@@ +@@= skipped -32, +32 lines =@@ * @param {fn} somebody */ function sayHello8(somebody) { } ->sayHello8 : (somebody: () => void) => void ->somebody : () => void -+>sayHello8 : (somebody: any) => void -+>somebody : any ++>sayHello8 : (somebody: fn) => void ++>somebody : fn diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefBeforeParenthesizedExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefBeforeParenthesizedExpression.types.diff index 4f663acef0..140057ceff 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefBeforeParenthesizedExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefBeforeParenthesizedExpression.types.diff @@ -1,13 +1,18 @@ --- old.jsdocTypedefBeforeParenthesizedExpression.types +++ new.jsdocTypedefBeforeParenthesizedExpression.types -@@= skipped -26, +26 lines =@@ - * @param b {AlsoNotADuplicate} - */ - function makeSureTypedefsAreStillRecognized(a, b) {} -->makeSureTypedefsAreStillRecognized : (a: number, b: number) => void -->a : number -->b : number -+>makeSureTypedefsAreStillRecognized : (a: any, b: any) => void -+>a : any -+>b : any +@@= skipped -2, +2 lines =@@ + === test.js === + // @ts-check + /** @typedef {number} NotADuplicateIdentifier */ ++>NotADuplicateIdentifier : any + (2 * 2); + >(2 * 2) : number +@@= skipped -8, +9 lines =@@ + >2 : 2 + + /** @typedef {number} AlsoNotADuplicate */ ++>AlsoNotADuplicate : any + + (2 * 2) + 1; + >(2 * 2) + 1 : number diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefMissingType.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefMissingType.types.diff index f6c9a86a0f..d3ad238a8d 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefMissingType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefMissingType.types.diff @@ -1,11 +1,14 @@ --- old.jsdocTypedefMissingType.types +++ new.jsdocTypedefMissingType.types -@@= skipped -15, +15 lines =@@ +@@= skipped -10, +10 lines =@@ + // OK: missing a type, but have property tags. + /** + * @typedef Person ++>Person : any ++ + * @property {string} name ++>name : any ++ + */ /** @type Person */ - const person = { name: "" }; -->person : Person -+>person : { name: string; } - >{ name: "" } : { name: string; } - >name : string - >"" : "" diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash.types.diff new file mode 100644 index 0000000000..e61379de61 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash.types.diff @@ -0,0 +1,11 @@ +--- old.jsdocTypedefNoCrash.types ++++ new.jsdocTypedefNoCrash.types +@@= skipped -4, +4 lines =@@ + * @typedef {{ + * }} + */ ++> : any ++ + export const foo = 5; + >foo : 5 + >5 : 5 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash2.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash2.types.diff new file mode 100644 index 0000000000..0ea5bb7fc4 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash2.types.diff @@ -0,0 +1,11 @@ +--- old.jsdocTypedefNoCrash2.types ++++ new.jsdocTypedefNoCrash2.types +@@= skipped -7, +7 lines =@@ + * @typedef {{ + * }} + */ ++> : any ++ + export const foo = 5; + >foo : 5 + >5 : 5 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedef_propertyWithNoType.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedef_propertyWithNoType.types.diff index 7cf27629a6..f59dc72588 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedef_propertyWithNoType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedef_propertyWithNoType.types.diff @@ -1,11 +1,14 @@ --- old.jsdocTypedef_propertyWithNoType.types +++ new.jsdocTypedef_propertyWithNoType.types -@@= skipped -7, +7 lines =@@ +@@= skipped -2, +2 lines =@@ + === /a.js === + /** + * @typedef Foo ++>Foo : any ++ + * @property foo ++>foo : any ++ + */ /** @type {Foo} */ - const x = { foo: 0 }; -->x : Foo -+>x : { foo: number; } - >{ foo: 0 } : { foo: number; } - >foo : number - >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/misspelledJsDocTypedefTags.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/misspelledJsDocTypedefTags.errors.txt.diff index ce597f7f1a..5a963d9941 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/misspelledJsDocTypedefTags.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/misspelledJsDocTypedefTags.errors.txt.diff @@ -4,16 +4,19 @@ - @@= skipped --1, +1 lines =@@ +a.js(2,11): error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. ++a.js(4,48): error TS2304: Cannot find name 'B'. +a.js(5,11): error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. + + -+==== a.js (2 errors) ==== ++==== a.js (3 errors) ==== + /** @typedef {{ endTime: number, screenshots: number}} A.*/ + Animation.AnimationModel.ScreenshotCapture.Request; + ~~~~~~~~~~~~~~ +!!! error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. + + /** @typedef {{ endTime: number, screenshots: !B.}} */ ++ ~ ++!!! error TS2304: Cannot find name 'B'. + Animation.AnimationModel.ScreenshotCapture.Request; + ~~~~~~~~~~~~~~ +!!! error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/misspelledJsDocTypedefTags.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/misspelledJsDocTypedefTags.types.diff index c2b65753b5..a187c3f88a 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/misspelledJsDocTypedefTags.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/misspelledJsDocTypedefTags.types.diff @@ -1,8 +1,13 @@ --- old.misspelledJsDocTypedefTags.types +++ new.misspelledJsDocTypedefTags.types -@@= skipped -2, +2 lines =@@ +@@= skipped -1, +1 lines =@@ + === a.js === /** @typedef {{ endTime: number, screenshots: number}} A.*/ ++>A : any ++>endTime : number ++>screenshots : number ++ Animation.AnimationModel.ScreenshotCapture.Request; ->Animation.AnimationModel.ScreenshotCapture.Request : error +>Animation.AnimationModel.ScreenshotCapture.Request : any @@ -15,6 +20,10 @@ >Request : any /** @typedef {{ endTime: number, screenshots: !B.}} */ ++> : any ++>endTime : number ++>screenshots : B ++ Animation.AnimationModel.ScreenshotCapture.Request; ->Animation.AnimationModel.ScreenshotCapture.Request : error +>Animation.AnimationModel.ScreenshotCapture.Request : any diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff deleted file mode 100644 index 80bc30a895..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastAtReturnStatement.errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.parenthesizedJSDocCastAtReturnStatement.errors.txt -+++ new.parenthesizedJSDocCastAtReturnStatement.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+index.js(8,26): error TS7006: Parameter 'key' implicitly has an 'any' type. -+ -+ -+==== index.js (1 errors) ==== -+ /** @type {Map>} */ -+ const cache = new Map() -+ -+ /** -+ * @param {string} key -+ * @returns {() => string} -+ */ -+ const getStringGetter = (key) => { -+ ~~~ -+!!! error TS7006: Parameter 'key' implicitly has an 'any' type. -+ return () => { -+ return /** @type {string} */ (cache.get(key)) -+ } -+ } -+ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastAtReturnStatement.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastAtReturnStatement.types.diff index 3cbf43a46a..eb228433cf 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastAtReturnStatement.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastAtReturnStatement.types.diff @@ -1,42 +1,10 @@ --- old.parenthesizedJSDocCastAtReturnStatement.types +++ new.parenthesizedJSDocCastAtReturnStatement.types -@@= skipped -2, +2 lines =@@ - === index.js === - /** @type {Map>} */ - const cache = new Map() -->cache : Map> -+>cache : Map - >new Map() : Map - >Map : MapConstructor - -@@= skipped -9, +9 lines =@@ - * @returns {() => string} - */ - const getStringGetter = (key) => { -->getStringGetter : (key: string) => () => string -->(key) => { return () => { return /** @type {string} */ (cache.get(key)) }} : (key: string) => () => string -->key : string -+>getStringGetter : (key: any) => () => any -+>(key) => { return () => { return /** @type {string} */ (cache.get(key)) }} : (key: any) => () => any -+>key : any - - return () => { -->() => { return /** @type {string} */ (cache.get(key)) } : () => string -+>() => { return /** @type {string} */ (cache.get(key)) } : () => any +@@= skipped -20, +20 lines =@@ return /** @type {string} */ (cache.get(key)) -->(cache.get(key)) : string -->cache.get(key) : string | Set | undefined -->cache.get : (key: string) => string | Set | undefined -->cache : Map> -->get : (key: string) => string | Set | undefined -->key : string -+>(cache.get(key)) : any -+>cache.get(key) : any -+>cache.get : (key: any) => any -+>cache : Map -+>get : (key: any) => any -+>key : any - } - } - + >(cache.get(key)) : string ++>cache.get(key) : string + >cache.get(key) : string | Set | undefined + >cache.get : (key: string) => string | Set | undefined + >cache : Map> diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastDoesNotNarrow.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastDoesNotNarrow.errors.txt.diff index b4095179ca..057946327b 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastDoesNotNarrow.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastDoesNotNarrow.errors.txt.diff @@ -1,27 +1,17 @@ --- old.parenthesizedJSDocCastDoesNotNarrow.errors.txt +++ new.parenthesizedJSDocCastDoesNotNarrow.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -index.js(12,8): error TS2678: Type '"invalid"' is not comparable to type '"foo" | "bar"'. -- -- --==== index.js (1 errors) ==== -- let value = ""; -- -- switch (/** @type {"foo" | "bar"} */ (value)) { -- case "bar": -- value; -- break; -- -- case "foo": -- value; -- break; -- -- case "invalid": -- ~~~~~~~~~ ++index.js(12,8): error TS2678: Type '"invalid"' is not comparable to type '"bar" | "foo"'. + + + ==== index.js (1 errors) ==== +@@= skipped -14, +14 lines =@@ + + case "invalid": + ~~~~~~~~~ -!!! error TS2678: Type '"invalid"' is not comparable to type '"foo" | "bar"'. -- value; -- break; -- } -- -@@= skipped --1, +1 lines =@@ -+ ++!!! error TS2678: Type '"invalid"' is not comparable to type '"bar" | "foo"'. + value; + break; + } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastDoesNotNarrow.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastDoesNotNarrow.types.diff index 243d90d6dd..e3c9ee9151 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastDoesNotNarrow.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/parenthesizedJSDocCastDoesNotNarrow.types.diff @@ -5,33 +5,8 @@ switch (/** @type {"foo" | "bar"} */ (value)) { ->(value) : "foo" | "bar" -+>(value) : string ++>(value) : "bar" | "foo" ++>value : "bar" | "foo" >value : string case "bar": - >"bar" : "bar" - - value; -->value : string -+>value : "bar" - - break; - -@@= skipped -15, +15 lines =@@ - >"foo" : "foo" - - value; -->value : string -+>value : "foo" - - break; - -@@= skipped -8, +8 lines =@@ - >"invalid" : "invalid" - - value; -->value : string -+>value : "invalid" - - break; - } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.types.diff index aefdcc4231..1b6fd0596b 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.types.diff @@ -19,20 +19,14 @@ /** @type {{ b: number }} */ const json1 = require("./json.json"); // No error (bad) -->json1 : { b: number; } + >json1 : { b: number; } ->require("./json.json") : { a: number; } -+>json1 : any +>require("./json.json") : any >require : any >"./json.json" : "./json.json" - json1.b; // No error (OK since that's the type annotation) -->json1.b : number -->json1 : { b: number; } -->b : number -+>json1.b : any -+>json1 : any -+>b : any +@@= skipped -23, +23 lines =@@ + >b : number const js0 = require("./js.js"); ->js0 : { a: number; } @@ -50,24 +44,13 @@ /** @type {{ b: number }} */ const js1 = require("./js.js"); // Error (good) -->js1 : { b: number; } + >js1 : { b: number; } ->require("./js.js") : { a: number; } -+>js1 : any +>require("./js.js") : any >require : any >"./js.js" : "./js.js" - js1.b; -->js1.b : number -->js1 : { b: number; } -->b : number -+>js1.b : any -+>js1 : any -+>b : any - - === /json.json === - { "a": 0 } -@@= skipped -51, +51 lines =@@ +@@= skipped -28, +28 lines =@@ >"a" : number >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.errors.txt.diff index 0732681a52..df1ecaaac6 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.errors.txt.diff @@ -1,37 +1,37 @@ --- old.strictOptionalProperties3.errors.txt +++ new.strictOptionalProperties3.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -a.js(7,7): error TS2375: Type '{ value: undefined; }' is not assignable to type 'A' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. -- Types of property 'value' are incompatible. -- Type 'undefined' is not assignable to type 'number'. ++a.js(14,7): error TS2375: Type '{ value: undefined; }' is not assignable to type '{ value?: number; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. + Types of property 'value' are incompatible. + Type 'undefined' is not assignable to type 'number'. -a.js(14,7): error TS2375: Type '{ value: undefined; }' is not assignable to type 'B' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. - Types of property 'value' are incompatible. - Type 'undefined' is not assignable to type 'number'. -- -- + + -==== a.js (2 errors) ==== -- /** -- * @typedef {object} A -- * @property {number} [value] -- */ -- -- /** @type {A} */ -- const a = { value: undefined }; // error ++==== a.js (1 errors) ==== + /** + * @typedef {object} A + * @property {number} [value] +@@= skipped -13, +10 lines =@@ + + /** @type {A} */ + const a = { value: undefined }; // error - ~ -!!! error TS2375: Type '{ value: undefined; }' is not assignable to type 'A' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. -!!! error TS2375: Types of property 'value' are incompatible. -!!! error TS2375: Type 'undefined' is not assignable to type 'number'. -- -- /** -- * @typedef {{ value?: number }} B -- */ -- -- /** @type {B} */ -- const b = { value: undefined }; // error -- ~ + + /** + * @typedef {{ value?: number }} B +@@= skipped -12, +8 lines =@@ + /** @type {B} */ + const b = { value: undefined }; // error + ~ -!!! error TS2375: Type '{ value: undefined; }' is not assignable to type 'B' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. --!!! error TS2375: Types of property 'value' are incompatible. --!!! error TS2375: Type 'undefined' is not assignable to type 'number'. -- -@@= skipped --1, +1 lines =@@ -+ ++!!! error TS2375: Type '{ value: undefined; }' is not assignable to type '{ value?: number; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. + !!! error TS2375: Types of property 'value' are incompatible. + !!! error TS2375: Type 'undefined' is not assignable to type 'number'. + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.types.diff index 5194029ac3..8db95e955b 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.types.diff @@ -1,20 +1,30 @@ --- old.strictOptionalProperties3.types +++ new.strictOptionalProperties3.types -@@= skipped -7, +7 lines =@@ +@@= skipped -2, +2 lines =@@ + === a.js === + /** + * @typedef {object} A ++>A : any ++ + * @property {number} [value] ++>value : any ++ + */ /** @type {A} */ - const a = { value: undefined }; // error -->a : A -+>a : { value: undefined; } - >{ value: undefined } : { value: undefined; } - >value : undefined - >undefined : undefined -@@= skipped -11, +11 lines =@@ +@@= skipped -12, +16 lines =@@ + + /** + * @typedef {{ value?: number }} B ++>B : any ++>value : number | undefined ++ + */ /** @type {B} */ const b = { value: undefined }; // error ->b : B -+>b : { value: undefined; } ++>b : { value?: number; } >{ value: undefined } : { value: undefined; } >value : undefined >undefined : undefined diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.errors.txt.diff deleted file mode 100644 index e1a04c729e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.strictOptionalProperties4.errors.txt -+++ new.strictOptionalProperties4.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+a.js(7,3): error TS2339: Property 'foo' does not exist on type '{}'. -+a.js(10,3): error TS2339: Property 'foo' does not exist on type '{}'. -+ -+ -+==== a.js (2 errors) ==== -+ /** -+ * @typedef Foo -+ * @property {number} [foo] -+ */ -+ -+ const x = /** @type {Foo} */ ({}); -+ x.foo; // number | undefined -+ ~~~ -+!!! error TS2339: Property 'foo' does not exist on type '{}'. -+ -+ const y = /** @type {Required} */ ({}); -+ y.foo; // number -+ ~~~ -+!!! error TS2339: Property 'foo' does not exist on type '{}'. -+ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.types.diff index 5104f3894a..0a97dd1c78 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.types.diff @@ -1,35 +1,39 @@ --- old.strictOptionalProperties4.types +++ new.strictOptionalProperties4.types -@@= skipped -6, +6 lines =@@ +@@= skipped -2, +2 lines =@@ + === a.js === + /** + * @typedef Foo ++>Foo : any ++ + * @property {number} [foo] ++>foo : any ++ */ const x = /** @type {Foo} */ ({}); -->x : Foo -->({}) : Foo -+>x : {} -+>({}) : {} + >x : Foo + >({}) : Foo ++>{} : Foo >{} : {} x.foo; // number | undefined ->x.foo : number | undefined -->x : Foo -->foo : number | undefined +>x.foo : any -+>x : {} + >x : Foo +->foo : number | undefined +>foo : any const y = /** @type {Required} */ ({}); -->y : Required -->({}) : Required -+>y : {} -+>({}) : {} + >y : Required + >({}) : Required ++>{} : Required >{} : {} y.foo; // number ->y.foo : number -->y : Required -->foo : number +>y.foo : any -+>y : {} + >y : Required +->foo : number +>foo : any diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/subclassThisTypeAssignable01.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/subclassThisTypeAssignable01.errors.txt.diff deleted file mode 100644 index 13748f7453..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/subclassThisTypeAssignable01.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.subclassThisTypeAssignable01.errors.txt -+++ new.subclassThisTypeAssignable01.errors.txt -@@= skipped -0, +0 lines =@@ --file1.js(2,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent'. -- Index signature for type 'number' is missing in type 'C'. - tile1.ts(2,30): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. - tile1.ts(6,81): error TS2744: Type parameter defaults can only reference previously declared type parameters. - tile1.ts(11,40): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. -@@= skipped -57, +55 lines =@@ - ~~~~~ - !!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'. - !!! error TS2322: Index signature for type 'number' is missing in type 'C'. --==== file1.js (1 errors) ==== -+==== file1.js (0 errors) ==== - /** @type {ClassComponent} */ - const test9 = new C(); -- ~~~~~ --!!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'. --!!! error TS2322: Index signature for type 'number' is missing in type 'C'. - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/subclassThisTypeAssignable01.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/subclassThisTypeAssignable01.types.diff index 2e04bf823c..f556f4f0fc 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/subclassThisTypeAssignable01.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/subclassThisTypeAssignable01.types.diff @@ -18,12 +18,3 @@ >v : Vnode> >0 : 0 } -@@= skipped -13, +13 lines =@@ - === file1.js === - /** @type {ClassComponent} */ - const test9 = new C(); -->test9 : ClassComponent -+>test9 : C - >new C() : C - >C : typeof C - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/subclassThisTypeAssignable02.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/subclassThisTypeAssignable02.types.diff index 50dd8c9372..3a6524ed50 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/subclassThisTypeAssignable02.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/subclassThisTypeAssignable02.types.diff @@ -26,12 +26,3 @@ >vnode : Vnode view(vnode: Vnode): number; -@@= skipped -40, +40 lines =@@ - === file1.js === - /** @type {ClassComponent} */ - const test9 = new C(); -->test9 : ClassComponent -+>test9 : C - >new C() : C - >C : typeof C - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/topLevelBlockExpando.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/topLevelBlockExpando.types.diff index 8800f1150b..146dfb8992 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/topLevelBlockExpando.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/topLevelBlockExpando.types.diff @@ -1,22 +1,17 @@ --- old.topLevelBlockExpando.types +++ new.topLevelBlockExpando.types -@@= skipped -55, +55 lines =@@ - * @param {Human} param used as a validation tool +@@= skipped -47, +47 lines =@@ + // Creates a type { first:string, last: string } + /** + * @typedef {Object} Human - creates a new type named 'SpecialType' ++>Human : Human ++ + * @property {string} first - a string property of SpecialType ++>first : any ++ + * @property {string} last - a number property of SpecialType ++>last : any ++ */ - function doHumanThings(param) {} -->doHumanThings : (param: Human) => void -->param : Human -+>doHumanThings : (param: any) => void -+>param : any - - const dice1 = () => Math.floor(Math.random() * 6); - >dice1 : { (): number; last: string; } -@@= skipped -59, +59 lines =@@ - - doHumanThings(dice2) - >doHumanThings(dice2) : void -->doHumanThings : (param: Human) => void -+>doHumanThings : (param: any) => void - >dice2 : { (): number; first: string; last: string; } - } + /** diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/unicodeEscapesInJSDoc.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/unicodeEscapesInJSDoc.types.diff deleted file mode 100644 index 76f5c6aa92..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/unicodeEscapesInJSDoc.types.diff +++ /dev/null @@ -1,51 +0,0 @@ ---- old.unicodeEscapesInJSDoc.types -+++ new.unicodeEscapesInJSDoc.types -@@= skipped -5, +5 lines =@@ - * @param {number} a\u0061 - */ - function foo(a, aa) { -->foo : (a: number, aa: number) => void -->a : number -->aa : number -+>foo : (a: any, aa: any) => void -+>a : any -+>aa : any - - console.log(a + aa); - >console.log(a + aa) : void - >console.log : (...data: any[]) => void - >console : Console - >log : (...data: any[]) => void -->a + aa : number -->a : number -->aa : number -+>a + aa : any -+>a : any -+>aa : any - } - - /** -@@= skipped -19, +19 lines =@@ - * @param {number} a\u{0061} - */ - function bar(a, aa) { -->bar : (a: number, aa: number) => void -->a : number -->aa : number -+>bar : (a: any, aa: any) => void -+>a : any -+>aa : any - - console.log(a + aa); - >console.log(a + aa) : void - >console.log : (...data: any[]) => void - >console : Console - >log : (...data: any[]) => void -->a + aa : number -->a : number -->aa : number -+>a + aa : any -+>a : any -+>aa : any - } - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt.diff index 84f28addd1..41957c2ca1 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.errors.txt.diff @@ -1,25 +1,28 @@ --- old.unmetTypeConstraintInJSDocImportCall.errors.txt +++ new.unmetTypeConstraintInJSDocImportCall.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -file2.js(3,36): error TS2344: Type 'T' does not satisfy the constraint 'string'. -- -- ++file1.js(3,21): error TS2304: Cannot find name 'T'. + + -==== file1.js (0 errors) ==== -- /** -- * @template {string} T -- * @typedef {{ foo: T }} Foo -- */ -- -- export default {}; -- ++==== file1.js (1 errors) ==== + /** + * @template {string} T + * @typedef {{ foo: T }} Foo ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + + export default {}; + -==== file2.js (1 errors) ==== -- /** -- * @template T -- * @typedef {import('./file1').Foo} Bar ++==== file2.js (0 errors) ==== + /** + * @template T + * @typedef {import('./file1').Foo} Bar - ~ -!!! error TS2344: Type 'T' does not satisfy the constraint 'string'. -!!! related TS2208 file2.js:2:14: This type parameter might need an `extends string` constraint. -- */ -- -@@= skipped --1, +1 lines =@@ -+ + */ + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.types.diff new file mode 100644 index 0000000000..7efbcfb7cf --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.types.diff @@ -0,0 +1,12 @@ +--- old.unmetTypeConstraintInJSDocImportCall.types ++++ new.unmetTypeConstraintInJSDocImportCall.types +@@= skipped -3, +3 lines =@@ + /** + * @template {string} T + * @typedef {{ foo: T }} Foo ++>Foo : any ++>foo : T ++ + */ + + export default {}; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag.errors.txt.diff index 27ab577471..3f50c11b6e 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag.errors.txt.diff @@ -1,14 +1,15 @@ --- old.unusedTypeParameters_templateTag.errors.txt +++ new.unusedTypeParameters_templateTag.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(1,5): error TS6133: 'T' is declared but its value is never read. -- -- --==== /a.js (1 errors) ==== -- /** @template T */ ++/a.js(2,1): error TS6196: 'T' is declared but never used. + + + ==== /a.js (1 errors) ==== + /** @template T */ - ~~~~~~~~~~~~ -!!! error TS6133: 'T' is declared but its value is never read. -- function f() {} -- -@@= skipped --1, +1 lines =@@ -+ + function f() {} ++ ~~~~~~~~~~~~~~~ ++!!! error TS6196: 'T' is declared but never used. + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag.types.diff deleted file mode 100644 index 2206bfccf9..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag.types.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.unusedTypeParameters_templateTag.types -+++ new.unusedTypeParameters_templateTag.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** @template T */ - function f() {} -->f : () => void -+>f : () => void - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag2.errors.txt.diff index 7b94e6883d..41fbdf9f5e 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag2.errors.txt.diff @@ -5,50 +5,94 @@ -/a.js(13,4): error TS6205: All type parameters are unused. -/a.js(20,16): error TS6133: 'V' is declared but its value is never read. -/a.js(20,18): error TS6133: 'X' is declared but its value is never read. -+/a.js(8,14): error TS2339: Property 'p' does not exist on type 'C1'. -+/a.js(25,14): error TS2339: Property 'p' does not exist on type 'C3'. ++/a.js(1,1): error TS6205: All type parameters are unused. ++/a.js(8,14): error TS2339: Property 'p' does not exist on type 'C1'. ++/a.js(10,1): error TS6205: All type parameters are unused. ++/a.js(17,1): error TS6205: All type parameters are unused. ++/a.js(25,14): error TS2339: Property 'p' does not exist on type 'C3'. -==== /a.js (4 errors) ==== -+==== /a.js (2 errors) ==== ++==== /a.js (5 errors) ==== /** ++ ~~~ * @template T ++ ~~~~~~~~~~~~~~ * @template V - ~~~~~~~~~~~ ++ ~~~~~~~~~~~~~~ */ - ~ -!!! error TS6133: 'V' is declared but its value is never read. ++ ~~~ class C1 { ++ ~~~~~~~~~~ constructor() { ++ ~~~~~~~~~~~~~~~~~~~ /** @type {T} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~ this.p; ++ ~~~~~~~~~~~~~~~ + ~ -+!!! error TS2339: Property 'p' does not exist on type 'C1'. ++!!! error TS2339: Property 'p' does not exist on type 'C1'. } ++ ~~~~~ } ++ ~ ++ ~ ++ ++ /** ++ ~~~ ++ ~~~ * @template T,V - ~~~~~~~~~~~~~ ++ ~~~~~~~~~~~~~~~~ ++ ~~~~~~~~~~~~~~~~ */ -- ~ --!!! error TS6205: All type parameters are unused. - class C2 { ++ ~~~ ++ ~~~ ++ class C2 { + ~ + !!! error TS6205: All type parameters are unused. +- class C2 { ++ ~~~~~~~~~~ constructor() { } ++ ~~~~~~~~~~~~~~~~~~~~~ } ++ ~ ++ ~ ++ ++ /** ++ ~~~ ++ ~~~ * @template T,V,X - ~ -!!! error TS6133: 'V' is declared but its value is never read. - ~ -!!! error TS6133: 'X' is declared but its value is never read. ++ ~~~~~~~~~~~~~~~~~~ ++ ~~~~~~~~~~~~~~~~~~ */ ++ ~~~ ++ ~~~ class C3 { ++ ~ ++!!! error TS6205: All type parameters are unused. ++ ~~~~~~~~~~ constructor() { ++ ~~~~~~~~~~~~~~~~~~~ /** @type {T} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~ this.p; ++ ~~~~~~~~~~~~~~~ + ~ -+!!! error TS2339: Property 'p' does not exist on type 'C3'. ++!!! error TS2339: Property 'p' does not exist on type 'C3'. } ++ ~~~~~ } ++ ~ ++!!! error TS6205: All type parameters are unused. diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag2.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag2.types.diff index a847a4dbe7..ced5bb2cc0 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag2.types.diff @@ -1,12 +1,6 @@ --- old.unusedTypeParameters_templateTag2.types +++ new.unusedTypeParameters_templateTag2.types -@@= skipped -5, +5 lines =@@ - * @template V - */ - class C1 { -->C1 : C1 -+>C1 : C1 - +@@= skipped -10, +10 lines =@@ constructor() { /** @type {T} */ this.p; @@ -18,22 +12,7 @@ } } -@@= skipped -15, +15 lines =@@ - * @template T,V - */ - class C2 { -->C2 : C2 -+>C2 : C2 - - constructor() { } - } -@@= skipped -9, +9 lines =@@ - * @template T,V,X - */ - class C3 { -->C3 : C3 -+>C3 : C3 - +@@= skipped -24, +24 lines =@@ constructor() { /** @type {T} */ this.p; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/annotatedThisPropertyInitializerDoesntNarrow.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/annotatedThisPropertyInitializerDoesntNarrow.types.diff index 32ff0c5404..f997643453 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/annotatedThisPropertyInitializerDoesntNarrow.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/annotatedThisPropertyInitializerDoesntNarrow.types.diff @@ -1,17 +1,6 @@ --- old.annotatedThisPropertyInitializerDoesntNarrow.types +++ new.annotatedThisPropertyInitializerDoesntNarrow.types -@@= skipped -3, +3 lines =@@ - // from webpack/lib/Compilation.js and filed at #26427 - /** @param {{ [s: string]: number }} map */ - function mappy(map) {} -->mappy : (map: { [s: string]: number; }) => void -->map : { [s: string]: number; } -+>mappy : (map: any) => void -+>map : any - - export class C { - >C : C -@@= skipped -10, +10 lines =@@ +@@= skipped -13, +13 lines =@@ /** @type {{ [assetName: string]: number}} */ this.assets = {}; >this.assets = {} : {} @@ -23,13 +12,11 @@ >{} : {} } m() { -@@= skipped -10, +10 lines =@@ - +@@= skipped -11, +11 lines =@@ mappy(this.assets) >mappy(this.assets) : void -->mappy : (map: { [s: string]: number; }) => void + >mappy : (map: { [s: string]: number; }) => void ->this.assets : { [assetName: string]: number; } -+>mappy : (map: any) => void +>this.assets : any >this : this ->assets : { [assetName: string]: number; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.errors.txt.diff new file mode 100644 index 0000000000..0f1e2740c5 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.errors.txt.diff @@ -0,0 +1,38 @@ +--- old.assertionTypePredicates2.errors.txt ++++ new.assertionTypePredicates2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++assertionTypePredicates2.js(21,5): error TS2775: Assertions require every name in the call target to be declared with an explicit type annotation. ++assertionTypePredicates2.js(21,5): error TS2775: Assertions require every name in the call target to be declared with an explicit type annotation. ++ ++ ++==== assertionTypePredicates2.js (2 errors) ==== ++ /** ++ * @typedef {{ x: number }} A ++ */ ++ ++ /** ++ * @typedef { A & { y: number } } B ++ */ ++ ++ /** ++ * @param {A} a ++ * @returns { asserts a is B } ++ */ ++ const foo = (a) => { ++ if (/** @type { B } */ (a).y !== 0) throw TypeError(); ++ return undefined; ++ }; ++ ++ export const main = () => { ++ /** @type { A } */ ++ const a = { x: 1 }; ++ foo(a); ++ ~~~ ++!!! error TS2775: Assertions require every name in the call target to be declared with an explicit type annotation. ++!!! related TS2782 assertionTypePredicates2.js:13:7: 'foo' needs an explicit type annotation. ++ ~~~ ++!!! error TS2775: Assertions require every name in the call target to be declared with an explicit type annotation. ++ }; ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff index 2f0efd3ae9..8b1768b31d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff @@ -1,30 +1,45 @@ --- old.assertionTypePredicates2.types +++ new.assertionTypePredicates2.types -@@= skipped -13, +13 lines =@@ +@@= skipped -2, +2 lines =@@ + === assertionTypePredicates2.js === + /** + * @typedef {{ x: number }} A ++>A : any ++>x : number ++ + */ + + /** + * @typedef { A & { y: number } } B ++>B : any ++>y : number ++ + */ + + /** +@@= skipped -11, +17 lines =@@ * @returns { asserts a is B } */ const foo = (a) => { ->foo : (a: A) => asserts a is B ->(a) => { if (/** @type { B } */ (a).y !== 0) throw TypeError(); return undefined;} : (a: A) => asserts a is B ->a : A -+>foo : (a: any) => any -+>(a) => { if (/** @type { B } */ (a).y !== 0) throw TypeError(); return undefined;} : (a: any) => any -+>a : any ++>foo : (a: { x: number; }) => asserts a is { x: number; } & { y: number; } ++>(a) => { if (/** @type { B } */ (a).y !== 0) throw TypeError(); return undefined;} : (a: { x: number; }) => asserts a is { x: number; } & { y: number; } ++>a : { x: number; } if (/** @type { B } */ (a).y !== 0) throw TypeError(); >(a).y !== 0 : boolean -->(a).y : number + >(a).y : number ->(a) : B ->a : A -->y : number -+>(a).y : any -+>(a) : any -+>a : any -+>y : any ++>(a) : { x: number; } & { y: number; } ++>a : { x: number; } & { y: number; } ++>a : { x: number; } + >y : number >0 : 0 >TypeError() : TypeError - >TypeError : TypeErrorConstructor -@@= skipped -25, +25 lines =@@ +@@= skipped -25, +26 lines =@@ /** @type { A } */ const a = { x: 1 }; @@ -35,11 +50,10 @@ >1 : 1 foo(a); -->foo(a) : void + >foo(a) : void ->foo : (a: A) => asserts a is B ->a : A -+>foo(a) : any -+>foo : (a: any) => any ++>foo : (a: { x: number; }) => asserts a is { x: number; } & { y: number; } +>a : { x: number; } }; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.errors.txt.diff deleted file mode 100644 index 991af43a91..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.assertionsAndNonReturningFunctions.errors.txt -+++ new.assertionsAndNonReturningFunctions.errors.txt -@@= skipped -0, +-1 lines =@@ --assertionsAndNonReturningFunctions.js(46,9): error TS7027: Unreachable code detected. --assertionsAndNonReturningFunctions.js(58,5): error TS7027: Unreachable code detected. -- -- --==== assertionsAndNonReturningFunctions.js (2 errors) ==== -- /** @typedef {(check: boolean) => asserts check} AssertFunc */ -- -- /** @type {AssertFunc} */ -- const assert = check => { -- if (!check) throw new Error(); -- } -- -- /** @type {(x: unknown) => asserts x is string } */ -- function assertIsString(x) { -- if (!(typeof x === "string")) throw new Error(); -- } -- -- /** -- * @param {boolean} check -- * @returns {asserts check} -- */ -- function assert2(check) { -- if (!check) throw new Error(); -- } -- -- /** -- * @returns {never} -- */ -- function fail() { -- throw new Error(); -- } -- -- /** -- * @param {*} x -- */ -- function f1(x) { -- if (!!true) { -- assert(typeof x === "string"); -- x.length; -- } -- if (!!true) { -- assert2(typeof x === "string"); -- x.length; -- } -- if (!!true) { -- assertIsString(x); -- x.length; -- } -- if (!!true) { -- fail(); -- x; // Unreachable -- ~~ --!!! error TS7027: Unreachable code detected. -- } -- } -- -- /** -- * @param {boolean} b -- */ -- function f2(b) { -- switch (b) { -- case true: return 1; -- case false: return 0; -- } -- b; // Unreachable -- ~~ --!!! error TS7027: Unreachable code detected. -- } -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.types.diff index 7b98e73ecd..52508822d4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.types.diff @@ -1,23 +1,22 @@ --- old.assertionsAndNonReturningFunctions.types +++ new.assertionsAndNonReturningFunctions.types -@@= skipped -4, +4 lines =@@ +@@= skipped -1, +1 lines =@@ + + === assertionsAndNonReturningFunctions.js === + /** @typedef {(check: boolean) => asserts check} AssertFunc */ ++>AssertFunc : any ++>check : boolean /** @type {AssertFunc} */ const assert = check => { ->assert : AssertFunc ->check => { if (!check) throw new Error();} : (check: boolean) => asserts check -->check : boolean -+>assert : (check: any) => void -+>check => { if (!check) throw new Error();} : (check: any) => void -+>check : any ++>assert : (check: boolean) => asserts check ++>check => { if (!check) throw new Error();} : (check: boolean) => void + >check : boolean if (!check) throw new Error(); - >!check : boolean -->check : boolean -+>check : any - >new Error() : Error - >Error : ErrorConstructor - } +@@= skipped -16, +18 lines =@@ /** @type {(x: unknown) => asserts x is string } */ function assertIsString(x) { @@ -37,76 +36,28 @@ >"string" : "string" >new Error() : Error >Error : ErrorConstructor -@@= skipped -32, +32 lines =@@ - * @returns {asserts check} - */ - function assert2(check) { -->assert2 : (check: boolean) => asserts check -->check : boolean -+>assert2 : (check: any) => void -+>check : any - - if (!check) throw new Error(); - >!check : boolean -->check : boolean -+>check : any - >new Error() : Error - >Error : ErrorConstructor - } -@@= skipped -14, +14 lines =@@ - * @returns {never} - */ - function fail() { -->fail : () => never -+>fail : () => void - - throw new Error(); - >new Error() : Error -@@= skipped -21, +21 lines =@@ +@@= skipped -54, +54 lines =@@ assert(typeof x === "string"); >assert(typeof x === "string") : void ->assert : AssertFunc -+>assert : (check: any) => void ++>assert : (check: boolean) => asserts check >typeof x === "string" : boolean ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" >x : any >"string" : "string" - x.length; -->x.length : number -->x : string -->length : number -+>x.length : any -+>x : any -+>length : any - } - if (!!true) { - >!!true : boolean -@@= skipped -18, +18 lines =@@ - - assert2(typeof x === "string"); +@@= skipped -20, +20 lines =@@ >assert2(typeof x === "string") : void -->assert2 : (check: boolean) => asserts check -+>assert2 : (check: any) => void + >assert2 : (check: boolean) => asserts check >typeof x === "string" : boolean ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" >x : any >"string" : "string" - x.length; -->x.length : number -->x : string -->length : number -+>x.length : any -+>x : any -+>length : any - } - if (!!true) { - >!!true : boolean -@@= skipped -18, +18 lines =@@ +@@= skipped -16, +16 lines =@@ assertIsString(x); >assertIsString(x) : void @@ -124,37 +75,12 @@ } if (!!true) { >!!true : boolean -@@= skipped -14, +14 lines =@@ - >true : true - - fail(); -->fail() : never -->fail : () => never -+>fail() : void -+>fail : () => void - - x; // Unreachable - >x : any -@@= skipped -12, +12 lines =@@ +@@= skipped -26, +26 lines =@@ * @param {boolean} b */ function f2(b) { ->f2 : (b: boolean) => 1 | 0 -->b : boolean -+>f2 : (b: any) => 0 | 1 -+>b : any ++>f2 : (b: boolean) => 0 | 1 + >b : boolean switch (b) { -->b : boolean -+>b : any - - case true: return 1; - >true : true -@@= skipped -15, +15 lines =@@ - >0 : 0 - } - b; // Unreachable -->b : never -+>b : any - } - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.errors.txt.diff index ca701d2045..0f2415be05 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.errors.txt.diff @@ -1,6 +1,6 @@ --- old.asyncArrowFunction_allowJs.errors.txt +++ new.asyncArrowFunction_allowJs.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -file.js(3,17): error TS2322: Type 'number' is not assignable to type 'string'. -file.js(6,24): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -file.js(7,23): error TS2322: Type 'number' is not assignable to type 'string'. @@ -9,50 +9,69 @@ -file.js(16,24): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -file.js(25,3): error TS2345: Argument of type '() => Promise' is not assignable to parameter of type '() => string'. - Type 'Promise' is not assignable to type 'string'. -- -- ++file.js(2,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(6,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + -==== file.js (7 errors) ==== -- // Error (good) -- /** @type {function(): string} */ -- const a = () => 0 ++==== file.js (5 errors) ==== + // Error (good) + /** @type {function(): string} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const a = () => 0 - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- -- // Error (good) -- /** @type {function(): string} */ + + // Error (good) + /** @type {function(): string} */ - ~~~~~~ -!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -- const b = async () => 0 ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const b = async () => 0 - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- -- // No error (bad) -- /** @type {function(): string} */ + + // No error (bad) + /** @type {function(): string} */ - ~~~~~~ -!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -- const c = async () => { -- return 0 ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const c = async () => { + return 0 - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- } -- -- // Error (good) -- /** @type {function(): string} */ + } + + // Error (good) + /** @type {function(): string} */ - ~~~~~~ -!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? -- const d = async () => { -- return "" -- } -- -- /** @type {function(function(): string): void} */ -- const f = (p) => {} -- -- // Error (good) -- f(async () => { ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const d = async () => { + return "" + } + + /** @type {function(function(): string): void} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const f = (p) => {} + + // Error (good) + f(async () => { - ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '() => Promise' is not assignable to parameter of type '() => string'. -!!! error TS2345: Type 'Promise' is not assignable to type 'string'. -- return 0 -- }) -@@= skipped --1, +1 lines =@@ -+ + return 0 + }) diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.types.diff index 75f2f0c4c4..76d06c7fd0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.types.diff @@ -6,7 +6,7 @@ const a = () => 0 ->a : () => string ->() => 0 : () => string -+>a : () => number ++>a : function +>() => 0 : () => number >0 : 0 @@ -15,7 +15,7 @@ const b = async () => 0 ->b : () => string ->async () => 0 : () => string -+>b : () => Promise ++>b : function +>async () => 0 : () => Promise >0 : 0 @@ -24,7 +24,7 @@ const c = async () => { ->c : () => string ->async () => { return 0} : () => string -+>c : () => Promise ++>c : function +>async () => { return 0} : () => Promise return 0 @@ -35,7 +35,7 @@ const d = async () => { ->d : () => string ->async () => { return ""} : () => string -+>d : () => Promise ++>d : function +>async () => { return ""} : () => Promise return "" @@ -47,15 +47,16 @@ ->f : (arg0: () => string) => void ->(p) => {} : (p: () => string) => void ->p : () => string -+>f : (p: any) => void ++>f : function +>(p) => {} : (p: any) => void +>p : any // Error (good) f(async () => { - >f(async () => { return 0}) : void +->f(async () => { return 0}) : void ->f : (arg0: () => string) => void -+>f : (p: any) => void ++>f(async () => { return 0}) : any ++>f : function >async () => { return 0} : () => Promise return 0 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/asyncFunctionDeclaration16_es5.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/asyncFunctionDeclaration16_es5.errors.txt.diff index 7b01d94509..febfcff46c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/asyncFunctionDeclaration16_es5.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/asyncFunctionDeclaration16_es5.errors.txt.diff @@ -1,6 +1,6 @@ --- old.asyncFunctionDeclaration16_es5.errors.txt +++ new.asyncFunctionDeclaration16_es5.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(21,14): error TS1055: Type 'string' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -/a.js(27,12): error TS1065: The return type of an async function or method must be the global Promise type. -/a.js(45,12): error TS1065: The return type of an async function or method must be the global Promise type. @@ -8,71 +8,57 @@ - Construct signature return types 'Thenable' and 'PromiseLike' are incompatible. - The types returned by 'then(...)' are incompatible between these types. - Type 'void' is not assignable to type 'PromiseLike'. -- -- --==== /types.d.ts (0 errors) ==== -- declare class Thenable { then(): void; } -- ++/a.js(21,14): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? ++/a.js(27,12): error TS2304: Cannot find name 'T1'. ++/a.js(40,12): error TS2304: Cannot find name 'T2'. ++/a.js(45,12): error TS2304: Cannot find name 'T3'. + + + ==== /types.d.ts (0 errors) ==== + declare class Thenable { then(): void; } + -==== /a.js (3 errors) ==== -- /** -- * @callback T1 -- * @param {string} str -- * @returns {string} -- */ -- -- /** -- * @callback T2 -- * @param {string} str -- * @returns {Promise} -- */ -- -- /** -- * @callback T3 -- * @param {string} str -- * @returns {Thenable} -- */ -- -- /** -- * @param {string} str -- * @returns {string} -- ~~~~~~ ++==== /a.js (4 errors) ==== + /** + * @callback T1 + * @param {string} str +@@= skipped -32, +29 lines =@@ + * @param {string} str + * @returns {string} + ~~~~~~ -!!! error TS1055: Type 'string' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -- */ -- const f1 = async str => { -- return str; -- } -- -- /** @type {T1} */ -- ~~ ++!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + */ + const f1 = async str => { + return str; +@@= skipped -8, +8 lines =@@ + + /** @type {T1} */ + ~~ -!!! error TS1065: The return type of an async function or method must be the global Promise type. -!!! related TS1055 /a.js:4:14: Type 'string' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -- const f2 = async str => { -- return str; -- } -- -- /** -- * @param {string} str -- * @returns {Promise} -- */ -- const f3 = async str => { -- return str; -- } -- -- /** @type {T2} */ -- const f4 = async str => { -- return str; -- } -- -- /** @type {T3} */ -- ~~ ++!!! error TS2304: Cannot find name 'T1'. + const f2 = async str => { + return str; + } +@@= skipped -15, +14 lines =@@ + } + + /** @type {T2} */ ++ ~~ ++!!! error TS2304: Cannot find name 'T2'. + const f4 = async str => { + return str; + } + + /** @type {T3} */ + ~~ -!!! error TS1065: The return type of an async function or method must be the global Promise type. -!!! error TS1065: Type 'typeof Thenable' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -!!! error TS1065: Construct signature return types 'Thenable' and 'PromiseLike' are incompatible. -!!! error TS1065: The types returned by 'then(...)' are incompatible between these types. -!!! error TS1065: Type 'void' is not assignable to type 'PromiseLike'. -- const f5 = async str => { -- return str; -- } -- -@@= skipped --1, +1 lines =@@ -+ ++!!! error TS2304: Cannot find name 'T3'. + const f5 = async str => { + return str; + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/asyncFunctionDeclaration16_es5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/asyncFunctionDeclaration16_es5.types.diff index e8b7377df6..6a755833d4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/asyncFunctionDeclaration16_es5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/asyncFunctionDeclaration16_es5.types.diff @@ -1,27 +1,11 @@ --- old.asyncFunctionDeclaration16_es5.types +++ new.asyncFunctionDeclaration16_es5.types -@@= skipped -28, +28 lines =@@ - * @returns {string} - */ - const f1 = async str => { -->f1 : (str: string) => string -->async str => { return str;} : (str: string) => string -->str : string -+>f1 : (str: any) => Promise -+>async str => { return str;} : (str: any) => Promise -+>str : any - - return str; -->str : string -+>str : any - } - +@@= skipped -39, +39 lines =@@ /** @type {T1} */ const f2 = async str => { -->f2 : T1 + >f2 : T1 ->async str => { return str;} : (str: string) => string ->str : string -+>f2 : (str: any) => Promise +>async str => { return str;} : (str: any) => Promise +>str : any @@ -32,27 +16,11 @@ /** @@= skipped -23, +23 lines =@@ - * @returns {Promise} - */ - const f3 = async str => { -->f3 : (str: string) => Promise -->async str => { return str;} : (str: string) => Promise -->str : string -+>f3 : (str: any) => Promise -+>async str => { return str;} : (str: any) => Promise -+>str : any - - return str; -->str : string -+>str : any - } - /** @type {T2} */ const f4 = async str => { -->f4 : T2 + >f4 : T2 ->async str => { return str;} : (str: string) => Promise ->str : string -+>f4 : (str: any) => Promise +>async str => { return str;} : (str: any) => Promise +>str : any @@ -63,10 +31,9 @@ /** @type {T3} */ const f5 = async str => { -->f5 : T3 + >f5 : T3 ->async str => { return str;} : (str: string) => Thenable ->str : string -+>f5 : (str: any) => Promise +>async str => { return str;} : (str: any) => Promise +>str : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff index ac9047c074..fc24b46f5c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff @@ -4,6 +4,7 @@ - @@= skipped --1, +1 lines =@@ +mod1.js(5,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++use.js(1,20): error TS2306: File 'mod1.js' is not a module. + + +==== mod1.js (1 errors) ==== @@ -18,8 +19,10 @@ + this.p = 1 + } + -+==== use.js (0 errors) ==== ++==== use.js (1 errors) ==== + /** @param {import('./mod1').Con} k */ ++ ~~~~~~~~ ++!!! error TS2306: File 'mod1.js' is not a module. + function f(k) { + if (1 === 2 - 1) { + // I guess basic math works! diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackOnConstructor.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackOnConstructor.errors.txt.diff new file mode 100644 index 0000000000..df85b5798e --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackOnConstructor.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.callbackOnConstructor.errors.txt ++++ new.callbackOnConstructor.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++callbackOnConstructor.js(12,12): error TS2304: Cannot find name 'ValueGetter_2'. ++ ++ ++==== callbackOnConstructor.js (1 errors) ==== ++ export class Preferences { ++ assignability = "no" ++ /** ++ * @callback ValueGetter_2 ++ * @param {string} name ++ * @returns {boolean|number|string|undefined} ++ */ ++ constructor() {} ++ } ++ ++ ++ /** @type {ValueGetter_2} */ ++ ~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'ValueGetter_2'. ++ var ooscope2 = s => s.length > 0 ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackOnConstructor.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackOnConstructor.types.diff index 84b1064505..84dba7f57e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackOnConstructor.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackOnConstructor.types.diff @@ -7,7 +7,7 @@ ->ooscope2 : (name: string) => boolean | number | string | undefined ->s => s.length > 0 : (s: string) => string | number | boolean ->s : string -+>ooscope2 : (s: any) => boolean ++>ooscope2 : ValueGetter_2 +>s => s.length > 0 : (s: any) => boolean +>s : any >s.length > 0 : boolean diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag1.errors.txt.diff new file mode 100644 index 0000000000..f7336c1648 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag1.errors.txt.diff @@ -0,0 +1,32 @@ +--- old.callbackTag1.errors.txt ++++ new.callbackTag1.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++cb.js(7,12): error TS2304: Cannot find name 'Sid'. ++cb.js(11,12): error TS2304: Cannot find name 'NoReturn'. ++ ++ ++==== cb.js (2 errors) ==== ++ /** @callback Sid ++ * @param {string} s ++ * @returns {string} What were you expecting ++ */ ++ var x = 1 ++ ++ /** @type {Sid} smallId */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Sid'. ++ var sid = s => s + "!"; ++ ++ ++ /** @type {NoReturn} */ ++ ~~~~~~~~ ++!!! error TS2304: Cannot find name 'NoReturn'. ++ var noreturn = obj => void obj.title ++ ++ /** ++ * @callback NoReturn ++ * @param {{ e: number, m: number, title: string }} s - Knee deep, shores, etc ++ */ ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag1.types.diff index 9524130d1f..26718ee325 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag1.types.diff @@ -1,13 +1,11 @@ --- old.callbackTag1.types +++ new.callbackTag1.types -@@= skipped -10, +10 lines =@@ - +@@= skipped -11, +11 lines =@@ /** @type {Sid} smallId */ var sid = s => s + "!"; -->sid : Sid + >sid : Sid ->s => s + "!" : (s: string) => string ->s : string -+>sid : (s: any) => string +>s => s + "!" : (s: any) => string +>s : any >s + "!" : string @@ -18,10 +16,9 @@ /** @type {NoReturn} */ var noreturn = obj => void obj.title -->noreturn : NoReturn + >noreturn : NoReturn ->obj => void obj.title : (obj: { e: number; m: number; title: string; }) => any ->obj : { e: number; m: number; title: string; } -+>noreturn : (obj: any) => any +>obj => void obj.title : (obj: any) => any +>obj : any >void obj.title : undefined diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag2.errors.txt.diff index c58ffc7f0c..1979e8649b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag2.errors.txt.diff @@ -2,11 +2,27 @@ +++ new.callbackTag2.errors.txt @@= skipped -0, +0 lines =@@ -cb.js(18,29): error TS2304: Cannot find name 'S'. -+cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'. ++cb.js(8,12): error TS2304: Cannot find name 'Id'. ++cb.js(19,14): error TS2339: Property 'id' does not exist on type 'SharedClass'. ++cb.js(22,12): error TS2304: Cannot find name 'SharedId'. ++cb.js(25,12): error TS2304: Cannot find name 'Final'. - ==== cb.js (1 errors) ==== -@@= skipped -19, +19 lines =@@ +-==== cb.js (1 errors) ==== ++==== cb.js (4 errors) ==== + /** @template T + * @callback Id + * @param {T} t +@@= skipped -9, +12 lines =@@ + var x = 1 + + /** @type {Id} I actually wanted to write `const "120"` */ ++ ~~ ++!!! error TS2304: Cannot find name 'Id'. + var one_twenty = s => "120"; + + /** @template S +@@= skipped -10, +12 lines =@@ class SharedClass { constructor() { /** @type {SharedId} */ @@ -14,7 +30,17 @@ -!!! error TS2304: Cannot find name 'S'. this.id; + ~~ -+!!! error TS2339: Property 'id' does not exist on type 'SharedClass'. ++!!! error TS2339: Property 'id' does not exist on type 'SharedClass'. } } /** @type {SharedId} */ ++ ~~~~~~~~ ++!!! error TS2304: Cannot find name 'SharedId'. + var outside = n => n + 1; + + /** @type {Final<{ fantasy }, { heroes }>} */ ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Final'. + var noreturn = (barts, tidus, noctis) => "cecil" + + /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag2.types.diff index afc9b14dbb..a9917280c1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag2.types.diff @@ -1,19 +1,23 @@ --- old.callbackTag2.types +++ new.callbackTag2.types -@@= skipped -11, +11 lines =@@ - +@@= skipped -12, +12 lines =@@ /** @type {Id} I actually wanted to write `const "120"` */ var one_twenty = s => "120"; -->one_twenty : Id + >one_twenty : Id ->s => "120" : (s: string) => string ->s : string -+>one_twenty : (s: any) => string +>s => "120" : (s: any) => string +>s : any >"120" : "120" /** @template S -@@= skipped -16, +16 lines =@@ +@@= skipped -10, +10 lines =@@ + * @return {S} + */ + class SharedClass { +->SharedClass : SharedClass ++>SharedClass : SharedClass + constructor() { /** @type {SharedId} */ this.id; @@ -26,12 +30,11 @@ } /** @type {SharedId} */ var outside = n => n + 1; -->outside : SharedId + >outside : SharedId ->n => n + 1 : (n: number) => number ->n : number ->n + 1 : number ->n : number -+>outside : (n: any) => any +>n => n + 1 : (n: any) => any +>n : any +>n + 1 : any @@ -40,12 +43,11 @@ /** @type {Final<{ fantasy }, { heroes }>} */ var noreturn = (barts, tidus, noctis) => "cecil" -->noreturn : Final<{ fantasy: any; }, { heroes: any; }> + >noreturn : Final<{ fantasy: any; }, { heroes: any; }> ->(barts, tidus, noctis) => "cecil" : (barts: { fantasy: any; }, tidus: { heroes: any; }, noctis: { heroes: any; } & { fantasy: any; }) => "cecil" | "zidane" ->barts : { fantasy: any; } ->tidus : { heroes: any; } ->noctis : { heroes: any; } & { fantasy: any; } -+>noreturn : (barts: any, tidus: any, noctis: any) => string +>(barts, tidus, noctis) => "cecil" : (barts: any, tidus: any, noctis: any) => string +>barts : any +>tidus : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag3.errors.txt.diff new file mode 100644 index 0000000000..7ab5188958 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag3.errors.txt.diff @@ -0,0 +1,18 @@ +--- old.callbackTag3.errors.txt ++++ new.callbackTag3.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++cb.js(4,12): error TS2304: Cannot find name 'Miracle'. ++ ++ ++==== cb.js (1 errors) ==== ++ /** @callback Miracle ++ * @returns {string} What were you expecting ++ */ ++ /** @type {Miracle} smallId */ ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'Miracle'. ++ var sid = () => "!"; ++ ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag3.types.diff deleted file mode 100644 index cd3c842a27..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag3.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.callbackTag3.types -+++ new.callbackTag3.types -@@= skipped -5, +5 lines =@@ - */ - /** @type {Miracle} smallId */ - var sid = () => "!"; -->sid : Miracle -+>sid : () => string - >() => "!" : () => string - >"!" : "!" - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag4.errors.txt.diff index 9977dcc3f9..0b07465530 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag4.errors.txt.diff @@ -3,12 +3,13 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++a.js(9,12): error TS2304: Cannot find name 'C'. +a.js(10,22): error TS7006: Parameter 'a' implicitly has an 'any' type. +a.js(10,25): error TS7006: Parameter 'b' implicitly has an 'any' type. +a.js(11,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + + -+==== a.js (3 errors) ==== ++==== a.js (4 errors) ==== + /** + * @callback C + * @this {{ a: string, b: number }} @@ -18,6 +19,8 @@ + */ + + /** @type {C} */ ++ ~ ++!!! error TS2304: Cannot find name 'C'. + const cb = function (a, b) { + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag4.types.diff index b6c4896c70..369753e315 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTag4.types.diff @@ -8,15 +8,13 @@ /** * @callback C * @this {{ a: string, b: number }} -@@= skipped -10, +10 lines =@@ - +@@= skipped -11, +11 lines =@@ /** @type {C} */ const cb = function (a, b) { -->cb : C + >cb : C ->function (a, b) { this return true} : (this: { a: string; b: number; }, a: string, b: number) => boolean ->a : string ->b : number -+>cb : (a: any, b: any) => boolean +>function (a, b) { this return true} : (a: any, b: any) => boolean +>a : any +>b : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagNestedParameter.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagNestedParameter.errors.txt.diff new file mode 100644 index 0000000000..f6ca9c7ec2 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagNestedParameter.errors.txt.diff @@ -0,0 +1,28 @@ +--- old.callbackTagNestedParameter.errors.txt ++++ new.callbackTagNestedParameter.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++cb_nested.js(11,12): error TS2304: Cannot find name 'WorksWithPeopleCallback'. ++ ++ ++==== cb_nested.js (1 errors) ==== ++ /** ++ * @callback WorksWithPeopleCallback ++ * @param {Object} person ++ * @param {string} person.name ++ * @param {number} [person.age] ++ * @returns {void} ++ */ ++ ++ /** ++ * For each person, calls your callback. ++ * @param {WorksWithPeopleCallback} callback ++ ~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'WorksWithPeopleCallback'. ++ * @returns {void} ++ */ ++ function eachPerson(callback) { ++ callback({ name: "Empty" }); ++ } ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagNestedParameter.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagNestedParameter.types.diff index 4775e33ef4..d30f23f02a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagNestedParameter.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagNestedParameter.types.diff @@ -1,19 +1,11 @@ --- old.callbackTagNestedParameter.types +++ new.callbackTagNestedParameter.types -@@= skipped -14, +14 lines =@@ - * @returns {void} - */ - function eachPerson(callback) { -->eachPerson : (callback: WorksWithPeopleCallback) => void -->callback : WorksWithPeopleCallback -+>eachPerson : (callback: any) => void -+>callback : any +@@= skipped -18, +18 lines =@@ + >callback : WorksWithPeopleCallback callback({ name: "Empty" }); ->callback({ name: "Empty" }) : void -->callback : WorksWithPeopleCallback +>callback({ name: "Empty" }) : any -+>callback : any + >callback : WorksWithPeopleCallback >{ name: "Empty" } : { name: string; } >name : string - >"Empty" : "Empty" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagVariadicType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagVariadicType.errors.txt.diff index 49adc28146..329423e0b5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagVariadicType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagVariadicType.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+callbackTagVariadicType.js(9,13): error TS2554: Expected 0 arguments, but got 2. ++callbackTagVariadicType.js(7,12): error TS2304: Cannot find name 'Foo'. + + +==== callbackTagVariadicType.js (1 errors) ==== @@ -14,8 +14,8 @@ + */ + + /** @type {Foo} */ ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. + export const x = () => 1 + var res = x('a', 'b') -+ ~~~~~~~~ -+!!! error TS2554: Expected 0 arguments, but got 2. + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagVariadicType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagVariadicType.types.diff index 9b1ccf79b4..886bdbca6c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagVariadicType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackTagVariadicType.types.diff @@ -1,19 +1,13 @@ --- old.callbackTagVariadicType.types +++ new.callbackTagVariadicType.types -@@= skipped -8, +8 lines =@@ - - /** @type {Foo} */ - export const x = () => 1 -->x : Foo -+>x : () => number - >() => 1 : () => number +@@= skipped -13, +13 lines =@@ >1 : 1 var res = x('a', 'b') - >res : number - >x('a', 'b') : number -->x : Foo -+>x : () => number +->res : number +->x('a', 'b') : number ++>res : any ++>x('a', 'b') : any + >x : Foo >'a' : "a" >'b' : "b" - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocOptionalParamOrder.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocOptionalParamOrder.errors.txt.diff deleted file mode 100644 index 6cd1a12a45..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocOptionalParamOrder.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.checkJsdocOptionalParamOrder.errors.txt -+++ new.checkJsdocOptionalParamOrder.errors.txt -@@= skipped -0, +-1 lines =@@ --0.js(7,20): error TS1016: A required parameter cannot follow an optional parameter. -- -- --==== 0.js (1 errors) ==== -- // @ts-check -- /** -- * @param {number} a -- * @param {number} [b] -- * @param {number} c -- */ -- function foo(a, b, c) {} -- ~ --!!! error TS1016: A required parameter cannot follow an optional parameter. -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocOptionalParamOrder.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocOptionalParamOrder.types.diff index 8b4a04dc13..4e5cd89f15 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocOptionalParamOrder.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocOptionalParamOrder.types.diff @@ -5,11 +5,7 @@ */ function foo(a, b, c) {} ->foo : (a: number, b?: number, c: number) => void -->a : number -->b : number -->c : number -+>foo : (a: any, b: any, c: any) => void -+>a : any -+>b : any -+>c : any - ++>foo : (a: number, b: number, c: number) => void + >a : number + >b : number + >c : number diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types.diff index 4f90472433..d09f5ecd48 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamOnVariableDeclaredFunctionExpression.types.diff @@ -7,16 +7,12 @@ ->x : (n?: number | undefined, s?: string) => void ->function foo(n, s) {} : (n?: number | undefined, s?: string) => void ->foo : (n?: number | undefined, s?: string) => void -->n : number -->s : string -+>x : (n: any, s: any) => void -+>function foo(n, s) {} : (n: any, s: any) => void -+>foo : (n: any, s: any) => void -+>n : any -+>s : any ++>x : (n?: number, s?: string) => void ++>function foo(n, s) {} : (n?: number, s?: string) => void ++>foo : (n?: number, s?: string) => void + >n : number + >s : string - var y; - >y : any @@= skipped -13, +13 lines =@@ * @param {boolean!} b */ @@ -33,14 +29,3 @@ /** * @param {string} s - */ - var one = function (s) { }, two = function (untyped) { }; -->one : (s: string) => void -->function (s) { } : (s: string) => void -->s : string -+>one : (s: any) => void -+>function (s) { } : (s: any) => void -+>s : any - >two : (untyped: any) => void - >function (untyped) { } : (untyped: any) => void - >untyped : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamTag1.errors.txt.diff deleted file mode 100644 index 5fb5ffe788..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamTag1.errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.checkJsdocParamTag1.errors.txt -+++ new.checkJsdocParamTag1.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+0.js(8,1): error TS2554: Expected 2 arguments, but got 0. -+0.js(9,1): error TS2554: Expected 2 arguments, but got 1. -+ -+ -+==== 0.js (2 errors) ==== -+ // @ts-check -+ /** -+ * @param {number=} n -+ * @param {string} [s] -+ */ -+ function foo(n, s) {} -+ -+ foo(); -+ ~~~ -+!!! error TS2554: Expected 2 arguments, but got 0. -+!!! related TS6210 0.js:6:14: An argument for 'n' was not provided. -+ foo(1); -+ ~~~ -+!!! error TS2554: Expected 2 arguments, but got 1. -+!!! related TS6210 0.js:6:17: An argument for 's' was not provided. -+ foo(1, "hi"); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamTag1.types.diff index f45c6da257..f6dc725c1d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocParamTag1.types.diff @@ -5,27 +5,25 @@ */ function foo(n, s) {} ->foo : (n?: number | undefined, s?: string) => void -->n : number -->s : string -+>foo : (n: any, s: any) => void -+>n : any -+>s : any ++>foo : (n?: number, s?: string) => void + >n : number + >s : string foo(); >foo() : void ->foo : (n?: number | undefined, s?: string) => void -+>foo : (n: any, s: any) => void ++>foo : (n?: number, s?: string) => void foo(1); >foo(1) : void ->foo : (n?: number | undefined, s?: string) => void -+>foo : (n: any, s: any) => void ++>foo : (n?: number, s?: string) => void >1 : 1 foo(1, "hi"); >foo(1, "hi") : void ->foo : (n?: number | undefined, s?: string) => void -+>foo : (n: any, s: any) => void ++>foo : (n?: number, s?: string) => void >1 : 1 >"hi" : "hi" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag1.types.diff index 1e13e1787e..a13501ac4d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag1.types.diff @@ -9,12 +9,3 @@ return "hello world"; >"hello world" : "hello world" -@@= skipped -10, +10 lines =@@ - * @returns {string|number} This comment is not currently exposed - */ - function f2() { -->f2 : () => string | number -+>f2 : () => "hello" | 5 - - return 5 || "hello"; - >5 || "hello" : "hello" | 5 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag2.errors.txt.diff deleted file mode 100644 index d4d9342407..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag2.errors.txt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.checkJsdocReturnTag2.errors.txt -+++ new.checkJsdocReturnTag2.errors.txt -@@= skipped -0, +0 lines =@@ --returns.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. --returns.js(13,5): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. -- Type 'boolean' is not assignable to type 'string | number'. - returns.js(13,12): error TS2872: This kind of expression is always truthy. - - --==== returns.js (3 errors) ==== -+==== returns.js (1 errors) ==== - // @ts-check - /** - * @returns {string} This comment is not currently exposed - */ - function f() { - return 5; -- ~~~~~~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. - } - - /** -@@= skipped -19, +14 lines =@@ - */ - function f1() { - return 5 || true; -- ~~~~~~ --!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. --!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. - ~ - !!! error TS2872: This kind of expression is always truthy. - } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag2.types.diff index 9e83812133..0fe1fb3e4f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag2.types.diff @@ -1,20 +1,7 @@ --- old.checkJsdocReturnTag2.types +++ new.checkJsdocReturnTag2.types -@@= skipped -5, +5 lines =@@ - * @returns {string} This comment is not currently exposed - */ - function f() { -->f : () => string -+>f : () => number - - return 5; - >5 : 5 -@@= skipped -10, +10 lines =@@ - * @returns {string | number} This comment is not currently exposed - */ - function f1() { -->f1 : () => string | number -+>f1 : () => 5 | true +@@= skipped -18, +18 lines =@@ + >f1 : () => string | number return 5 || true; ->5 || true : true | 5 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.types.diff index 523019ce4c..038506abf4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.types.diff @@ -1,37 +1,56 @@ --- old.checkJsdocSatisfiesTag1.types +++ new.checkJsdocSatisfiesTag1.types -@@= skipped -42, +42 lines =@@ +@@= skipped -2, +2 lines =@@ + === /a.js === + /** + * @typedef {Object} T1 ++>T1 : any ++ + * @property {number} a ++>a : any ++ + */ + /** + * @typedef {Object} T2 ++>T2 : any ++ + * @property {"a" | "b"} a ++>a : any ++ + */ + + /** + * @typedef {(x: string) => string} T3 ++>T3 : any ++>x : string ++ + */ + + /** + * @typedef {Object} T4 ++>T4 : any ++ + * @property {string} a ++>a : any ++ + */ + + const t1 = /** @satisfies {T1} */ ({ a: 1 }); +@@= skipped -41, +56 lines =@@ /** @type {T2} */ const t4 = /** @satisfies {T2} */ ({ a: "a" }); -->t4 : T2 + >t4 : T2 ->({ a: "a" }) : T2 ->{ a: "a" } : { a: "a"; } ->a : "a" -+>t4 : { a: string; } +>({ a: "a" }) : { a: string; } +>{ a: "a" } : { a: string; } +>a : string >"a" : "a" /** @type {(m: string) => string} */ - const t5 = /** @satisfies {T3} */((m) => m.substring(0)); -->t5 : (m: string) => string -->((m) => m.substring(0)) : (m: string) => string -->(m) => m.substring(0) : (m: string) => string -->m : string -->m.substring(0) : string -->m.substring : (start: number, end?: number) => string -->m : string -->substring : (start: number, end?: number) => string -+>t5 : (m: any) => any -+>((m) => m.substring(0)) : (m: any) => any -+>(m) => m.substring(0) : (m: any) => any -+>m : any -+>m.substring(0) : any -+>m.substring : any -+>m : any -+>substring : any +@@= skipped -18, +18 lines =@@ >0 : 0 const t6 = /** @satisfies {[number, number]} */ ([1, 2]); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag10.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag10.types.diff new file mode 100644 index 0000000000..f24887d31f --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag10.types.diff @@ -0,0 +1,10 @@ +--- old.checkJsdocSatisfiesTag10.types ++++ new.checkJsdocSatisfiesTag10.types +@@= skipped -1, +1 lines =@@ + + === /a.js === + /** @typedef {"a" | "b" | "c" | "d"} Keys */ ++>Keys : any + + const p = /** @satisfies {Partial>} */ ({ + >p : { a: number; b: string; x: number; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag11.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag11.types.diff new file mode 100644 index 0000000000..1854b6a74f --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag11.types.diff @@ -0,0 +1,23 @@ +--- old.checkJsdocSatisfiesTag11.types ++++ new.checkJsdocSatisfiesTag11.types +@@= skipped -2, +2 lines =@@ + === /a.js === + /** + * @typedef {Object} T1 ++>T1 : any ++ + * @property {number} a ++>a : any ++ + */ + + /** + * @typedef {Object} T2 ++>T2 : any ++ + * @property {number} a ++>a : any ++ + */ + + /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag12.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag12.types.diff index c052f121c1..2b6d2bc619 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag12.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag12.types.diff @@ -1,6 +1,36 @@ --- old.checkJsdocSatisfiesTag12.types +++ new.checkJsdocSatisfiesTag12.types -@@= skipped -75, +75 lines =@@ +@@= skipped -2, +2 lines =@@ + === /a.js === + /** + * @typedef {Object} T1 ++>T1 : any ++ + * @property {number} a ++>a : any ++ + */ + + /** + * @typedef {Object} T2 ++>T2 : any ++ + * @property {string} a ++>a : any ++ + */ + + /** + * @typedef {Object} T3 ++>T3 : any ++ + * @property {"a" | "b"} a ++>a : any ++ + */ + + /** +@@= skipped -73, +85 lines =@@ * @satisfies {T3} */ const t7 = { a: "a" }; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.types.diff new file mode 100644 index 0000000000..19ee23005b --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.types.diff @@ -0,0 +1,14 @@ +--- old.checkJsdocSatisfiesTag14.types ++++ new.checkJsdocSatisfiesTag14.types +@@= skipped -2, +2 lines =@@ + === /a.js === + /** + * @typedef {Object} T1 ++>T1 : any ++ + * @property {number} a ++>a : any ++ + */ + + /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.errors.txt.diff new file mode 100644 index 0000000000..9d083d1300 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.errors.txt.diff @@ -0,0 +1,21 @@ +--- old.checkJsdocSatisfiesTag2.errors.txt ++++ new.checkJsdocSatisfiesTag2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/a.js(1,15): error TS2315: Type 'Object' is not generic. ++/a.js(1,21): error TS8020: JSDoc types can only be used inside documentation comments. ++ ++ ++==== /a.js (2 errors) ==== ++ /** @typedef {Object. boolean>} Predicates */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. ++ ~ ++!!! error TS8020: JSDoc types can only be used inside documentation comments. ++ ++ const p = /** @satisfies {Predicates} */ ({ ++ isEven: n => n % 2 === 0, ++ isOdd: n => n % 2 === 1 ++ }); ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.types.diff index 168b0f62f0..5782e62c1f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.types.diff @@ -1,7 +1,11 @@ --- old.checkJsdocSatisfiesTag2.types +++ new.checkJsdocSatisfiesTag2.types -@@= skipped -3, +3 lines =@@ +@@= skipped -1, +1 lines =@@ + + === /a.js === /** @typedef {Object. boolean>} Predicates */ ++>Predicates : any ++>n : number const p = /** @satisfies {Predicates} */ ({ ->p : { isEven: (n: number) => boolean; isOdd: (n: number) => boolean; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.errors.txt.diff index 318b609d0d..73eaaa76a0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.errors.txt.diff @@ -1,21 +1,20 @@ --- old.checkJsdocSatisfiesTag3.errors.txt +++ new.checkJsdocSatisfiesTag3.errors.txt @@= skipped -0, +0 lines =@@ - /a.js(3,7): error TS7006: Parameter 's' implicitly has an 'any' type. +-/a.js(3,7): error TS7006: Parameter 's' implicitly has an 'any' type. +/a.js(4,7): error TS7006: Parameter 's' implicitly has an 'any' type. +/a.js(8,49): error TS7006: Parameter 'x' implicitly has an 'any' type. -==== /a.js (1 errors) ==== -+==== /a.js (3 errors) ==== ++==== /a.js (2 errors) ==== /** @type {{ f(s: string): void } & Record }} */ let obj = /** @satisfies {{ g(s: string): void } & Record} */ ({ f(s) { }, // "incorrect" implicit any on 's' ++ g(s) { } ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. - g(s) { } -+ ~ -+!!! error TS7006: Parameter 's' implicitly has an 'any' type. +- g(s) { } }); // This needs to not crash (outer node is not expression) diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.types.diff index 27821645bc..37eef391a2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag3.types.diff @@ -7,13 +7,15 @@ ->obj : { f(s: string): void; } & Record ->({ f(s) { }, // "incorrect" implicit any on 's' g(s) { }}) : { f(s: string): void; } & Record ->{ f(s) { }, // "incorrect" implicit any on 's' g(s) { }} : { f(s: any): void; g(s: string): void; } -+>obj : { f: (s: any) => void; g: (s: any) => void; } -+>({ f(s) { }, // "incorrect" implicit any on 's' g(s) { }}) : { f: (s: any) => void; g: (s: any) => void; } -+>{ f(s) { }, // "incorrect" implicit any on 's' g(s) { }} : { f: (s: any) => void; g: (s: any) => void; } ++>obj : { f: (s: string) => void; } & Record ++>({ f(s) { }, // "incorrect" implicit any on 's' g(s) { }}) : { f: (s: string) => void; g: (s: any) => void; } ++>{ f(s) { }, // "incorrect" implicit any on 's' g(s) { }} : { f: (s: string) => void; g: (s: any) => void; } f(s) { }, // "incorrect" implicit any on 's' - >f : (s: any) => void - >s : any +->f : (s: any) => void +->s : any ++>f : (s: string) => void ++>s : string g(s) { } ->g : (s: string) => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag4.types.diff new file mode 100644 index 0000000000..22b606e490 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag4.types.diff @@ -0,0 +1,26 @@ +--- old.checkJsdocSatisfiesTag4.types ++++ new.checkJsdocSatisfiesTag4.types +@@= skipped -2, +2 lines =@@ + === /a.js === + /** + * @typedef {Object} Foo ++>Foo : any ++ + * @property {number} a ++>a : any ++ + */ + export default /** @satisfies {Foo} */ ({}); + >({}) : {} +@@= skipped -9, +13 lines =@@ + === /b.js === + /** + * @typedef {Object} Foo ++>Foo : any ++ + * @property {number} a ++>a : any ++ + */ + + export default /** @satisfies {Foo} */ ({ a: 1 }); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag5.types.diff index 7980edabd7..43e003cbc2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag5.types.diff @@ -1,7 +1,12 @@ --- old.checkJsdocSatisfiesTag5.types +++ new.checkJsdocSatisfiesTag5.types -@@= skipped -3, +3 lines =@@ +@@= skipped -1, +1 lines =@@ + + === /a.js === /** @typedef {{ move(distance: number): void }} Movable */ ++>Movable : any ++>move : (distance: number) => void ++>distance : number const car = /** @satisfies {Movable & Record} */ ({ ->car : { start(): void; move(d: number): void; stop(): void; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag6.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag6.types.diff new file mode 100644 index 0000000000..bacdb3f5f7 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag6.types.diff @@ -0,0 +1,17 @@ +--- old.checkJsdocSatisfiesTag6.types ++++ new.checkJsdocSatisfiesTag6.types +@@= skipped -2, +2 lines =@@ + === /a.js === + /** + * @typedef {Object} Point2d ++>Point2d : any ++ + * @property {number} x ++>x : any ++ + * @property {number} y ++>y : any ++ + */ + + // Undesirable behavior today with type annotation diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag7.types.diff new file mode 100644 index 0000000000..bce34c2708 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag7.types.diff @@ -0,0 +1,10 @@ +--- old.checkJsdocSatisfiesTag7.types ++++ new.checkJsdocSatisfiesTag7.types +@@= skipped -1, +1 lines =@@ + + === /a.js === + /** @typedef {"a" | "b" | "c" | "d"} Keys */ ++>Keys : any + + const p = /** @satisfies {Record} */ ({ + >p : { a: number; b: string; x: number; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.errors.txt.diff index 0dd7a74d2d..d4a0745ab7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.errors.txt.diff @@ -1,19 +1,24 @@ --- old.checkJsdocSatisfiesTag8.errors.txt +++ new.checkJsdocSatisfiesTag8.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(6,5): error TS2322: Type 'string' is not assignable to type 'boolean'. -- -- ++/a.js(1,15): error TS2315: Type 'Object' is not generic. ++/a.js(1,21): error TS8020: JSDoc types can only be used inside documentation comments. + + -==== /a.js (1 errors) ==== -- /** @typedef {Object.} Facts */ -- -- // Should be able to detect a failure here -- const x = /** @satisfies {Facts} */ ({ -- m: true, -- s: "false" ++==== /a.js (2 errors) ==== + /** @typedef {Object.} Facts */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. ++ ~ ++!!! error TS8020: JSDoc types can only be used inside documentation comments. + + // Should be able to detect a failure here + const x = /** @satisfies {Facts} */ ({ + m: true, + s: "false" - ~ -!!! error TS2322: Type 'string' is not assignable to type 'boolean'. -- }) -- -@@= skipped --1, +1 lines =@@ -+ + }) + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.types.diff index 8ddb8e5ad8..d5d8580e57 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.types.diff @@ -1,6 +1,10 @@ --- old.checkJsdocSatisfiesTag8.types +++ new.checkJsdocSatisfiesTag8.types -@@= skipped -4, +4 lines =@@ +@@= skipped -1, +1 lines =@@ + + === /a.js === + /** @typedef {Object.} Facts */ ++>Facts : any // Should be able to detect a failure here const x = /** @satisfies {Facts} */ ({ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag9.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag9.types.diff new file mode 100644 index 0000000000..5666b6b4b5 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag9.types.diff @@ -0,0 +1,20 @@ +--- old.checkJsdocSatisfiesTag9.types ++++ new.checkJsdocSatisfiesTag9.types +@@= skipped -2, +2 lines =@@ + === /a.js === + /** + * @typedef {Object} Color ++>Color : any ++ + * @property {number} r ++>r : any ++ + * @property {number} g ++>g : any ++ + * @property {number} b ++>b : any ++ + */ + + // All of these should be Colors, but I only use some of them here. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff index dab89aba16..621cec769f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff @@ -1,52 +1,49 @@ --- old.checkJsdocTypeTag1.errors.txt +++ new.checkJsdocTypeTag1.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -0.js(24,12): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -- -- ++0.js(20,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(24,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(28,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. + + -==== 0.js (1 errors) ==== -- // @ts-check -- /** @type {String} */ -- var S = "hello world"; -- -- /** @type {number} */ -- var n = 10; -- -- /** @type {*} */ -- var anyT = 2; -- anyT = "hello"; -- -- /** @type {?} */ -- var anyT1 = 2; -- anyT1 = "hi"; -- -- /** @type {Function} */ -- const x = (a) => a + 1; -- x(1); -- -- /** @type {function} */ -- const y = (a) => a + 1; -- y(1); -- -- /** @type {function (number)} */ ++==== 0.js (4 errors) ==== + // @ts-check + /** @type {String} */ + var S = "hello world"; +@@= skipped -21, +24 lines =@@ + x(1); + + /** @type {function} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const y = (a) => a + 1; + y(1); + + /** @type {function (number)} */ - ~~~~~~~~~~~~~~~~~ -!!! error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -- const x1 = (a) => a + 1; -- x1(0); -- -- /** @type {function (number): number} */ -- const x2 = (a) => a + 1; -- x2(0); -- -- /** -- * @type {object} -- */ -- var props = {}; -- -- /** -- * @type {Object} -- */ -- var props = {}; -- -@@= skipped --1, +1 lines =@@ -+ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x1 = (a) => a + 1; + x1(0); + + /** @type {function (number): number} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x2 = (a) => a + 1; + x2(0); + +@@= skipped -22, +29 lines =@@ + * @type {Object} + */ + var props = {}; ++ ~~~~~ ++!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. ++!!! related TS6203 0.js:35:5: 'props' was also declared here. + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.types.diff index a4fb6376c7..00334ca703 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.types.diff @@ -1,59 +1,29 @@ --- old.checkJsdocTypeTag1.types +++ new.checkJsdocTypeTag1.types -@@= skipped -13, +13 lines =@@ +@@= skipped -3, +3 lines =@@ + // @ts-check + /** @type {String} */ + var S = "hello world"; +->S : string ++>S : String + >"hello world" : "hello world" - /** @type {*} */ - var anyT = 2; -->anyT : any -+>anyT : number - >2 : 2 - - anyT = "hello"; - >anyT = "hello" : "hello" -->anyT : any -+>anyT : number - >"hello" : "hello" - - /** @type {?} */ - var anyT1 = 2; -->anyT1 : any -+>anyT1 : number - >2 : 2 - - anyT1 = "hi"; - >anyT1 = "hi" : "hi" -->anyT1 : any -+>anyT1 : number - >"hi" : "hi" - - /** @type {Function} */ - const x = (a) => a + 1; -->x : Function -+>x : (a: any) => any - >(a) => a + 1 : (a: any) => any - >a : any - >a + 1 : any -@@= skipped -29, +29 lines =@@ - - x(1); - >x(1) : any -->x : Function -+>x : (a: any) => any - >1 : 1 + /** @type {number} */ +@@= skipped -44, +44 lines =@@ /** @type {function} */ const y = (a) => a + 1; ->y : Function -+>y : (a: any) => any ++>y : function >(a) => a + 1 : (a: any) => any >a : any >a + 1 : any -@@= skipped -14, +14 lines =@@ +@@= skipped -9, +9 lines =@@ y(1); >y(1) : any ->y : Function -+>y : (a: any) => any ++>y : function >1 : 1 /** @type {function (number)} */ @@ -63,7 +33,7 @@ ->a : number ->a + 1 : number ->a : number -+>x1 : (a: any) => any ++>x1 : function +>(a) => a + 1 : (a: any) => any +>a : any +>a + 1 : any @@ -73,7 +43,7 @@ x1(0); >x1(0) : any ->x1 : (arg0: number) => any -+>x1 : (a: any) => any ++>x1 : function >0 : 0 /** @type {function (number): number} */ @@ -83,7 +53,7 @@ ->a : number ->a + 1 : number ->a : number -+>x2 : (a: any) => any ++>x2 : function +>(a) => a + 1 : (a: any) => any +>a : any +>a + 1 : any @@ -94,22 +64,7 @@ ->x2(0) : number ->x2 : (arg0: number) => number +>x2(0) : any -+>x2 : (a: any) => any ++>x2 : function >0 : 0 /** - * @type {object} - */ - var props = {}; -->props : any -+>props : {} - >{} : {} - - /** - * @type {Object} - */ - var props = {}; -->props : any -+>props : {} - >{} : {} - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.errors.txt.diff index f06ecf6e93..a26d98f387 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.errors.txt.diff @@ -1,54 +1,71 @@ --- old.checkJsdocTypeTag2.errors.txt +++ new.checkJsdocTypeTag2.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'string'. --0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'. ++0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'String'. + 0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'. -0.js(8,12): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -0.js(10,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -0.js(17,1): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(20,21): error TS2339: Property 'concat' does not exist on type 'number'. -0.js(24,19): error TS2322: Type 'number' is not assignable to type 'string'. -- -- ++0.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(12,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(23,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + -==== 0.js (7 errors) ==== -- // @ts-check -- /** @type {String} */ -- var S = true; -- ~ ++==== 0.js (6 errors) ==== + // @ts-check + /** @type {String} */ + var S = true; + ~ -!!! error TS2322: Type 'boolean' is not assignable to type 'string'. -- -- /** @type {number} */ -- var n = "hello"; -- ~ --!!! error TS2322: Type 'string' is not assignable to type 'number'. -- -- /** @type {function (number)} */ ++!!! error TS2322: Type 'boolean' is not assignable to type 'String'. + + /** @type {number} */ + var n = "hello"; +@@= skipped -19, +18 lines =@@ + !!! error TS2322: Type 'string' is not assignable to type 'number'. + + /** @type {function (number)} */ - ~~~~~~~~~~~~~~~~~ -!!! error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -- const x1 = (a) => a + 1; -- x1("string"); ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x1 = (a) => a + 1; + x1("string"); - ~~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -- -- /** @type {function (number): number} */ -- const x2 = (a) => a + 1; -- -- /** @type {string} */ -- var a; -- a = x2(0); + + /** @type {function (number): number} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x2 = (a) => a + 1; + + /** @type {string} */ + var a; + a = x2(0); - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- -- /** @type {function (number): number} */ -- const x3 = (a) => a.concat("hi"); + + /** @type {function (number): number} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x3 = (a) => a.concat("hi"); - ~~~~~~ -!!! error TS2339: Property 'concat' does not exist on type 'number'. -- x3(0); -- -- /** @type {function (number): string} */ -- const x4 = (a) => a + 1; + x3(0); + + /** @type {function (number): string} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + const x4 = (a) => a + 1; - ~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- x4(0); -@@= skipped --1, +1 lines =@@ -+ + x4(0); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.types.diff index bd5e836f55..b30261a16e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.types.diff @@ -5,14 +5,11 @@ /** @type {String} */ var S = true; ->S : string -+>S : boolean ++>S : String >true : true /** @type {number} */ - var n = "hello"; -->n : number -+>n : string - >"hello" : "hello" +@@= skipped -10, +10 lines =@@ /** @type {function (number)} */ const x1 = (a) => a + 1; @@ -21,7 +18,7 @@ ->a : number ->a + 1 : number ->a : number -+>x1 : (a: any) => any ++>x1 : function +>(a) => a + 1 : (a: any) => any +>a : any +>a + 1 : any @@ -31,7 +28,7 @@ x1("string"); >x1("string") : any ->x1 : (arg0: number) => any -+>x1 : (a: any) => any ++>x1 : function >"string" : "string" /** @type {function (number): number} */ @@ -41,7 +38,7 @@ ->a : number ->a + 1 : number ->a : number -+>x2 : (a: any) => any ++>x2 : function +>(a) => a + 1 : (a: any) => any +>a : any +>a + 1 : any @@ -49,19 +46,17 @@ >1 : 1 /** @type {string} */ - var a; -->a : string -+>a : any +@@= skipped -26, +26 lines =@@ + >a : string a = x2(0); ->a = x2(0) : number -->a : string ++>a = x2(0) : any + >a : string ->x2(0) : number ->x2 : (arg0: number) => number -+>a = x2(0) : any -+>a : any +>x2(0) : any -+>x2 : (a: any) => any ++>x2 : function >0 : 0 /** @type {function (number): number} */ @@ -69,7 +64,7 @@ ->x3 : (arg0: number) => number ->(a) => a.concat("hi") : (a: number) => number ->a : number -+>x3 : (a: any) => any ++>x3 : function +>(a) => a.concat("hi") : (a: any) => any +>a : any >a.concat("hi") : any @@ -83,7 +78,7 @@ ->x3(0) : number ->x3 : (arg0: number) => number +>x3(0) : any -+>x3 : (a: any) => any ++>x3 : function >0 : 0 /** @type {function (number): string} */ @@ -93,7 +88,7 @@ ->a : number ->a + 1 : number ->a : number -+>x4 : (a: any) => any ++>x4 : function +>(a) => a + 1 : (a: any) => any +>a : any +>a + 1 : any @@ -104,6 +99,6 @@ ->x4(0) : string ->x4 : (arg0: number) => string +>x4(0) : any -+>x4 : (a: any) => any ++>x4 : function >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag3.types.diff deleted file mode 100644 index 74267b93fe..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag3.types.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.checkJsdocTypeTag3.types -+++ new.checkJsdocTypeTag3.types -@@= skipped -2, +2 lines =@@ - === test.js === - /** @type {Array} */ - var nns; -->nns : number[] -+>nns : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.errors.txt.diff index ffefc22db0..ecccd6f603 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.errors.txt.diff @@ -1,26 +1,21 @@ --- old.checkJsdocTypeTag4.errors.txt +++ new.checkJsdocTypeTag4.errors.txt -@@= skipped -0, +-1 lines =@@ --test.js(5,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. --test.js(7,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. -- -- --==== t.d.ts (0 errors) ==== -- type A = { a: T } -- +@@= skipped -0, +0 lines =@@ ++test.js(3,19): error TS2304: Cannot find name 'U'. + test.js(5,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. + test.js(7,14): error TS2344: Type 'number' does not satisfy the constraint 'string'. + +@@= skipped -4, +5 lines =@@ + ==== t.d.ts (0 errors) ==== + type A = { a: T } + -==== test.js (2 errors) ==== -- /** Also should error for jsdoc typedefs -- * @template {string} U -- * @typedef {{ b: U }} B -- */ -- /** @type {A} */ -- ~~~~~~ --!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. -- var a; -- /** @type {B} */ -- ~~~~~~ --!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. -- var b; -- -@@= skipped --1, +1 lines =@@ -+ ++==== test.js (3 errors) ==== + /** Also should error for jsdoc typedefs + * @template {string} U + * @typedef {{ b: U }} B ++ ~ ++!!! error TS2304: Cannot find name 'U'. + */ + /** @type {A} */ + ~~~~~~ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.types.diff index d37413d440..39887ce32e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.types.diff @@ -1,14 +1,19 @@ --- old.checkJsdocTypeTag4.types +++ new.checkJsdocTypeTag4.types -@@= skipped -11, +11 lines =@@ +@@= skipped -8, +8 lines =@@ + /** Also should error for jsdoc typedefs + * @template {string} U + * @typedef {{ b: U }} B ++>B : any ++>b : U ++ */ /** @type {A} */ var a; -->a : A -+>a : any +@@= skipped -7, +10 lines =@@ /** @type {B} */ var b; ->b : B -+>b : any ++>b : { b: U; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.errors.txt.diff index ef88515543..aadaba2498 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.errors.txt.diff @@ -1,69 +1,73 @@ --- old.checkJsdocTypeTag5.errors.txt +++ new.checkJsdocTypeTag5.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -test.js(3,17): error TS2322: Type 'number' is not assignable to type 'string'. --test.js(5,14): error TS2322: Type 'number' is not assignable to type 'string'. + test.js(5,14): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(7,24): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(10,17): error TS2322: Type 'number' is not assignable to type 'string'. --test.js(12,14): error TS2322: Type 'number' is not assignable to type 'string'. ++test.js(7,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. ++ Type 'number' is not assignable to type 'string'. + test.js(12,14): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(14,24): error TS2322: Type 'number' is not assignable to type 'string'. -test.js(28,12): error TS8030: The type of a function declaration must match the function's signature. --test.js(34,5): error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. -- Type '1' is not assignable to type '2 | 3'. -- -- ++test.js(14,5): error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. ++ Type 'number' is not assignable to type 'string'. ++test.js(24,5): error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'. + test.js(34,5): error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. + Type '1' is not assignable to type '2 | 3'. + + -==== test.js (8 errors) ==== -- // all 6 should error on return statement/expression -- /** @type {(x: number) => string} */ -- function h(x) { return x } ++==== test.js (6 errors) ==== + // all 6 should error on return statement/expression + /** @type {(x: number) => string} */ + function h(x) { return x } - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- /** @type {(x: number) => string} */ -- var f = x => x -- ~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. -- /** @type {(x: number) => string} */ -- var g = function (x) { return x } + /** @type {(x: number) => string} */ + var f = x => x + ~ + !!! error TS2322: Type 'number' is not assignable to type 'string'. ++!!! related TS6502 test.js:4:12: The expected type comes from the return type of this signature. + /** @type {(x: number) => string} */ + var g = function (x) { return x } - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- -- /** @type {{ (x: number): string }} */ -- function i(x) { return x } ++ ~ ++!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. ++!!! error TS2322: Type 'number' is not assignable to type 'string'. + + /** @type {{ (x: number): string }} */ + function i(x) { return x } - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- /** @type {{ (x: number): string }} */ -- var j = x => x -- ~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. -- /** @type {{ (x: number): string }} */ -- var k = function (x) { return x } + /** @type {{ (x: number): string }} */ + var j = x => x + ~ + !!! error TS2322: Type 'number' is not assignable to type 'string'. ++!!! related TS6502 test.js:11:12: The expected type comes from the return type of this signature. + /** @type {{ (x: number): string }} */ + var k = function (x) { return x } - ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- -- -- /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ -- /** @type {Argle} */ -- function blargle(s) { -- return 0; -- } -- -- /** @type {0 | 1 | 2} - assignment should not error */ -- var zeroonetwo = blargle('hi') -- -- /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ -- -- /** @type {Gioconda} */ ++ ~ ++!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: number) => string'. ++!!! error TS2322: Type 'number' is not assignable to type 'string'. + + + /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ +@@= skipped -45, +45 lines =@@ + + /** @type {0 | 1 | 2} - assignment should not error */ + var zeroonetwo = blargle('hi') ++ ~~~~~~~~~~ ++!!! error TS2322: Type 'number' is not assignable to type '0 | 1 | 2'. + + /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ + + /** @type {Gioconda} */ - ~~~~~~~~ -!!! error TS8030: The type of a function declaration must match the function's signature. -- function monaLisa(sb) { -- return typeof sb === 'string' ? 1 : 2; -- } -- -- /** @type {2 | 3} - overloads are not supported, so there will be an error */ -- var twothree = monaLisa(false); -- ~~~~~~~~ --!!! error TS2322: Type '1 | 2' is not assignable to type '2 | 3'. --!!! error TS2322: Type '1' is not assignable to type '2 | 3'. -- -@@= skipped --1, +1 lines =@@ -+ + function monaLisa(sb) { + return typeof sb === 'string' ? 1 : 2; + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff index 2f3d183d3b..81a03be231 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff @@ -13,25 +13,19 @@ /** @type {(x: number) => string} */ var f = x => x -->f : (x: number) => string + >f : (x: number) => string ->x => x : (x: number) => string -->x : number -->x : number -+>f : (x: any) => any -+>x => x : (x: any) => any -+>x : any -+>x : any ++>x => x : (x: number) => number + >x : number + >x : number /** @type {(x: number) => string} */ var g = function (x) { return x } -->g : (x: number) => string + >g : (x: number) => string ->function (x) { return x } : (x: number) => string -->x : number -->x : number -+>g : (x: any) => any -+>function (x) { return x } : (x: any) => any -+>x : any -+>x : any ++>function (x) { return x } : (x: number) => number + >x : number + >x : number /** @type {{ (x: number): string }} */ function i(x) { return x } @@ -44,28 +38,25 @@ /** @type {{ (x: number): string }} */ var j = x => x -->j : (x: number) => string + >j : (x: number) => string ->x => x : (x: number) => string -->x : number -->x : number -+>j : (x: any) => any -+>x => x : (x: any) => any -+>x : any -+>x : any ++>x => x : (x: number) => number + >x : number + >x : number /** @type {{ (x: number): string }} */ var k = function (x) { return x } -->k : (x: number) => string + >k : (x: number) => string ->function (x) { return x } : (x: number) => string -->x : number -->x : number -+>k : (x: any) => any -+>function (x) { return x } : (x: any) => any -+>x : any -+>x : any ++>function (x) { return x } : (x: number) => number + >x : number + >x : number /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ ++>Argle : Argle ++>x : "bye" | "hi" ++ /** @type {Argle} */ function blargle(s) { ->blargle : (x: "hi" | "bye") => 0 | 1 | 2 @@ -75,20 +66,24 @@ return 0; >0 : 0 -@@= skipped -51, +51 lines =@@ - +@@= skipped -52, +55 lines =@@ /** @type {0 | 1 | 2} - assignment should not error */ var zeroonetwo = blargle('hi') -->zeroonetwo : 0 | 1 | 2 + >zeroonetwo : 0 | 1 | 2 ->blargle('hi') : 0 | 1 | 2 ->blargle : (x: "hi" | "bye") => 0 | 1 | 2 -+>zeroonetwo : number +>blargle('hi') : number +>blargle : (s: any) => number >'hi' : "hi" /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ -@@= skipped -15, +15 lines =@@ ++>Gioconda : Gioconda ++>s : string ++>b : boolean + + /** @type {Gioconda} */ + function monaLisa(sb) { +@@= skipped -14, +17 lines =@@ return typeof sb === 'string' ? 1 : 2; >typeof sb === 'string' ? 1 : 2 : 1 | 2 >typeof sb === 'string' : boolean @@ -97,12 +92,3 @@ >sb : any >'string' : "string" >1 : 1 -@@= skipped -9, +9 lines =@@ - - /** @type {2 | 3} - overloads are not supported, so there will be an error */ - var twothree = monaLisa(false); -->twothree : 2 | 3 -+>twothree : number - >monaLisa(false) : 1 | 2 - >monaLisa : (sb: any) => 1 | 2 - >false : false diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.errors.txt.diff index dc81be50ce..13763ae1a4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.errors.txt.diff @@ -1,71 +1,50 @@ --- old.checkJsdocTypeTag6.errors.txt +++ new.checkJsdocTypeTag6.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -test.js(1,12): error TS8030: The type of a function declaration must match the function's signature. --test.js(7,5): error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. + test.js(7,5): error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. -test.js(10,12): error TS8030: The type of a function declaration must match the function's signature. -test.js(23,12): error TS8030: The type of a function declaration must match the function's signature. --test.js(27,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. -- Target signature provides too few arguments. Expected 1 or more, but got 0. --test.js(30,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. -- Target signature provides too few arguments. Expected 1 or more, but got 0. + test.js(27,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. + Target signature provides too few arguments. Expected 1 or more, but got 0. + test.js(30,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. + Target signature provides too few arguments. Expected 1 or more, but got 0. -test.js(34,3): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. - Target signature provides too few arguments. Expected 1 or more, but got 0. -- -- + + -==== test.js (7 errors) ==== -- /** @type {number} */ ++==== test.js (3 errors) ==== + /** @type {number} */ - ~~~~~~ -!!! error TS8030: The type of a function declaration must match the function's signature. -- function f() { -- return 1 -- } -- -- /** @type {{ prop: string }} */ -- var g = function (prop) { -- ~ --!!! error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. -- } -- -- /** @type {(a: number) => number} */ + function f() { + return 1 + } +@@= skipped -24, +17 lines =@@ + } + + /** @type {(a: number) => number} */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8030: The type of a function declaration must match the function's signature. -- function add1(a, b) { return a + b; } -- -- /** @type {(a: number, b: number) => number} */ -- function add2(a, b) { return a + b; } -- -- // TODO: Should be an error since signature doesn't match. -- /** @type {(a: number, b: number, c: number) => number} */ -- function add3(a, b) { return a + b; } -- -- // Confirm initializers are compatible. -- // They can't have more parameters than the type/context. -- -- /** @type {() => void} */ + function add1(a, b) { return a + b; } + + /** @type {(a: number, b: number) => number} */ +@@= skipped -15, +13 lines =@@ + // They can't have more parameters than the type/context. + + /** @type {() => void} */ - ~~~~~~~~~~ -!!! error TS8030: The type of a function declaration must match the function's signature. -- function funcWithMoreParameters(more) {} // error -- -- /** @type {() => void} */ -- const variableWithMoreParameters = function (more) {}; // error -- ~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. --!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. -- -- /** @type {() => void} */ -- const arrowWithMoreParameters = (more) => {}; // error -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. --!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. -- -- ({ -- /** @type {() => void} */ -- methodWithMoreParameters(more) {}, // error + function funcWithMoreParameters(more) {} // error + + /** @type {() => void} */ +@@= skipped -19, +17 lines =@@ + ({ + /** @type {() => void} */ + methodWithMoreParameters(more) {}, // error - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. -!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. -- }); -- -@@= skipped --1, +1 lines =@@ -+ + }); + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.types.diff index 3e5cbc5ea3..ead935ec01 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.types.diff @@ -1,14 +1,6 @@ --- old.checkJsdocTypeTag6.types +++ new.checkJsdocTypeTag6.types -@@= skipped -10, +10 lines =@@ - - /** @type {{ prop: string }} */ - var g = function (prop) { -->g : { prop: string; } -+>g : (prop: any) => void - >function (prop) {} : (prop: any) => void - >prop : any - } +@@= skipped -17, +17 lines =@@ /** @type {(a: number) => number} */ function add1(a, b) { return a + b; } @@ -63,17 +55,7 @@ >more : any /** @type {() => void} */ - const variableWithMoreParameters = function (more) {}; // error -->variableWithMoreParameters : () => void -+>variableWithMoreParameters : (more: any) => void - >function (more) {} : (more: any) => void - >more : any - - /** @type {() => void} */ - const arrowWithMoreParameters = (more) => {}; // error -->arrowWithMoreParameters : () => void -+>arrowWithMoreParameters : (more: any) => void - >(more) => {} : (more: any) => void +@@= skipped -47, +47 lines =@@ >more : any ({ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff index 3224c0b361..1eb62a2e6f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff @@ -1,6 +1,17 @@ --- old.checkJsdocTypeTag7.types +++ new.checkJsdocTypeTag7.types -@@= skipped -9, +9 lines =@@ +@@= skipped -2, +2 lines =@@ + === test.js === + /** + * @typedef {(a: string, b: number) => void} Foo ++>Foo : any ++>a : string ++>b : number ++ + */ + + class C { +@@= skipped -7, +11 lines =@@ /** @type {Foo} */ foo(a, b) {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff index b1b2b146a2..7aa3c6a048 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff @@ -3,11 +3,10 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+0.js(19,1): error TS2322: Type '"string"' is not assignable to type 'undefined'. -+0.js(21,1): error TS2322: Type 'undefined' is not assignable to type 'string'. ++0.js(16,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + -+==== 0.js (2 errors) ==== ++==== 0.js (1 errors) ==== + // @ts-check + var lol = "hello Lol" + const obj = { @@ -24,15 +23,14 @@ + /** @type {number} */ + ['b' + 'ar1']: 42, + /** @type {function(number): number} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + arrowFunc: (num) => num + 42 + } + obj.foo = 'string' -+ ~~~~~~~ -+!!! error TS2322: Type '"string"' is not assignable to type 'undefined'. + obj.lol + obj.bar = undefined; -+ ~~~~~~~ -+!!! error TS2322: Type 'undefined' is not assignable to type 'string'. + var k = obj.method1(0); + obj.bar1 = "42"; + obj.arrowFunc(0); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.types.diff index ce55a84bca..05d1ea34a0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.types.diff @@ -6,19 +6,19 @@ const obj = { ->obj : { [x: string]: string | number | ((arg0: number) => number) | undefined; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } ->{ /** @type {string|undefined} */ foo: undefined, /** @type {string|undefined} */ bar: "42", /** @type {function(number): number} */ method1(n1) { return n1 + 42; }, /** @type {string} */ lol, /** @type {number} */ ['b' + 'ar1']: 42, /** @type {function(number): number} */ arrowFunc: (num) => num + 42} : { [x: string]: string | number | ((arg0: number) => number) | undefined; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } -+>obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } -+>{ /** @type {string|undefined} */ foo: undefined, /** @type {string|undefined} */ bar: "42", /** @type {function(number): number} */ method1(n1) { return n1 + 42; }, /** @type {string} */ lol, /** @type {number} */ ['b' + 'ar1']: 42, /** @type {function(number): number} */ arrowFunc: (num) => num + 42} : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } ++>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } ++>{ /** @type {string|undefined} */ foo: undefined, /** @type {string|undefined} */ bar: "42", /** @type {function(number): number} */ method1(n1) { return n1 + 42; }, /** @type {string} */ lol, /** @type {number} */ ['b' + 'ar1']: 42, /** @type {function(number): number} */ arrowFunc: (num) => num + 42} : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } /** @type {string|undefined} */ foo: undefined, -->foo : string | undefined -+>foo : undefined + >foo : string | undefined ++>undefined : string | undefined >undefined : undefined /** @type {string|undefined} */ bar: "42", -->bar : string | undefined -+>bar : string + >bar : string | undefined ++>"42" : string | undefined >"42" : "42" /** @type {function(number): number} */ @@ -36,7 +36,12 @@ >42 : 42 }, -@@= skipped -38, +38 lines =@@ +@@= skipped -34, +36 lines =@@ + >'b' + 'ar1' : string + >'b' : "b" + >'ar1' : "ar1" ++>42 : number + >42 : 42 /** @type {function(number): number} */ arrowFunc: (num) => num + 42 @@ -45,7 +50,8 @@ ->num : number ->num + 42 : number ->num : number -+>arrowFunc : (num: any) => any ++>arrowFunc : function ++>(num) => num + 42 : function +>(num) => num + 42 : (num: any) => any +>num : any +>num + 42 : any @@ -54,28 +60,24 @@ } obj.foo = 'string' >obj.foo = 'string' : "string" -->obj.foo : string | undefined + >obj.foo : string | undefined ->obj : { [x: string]: string | number | ((arg0: number) => number) | undefined; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } -->foo : string | undefined -+>obj.foo : undefined -+>obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } -+>foo : undefined ++>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } + >foo : string | undefined >'string' : "string" obj.lol >obj.lol : string ->obj : { [x: string]: string | number | ((arg0: number) => number) | undefined; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } -+>obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } ++>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } >lol : string obj.bar = undefined; >obj.bar = undefined : undefined -->obj.bar : string | undefined + >obj.bar : string | undefined ->obj : { [x: string]: string | number | ((arg0: number) => number) | undefined; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } -->bar : string | undefined -+>obj.bar : string -+>obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } -+>bar : string ++>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } + >bar : string | undefined >undefined : undefined var k = obj.method1(0); @@ -87,7 +89,7 @@ +>k : any +>obj.method1(0) : any +>obj.method1 : (n1: any) => any -+>obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } ++>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } +>method1 : (n1: any) => any >0 : 0 @@ -96,9 +98,9 @@ ->obj.bar1 : string | number | ((arg0: number) => number) | undefined ->obj : { [x: string]: string | number | ((arg0: number) => number) | undefined; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } ->bar1 : string | number | ((arg0: number) => number) | undefined -+>obj.bar1 : string | number | (n1: any) => any | undefined -+>obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } -+>bar1 : string | number | (n1: any) => any | undefined ++>obj.bar1 : any ++>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } ++>bar1 : any >"42" : "42" obj.arrowFunc(0); @@ -107,8 +109,8 @@ ->obj : { [x: string]: string | number | ((arg0: number) => number) | undefined; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } ->arrowFunc : (arg0: number) => number +>obj.arrowFunc(0) : any -+>obj.arrowFunc : (num: any) => any -+>obj : { [x: string]: string | number | (n1: any) => any | undefined; foo: undefined; bar: string; method1: (n1: any) => any; lol: string; arrowFunc: (num: any) => any; } -+>arrowFunc : (num: any) => any ++>obj.arrowFunc : function ++>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1: (n1: any) => any; lol: string; arrowFunc: function; } ++>arrowFunc : function >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff index 015876ca90..efedccde18 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff @@ -1,6 +1,6 @@ --- old.checkJsdocTypeTagOnObjectProperty2.errors.txt +++ new.checkJsdocTypeTagOnObjectProperty2.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -0.js(5,3): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(8,7): error TS2322: Type 'string' is not assignable to type 'number'. -0.js(11,20): error TS2322: Type 'string' is not assignable to type 'number'. @@ -9,46 +9,56 @@ -0.js(19,5): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(22,5): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(22,22): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -- -- ++0.js(5,8): error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. ++0.js(10,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(12,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + -==== 0.js (8 errors) ==== -- // @ts-check -- var lol; -- const obj = { -- /** @type {string|undefined} */ -- bar: 42, ++==== 0.js (3 errors) ==== + // @ts-check + var lol; + const obj = { + /** @type {string|undefined} */ + bar: 42, - ~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- /** @type {function(number): number} */ -- method1(n1) { -- return "42"; ++ ~~ ++!!! error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. + /** @type {function(number): number} */ + method1(n1) { + return "42"; - ~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. -- }, -- /** @type {function(number): number} */ -- method2: (n1) => "lol", + }, + /** @type {function(number): number} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + method2: (n1) => "lol", - ~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. -- /** @type {function(number): number} */ -- arrowFunc: (num="0") => num + 42, + /** @type {function(number): number} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + arrowFunc: (num="0") => num + 42, - ~~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. -- /** @type {string} */ -- lol + /** @type {string} */ + lol - ~~~ -!!! error TS2322: Type 'undefined' is not assignable to type 'string'. -- } -- lol = "string" -- /** @type {string} */ -- var s = obj.method1(0); + } + lol = "string" + /** @type {string} */ + var s = obj.method1(0); - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- -- /** @type {string} */ -- var s1 = obj.method2("0"); + + /** @type {string} */ + var s1 = obj.method2("0"); - ~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - ~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.types.diff index 93082f1b63..49de36cefb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.types.diff @@ -6,13 +6,13 @@ const obj = { ->obj : { bar: string | undefined; method1(arg0: number): number; method2: (arg0: number) => number; arrowFunc: (arg0: number) => number; lol: string; } ->{ /** @type {string|undefined} */ bar: 42, /** @type {function(number): number} */ method1(n1) { return "42"; }, /** @type {function(number): number} */ method2: (n1) => "lol", /** @type {function(number): number} */ arrowFunc: (num="0") => num + 42, /** @type {string} */ lol} : { bar: string | undefined; method1(arg0: number): number; method2: (arg0: number) => number; arrowFunc: (arg0: number) => number; lol: string; } -+>obj : { bar: number; method1: (n1: any) => string; method2: (n1: any) => string; arrowFunc: (num?: string) => string; lol: any; } -+>{ /** @type {string|undefined} */ bar: 42, /** @type {function(number): number} */ method1(n1) { return "42"; }, /** @type {function(number): number} */ method2: (n1) => "lol", /** @type {function(number): number} */ arrowFunc: (num="0") => num + 42, /** @type {string} */ lol} : { bar: number; method1: (n1: any) => string; method2: (n1: any) => string; arrowFunc: (num?: string) => string; lol: any; } ++>obj : { bar: string | undefined; method1: (n1: any) => string; method2: function; arrowFunc: function; lol: any; } ++>{ /** @type {string|undefined} */ bar: 42, /** @type {function(number): number} */ method1(n1) { return "42"; }, /** @type {function(number): number} */ method2: (n1) => "lol", /** @type {function(number): number} */ arrowFunc: (num="0") => num + 42, /** @type {string} */ lol} : { bar: string | undefined; method1: (n1: any) => string; method2: function; arrowFunc: function; lol: any; } /** @type {string|undefined} */ bar: 42, -->bar : string | undefined -+>bar : number + >bar : string | undefined ++>42 : string | undefined >42 : 42 /** @type {function(number): number} */ @@ -24,14 +24,15 @@ return "42"; >"42" : "42" -@@= skipped -19, +19 lines =@@ +@@= skipped -19, +20 lines =@@ }, /** @type {function(number): number} */ method2: (n1) => "lol", ->method2 : (arg0: number) => number ->(n1) => "lol" : (n1: number) => number ->n1 : number -+>method2 : (n1: any) => string ++>method2 : function ++>(n1) => "lol" : function +>(n1) => "lol" : (n1: any) => string +>n1 : any >"lol" : "lol" @@ -41,7 +42,8 @@ ->arrowFunc : (arg0: number) => number ->(num="0") => num + 42 : (num?: number) => number ->num : number -+>arrowFunc : (num?: string) => string ++>arrowFunc : function ++>(num="0") => num + 42 : function +>(num="0") => num + 42 : (num?: string) => string +>num : string >"0" : "0" @@ -58,7 +60,7 @@ } lol = "string" >lol = "string" : "string" -@@= skipped -27, +27 lines =@@ +@@= skipped -27, +29 lines =@@ /** @type {string} */ var s = obj.method1(0); >s : string @@ -68,7 +70,7 @@ ->method1 : (arg0: number) => number +>obj.method1(0) : string +>obj.method1 : (n1: any) => string -+>obj : { bar: number; method1: (n1: any) => string; method2: (n1: any) => string; arrowFunc: (num?: string) => string; lol: any; } ++>obj : { bar: string | undefined; method1: (n1: any) => string; method2: function; arrowFunc: function; lol: any; } +>method1 : (n1: any) => string >0 : 0 @@ -79,9 +81,9 @@ ->obj.method2 : (arg0: number) => number ->obj : { bar: string | undefined; method1(arg0: number): number; method2: (arg0: number) => number; arrowFunc: (arg0: number) => number; lol: string; } ->method2 : (arg0: number) => number -+>obj.method2("0") : string -+>obj.method2 : (n1: any) => string -+>obj : { bar: number; method1: (n1: any) => string; method2: (n1: any) => string; arrowFunc: (num?: string) => string; lol: any; } -+>method2 : (n1: any) => string ++>obj.method2("0") : any ++>obj.method2 : function ++>obj : { bar: string | undefined; method1: (n1: any) => string; method2: function; arrowFunc: function; lol: any; } ++>method2 : function >"0" : "0" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff new file mode 100644 index 0000000000..24d6542318 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff @@ -0,0 +1,61 @@ +--- old.checkJsdocTypedefInParamTag1.errors.txt ++++ new.checkJsdocTypedefInParamTag1.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++0.js(15,5): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': w, y, z ++0.js(28,6): error TS2741: Property 'anotherY' is missing in type '{ anotherX: string; }' but required in type 'AnotherOpts'. ++0.js(42,6): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': w, y, z ++ ++ ++==== 0.js (3 errors) ==== ++ // @ts-check ++ /** ++ * @typedef {Object} Opts ++ * @property {string} x ++ * @property {string=} y ++ * @property {string} [z] ++ * @property {string} [w="hi"] ++ * ++ * @param {Opts} opts ++ */ ++ function foo(opts) { ++ opts.x; ++ } ++ ++ foo({x: 'abc'}); ++ ~~~~~~~~~~ ++!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': w, y, z ++ ++ /** ++ * @typedef {Object} AnotherOpts ++ * @property anotherX {string} ++ * @property anotherY {string=} ++ * ++ * @param {AnotherOpts} opts ++ */ ++ function foo1(opts) { ++ opts.anotherX; ++ } ++ ++ foo1({anotherX: "world"}); ++ ~~~~~~~~~~~~~~~~~~~ ++!!! error TS2741: Property 'anotherY' is missing in type '{ anotherX: string; }' but required in type 'AnotherOpts'. ++!!! related TS2728 0.js:20:14: 'anotherY' is declared here. ++ ++ /** ++ * @typedef {object} Opts1 ++ * @property {string} x ++ * @property {string=} y ++ * @property {string} [z] ++ * @property {string} [w="hi"] ++ * ++ * @param {Opts1} opts ++ */ ++ function foo2(opts) { ++ opts.x; ++ } ++ foo2({x: 'abc'}); ++ ~~~~~~~~~~ ++!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': w, y, z ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.types.diff index 652317c001..f1d6e58395 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.types.diff @@ -1,76 +1,95 @@ --- old.checkJsdocTypedefInParamTag1.types +++ new.checkJsdocTypedefInParamTag1.types -@@= skipped -11, +11 lines =@@ +@@= skipped -3, +3 lines =@@ + // @ts-check + /** + * @typedef {Object} Opts ++>Opts : Opts ++ + * @property {string} x ++>x : any ++ + * @property {string=} y ++>y : any ++ + * @property {string} [z] ++>z : any ++ + * @property {string} [w="hi"] ++>w : any ++ + * * @param {Opts} opts */ - function foo(opts) { -->foo : (opts: Opts) => void -->opts : Opts -+>foo : (opts: any) => void -+>opts : any +@@= skipped -12, +22 lines =@@ + >opts : Opts opts.x; ->opts.x : string -->opts : Opts -->x : string +>opts.x : any -+>opts : any + >opts : Opts +->x : string +>x : any } foo({x: 'abc'}); - >foo({x: 'abc'}) : void -->foo : (opts: Opts) => void -+>foo : (opts: any) => void - >{x: 'abc'} : { x: string; } - >x : string - >'abc' : "abc" -@@= skipped -24, +24 lines =@@ +@@= skipped -14, +14 lines =@@ + + /** + * @typedef {Object} AnotherOpts ++>AnotherOpts : AnotherOpts ++ + * @property anotherX {string} ++>anotherX : any ++ + * @property anotherY {string=} ++>anotherY : any ++ + * * @param {AnotherOpts} opts */ - function foo1(opts) { -->foo1 : (opts: AnotherOpts) => void -->opts : AnotherOpts -+>foo1 : (opts: any) => void -+>opts : any +@@= skipped -10, +16 lines =@@ + >opts : AnotherOpts opts.anotherX; ->opts.anotherX : string -->opts : AnotherOpts -->anotherX : string +>opts.anotherX : any -+>opts : any + >opts : AnotherOpts +->anotherX : string +>anotherX : any } foo1({anotherX: "world"}); - >foo1({anotherX: "world"}) : void -->foo1 : (opts: AnotherOpts) => void -+>foo1 : (opts: any) => void - >{anotherX: "world"} : { anotherX: string; } - >anotherX : string - >"world" : "world" -@@= skipped -26, +26 lines =@@ +@@= skipped -14, +14 lines =@@ + + /** + * @typedef {object} Opts1 ++>Opts1 : Opts1 ++ + * @property {string} x ++>x : any ++ + * @property {string=} y ++>y : any ++ + * @property {string} [z] ++>z : any ++ + * @property {string} [w="hi"] ++>w : any ++ + * * @param {Opts1} opts */ - function foo2(opts) { -->foo2 : (opts: Opts1) => void -->opts : Opts1 -+>foo2 : (opts: any) => void -+>opts : any +@@= skipped -12, +22 lines =@@ + >opts : Opts1 opts.x; ->opts.x : string -->opts : Opts1 -->x : string +>opts.x : any -+>opts : any + >opts : Opts1 +->x : string +>x : any } foo2({x: 'abc'}); >foo2({x: 'abc'}) : void -->foo2 : (opts: Opts1) => void -+>foo2 : (opts: any) => void - >{x: 'abc'} : { x: string; } - >x : string - >'abc' : "abc" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff index 74d01ceb26..363f19a91b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff @@ -4,10 +4,11 @@ -0.js(10,20): error TS2694: Namespace 'exports' has no exported member 'SomeName'. +0.js(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. +0.js(8,9): error TS2339: Property 'SomeName' does not exist on type '{}'. ++0.js(10,12): error TS2503: Cannot find namespace 'exports'. -==== 0.js (1 errors) ==== -+==== 0.js (2 errors) ==== ++==== 0.js (3 errors) ==== // @ts-check var exports = {}; @@ -24,5 +25,7 @@ /** @type {exports.SomeName} */ - ~~~~~~~~ -!!! error TS2694: Namespace 'exports' has no exported member 'SomeName'. ++ ~~~~~~~ ++!!! error TS2503: Cannot find namespace 'exports'. const myString = 'str'; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.types.diff index 5082a1d261..553db4021f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.types.diff @@ -1,10 +1,19 @@ --- old.checkJsdocTypedefOnlySourceFile.types +++ new.checkJsdocTypedefOnlySourceFile.types -@@= skipped -16, +16 lines =@@ +@@= skipped -9, +9 lines =@@ + /** + * @typedef {string} + */ ++> : any ++ + exports.SomeName; + >exports.SomeName : any + >exports : {} +@@= skipped -7, +9 lines =@@ /** @type {exports.SomeName} */ const myString = 'str'; ->myString : exports.SomeName -+>myString : "str" ++>myString : SomeName >'str' : "str" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkSpecialPropertyAssignments.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkSpecialPropertyAssignments.errors.txt.diff index ca5f8336d5..9788eb2be5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkSpecialPropertyAssignments.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkSpecialPropertyAssignments.errors.txt.diff @@ -1,12 +1,13 @@ --- old.checkSpecialPropertyAssignments.errors.txt +++ new.checkSpecialPropertyAssignments.errors.txt @@= skipped -0, +0 lines =@@ --bug24252.js(8,9): error TS2322: Type 'string[]' is not assignable to type 'number[]'. -- Type 'string' is not assignable to type 'number'. +bug24252.js(2,3): error TS2339: Property 'B' does not exist on type '{}'. + bug24252.js(8,9): error TS2322: Type 'string[]' is not assignable to type 'number[]'. + Type 'string' is not assignable to type 'number'. - ==== bug24252.js (1 errors) ==== +-==== bug24252.js (1 errors) ==== ++==== bug24252.js (2 errors) ==== var A = {}; A.B = class { + ~ @@ -14,12 +15,3 @@ m() { /** @type {string[]} */ var x = []; - /** @type {number[]} */ - var y; - y = x; -- ~ --!!! error TS2322: Type 'string[]' is not assignable to type 'number[]'. --!!! error TS2322: Type 'string' is not assignable to type 'number'. - } - }; - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkSpecialPropertyAssignments.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkSpecialPropertyAssignments.types.diff index 5bac2a6a22..e6cc8deaaa 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkSpecialPropertyAssignments.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkSpecialPropertyAssignments.types.diff @@ -19,26 +19,3 @@ >class { m() { /** @type {string[]} */ var x = []; /** @type {number[]} */ var y; y = x; }} : typeof B m() { -@@= skipped -15, +15 lines =@@ - - /** @type {string[]} */ - var x = []; -->x : string[] -+>x : any[] - >[] : undefined[] - - /** @type {number[]} */ - var y; -->y : number[] -+>y : any - - y = x; -->y = x : string[] -->y : number[] -->x : string[] -+>y = x : any[] -+>y : any -+>x : any[] - } - }; - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/classCanExtendConstructorFunction.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/classCanExtendConstructorFunction.errors.txt.diff index 183cf7367f..f31a7d73d3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/classCanExtendConstructorFunction.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/classCanExtendConstructorFunction.errors.txt.diff @@ -5,14 +5,15 @@ -first.js(31,5): error TS2416: Property 'load' in type 'Sql' is not assignable to the same property in base type 'Wagon'. - Type '(files: string[], format: "csv" | "json" | "xmlolololol") => void' is not assignable to type '(supplies?: any[]) => void'. - Target signature provides too few arguments. Expected 2 or more, but got 1. -+first.js(21,19): error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. ++first.js(21,19): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. +first.js(24,14): error TS2339: Property 'foonly' does not exist on type 'Sql'. ++first.js(27,21): error TS8020: JSDoc types can only be used inside documentation comments. +first.js(44,4): error TS2339: Property 'numberOxen' does not exist on type 'Sql'. +first.js(44,20): error TS2339: Property 'foonly' does not exist on type 'Sql'. first.js(47,24): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. -generic.js(19,19): error TS2554: Expected 1 arguments, but got 0. -generic.js(20,32): error TS2345: Argument of type 'number' is not assignable to parameter of type '{ claim: "ignorant" | "malicious"; }'. -+generic.js(9,23): error TS2507: Type '(flavour: any) => void' is not a constructor function type. ++generic.js(9,23): error TS2507: Type '(flavour: T) => void' is not a constructor function type. +generic.js(11,21): error TS2339: Property 'flavour' does not exist on type 'Chowder'. +generic.js(17,27): error TS2554: Expected 0 arguments, but got 1. +generic.js(18,9): error TS2339: Property 'flavour' does not exist on type 'Chowder'. @@ -25,21 +26,21 @@ - Type 'Wagon[]' is not assignable to type '(typeof Wagon)[]'. - Property 'circle' is missing in type 'Wagon' but required in type 'typeof Wagon'. -second.ts(17,15): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -+second.ts(14,25): error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. ++second.ts(14,25): error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. +second.ts(26,3): error TS2339: Property 'numberOxen' does not exist on type 'Conestoga'. -==== first.js (3 errors) ==== -+==== first.js (5 errors) ==== ++==== first.js (6 errors) ==== /** * @constructor * @param {number} numberOxen -@@= skipped -36, +34 lines =@@ +@@= skipped -36, +35 lines =@@ } // ok class Sql extends Wagon { + ~~~~~ -+!!! error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. ++!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. constructor() { super(); // error: not enough arguments - ~~~~~ @@ -51,7 +52,9 @@ } /** * @param {Array.} files -@@= skipped -13, +14 lines =@@ ++ ~ ++!!! error TS8020: JSDoc types can only be used inside documentation comments. + * @param {"csv" | "json" | "xmlolololol"} format * This is not assignable, so should have a type error */ load(files, format) { @@ -62,7 +65,7 @@ if (format === "xmlolololol") { throw new Error("please do not use XML. It was a joke."); } -@@= skipped -17, +13 lines =@@ +@@= skipped -30, +29 lines =@@ } var db = new Sql(); db.numberOxen = db.foonly @@ -86,7 +89,7 @@ -!!! error TS2417: Property 'circle' is missing in type 'Wagon' but required in type 'typeof Wagon'. -!!! related TS2728 first.js:9:1: 'circle' is declared here. + ~~~~~ -+!!! error TS2507: Type '{ (numberOxen: any): void; circle: (wagons: any) => any; }' is not a constructor function type. ++!!! error TS2507: Type '{ (numberOxen: number): void; circle: (wagons: any) => any; }' is not a constructor function type. constructor(public drunkOO: true) { // error: wrong type super('nope'); @@ -112,7 +115,7 @@ /** @extends {Soup<{ claim: "ignorant" | "malicious" }>} */ class Chowder extends Soup { + ~~~~ -+!!! error TS2507: Type '(flavour: any) => void' is not a constructor function type. ++!!! error TS2507: Type '(flavour: T) => void' is not a constructor function type. log() { return this.flavour + ~~~~~~~ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/classCanExtendConstructorFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/classCanExtendConstructorFunction.types.diff index 8be3b12163..aacabb3616 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/classCanExtendConstructorFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/classCanExtendConstructorFunction.types.diff @@ -5,19 +5,16 @@ */ function Wagon(numberOxen) { ->Wagon : typeof Wagon -->numberOxen : number -+>Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } -+>numberOxen : any ++>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } + >numberOxen : number this.numberOxen = numberOxen -->this.numberOxen = numberOxen : number -+>this.numberOxen = numberOxen : any + >this.numberOxen = numberOxen : number >this.numberOxen : any ->this : this +>this : any >numberOxen : any -->numberOxen : number -+>numberOxen : any + >numberOxen : number } /** @param {Wagon[]=} wagons */ Wagon.circle = function (wagons) { @@ -29,7 +26,7 @@ ->wagons : Wagon[] +>Wagon.circle = function (wagons) { return wagons ? wagons.length : 3.14;} : (wagons: any) => any +>Wagon.circle : (wagons: any) => any -+>Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } ++>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } +>circle : (wagons: any) => any +>function (wagons) { return wagons ? wagons.length : 3.14;} : (wagons: any) => any +>wagons : any @@ -54,7 +51,7 @@ >Wagon.prototype.load : any >Wagon.prototype : any ->Wagon : typeof Wagon -+>Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } ++>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } >prototype : any >load : any ->function (supplies) {} : (supplies?: any[] | undefined) => void @@ -69,7 +66,7 @@ >Wagon.prototype.weight : any >Wagon.prototype : any ->Wagon : typeof Wagon -+>Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } ++>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } >prototype : any >weight : any ->supplies => supplies ? supplies.length : -1 : (supplies?: any[] | undefined) => number @@ -94,7 +91,7 @@ >Wagon.prototype.speed : any >Wagon.prototype : any ->Wagon : typeof Wagon -+>Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } ++>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } >prototype : any >speed : any >function () { return this.numberOxen / this.weight()} : () => number @@ -120,7 +117,7 @@ class Sql extends Wagon { >Sql : Sql ->Wagon : Wagon -+>Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } ++>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } constructor() { super(); // error: not enough arguments @@ -135,19 +132,10 @@ */ load(files, format) { ->load : (files: Array, format: "csv" | "json" | "xmlolololol") => void -->files : string[] -->format : "csv" | "json" | "xmlolololol" -+>load : (files: any, format: any) => void -+>files : any -+>format : any ++>load : (files: string[], format: "csv" | "json" | "xmlolololol") => void + >files : string[] + >format : "csv" | "json" | "xmlolololol" - if (format === "xmlolololol") { - >format === "xmlolololol" : boolean -->format : "csv" | "json" | "xmlolololol" -+>format : any - >"xmlolololol" : "xmlolololol" - - throw new Error("please do not use XML. It was a joke."); @@= skipped -16, +16 lines =@@ } else { @@ -198,7 +186,7 @@ class Conestoga extends Wagon { >Conestoga : Conestoga ->Wagon : Wagon -+>Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } ++>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } constructor(public drunkOO: true) { >drunkOO : true @@ -215,14 +203,14 @@ ->circle : (others: (typeof Wagon)[]) => number ->others : (typeof Wagon)[] ->Wagon : typeof Wagon -+>circle : (others: { (numberOxen: any): void; circle: (wagons: any) => any; }[]) => number -+>others : { (numberOxen: any): void; circle: (wagons: any) => any; }[] -+>Wagon : { (numberOxen: any): void; circle: (wagons: any) => any; } ++>circle : (others: { (numberOxen: number): void; circle: (wagons: any) => any; }[]) => number ++>others : { (numberOxen: number): void; circle: (wagons: any) => any; }[] ++>Wagon : { (numberOxen: number): void; circle: (wagons: any) => any; } return others.length >others.length : number ->others : (typeof Wagon)[] -+>others : { (numberOxen: any): void; circle: (wagons: any) => any; }[] ++>others : { (numberOxen: number): void; circle: (wagons: any) => any; }[] >length : number } } @@ -243,25 +231,22 @@ */ function Soup(flavour) { ->Soup : typeof Soup -->flavour : T -+>Soup : (flavour: any) => void -+>flavour : any ++>Soup : (flavour: T) => void + >flavour : T this.flavour = flavour -->this.flavour = flavour : T -+>this.flavour = flavour : any + >this.flavour = flavour : T >this.flavour : any ->this : this +>this : any >flavour : any -->flavour : T -+>flavour : any + >flavour : T } /** @extends {Soup<{ claim: "ignorant" | "malicious" }>} */ class Chowder extends Soup { >Chowder : Chowder ->Soup : Soup<{ claim: "ignorant" | "malicious"; }> -+>Soup : (flavour: any) => void ++>Soup : (flavour: T) => void log() { ->log : () => { claim: "ignorant" | "malicious"; } @@ -282,7 +267,7 @@ ->Soup : typeof Soup +>soup : any +>new Soup(1) : any -+>Soup : (flavour: any) => void ++>Soup : (flavour: T) => void >1 : 1 soup.flavour diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff index f70259cdcd..9e2d6a0d55 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff @@ -11,16 +11,12 @@ >require : any >'./commonJSAliasedExport' : "./commonJSAliasedExport" - /** @type {boolean} */ - var diddy -->diddy : boolean -+>diddy : any +@@= skipped -11, +11 lines =@@ var diddy = funky(1) -->diddy : boolean + >diddy : boolean ->funky(1) : boolean ->funky : (declaration: any) => boolean -+>diddy : any +>funky(1) : any +>funky : any >1 : 1 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.errors.txt.diff index a3879ab8a8..d2f2ce6611 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.errors.txt.diff @@ -5,11 +5,12 @@ @@= skipped --1, +1 lines =@@ +main.js(1,9): error TS2451: Cannot redeclare block-scoped variable 'K'. +main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? +mod1.js(1,7): error TS2451: Cannot redeclare block-scoped variable 'K'. +mod1.js(6,1): error TS2304: Cannot find name 'exports'. + + -+==== main.js (2 errors) ==== ++==== main.js (3 errors) ==== + const { K } = require("./mod1"); + ~ +!!! error TS2451: Cannot redeclare block-scoped variable 'K'. @@ -17,6 +18,8 @@ + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @param {K} k */ ++ ~ ++!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? + function f(k) { + k.values() + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.types.diff index 6155c712b1..74df8199ac 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.types.diff @@ -11,26 +11,21 @@ >require : any >"./mod1" : "./mod1" - /** @param {K} k */ - function f(k) { -->f : (k: K) => void -->k : K -+>f : (k: any) => void -+>k : any +@@= skipped -11, +11 lines =@@ + >k : K k.values() ->k.values() : K ->k.values : () => K -->k : K -->values : () => K +>k.values() : any +>k.values : any -+>k : any + >k : K +->values : () => K +>values : any } === mod1.js === -@@= skipped -22, +22 lines =@@ +@@= skipped -11, +11 lines =@@ >K : K values() { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.errors.txt.diff index 42ae2e59b2..bf8c296755 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.errors.txt.diff @@ -4,14 +4,17 @@ - @@= skipped --1, +1 lines =@@ +main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? +mod1.js(1,1): error TS2304: Cannot find name 'exports'. + + -+==== main.js (1 errors) ==== ++==== main.js (2 errors) ==== + const { K } = require("./mod1"); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @param {K} k */ ++ ~ ++!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? + function f(k) { + k.values() + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.types.diff index 5b5f42d6b2..48f2524416 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.types.diff @@ -11,21 +11,16 @@ >require : any >"./mod1" : "./mod1" - /** @param {K} k */ - function f(k) { -->f : (k: K) => void -->k : K -+>f : (k: any) => void -+>k : any +@@= skipped -11, +11 lines =@@ + >k : K k.values() ->k.values() : void ->k.values : () => void -->k : K -->values : () => void +>k.values() : any +>k.values : any -+>k : any + >k : K +->values : () => void +>values : any } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.errors.txt.diff index 23b8172836..89b004e1e7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.errors.txt.diff @@ -4,17 +4,20 @@ - @@= skipped --1, +1 lines =@@ +main.js(1,15): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++main.js(2,13): error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? +mod1.js(2,4): error TS2339: Property 'K' does not exist on type '{}'. +mod1.js(4,23): error TS2339: Property 'K' does not exist on type '{}'. +mod1.js(7,1): error TS2304: Cannot find name 'exports'. +mod1.js(7,16): error TS2339: Property 'K' does not exist on type '{}'. + + -+==== main.js (1 errors) ==== ++==== main.js (2 errors) ==== + const { K } = require("./mod1"); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @param {K} k */ ++ ~ ++!!! error TS2749: 'K' refers to a value, but is being used as a type here. Did you mean 'typeof K'? + function f(k) { + k.values() + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.types.diff index 0cf1fd6601..448c40f37d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.types.diff @@ -11,21 +11,16 @@ >require : any >"./mod1" : "./mod1" - /** @param {K} k */ - function f(k) { -->f : (k: K) => void -->k : K -+>f : (k: any) => void -+>k : any +@@= skipped -11, +11 lines =@@ + >k : K k.values() ->k.values() : K ->k.values : () => K -->k : K -->values : () => K +>k.values() : any +>k.values : any -+>k : any + >k : K +->values : () => K +>values : any } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff new file mode 100644 index 0000000000..87f9c60ace --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctionMethodTypeParameters.errors.txt.diff @@ -0,0 +1,48 @@ +--- old.constructorFunctionMethodTypeParameters.errors.txt ++++ new.constructorFunctionMethodTypeParameters.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++constructorFunctionMethodTypeParameters.js(22,16): error TS2304: Cannot find name 'T'. ++constructorFunctionMethodTypeParameters.js(24,17): error TS2304: Cannot find name 'T'. ++ ++ ++==== constructorFunctionMethodTypeParameters.js (2 errors) ==== ++ /** ++ * @template {string} T ++ * @param {T} t ++ */ ++ function Cls(t) { ++ this.t = t; ++ } ++ ++ /** ++ * @template {string} V ++ * @param {T} t ++ * @param {V} v ++ * @return {V} ++ */ ++ Cls.prototype.topLevelComment = function (t, v) { ++ return v ++ }; ++ ++ Cls.prototype.nestedComment = ++ /** ++ * @template {string} U ++ * @param {T} t ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ * @param {U} u ++ * @return {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ function (t, u) { ++ return t ++ }; ++ ++ var c = new Cls('a'); ++ const s = c.topLevelComment('a', 'b'); ++ const t = c.nestedComment('a', 'b'); ++ ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctionMethodTypeParameters.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctionMethodTypeParameters.types.diff index 7101e98afa..ab018ef8ed 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctionMethodTypeParameters.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctionMethodTypeParameters.types.diff @@ -5,22 +5,17 @@ */ function Cls(t) { ->Cls : typeof Cls -->t : T -+>Cls : (t: any) => void -+>t : any ++>Cls : (t: T) => void + >t : T this.t = t; -->this.t = t : T -+>this.t = t : any + >this.t = t : T >this.t : any ->this : this +>this : any >t : any -->t : T -+>t : any + >t : T } - - /** @@= skipped -18, +18 lines =@@ * @return {V} */ @@ -30,7 +25,7 @@ >Cls.prototype.topLevelComment : any >Cls.prototype : any ->Cls : typeof Cls -+>Cls : (t: any) => void ++>Cls : (t: T) => void >prototype : any >topLevelComment : any ->function (t, v) { return v} : (t: T, v: V) => V @@ -46,31 +41,16 @@ }; - Cls.prototype.nestedComment = -->Cls.prototype.nestedComment = /** * @template {string} U * @param {T} t * @param {U} u * @return {T} */ function (t, u) { return t } : (t: T, u: U) => T -+>Cls.prototype.nestedComment = /** * @template {string} U * @param {T} t * @param {U} u * @return {T} */ function (t, u) { return t } : (t: any, u: any) => any +@@= skipped -19, +19 lines =@@ + >Cls.prototype.nestedComment = /** * @template {string} U * @param {T} t * @param {U} u * @return {T} */ function (t, u) { return t } : (t: T, u: U) => T >Cls.prototype.nestedComment : any >Cls.prototype : any ->Cls : typeof Cls -+>Cls : (t: any) => void ++>Cls : (t: T) => void >prototype : any >nestedComment : any -@@= skipped -30, +30 lines =@@ - * @return {T} - */ - function (t, u) { -->function (t, u) { return t } : (t: T, u: U) => T -->t : T -->u : U -+>function (t, u) { return t } : (t: any, u: any) => any -+>t : any -+>u : any - - return t -->t : T -+>t : any - +@@= skipped -21, +21 lines =@@ }; var c = new Cls('a'); @@ -79,7 +59,7 @@ ->Cls : typeof Cls +>c : any +>new Cls('a') : any -+>Cls : (t: any) => void ++>Cls : (t: T) => void >'a' : "a" const s = c.topLevelComment('a', 'b'); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctions.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctions.types.diff index 69caa8a7c0..c9e2225b38 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctions.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctions.types.diff @@ -215,9 +215,8 @@ */ function C7(num) {} ->C7 : typeof C7 -->num : number -+>C7 : (num: any) => void -+>num : any ++>C7 : (num: number) => void + >num : number var c7_v1 = new C7(); ->c7_v1 : C7 @@ -225,5 +224,5 @@ ->C7 : typeof C7 +>c7_v1 : any +>new C7() : any -+>C7 : (num: any) => void ++>C7 : (num: number) => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctionsStrict.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctionsStrict.types.diff index 8061bff2b9..a65cbad88e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctionsStrict.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctionsStrict.types.diff @@ -5,26 +5,23 @@ /** @param {number} x */ function C(x) { ->C : typeof C -->x : number -+>C : (x: any) => void -+>x : any ++>C : (x: number) => void + >x : number this.x = x -->this.x = x : number -+>this.x = x : any + >this.x = x : number >this.x : any ->this : this +>this : any >x : any -->x : number -+>x : any + >x : number } - C.prototype.m = function() { +@@= skipped -14, +14 lines =@@ >C.prototype.m = function() { this.y = 12} : () => void >C.prototype.m : any >C.prototype : any ->C : typeof C -+>C : (x: any) => void ++>C : (x: number) => void >prototype : any >m : any >function() { this.y = 12} : () => void @@ -45,7 +42,7 @@ ->C : typeof C +>c : any +>new C(1) : any -+>C : (x: any) => void ++>C : (x: number) => void >1 : 1 c.x = undefined // should error @@ -71,9 +68,8 @@ /** @param {number} x */ function A(x) { ->A : typeof A -->x : number -+>A : (x: any) => any -+>x : any ++>A : (x: number) => any + >x : number if (!(this instanceof A)) { >!(this instanceof A) : boolean @@ -82,25 +78,22 @@ ->this : this ->A : typeof A +>this : any -+>A : (x: any) => any ++>A : (x: number) => any return new A(x) ->new A(x) : A ->A : typeof A -->x : number +>new A(x) : any -+>A : (x: any) => any -+>x : any ++>A : (x: number) => any + >x : number } this.x = x -->this.x = x : number -+>this.x = x : any + >this.x = x : number >this.x : any ->this : this +>this : any >x : any -->x : number -+>x : any + >x : number } var k = A(1) ->k : A @@ -108,7 +101,7 @@ ->A : typeof A +>k : any +>A(1) : any -+>A : (x: any) => any ++>A : (x: number) => any >1 : 1 var j = new A(2) @@ -117,7 +110,7 @@ ->A : typeof A +>j : any +>new A(2) : any -+>A : (x: any) => any ++>A : (x: number) => any >2 : 2 k.x === j.x diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypeFromJSDoc.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypeFromJSDoc.types.diff index 3e2b213111..4dbe891295 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypeFromJSDoc.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypeFromJSDoc.types.diff @@ -1,81 +1,11 @@ --- old.contextualTypeFromJSDoc.types +++ new.contextualTypeFromJSDoc.types -@@= skipped -2, +2 lines =@@ - === index.js === - /** @type {Array<[string, {x?:number, y?:number}]>} */ - const arr = [ -->arr : [string, { x?: number; y?: number; }][] -->[ ['a', { x: 1 }], ['b', { y: 2 }]] : ([string, { x: number; }] | [string, { y: number; }])[] -+>arr : ((string | { x: number; })[] | (string | { y: number; })[])[] -+>[ ['a', { x: 1 }], ['b', { y: 2 }]] : ((string | { x: number; })[] | (string | { y: number; })[])[] - - ['a', { x: 1 }], -->['a', { x: 1 }] : [string, { x: number; }] -+>['a', { x: 1 }] : (string | { x: number; })[] - >'a' : "a" - >{ x: 1 } : { x: number; } - >x : number - >1 : 1 - - ['b', { y: 2 }] -->['b', { y: 2 }] : [string, { y: number; }] -+>['b', { y: 2 }] : (string | { y: number; })[] - >'b' : "b" - >{ y: 2 } : { y: number; } - >y : number -@@= skipped -21, +21 lines =@@ +@@= skipped -23, +23 lines =@@ /** @return {Array<[string, {x?:number, y?:number}]>} */ function f() { ->f : () => Array<[string, { x?: number; y?: number; }]> -+>f : () => ((string | { x: number; })[] | (string | { y: number; })[])[] ++>f : () => [string, { x?: number; y?: number; }][] return [ -->[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ([string, { x: number; }] | [string, { y: number; }])[] -+>[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ((string | { x: number; })[] | (string | { y: number; })[])[] - - ['a', { x: 1 }], -->['a', { x: 1 }] : [string, { x: number; }] -+>['a', { x: 1 }] : (string | { x: number; })[] - >'a' : "a" - >{ x: 1 } : { x: number; } - >x : number - >1 : 1 - - ['b', { y: 2 }] -->['b', { y: 2 }] : [string, { y: number; }] -+>['b', { y: 2 }] : (string | { y: number; })[] - >'b' : "b" - >{ y: 2 } : { y: number; } - >y : number -@@= skipped -27, +27 lines =@@ - - /** @param {Array<[string, {x?:number, y?:number}]>} value */ - set x(value) { } -->x : [string, { x?: number; y?: number; }][] -->value : [string, { x?: number; y?: number; }][] -+>x : ((string | { x: number; })[] | (string | { y: number; })[])[] -+>value : ((string | { x: number; })[] | (string | { y: number; })[])[] - - get x() { -->x : [string, { x?: number; y?: number; }][] -+>x : ((string | { x: number; })[] | (string | { y: number; })[])[] - - return [ -->[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ([string, { x: number; }] | [string, { y: number; }])[] -+>[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ((string | { x: number; })[] | (string | { y: number; })[])[] - - ['a', { x: 1 }], -->['a', { x: 1 }] : [string, { x: number; }] -+>['a', { x: 1 }] : (string | { x: number; })[] - >'a' : "a" - >{ x: 1 } : { x: number; } - >x : number - >1 : 1 - - ['b', { y: 2 }] -->['b', { y: 2 }] : [string, { y: number; }] -+>['b', { y: 2 }] : (string | { y: number; })[] - >'b' : "b" - >{ y: 2 } : { y: number; } - >y : number + >[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ([string, { x: number; }] | [string, { y: number; }])[] diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.types.diff index 98fd6fec42..2cda304821 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.types.diff @@ -1,6 +1,10 @@ --- old.contextualTypedSpecialAssignment.types +++ new.contextualTypedSpecialAssignment.types -@@= skipped -7, +7 lines =@@ +@@= skipped -4, +4 lines =@@ + status: 'done' + m(n: number): void + }} DoneStatus */ ++>DoneStatus : any // property assignment var ns = {} @@ -66,7 +70,7 @@ // this-property assignment -@@= skipped -48, +48 lines =@@ +@@= skipped -51, +52 lines =@@ constructor() { /** @type {DoneStatus} */ this.s = { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/enumTag.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/enumTag.errors.txt.diff index b9e53d50eb..62b9f20755 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/enumTag.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/enumTag.errors.txt.diff @@ -3,12 +3,15 @@ @@= skipped -0, +0 lines =@@ -a.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. -a.js(12,5): error TS2322: Type 'string' is not assignable to type 'number'. --a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. -+a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: any; }'. ++a.js(24,13): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? ++a.js(25,12): error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? ++a.js(26,12): error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? ++a.js(35,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? + a.js(37,16): error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. -==== a.js (3 errors) ==== -+==== a.js (1 errors) ==== ++==== a.js (5 errors) ==== /** @enum {string} */ const Target = { START: "start", @@ -28,12 +31,27 @@ OK: 1, /** @type {number} */ FINE: 2, -@@= skipped -45, +39 lines =@@ +@@= skipped -31, +29 lines =@@ + } + + /** @param {Target} t ++ ~~~~~~ ++!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? + * @param {Second} s ++ ~~~~~~ ++!!! error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? + * @param {Fs} f ++ ~~ ++!!! error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? + */ + function consume(t,s,f) { + /** @type {string} */ +@@= skipped -11, +17 lines =@@ + /** @type {(n: number) => number} */ + var fun = f + /** @type {Target} */ ++ ~~~~~~ ++!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? var v = Target.START v = Target.UNKNOWN // error, can't find 'UNKNOWN' ~~~~~~~ --!!! error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; }'. -+!!! error TS2339: Property 'UNKNOWN' does not exist on type '{ START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: any; }'. - v = Second.MISTAKE // meh..ok, I guess? - v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums - } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/enumTag.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/enumTag.types.diff index 936529296d..936126cc00 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/enumTag.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/enumTag.types.diff @@ -1,66 +1,75 @@ --- old.enumTag.types +++ new.enumTag.types -@@= skipped -77, +77 lines =@@ - * @param {Fs} f +@@= skipped -24, +24 lines =@@ + /** @type {number} */ + OK_I_GUESS: 2 + >OK_I_GUESS : number ++>2 : number + >2 : 2 + } + /** @enum number */ +@@= skipped -18, +19 lines =@@ + /** @type {number} */ + FINE: 2, + >FINE : number ++>2 : number + >2 : 2 + } + /** @enum {function(number): number} */ +@@= skipped -36, +37 lines =@@ */ function consume(t,s,f) { -->consume : (t: Target, s: Second, f: Fs) => void + >consume : (t: Target, s: Second, f: Fs) => void ->t : string ->s : number -->f : Fs -+>consume : (t: any, s: any, f: any) => void -+>t : any -+>s : any -+>f : any ++>t : Target ++>s : Second + >f : Fs /** @type {string} */ var str = t -->str : string + >str : string ->t : string -+>str : any -+>t : any ++>t : Target /** @type {number} */ var num = s -->num : number + >num : number ->s : number -+>num : any -+>s : any ++>s : Second /** @type {(n: number) => number} */ var fun = f -->fun : (n: number) => number -->f : Fs -+>fun : any -+>f : any +@@= skipped -21, +21 lines =@@ /** @type {Target} */ var v = Target.START -@@= skipped -48, +48 lines =@@ - } - /** @param {string} s */ - function ff(s) { -->ff : (s: string) => any -->s : string -+>ff : (s: any) => any -+>s : any - - // element access with arbitrary string is an error only with noImplicitAny - if (!Target[s]) { - >!Target[s] : boolean - >Target[s] : any +->v : string ++>v : Target + >Target.START : string >Target : { START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; } -->s : string -+>s : any + >START : string - return null - } -@@= skipped -16, +16 lines =@@ - return Target[s] - >Target[s] : any + v = Target.UNKNOWN // error, can't find 'UNKNOWN' + >v = Target.UNKNOWN : any +->v : string ++>v : Target + >Target.UNKNOWN : any >Target : { START: string; MIDDLE: string; END: string; MISTAKE: number; OK_I_GUESS: number; } -->s : string -+>s : any - } - } + >UNKNOWN : any + + v = Second.MISTAKE // meh..ok, I guess? + >v = Second.MISTAKE : string +->v : string ++>v : Target + >Second.MISTAKE : string + >Second : { MISTAKE: string; OK: number; FINE: number; } + >MISTAKE : string + v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums + >v = 'something else' : "something else" +->v : string ++>v : Target + >'something else' : "something else" + } + /** @param {string} s */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.errors.txt.diff new file mode 100644 index 0000000000..5d55a947a0 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.errors.txt.diff @@ -0,0 +1,36 @@ +--- old.enumTagImported.errors.txt ++++ new.enumTagImported.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++type.js(1,32): error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'. ++type.js(4,29): error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'. ++value.js(2,12): error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'? ++ ++ ++==== type.js (2 errors) ==== ++ /** @typedef {import("./mod1").TestEnum} TE */ ++ ~~~~~~~~ ++!!! error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'. ++ /** @type {TE} */ ++ const test = 'add' ++ /** @type {import("./mod1").TestEnum} */ ++ ~~~~~~~~ ++!!! error TS2694: Namespace '"mod1"' has no exported member 'TestEnum'. ++ const tost = 'remove' ++ ++==== value.js (1 errors) ==== ++ import { TestEnum } from "./mod1" ++ /** @type {TestEnum} */ ++ ~~~~~~~~ ++!!! error TS2749: 'TestEnum' refers to a value, but is being used as a type here. Did you mean 'typeof TestEnum'? ++ const tist = TestEnum.ADD ++ ++ ++==== mod1.js (0 errors) ==== ++ /** @enum {string} */ ++ export const TestEnum = { ++ ADD: 'add', ++ REMOVE: 'remove' ++ } ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff index 7dc569295f..47c3a9ae2d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff @@ -1,17 +1,30 @@ --- old.enumTagImported.types +++ new.enumTagImported.types -@@= skipped -3, +3 lines =@@ +@@= skipped -1, +1 lines =@@ + + === type.js === /** @typedef {import("./mod1").TestEnum} TE */ ++>TE : any ++ /** @type {TE} */ const test = 'add' ->test : string -+>test : "add" ++>test : any >'add' : "add" /** @type {import("./mod1").TestEnum} */ const tost = 'remove' ->tost : string -+>tost : "remove" ++>tost : any >'remove' : "remove" === value.js === +@@= skipped -16, +18 lines =@@ + + /** @type {TestEnum} */ + const tist = TestEnum.ADD +->tist : string ++>tist : TestEnum + >TestEnum.ADD : string + >TestEnum : { ADD: string; REMOVE: string; } + >ADD : string diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagUseBeforeDefCrash.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagUseBeforeDefCrash.errors.txt.diff new file mode 100644 index 0000000000..732a57f4c7 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagUseBeforeDefCrash.errors.txt.diff @@ -0,0 +1,21 @@ +--- old.enumTagUseBeforeDefCrash.errors.txt ++++ new.enumTagUseBeforeDefCrash.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++bug27134.js(7,11): error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? ++ ++ ++==== bug27134.js (1 errors) ==== ++ /** ++ * @enum {number} ++ */ ++ var foo = { }; ++ ++ /** ++ * @type {foo} ++ ~~~ ++!!! error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? ++ */ ++ var s; ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagUseBeforeDefCrash.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagUseBeforeDefCrash.types.diff index 7469ec5e2f..7e3ef556d6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagUseBeforeDefCrash.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagUseBeforeDefCrash.types.diff @@ -5,5 +5,5 @@ */ var s; ->s : number -+>s : any ++>s : foo diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/errorOnFunctionReturnType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/errorOnFunctionReturnType.errors.txt.diff index bf618fbdbf..a85247a036 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/errorOnFunctionReturnType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/errorOnFunctionReturnType.errors.txt.diff @@ -1,6 +1,6 @@ --- old.errorOnFunctionReturnType.errors.txt +++ new.errorOnFunctionReturnType.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -foo.js(7,10): error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. -foo.js(11,12): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -foo.js(13,5): error TS2322: Type 'string' is not assignable to type 'number'. @@ -11,76 +11,78 @@ -foo.js(37,5): error TS2322: Type '"asd"' is not assignable to type 'never'. -foo.js(40,56): error TS2534: A function returning 'never' cannot have a reachable end point. -foo.js(45,18): error TS2534: A function returning 'never' cannot have a reachable end point. -- -- ++foo.js(20,12): error TS2304: Cannot find name 'FunctionReturningPromise'. ++foo.js(44,12): error TS2304: Cannot find name 'FunctionReturningNever'. + + -==== foo.js (10 errors) ==== -- /** -- * @callback FunctionReturningPromise -- * @returns {Promise} -- */ -- -- /** @type {FunctionReturningPromise} */ -- function testPromise1() { ++==== foo.js (2 errors) ==== + /** + * @callback FunctionReturningPromise + * @returns {Promise} +@@= skipped -17, +9 lines =@@ + + /** @type {FunctionReturningPromise} */ + function testPromise1() { - ~~~~~~~~~~~~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. -- console.log("Nope"); -- } -- -- /** @type {FunctionReturningPromise} */ + console.log("Nope"); + } + + /** @type {FunctionReturningPromise} */ - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -- async function testPromise2() { -- return "asd"; + async function testPromise2() { + return "asd"; - ~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. -- } -- -- var testPromise3 = /** @type {FunctionReturningPromise} */ function() { + } + + var testPromise3 = /** @type {FunctionReturningPromise} */ function() { - ~~~~~~~~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. -- console.log("test") -- } -- -- /** @type {FunctionReturningPromise} */ -- var testPromise4 = function() { + console.log("test") + } + + /** @type {FunctionReturningPromise} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'FunctionReturningPromise'. + var testPromise4 = function() { - ~~~~~~~~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. -- console.log("test") -- } -- -- /** -- * @callback FunctionReturningNever -- * @returns {never} -- */ -- -- /** @type {FunctionReturningNever} */ -- function testNever1() { + console.log("test") + } + +@@= skipped -34, +26 lines =@@ + + /** @type {FunctionReturningNever} */ + function testNever1() { - ~~~~~~~~~~ -!!! error TS2534: A function returning 'never' cannot have a reachable end point. -- -- } -- -- /** @type {FunctionReturningNever} */ + + } + + /** @type {FunctionReturningNever} */ - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1065: The return type of an async function or method must be the global Promise type. -!!! related TS1055 foo.js:27:14: Type 'never' is not a valid async function return type in ES5 because it does not refer to a Promise-compatible constructor value. -- async function testNever2() { -- return "asd"; + async function testNever2() { + return "asd"; - ~~~~~~ -!!! error TS2322: Type '"asd"' is not assignable to type 'never'. -- } -- -- var testNever3 = /** @type {FunctionReturningNever} */ function() { + } + + var testNever3 = /** @type {FunctionReturningNever} */ function() { - ~~~~~~~~ -!!! error TS2534: A function returning 'never' cannot have a reachable end point. -- console.log("test") -- } -- -- /** @type {FunctionReturningNever} */ -- var testNever4 = function() { + console.log("test") + } + + /** @type {FunctionReturningNever} */ ++ ~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'FunctionReturningNever'. + var testNever4 = function() { - ~~~~~~~~ -!!! error TS2534: A function returning 'never' cannot have a reachable end point. -- console.log("test") -- } -@@= skipped --1, +1 lines =@@ -+ + console.log("test") + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/errorOnFunctionReturnType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/errorOnFunctionReturnType.types.diff index dd2a3b70df..13c5f7a1b6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/errorOnFunctionReturnType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/errorOnFunctionReturnType.types.diff @@ -28,18 +28,16 @@ console.log("test") >console.log("test") : void -@@= skipped -20, +20 lines =@@ - +@@= skipped -21, +21 lines =@@ /** @type {FunctionReturningPromise} */ var testPromise4 = function() { -->testPromise4 : FunctionReturningPromise + >testPromise4 : FunctionReturningPromise ->function() { console.log("test")} : () => Promise -+>testPromise4 : () => void +>function() { console.log("test")} : () => void console.log("test") >console.log("test") : void -@@= skipped -18, +18 lines =@@ +@@= skipped -17, +17 lines =@@ /** @type {FunctionReturningNever} */ function testNever1() { @@ -65,13 +63,11 @@ console.log("test") >console.log("test") : void -@@= skipped -26, +26 lines =@@ - +@@= skipped -27, +27 lines =@@ /** @type {FunctionReturningNever} */ var testNever4 = function() { -->testNever4 : FunctionReturningNever + >testNever4 : FunctionReturningNever ->function() { console.log("test")} : () => never -+>testNever4 : () => void +>function() { console.log("test")} : () => void console.log("test") diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces.types.diff index 5695e85f5e..ab20ffea84 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/exportNestedNamespaces.types.diff @@ -97,18 +97,16 @@ @param {s.Classic} classic */ function f(c, classic) { ->f : (c: K, classic: s.Classic) => void -->c : K ++>f : (c: K, classic: Classic) => void + >c : K ->classic : s.Classic -+>f : (c: any, classic: any) => void -+>c : any -+>classic : any ++>classic : Classic c.x ->c.x : number -->c : K -->x : number +>c.x : any -+>c : any + >c : K +->x : number +>x : any classic.p @@ -116,7 +114,7 @@ ->classic : s.Classic ->p : number +>classic.p : any -+>classic : any ++>classic : Classic +>p : any } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.errors.txt.diff new file mode 100644 index 0000000000..a8138db37b --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.errors.txt.diff @@ -0,0 +1,24 @@ +--- old.exportedEnumTypeAndValue.errors.txt ++++ new.exportedEnumTypeAndValue.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++use.js(3,12): error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'? ++ ++ ++==== def.js (0 errors) ==== ++ /** @enum {number} */ ++ const MyEnum = { ++ a: 1, ++ b: 2 ++ }; ++ export default MyEnum; ++ ++==== use.js (1 errors) ==== ++ import MyEnum from "./def"; ++ ++ /** @type {MyEnum} */ ++ ~~~~~~ ++!!! error TS2749: 'MyEnum' refers to a value, but is being used as a type here. Did you mean 'typeof MyEnum'? ++ const v = MyEnum.b; ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.types.diff index 38f4bbc212..b829425316 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.types.diff @@ -9,3 +9,12 @@ === use.js === import MyEnum from "./def"; +@@= skipped -8, +8 lines =@@ + + /** @type {MyEnum} */ + const v = MyEnum.b; +->v : number ++>v : MyEnum + >MyEnum.b : number + >MyEnum : { a: number; b: number; } + >b : number diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag1.types.diff index 0fb9e89c63..4fadde1870 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag1.types.diff @@ -1,11 +1,9 @@ --- old.extendsTag1.types +++ new.extendsTag1.types -@@= skipped -5, +5 lines =@@ - * @extends {Set} Should prefer this Set, not the Set in the heritage clause +@@= skipped -6, +6 lines =@@ */ class My extends Set {} -->My : My + >My : My ->Set : Set -+>My : My +>Set : Set diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.errors.txt.diff index 536d568237..02e24c467a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.errors.txt.diff @@ -1,70 +1,62 @@ --- old.extendsTag5.errors.txt +++ new.extendsTag5.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(29,16): error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. - Types of property 'b' are incompatible. - Type 'string' is not assignable to type 'boolean | string[]'. -/a.js(42,16): error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. - Types of property 'b' are incompatible. - Type 'string' is not assignable to type 'boolean | string[]'. -- -- ++/a.js(26,17): error TS2314: Generic type 'A' requires 1 type argument(s). ++/a.js(34,17): error TS2314: Generic type 'A' requires 1 type argument(s). ++/a.js(39,17): error TS2314: Generic type 'A' requires 1 type argument(s). ++/a.js(44,17): error TS2314: Generic type 'A' requires 1 type argument(s). + + -==== /a.js (2 errors) ==== -- /** -- * @typedef {{ -- * a: number | string; -- * b: boolean | string[]; -- * }} Foo -- */ -- -- /** -- * @template {Foo} T -- */ -- class A { -- /** -- * @param {T} a -- */ -- constructor(a) { -- return a -- } -- } -- -- /** -- * @extends {A<{ -- * a: string, -- * b: string[] -- * }>} -- */ -- class B extends A {} -- -- /** -- * @extends {A<{ ++==== /a.js (4 errors) ==== + /** + * @typedef {{ + * a: number | string; +@@= skipped -32, +30 lines =@@ + * }>} + */ + class B extends A {} ++ ~ ++!!! error TS2314: Generic type 'A' requires 1 type argument(s). + + /** + * @extends {A<{ - ~ -- * a: string, + * a: string, - ~~~~~~~~~~~~~~~~~ -- * b: string + * b: string - ~~~~~~~~~~~~~~~~ -- * }>} + * }>} - ~~~~ -!!! error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. -!!! error TS2344: Types of property 'b' are incompatible. -!!! error TS2344: Type 'string' is not assignable to type 'boolean | string[]'. -- */ -- class C extends A {} -- -- /** -- * @extends {A<{a: string, b: string[]}>} -- */ -- class D extends A {} -- -- /** -- * @extends {A<{a: string, b: string}>} + */ + class C extends A {} ++ ~ ++!!! error TS2314: Generic type 'A' requires 1 type argument(s). + + /** + * @extends {A<{a: string, b: string[]}>} + */ + class D extends A {} ++ ~ ++!!! error TS2314: Generic type 'A' requires 1 type argument(s). + + /** + * @extends {A<{a: string, b: string}>} - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. -!!! error TS2344: Types of property 'b' are incompatible. -!!! error TS2344: Type 'string' is not assignable to type 'boolean | string[]'. -- */ -- class E extends A {} -- -@@= skipped --1, +1 lines =@@ -+ + */ + class E extends A {} ++ ~ ++!!! error TS2314: Generic type 'A' requires 1 type argument(s). + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.types.diff index 07ee706aa1..778936d0bd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.types.diff @@ -1,31 +1,20 @@ --- old.extendsTag5.types +++ new.extendsTag5.types -@@= skipped -11, +11 lines =@@ - * @template {Foo} T +@@= skipped -5, +5 lines =@@ + * a: number | string; + * b: boolean | string[]; + * }} Foo ++>Foo : any ++ */ - class A { -->A : A -+>A : A - /** - * @param {T} a - */ - constructor(a) { -->a : T -+>a : any - - return a -->a : T -+>a : any - } - } - -@@= skipped -21, +21 lines =@@ + /** +@@= skipped -27, +29 lines =@@ */ class B extends A {} >B : B ->A : A<{ a: string; b: string[]; }> -+>A : A ++>A : typeof A /** * @extends {A<{ @@ -34,7 +23,7 @@ class C extends A {} >C : C ->A : A<{ a: string; b: string; }> -+>A : A ++>A : typeof A /** * @extends {A<{a: string, b: string[]}>} @@ -42,7 +31,7 @@ class D extends A {} >D : D ->A : A<{ a: string; b: string[]; }> -+>A : A ++>A : typeof A /** * @extends {A<{a: string, b: string}>} @@ -50,5 +39,5 @@ class E extends A {} >E : E ->A : A<{ a: string; b: string; }> -+>A : A ++>A : typeof A diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/genericSetterInClassTypeJsDoc.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/genericSetterInClassTypeJsDoc.types.diff index 266cfe8dc9..40a70fe190 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/genericSetterInClassTypeJsDoc.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/genericSetterInClassTypeJsDoc.types.diff @@ -1,11 +1,7 @@ --- old.genericSetterInClassTypeJsDoc.types +++ new.genericSetterInClassTypeJsDoc.types -@@= skipped -4, +4 lines =@@ - * @template T - */ - class Box { -->Box : Box -+>Box : Box +@@= skipped -7, +7 lines =@@ + >Box : Box #value; ->#value : T @@ -13,17 +9,14 @@ /** @param {T} initialValue */ constructor(initialValue) { -->initialValue : T -+>initialValue : any +@@= skipped -8, +8 lines =@@ this.#value = initialValue; -->this.#value = initialValue : T + >this.#value = initialValue : T ->this.#value : T -+>this.#value = initialValue : any +>this.#value : any >this : this -->initialValue : T -+>initialValue : any + >initialValue : T } /** @type {T} */ @@ -57,9 +50,8 @@ new Box(3).value = 3; >new Box(3).value = 3 : 3 ->new Box(3).value : number -->new Box(3) : Box +>new Box(3).value : any -+>new Box(3) : Box + >new Box(3) : Box >Box : typeof Box >3 : 3 ->value : number diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag1.errors.txt.diff new file mode 100644 index 0000000000..045636af04 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag1.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.importTag1.errors.txt ++++ new.importTag1.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(6,13): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface Foo { ++ a: number; ++ } ++ ++==== /foo.js (1 errors) ==== ++ /** ++ * @import { Foo } from "./types" ++ */ ++ ++ /** ++ * @param { Foo } foo ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ */ ++ function f(foo) {} ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag1.types.diff deleted file mode 100644 index 17fbfed2ff..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag1.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.importTag1.types -+++ new.importTag1.types -@@= skipped -14, +14 lines =@@ - * @param { Foo } foo - */ - function f(foo) {} -->f : (foo: Foo) => void -->foo : Foo -+>f : (foo: any) => void -+>foo : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=es2015).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=es2015).errors.txt.diff index fe54c81fd5..619cb1400c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=es2015).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=es2015).errors.txt.diff @@ -1,23 +1,25 @@ --- old.importTag15(module=es2015).errors.txt +++ new.importTag15(module=es2015).errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -1.js(1,30): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.js(2,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -- -- --==== 0.ts (0 errors) ==== -- export interface I { } -- ++1.js(4,13): error TS2304: Cannot find name 'I'. + + + ==== 0.ts (0 errors) ==== + export interface I { } + -==== 1.js (2 errors) ==== -- /** @import { I } from './0' with { type: "json" } */ ++==== 1.js (1 errors) ==== + /** @import { I } from './0' with { type: "json" } */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -- /** @import * as foo from './0' with { type: "json" } */ + /** @import * as foo from './0' with { type: "json" } */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -- -- /** @param {I} a */ -- function f(a) {} -- -@@= skipped --1, +1 lines =@@ -+ + + /** @param {I} a */ ++ ~ ++!!! error TS2304: Cannot find name 'I'. + function f(a) {} + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=es2015).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=es2015).types.diff deleted file mode 100644 index d69c0efeac..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=es2015).types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.importTag15(module=es2015).types -+++ new.importTag15(module=es2015).types -@@= skipped -9, +9 lines =@@ - - /** @param {I} a */ - function f(a) {} -->f : (a: I) => void -->a : I -+>f : (a: any) => void -+>a : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=esnext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=esnext).errors.txt.diff index 89c48b23da..3f390debf8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=esnext).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=esnext).errors.txt.diff @@ -1,23 +1,25 @@ --- old.importTag15(module=esnext).errors.txt +++ new.importTag15(module=esnext).errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -1.js(1,30): error TS2857: Import attributes cannot be used with type-only imports or exports. -1.js(2,33): error TS2857: Import attributes cannot be used with type-only imports or exports. -- -- --==== 0.ts (0 errors) ==== -- export interface I { } -- ++1.js(4,13): error TS2304: Cannot find name 'I'. + + + ==== 0.ts (0 errors) ==== + export interface I { } + -==== 1.js (2 errors) ==== -- /** @import { I } from './0' with { type: "json" } */ ++==== 1.js (1 errors) ==== + /** @import { I } from './0' with { type: "json" } */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2857: Import attributes cannot be used with type-only imports or exports. -- /** @import * as foo from './0' with { type: "json" } */ + /** @import * as foo from './0' with { type: "json" } */ - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2857: Import attributes cannot be used with type-only imports or exports. -- -- /** @param {I} a */ -- function f(a) {} -- -@@= skipped --1, +1 lines =@@ -+ + + /** @param {I} a */ ++ ~ ++!!! error TS2304: Cannot find name 'I'. + function f(a) {} + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=esnext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=esnext).types.diff deleted file mode 100644 index d0ba8678b7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag15(module=esnext).types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.importTag15(module=esnext).types -+++ new.importTag15(module=esnext).types -@@= skipped -9, +9 lines =@@ - - /** @param {I} a */ - function f(a) {} -->f : (a: I) => void -->a : I -+>f : (a: any) => void -+>a : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag16.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag16.errors.txt.diff new file mode 100644 index 0000000000..a2ed8030b1 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag16.errors.txt.diff @@ -0,0 +1,26 @@ +--- old.importTag16.errors.txt ++++ new.importTag16.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++b.js(4,12): error TS2304: Cannot find name 'Foo'. ++b.js(5,12): error TS2304: Cannot find name 'I'. ++ ++ ++==== a.ts (0 errors) ==== ++ export default interface Foo {} ++ export interface I {} ++ ++==== b.js (2 errors) ==== ++ /** @import Foo, { I } from "./a" */ ++ ++ /** ++ * @param {Foo} a ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ * @param {I} b ++ ~ ++!!! error TS2304: Cannot find name 'I'. ++ */ ++ export function foo(a, b) {} ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag16.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag16.types.diff deleted file mode 100644 index dc2234939f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag16.types.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.importTag16.types -+++ new.importTag16.types -@@= skipped -12, +12 lines =@@ - * @param {I} b - */ - export function foo(a, b) {} -->foo : (a: Foo, b: I) => void -->a : Foo -->b : I -+>foo : (a: any, b: any) => void -+>a : any -+>b : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag17.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag17.errors.txt.diff index ec2074c7cf..3dba612b3e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag17.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag17.errors.txt.diff @@ -1,49 +1,34 @@ --- old.importTag17.errors.txt +++ new.importTag17.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/a.js(8,5): error TS2322: Type '1' is not assignable to type '"module"'. -/a.js(15,5): error TS2322: Type '1' is not assignable to type '"script"'. -- -- --==== /node_modules/@types/foo/package.json (0 errors) ==== -- { -- "name": "@types/foo", -- "version": "1.0.0", -- "exports": { -- ".": { -- "import": "./index.d.mts", -- "require": "./index.d.cts" -- } -- } -- } -- --==== /node_modules/@types/foo/index.d.mts (0 errors) ==== -- export declare const Import: "module"; -- --==== /node_modules/@types/foo/index.d.cts (0 errors) ==== -- export declare const Require: "script"; -- --==== /a.js (2 errors) ==== -- /** @import { Import } from 'foo' with { 'resolution-mode': 'import' } */ -- /** @import { Require } from 'foo' with { 'resolution-mode': 'require' } */ -- -- /** -- * @returns { Import } -- */ -- export function f1() { -- return 1; ++/a.js(5,15): error TS2304: Cannot find name 'Import'. ++/a.js(12,15): error TS2552: Cannot find name 'Require'. Did you mean 'Required'? + + + ==== /node_modules/@types/foo/package.json (0 errors) ==== +@@= skipped -25, +25 lines =@@ + + /** + * @returns { Import } ++ ~~~~~~ ++!!! error TS2304: Cannot find name 'Import'. + */ + export function f1() { + return 1; - ~~~~~~ -!!! error TS2322: Type '1' is not assignable to type '"module"'. -- } -- -- /** -- * @returns { Require } -- */ -- export function f2() { -- return 1; + } + + /** + * @returns { Require } ++ ~~~~~~~ ++!!! error TS2552: Cannot find name 'Require'. Did you mean 'Required'? + */ + export function f2() { + return 1; - ~~~~~~ -!!! error TS2322: Type '1' is not assignable to type '"script"'. -- } -- -@@= skipped --1, +1 lines =@@ -+ + } + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag17.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag17.types.diff index d2e7715edc..91ff3e5da5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag17.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag17.types.diff @@ -5,7 +5,7 @@ */ export function f1() { ->f1 : () => "module" -+>f1 : () => number ++>f1 : () => Import return 1; >1 : 1 @@ -14,7 +14,7 @@ */ export function f2() { ->f2 : () => "script" -+>f2 : () => number ++>f2 : () => Require return 1; >1 : 1 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag18.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag18.errors.txt.diff new file mode 100644 index 0000000000..8895183edb --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag18.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.importTag18.errors.txt ++++ new.importTag18.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++b.js(8,12): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== a.ts (0 errors) ==== ++ export interface Foo {} ++ ++==== b.js (1 errors) ==== ++ /** ++ * @import { ++ * Foo ++ * } from "./a" ++ */ ++ ++ /** ++ * @param {Foo} a ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ */ ++ export function foo(a) {} ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag18.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag18.types.diff deleted file mode 100644 index c1977a12ed..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag18.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.importTag18.types -+++ new.importTag18.types -@@= skipped -14, +14 lines =@@ - * @param {Foo} a - */ - export function foo(a) {} -->foo : (a: Foo) => void -->a : Foo -+>foo : (a: any) => void -+>a : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag19.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag19.errors.txt.diff new file mode 100644 index 0000000000..8839708644 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag19.errors.txt.diff @@ -0,0 +1,24 @@ +--- old.importTag19.errors.txt ++++ new.importTag19.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++b.js(7,12): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== a.ts (0 errors) ==== ++ export interface Foo {} ++ ++==== b.js (1 errors) ==== ++ /** ++ * @import { Foo } ++ * from "./a" ++ */ ++ ++ /** ++ * @param {Foo} a ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ */ ++ export function foo(a) {} ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag19.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag19.types.diff deleted file mode 100644 index 86aa75f19c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag19.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.importTag19.types -+++ new.importTag19.types -@@= skipped -13, +13 lines =@@ - * @param {Foo} a - */ - export function foo(a) {} -->foo : (a: Foo) => void -->a : Foo -+>foo : (a: any) => void -+>a : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag2.errors.txt.diff new file mode 100644 index 0000000000..68b2074596 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag2.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.importTag2.errors.txt ++++ new.importTag2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(6,13): error TS2503: Cannot find namespace 'types'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface Foo { ++ a: number; ++ } ++ ++==== /foo.js (1 errors) ==== ++ /** ++ * @import * as types from "./types" ++ */ ++ ++ /** ++ * @param { types.Foo } foo ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'types'. ++ */ ++ export function f(foo) {} ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag2.types.diff index 415341d645..1a2653c0a1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag2.types.diff @@ -6,6 +6,6 @@ export function f(foo) {} ->f : (foo: types.Foo) => void ->foo : types.Foo -+>f : (foo: any) => void -+>foo : any ++>f : (foo: Foo) => void ++>foo : Foo diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag20.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag20.errors.txt.diff new file mode 100644 index 0000000000..3001e176c7 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag20.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.importTag20.errors.txt ++++ new.importTag20.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++b.js(8,12): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== a.ts (0 errors) ==== ++ export interface Foo {} ++ ++==== b.js (1 errors) ==== ++ /** ++ * @import ++ * { Foo ++ * } from './a' ++ */ ++ ++ /** ++ * @param {Foo} a ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ */ ++ export function foo(a) {} ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag20.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag20.types.diff deleted file mode 100644 index 6d8880355f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag20.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.importTag20.types -+++ new.importTag20.types -@@= skipped -14, +14 lines =@@ - * @param {Foo} a - */ - export function foo(a) {} -->foo : (a: Foo) => void -->a : Foo -+>foo : (a: any) => void -+>a : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag3.errors.txt.diff new file mode 100644 index 0000000000..31d34ac710 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag3.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.importTag3.errors.txt ++++ new.importTag3.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(6,13): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export default interface Foo { ++ a: number; ++ } ++ ++==== /foo.js (1 errors) ==== ++ /** ++ * @import Foo from "./types" ++ */ ++ ++ /** ++ * @param { Foo } foo ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ */ ++ export function f(foo) {} ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag3.types.diff deleted file mode 100644 index d7bc1b030e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag3.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.importTag3.types -+++ new.importTag3.types -@@= skipped -14, +14 lines =@@ - * @param { Foo } foo - */ - export function f(foo) {} -->f : (foo: Foo) => void -->foo : Foo -+>f : (foo: any) => void -+>foo : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag4.errors.txt.diff index 816497509b..8f00ca389e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag4.errors.txt.diff @@ -1,32 +1,34 @@ --- old.importTag4.errors.txt +++ new.importTag4.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -/foo.js(2,14): error TS2300: Duplicate identifier 'Foo'. -/foo.js(6,14): error TS2300: Duplicate identifier 'Foo'. -- -- --==== /types.ts (0 errors) ==== -- export interface Foo { -- a: number; -- } -- ++/foo.js(10,13): error TS2304: Cannot find name 'Foo'. + + + ==== /types.ts (0 errors) ==== +@@= skipped -6, +5 lines =@@ + a: number; + } + -==== /foo.js (2 errors) ==== -- /** -- * @import { Foo } from "./types" ++==== /foo.js (1 errors) ==== + /** + * @import { Foo } from "./types" - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -- */ -- -- /** -- * @import { Foo } from "./types" + */ + + /** + * @import { Foo } from "./types" - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -- */ -- -- /** -- * @param { Foo } foo -- */ -- function f(foo) {} -- -@@= skipped --1, +1 lines =@@ -+ + */ + + /** + * @param { Foo } foo ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. + */ + function f(foo) {} + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag4.types.diff deleted file mode 100644 index e5a87a9213..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag4.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.importTag4.types -+++ new.importTag4.types -@@= skipped -18, +18 lines =@@ - * @param { Foo } foo - */ - function f(foo) {} -->f : (foo: Foo) => void -->foo : Foo -+>f : (foo: any) => void -+>foo : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag5.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag5.errors.txt.diff new file mode 100644 index 0000000000..25bcd83984 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag5.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.importTag5.errors.txt ++++ new.importTag5.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(6,13): error TS2304: Cannot find name 'Foo'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface Foo { ++ a: number; ++ } ++ ++==== /foo.js (1 errors) ==== ++ /** ++ * @import { Foo } from "./types" ++ */ ++ ++ /** ++ * @param { Foo } foo ++ ~~~ ++!!! error TS2304: Cannot find name 'Foo'. ++ */ ++ function f(foo) {} ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag5.types.diff deleted file mode 100644 index fc57194afc..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag5.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.importTag5.types -+++ new.importTag5.types -@@= skipped -14, +14 lines =@@ - * @param { Foo } foo - */ - function f(foo) {} -->f : (foo: Foo) => void -->foo : Foo -+>f : (foo: any) => void -+>foo : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag6.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag6.errors.txt.diff new file mode 100644 index 0000000000..51eb4dfd60 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag6.errors.txt.diff @@ -0,0 +1,35 @@ +--- old.importTag6.errors.txt ++++ new.importTag6.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(9,13): error TS2304: Cannot find name 'A'. ++/foo.js(10,13): error TS2304: Cannot find name 'B'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface A { ++ a: number; ++ } ++ export interface B { ++ a: number; ++ } ++ ++==== /foo.js (2 errors) ==== ++ /** ++ * @import { ++ * A, ++ * B, ++ * } from "./types" ++ */ ++ ++ /** ++ * @param { A } a ++ ~ ++!!! error TS2304: Cannot find name 'A'. ++ * @param { B } b ++ ~ ++!!! error TS2304: Cannot find name 'B'. ++ */ ++ function f(a, b) {} ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag6.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag6.types.diff deleted file mode 100644 index 9e41357a2d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag6.types.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.importTag6.types -+++ new.importTag6.types -@@= skipped -22, +22 lines =@@ - * @param { B } b - */ - function f(a, b) {} -->f : (a: A, b: B) => void -->a : A -->b : B -+>f : (a: any, b: any) => void -+>a : any -+>b : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag7.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag7.errors.txt.diff new file mode 100644 index 0000000000..7e454e8a8a --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag7.errors.txt.diff @@ -0,0 +1,34 @@ +--- old.importTag7.errors.txt ++++ new.importTag7.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(8,13): error TS2304: Cannot find name 'A'. ++/foo.js(9,13): error TS2304: Cannot find name 'B'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface A { ++ a: number; ++ } ++ export interface B { ++ a: number; ++ } ++ ++==== /foo.js (2 errors) ==== ++ /** ++ * @import { ++ * A, ++ * B } from "./types" ++ */ ++ ++ /** ++ * @param { A } a ++ ~ ++!!! error TS2304: Cannot find name 'A'. ++ * @param { B } b ++ ~ ++!!! error TS2304: Cannot find name 'B'. ++ */ ++ function f(a, b) {} ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag7.types.diff deleted file mode 100644 index 44f05adfce..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag7.types.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.importTag7.types -+++ new.importTag7.types -@@= skipped -21, +21 lines =@@ - * @param { B } b - */ - function f(a, b) {} -->f : (a: A, b: B) => void -->a : A -->b : B -+>f : (a: any, b: any) => void -+>a : any -+>b : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag8.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag8.errors.txt.diff new file mode 100644 index 0000000000..9bb7bbb81c --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag8.errors.txt.diff @@ -0,0 +1,34 @@ +--- old.importTag8.errors.txt ++++ new.importTag8.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(8,13): error TS2304: Cannot find name 'A'. ++/foo.js(9,13): error TS2304: Cannot find name 'B'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface A { ++ a: number; ++ } ++ export interface B { ++ a: number; ++ } ++ ++==== /foo.js (2 errors) ==== ++ /** ++ * @import ++ * { A, B } ++ * from "./types" ++ */ ++ ++ /** ++ * @param { A } a ++ ~ ++!!! error TS2304: Cannot find name 'A'. ++ * @param { B } b ++ ~ ++!!! error TS2304: Cannot find name 'B'. ++ */ ++ function f(a, b) {} ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag8.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag8.types.diff deleted file mode 100644 index 0755b706a9..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag8.types.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.importTag8.types -+++ new.importTag8.types -@@= skipped -21, +21 lines =@@ - * @param { B } b - */ - function f(a, b) {} -->f : (a: A, b: B) => void -->a : A -->b : B -+>f : (a: any, b: any) => void -+>a : any -+>b : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag9.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag9.errors.txt.diff new file mode 100644 index 0000000000..047a55a6c9 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag9.errors.txt.diff @@ -0,0 +1,34 @@ +--- old.importTag9.errors.txt ++++ new.importTag9.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/foo.js(8,13): error TS2503: Cannot find namespace 'types'. ++/foo.js(9,13): error TS2503: Cannot find namespace 'types'. ++ ++ ++==== /types.ts (0 errors) ==== ++ export interface A { ++ a: number; ++ } ++ export interface B { ++ a: number; ++ } ++ ++==== /foo.js (2 errors) ==== ++ /** ++ * @import ++ * * as types ++ * from "./types" ++ */ ++ ++ /** ++ * @param { types.A } a ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'types'. ++ * @param { types.B } b ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'types'. ++ */ ++ function f(a, b) {} ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag9.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag9.types.diff index 2a7f6d4ead..a9af23b03a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag9.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag9.types.diff @@ -7,7 +7,7 @@ ->f : (a: types.A, b: types.B) => void ->a : types.A ->b : types.B -+>f : (a: any, b: any) => void -+>a : any -+>b : any ++>f : (a: A, b: B) => void ++>a : A ++>b : B diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTypeInJSDoc.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTypeInJSDoc.types.diff index 89ded2bbed..73bc3119dd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTypeInJSDoc.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTypeInJSDoc.types.diff @@ -9,16 +9,22 @@ >MyClass : any } declare global { -@@= skipped -19, +19 lines =@@ +@@= skipped -16, +16 lines =@@ + === index.js === + /** + * @typedef {import("./externs")} Foo ++>Foo : any ++ */ let a = /** @type {Foo} */(/** @type {*} */(undefined)); ->a : import("externs") ->(/** @type {*} */(undefined)) : import("externs") -->(undefined) : any -+>a : any -+>(/** @type {*} */(undefined)) : undefined -+>(undefined) : undefined ++>a : MyClass ++>(/** @type {*} */(undefined)) : MyClass ++>(undefined) : MyClass + >(undefined) : any ++>undefined : any >undefined : undefined a = new Foo({doer: Foo.Bar}); @@ -27,7 +33,7 @@ ->new Foo({doer: Foo.Bar}) : import("externs") ->Foo : typeof import("externs") +>a = new Foo({doer: Foo.Bar}) : MyClass -+>a : any ++>a : MyClass +>new Foo({doer: Foo.Bar}) : MyClass +>Foo : typeof MyClass >{doer: Foo.Bar} : { doer: (x: string, y?: number) => void; } @@ -40,28 +46,18 @@ const q = /** @type {import("./externs").Bar} */({ doer: q => q }); ->q : import("externs").Bar ->({ doer: q => q }) : import("externs").Bar -->{ doer: q => q } : { doer: (q: string) => string; } -->doer : (q: string) => string -->q => q : (q: string) => string -->q : string -->q : string -+>q : { doer: (q: any) => any; } -+>({ doer: q => q }) : { doer: (q: any) => any; } -+>{ doer: q => q } : { doer: (q: any) => any; } -+>doer : (q: any) => any -+>q => q : (q: any) => any -+>q : any -+>q : any - ++>q : Bar ++>({ doer: q => q }) : Bar ++>{ doer: q => q } : Bar + >{ doer: q => q } : { doer: (q: string) => string; } + >doer : (q: string) => string + >q => q : (q: string) => string +@@= skipped -31, +36 lines =@@ const r = /** @type {typeof import("./externs").Bar} */(r => r); -->r : (x: string, y?: number) => void -->(r => r) : (x: string, y?: number) => void -->r => r : (r: string) => string -->r : string -->r : string -+>r : (r: any) => any -+>(r => r) : (r: any) => any -+>r => r : (r: any) => any -+>r : any -+>r : any - + >r : (x: string, y?: number) => void + >(r => r) : (x: string, y?: number) => void ++>r => r : (x: string, y?: number) => void ++>Bar : any + >r => r : (r: string) => string + >r : string + >r : string diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importingExportingTypes.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importingExportingTypes.errors.txt.diff index 409f61b696..c7f4d7ee38 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importingExportingTypes.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importingExportingTypes.errors.txt.diff @@ -6,17 +6,16 @@ -/index.js(5,10): error TS18043: Types cannot appear in export declarations in JavaScript files. -/index.js(6,10): error TS18043: Types cannot appear in export declarations in JavaScript files. -/index.js(7,10): error TS18043: Types cannot appear in export declarations in JavaScript files. -+/index.js(5,10): error TS2304: Cannot find name 'JSDocType'. -+/index.js(6,10): error TS2304: Cannot find name 'JSDocType'. ++/index.js(5,10): error TS2484: Export declaration conflicts with exported declaration of 'JSDocType'. ==== /node_modules/@types/node/index.d.ts (0 errors) ==== -@@= skipped -10, +7 lines =@@ +@@= skipped -10, +6 lines =@@ export function writeFile(path: string, data: any, options: WriteFileOptions, callback: (err: Error) => void): void; } -==== /index.js (5 errors) ==== -+==== /index.js (2 errors) ==== ++==== /index.js (1 errors) ==== import { writeFile, WriteFileOptions, WriteFileOptions as OtherName } from "fs"; - ~~~~~~~~~~~~~~~~ -!!! error TS18042: 'WriteFileOptions' is a type and cannot be imported in JavaScript files. Use 'import("fs").WriteFileOptions' in a JSDoc type annotation. @@ -29,12 +28,11 @@ ~~~~~~~~~ -!!! error TS18043: Types cannot appear in export declarations in JavaScript files. -!!! related TS18044 /index.js:3:5: 'JSDocType' is automatically exported here. -+!!! error TS2304: Cannot find name 'JSDocType'. ++!!! error TS2484: Export declaration conflicts with exported declaration of 'JSDocType'. export { JSDocType as ThisIsFine }; - ~~~~~~~~~ +- ~~~~~~~~~ -!!! error TS18043: Types cannot appear in export declarations in JavaScript files. -!!! related TS18044 /index.js:3:5: 'JSDocType' is automatically exported here. -+!!! error TS2304: Cannot find name 'JSDocType'. export { WriteFileOptions }; - ~~~~~~~~~~~~~~~~ -!!! error TS18043: Types cannot appear in export declarations in JavaScript files. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importingExportingTypes.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importingExportingTypes.types.diff new file mode 100644 index 0000000000..401926d2f8 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importingExportingTypes.types.diff @@ -0,0 +1,11 @@ +--- old.importingExportingTypes.types ++++ new.importingExportingTypes.types +@@= skipped -21, +21 lines =@@ + >OtherName : any + + /** @typedef {{ x: any }} JSDocType */ ++>JSDocType : any ++>x : any + + export { JSDocType }; + >JSDocType : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/inferThis.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/inferThis.errors.txt.diff new file mode 100644 index 0000000000..6e04c6303d --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/inferThis.errors.txt.diff @@ -0,0 +1,45 @@ +--- old.inferThis.errors.txt ++++ new.inferThis.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++/a.js(8,9): error TS2322: Type 'typeof C' is not assignable to type 'T'. ++ 'T' could be instantiated with an arbitrary type which could be unrelated to 'typeof C'. ++/a.js(17,9): error TS2322: Type 'this' is not assignable to type 'T'. ++ 'T' could be instantiated with an arbitrary type which could be unrelated to 'this'. ++ ++ ++==== /a.js (2 errors) ==== ++ export class C { ++ /** ++ * @template T ++ * @this {T} ++ * @return {T} ++ */ ++ static a() { ++ return this; ++ ~~~~~~ ++!!! error TS2322: Type 'typeof C' is not assignable to type 'T'. ++!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'typeof C'. ++ } ++ ++ /** ++ * @template T ++ * @this {T} ++ * @return {T} ++ */ ++ b() { ++ return this; ++ ~~~~~~ ++!!! error TS2322: Type 'this' is not assignable to type 'T'. ++!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'this'. ++ } ++ } ++ ++ const a = C.a(); ++ a; // typeof C ++ ++ const c = new C(); ++ const b = c.b(); ++ b; // C ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/inferThis.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/inferThis.types.diff index 7444ed2873..d4b30d42ba 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/inferThis.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/inferThis.types.diff @@ -5,7 +5,7 @@ */ static a() { ->a : (this: T) => T -+>a : () => typeof C ++>a : () => T return this; ->this : T @@ -18,7 +18,7 @@ */ b() { ->b : (this: T) => T -+>b : () => this ++>b : () => T return this; ->this : T @@ -27,25 +27,37 @@ } const a = C.a(); - >a : typeof C - >C.a() : typeof C +->a : typeof C +->C.a() : typeof C ->C.a : (this: T) => T -+>C.a : () => typeof C ++>a : unknown ++>C.a() : unknown ++>C.a : () => T >C : typeof C ->a : (this: T) => T -+>a : () => typeof C ++>a : () => T a; // typeof C - >a : typeof C -@@= skipped -25, +25 lines =@@ +->a : typeof C ++>a : unknown + + const c = new C(); + >c : C +@@= skipped -23, +23 lines =@@ + >C : typeof C + const b = c.b(); - >b : C - >c.b() : C +->b : C +->c.b() : C ->c.b : (this: T) => T -+>c.b : () => C ++>b : unknown ++>c.b() : unknown ++>c.b : () => T >c : C ->b : (this: T) => T -+>b : () => C ++>b : () => T b; // C - >b : C +->b : C ++>b : unknown + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff new file mode 100644 index 0000000000..b2e4887db6 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff @@ -0,0 +1,30 @@ +--- old.instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt ++++ new.instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++instantiateTemplateTagTypeParameterOnVariableStatement.js(3,12): error TS2304: Cannot find name 'T'. ++instantiateTemplateTagTypeParameterOnVariableStatement.js(4,18): error TS2304: Cannot find name 'T'. ++instantiateTemplateTagTypeParameterOnVariableStatement.js(4,24): error TS2304: Cannot find name 'T'. ++ ++ ++==== instantiateTemplateTagTypeParameterOnVariableStatement.js (3 errors) ==== ++ /** ++ * @template T ++ * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ * @returns {(b: T) => T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ const seq = a => b => b; ++ ++ const text1 = "hello"; ++ const text2 = "world"; ++ ++ /** @type {string} */ ++ var text3 = seq(text1)(text2); ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types.diff index 6194ff1bf7..0a221061c3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types.diff @@ -1,36 +1,13 @@ --- old.instantiateTemplateTagTypeParameterOnVariableStatement.types +++ new.instantiateTemplateTagTypeParameterOnVariableStatement.types -@@= skipped -6, +6 lines =@@ - * @returns {(b: T) => T} - */ - const seq = a => b => b; -->seq : (a: T) => (b: T) => T -->a => b => b : (a: T) => (b: T) => T -->a : T -->b => b : (b: T) => T -->b : T -->b : T -+>seq : (a: any) => (b: any) => any -+>a => b => b : (a: any) => (b: any) => any -+>a : any -+>b => b : (b: any) => any -+>b : any -+>b : any - - const text1 = "hello"; - >text1 : "hello" -@@= skipped -17, +17 lines =@@ - +@@= skipped -24, +24 lines =@@ /** @type {string} */ var text3 = seq(text1)(text2); -->text3 : string + >text3 : string ->seq(text1)(text2) : string ->seq(text1) : (b: string) => string -->seq : (a: T) => (b: T) => T -+>text3 : any -+>seq(text1)(text2) : any -+>seq(text1) : (b: any) => any -+>seq : (a: any) => (b: any) => any ++>seq(text1)(text2) : T ++>seq(text1) : (b: T) => T + >seq : (a: T) => (b: T) => T >text1 : "hello" >text2 : "world" - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassImplementsGenericsSerialization.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassImplementsGenericsSerialization.types.diff index 640e6a870a..7ad9860f66 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassImplementsGenericsSerialization.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassImplementsGenericsSerialization.types.diff @@ -9,21 +9,3 @@ >value : T } === lib.js === -@@= skipped -9, +9 lines =@@ - * @implements {IEncoder} - */ - export class Encoder { -->Encoder : Encoder -+>Encoder : Encoder - - /** - * @param {T} value - */ - encode(value) { -->encode : (value: T) => Uint8Array -->value : T -+>encode : (value: any) => Uint8Array -+>value : any - - return new Uint8Array(0) - >new Uint8Array(0) : Uint8Array diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassMethod.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassMethod.types.diff index 58a8213d60..5da9370558 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassMethod.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassMethod.types.diff @@ -94,28 +94,7 @@ } class C2 { -@@= skipped -24, +24 lines =@@ - * @returns {number} - */ - method1(x, y) { -->method1 : (x: number, y: number) => number -->x : number -->y : number -+>method1 : (x: any, y: any) => any -+>x : any -+>y : any - - return x + y; -->x + y : number -->x : number -->y : number -+>x + y : any -+>x : any -+>y : any - } - } - -@@= skipped -18, +18 lines =@@ +@@= skipped -42, +42 lines =@@ * @returns {number} */ C2.prototype.method2 = function (x, y) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.errors.txt.diff index 4389d4e7fc..1bec95b21f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.errors.txt.diff @@ -7,11 +7,12 @@ +index.js(139,14): error TS2339: Property 'p2' does not exist on type 'K'. +index.js(143,21): error TS2339: Property 'p1' does not exist on type 'K'. +index.js(151,14): error TS2339: Property 'prop' does not exist on type 'M'. -+index.js(165,14): error TS2339: Property 'another' does not exist on type 'N'. -+index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. ++index.js(165,14): error TS2339: Property 'another' does not exist on type 'N'. ++index.js(173,24): error TS2314: Generic type 'N' requires 1 type argument(s). ++index.js(179,14): error TS2339: Property 'another2' does not exist on type 'O'. + + -+==== index.js (6 errors) ==== ++==== index.js (7 errors) ==== + export class A {} + + export class B { @@ -186,7 +187,7 @@ + super(); + this.another = param; + ~~~~~~~ -+!!! error TS2339: Property 'another' does not exist on type 'N'. ++!!! error TS2339: Property 'another' does not exist on type 'N'. + } + } + @@ -195,6 +196,8 @@ + * @extends {N} + */ + export class O extends N { ++ ~ ++!!! error TS2314: Generic type 'N' requires 1 type argument(s). + /** + * @param {U} param + */ @@ -202,7 +205,7 @@ + super(param); + this.another2 = param; + ~~~~~~~~ -+!!! error TS2339: Property 'another2' does not exist on type 'O'. ++!!! error TS2339: Property 'another2' does not exist on type 'O'. + } + } + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.types.diff index f0d3a6abed..0d9c718bdb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.types.diff @@ -1,162 +1,22 @@ --- old.jsDeclarationsClasses.types +++ new.jsDeclarationsClasses.types -@@= skipped -27, +27 lines =@@ - * @param {number} b - */ - constructor(a, b) {} -->a : number -->b : number -+>a : any -+>b : any - } - - /** - * @template T,U - */ - export class E { -->E : E -+>E : E - - /** - * @type {T & U} - */ - field; -->field : T & U -+>field : any - - // @readonly is currently unsupported, it seems - included here just in case that changes - /** -@@= skipped -22, +22 lines =@@ - * @readonly - */ - readonlyField; -->readonlyField : T & U -+>readonlyField : any - - initializedField = 12; - >initializedField : number -@@= skipped -10, +10 lines =@@ - * @return {U} - */ +@@= skipped -61, +61 lines =@@ get f1() { return /** @type {*} */(null); } -->f1 : U -->(null) : any -+>f1 : any -+>(null) : null + >f1 : U + >(null) : any ++>null : any /** * @param {U} _p - */ - set f1(_p) {} -->f1 : U -->_p : U -+>f1 : any -+>_p : any - - /** - * @return {U} - */ +@@= skipped -14, +15 lines =@@ get f2() { return /** @type {*} */(null); } -->f2 : U -->(null) : any -+>f2 : any -+>(null) : null + >f2 : U + >(null) : any ++>null : any /** * @param {U} _p - */ - set f3(_p) {} -->f3 : U -->_p : U -+>f3 : any -+>_p : any - - /** - * @param {T} a - * @param {U} b - */ - constructor(a, b) {} -->a : T -->b : U -+>a : any -+>b : any - - - /** - * @type {string} - */ - static staticField; -->staticField : string -+>staticField : any - - // @readonly is currently unsupported, it seems - included here just in case that changes - /** -@@= skipped -45, +45 lines =@@ - * @readonly - */ - static staticReadonlyField; -->staticReadonlyField : string -+>staticReadonlyField : any - - static staticInitializedField = 12; - >staticInitializedField : number -@@= skipped -31, +31 lines =@@ - * @param {string} _p - */ - static set s3(_p) {} -->s3 : string -->_p : string -+>s3 : any -+>_p : any - } - - /** - * @template T,U - */ - export class F { -->F : F -+>F : F - - /** - * @type {T & U} - */ - field; -->field : T & U -+>field : any - - /** - * @param {T} a - * @param {U} b - */ - constructor(a, b) {} -->a : T -->b : U -+>a : any -+>b : any - - /** - * @template A,B -@@= skipped -30, +30 lines =@@ - * @param {B} b - */ - static create(a, b) { return new F(a, b); } -->create : (a: A, b: B) => F -->a : A -->b : B -->new F(a, b) : F -+>create : (a: any, b: any) => F -+>a : any -+>b : any -+>new F(a, b) : F - >F : typeof F -->a : A -->b : B -+>a : any -+>b : any - } - - class G {} -@@= skipped -57, +57 lines =@@ +@@= skipped -147, +148 lines =@@ } method() { @@ -172,73 +32,29 @@ } } -@@= skipped -31, +31 lines =@@ - * @template T - */ - export class N extends L { -->N : N -+>N : N - >L : L - - /** - * @param {T} param - */ - constructor(param) { -->param : T -+>param : any - - super(); - >super() : void - >super : typeof L - - this.another = param; -->this.another = param : T -+>this.another = param : any - >this.another : any - >this : this - >another : any -->param : T -+>param : any - } - } - -@@= skipped -27, +27 lines =@@ - * @extends {N} +@@= skipped -59, +59 lines =@@ */ export class O extends N { -->O : O + >O : O ->N : N -+>O : O -+>N : N ++>N : typeof N /** * @param {U} param - */ - constructor(param) { -->param : U -+>param : any +@@= skipped -10, +10 lines =@@ super(param); >super(param) : void - >super : typeof N -->param : U -+>param : any +->super : typeof N ++>super : any + >param : U this.another2 = param; -->this.another2 = param : U -+>this.another2 = param : any - >this.another2 : any - >this : this - >another2 : any -->param : U -+>param : any - } - } - +@@= skipped -15, +15 lines =@@ var x = /** @type {*} */(null); >x : any -->(null) : any -+>(null) : null + >(null) : any ++>null : any export class VariableBase extends x {} >VariableBase : VariableBase diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsComputedNames.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsComputedNames.types.diff index 9ec76f7d12..7b4fcb9acf 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsComputedNames.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsComputedNames.types.diff @@ -17,12 +17,3 @@ [TopLevelSym](x = 12) { >[TopLevelSym] : (x?: number) => number -@@= skipped -62, +62 lines =@@ - * @param {typeof TopLevelSym | typeof InnerSym} _p - */ - constructor(_p = InnerSym) { -->_p : unique symbol | unique symbol -+>_p : symbol - >InnerSym : unique symbol - - // switch on _p diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsDefault.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsDefault.types.diff index 5617dbbfd8..08d47101d6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsDefault.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsDefault.types.diff @@ -31,8 +31,9 @@ a = /** @type {Foo} */(null); ->a : Foo ->(null) : Foo -+>a : any -+>(null) : null ++>a : default ++>(null) : default ++>null : default }; export const X = Foo; @@ -58,10 +59,9 @@ +>Fab : default x = /** @type {Bar} */(null); -->x : Bar -->(null) : Bar -+>x : any -+>(null) : null + >x : Bar + >(null) : Bar ++>null : Bar } export default Bar; >Bar : Bar diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsEnumTag.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsEnumTag.errors.txt.diff new file mode 100644 index 0000000000..0926175c08 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsEnumTag.errors.txt.diff @@ -0,0 +1,68 @@ +--- old.jsDeclarationsEnumTag.errors.txt ++++ new.jsDeclarationsEnumTag.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++index.js(23,12): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? ++index.js(24,12): error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? ++index.js(25,12): error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? ++index.js(34,16): error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? ++ ++ ++==== index.js (4 errors) ==== ++ /** @enum {string} */ ++ export const Target = { ++ START: "start", ++ MIDDLE: "middle", ++ END: "end", ++ /** @type {number} */ ++ OK_I_GUESS: 2 ++ } ++ /** @enum number */ ++ export const Second = { ++ OK: 1, ++ /** @type {number} */ ++ FINE: 2, ++ } ++ /** @enum {function(number): number} */ ++ export const Fs = { ++ ADD1: n => n + 1, ++ ID: n => n, ++ SUB1: n => n - 1 ++ } ++ ++ /** ++ * @param {Target} t ++ ~~~~~~ ++!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? ++ * @param {Second} s ++ ~~~~~~ ++!!! error TS2749: 'Second' refers to a value, but is being used as a type here. Did you mean 'typeof Second'? ++ * @param {Fs} f ++ ~~ ++!!! error TS2749: 'Fs' refers to a value, but is being used as a type here. Did you mean 'typeof Fs'? ++ */ ++ export function consume(t,s,f) { ++ /** @type {string} */ ++ var str = t ++ /** @type {number} */ ++ var num = s ++ /** @type {(n: number) => number} */ ++ var fun = f ++ /** @type {Target} */ ++ ~~~~~~ ++!!! error TS2749: 'Target' refers to a value, but is being used as a type here. Did you mean 'typeof Target'? ++ var v = Target.START ++ v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums ++ } ++ /** @param {string} s */ ++ export function ff(s) { ++ // element access with arbitrary string is an error only with noImplicitAny ++ if (!Target[s]) { ++ return null ++ } ++ else { ++ return Target[s] ++ } ++ } ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsEnumTag.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsEnumTag.types.diff index de5d84b5c4..adcfae58f2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsEnumTag.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsEnumTag.types.diff @@ -1,68 +1,77 @@ --- old.jsDeclarationsEnumTag.types +++ new.jsDeclarationsEnumTag.types -@@= skipped -70, +70 lines =@@ - * @param {Fs} f +@@= skipped -20, +20 lines =@@ + /** @type {number} */ + OK_I_GUESS: 2 + >OK_I_GUESS : number ++>2 : number + >2 : 2 + } + /** @enum number */ +@@= skipped -14, +15 lines =@@ + /** @type {number} */ + FINE: 2, + >FINE : number ++>2 : number + >2 : 2 + } + /** @enum {function(number): number} */ +@@= skipped -37, +38 lines =@@ */ export function consume(t,s,f) { -->consume : (t: Target, s: Second, f: Fs) => void + >consume : (t: Target, s: Second, f: Fs) => void ->t : string ->s : number -->f : Fs -+>consume : (t: any, s: any, f: any) => void -+>t : any -+>s : any -+>f : any ++>t : Target ++>s : Second + >f : Fs /** @type {string} */ var str = t -->str : string + >str : string ->t : string -+>str : any -+>t : any ++>t : Target /** @type {number} */ var num = s -->num : number + >num : number ->s : number -+>num : any -+>s : any ++>s : Second /** @type {(n: number) => number} */ var fun = f -->fun : (n: number) => number -->f : Fs -+>fun : any -+>f : any +@@= skipped -21, +21 lines =@@ /** @type {Target} */ var v = Target.START -@@= skipped -34, +34 lines =@@ +->v : string ++>v : Target + >Target.START : string + >Target : { START: string; MIDDLE: string; END: string; OK_I_GUESS: number; } + >START : string + + v = 'something else' // allowed, like Typescript's classic enums and unlike its string enums + >v = 'something else' : "something else" +->v : string ++>v : Target + >'something else' : "something else" } /** @param {string} s */ - export function ff(s) { -->ff : (s: string) => any -->s : string -+>ff : (s: any) => any -+>s : any - +@@= skipped -18, +18 lines =@@ // element access with arbitrary string is an error only with noImplicitAny if (!Target[s]) { >!Target[s] : boolean ->Target[s] : error +>Target[s] : any >Target : { START: string; MIDDLE: string; END: string; OK_I_GUESS: number; } -->s : string -+>s : any + >s : string - return null +@@= skipped -8, +8 lines =@@ } else { return Target[s] ->Target[s] : error +>Target[s] : any >Target : { START: string; MIDDLE: string; END: string; OK_I_GUESS: number; } -->s : string -+>s : any + >s : string } - } - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpression.types.diff index 1f0c43d581..c83a1e0bdf 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpression.types.diff @@ -19,21 +19,3 @@ /** * @param {number} p - */ - constructor(p) { -->p : number -+>p : any - - this.t = 12 + p; -->this.t = 12 + p : number -+>this.t = 12 + p : any - >this.t : any - >this : this - >t : any -->12 + p : number -+>12 + p : any - >12 : 12 -->p : number -+>p : any - } - } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types.diff index f4d30b0c9c..2278b6ed71 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types.diff @@ -17,21 +17,3 @@ /** * @param {number} p - */ - constructor(p) { -->p : number -+>p : any - - this.t = 12 + p; -->this.t = 12 + p : number -+>this.t = 12 + p : any - >this.t : any - >this : this - >t : any -->12 + p : number -+>12 + p : any - >12 : 12 -->p : number -+>p : any - } - } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff index 90f034adfa..6472276902 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff @@ -17,23 +17,7 @@ /** * @param {number} p - */ - constructor(p) { -->p : number -+>p : any - - this.t = 12 + p; -->this.t = 12 + p : number -+>this.t = 12 + p : any - >this.t : any - >this : this - >t : any -->12 + p : number -+>12 + p : any - >12 : 12 -->p : number -+>p : any - } +@@= skipped -24, +24 lines =@@ } module.exports.Sub = class { >module.exports.Sub = class { constructor() { this.instance = new module.exports(10); }} : typeof Sub diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff index 566f77664d..18a693aea2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDefinePropertyEmit.errors.txt.diff @@ -11,7 +11,9 @@ +index.js(31,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(32,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(32,58): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(36,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(41,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(46,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(51,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(53,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(54,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -21,7 +23,7 @@ +index.js(58,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== index.js (16 errors) ==== ++==== index.js (18 errors) ==== + Object.defineProperty(module.exports, "a", { value: function a() {} }); + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -74,6 +76,8 @@ + /** + * @param {{x: string}} a + * @param {{y: typeof module.exports.b}} b ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + function g(a, b) { + return a.x && b.y(); @@ -86,6 +90,8 @@ + /** + * @param {{x: string}} a + * @param {{y: typeof module.exports.b}} b ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + function hh(a, b) { + return a.x && b.y(); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDefinePropertyEmit.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDefinePropertyEmit.types.diff index 8e71a2b205..29907290e2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDefinePropertyEmit.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDefinePropertyEmit.types.diff @@ -58,18 +58,11 @@ >"cat" : "cat" >{ value: "cat" } : { value: string; } >value : string -@@= skipped -20, +20 lines =@@ - * @return {string} - */ - function d(a, b) { return /** @type {*} */(null); } -->d : (a: number, b: number) => string -->a : number -->b : number -->(null) : any -+>d : (a: any, b: any) => any -+>a : any -+>b : any -+>(null) : null +@@= skipped -24, +24 lines =@@ + >a : number + >b : number + >(null) : any ++>null : any Object.defineProperty(module.exports, "d", { value: d }); ->Object.defineProperty(module.exports, "d", { value: d }) : typeof module.exports @@ -84,27 +77,13 @@ +>module : any +>exports : any >"d" : "d" -->{ value: d } : { value: (a: number, b: number) => string; } -->value : (a: number, b: number) => string -->d : (a: number, b: number) => string -+>{ value: d } : { value: (a: any, b: any) => any; } -+>value : (a: any, b: any) => any -+>d : (a: any, b: any) => any - - - /** -@@= skipped -26, +26 lines =@@ - * @return {T & U} - */ - function e(a, b) { return /** @type {*} */(null); } -->e : (a: T, b: U) => T & U -->a : T -->b : U -->(null) : any -+>e : (a: any, b: any) => any -+>a : any -+>b : any -+>(null) : null + >{ value: d } : { value: (a: number, b: number) => string; } + >value : (a: number, b: number) => string +@@= skipped -26, +27 lines =@@ + >a : T + >b : U + >(null) : any ++>null : any Object.defineProperty(module.exports, "e", { value: e }); ->Object.defineProperty(module.exports, "e", { value: e }) : typeof module.exports @@ -119,26 +98,10 @@ +>module : any +>exports : any >"e" : "e" -->{ value: e } : { value: (a: T, b: U) => T & U; } -->value : (a: T, b: U) => T & U -->e : (a: T, b: U) => T & U -+>{ value: e } : { value: (a: any, b: any) => any; } -+>value : (a: any, b: any) => any -+>e : (a: any, b: any) => any - - /** - * @template T - * @param {T} a - */ - function f(a) { -->f : (a: T) => T -->a : T -+>f : (a: any) => any -+>a : any - - return a; -->a : T -+>a : any + >{ value: e } : { value: (a: T, b: U) => T & U; } + >value : (a: T, b: U) => T & U +@@= skipped -26, +27 lines =@@ + >a : T } Object.defineProperty(module.exports, "f", { value: f }); ->Object.defineProperty(module.exports, "f", { value: f }) : typeof module.exports @@ -153,12 +116,9 @@ +>module : any +>exports : any >"f" : "f" -->{ value: f } : { value: (a: T) => T; } -->value : (a: T) => T -->f : (a: T) => T -+>{ value: f } : { value: (a: any) => any; } -+>value : (a: any) => any -+>f : (a: any) => any + >{ value: f } : { value: (a: T) => T; } + >value : (a: T) => T + >f : (a: T) => T Object.defineProperty(module.exports.f, "self", { value: module.exports.f }); ->Object.defineProperty(module.exports.f, "self", { value: module.exports.f }) : (a: T) => T @@ -198,28 +158,24 @@ */ function g(a, b) { ->g : (a: { x: string; }, b: { y: () => void; }) => void -->a : { x: string; } ++>g : (a: { x: string; }, b: { y: any; }) => any + >a : { x: string; } ->b : { y: () => void; } -+>g : (a: any, b: any) => any -+>a : any -+>b : any ++>b : { y: any; } return a.x && b.y(); ->a.x && b.y() : void -->a.x : string -->a : { x: string; } -->x : string ++>a.x && b.y() : any + >a.x : string + >a : { x: string; } + >x : string ->b.y() : void ->b.y : () => void ->b : { y: () => void; } ->y : () => void -+>a.x && b.y() : any -+>a.x : any -+>a : any -+>x : any +>b.y() : any +>b.y : any -+>b : any ++>b : { y: any; } +>y : any } Object.defineProperty(module.exports, "g", { value: g }); @@ -238,39 +194,35 @@ ->{ value: g } : { value: (a: { x: string; }, b: { y: () => void; }) => void; } ->value : (a: { x: string; }, b: { y: () => void; }) => void ->g : (a: { x: string; }, b: { y: () => void; }) => void -+>{ value: g } : { value: (a: any, b: any) => any; } -+>value : (a: any, b: any) => any -+>g : (a: any, b: any) => any ++>{ value: g } : { value: (a: { x: string; }, b: { y: any; }) => any; } ++>value : (a: { x: string; }, b: { y: any; }) => any ++>g : (a: { x: string; }, b: { y: any; }) => any /** -@@= skipped -99, +99 lines =@@ +@@= skipped -69, +69 lines =@@ * @param {{y: typeof module.exports.b}} b */ function hh(a, b) { ->hh : (a: { x: string; }, b: { y: () => void; }) => void -->a : { x: string; } ++>hh : (a: { x: string; }, b: { y: any; }) => any + >a : { x: string; } ->b : { y: () => void; } -+>hh : (a: any, b: any) => any -+>a : any -+>b : any ++>b : { y: any; } return a.x && b.y(); ->a.x && b.y() : void -->a.x : string -->a : { x: string; } -->x : string ++>a.x && b.y() : any + >a.x : string + >a : { x: string; } + >x : string ->b.y() : void ->b.y : () => void ->b : { y: () => void; } ->y : () => void -+>a.x && b.y() : any -+>a.x : any -+>a : any -+>x : any +>b.y() : any +>b.y : any -+>b : any ++>b : { y: any; } +>y : any } Object.defineProperty(module.exports, "h", { value: hh }); @@ -289,9 +241,9 @@ ->{ value: hh } : { value: (a: { x: string; }, b: { y: () => void; }) => void; } ->value : (a: { x: string; }, b: { y: () => void; }) => void ->hh : (a: { x: string; }, b: { y: () => void; }) => void -+>{ value: hh } : { value: (a: any, b: any) => any; } -+>value : (a: any, b: any) => any -+>hh : (a: any, b: any) => any ++>{ value: hh } : { value: (a: { x: string; }, b: { y: any; }) => any; } ++>value : (a: { x: string; }, b: { y: any; }) => any ++>hh : (a: { x: string; }, b: { y: any; }) => any Object.defineProperty(module.exports, "i", { value: function i(){} }); ->Object.defineProperty(module.exports, "i", { value: function i(){} }) : typeof module.exports diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff index 908a49bb28..6f27b694f5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff @@ -3,8 +3,11 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++context.js(4,21): error TS2306: File 'timer.js' is not a module. ++context.js(5,14): error TS1340: Module './hook' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./hook')'? +context.js(34,14): error TS2350: Only a void function can be called with the 'new' keyword. +context.js(48,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++hook.js(2,20): error TS1340: Module './context' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./context')'? +hook.js(10,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +timer.js(7,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + @@ -19,9 +22,11 @@ + module.exports = Timer; + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+==== hook.js (1 errors) ==== ++==== hook.js (2 errors) ==== + /** + * @typedef {(arg: import("./context")) => void} HookHandler ++ ~~~~~~~~~~~~~~~~~~~ ++!!! error TS1340: Module './context' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./context')'? + */ + /** + * @param {HookHandler} handle @@ -33,12 +38,16 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== context.js (2 errors) ==== ++==== context.js (4 errors) ==== + /** + * Imports + * + * @typedef {import("./timer")} Timer ++ ~~~~~~~~~ ++!!! error TS2306: File 'timer.js' is not a module. + * @typedef {import("./hook")} Hook ++ ~~~~~~~~~~~~~~~~ ++!!! error TS1340: Module './hook' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./hook')'? + * @typedef {import("./hook").HookHandler} HookHandler + */ + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff index 955ca39a63..3962100c2b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff @@ -5,19 +5,16 @@ */ function Timer(timeout) { ->Timer : typeof Timer -->timeout : number -+>Timer : (timeout: any) => void -+>timeout : any ++>Timer : (timeout: number) => void + >timeout : number this.timeout = timeout; -->this.timeout = timeout : number -+>this.timeout = timeout : any + >this.timeout = timeout : number >this.timeout : any ->this : this +>this : any >timeout : any -->timeout : number -+>timeout : any + >timeout : number } module.exports = Timer; ->module.exports = Timer : typeof Timer @@ -25,32 +22,34 @@ ->module : { exports: typeof Timer; } ->exports : typeof Timer ->Timer : typeof Timer -+>module.exports = Timer : (timeout: any) => void ++>module.exports = Timer : (timeout: number) => void +>module.exports : any +>module : any +>exports : any -+>Timer : (timeout: any) => void ++>Timer : (timeout: number) => void === hook.js === /** -@@= skipped -25, +25 lines =@@ + * @typedef {(arg: import("./context")) => void} HookHandler ++>HookHandler : HookHandler ++>arg : any ++ + */ + /** * @param {HookHandler} handle */ function Hook(handle) { ->Hook : typeof Hook -->handle : HookHandler -+>Hook : (handle: any) => void -+>handle : any ++>Hook : (handle: HookHandler) => void + >handle : HookHandler this.handle = handle; -->this.handle = handle : HookHandler -+>this.handle = handle : any + >this.handle = handle : HookHandler >this.handle : any ->this : this +>this : any >handle : any -->handle : HookHandler -+>handle : any + >handle : HookHandler } module.exports = Hook; ->module.exports = Hook : typeof Hook @@ -58,22 +57,63 @@ ->module : { exports: typeof Hook; } ->exports : typeof Hook ->Hook : typeof Hook -+>module.exports = Hook : (handle: any) => void ++>module.exports = Hook : (handle: HookHandler) => void +>module.exports : any +>module : any +>exports : any -+>Hook : (handle: any) => void ++>Hook : (handle: HookHandler) => void === context.js === /** -@@= skipped -50, +50 lines =@@ + * Imports + * + * @typedef {import("./timer")} Timer ++>Timer : any ++ + * @typedef {import("./hook")} Hook ++>Hook : any ++ + * @typedef {import("./hook").HookHandler} HookHandler ++>HookHandler : HookHandler ++ + */ + + /** + * Input type definition + * + * @typedef {Object} Input ++>Input : Input ++ + * @prop {Timer} timer ++>timer : any ++ + * @prop {Hook} hook ++>hook : any ++ + */ + + /** + * State type definition + * + * @typedef {Object} State ++>State : State ++ + * @prop {Timer} timer ++>timer : any ++ + * @prop {Hook} hook ++>hook : any ++ + */ + + /** +@@= skipped -75, +96 lines =@@ */ function Context(input) { ->Context : typeof Context -->input : Input -+>Context : { (input: any): any; prototype: { construct: (input: any, handle?: () => any) => any; }; } -+>input : any ++>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } + >input : Input if (!(this instanceof Context)) { >!(this instanceof Context) : boolean @@ -82,15 +122,14 @@ ->this : this ->Context : typeof Context +>this : any -+>Context : { (input: any): any; prototype: { construct: (input: any, handle?: () => any) => any; }; } ++>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } return new Context(input) ->new Context(input) : Context ->Context : typeof Context -->input : Input +>new Context(input) : any -+>Context : { (input: any): any; prototype: { construct: (input: any, handle?: () => any) => any; }; } -+>input : any ++>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } + >input : Input } this.state = this.construct(input); ->this.state = this.construct(input) : State @@ -103,12 +142,11 @@ ->this.construct : (input: Input, handle?: HookHandler | undefined) => State ->this : this & { construct(input: Input, handle?: HookHandler | undefined): State; } ->construct : (input: Input, handle?: HookHandler | undefined) => State -->input : Input +>this.construct(input) : any +>this.construct : any +>this : any +>construct : any -+>input : any + >input : Input } Context.prototype = { ->Context.prototype = { /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct(input: Input, handle?: HookHandler | undefined): State; } @@ -116,11 +154,11 @@ ->Context : typeof Context ->prototype : { construct(input: Input, handle?: HookHandler | undefined): State; } ->{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct(input: Input, handle?: HookHandler | undefined): State; } -+>Context.prototype = { /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: any, handle?: () => any) => any; } -+>Context.prototype : { construct: (input: any, handle?: () => any) => any; } -+>Context : { (input: any): any; prototype: { construct: (input: any, handle?: () => any) => any; }; } -+>prototype : { construct: (input: any, handle?: () => any) => any; } -+>{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: any, handle?: () => any) => any; } ++>Context.prototype = { /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: Input, handle?: HookHandler) => State; } ++>Context.prototype : { construct: (input: Input, handle?: HookHandler) => State; } ++>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } ++>prototype : { construct: (input: Input, handle?: HookHandler) => State; } ++>{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: Input, handle?: HookHandler) => State; } /** * @param {Input} input @@ -129,18 +167,14 @@ */ construct(input, handle = () => void 0) { ->construct : (input: Input, handle?: HookHandler | undefined) => State -->input : Input ++>construct : (input: Input, handle?: HookHandler) => State + >input : Input ->handle : import("hook").HookHandler -+>construct : (input: any, handle?: () => any) => any -+>input : any -+>handle : () => any ++>handle : HookHandler >() => void 0 : () => any >void 0 : undefined >0 : 0 - - return input; -->input : Input -+>input : any +@@= skipped -12, +12 lines =@@ } } module.exports = Context; @@ -149,9 +183,9 @@ ->module : { exports: { (input: Input): Context; new (input: Input): Context; prototype: { construct(input: Input, handle?: HookHandler | undefined): State; }; }; } ->exports : { (input: Input): Context; new (input: Input): Context; prototype: { construct(input: Input, handle?: HookHandler | undefined): State; }; } ->Context : typeof Context -+>module.exports = Context : { (input: any): any; prototype: { construct: (input: any, handle?: () => any) => any; }; } ++>module.exports = Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } +>module.exports : any +>module : any +>exports : any -+>Context : { (input: any): any; prototype: { construct: (input: any, handle?: () => any) => any; }; } ++>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionJSDoc.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionJSDoc.types.diff deleted file mode 100644 index 8535bd4174..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionJSDoc.types.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.jsDeclarationsFunctionJSDoc.types -+++ new.jsDeclarationsFunctionJSDoc.types -@@= skipped -6, +6 lines =@@ - * @param {string} b - */ - export function foo(a, b) {} -->foo : (a: number, b: string) => void -->a : number -->b : string -+>foo : (a: any, b: any) => void -+>a : any -+>b : any - - /** - * Legacy - DO NOT USE -@@= skipped -16, +16 lines =@@ - * @param {null} b - */ - constructor(a, b) { -->a : Aleph -->b : null -+>a : any -+>b : any - - /** - * Field is always null - */ - this.field = b; -->this.field = b : null -+>this.field = b : any - >this.field : any - >this : this - >field : any -->b : null -+>b : any - } - - /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.errors.txt.diff index 3ea0bd366c..142d50e852 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.errors.txt.diff @@ -3,6 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++referencer.js(4,12): error TS2749: 'Point' refers to a value, but is being used as a type here. Did you mean 'typeof Point'? +source.js(7,16): error TS2350: Only a void function can be called with the 'new' keyword. + + @@ -21,11 +22,13 @@ + this.y = y; + } + -+==== referencer.js (0 errors) ==== ++==== referencer.js (1 errors) ==== + import {Point} from "./source"; + + /** + * @param {Point} p ++ ~~~~~ ++!!! error TS2749: 'Point' refers to a value, but is being used as a type here. Did you mean 'typeof Point'? + */ + export function magnitude(p) { + return Math.sqrt(p.x ** 2 + p.y ** 2); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.types.diff index d8b300e95f..a0d16ed5f0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.types.diff @@ -5,85 +5,66 @@ */ export function Point(x, y) { ->Point : typeof Point -->x : number -->y : number -+>Point : (x: any, y: any) => any -+>x : any -+>y : any ++>Point : (x: number, y: number) => any + >x : number + >y : number - if (!(this instanceof Point)) { +@@= skipped -8, +8 lines =@@ >!(this instanceof Point) : boolean >(this instanceof Point) : boolean >this instanceof Point : boolean ->this : this ->Point : typeof Point +>this : any -+>Point : (x: any, y: any) => any ++>Point : (x: number, y: number) => any return new Point(x, y); ->new Point(x, y) : Point ->Point : typeof Point -->x : number -->y : number +>new Point(x, y) : any -+>Point : (x: any, y: any) => any -+>x : any -+>y : any ++>Point : (x: number, y: number) => any + >x : number + >y : number } this.x = x; -->this.x = x : number -+>this.x = x : any + >this.x = x : number >this.x : any ->this : this +>this : any >x : any -->x : number -+>x : any + >x : number this.y = y; -->this.y = y : number -+>this.y = y : any + >this.y = y : number >this.y : any ->this : this +>this : any >y : any -->y : number -+>y : any + >y : number } === referencer.js === import {Point} from "./source"; ->Point : typeof Point -+>Point : (x: any, y: any) => any ++>Point : (x: number, y: number) => any /** * @param {Point} p - */ - export function magnitude(p) { -->magnitude : (p: Point) => number -->p : Point -+>magnitude : (p: any) => number -+>p : any - - return Math.sqrt(p.x ** 2 + p.y ** 2); - >Math.sqrt(p.x ** 2 + p.y ** 2) : number -@@= skipped -50, +50 lines =@@ +@@= skipped -42, +42 lines =@@ >sqrt : (x: number) => number >p.x ** 2 + p.y ** 2 : number >p.x ** 2 : number ->p.x : number -->p : Point -->x : number +>p.x : any -+>p : any + >p : Point +->x : number +>x : any >2 : 2 >p.y ** 2 : number ->p.y : number -->p : Point -->y : number +>p.y : any -+>p : any + >p : Point +->y : number +>y : any >2 : 2 } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt.diff index 88d60fa3dd..123f6c5506 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses2.errors.txt.diff @@ -4,10 +4,11 @@ - @@= skipped --1, +1 lines =@@ +referencer.js(3,23): error TS2350: Only a void function can be called with the 'new' keyword. ++source.js(13,16): error TS2749: 'Vec' refers to a value, but is being used as a type here. Did you mean 'typeof Vec'? +source.js(40,16): error TS2350: Only a void function can be called with the 'new' keyword. + + -+==== source.js (1 errors) ==== ++==== source.js (2 errors) ==== + /** + * @param {number} len + */ @@ -21,6 +22,8 @@ + Vec.prototype = { + /** + * @param {Vec} other ++ ~~~ ++!!! error TS2749: 'Vec' refers to a value, but is being used as a type here. Did you mean 'typeof Vec'? + */ + dot(other) { + if (other.storage.length !== this.storage.length) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses2.types.diff index 7642d5b2b8..542a5e314a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses2.types.diff @@ -5,12 +5,11 @@ */ export function Vec(len) { ->Vec : typeof Vec -->len : number -+>Vec : { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; } -+>len : any ++>Vec : { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; } + >len : number /** - * @type {number[]} +@@= skipped -8, +8 lines =@@ */ this.storage = new Array(len); >this.storage = new Array(len) : any[] @@ -22,8 +21,7 @@ +>storage : any >new Array(len) : any[] >Array : ArrayConstructor -->len : number -+>len : any + >len : number } Vec.prototype = { @@ -32,26 +30,23 @@ ->Vec : typeof Vec ->prototype : { dot(other: Vec): number; magnitude(): number; } ->{ /** * @param {Vec} other */ dot(other) { if (other.storage.length !== this.storage.length) { throw new Error(`Dot product only applicable for vectors of equal length`); } let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] * other.storage[i]); } return sum; }, magnitude() { let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] ** 2); } return Math.sqrt(sum); }} : { dot(other: Vec): number; magnitude(): number; } -+>Vec.prototype = { /** * @param {Vec} other */ dot(other) { if (other.storage.length !== this.storage.length) { throw new Error(`Dot product only applicable for vectors of equal length`); } let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] * other.storage[i]); } return sum; }, magnitude() { let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] ** 2); } return Math.sqrt(sum); }} : { dot: (other: any) => number; magnitude: () => number; } -+>Vec.prototype : { dot: (other: any) => number; magnitude: () => number; } -+>Vec : { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; } -+>prototype : { dot: (other: any) => number; magnitude: () => number; } -+>{ /** * @param {Vec} other */ dot(other) { if (other.storage.length !== this.storage.length) { throw new Error(`Dot product only applicable for vectors of equal length`); } let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] * other.storage[i]); } return sum; }, magnitude() { let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] ** 2); } return Math.sqrt(sum); }} : { dot: (other: any) => number; magnitude: () => number; } ++>Vec.prototype = { /** * @param {Vec} other */ dot(other) { if (other.storage.length !== this.storage.length) { throw new Error(`Dot product only applicable for vectors of equal length`); } let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] * other.storage[i]); } return sum; }, magnitude() { let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] ** 2); } return Math.sqrt(sum); }} : { dot: (other: Vec) => number; magnitude: () => number; } ++>Vec.prototype : { dot: (other: Vec) => number; magnitude: () => number; } ++>Vec : { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; } ++>prototype : { dot: (other: Vec) => number; magnitude: () => number; } ++>{ /** * @param {Vec} other */ dot(other) { if (other.storage.length !== this.storage.length) { throw new Error(`Dot product only applicable for vectors of equal length`); } let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] * other.storage[i]); } return sum; }, magnitude() { let sum = 0; for (let i = 0; i < this.storage.length; i++) { sum += (this.storage[i] ** 2); } return Math.sqrt(sum); }} : { dot: (other: Vec) => number; magnitude: () => number; } /** * @param {Vec} other - */ - dot(other) { -->dot : (other: Vec) => number -->other : Vec -+>dot : (other: any) => number -+>other : any +@@= skipped -24, +24 lines =@@ if (other.storage.length !== this.storage.length) { >other.storage.length !== this.storage.length : boolean ->other.storage.length : number ->other.storage : number[] -->other : Vec ++>other.storage.length : any ++>other.storage : any + >other : Vec ->storage : number[] ->length : number ->this.storage.length : number @@ -59,9 +54,6 @@ ->this : this ->storage : number[] ->length : number -+>other.storage.length : any -+>other.storage : any -+>other : any +>storage : any +>length : any +>this.storage.length : any @@ -72,7 +64,7 @@ throw new Error(`Dot product only applicable for vectors of equal length`); >new Error(`Dot product only applicable for vectors of equal length`) : Error -@@= skipped -57, +57 lines =@@ +@@= skipped -25, +25 lines =@@ >0 : 0 >i < this.storage.length : boolean >i : number @@ -104,11 +96,10 @@ >i : number ->other.storage[i] : number ->other.storage : number[] -->other : Vec -->storage : number[] +>other.storage[i] : any +>other.storage : any -+>other : any + >other : Vec +->storage : number[] +>storage : any >i : number } @@ -150,30 +141,26 @@ */ export function Point2D(x, y) { ->Point2D : typeof Point2D -->x : number -->y : number -+>Point2D : { (x: any, y: any): any; prototype: { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; }; } -+>x : any -+>y : any ++>Point2D : { (x: number, y: number): any; prototype: { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; }; } + >x : number + >y : number - if (!(this instanceof Point2D)) { +@@= skipped -8, +8 lines =@@ >!(this instanceof Point2D) : boolean >(this instanceof Point2D) : boolean >this instanceof Point2D : boolean ->this : this ->Point2D : typeof Point2D +>this : any -+>Point2D : { (x: any, y: any): any; prototype: { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; }; } ++>Point2D : { (x: number, y: number): any; prototype: { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; }; } return new Point2D(x, y); ->new Point2D(x, y) : Point2D ->Point2D : typeof Point2D -->x : number -->y : number +>new Point2D(x, y) : any -+>Point2D : { (x: any, y: any): any; prototype: { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; }; } -+>x : any -+>y : any ++>Point2D : { (x: number, y: number): any; prototype: { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; }; } + >x : number + >y : number } Vec.call(this, 2); >Vec.call(this, 2) : any @@ -182,34 +169,30 @@ ->call : (this: Function, thisArg: any, ...argArray: any[]) => any ->this : this +>Vec.call : (thisArg: any, ...argArray: any[]) => any -+>Vec : { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; } ++>Vec : { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; } +>call : (thisArg: any, ...argArray: any[]) => any +>this : any >2 : 2 this.x = x; -->this.x = x : number + >this.x = x : number ->this.x : number ->this : this -->x : number -->x : number -+>this.x = x : any +>this.x : any +>this : any +>x : any -+>x : any + >x : number +->x : number this.y = y; -->this.y = y : number + >this.y = y : number ->this.y : number ->this : this -->y : number -->y : number -+>this.y = y : any +>this.y : any +>this : any +>y : any -+>y : any + >y : number +->y : number } Point2D.prototype = { @@ -218,22 +201,21 @@ ->Point2D : typeof Point2D ->prototype : { __proto__: typeof Vec; x: number; y: number; } ->{ __proto__: Vec, get x() { return this.storage[0]; }, /** * @param {number} x */ set x(x) { this.storage[0] = x; }, get y() { return this.storage[1]; }, /** * @param {number} y */ set y(y) { this.storage[1] = y; }} : { __proto__: typeof Vec; x: number; y: number; } -+>Point2D.prototype = { __proto__: Vec, get x() { return this.storage[0]; }, /** * @param {number} x */ set x(x) { this.storage[0] = x; }, get y() { return this.storage[1]; }, /** * @param {number} y */ set y(y) { this.storage[1] = y; }} : { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; } -+>Point2D.prototype : { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; } -+>Point2D : { (x: any, y: any): any; prototype: { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; }; } -+>prototype : { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; } -+>{ __proto__: Vec, get x() { return this.storage[0]; }, /** * @param {number} x */ set x(x) { this.storage[0] = x; }, get y() { return this.storage[1]; }, /** * @param {number} y */ set y(y) { this.storage[1] = y; }} : { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; } ++>Point2D.prototype = { __proto__: Vec, get x() { return this.storage[0]; }, /** * @param {number} x */ set x(x) { this.storage[0] = x; }, get y() { return this.storage[1]; }, /** * @param {number} y */ set y(y) { this.storage[1] = y; }} : { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; } ++>Point2D.prototype : { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; } ++>Point2D : { (x: number, y: number): any; prototype: { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; }; } ++>prototype : { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; } ++>{ __proto__: Vec, get x() { return this.storage[0]; }, /** * @param {number} x */ set x(x) { this.storage[0] = x; }, get y() { return this.storage[1]; }, /** * @param {number} y */ set y(y) { this.storage[1] = y; }} : { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; } __proto__: Vec, ->__proto__ : typeof Vec ->Vec : typeof Vec -+>__proto__ : { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; } -+>Vec : { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; } ++>__proto__ : { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; } ++>Vec : { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; } get x() { -->x : number -+>x : any - + >x : number +@@= skipped -49, +49 lines =@@ return this.storage[0]; >this.storage[0] : any >this.storage : any @@ -242,32 +224,16 @@ >storage : any >0 : 0 -@@= skipped -66, +66 lines =@@ - * @param {number} x - */ - set x(x) { -->x : number -->x : number -+>x : any -+>x : any - - this.storage[0] = x; -->this.storage[0] = x : number -+>this.storage[0] = x : any +@@= skipped -16, +16 lines =@@ + >this.storage[0] = x : number >this.storage[0] : any >this.storage : any ->this : { __proto__: typeof Vec; x: number; y: number; } +>this : any >storage : any >0 : 0 -->x : number -+>x : any - - }, - get y() { -->y : number -+>y : any - + >x : number +@@= skipped -12, +12 lines =@@ return this.storage[1]; >this.storage[1] : any >this.storage : any @@ -276,33 +242,21 @@ >storage : any >1 : 1 -@@= skipped -28, +28 lines =@@ - * @param {number} y - */ - set y(y) { -->y : number -->y : number -+>y : any -+>y : any - - this.storage[1] = y; -->this.storage[1] = y : number -+>this.storage[1] = y : any +@@= skipped -16, +16 lines =@@ + >this.storage[1] = y : number >this.storage[1] : any >this.storage : any ->this : { __proto__: typeof Vec; x: number; y: number; } +>this : any >storage : any >1 : 1 -->y : number -+>y : any - } - }; + >y : number +@@= skipped -9, +9 lines =@@ === referencer.js === import {Point2D} from "./source"; ->Point2D : typeof Point2D -+>Point2D : { (x: any, y: any): any; prototype: { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; }; } ++>Point2D : { (x: number, y: number): any; prototype: { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; }; } export const origin = new Point2D(0, 0); ->origin : Point2D @@ -310,7 +264,7 @@ ->Point2D : typeof Point2D +>origin : any +>new Point2D(0, 0) : any -+>Point2D : { (x: any, y: any): any; prototype: { __proto__: { (len: any): void; prototype: { dot: (other: any) => number; magnitude: () => number; }; }; x: any; y: any; }; } ++>Point2D : { (x: number, y: number): any; prototype: { __proto__: { (len: number): void; prototype: { dot: (other: Vec) => number; magnitude: () => number; }; }; x: number; y: number; }; } >0 : 0 >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.types.diff index b85b33f237..054c33ddb3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.types.diff @@ -27,33 +27,19 @@ >Cls : typeof Cls >class {} : typeof Cls -@@= skipped -25, +25 lines =@@ - * @return {string} - */ - export function d(a, b) { return /** @type {*} */(null); } -->d : (a: number, b: number) => string -->a : number -->b : number -->(null) : any -+>d : (a: any, b: any) => any -+>a : any -+>b : any -+>(null) : null +@@= skipped -29, +29 lines =@@ + >a : number + >b : number + >(null) : any ++>null : any /** * @template T,U -@@= skipped -12, +12 lines =@@ - * @return {T & U} - */ - export function e(a, b) { return /** @type {*} */(null); } -->e : (a: T, b: U) => T & U -->a : T -->b : U -->(null) : any -+>e : (a: any, b: any) => any -+>a : any -+>b : any -+>(null) : null +@@= skipped -12, +13 lines =@@ + >a : T + >b : U + >(null) : any ++>null : any /** * @template T @@ -61,13 +47,11 @@ */ export function f(a) { ->f : typeof f -->a : T -+>f : { (a: any): any; self: ???; } -+>a : any ++>f : { (a: T): T; self: ???; } + >a : T return a; -->a : T -+>a : any + >a : T } f.self = f; ->f.self = f : typeof f @@ -75,11 +59,11 @@ ->f : typeof f ->self : typeof f ->f : typeof f -+>f.self = f : { (a: any): any; self: ???; } -+>f.self : { (a: any): any; self: ???; } -+>f : { (a: any): any; self: ???; } -+>self : { (a: any): any; self: ???; } -+>f : { (a: any): any; self: ???; } ++>f.self = f : { (a: T): T; self: ???; } ++>f.self : { (a: T): T; self: ???; } ++>f : { (a: T): T; self: ???; } ++>self : { (a: T): T; self: ???; } ++>f : { (a: T): T; self: ???; } /** * @param {{x: string}} a @@ -87,34 +71,28 @@ */ function g(a, b) { ->g : (a: { x: string; }, b: { y: typeof import("index").b; }) => void -->a : { x: string; } ++>g : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void + >a : { x: string; } ->b : { y: typeof import("index").b; } -+>g : (a: any, b: any) => any -+>a : any -+>b : any ++>b : { y: { (): void; cat: string; }; } return a.x && b.y(); -->a.x && b.y() : void -->a.x : string -->a : { x: string; } -->x : string -->b.y() : void + >a.x && b.y() : void +@@= skipped -34, +35 lines =@@ + >a : { x: string; } + >x : string + >b.y() : void ->b.y : typeof import("index").b ->b : { y: typeof import("index").b; } ->y : typeof import("index").b -+>a.x && b.y() : any -+>a.x : any -+>a : any -+>x : any -+>b.y() : any -+>b.y : any -+>b : any -+>y : any ++>b.y : { (): void; cat: string; } ++>b : { y: { (): void; cat: string; }; } ++>y : { (): void; cat: string; } } export { g }; ->g : (a: { x: string; }, b: { y: typeof import("index").b; }) => void -+>g : (a: any, b: any) => any ++>g : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void /** * @param {{x: string}} a @@ -122,36 +100,30 @@ */ function hh(a, b) { ->hh : (a: { x: string; }, b: { y: typeof import("index").b; }) => void -->a : { x: string; } ++>hh : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void + >a : { x: string; } ->b : { y: typeof import("index").b; } -+>hh : (a: any, b: any) => any -+>a : any -+>b : any ++>b : { y: { (): void; cat: string; }; } return a.x && b.y(); -->a.x && b.y() : void -->a.x : string -->a : { x: string; } -->x : string -->b.y() : void + >a.x && b.y() : void +@@= skipped -23, +23 lines =@@ + >a : { x: string; } + >x : string + >b.y() : void ->b.y : typeof import("index").b ->b : { y: typeof import("index").b; } ->y : typeof import("index").b -+>a.x && b.y() : any -+>a.x : any -+>a : any -+>x : any -+>b.y() : any -+>b.y : any -+>b : any -+>y : any ++>b.y : { (): void; cat: string; } ++>b : { y: { (): void; cat: string; }; } ++>y : { (): void; cat: string; } } export { hh as h }; ->hh : (a: { x: string; }, b: { y: typeof import("index").b; }) => void ->h : (a: { x: string; }, b: { y: typeof import("index").b; }) => void -+>hh : (a: any, b: any) => any -+>h : (a: any, b: any) => any ++>hh : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void ++>h : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void export function i() {} >i : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff index a627695439..1d33520fdf 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.errors.txt.diff @@ -13,7 +13,9 @@ +index.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(31,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(31,25): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(35,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(41,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(45,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(51,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(53,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(54,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -23,7 +25,7 @@ +index.js(58,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== index.js (18 errors) ==== ++==== index.js (20 errors) ==== + module.exports.a = function a() {} + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -79,6 +81,8 @@ + /** + * @param {{x: string}} a + * @param {{y: typeof module.exports.b}} b ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + function g(a, b) { + return a.x && b.y(); @@ -91,6 +95,8 @@ + /** + * @param {{x: string}} a + * @param {{y: typeof module.exports.b}} b ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + */ + function hh(a, b) { + return a.x && b.y(); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.types.diff index 1b721e10f3..9709f467ba 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionsCjs.types.diff @@ -104,7 +104,6 @@ ->d : (a: number, b: number) => string ->a : number ->b : number -->(null) : any +>module.exports.d = function d(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any +>module.exports.d : any +>module.exports : any @@ -115,11 +114,12 @@ +>d : (a: any, b: any) => any +>a : any +>b : any -+>(null) : null + >(null) : any ++>null : any /** * @template T,U -@@= skipped -19, +19 lines =@@ +@@= skipped -19, +20 lines =@@ * @return {T & U} */ module.exports.e = function e(a, b) { return /** @type {*} */(null); } @@ -133,7 +133,6 @@ ->e : (a: T, b: U) => T & U ->a : T ->b : U -->(null) : any +>module.exports.e = function e(a, b) { return /** @type {*} */(null); } : (a: any, b: any) => any +>module.exports.e : any +>module.exports : any @@ -144,7 +143,8 @@ +>e : (a: any, b: any) => any +>a : any +>b : any -+>(null) : null + >(null) : any ++>null : any /** * @template T @@ -208,28 +208,24 @@ */ function g(a, b) { ->g : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void -->a : { x: string; } ++>g : (a: { x: string; }, b: { y: any; }) => any + >a : { x: string; } ->b : { y: { (): void; cat: string; }; } -+>g : (a: any, b: any) => any -+>a : any -+>b : any ++>b : { y: any; } return a.x && b.y(); ->a.x && b.y() : void -->a.x : string -->a : { x: string; } -->x : string ++>a.x && b.y() : any + >a.x : string + >a : { x: string; } + >x : string ->b.y() : void ->b.y : { (): void; cat: string; } ->b : { y: { (): void; cat: string; }; } ->y : { (): void; cat: string; } -+>a.x && b.y() : any -+>a.x : any -+>a : any -+>x : any +>b.y() : any +>b.y : any -+>b : any ++>b : { y: any; } +>y : any } @@ -241,13 +237,13 @@ ->exports : typeof module.exports ->g : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void ->g : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void -+>module.exports.g = g : (a: any, b: any) => any ++>module.exports.g = g : (a: { x: string; }, b: { y: any; }) => any +>module.exports.g : any +>module.exports : any +>module : any +>exports : any +>g : any -+>g : (a: any, b: any) => any ++>g : (a: { x: string; }, b: { y: any; }) => any /** * @param {{x: string}} a @@ -255,28 +251,24 @@ */ function hh(a, b) { ->hh : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void -->a : { x: string; } ++>hh : (a: { x: string; }, b: { y: any; }) => any + >a : { x: string; } ->b : { y: { (): void; cat: string; }; } -+>hh : (a: any, b: any) => any -+>a : any -+>b : any ++>b : { y: any; } return a.x && b.y(); ->a.x && b.y() : void -->a.x : string -->a : { x: string; } -->x : string ++>a.x && b.y() : any + >a.x : string + >a : { x: string; } + >x : string ->b.y() : void ->b.y : { (): void; cat: string; } ->b : { y: { (): void; cat: string; }; } ->y : { (): void; cat: string; } -+>a.x && b.y() : any -+>a.x : any -+>a : any -+>x : any +>b.y() : any +>b.y : any -+>b : any ++>b : { y: any; } +>y : any } @@ -288,13 +280,13 @@ ->exports : typeof module.exports ->h : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void ->hh : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void -+>module.exports.h = hh : (a: any, b: any) => any ++>module.exports.h = hh : (a: { x: string; }, b: { y: any; }) => any +>module.exports.h : any +>module.exports : any +>module : any +>exports : any +>h : any -+>hh : (a: any, b: any) => any ++>hh : (a: { x: string; }, b: { y: any; }) => any module.exports.i = function i() {} >module.exports.i = function i() {} : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsGetterSetter.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsGetterSetter.types.diff index f80046b27e..1ae4213ee4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsGetterSetter.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsGetterSetter.types.diff @@ -1,17 +1,6 @@ --- old.jsDeclarationsGetterSetter.types +++ new.jsDeclarationsGetterSetter.types -@@= skipped -18, +18 lines =@@ - * @param {number} _arg - */ - set x(_arg) { -->x : number -->_arg : number -+>x : any -+>_arg : any - } - } - -@@= skipped -32, +32 lines =@@ +@@= skipped -50, +50 lines =@@ >D : typeof D >prototype : D >"x" : "x" @@ -25,57 +14,28 @@ >prototype : E >"x" : "x" ->{ /** * @param {number} _arg */ set(_arg) {}} : { set(_arg: number): void; } -+>{ /** * @param {number} _arg */ set(_arg) {}} : { set: (_arg: any) => void; } ++>{ /** * @param {number} _arg */ set(_arg) {}} : { set: (_arg: number) => void; } /** * @param {number} _arg - */ - set(_arg) {} -->set : (_arg: number) => void -->_arg : number -+>set : (_arg: any) => void -+>_arg : any - - }); - @@= skipped -23, +23 lines =@@ >F : typeof F >prototype : F >"x" : "x" ->{ get() { return 12; }, /** * @param {number} _arg */ set(_arg) {}} : { get(): number; set(_arg: number): void; } -+>{ get() { return 12; }, /** * @param {number} _arg */ set(_arg) {}} : { get: () => number; set: (_arg: any) => void; } ++>{ get() { return 12; }, /** * @param {number} _arg */ set(_arg) {}} : { get: () => number; set: (_arg: number) => void; } get() { >get : () => number -@@= skipped -13, +13 lines =@@ - * @param {number} _arg - */ - set(_arg) {} -->set : (_arg: number) => void -->_arg : number -+>set : (_arg: any) => void -+>_arg : any - - }); - -@@= skipped -17, +17 lines =@@ +@@= skipped -30, +30 lines =@@ >G : typeof G >prototype : G >"x" : "x" ->{ /** * @param {number[]} args */ set(...args) {}} : { set(...args: number[]): void; } -+>{ /** * @param {number[]} args */ set(...args) {}} : { set: (...args: [v: any]) => void; } ++>{ /** * @param {number[]} args */ set(...args) {}} : { set: (...args: number[]) => void; } /** * @param {number[]} args - */ - set(...args) {} -->set : (...args: number[]) => void -->args : number[] -+>set : (...args: [v: any]) => void -+>args : [v: any] - - }); - @@= skipped -23, +23 lines =@@ >H : typeof H >prototype : H @@ -85,192 +45,33 @@ set() {} >set : () => void -@@= skipped -20, +20 lines =@@ - >I : typeof I - >prototype : I - >"x" : "x" -->{ /** * @param {number} v */ set: (v) => {}} : { set: (v: number) => void; } -+>{ /** * @param {number} v */ set: (v) => {}} : { set: (v: any) => void; } - - /** - * @param {number} v - */ - set: (v) => {} -->set : (v: number) => void -->(v) => {} : (v: number) => void -->v : number -+>set : (v: any) => void -+>(v) => {} : (v: any) => void -+>v : any - - }); - -@@= skipped -16, +16 lines =@@ - * @param {number} v - */ - const jSetter = (v) => {} -->jSetter : (v: number) => void -->(v) => {} : (v: number) => void -->v : number -+>jSetter : (v: any) => void -+>(v) => {} : (v: any) => void -+>v : any - - export class J {} - >J : J -@@= skipped -16, +16 lines =@@ - >J : typeof J - >prototype : J - >"x" : "x" -->{ set: jSetter} : { set: (v: number) => void; } -+>{ set: jSetter} : { set: (v: any) => void; } - - set: jSetter -->set : (v: number) => void -->jSetter : (v: number) => void -+>set : (v: any) => void -+>jSetter : (v: any) => void - - }); - -@@= skipped -12, +12 lines =@@ - * @param {number} v - */ - const kSetter1 = (v) => {} -->kSetter1 : (v: number) => void -->(v) => {} : (v: number) => void -->v : number -+>kSetter1 : (v: any) => void -+>(v) => {} : (v: any) => void -+>v : any - - /** - * @param {number} v - */ - const kSetter2 = (v) => {} -->kSetter2 : (v: number) => void -->(v) => {} : (v: number) => void -->v : number -+>kSetter2 : (v: any) => void -+>(v) => {} : (v: any) => void -+>v : any - - export class K {} - >K : K -@@= skipped -24, +24 lines =@@ - >K : typeof K - >prototype : K - >"x" : "x" -->{ set: Math.random() ? kSetter1 : kSetter2} : { set: (v: number) => void; } -+>{ set: Math.random() ? kSetter1 : kSetter2} : { set: (v: any) => void; } - - set: Math.random() ? kSetter1 : kSetter2 -->set : (v: number) => void -->Math.random() ? kSetter1 : kSetter2 : (v: number) => void -+>set : (v: any) => void -+>Math.random() ? kSetter1 : kSetter2 : (v: any) => void - >Math.random() : number - >Math.random : () => number - >Math : Math - >random : () => number -->kSetter1 : (v: number) => void -->kSetter2 : (v: number) => void -+>kSetter1 : (v: any) => void -+>kSetter2 : (v: any) => void - - }); - -@@= skipped -18, +18 lines =@@ - * @param {number} v - */ - const lSetter1 = (v) => {} -->lSetter1 : (v: number) => void -->(v) => {} : (v: number) => void -->v : number -+>lSetter1 : (v: any) => void -+>(v) => {} : (v: any) => void -+>v : any - - /** - * @param {string} v - */ - const lSetter2 = (v) => {} -->lSetter2 : (v: string) => void -->(v) => {} : (v: string) => void -->v : string -+>lSetter2 : (v: any) => void -+>(v) => {} : (v: any) => void -+>v : any - - export class L {} - >L : L -@@= skipped -24, +24 lines =@@ +@@= skipped -130, +130 lines =@@ >L : typeof L >prototype : L >"x" : "x" ->{ set: Math.random() ? lSetter1 : lSetter2} : { set: ((v: number) => void) | ((v: string) => void); } -+>{ set: Math.random() ? lSetter1 : lSetter2} : { set: (v: any) => void; } ++>{ set: Math.random() ? lSetter1 : lSetter2} : { set: (v: number) => void | (v: string) => void; } set: Math.random() ? lSetter1 : lSetter2 ->set : ((v: number) => void) | ((v: string) => void) ->Math.random() ? lSetter1 : lSetter2 : ((v: number) => void) | ((v: string) => void) -+>set : (v: any) => void -+>Math.random() ? lSetter1 : lSetter2 : (v: any) => void ++>set : (v: number) => void | (v: string) => void ++>Math.random() ? lSetter1 : lSetter2 : (v: number) => void | (v: string) => void >Math.random() : number >Math.random : () => number >Math : Math - >random : () => number -->lSetter1 : (v: number) => void -->lSetter2 : (v: string) => void -+>lSetter1 : (v: any) => void -+>lSetter2 : (v: any) => void - - }); - -@@= skipped -18, +18 lines =@@ - * @param {number | boolean} v - */ - const mSetter1 = (v) => {} -->mSetter1 : (v: number | boolean) => void -->(v) => {} : (v: number | boolean) => void -->v : number | boolean -+>mSetter1 : (v: any) => void -+>(v) => {} : (v: any) => void -+>v : any - - /** - * @param {string | boolean} v - */ - const mSetter2 = (v) => {} -->mSetter2 : (v: string | boolean) => void -->(v) => {} : (v: string | boolean) => void -->v : string | boolean -+>mSetter2 : (v: any) => void -+>(v) => {} : (v: any) => void -+>v : any - - export class M {} - >M : M -@@= skipped -24, +24 lines =@@ +@@= skipped -42, +42 lines =@@ >M : typeof M >prototype : M >"x" : "x" ->{ set: Math.random() ? mSetter1 : mSetter2} : { set: ((v: number | boolean) => void) | ((v: string | boolean) => void); } -+>{ set: Math.random() ? mSetter1 : mSetter2} : { set: (v: any) => void; } ++>{ set: Math.random() ? mSetter1 : mSetter2} : { set: (v: number | boolean) => void | (v: string | boolean) => void; } set: Math.random() ? mSetter1 : mSetter2 ->set : ((v: number | boolean) => void) | ((v: string | boolean) => void) ->Math.random() ? mSetter1 : mSetter2 : ((v: number | boolean) => void) | ((v: string | boolean) => void) -+>set : (v: any) => void -+>Math.random() ? mSetter1 : mSetter2 : (v: any) => void ++>set : (v: number | boolean) => void | (v: string | boolean) => void ++>Math.random() ? mSetter1 : mSetter2 : (v: number | boolean) => void | (v: string | boolean) => void >Math.random() : number >Math.random : () => number >Math : Math - >random : () => number -->mSetter1 : (v: number | boolean) => void -->mSetter2 : (v: string | boolean) => void -+>mSetter1 : (v: any) => void -+>mSetter2 : (v: any) => void - - }); - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff index 818f900585..53d5cc4eb9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff @@ -1,60 +1,76 @@ --- old.jsDeclarationsImportAliasExposedWithinNamespace.errors.txt +++ new.jsDeclarationsImportAliasExposedWithinNamespace.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -file2.js(1,9): error TS18042: 'myTypes' is a type and cannot be imported in JavaScript files. Use 'import("./file.js").myTypes' in a JSDoc type annotation. -- -- ++file.js(4,11): error TS2315: Type 'Object' is not generic. ++file.js(10,51): error TS2300: Duplicate identifier 'myTypes'. ++file.js(13,13): error TS2300: Duplicate identifier 'myTypes'. ++file.js(18,15): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. ++file.js(18,39): error TS2300: Duplicate identifier 'myTypes'. ++file2.js(6,11): error TS2315: Type 'Object' is not generic. ++file2.js(12,23): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. ++file2.js(17,12): error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. + + -==== file.js (0 errors) ==== -- /** -- * @namespace myTypes -- * @global -- * @type {Object} -- */ -- const myTypes = { -- // SOME PROPS HERE -- }; -- -- /** @typedef {string|RegExp|Array} myTypes.typeA */ -- -- /** -- * @typedef myTypes.typeB -- * @property {myTypes.typeA} prop1 - Prop 1. -- * @property {string} prop2 - Prop 2. -- */ -- -- /** @typedef {myTypes.typeB|Function} myTypes.typeC */ -- -- export {myTypes}; ++==== file.js (5 errors) ==== + /** + * @namespace myTypes + * @global + * @type {Object} ++ ~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. + */ + const myTypes = { + // SOME PROPS HERE + }; + + /** @typedef {string|RegExp|Array} myTypes.typeA */ ++ ~~~~~~~ ++!!! error TS2300: Duplicate identifier 'myTypes'. + + /** + * @typedef myTypes.typeB ++ ~~~~~~~ ++!!! error TS2300: Duplicate identifier 'myTypes'. + * @property {myTypes.typeA} prop1 - Prop 1. + * @property {string} prop2 - Prop 2. + */ + + /** @typedef {myTypes.typeB|Function} myTypes.typeC */ ++ ~~~~~~~ ++!!! error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. ++ ~~~~~~~ ++!!! error TS2300: Duplicate identifier 'myTypes'. + + export {myTypes}; -==== file2.js (1 errors) ==== -- import {myTypes} from './file.js'; ++==== file2.js (3 errors) ==== + import {myTypes} from './file.js'; - ~~~~~~~ -!!! error TS18042: 'myTypes' is a type and cannot be imported in JavaScript files. Use 'import("./file.js").myTypes' in a JSDoc type annotation. -- -- /** -- * @namespace testFnTypes -- * @global -- * @type {Object} -- */ -- const testFnTypes = { -- // SOME PROPS HERE -- }; -- -- /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ -- -- /** -- * @function testFn -- * @description A test function. -- * @param {testFnTypes.input} input - Input. -- * @returns {number|null} Result. -- */ -- function testFn(input) { -- if (typeof input === 'number') { -- return 2 * input; -- } else { -- return null; -- } -- } -- -- export {testFn, testFnTypes}; -@@= skipped --1, +1 lines =@@ -+ + + /** + * @namespace testFnTypes + * @global + * @type {Object} ++ ~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. + */ + const testFnTypes = { + // SOME PROPS HERE + }; + + /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ++ ~~~~~~~ ++!!! error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. + + /** + * @function testFn + * @description A test function. + * @param {testFnTypes.input} input - Input. ++ ~~~~~~~~~~~ ++!!! error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. + * @returns {number|null} Result. + */ + function testFn(input) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types.diff index 4a7d86192f..bc810ab0bd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types.diff @@ -5,48 +5,75 @@ */ const myTypes = { ->myTypes : { [x: string]: any; } -+>myTypes : {} ++>myTypes : any >{ // SOME PROPS HERE} : {} // SOME PROPS HERE -@@= skipped -17, +17 lines =@@ + }; + + /** @typedef {string|RegExp|Array} myTypes.typeA */ ++>myTypes : any + + /** + * @typedef myTypes.typeB ++>myTypes : any ++ + * @property {myTypes.typeA} prop1 - Prop 1. ++>prop1 : any ++>myTypes : any ++ + * @property {string} prop2 - Prop 2. ++>prop2 : any ++ + */ + /** @typedef {myTypes.typeB|Function} myTypes.typeC */ ++>myTypes : any ++>myTypes : any export {myTypes}; ->myTypes : { [x: string]: any; } -+>myTypes : {} ++>myTypes : any === file2.js === import {myTypes} from './file.js'; ->myTypes : { [x: string]: any; } -+>myTypes : {} ++>myTypes : any /** * @namespace testFnTypes -@@= skipped -12, +12 lines =@@ +@@= skipped -29, +39 lines =@@ * @type {Object} */ const testFnTypes = { ->testFnTypes : { [x: string]: any; } -+>testFnTypes : {} ++>testFnTypes : any >{ // SOME PROPS HERE} : {} // SOME PROPS HERE -@@= skipped -15, +15 lines =@@ + }; + + /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ++>testFnTypes : any ++>myTypes : any + + /** + * @function testFn +@@= skipped -15, +17 lines =@@ * @returns {number|null} Result. */ function testFn(input) { ->testFn : (input: testFnTypes.input) => number | null ->input : import("file2").testFnTypes.input -+>testFn : (input: any) => number -+>input : any ++>testFn : (input: input) => number ++>input : input if (typeof input === 'number') { >typeof input === 'number' : boolean ->typeof input : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" ->input : import("file2").testFnTypes.input +>typeof input : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" -+>input : any ++>input : input >'number' : "number" return 2 * input; @@ -63,6 +90,6 @@ export {testFn, testFnTypes}; ->testFn : (input: testFnTypes.input) => number | null ->testFnTypes : { [x: string]: any; } -+>testFn : (input: any) => number -+>testFnTypes : {} ++>testFn : (input: input) => number ++>testFnTypes : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff index eec1b597c4..0153236330 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff @@ -4,10 +4,13 @@ - @@= skipped --1, +1 lines =@@ +file2.js(1,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++file2.js(6,11): error TS2315: Type 'Object' is not generic. ++file2.js(12,23): error TS2503: Cannot find namespace 'myTypes'. ++file2.js(17,12): error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. +file2.js(28,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== file2.js (2 errors) ==== ++==== file2.js (5 errors) ==== + const {myTypes} = require('./file.js'); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -16,17 +19,23 @@ + * @namespace testFnTypes + * @global + * @type {Object} ++ ~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. + */ + const testFnTypes = { + // SOME PROPS HERE + }; + + /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ++ ~~~~~~~ ++!!! error TS2503: Cannot find namespace 'myTypes'. + + /** + * @function testFn + * @description A test function. + * @param {testFnTypes.input} input - Input. ++ ~~~~~~~~~~~ ++!!! error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. + * @returns {number|null} Result. + */ + function testFn(input) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff index cd20fdf044..585b7a202a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff @@ -16,25 +16,33 @@ */ const testFnTypes = { ->testFnTypes : { [x: string]: any; } -+>testFnTypes : {} ++>testFnTypes : any >{ // SOME PROPS HERE} : {} // SOME PROPS HERE -@@= skipped -15, +15 lines =@@ + }; + + /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ++>testFnTypes : any ++>myTypes : any + + /** + * @function testFn +@@= skipped -15, +17 lines =@@ * @returns {number|null} Result. */ function testFn(input) { ->testFn : (input: testFnTypes.input) => number | null ->input : boolean | myTypes.typeC -+>testFn : (input: any) => number -+>input : any ++>testFn : (input: input) => number ++>input : input if (typeof input === 'number') { >typeof input === 'number' : boolean ->typeof input : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" ->input : boolean | myTypes.typeC +>typeof input : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" -+>input : any ++>input : input >'number' : "number" return 2 * input; @@ -56,13 +64,13 @@ ->{testFn, testFnTypes} : { testFn: (input: testFnTypes.input) => number | null; testFnTypes: { [x: string]: any; }; } ->testFn : (input: testFnTypes.input) => number | null ->testFnTypes : { [x: string]: any; } -+>module.exports = {testFn, testFnTypes} : { testFn: (input: any) => number; testFnTypes: {}; } ++>module.exports = {testFn, testFnTypes} : { testFn: (input: input) => number; testFnTypes: any; } +>module.exports : any +>module : any +>exports : any -+>{testFn, testFnTypes} : { testFn: (input: any) => number; testFnTypes: {}; } -+>testFn : (input: any) => number -+>testFnTypes : {} ++>{testFn, testFnTypes} : { testFn: (input: input) => number; testFnTypes: any; } ++>testFn : (input: input) => number ++>testFnTypes : any -=== file.js === -/** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportNamespacedType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportNamespacedType.errors.txt.diff new file mode 100644 index 0000000000..ce41044958 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportNamespacedType.errors.txt.diff @@ -0,0 +1,19 @@ +--- old.jsDeclarationsImportNamespacedType.errors.txt ++++ new.jsDeclarationsImportNamespacedType.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++file.js(2,29): error TS2694: Namespace '"mod1"' has no exported member 'Dotted'. ++ ++ ++==== file.js (1 errors) ==== ++ import { dummy } from './mod1' ++ /** @type {import('./mod1').Dotted.Name} - should work */ ++ ~~~~~~ ++!!! error TS2694: Namespace '"mod1"' has no exported member 'Dotted'. ++ var dot2 ++ ++==== mod1.js (0 errors) ==== ++ /** @typedef {number} Dotted.Name */ ++ export var dummy = 1 ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportNamespacedType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportNamespacedType.types.diff index 440918b5f4..4f16b15416 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportNamespacedType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportNamespacedType.types.diff @@ -9,3 +9,8 @@ === mod1.js === /** @typedef {number} Dotted.Name */ ++>Dotted : any ++ + export var dummy = 1 + >dummy : number + >1 : 1 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff index 78dc2a90d6..9133dd122f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff @@ -1,6 +1,14 @@ --- old.jsDeclarationsImportTypeBundled.types +++ new.jsDeclarationsImportTypeBundled.types -@@= skipped -7, +7 lines =@@ +@@= skipped -2, +2 lines =@@ + === folder/mod1.js === + /** + * @typedef {{x: number}} Item ++>Item : any ++>x : number ++ + */ + /** * @type {Item}; */ const x = {x: 12}; @@ -25,7 +33,7 @@ /** @type {(typeof import("./folder/mod1"))[]} */ const items = [{x: 12}]; ->items : import("folder/mod1").Item[] -+>items : { x: number; }[] ++>items : typeof import("folder/mod1")[] >[{x: 12}] : { x: number; }[] >{x: 12} : { x: number; } >x : number @@ -37,9 +45,9 @@ ->module : { exports: import("folder/mod1").Item[]; } ->exports : import("folder/mod1").Item[] ->items : import("folder/mod1").Item[] -+>module.exports = items : { x: number; }[] ++>module.exports = items : typeof import("folder/mod1")[] +>module.exports : any +>module : any +>exports : any -+>items : { x: number; }[] ++>items : typeof import("folder/mod1")[] diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt.diff new file mode 100644 index 0000000000..fd7f1f4724 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJSDocRedirectedLookups.errors.txt.diff @@ -0,0 +1,65 @@ +--- old.jsDeclarationsJSDocRedirectedLookups.errors.txt ++++ new.jsDeclarationsJSDocRedirectedLookups.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++index.js(5,12): error TS2304: Cannot find name 'Void'. ++index.js(6,12): error TS2304: Cannot find name 'Undefined'. ++index.js(7,12): error TS2304: Cannot find name 'Null'. ++index.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++index.js(11,12): error TS2552: Cannot find name 'array'. Did you mean 'Array'? ++index.js(12,12): error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? ++index.js(13,12): error TS2315: Type 'Object' is not generic. ++index.js(30,12): error TS2749: 'event' refers to a value, but is being used as a type here. Did you mean 'typeof event'? ++ ++ ++==== index.js (8 errors) ==== ++ // these are recognized as TS concepts by the checker ++ /** @type {String} */const a = ""; ++ /** @type {Number} */const b = 0; ++ /** @type {Boolean} */const c = true; ++ /** @type {Void} */const d = undefined; ++ ~~~~ ++!!! error TS2304: Cannot find name 'Void'. ++ /** @type {Undefined} */const e = undefined; ++ ~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Undefined'. ++ /** @type {Null} */const f = null; ++ ~~~~ ++!!! error TS2304: Cannot find name 'Null'. ++ ++ /** @type {Function} */const g = () => void 0; ++ /** @type {function} */const h = () => void 0; ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ /** @type {array} */const i = []; ++ ~~~~~ ++!!! error TS2552: Cannot find name 'array'. Did you mean 'Array'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Array' is declared here. ++ /** @type {promise} */const j = Promise.resolve(0); ++ ~~~~~~~ ++!!! error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? ++!!! related TS2728 lib.es2015.promise.d.ts:--:--: 'Promise' is declared here. ++ /** @type {Object} */const k = {x: "x"}; ++ ~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. ++ ++ ++ // these are not recognized as anything and should just be lookup failures ++ // ignore the errors to try to ensure they're emitted as `any` in declaration emit ++ // @ts-ignore ++ /** @type {class} */const l = true; ++ // @ts-ignore ++ /** @type {bool} */const m = true; ++ // @ts-ignore ++ /** @type {int} */const n = true; ++ // @ts-ignore ++ /** @type {float} */const o = true; ++ // @ts-ignore ++ /** @type {integer} */const p = true; ++ ++ // or, in the case of `event` likely erroneously refers to the type of the global Event object ++ /** @type {event} */const q = undefined; ++ ~~~~~ ++!!! error TS2749: 'event' refers to a value, but is being used as a type here. Did you mean 'typeof event'? diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJSDocRedirectedLookups.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJSDocRedirectedLookups.types.diff index dcd308c317..8de5245bea 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJSDocRedirectedLookups.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJSDocRedirectedLookups.types.diff @@ -5,59 +5,62 @@ // these are recognized as TS concepts by the checker /** @type {String} */const a = ""; ->a : string -+>a : "" ++>a : String >"" : "" /** @type {Number} */const b = 0; ->b : number -+>b : 0 ++>b : Number >0 : 0 /** @type {Boolean} */const c = true; ->c : boolean -+>c : true ++>c : Boolean >true : true /** @type {Void} */const d = undefined; ->d : void -+>d : undefined ++>d : Void >undefined : undefined /** @type {Undefined} */const e = undefined; -@@= skipped -23, +23 lines =@@ - >f : null +->e : undefined ++>e : Undefined + >undefined : undefined + + /** @type {Null} */const f = null; +->f : null ++>f : Null /** @type {Function} */const g = () => void 0; -->g : Function -+>g : () => undefined - >() => void 0 : () => undefined - >void 0 : undefined + >g : Function +@@= skipped -29, +29 lines =@@ >0 : 0 /** @type {function} */const h = () => void 0; ->h : Function -+>h : () => undefined ++>h : function >() => void 0 : () => undefined >void 0 : undefined >0 : 0 /** @type {array} */const i = []; ->i : any[] -+>i : never[] ++>i : array >[] : never[] /** @type {promise} */const j = Promise.resolve(0); ->j : Promise -+>j : Promise ++>j : promise >Promise.resolve(0) : Promise >Promise.resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; } >Promise : PromiseConstructor -@@= skipped -24, +24 lines =@@ +@@= skipped -18, +18 lines =@@ >0 : 0 /** @type {Object} */const k = {x: "x"}; ->k : { [x: string]: string; } -+>k : { x: string; } ++>k : any >{x: "x"} : { x: string; } >x : string >"x" : "x" @@ -66,36 +69,36 @@ // @ts-ignore /** @type {class} */const l = true; ->l : error -+>l : true ++>l : class >true : true // @ts-ignore /** @type {bool} */const m = true; ->m : error -+>m : true ++>m : bool >true : true // @ts-ignore /** @type {int} */const n = true; ->n : error -+>n : true ++>n : int >true : true // @ts-ignore /** @type {float} */const o = true; ->o : error -+>o : true ++>o : float >true : true // @ts-ignore /** @type {integer} */const p = true; ->p : error -+>p : true ++>p : integer >true : true // or, in the case of `event` likely erroneously refers to the type of the global Event object /** @type {event} */const q = undefined; ->q : Event | undefined -+>q : undefined ++>q : event >undefined : undefined diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingGenerics.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingGenerics.errors.txt.diff new file mode 100644 index 0000000000..83d2307f9d --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingGenerics.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.jsDeclarationsMissingGenerics.errors.txt ++++ new.jsDeclarationsMissingGenerics.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++file.js(2,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++file.js(6,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). ++ ++ ++==== file.js (2 errors) ==== ++ /** ++ * @param {Array} x ++ ~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). ++ */ ++ function x(x) {} ++ /** ++ * @param {Promise} x ++ ~~~~~~~ ++!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). ++ */ ++ function y(x) {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff new file mode 100644 index 0000000000..9fa727f35c --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff @@ -0,0 +1,43 @@ +--- old.jsDeclarationsMissingTypeParameters.errors.txt ++++ new.jsDeclarationsMissingTypeParameters.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++file.js(2,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++file.js(12,14): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++file.js(12,19): error TS8020: JSDoc types can only be used inside documentation comments. ++file.js(12,20): error TS1099: Type argument list cannot be empty. ++file.js(18,14): error TS2314: Generic type 'Promise' requires 1 type argument(s). ++ ++ ++==== file.js (5 errors) ==== ++ /** ++ * @param {Array=} y desc ++ ~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). ++ */ ++ function x(y) { } ++ ++ // @ts-ignore ++ /** @param {function (Array)} func Invoked ++ */ ++ function y(func) { return; } ++ ++ /** ++ * @return {(Array.<> | null)} list of devices ++ ~~~~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). ++ ~ ++!!! error TS8020: JSDoc types can only be used inside documentation comments. ++ ~~ ++!!! error TS1099: Type argument list cannot be empty. ++ */ ++ function z() { return null ;} ++ ++ /** ++ * ++ * @return {?Promise} A promise ++ ~~~~~~~ ++!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). ++ */ ++ function w() { return null; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.types.diff index 3b61d0a996..d4a01d6813 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.types.diff @@ -6,7 +6,7 @@ function x(y) { } ->x : (y?: any[] | undefined) => void ->y : any[] -+>x : (y: any) => void ++>x : (y?: any) => void +>y : any // @ts-ignore diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff new file mode 100644 index 0000000000..0b455a33c0 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff @@ -0,0 +1,24 @@ +--- old.jsDeclarationsModuleReferenceHasEmit.errors.txt ++++ new.jsDeclarationsModuleReferenceHasEmit.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++index.js(9,11): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++ ++ ++==== index.js (1 errors) ==== ++ /** ++ * @module A ++ */ ++ class A {} ++ ++ ++ /** ++ * Target element ++ * @type {module:A} ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++ */ ++ export let el = null; ++ ++ export default A; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.types.diff index ed86842dcc..0a0c71baee 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.types.diff @@ -5,7 +5,7 @@ */ export let el = null; ->el : error -+>el : any ++>el : module export default A; >A : A diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsNestedParams.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsNestedParams.errors.txt.diff new file mode 100644 index 0000000000..67afcc4341 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsNestedParams.errors.txt.diff @@ -0,0 +1,38 @@ +--- old.jsDeclarationsNestedParams.errors.txt ++++ new.jsDeclarationsNestedParams.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++file.js(7,26): error TS8020: JSDoc types can only be used inside documentation comments. ++file.js(20,26): error TS8020: JSDoc types can only be used inside documentation comments. ++ ++ ++==== file.js (2 errors) ==== ++ class X { ++ /** ++ * Cancels the request, sending a cancellation to the other party ++ * @param {Object} error __auto_generated__ ++ * @param {string?} error.reason the error reason to send the cancellation with ++ * @param {string?} error.code the error code to send the cancellation with ++ * @returns {Promise.<*>} resolves when the event has been sent. ++ ~ ++!!! error TS8020: JSDoc types can only be used inside documentation comments. ++ */ ++ async cancel({reason, code}) {} ++ } ++ ++ class Y { ++ /** ++ * Cancels the request, sending a cancellation to the other party ++ * @param {Object} error __auto_generated__ ++ * @param {string?} error.reason the error reason to send the cancellation with ++ * @param {Object} error.suberr ++ * @param {string?} error.suberr.reason the error reason to send the cancellation with ++ * @param {string?} error.suberr.code the error code to send the cancellation with ++ * @returns {Promise.<*>} resolves when the event has been sent. ++ ~ ++!!! error TS8020: JSDoc types can only be used inside documentation comments. ++ */ ++ async cancel({reason, suberr}) {} ++ } ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsNestedParams.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsNestedParams.types.diff index 47dd234c84..955c308339 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsNestedParams.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsNestedParams.types.diff @@ -7,7 +7,7 @@ ->cancel : ({ reason, code }: { reason: string | null; code: string | null;}) => Promise ->reason : string ->code : string -+>cancel : (__0: { code: any; reason: any; }) => Promise ++>cancel : (__0: { code: any; reason: any; }) => Promise +>reason : any +>code : any } @@ -20,7 +20,7 @@ ->cancel : ({ reason, suberr }: { reason: string | null; suberr: { reason: string | null; code: string | null; };}) => Promise ->reason : string ->suberr : { reason: string | null; code: string | null; } -+>cancel : (__0: { reason: any; suberr: any; }) => Promise ++>cancel : (__0: { reason: any; suberr: any; }) => Promise +>reason : any +>suberr : any } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsOptionalTypeLiteralProps1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsOptionalTypeLiteralProps1.types.diff index 2de115c9e7..cb81720b04 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsOptionalTypeLiteralProps1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsOptionalTypeLiteralProps1.types.diff @@ -8,7 +8,7 @@ ->a : number ->b : number ->c : number -+>foo : (__0: { a: any; b: any; c: any; }) => any ++>foo : (__0: { a: any; b: any; c: any; }) => number +>a : any +>b : any +>c : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsOptionalTypeLiteralProps2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsOptionalTypeLiteralProps2.types.diff index d1670d2eaf..076b5af32a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsOptionalTypeLiteralProps2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsOptionalTypeLiteralProps2.types.diff @@ -8,7 +8,7 @@ ->a : number ->b : number | undefined ->c : number | undefined -+>foo : (__0: { a: any; b: any; c: any; }) => any ++>foo : (__0: { a: any; b: any; c: any; }) => number +>a : any +>b : any +>c : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff index 17b4baf21c..ab6b8594d0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff @@ -4,6 +4,7 @@ - @@= skipped --1, +1 lines =@@ +base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++file.js(1,22): error TS2306: File 'base.js' is not a module. + + +==== base.js (1 errors) ==== @@ -21,8 +22,10 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== file.js (0 errors) ==== ++==== file.js (1 errors) ==== + /** @typedef {import('./base')} BaseFactory */ ++ ~~~~~~~~ ++!!! error TS2306: File 'base.js' is not a module. + /** + * @callback BaseFactoryFactory + * @param {import('./base')} factory diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff index 2e1c6c6c7d..599b276af8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff @@ -13,7 +13,13 @@ >BaseFactory : { (): Base; Base: typeof Base; } === file.js === -@@= skipped -22, +22 lines =@@ + /** @typedef {import('./base')} BaseFactory */ ++>BaseFactory : any ++ + /** + * @callback BaseFactoryFactory + * @param {import('./base')} factory +@@= skipped -22, +24 lines =@@ * @returns {InstanceType} */ const test = (base) => { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff index 88e0ccb660..bc3ee2343a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff @@ -4,6 +4,7 @@ - @@= skipped --1, +1 lines =@@ +base.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++file.js(1,29): error TS2306: File 'base.js' is not a module. + + +==== base.js (1 errors) ==== @@ -21,8 +22,10 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== file.js (0 errors) ==== ++==== file.js (1 errors) ==== + /** @typedef {typeof import('./base')} BaseFactory */ ++ ~~~~~~~~ ++!!! error TS2306: File 'base.js' is not a module. + + /** + * diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff index 0d97f79029..602bdbd740 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff @@ -13,7 +13,12 @@ >BaseFactory : { (): Base; Base: typeof Base; } === file.js === -@@= skipped -14, +14 lines =@@ + /** @typedef {typeof import('./base')} BaseFactory */ ++>BaseFactory : any + + /** + * +@@= skipped -14, +15 lines =@@ * @returns {InstanceType} */ const test = (base) => { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.errors.txt.diff index 17c105f385..ba62b06bd8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.errors.txt.diff @@ -7,6 +7,7 @@ +jsDeclarationsReactComponents1.jsx(3,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. +jsDeclarationsReactComponents2.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. +jsDeclarationsReactComponents3.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. ++jsDeclarationsReactComponents3.jsx(3,73): error TS2503: Cannot find namespace 'JSX'. +jsDeclarationsReactComponents4.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. +jsDeclarationsReactComponents5.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. +jsDeclarationsReactComponents5.jsx(2,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. @@ -60,12 +61,14 @@ + + export default TabbedShowLayout; + -+==== jsDeclarationsReactComponents3.jsx (1 errors) ==== ++==== jsDeclarationsReactComponents3.jsx (2 errors) ==== + import React from "react"; + ~~~~~~~ +!!! error TS2307: Cannot find module 'react' or its corresponding type declarations. + /** + * @type {{defaultProps: {tabs: string}} & ((props?: {elem: string}) => JSX.Element)} ++ ~~~ ++!!! error TS2503: Cannot find namespace 'JSX'. + */ + const TabbedShowLayout = () => { + return ( diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.types.diff index effed9459b..a5bab9916c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.types.diff @@ -80,7 +80,7 @@ const TabbedShowLayout = () => { ->TabbedShowLayout : React.SFC<{}> ->() => { return (

ok
);} : { (): JSX.Element; defaultProps: Partial<{}> | undefined; } -+>TabbedShowLayout : { (): any; defaultProps: { tabs: string; }; } ++>TabbedShowLayout : SFC +>() => { return (
ok
);} : { (): any; defaultProps: { tabs: string; }; } return ( @@ -105,9 +105,9 @@ ->TabbedShowLayout.defaultProps : Partial<{}> | undefined ->TabbedShowLayout : React.SFC<{}> ->defaultProps : Partial<{}> | undefined -+>TabbedShowLayout.defaultProps : { tabs: string; } -+>TabbedShowLayout : { (): any; defaultProps: { tabs: string; }; } -+>defaultProps : { tabs: string; } ++>TabbedShowLayout.defaultProps : any ++>TabbedShowLayout : SFC ++>defaultProps : any >{ tabs: "default value"} : { tabs: string; } tabs: "default value" @@ -116,7 +116,7 @@ export default TabbedShowLayout; ->TabbedShowLayout : React.SFC<{}> -+>TabbedShowLayout : { (): any; defaultProps: { tabs: string; }; } ++>TabbedShowLayout : SFC === jsDeclarationsReactComponents3.jsx === import React from "react"; @@ -129,7 +129,7 @@ const TabbedShowLayout = () => { ->TabbedShowLayout : { defaultProps: { tabs: string; }; } & ((props?: { elem: string; }) => JSX.Element) ->() => { return (
ok
);} : { (): JSX.Element; defaultProps: { tabs: string; }; } -+>TabbedShowLayout : { (): any; defaultProps: { tabs: string; }; } ++>TabbedShowLayout : { defaultProps: { tabs: string; }; } & (props?: { elem: string; } | undefined) => Element +>() => { return (
ok
);} : { (): any; defaultProps: { tabs: string; }; } return ( @@ -152,7 +152,7 @@ >TabbedShowLayout.defaultProps = { tabs: "default value"} : { tabs: string; } >TabbedShowLayout.defaultProps : { tabs: string; } ->TabbedShowLayout : { defaultProps: { tabs: string; }; } & ((props?: { elem: string; }) => JSX.Element) -+>TabbedShowLayout : { (): any; defaultProps: { tabs: string; }; } ++>TabbedShowLayout : { defaultProps: { tabs: string; }; } & (props?: { elem: string; } | undefined) => Element >defaultProps : { tabs: string; } >{ tabs: "default value"} : { tabs: string; } @@ -161,7 +161,7 @@ export default TabbedShowLayout; ->TabbedShowLayout : { defaultProps: { tabs: string; }; } & ((props?: { elem: string; }) => JSX.Element) -+>TabbedShowLayout : { (): any; defaultProps: { tabs: string; }; } ++>TabbedShowLayout : { defaultProps: { tabs: string; }; } & (props?: { elem: string; } | undefined) => Element === jsDeclarationsReactComponents4.jsx === import React from "react"; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff new file mode 100644 index 0000000000..857b84e064 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff @@ -0,0 +1,46 @@ +--- old.jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt ++++ new.jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++index.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++index.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++index.js(22,12): error TS2315: Type 'Object' is not generic. ++index.js(22,18): error TS8020: JSDoc types can only be used inside documentation comments. ++ ++ ++==== index.js (4 errors) ==== ++ /** @type {?} */ ++ export const a = null; ++ ++ /** @type {*} */ ++ export const b = null; ++ ++ /** @type {string?} */ ++ export const c = null; ++ ++ /** @type {string=} */ ++ export const d = null; ++ ++ /** @type {string!} */ ++ export const e = null; ++ ++ /** @type {function(string, number): object} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ export const f = null; ++ ++ /** @type {function(new: object, string, number)} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ export const g = null; ++ ++ /** @type {Object.} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. ++ ~ ++!!! error TS8020: JSDoc types can only be used inside documentation comments. ++ export const h = null; ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.types.diff index 947063abd7..09e984f0b1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.types.diff @@ -1,31 +1,16 @@ --- old.jsDeclarationsReusesExistingNodesMappingJSDocTypes.types +++ new.jsDeclarationsReusesExistingNodesMappingJSDocTypes.types -@@= skipped -10, +10 lines =@@ - - /** @type {string?} */ - export const c = null; -->c : string -+>c : any - - /** @type {string=} */ - export const d = null; -->d : string -+>d : any - - /** @type {string!} */ - export const e = null; -->e : string -+>e : any +@@= skipped -22, +22 lines =@@ /** @type {function(string, number): object} */ export const f = null; ->f : (arg0: string, arg1: number) => object -+>f : any ++>f : function /** @type {function(new: object, string, number)} */ export const g = null; ->g : new (arg1: string, arg2: number) => any -+>g : any ++>g : function /** @type {Object.} */ export const h = null; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt.diff index fdadf3dc09..c0de87cea9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingTypeAnnotations.errors.txt.diff @@ -3,17 +3,11 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+index.js(83,9): error TS7032: Property 'p1' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+index.js(83,12): error TS7006: Parameter 'value' implicitly has an 'any' type. -+index.js(88,9): error TS7032: Property 'p2' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+index.js(88,12): error TS7006: Parameter 'value' implicitly has an 'any' type. -+index.js(93,9): error TS7032: Property 'p3' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+index.js(93,12): error TS7006: Parameter 'value' implicitly has an 'any' type. -+index.js(98,9): error TS7032: Property 'p4' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+index.js(98,12): error TS7006: Parameter 'value' implicitly has an 'any' type. ++index.js(45,17): error TS1051: A 'set' accessor cannot have an optional parameter. ++index.js(83,17): error TS1051: A 'set' accessor cannot have an optional parameter. + + -+==== index.js (8 errors) ==== ++==== index.js (2 errors) ==== + class С1 { + /** @type {string=} */ + p1 = undefined; @@ -59,6 +53,8 @@ + + /** @param {string=} value */ + set p1(value) { ++ ++!!! error TS1051: A 'set' accessor cannot have an optional parameter. + this.p1 = value; + } + @@ -97,37 +93,23 @@ + class С4 { + /** @param {string=} value */ + set p1(value) { -+ ~~ -+!!! error TS7032: Property 'p1' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+ ~~~~~ -+!!! error TS7006: Parameter 'value' implicitly has an 'any' type. ++ ++!!! error TS1051: A 'set' accessor cannot have an optional parameter. + this.p1 = value; + } + + /** @param {string | undefined} value */ + set p2(value) { -+ ~~ -+!!! error TS7032: Property 'p2' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+ ~~~~~ -+!!! error TS7006: Parameter 'value' implicitly has an 'any' type. + this.p2 = value; + } + + /** @param {?string} value */ + set p3(value) { -+ ~~ -+!!! error TS7032: Property 'p3' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+ ~~~~~ -+!!! error TS7006: Parameter 'value' implicitly has an 'any' type. + this.p3 = value; + } + + /** @param {string | null} value */ + set p4(value) { -+ ~~ -+!!! error TS7032: Property 'p4' implicitly has type 'any', because its set accessor lacks a parameter type annotation. -+ ~~~~~ -+!!! error TS7006: Parameter 'value' implicitly has an 'any' type. + this.p4 = value; + } + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingTypeAnnotations.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingTypeAnnotations.types.diff index c5ece9463c..3b34f975c9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingTypeAnnotations.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingTypeAnnotations.types.diff @@ -1,32 +1,6 @@ --- old.jsDeclarationsReusesExistingTypeAnnotations.types +++ new.jsDeclarationsReusesExistingTypeAnnotations.types -@@= skipped -5, +5 lines =@@ - - /** @type {string=} */ - p1 = undefined; -->p1 : string | undefined -+>p1 : undefined - >undefined : undefined - - /** @type {string | undefined} */ - p2 = undefined; -->p2 : string | undefined -+>p2 : undefined - >undefined : undefined - - /** @type {?string} */ - p3 = null; -->p3 : string | null -+>p3 : null - - /** @type {string | null} */ - p4 = null; -->p4 : string | null -+>p4 : null - } - - class С2 { -@@= skipped -22, +22 lines =@@ +@@= skipped -27, +27 lines =@@ /** @type {string=} */ get p1() { @@ -61,195 +35,3 @@ return null; } -@@= skipped -19, +19 lines =@@ - - /** @type {string=} */ - get p1() { -->p1 : string | undefined -+>p1 : undefined - - return undefined; - >undefined : undefined -@@= skipped -8, +8 lines =@@ - - /** @param {string=} value */ - set p1(value) { -->p1 : string | undefined -->value : string | undefined -+>p1 : undefined -+>value : undefined - - this.p1 = value; -->this.p1 = value : string | undefined -->this.p1 : string | undefined -+>this.p1 = value : undefined -+>this.p1 : undefined - >this : this -->p1 : string | undefined -->value : string | undefined -+>p1 : undefined -+>value : undefined - } - - /** @type {string | undefined} */ - get p2() { -->p2 : string | undefined -+>p2 : undefined - - return undefined; - >undefined : undefined -@@= skipped -21, +21 lines =@@ - - /** @param {string | undefined} value */ - set p2(value) { -->p2 : string | undefined -->value : string | undefined -+>p2 : undefined -+>value : undefined - - this.p2 = value; -->this.p2 = value : string | undefined -->this.p2 : string | undefined -+>this.p2 = value : undefined -+>this.p2 : undefined - >this : this -->p2 : string | undefined -->value : string | undefined -+>p2 : undefined -+>value : undefined - } - - /** @type {?string} */ - get p3() { -->p3 : string | null -+>p3 : null - - return null; - } - - /** @param {?string} value */ - set p3(value) { -->p3 : string | null -->value : string | null -+>p3 : null -+>value : null - - this.p3 = value; -->this.p3 = value : string | null -->this.p3 : string | null -+>this.p3 = value : null -+>this.p3 : null - >this : this -->p3 : string | null -->value : string | null -+>p3 : null -+>value : null - } - - /** @type {string | null} */ - get p4() { -->p4 : string | null -+>p4 : null - - return null; - } - - /** @param {string | null} value */ - set p4(value) { -->p4 : string | null -->value : string | null -+>p4 : null -+>value : null - - this.p4 = value; -->this.p4 = value : string | null -->this.p4 : string | null -+>this.p4 = value : null -+>this.p4 : null - >this : this -->p4 : string | null -->value : string | null -+>p4 : null -+>value : null - } - } - -@@= skipped -58, +58 lines =@@ - - /** @param {string=} value */ - set p1(value) { -->p1 : string | undefined -->value : string | undefined -+>p1 : any -+>value : any - - this.p1 = value; -->this.p1 = value : string | undefined -->this.p1 : string | undefined -+>this.p1 = value : any -+>this.p1 : any - >this : this -->p1 : string | undefined -->value : string | undefined -+>p1 : any -+>value : any - } - - /** @param {string | undefined} value */ - set p2(value) { -->p2 : string | undefined -->value : string | undefined -+>p2 : any -+>value : any - - this.p2 = value; -->this.p2 = value : string | undefined -->this.p2 : string | undefined -+>this.p2 = value : any -+>this.p2 : any - >this : this -->p2 : string | undefined -->value : string | undefined -+>p2 : any -+>value : any - } - - /** @param {?string} value */ - set p3(value) { -->p3 : string | null -->value : string | null -+>p3 : any -+>value : any - - this.p3 = value; -->this.p3 = value : string | null -->this.p3 : string | null -+>this.p3 = value : any -+>this.p3 : any - >this : this -->p3 : string | null -->value : string | null -+>p3 : any -+>value : any - } - - /** @param {string | null} value */ - set p4(value) { -->p4 : string | null -->value : string | null -+>p4 : any -+>value : any - - this.p4 = value; -->this.p4 = value : string | null -->this.p4 : string | null -+>this.p4 = value : any -+>this.p4 : any - >this : this -->p4 : string | null -->value : string | null -+>p4 : any -+>value : any - } - } - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsSubclassWithExplicitNoArgumentConstructor.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsSubclassWithExplicitNoArgumentConstructor.types.diff deleted file mode 100644 index 7eb7b1df94..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsSubclassWithExplicitNoArgumentConstructor.types.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.jsDeclarationsSubclassWithExplicitNoArgumentConstructor.types -+++ new.jsDeclarationsSubclassWithExplicitNoArgumentConstructor.types -@@= skipped -8, +8 lines =@@ - * @param {string} secondArg - */ - constructor(firstArg, secondArg) { } -->firstArg : string -->secondArg : string -+>firstArg : any -+>secondArg : any - } - - export class Sub extends Super { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeAliases.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeAliases.types.diff index 43134007da..ec82c484ed 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeAliases.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeAliases.types.diff @@ -1,25 +1,16 @@ --- old.jsDeclarationsTypeAliases.types +++ new.jsDeclarationsTypeAliases.types -@@= skipped -37, +37 lines =@@ - * @returns {SomeType} +@@= skipped -31, +31 lines =@@ + === mixed.js === + /** + * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType ++>SomeType : SomeType ++>x : string ++ */ - function doTheThing(x) { -->doTheThing : (x: number) => SomeType -->x : number -+>doTheThing : (x: any) => { x: string; } -+>x : any - - return {x: ""+x}; - >{x: ""+x} : { x: string; } - >x : string - >""+x : string - >"" : "" -->x : number -+>x : any - } - class ExportedThing { - >ExportedThing : ExportedThing -@@= skipped -18, +18 lines =@@ + /** + * @param {number} x +@@= skipped -24, +27 lines =@@ >"ok" : "ok" } module.exports = { @@ -27,16 +18,10 @@ ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ doTheThing, ExportedThing,} : { doTheThing: (x: number) => SomeType; ExportedThing: typeof ExportedThing; } -+>module.exports = { doTheThing, ExportedThing,} : { doTheThing: (x: any) => { x: string; }; ExportedThing: typeof ExportedThing; } ++>module.exports = { doTheThing, ExportedThing,} : { doTheThing: (x: number) => SomeType; ExportedThing: typeof ExportedThing; } +>module.exports : any +>module : any +>exports : any -+>{ doTheThing, ExportedThing,} : { doTheThing: (x: any) => { x: string; }; ExportedThing: typeof ExportedThing; } + >{ doTheThing, ExportedThing,} : { doTheThing: (x: number) => SomeType; ExportedThing: typeof ExportedThing; } doTheThing, -->doTheThing : (x: number) => SomeType -+>doTheThing : (x: any) => { x: string; } - - ExportedThing, - >ExportedThing : typeof ExportedThing diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types.diff index 974ec8181e..9cac2c44f6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types.diff @@ -1,22 +1,14 @@ --- old.jsDeclarationsTypeReassignmentFromDeclaration.types +++ new.jsDeclarationsTypeReassignmentFromDeclaration.types -@@= skipped -13, +13 lines =@@ - === index.js === - /** @type {typeof import("/some-mod")} */ - const items = []; -->items : Item[] -+>items : any[] - >[] : undefined[] +@@= skipped -18, +18 lines =@@ module.exports = items; -->module.exports = items : Item[] + >module.exports = items : Item[] ->module.exports : Item[] ->module : { exports: Item[]; } ->exports : Item[] -->items : Item[] -+>module.exports = items : any[] +>module.exports : any +>module : any +>exports : any -+>items : any[] + >items : Item[] diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff index 4e172cc4ee..f71263fffb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff @@ -4,6 +4,7 @@ - @@= skipped --1, +1 lines =@@ +conn.js(11,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++usage.js(2,14): error TS1340: Module './conn' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./conn')'? +usage.js(10,14): error TS2339: Property 'connItem' does not exist on type 'Wrap'. +usage.js(12,14): error TS2339: Property 'another' does not exist on type 'Wrap'. +usage.js(16,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -24,9 +25,11 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== usage.js (3 errors) ==== ++==== usage.js (4 errors) ==== + /** + * @typedef {import("./conn")} Conn ++ ~~~~~~~~~~~~~~~~ ++!!! error TS1340: Module './conn' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./conn')'? + */ + + class Wrap { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff index d0c2c9e3f5..40b997814c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff @@ -1,6 +1,15 @@ --- old.jsDeclarationsTypedefAndImportTypes.types +++ new.jsDeclarationsTypedefAndImportTypes.types -@@= skipped -18, +18 lines =@@ +@@= skipped -2, +2 lines =@@ + === conn.js === + /** + * @typedef {string | number} Whatever ++>Whatever : any ++ + */ + + class Conn { +@@= skipped -16, +18 lines =@@ module.exports = Conn; >module.exports = Conn : typeof Conn @@ -13,7 +22,14 @@ >Conn : typeof Conn === usage.js === -@@= skipped -17, +17 lines =@@ + /** + * @typedef {import("./conn")} Conn ++>Conn : any ++ + */ + + class Wrap { +@@= skipped -17, +19 lines =@@ * @param {Conn} c */ constructor(c) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff index c9b7a1ae44..e8f0b635bd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff @@ -5,14 +5,17 @@ @@= skipped --1, +1 lines =@@ +LazySet.js(13,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(1,17): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(3,12): error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? + + -+==== index.js (1 errors) ==== ++==== index.js (2 errors) ==== + const LazySet = require("./LazySet"); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + /** @type {LazySet} */ ++ ~~~~~~~ ++!!! error TS2749: 'LazySet' refers to a value, but is being used as a type here. Did you mean 'typeof LazySet'? + const stringSet = undefined; + stringSet.addAll(stringSet); + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff index bd3792d4d4..a62032b2ab 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff @@ -11,49 +11,47 @@ >require : any >"./LazySet" : "./LazySet" - /** @type {LazySet} */ - const stringSet = undefined; -->stringSet : LazySet -+>stringSet : any +@@= skipped -11, +11 lines =@@ >undefined : undefined stringSet.addAll(stringSet); ->stringSet.addAll(stringSet) : void ->stringSet.addAll : (iterable: LazySet) => void -->stringSet : LazySet -->addAll : (iterable: LazySet) => void -->stringSet : LazySet +>stringSet.addAll(stringSet) : any +>stringSet.addAll : any -+>stringSet : any + >stringSet : LazySet +->addAll : (iterable: LazySet) => void +>addAll : any -+>stringSet : any + >stringSet : LazySet - === LazySet.js === -@@= skipped -30, +30 lines =@@ - * @param {LazySet} iterable +@@= skipped -11, +11 lines =@@ + // Comment out this JSDoc, and note that the errors index.js go away. + /** + * @typedef {Object} SomeObject ++>SomeObject : any ++ + */ + class LazySet { + >LazySet : LazySet +@@= skipped -9, +11 lines =@@ */ addAll(iterable) {} -->addAll : (iterable: LazySet) => void + >addAll : (iterable: LazySet) => void ->iterable : import("LazySet") -+>addAll : (iterable: any) => void -+>iterable : any ++>iterable : LazySet [Symbol.iterator]() {} >[Symbol.iterator] : () => void @@= skipped -11, +11 lines =@@ - } module.exports = LazySet; -->module.exports = LazySet : typeof LazySet + >module.exports = LazySet : typeof LazySet ->module.exports : typeof LazySet ->module : { exports: typeof LazySet; } ->exports : typeof LazySet -->LazySet : typeof LazySet -+>module.exports = LazySet : any +>module.exports : any +>module : any +>exports : any -+>LazySet : any + >LazySet : typeof LazySet diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefFunction.types.diff index 6c596c0d9f..df34b8e8ff 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefFunction.types.diff @@ -1,37 +1,33 @@ --- old.jsDeclarationsTypedefFunction.types +++ new.jsDeclarationsTypedefFunction.types -@@= skipped -15, +15 lines =@@ +@@= skipped -4, +4 lines =@@ + * @typedef {{ + * [id: string]: [Function, Function]; + * }} ResolveRejectMap ++>ResolveRejectMap : any ++ + */ + + let id = 0 +@@= skipped -11, +13 lines =@@ * @returns {Promise} */ const send = handlers => new Promise((resolve, reject) => { ->send : (handlers: ResolveRejectMap) => Promise ->handlers => new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : (handlers: ResolveRejectMap) => Promise ->handlers : ResolveRejectMap -->new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : Promise -+>send : (handlers: any) => Promise -+>handlers => new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : (handlers: any) => Promise -+>handlers : any -+>new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : Promise ++>send : (handlers: { [id: string]: [Function, Function]; }) => Promise ++>handlers => new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : (handlers: { [id: string]: [Function, Function]; }) => Promise ++>handlers : { [id: string]: [Function, Function]; } + >new Promise((resolve, reject) => { handlers[++id] = [resolve, reject]}) : Promise >Promise : PromiseConstructor -->(resolve, reject) => { handlers[++id] = [resolve, reject]} : (resolve: (value: any) => void, reject: (reason?: any) => void) => void -->resolve : (value: any) => void -+>(resolve, reject) => { handlers[++id] = [resolve, reject]} : (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void -+>resolve : (value: unknown) => void - >reject : (reason?: any) => void - + >(resolve, reject) => { handlers[++id] = [resolve, reject]} : (resolve: (value: any) => void, reject: (reason?: any) => void) => void +@@= skipped -12, +12 lines =@@ handlers[++id] = [resolve, reject] -->handlers[++id] = [resolve, reject] : [(value: any) => void, (reason?: any) => void] -->handlers[++id] : [Function, Function] + >handlers[++id] = [resolve, reject] : [(value: any) => void, (reason?: any) => void] + >handlers[++id] : [Function, Function] ->handlers : ResolveRejectMap -+>handlers[++id] = [resolve, reject] : (value: unknown) => void[] -+>handlers[++id] : any -+>handlers : any ++>handlers : { [id: string]: [Function, Function]; } >++id : number >id : number -->[resolve, reject] : [(value: any) => void, (reason?: any) => void] -->resolve : (value: any) => void -+>[resolve, reject] : (value: unknown) => void[] -+>resolve : (value: unknown) => void - >reject : (reason?: any) => void - - }) + >[resolve, reject] : [(value: any) => void, (reason?: any) => void] diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff index 5b098b29d9..67bf093500 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff @@ -4,15 +4,18 @@ - @@= skipped --1, +1 lines =@@ +index.js(1,39): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(3,22): error TS2307: Cannot find module './module.js' or its corresponding type declarations. +index.js(21,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + -+==== index.js (2 errors) ==== ++==== index.js (3 errors) ==== + const {taskGroups, taskNameToGroup} = require('./module.js'); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + /** @typedef {import('./module.js').TaskGroup} TaskGroup */ ++ ~~~~~~~~~~~~~ ++!!! error TS2307: Cannot find module './module.js' or its corresponding type declarations. + + /** + * @typedef TaskNode diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff index 0969f84dfa..5f45d9a18f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff @@ -13,14 +13,38 @@ >require : any >'./module.js' : "./module.js" -@@= skipped -24, +24 lines =@@ + /** @typedef {import('./module.js').TaskGroup} TaskGroup */ ++>TaskGroup : any + + /** + * @typedef TaskNode ++>TaskNode : any ++ + * @prop {TaskNode[]} children ++>children : any ++ + * @prop {TaskNode|undefined} parent ++>parent : any ++ + * @prop {TaskGroup} group ++>group : any ++ + */ + + /** @typedef {{timers: Map}} PriorTaskData */ ++>PriorTaskData : any ++>timers : Map ++ + class MainThreadTasks { + >MainThreadTasks : MainThreadTasks + +@@= skipped -24, +36 lines =@@ * @param {TaskNode} y */ constructor(x, y){} ->x : import("module").TaskGroup -->y : TaskNode +>x : any -+>y : any + >y : TaskNode } module.exports = MainThreadTasks; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff new file mode 100644 index 0000000000..dd3cb451d4 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsUniqueSymbolUsage.errors.txt.diff @@ -0,0 +1,28 @@ +--- old.jsDeclarationsUniqueSymbolUsage.errors.txt ++++ new.jsDeclarationsUniqueSymbolUsage.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++b.js(2,28): error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. ++b.js(3,26): error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. ++ ++ ++==== a.js (0 errors) ==== ++ export const kSymbol = Symbol("my-symbol"); ++ ++ /** ++ * @typedef {{[kSymbol]: true}} WithSymbol ++ */ ++==== b.js (2 errors) ==== ++ /** ++ * @returns {import('./a').WithSymbol} ++ ~~~~~~~~~~ ++!!! error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. ++ * @param {import('./a').WithSymbol} value ++ ~~~~~~~~~~ ++!!! error TS2694: Namespace '"a"' has no exported member 'WithSymbol'. ++ */ ++ export function b(value) { ++ return value; ++ } ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocBindingInUnreachableCode.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocBindingInUnreachableCode.types.diff deleted file mode 100644 index f2d1b617e9..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocBindingInUnreachableCode.types.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.jsdocBindingInUnreachableCode.types -+++ new.jsdocBindingInUnreachableCode.types -@@= skipped -7, +7 lines =@@ - * @param {string} s - */ - const x = function (s) { -->x : (s: string) => void -->function (s) { } : (s: string) => void -->s : string -+>x : (s: any) => void -+>function (s) { } : (s: any) => void -+>s : any - - }; - } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.types.diff index 2f23df8525..8908ee9aa5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.types.diff @@ -1,6 +1,21 @@ --- old.jsdocCatchClauseWithTypeAnnotation.types +++ new.jsdocCatchClauseWithTypeAnnotation.types -@@= skipped -21, +21 lines =@@ +@@= skipped -2, +2 lines =@@ + === foo.js === + /** + * @typedef {any} Any ++>Any : any ++ + */ + + /** + * @typedef {unknown} Unknown ++>Unknown : unknown ++ + */ + + function fn() { +@@= skipped -19, +23 lines =@@ >err : any try { } catch (/** @type {unknown} */ err) { } // should be OK @@ -53,21 +68,3 @@ >foo : any try { } catch (/** @type {Error} */ err) { } // error in the type -@@= skipped -61, +61 lines =@@ - - /** @type {string} */ - let err; -->err : string -+>err : any - } - try { } - catch (err) { -@@= skipped -8, +8 lines =@@ - - /** @type {boolean} */ - var err; -->err : boolean -+>err : any - } - - try { } catch ({ x }) { } // should be OK diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocConstructorFunctionTypeReference.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocConstructorFunctionTypeReference.errors.txt.diff index cb035fb3cc..c21b318347 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocConstructorFunctionTypeReference.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocConstructorFunctionTypeReference.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+jsdocConstructorFunctionTypeReference.js(10,36): error TS7006: Parameter 'state' implicitly has an 'any' type. ++jsdocConstructorFunctionTypeReference.js(8,12): error TS2749: 'Validator' refers to a value, but is being used as a type here. Did you mean 'typeof Validator'? + + +==== jsdocConstructorFunctionTypeReference.js (1 errors) ==== @@ -15,10 +15,10 @@ + + /** + * @param {Validator} state ++ ~~~~~~~~~ ++!!! error TS2749: 'Validator' refers to a value, but is being used as a type here. Did you mean 'typeof Validator'? + */ + var validateRegExpFlags = function(state) { -+ ~~~~~ -+!!! error TS7006: Parameter 'state' implicitly has an 'any' type. + return state.flags + }; + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocConstructorFunctionTypeReference.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocConstructorFunctionTypeReference.types.diff index 07e6ec3e39..c72b259db6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocConstructorFunctionTypeReference.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocConstructorFunctionTypeReference.types.diff @@ -35,16 +35,16 @@ ->validateRegExpFlags : (state: Validator) => string ->function(state) { return state.flags} : (state: Validator) => string ->state : VFunc -+>validateRegExpFlags : (state: any) => any -+>function(state) { return state.flags} : (state: any) => any -+>state : any ++>validateRegExpFlags : (state: Validator) => any ++>function(state) { return state.flags} : (state: Validator) => any ++>state : Validator return state.flags ->state.flags : string ->state : VFunc ->flags : string +>state.flags : any -+>state : any ++>state : Validator +>flags : any }; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.errors.txt.diff index d174f92343..4dfb3b025c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.errors.txt.diff @@ -3,21 +3,28 @@ @@= skipped -0, +0 lines =@@ -functions.js(65,14): error TS2345: Argument of type 'typeof E' is not assignable to parameter of type 'new (arg1: number) => { length: number; }'. - Property 'length' is missing in type 'E' but required in type '{ length: number; }'. ++functions.js(3,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(5,14): error TS7006: Parameter 'c' implicitly has an 'any' type. +functions.js(9,23): error TS7006: Parameter 'n' implicitly has an 'any' type. ++functions.js(13,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(15,14): error TS7006: Parameter 'c' implicitly has an 'any' type. +functions.js(22,14): error TS2339: Property 'length' does not exist on type 'C'. ++functions.js(30,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(31,19): error TS7006: Parameter 'ab' implicitly has an 'any' type. +functions.js(31,23): error TS7006: Parameter 'onetwo' implicitly has an 'any' type. ++functions.js(49,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? +functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type. +functions.js(72,14): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. -==== functions.js (1 errors) ==== -+==== functions.js (8 errors) ==== ++==== functions.js (12 errors) ==== /** * @param {function(this: string, number): number} c is just passing on through * @return {function(this: string, number): number} ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function id1(c) { + ~ @@ -32,6 +39,9 @@ /** * @param {function(new: { length: number }, number): number} c is just passing on through * @return {function(new: { length: number }, number): number} ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. */ function id2(c) { + ~ @@ -39,7 +49,7 @@ return c } -@@= skipped -24, +36 lines =@@ +@@= skipped -24, +46 lines =@@ /** @param {number} n */ constructor(n) { this.length = n; @@ -48,9 +58,13 @@ } } -@@= skipped -9, +11 lines =@@ +@@= skipped -8, +10 lines =@@ + z.length; /** @type {function ("a" | "b", 1 | 2): 3 | 4} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. var f = function (ab, onetwo) { return ab === "a" ? 3 : 4; } + ~~ +!!! error TS7006: Parameter 'ab' implicitly has an 'any' type. @@ -59,8 +73,12 @@ /** -@@= skipped -20, +24 lines =@@ +@@= skipped -19, +26 lines =@@ + /** + * @param {function(new: D, number)} dref * @return {D} ++ ~ ++!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? */ var construct = function(dref) { return new dref(33); } + ~~~~ @@ -68,7 +86,7 @@ var z3 = construct(D); z3.length; -@@= skipped -14, +16 lines =@@ +@@= skipped -16, +20 lines =@@ var y3 = id2(E); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.types.diff index ed9309fc49..99cde71581 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.types.diff @@ -6,7 +6,7 @@ function id1(c) { ->id1 : (c: (this: string, arg1: number) => number) => (this: string, arg1: number) => number ->c : (this: string, arg1: number) => number -+>id1 : (c: any) => any ++>id1 : (c: any) => function +>c : any return c @@ -25,9 +25,9 @@ ->this : string ->length : number ->n : number -+>x : any -+>id1(function (n) { return this.length + n }) : any -+>id1 : (c: any) => any ++>x : function ++>id1(function (n) { return this.length + n }) : function ++>id1 : (c: any) => function +>function (n) { return this.length + n } : (n: any) => any +>n : any +>this.length + n : any @@ -43,7 +43,7 @@ function id2(c) { ->id2 : (c: new (arg1: number) => { length: number; }) => new (arg1: number) => { length: number; } ->c : new (arg1: number) => { length: number; } -+>id2 : (c: any) => any ++>id2 : (c: any) => function +>c : any return c @@ -52,31 +52,16 @@ } class C { -@@= skipped -36, +36 lines =@@ - - /** @param {number} n */ - constructor(n) { -->n : number -+>n : any - - this.length = n; -->this.length = n : number -+>this.length = n : any - >this.length : any - >this : this - >length : any -->n : number -+>n : any - } +@@= skipped -48, +48 lines =@@ } var y = id2(C); ->y : new (arg1: number) => { length: number; } ->id2(C) : new (arg1: number) => { length: number; } ->id2 : (c: new (arg1: number) => { length: number; }) => new (arg1: number) => { length: number; } -+>y : any -+>id2(C) : any -+>id2 : (c: any) => any ++>y : function ++>id2(C) : function ++>id2 : (c: any) => function >C : typeof C var z = new y(12); @@ -85,7 +70,7 @@ ->y : new (arg1: number) => { length: number; } +>z : any +>new y(12) : any -+>y : any ++>y : function >12 : 12 z.length; @@ -102,7 +87,7 @@ ->function (ab, onetwo) { return ab === "a" ? 3 : 4; } : (ab: "a" | "b", onetwo: 1 | 2) => 3 | 4 ->ab : "a" | "b" ->onetwo : 1 | 2 -+>f : (ab: any, onetwo: any) => 3 | 4 ++>f : function +>function (ab, onetwo) { return ab === "a" ? 3 : 4; } : (ab: any, onetwo: any) => 3 | 4 +>ab : any +>onetwo : any @@ -113,24 +98,21 @@ >"a" : "a" >3 : 3 >4 : 4 -@@= skipped -47, +47 lines =@@ +@@= skipped -35, +35 lines =@@ * @param {number} n */ function D(n) { ->D : typeof D -->n : number -+>D : (n: any) => void -+>n : any ++>D : (n: number) => void + >n : number this.length = n; -->this.length = n : number -+>this.length = n : any + >this.length = n : number >this.length : any ->this : this +>this : any >length : any -->n : number -+>n : any + >n : number } var y2 = id2(D); @@ -138,10 +120,10 @@ ->id2(D) : new (arg1: number) => { length: number; } ->id2 : (c: new (arg1: number) => { length: number; }) => new (arg1: number) => { length: number; } ->D : typeof D -+>y2 : any -+>id2(D) : any -+>id2 : (c: any) => any -+>D : (n: any) => void ++>y2 : function ++>id2(D) : function ++>id2 : (c: any) => function ++>D : (n: number) => void var z2 = new y2(33); ->z2 : { length: number; } @@ -149,7 +131,7 @@ ->y2 : new (arg1: number) => { length: number; } +>z2 : any +>new y2(33) : any -+>y2 : any ++>y2 : function >33 : 33 z2.length; @@ -171,29 +153,26 @@ ->dref : new (arg1: number) => D ->new dref(33) : D ->dref : new (arg1: number) => D -+>construct : (dref: any) => any -+>function(dref) { return new dref(33); } : (dref: any) => any ++>construct : (dref: any) => D ++>function(dref) { return new dref(33); } : (dref: any) => D +>dref : any +>new dref(33) : any +>dref : any >33 : 33 var z3 = construct(D); -->z3 : D -->construct(D) : D + >z3 : D + >construct(D) : D ->construct : (dref: new (arg1: number) => D) => D ->D : typeof D -+>z3 : any -+>construct(D) : any -+>construct : (dref: any) => any -+>D : (n: any) => void ++>construct : (dref: any) => D ++>D : (n: number) => void z3.length; ->z3.length : number -->z3 : D -->length : number +>z3.length : any -+>z3 : any + >z3 : D +->length : number +>length : any @@ -204,22 +183,19 @@ var E = function(n) { ->E : typeof E ->function(n) { this.not_length_on_purpose = n;} : typeof E -->n : number -+>E : (n: any) => void -+>function(n) { this.not_length_on_purpose = n;} : (n: any) => void -+>n : any ++>E : (n: number) => void ++>function(n) { this.not_length_on_purpose = n;} : (n: number) => void + >n : number this.not_length_on_purpose = n; -->this.not_length_on_purpose = n : number -+>this.not_length_on_purpose = n : any + >this.not_length_on_purpose = n : number >this.not_length_on_purpose : any ->this : this +>this : any >not_length_on_purpose : any -->n : number -+>n : any + >n : number - }; +@@= skipped -15, +15 lines =@@ var y3 = id2(E); @@ -227,14 +203,14 @@ ->id2(E) : new (arg1: number) => { length: number; } ->id2 : (c: new (arg1: number) => { length: number; }) => new (arg1: number) => { length: number; } ->E : typeof E -+>y3 : any -+>id2(E) : any -+>id2 : (c: any) => any -+>E : (n: any) => void ++>y3 : function ++>id2(E) : function ++>id2 : (c: any) => function ++>E : (n: number) => void // Repro from #39229 -@@= skipped -26, +26 lines =@@ +@@= skipped -11, +11 lines =@@ * @type {(...args: [string, string] | [number, string, string]) => void} */ function foo(...args) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_class.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_class.types.diff index 0d4ecfe3ef..7d3db579f1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_class.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_class.types.diff @@ -1,15 +1,6 @@ --- old.jsdocImplements_class.types +++ new.jsdocImplements_class.types -@@= skipped -5, +5 lines =@@ - - /** @return {number} */ - method() { throw new Error(); } -->method : () => number -+>method : () => void - >new Error() : Error - >Error : ErrorConstructor - } -@@= skipped -30, +30 lines =@@ +@@= skipped -35, +35 lines =@@ var Ns = {}; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.errors.txt.diff new file mode 100644 index 0000000000..5b9e9bb1c1 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.errors.txt.diff @@ -0,0 +1,38 @@ +--- old.jsdocImportType.errors.txt ++++ new.jsdocImportType.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++use.js(2,22): error TS2307: Cannot find module './mod1' or its corresponding type declarations. ++use.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? ++ ++ ++==== use.js (2 errors) ==== ++ /// ++ /** @typedef {import("./mod1")} C ++ ~~~~~~~~ ++!!! error TS2307: Cannot find module './mod1' or its corresponding type declarations. ++ * @type {C} */ ++ var c; ++ c.chunk; ++ ++ const D = require("./mod1"); ++ /** @type {D} */ ++ ~ ++!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? ++ var d; ++ d.chunk; ++ ++==== types.d.ts (0 errors) ==== ++ declare function require(name: string): any; ++ declare var exports: any; ++ declare var module: { exports: any }; ++==== mod1.js (0 errors) ==== ++ /// ++ class Chunk { ++ constructor() { ++ this.chunk = 1; ++ } ++ } ++ module.exports = Chunk; ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff index d06710a806..67c9e1d058 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff @@ -1,7 +1,11 @@ --- old.jsdocImportType.types +++ new.jsdocImportType.types -@@= skipped -4, +4 lines =@@ +@@= skipped -2, +2 lines =@@ + === use.js === + /// /** @typedef {import("./mod1")} C ++>C : any ++ * @type {C} */ var c; ->c : D @@ -23,22 +27,19 @@ >require : (name: string) => any >"./mod1" : "./mod1" - /** @type {D} */ - var d; -->d : D -+>d : any +@@= skipped -20, +22 lines =@@ + >d : D d.chunk; ->d.chunk : number -->d : D -->chunk : number +>d.chunk : any -+>d : any + >d : D +->chunk : number +>chunk : any === types.d.ts === declare function require(name: string): any; -@@= skipped -34, +34 lines =@@ +@@= skipped -16, +16 lines =@@ >module : { exports: any; } >exports : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.errors.txt.diff new file mode 100644 index 0000000000..09508f12a1 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.errors.txt.diff @@ -0,0 +1,37 @@ +--- old.jsdocImportType2.errors.txt ++++ new.jsdocImportType2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++use.js(2,22): error TS2307: Cannot find module './mod1' or its corresponding type declarations. ++use.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? ++ ++ ++==== use.js (2 errors) ==== ++ /// ++ /** @typedef {import("./mod1")} C ++ ~~~~~~~~ ++!!! error TS2307: Cannot find module './mod1' or its corresponding type declarations. ++ * @type {C} */ ++ var c; ++ c.chunk; ++ ++ const D = require("./mod1"); ++ /** @type {D} */ ++ ~ ++!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? ++ var d; ++ d.chunk; ++ ++==== types.d.ts (0 errors) ==== ++ declare function require(name: string): any; ++ declare var exports: any; ++ declare var module: { exports: any }; ++==== mod1.js (0 errors) ==== ++ /// ++ module.exports = class Chunk { ++ constructor() { ++ this.chunk = 1; ++ } ++ } ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff index 5a0498183b..a3f51400c3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff @@ -1,7 +1,11 @@ --- old.jsdocImportType2.types +++ new.jsdocImportType2.types -@@= skipped -4, +4 lines =@@ +@@= skipped -2, +2 lines =@@ + === use.js === + /// /** @typedef {import("./mod1")} C ++>C : any ++ * @type {C} */ var c; ->c : D @@ -23,22 +27,19 @@ >require : (name: string) => any >"./mod1" : "./mod1" - /** @type {D} */ - var d; -->d : D -+>d : any +@@= skipped -20, +22 lines =@@ + >d : D d.chunk; ->d.chunk : number -->d : D -->chunk : number +>d.chunk : any -+>d : any + >d : D +->chunk : number +>chunk : any === types.d.ts === declare function require(name: string): any; -@@= skipped -34, +34 lines =@@ +@@= skipped -16, +16 lines =@@ >module : { exports: any; } >exports : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt.diff index e55e44a227..5bb0ac21ec 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToClassAlias.errors.txt.diff @@ -4,6 +4,7 @@ - @@= skipped --1, +1 lines =@@ +mod1.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++test.js(1,22): error TS2306: File 'mod1.js' is not a module. + + +==== mod1.js (1 errors) ==== @@ -14,8 +15,10 @@ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + -+==== test.js (0 errors) ==== ++==== test.js (1 errors) ==== + /** @typedef {import('./mod1').C} X */ ++ ~~~~~~~~ ++!!! error TS2306: File 'mod1.js' is not a module. + /** @param {X} c */ + function demo(c) { + c.s diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToClassAlias.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToClassAlias.types.diff index 13ace9c048..a9f0c0a7c0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToClassAlias.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToClassAlias.types.diff @@ -18,6 +18,8 @@ === test.js === /** @typedef {import('./mod1').C} X */ ++>X : any ++ /** @param {X} c */ function demo(c) { ->demo : (c: X) => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt.diff new file mode 100644 index 0000000000..3f2fae2ebd --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToCommonjsModule.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.jsdocImportTypeReferenceToCommonjsModule.errors.txt ++++ new.jsdocImportTypeReferenceToCommonjsModule.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++test.js(1,13): error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? ++ ++ ++==== ex.d.ts (0 errors) ==== ++ declare var config: { ++ fix: boolean ++ } ++ export = config; ++ ++==== test.js (1 errors) ==== ++ /** @param {import('./ex')} a */ ++ ~~~~~~~~~~~~~~ ++!!! error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? ++ function demo(a) { ++ a.fix ++ } ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToESModule.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToESModule.errors.txt.diff new file mode 100644 index 0000000000..def5d93263 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToESModule.errors.txt.diff @@ -0,0 +1,19 @@ +--- old.jsdocImportTypeReferenceToESModule.errors.txt ++++ new.jsdocImportTypeReferenceToESModule.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++test.js(1,13): error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? ++ ++ ++==== ex.d.ts (0 errors) ==== ++ export var config: {} ++ ++==== test.js (1 errors) ==== ++ /** @param {import('./ex')} a */ ++ ~~~~~~~~~~~~~~ ++!!! error TS1340: Module './ex' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./ex')'? ++ function demo(a) { ++ a.config ++ } ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt.diff new file mode 100644 index 0000000000..7ec491bcaa --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToStringLiteral.errors.txt.diff @@ -0,0 +1,17 @@ +--- old.jsdocImportTypeReferenceToStringLiteral.errors.txt ++++ new.jsdocImportTypeReferenceToStringLiteral.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++a.js(1,26): error TS2694: Namespace '"b"' has no exported member 'FOO'. ++ ++ ++==== b.js (0 errors) ==== ++ export const FOO = "foo"; ++ ++==== a.js (1 errors) ==== ++ /** @type {import('./b').FOO} */ ++ ~~~ ++!!! error TS2694: Namespace '"b"' has no exported member 'FOO'. ++ let x; ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocIndexSignature.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocIndexSignature.errors.txt.diff index 67f90c1063..b8d8c51d2a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocIndexSignature.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocIndexSignature.errors.txt.diff @@ -1,23 +1,46 @@ --- old.jsdocIndexSignature.errors.txt +++ new.jsdocIndexSignature.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -indices.js(9,5): error TS2322: Type 'number' is not assignable to type 'boolean'. -- -- ++indices.js(1,12): error TS2315: Type 'Object' is not generic. ++indices.js(1,18): error TS8020: JSDoc types can only be used inside documentation comments. ++indices.js(3,12): error TS2315: Type 'Object' is not generic. ++indices.js(3,18): error TS8020: JSDoc types can only be used inside documentation comments. ++indices.js(5,12): error TS2315: Type 'Object' is not generic. ++indices.js(5,18): error TS8020: JSDoc types can only be used inside documentation comments. ++indices.js(7,13): error TS2315: Type 'Object' is not generic. ++indices.js(7,19): error TS8020: JSDoc types can only be used inside documentation comments. + + -==== indices.js (1 errors) ==== -- /** @type {Object.} */ -- var o1; -- /** @type {Object.} */ -- var o2; -- /** @type {Object.} */ -- var o3; -- /** @param {Object.} o */ -- function f(o) { -- o.foo = 1; // error ++==== indices.js (8 errors) ==== + /** @type {Object.} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. ++ ~ ++!!! error TS8020: JSDoc types can only be used inside documentation comments. + var o1; + /** @type {Object.} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. ++ ~ ++!!! error TS8020: JSDoc types can only be used inside documentation comments. + var o2; + /** @type {Object.} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. ++ ~ ++!!! error TS8020: JSDoc types can only be used inside documentation comments. + var o3; + /** @param {Object.} o */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. ++ ~ ++!!! error TS8020: JSDoc types can only be used inside documentation comments. + function f(o) { + o.foo = 1; // error - ~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'boolean'. -- o.bar = false; // ok -- } -- -@@= skipped --1, +1 lines =@@ -+ + o.bar = false; // ok + } + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocLiteral.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocLiteral.types.diff index cb3905b712..49e182ca90 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocLiteral.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocLiteral.types.diff @@ -5,38 +5,22 @@ */ function f(p1, p2, p3, p4, p5) { ->f : (p1: "literal", p2: "literal", p3: "literal" | "other", p4: "literal" | number, p5: 12 | true | "str") => string -->p1 : "literal" -->p2 : "literal" -->p3 : "literal" | "other" -->p4 : number | "literal" ++>f : (p1: "literal", p2: "literal", p3: "literal" | "other", p4: number | "literal", p5: "str" | 12 | true) => string + >p1 : "literal" + >p2 : "literal" + >p3 : "literal" | "other" + >p4 : number | "literal" ->p5 : true | 12 | "str" -+>f : (p1: any, p2: any, p3: any, p4: any, p5: any) => string -+>p1 : any -+>p2 : any -+>p3 : any -+>p4 : any -+>p5 : any ++>p5 : "str" | 12 | true return p1 + p2 + p3 + p4 + p5 + '.'; >p1 + p2 + p3 + p4 + p5 + '.' : string -->p1 + p2 + p3 + p4 + p5 : string -->p1 + p2 + p3 + p4 : string -->p1 + p2 + p3 : string -->p1 + p2 : string -->p1 : "literal" -->p2 : "literal" -->p3 : "literal" | "other" -->p4 : number | "literal" +@@= skipped -17, +17 lines =@@ + >p2 : "literal" + >p3 : "literal" | "other" + >p4 : number | "literal" ->p5 : true | 12 | "str" -+>p1 + p2 + p3 + p4 + p5 : any -+>p1 + p2 + p3 + p4 : any -+>p1 + p2 + p3 : any -+>p1 + p2 : any -+>p1 : any -+>p2 : any -+>p3 : any -+>p4 : any -+>p5 : any ++>p5 : "str" | 12 | true >'.' : "." } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocNeverUndefinedNull.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocNeverUndefinedNull.types.diff deleted file mode 100644 index fe73817cd1..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocNeverUndefinedNull.types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.jsdocNeverUndefinedNull.types -+++ new.jsdocNeverUndefinedNull.types -@@= skipped -7, +7 lines =@@ - * @returns {void} nothing - */ - function f(p1, p2, p3) { -->f : (p1: never, p2: undefined, p3: null) => void -->p1 : never -->p2 : undefined -->p3 : null -+>f : (p1: any, p2: any, p3: any) => void -+>p1 : any -+>p2 : any -+>p3 : any - } - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.errors.txt.diff index 2c33e4dd18..a7781ae987 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +0 lines =@@ -error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. --jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. + jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. -jsdocOuterTypeParameters1.js(4,17): error TS2304: Cannot find name 'T'. -jsdocOuterTypeParameters1.js(4,19): error TS1069: Unexpected token. A type parameter name was expected without curly braces. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. @@ -12,10 +12,10 @@ -!!! error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -==== jsdocOuterTypeParameters1.js (4 errors) ==== -+==== jsdocOuterTypeParameters1.js (1 errors) ==== ++==== jsdocOuterTypeParameters1.js (2 errors) ==== /** @return {T} */ -- ~ --!!! error TS2304: Cannot find name 'T'. + ~ + !!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template {T} */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.types.diff deleted file mode 100644 index bda5b3ab4a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.types.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.jsdocOuterTypeParameters1.types -+++ new.jsdocOuterTypeParameters1.types -@@= skipped -2, +2 lines =@@ - === jsdocOuterTypeParameters1.js === - /** @return {T} */ - const dedupingMixin = function(mixin) {}; -->dedupingMixin : (mixin: any) => T -->function(mixin) {} : (mixin: any) => T -+>dedupingMixin : (mixin: any) => void -+>function(mixin) {} : (mixin: any) => void - >mixin : any - - /** @template {T} */ - const PropertyAccessors = dedupingMixin(() => { -->PropertyAccessors : T -->dedupingMixin(() => { class Bar { static bar() { this.prototype.foo(); } }}) : T -->dedupingMixin : (mixin: any) => T -+>PropertyAccessors : void -+>dedupingMixin(() => { class Bar { static bar() { this.prototype.foo(); } }}) : void -+>dedupingMixin : (mixin: any) => void - >() => { class Bar { static bar() { this.prototype.foo(); } }} : () => void - - class Bar { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters2.errors.txt.diff index d1baa63090..837f743c5a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters2.errors.txt.diff @@ -4,16 +4,17 @@ -error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -jsdocOuterTypeParameters1.js(1,14): error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. ++jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. -!!! error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. --==== jsdocOuterTypeParameters1.js (2 errors) ==== -+==== jsdocOuterTypeParameters1.js (1 errors) ==== + ==== jsdocOuterTypeParameters1.js (2 errors) ==== /** @return {T} */ -- ~ + ~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. ++!!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template T */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters2.types.diff deleted file mode 100644 index e39f24636a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters2.types.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.jsdocOuterTypeParameters2.types -+++ new.jsdocOuterTypeParameters2.types -@@= skipped -2, +2 lines =@@ - === jsdocOuterTypeParameters1.js === - /** @return {T} */ - const dedupingMixin = function(mixin) {}; -->dedupingMixin : (mixin: any) => T -->function(mixin) {} : (mixin: any) => T -+>dedupingMixin : (mixin: any) => void -+>function(mixin) {} : (mixin: any) => void - >mixin : any - - /** @template T */ - const PropertyAccessors = dedupingMixin(() => { -->PropertyAccessors : T -->dedupingMixin(() => { class Bar { static bar() { this.prototype.foo(); } }}) : T -->dedupingMixin : (mixin: any) => T -+>PropertyAccessors : void -+>dedupingMixin(() => { class Bar { static bar() { this.prototype.foo(); } }}) : void -+>dedupingMixin : (mixin: any) => void - >() => { class Bar { static bar() { this.prototype.foo(); } }} : () => void - - class Bar { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOverrideTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOverrideTag1.types.diff index e86e473f41..4890a49b62 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOverrideTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOverrideTag1.types.diff @@ -1,41 +1,11 @@ --- old.jsdocOverrideTag1.types +++ new.jsdocOverrideTag1.types -@@= skipped -9, +9 lines =@@ - * @returns {boolean} - */ - foo (a) { -->foo : (a: string | number) => boolean -->a : string | number -+>foo : (a: any) => a is string -+>a : any +@@= skipped -14, +14 lines =@@ return typeof a === 'string' >typeof a === 'string' : boolean ->typeof a : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" -->a : string | number +>typeof a : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" -+>a : any + >a : string | number >'string' : "string" } - bar () { -@@= skipped -26, +26 lines =@@ - * @returns {boolean} - */ - foo (a) { -->foo : (a: string | number) => boolean -->a : string | number -+>foo : (a: any) => a is string -+>a : any - - return super.foo(a) - >super.foo(a) : boolean -->super.foo : (a: string | number) => boolean -+>super.foo : (a: any) => a is string - >super : A -->foo : (a: string | number) => boolean -->a : string | number -+>foo : (a: any) => a is string -+>a : any - } - - bar () { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParamTag2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParamTag2.types.diff index 7ca76fe88c..384678651d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParamTag2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParamTag2.types.diff @@ -7,14 +7,13 @@ ->good1 : ({ a, b }: { a: string; b: string; }, x: string) => void ->a : string ->b : string -->x : string -+>good1 : (__0: { a: any; b: any; }, x: any) => void ++>good1 : (__0: { a: any; b: any; }, x: string) => void +>a : any +>b : any -+>x : any + >x : string /** - * @param {{a: string, b: string}} obj +@@= skipped -10, +10 lines =@@ * @param {{c: number, d: number}} OBJECTION */ function good2({a, b}, {c, d}) {} @@ -31,20 +30,18 @@ /** * @param {number} x -@@= skipped -22, +22 lines =@@ +@@= skipped -12, +12 lines =@@ * @param {string} y */ function good3(x, {a, b}, y) {} ->good3 : (x: number, { a, b }: { a: string; b: string; }, y: string) => void -->x : number ++>good3 : (x: number, __1: { a: any; b: any; }, y: string) => void + >x : number ->a : string ->b : string -->y : string -+>good3 : (x: any, __1: { a: any; b: any; }, y: any) => void -+>x : any +>a : any +>b : any -+>y : any + >y : string /** * @param {{a: string, b: string}} obj @@ -66,14 +63,12 @@ ->good5 : ({ a, b }: { a: string; b: string;}, x: string) => void ->a : string ->b : string -->x : string -+>good5 : (__0: { a: any; b: any; }, x: any) => void ++>good5 : (__0: { a: any; b: any; }, x: string) => void +>a : any +>b : any -+>x : any + >x : string /** - * @param {Object} obj @@= skipped -14, +14 lines =@@ * @param {string} OBJECTION.d - meh */ @@ -96,18 +91,15 @@ */ function good7(x, {a, b}, y) {} ->good7 : (x: number, { a, b }: { a: string; b: string;}, y: string) => void -->x : number ++>good7 : (x: number, __1: { a: any; b: any; }, y: string) => void + >x : number ->a : string ->b : string -->y : string -+>good7 : (x: any, __1: { a: any; b: any; }, y: any) => void -+>x : any +>a : any +>b : any -+>y : any + >y : string /** - * @param {Object} obj @@= skipped -12, +12 lines =@@ * @param {string} obj.b */ @@ -144,12 +136,10 @@ */ function bad1(x, {a, b}) {} ->bad1 : (x: string, { a, b }: string) => void -->x : string -+>bad1 : (x: any, __1: { a: any; b: any; }) => void -+>x : any ++>bad1 : (x: string, __1: { a: any; b: any; }) => void + >x : string >a : any >b : any - @@= skipped -10, +10 lines =@@ * @param {{a: string, b: string}} obj */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParamTagTypeLiteral.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParamTagTypeLiteral.types.diff index f210968315..49affed553 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParamTagTypeLiteral.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParamTagTypeLiteral.types.diff @@ -1,26 +1,6 @@ --- old.jsdocParamTagTypeLiteral.types +++ new.jsdocParamTagTypeLiteral.types -@@= skipped -5, +5 lines =@@ - * @param {string} unrelated - not actually related because it's not notSpecial.unrelated - */ - function normal(notSpecial) { -->normal : (notSpecial: Object) => void -->notSpecial : Object -+>normal : (notSpecial: any) => void -+>notSpecial : any - - notSpecial; // should just be 'Object' -->notSpecial : Object -+>notSpecial : any - } - normal(12); - >normal(12) : void -->normal : (notSpecial: Object) => void -+>normal : (notSpecial: any) => void - >12 : 12 - - /** -@@= skipped -19, +19 lines =@@ +@@= skipped -24, +24 lines =@@ * @param {string} [opts1.w="hi"] doc5 */ function foo1(opts1) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseBackquotedParamName.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseBackquotedParamName.errors.txt.diff deleted file mode 100644 index fedfeb44ac..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseBackquotedParamName.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.jsdocParseBackquotedParamName.errors.txt -+++ new.jsdocParseBackquotedParamName.errors.txt -@@= skipped -0, +-1 lines =@@ --a.js(5,18): error TS1016: A required parameter cannot follow an optional parameter. -- -- --==== a.js (1 errors) ==== -- /** -- * @param {string=} `args` -- * @param `bwarg` {?number?} -- */ -- function f(args, bwarg) { -- ~~~~~ --!!! error TS1016: A required parameter cannot follow an optional parameter. -- } -- --==== ts.ts (0 errors) ==== -- /** -- * @param `arg` - this is fine -- */ -- function g(arg: string) { -- } -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseBackquotedParamName.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseBackquotedParamName.types.diff index 94bc384066..754efe4f80 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseBackquotedParamName.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseBackquotedParamName.types.diff @@ -5,11 +5,7 @@ */ function f(args, bwarg) { ->f : (args?: string | undefined, bwarg: (number | null) | null) => void -->args : string | undefined -->bwarg : number | null -+>f : (args: any, bwarg: any) => void -+>args : any -+>bwarg : any ++>f : (args: string | undefined, bwarg: number | null) => void + >args : string | undefined + >bwarg : number | null } - - === ts.ts === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt.diff index 18fafa051f..00fe0a54aa 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt.diff @@ -3,9 +3,11 @@ @@= skipped -0, +0 lines =@@ -a.js(2,13): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. +a.js(3,12): error TS7006: Parameter 'callback' implicitly has an 'any' type. ++a.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? - ==== a.js (1 errors) ==== +-==== a.js (1 errors) ==== ++==== a.js (2 errors) ==== // from bcryptjs /** @param {function(...[*])} callback */ - ~~~~~~~~~~~~~~~~ @@ -16,3 +18,11 @@ callback([1], [2], [3]) } + /** + * @type {!function(...number):string} ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + * @inner + */ + var stringFromCharCode = String.fromCharCode; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.types.diff index 2e3ae76421..6f3674deb3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.types.diff @@ -29,7 +29,7 @@ */ var stringFromCharCode = String.fromCharCode; ->stringFromCharCode : (...arg0: number[]) => string -+>stringFromCharCode : (...codes: number[]) => string ++>stringFromCharCode : function >String.fromCharCode : (...codes: number[]) => string >String : StringConstructor >fromCharCode : (...codes: number[]) => string diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.errors.txt.diff index 4b661c13ec..8649a77e4f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.errors.txt.diff @@ -3,12 +3,16 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +paren.js(2,10): error TS7006: Parameter 's' implicitly has an 'any' type. +paren.js(2,13): error TS7006: Parameter 'id' implicitly has an 'any' type. + + -+==== paren.js (2 errors) ==== ++==== paren.js (3 errors) ==== + /** @type {function((string), function((string)): string): string} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + var x = (s, id) => id(s) + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.types.diff index f379b2de9e..7ecfce7970 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.types.diff @@ -11,7 +11,7 @@ ->id(s) : string ->id : (arg0: (string)) => string ->s : string -+>x : (s: any, id: any) => any ++>x : function +>(s, id) => id(s) : (s: any, id: any) => any +>s : any +>id : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseMatchingBackticks.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseMatchingBackticks.errors.txt.diff deleted file mode 100644 index 3b910ca7a9..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseMatchingBackticks.errors.txt.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- old.jsdocParseMatchingBackticks.errors.txt -+++ new.jsdocParseMatchingBackticks.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+jsdocParseMatchingBackticks.js(12,19): error TS7006: Parameter 'x' implicitly has an 'any' type. -+jsdocParseMatchingBackticks.js(12,22): error TS7006: Parameter 'y' implicitly has an 'any' type. -+jsdocParseMatchingBackticks.js(12,25): error TS7006: Parameter 'z' implicitly has an 'any' type. -+jsdocParseMatchingBackticks.js(12,28): error TS7006: Parameter 'alpha' implicitly has an 'any' type. -+jsdocParseMatchingBackticks.js(12,35): error TS7006: Parameter 'beta' implicitly has an 'any' type. -+jsdocParseMatchingBackticks.js(12,41): error TS7006: Parameter 'gamma' implicitly has an 'any' type. -+ -+ -+==== jsdocParseMatchingBackticks.js (6 errors) ==== -+ /** -+ * `@param` initial at-param is OK in title comment -+ * @param {string} x hi there `@param` -+ * @param {string} y hi there `@ * param -+ * this is the margin -+ * so we'll drop everything before it -+ `@param` @param {string} z hello??? -+ * `@param` @param {string} alpha hello??? -+ * `@ * param` @param {string} beta hello??? -+ * @param {string} gamma -+ */ -+ export function f(x, y, z, alpha, beta, gamma) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'y' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'z' implicitly has an 'any' type. -+ ~~~~~ -+!!! error TS7006: Parameter 'alpha' implicitly has an 'any' type. -+ ~~~~ -+!!! error TS7006: Parameter 'beta' implicitly has an 'any' type. -+ ~~~~~ -+!!! error TS7006: Parameter 'gamma' implicitly has an 'any' type. -+ return x + y + z + alpha + beta + gamma -+ } -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseMatchingBackticks.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseMatchingBackticks.types.diff deleted file mode 100644 index 430d6467ee..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseMatchingBackticks.types.diff +++ /dev/null @@ -1,46 +0,0 @@ ---- old.jsdocParseMatchingBackticks.types -+++ new.jsdocParseMatchingBackticks.types -@@= skipped -12, +12 lines =@@ - * @param {string} gamma - */ - export function f(x, y, z, alpha, beta, gamma) { -->f : (x: string, y: string, z: string, alpha: string, beta: string, gamma: string) => string -->x : string -->y : string -->z : string -->alpha : string -->beta : string -->gamma : string -+>f : (x: any, y: any, z: any, alpha: any, beta: any, gamma: any) => any -+>x : any -+>y : any -+>z : any -+>alpha : any -+>beta : any -+>gamma : any - - return x + y + z + alpha + beta + gamma -->x + y + z + alpha + beta + gamma : string -->x + y + z + alpha + beta : string -->x + y + z + alpha : string -->x + y + z : string -->x + y : string -->x : string -->y : string -->z : string -->alpha : string -->beta : string -->gamma : string -+>x + y + z + alpha + beta + gamma : any -+>x + y + z + alpha + beta : any -+>x + y + z + alpha : any -+>x + y + z : any -+>x + y : any -+>x : any -+>y : any -+>z : any -+>alpha : any -+>beta : any -+>gamma : any - } - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff index 493485caab..ee5d9700e8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff @@ -3,11 +3,15 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +paren.js(2,9): error TS7006: Parameter 's' implicitly has an 'any' type. + + -+==== paren.js (1 errors) ==== ++==== paren.js (2 errors) ==== + /** @type {function((string)): string} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + var x = s => s.toString() + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.types.diff index ef12063284..c66b206bda 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.types.diff @@ -11,7 +11,7 @@ ->s.toString : () => string ->s : string ->toString : () => string -+>x : (s: any) => any ++>x : function +>s => s.toString() : (s: any) => any +>s : any +>s.toString() : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.errors.txt.diff index da88bb7750..31ed89d7a9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.errors.txt.diff @@ -3,13 +3,19 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++a.js(3,12): error TS2370: A rest parameter must be of an array type. ++a.js(3,19): error TS1047: A rest parameter cannot be optional. +a.js(12,14): error TS7006: Parameter 'f' implicitly has an 'any' type. + + -+==== a.js (1 errors) ==== ++==== a.js (3 errors) ==== + /** @param {...*=} args + @return {*=} */ + function f(...args) { ++ ~~~~~~~ ++!!! error TS2370: A rest parameter must be of an array type. ++ ++!!! error TS1047: A rest parameter cannot be optional. + return null + } + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.types.diff index 1ecafd1037..aa400dc80a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.types.diff @@ -6,8 +6,8 @@ function f(...args) { ->f : (...args?: any[] | undefined) => any | undefined ->args : any -+>f : (...args: any[]) => null -+>args : any[] ++>f : (...args: any[] | undefined) => any ++>args : any[] | undefined return null } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt.diff index 2a00907542..77d5754b7c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPostfixEqualsAddsOptionality.errors.txt.diff @@ -1,32 +1,18 @@ --- old.jsdocPostfixEqualsAddsOptionality.errors.txt +++ new.jsdocPostfixEqualsAddsOptionality.errors.txt @@= skipped -0, +0 lines =@@ --a.js(4,5): error TS2322: Type 'null' is not assignable to type 'number | undefined'. --a.js(8,3): error TS2345: Argument of type 'null' is not assignable to parameter of type 'number | undefined'. -+a.js(7,1): error TS2554: Expected 1 arguments, but got 0. + a.js(4,5): error TS2322: Type 'null' is not assignable to type 'number | undefined'. + a.js(8,3): error TS2345: Argument of type 'null' is not assignable to parameter of type 'number | undefined'. +a.js(13,12): error TS7006: Parameter 'a' implicitly has an 'any' type. +a.js(18,1): error TS2554: Expected 1 arguments, but got 0. -==== a.js (2 errors) ==== -+==== a.js (3 errors) ==== ++==== a.js (4 errors) ==== /** @param {number=} a */ function f(a) { a = 1 - a = null // should not be allowed -- ~ --!!! error TS2322: Type 'null' is not assignable to type 'number | undefined'. - a = undefined - } - f() -+ ~ -+!!! error TS2554: Expected 1 arguments, but got 0. -+!!! related TS6210 a.js:2:12: An argument for 'a' was not provided. - f(null) // should not be allowed -- ~~~~ --!!! error TS2345: Argument of type 'null' is not assignable to parameter of type 'number | undefined'. - f(undefined) - f(1) +@@= skipped -19, +21 lines =@@ /** @param {???!?number?=} a */ function g(a) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPostfixEqualsAddsOptionality.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPostfixEqualsAddsOptionality.types.diff index e10afb03b2..1f8c2f2f7d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPostfixEqualsAddsOptionality.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPostfixEqualsAddsOptionality.types.diff @@ -1,52 +1,6 @@ --- old.jsdocPostfixEqualsAddsOptionality.types +++ new.jsdocPostfixEqualsAddsOptionality.types -@@= skipped -2, +2 lines =@@ - === a.js === - /** @param {number=} a */ - function f(a) { -->f : (a?: number | undefined) => void -->a : number | undefined -+>f : (a: any) => void -+>a : any - - a = 1 - >a = 1 : 1 -->a : number | undefined -+>a : any - >1 : 1 - - a = null // should not be allowed - >a = null : null -->a : number | undefined -+>a : any - - a = undefined - >a = undefined : undefined -->a : number | undefined -+>a : any - >undefined : undefined - } - f() - >f() : void -->f : (a?: number | undefined) => void -+>f : (a: any) => void - - f(null) // should not be allowed - >f(null) : void -->f : (a?: number | undefined) => void -+>f : (a: any) => void - - f(undefined) - >f(undefined) : void -->f : (a?: number | undefined) => void -+>f : (a: any) => void - >undefined : undefined - - f(1) - >f(1) : void -->f : (a?: number | undefined) => void -+>f : (a: any) => void - >1 : 1 +@@= skipped -39, +39 lines =@@ /** @param {???!?number?=} a */ function g(a) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrefixPostfixParsing.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrefixPostfixParsing.types.diff index 0ad674c66f..d3dfe2602c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrefixPostfixParsing.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrefixPostfixParsing.types.diff @@ -6,32 +6,26 @@ function f(x, y, z, a, b, c, e, f, g, h, i, j, k, l, m) { ->f : (x: number[], y: number[], z: (number[]), a: any, b: number[] | null, c: (number[]) | null, e: (number | null)[], f: (number | null)[], g: (number | null)[], h: any, i: number[][], j: (number[] | null)[], k: any, l: number extends number ? true : false, m: [number, number?]) => void ->x : number[] -->y : number[] -->z : number[] -+>f : (x: any, y: any, z: any, a: any, b: any, c: any, e: any, f: any, g: any, h: any, i: any, j: any, k: any, l: any, m: any) => void ++>f : (x: any, y: number[], z: any, a: any, b: number[] | null, c: any, e: (number | null)[], f: any, g: any, h: any, i: number[][], j: any, k: any, l: true, m: [number, (number | undefined)?]) => void +>x : any -+>y : any + >y : number[] +->z : number[] +>z : any >a : any -->b : number[] | null + >b : number[] | null ->c : number[] | null ->e : number | null | undefined ->f : number | null | undefined ->g : number | null | undefined -+>b : any +>c : any -+>e : any ++>e : (number | null)[] +>f : any +>g : any >h : any ->i : number[] | undefined ->j : number[] | null | undefined -+>i : any ++>i : number[][] +>j : any >k : any -->l : true -->m : [number, (number | undefined)?] -+>l : any -+>m : any - } - + >l : true + >m : [number, (number | undefined)?] diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName1.errors.txt.diff deleted file mode 100644 index 2c8264ffb2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName1.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.jsdocPrivateName1.errors.txt -+++ new.jsdocPrivateName1.errors.txt -@@= skipped -0, +-1 lines =@@ --jsdocPrivateName1.js(3,5): error TS2322: Type 'number' is not assignable to type 'boolean'. -- -- --==== jsdocPrivateName1.js (1 errors) ==== -- class A { -- /** @type {boolean} some number value */ -- #foo = 3 // Error because not assignable to boolean -- ~~~~ --!!! error TS2322: Type 'number' is not assignable to type 'boolean'. -- } -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName1.types.diff deleted file mode 100644 index 78138593af..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName1.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsdocPrivateName1.types -+++ new.jsdocPrivateName1.types -@@= skipped -5, +5 lines =@@ - - /** @type {boolean} some number value */ - #foo = 3 // Error because not assignable to boolean -->#foo : boolean -+>#foo : number - >3 : 3 - } - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.errors.txt.diff index 3270f2608a..9977298d26 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.errors.txt.diff @@ -3,15 +3,19 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++returns.js(5,5): error TS2322: Type 'number' is not assignable to type 'string'. ++returns.js(12,5): error TS2322: Type 'number' is not assignable to type 'string'. +returns.js(19,12): error TS2872: This kind of expression is always truthy. + + -+==== returns.js (1 errors) ==== ++==== returns.js (3 errors) ==== + /** + * @returns {string} This comment is not currently exposed + */ + function f() { + return 5; ++ ~~~~~~ ++!!! error TS2322: Type 'number' is not assignable to type 'string'. + } + + /** @@ -19,6 +23,8 @@ + */ + function f1() { + return 5; ++ ~~~~~~ ++!!! error TS2322: Type 'number' is not assignable to type 'string'. + } + + /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.types.diff index 8b0f982f22..5734fafcbf 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.types.diff @@ -1,29 +1,16 @@ --- old.jsdocReturnTag1.types +++ new.jsdocReturnTag1.types -@@= skipped -4, +4 lines =@@ - * @returns {string} This comment is not currently exposed - */ - function f() { -->f : () => string -+>f : () => number - - return 5; - >5 : 5 -@@= skipped -10, +10 lines =@@ +@@= skipped -14, +14 lines =@@ * @returns {string=} This comment is not currently exposed */ function f1() { ->f1 : () => string | undefined -+>f1 : () => number ++>f1 : () => string return 5; >5 : 5 -@@= skipped -10, +10 lines =@@ - * @returns {string|number} This comment is not currently exposed - */ - function f2() { -->f2 : () => string | number -+>f2 : () => "hello" | 5 +@@= skipped -13, +13 lines =@@ + >f2 : () => string | number return 5 || "hello"; ->5 || "hello" : 5 | "hello" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff deleted file mode 100644 index 2ccb14f1cf..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocSignatureOnReturnedFunction.errors.txt.diff +++ /dev/null @@ -1,56 +0,0 @@ ---- old.jsdocSignatureOnReturnedFunction.errors.txt -+++ new.jsdocSignatureOnReturnedFunction.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+jsdocSignatureOnReturnedFunction.js(25,13): error TS7006: Parameter 'a' implicitly has an 'any' type. -+jsdocSignatureOnReturnedFunction.js(25,16): error TS7006: Parameter 'b' implicitly has an 'any' type. -+jsdocSignatureOnReturnedFunction.js(32,22): error TS7006: Parameter 'a' implicitly has an 'any' type. -+jsdocSignatureOnReturnedFunction.js(32,25): error TS7006: Parameter 'b' implicitly has an 'any' type. -+ -+ -+==== jsdocSignatureOnReturnedFunction.js (4 errors) ==== -+ function f1() { -+ /** -+ * @param {number} a -+ * @param {number} b -+ * @returns {number} -+ */ -+ return (a, b) => { -+ return a + b; -+ } -+ } -+ -+ function f2() { -+ /** -+ * @param {number} a -+ * @param {number} b -+ * @returns {number} -+ */ -+ return function (a, b){ -+ return a + b; -+ } -+ } -+ -+ function f3() { -+ /** @type {(a: number, b: number) => number} */ -+ return (a, b) => { -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. -+ return a + b; -+ } -+ } -+ -+ function f4() { -+ /** @type {(a: number, b: number) => number} */ -+ return function (a, b){ -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. -+ return a + b; -+ } -+ } -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocSignatureOnReturnedFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocSignatureOnReturnedFunction.types.diff index 6773adc1cf..42e8dc2c10 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocSignatureOnReturnedFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocSignatureOnReturnedFunction.types.diff @@ -1,105 +1,18 @@ --- old.jsdocSignatureOnReturnedFunction.types +++ new.jsdocSignatureOnReturnedFunction.types -@@= skipped -1, +1 lines =@@ - - === jsdocSignatureOnReturnedFunction.js === - function f1() { -->f1 : () => (a: number, b: number) => number -+>f1 : () => (a: any, b: any) => any - - /** - * @param {number} a -@@= skipped -8, +8 lines =@@ - * @returns {number} - */ - return (a, b) => { -->(a, b) => { return a + b; } : (a: number, b: number) => number -->a : number -->b : number -+>(a, b) => { return a + b; } : (a: any, b: any) => any -+>a : any -+>b : any - - return a + b; -->a + b : number -->a : number -->b : number -+>a + b : any -+>a : any -+>b : any - } - } - - function f2() { -->f2 : () => (a: number, b: number) => number -+>f2 : () => (a: any, b: any) => any - - /** - * @param {number} a -@@= skipped -20, +20 lines =@@ - * @returns {number} - */ - return function (a, b){ -->function (a, b){ return a + b; } : (a: number, b: number) => number -->a : number -->b : number -+>function (a, b){ return a + b; } : (a: any, b: any) => any -+>a : any -+>b : any - - return a + b; -->a + b : number -->a : number -->b : number -+>a + b : any -+>a : any -+>b : any - } - } - - function f3() { -->f3 : () => (a: number, b: number) => number -+>f3 : () => (a: any, b: any) => any - +@@= skipped -46, +46 lines =@@ /** @type {(a: number, b: number) => number} */ return (a, b) => { -->(a, b) => { return a + b; } : (a: number, b: number) => number -->a : number -->b : number -+>(a, b) => { return a + b; } : (a: any, b: any) => any -+>a : any -+>b : any - - return a + b; -->a + b : number -->a : number -->b : number -+>a + b : any -+>a : any -+>b : any - } - } - - function f4() { -->f4 : () => (a: number, b: number) => number -+>f4 : () => (a: any, b: any) => any + >(a, b) => { return a + b; } : (a: number, b: number) => number ++>(a, b) => { return a + b; } : (a: number, b: number) => number + >a : number + >b : number +@@= skipped -16, +17 lines =@@ /** @type {(a: number, b: number) => number} */ return function (a, b){ -->function (a, b){ return a + b; } : (a: number, b: number) => number -->a : number -->b : number -+>function (a, b){ return a + b; } : (a: any, b: any) => any -+>a : any -+>b : any - - return a + b; -->a + b : number -->a : number -->b : number -+>a + b : any -+>a : any -+>b : any - } - } + >function (a, b){ return a + b; } : (a: number, b: number) => number ++>function (a, b){ return a + b; } : (a: number, b: number) => number + >a : number + >b : number diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.errors.txt.diff index 1f3bad0a46..cd447865f2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.errors.txt.diff @@ -2,9 +2,9 @@ +++ new.jsdocTemplateClass.errors.txt @@= skipped -0, +0 lines =@@ -templateTagOnClasses.js(25,1): error TS2322: Type 'boolean' is not assignable to type 'number'. -+templateTagOnClasses.js(10,14): error TS2339: Property 'a' does not exist on type 'Foo'. -+templateTagOnClasses.js(25,3): error TS2339: Property 'a' does not exist on type 'Foo'. -+templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type 'Foo'. ++templateTagOnClasses.js(10,14): error TS2339: Property 'a' does not exist on type 'Foo'. ++templateTagOnClasses.js(25,3): error TS2339: Property 'a' does not exist on type 'Foo'. ++templateTagOnClasses.js(25,9): error TS2339: Property 'a' does not exist on type 'Foo'. -==== templateTagOnClasses.js (1 errors) ==== @@ -17,7 +17,7 @@ constructor (x) { this.a = x + ~ -+!!! error TS2339: Property 'a' does not exist on type 'Foo'. ++!!! error TS2339: Property 'a' does not exist on type 'Foo'. } /** * @@ -28,7 +28,7 @@ - ~~~ -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. + ~ -+!!! error TS2339: Property 'a' does not exist on type 'Foo'. ++!!! error TS2339: Property 'a' does not exist on type 'Foo'. + ~ -+!!! error TS2339: Property 'a' does not exist on type 'Foo'. ++!!! error TS2339: Property 'a' does not exist on type 'Foo'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.types.diff index efcee783b8..44f0e526c2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.types.diff @@ -1,84 +1,58 @@ --- old.jsdocTemplateClass.types +++ new.jsdocTemplateClass.types -@@= skipped -6, +6 lines =@@ +@@= skipped -3, +3 lines =@@ + /** + * @template T + * @typedef {(t: T) => T} Id ++>Id : any ++>t : T ++ */ /** @template T */ class Foo { -->Foo : Foo -+>Foo : Foo + >Foo : Foo /** @typedef {(t: T) => T} Id2 */ ++>Id2 : any ++>t : T ++ /** @param {T} x */ constructor (x) { -->x : T -+>x : any - - this.a = x -->this.a = x : T -+>this.a = x : any - >this.a : any - >this : this - >a : any -->x : T -+>x : any - } - /** - * -@@= skipped -22, +22 lines =@@ + >x : T +@@= skipped -25, +31 lines =@@ * @return {T} */ foo(x, y, alpha) { ->foo : (x: T, y: Id, alpha: (t: T) => T) => T -->x : T ++>foo : (x: T, y: (t: T) => T, alpha: (t: T) => T) => T + >x : T ->y : Id -->alpha : (t: T) => T -+>foo : (x: any, y: any, alpha: any) => any -+>x : any -+>y : any -+>alpha : any ++>y : (t: T) => T + >alpha : (t: T) => T return alpha(y(x)) -->alpha(y(x)) : T -->alpha : (t: T) => T -->y(x) : T + >alpha(y(x)) : T + >alpha : (t: T) => T + >y(x) : T ->y : Id -->x : T -+>alpha(y(x)) : any -+>alpha : any -+>y(x) : any -+>y : any -+>x : any ++>y : (t: T) => T + >x : T } } - var f = new Foo(1) -->f : Foo -->new Foo(1) : Foo -+>f : Foo -+>new Foo(1) : Foo - >Foo : typeof Foo - >1 : 1 - - var g = new Foo(false) -->g : Foo -->new Foo(false) : Foo -+>g : Foo -+>new Foo(false) : Foo - >Foo : typeof Foo +@@= skipped -26, +26 lines =@@ >false : false f.a = g.a ->f.a = g.a : boolean ->f.a : number -->f : Foo -->a : number -->g.a : boolean -->g : Foo -->a : boolean +>f.a = g.a : any +>f.a : any -+>f : Foo + >f : Foo +->a : number +->g.a : boolean +>a : any +>g.a : any -+>g : Foo + >g : Foo +->a : boolean +>a : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction.types.diff index 1d191652c2..7b7f45443c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction.types.diff @@ -1,13 +1,21 @@ --- old.jsdocTemplateConstructorFunction.types +++ new.jsdocTemplateConstructorFunction.types -@@= skipped -9, +9 lines =@@ +@@= skipped -3, +3 lines =@@ + /** + * @template U + * @typedef {(u: U) => U} Id ++>Id : Id ++>u : U ++ + */ + /** + * @param {T} t * @template T */ function Zet(t) { ->Zet : typeof Zet -->t : T -+>Zet : (t: any) => void -+>t : any ++>Zet : (t: T) => void + >t : T /** @type {T} */ this.u @@ -19,17 +27,14 @@ +>u : any this.t = t -->this.t = t : T -+>this.t = t : any + >this.t = t : T >this.t : any ->this : this +>this : any >t : any -->t : T -+>t : any + >t : T } - /** - * @param {T} v +@@= skipped -27, +30 lines =@@ * @param {Id} id */ Zet.prototype.add = function(v, id) { @@ -38,7 +43,7 @@ >Zet.prototype.add : any >Zet.prototype : any ->Zet : typeof Zet -+>Zet : (t: any) => void ++>Zet : (t: T) => void >prototype : any >add : any ->function(v, id) { this.u = v || this.t return id(this.u)} : (v: T, id: Id) => T @@ -86,7 +91,7 @@ ->Zet : typeof Zet +>z : any +>new Zet(1) : any -+>Zet : (t: any) => void ++>Zet : (t: T) => void >1 : 1 z.t = 2 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction2.types.diff index 550dddeaf4..b5ba2cdada 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction2.types.diff @@ -5,9 +5,8 @@ */ function Zet(t) { ->Zet : typeof Zet -->t : T -+>Zet : (t: any) => void -+>t : any ++>Zet : (t: T) => void + >t : T /** @type {T} */ this.u @@ -19,17 +18,13 @@ +>u : any this.t = t -->this.t = t : T -+>this.t = t : any + >this.t = t : T >this.t : any ->this : this +>this : any >t : any -->t : T -+>t : any + >t : T } - /** - * @param {T} v @@= skipped -22, +22 lines =@@ * @param {T} o.nested */ @@ -39,7 +34,7 @@ >Zet.prototype.add : any >Zet.prototype : any ->Zet : typeof Zet -+>Zet : (t: any) => void ++>Zet : (t: T) => void >prototype : any >add : any ->function(v, o) { this.u = v || o.nested return this.u} : (v: T, o: { nested: T;}) => T @@ -83,7 +78,7 @@ ->Zet : typeof Zet +>z : any +>new Zet(1) : any -+>Zet : (t: any) => void ++>Zet : (t: T) => void >1 : 1 z.t = 2 @@ -108,12 +103,11 @@ /** @type {number} */ let answer = z.add(3, { nested: 4 }) -->answer : number + >answer : number ->z.add(3, { nested: 4 }) : number ->z.add : (v: number, o: { nested: number; }) => number ->z : Zet ->add : (v: number, o: { nested: number; }) => number -+>answer : any +>z.add(3, { nested: 4 }) : any +>z.add : any +>z : any @@ -121,12 +115,15 @@ >3 : 3 >{ nested: 4 } : { nested: number; } >nested : number -@@= skipped -65, +65 lines =@@ +@@= skipped -61, +61 lines =@@ + // lookup in typedef should not crash the compiler, even when the type is unknown + /** + * @typedef {Object} A ++>A : any ++ + * @property {T} value ++>value : any ++ */ /** @type {A} */ const options = { value: null }; -->options : A -+>options : { value: any; } - >{ value: null } : { value: null; } - >value : null - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.errors.txt.diff index b06fd95851..daf552c939 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.errors.txt.diff @@ -2,11 +2,27 @@ +++ new.jsdocTemplateTag.errors.txt @@= skipped -0, +0 lines =@@ -forgot.js(23,1): error TS2322: Type '(keyframes: any[]) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. ++forgot.js(13,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. Type 'void' is not assignable to type 'Animation'. -@@= skipped -26, +26 lines =@@ +-==== forgot.js (1 errors) ==== ++==== forgot.js (2 errors) ==== + /** + * @param {T} a + * @template T +@@= skipped -15, +16 lines =@@ + * @param {T} a + * @template T + * @returns {function(): T} ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + */ + function g(a) { + return () => a +@@= skipped -11, +14 lines =@@ */ Element.prototype.animate = function(keyframes) {}; ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.types.diff index 82d56b6e5b..ef254c27e8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.types.diff @@ -1,46 +1,16 @@ --- old.jsdocTemplateTag.types +++ new.jsdocTemplateTag.types -@@= skipped -5, +5 lines =@@ - * @template T - */ - function f(a) { -->f : (a: T) => () => T -->a : T -+>f : (a: any) => () => any -+>a : any - - return () => a -->() => a : () => T -->a : T -+>() => a : () => any -+>a : any - } - let n = f(1)() -->n : number -->f(1)() : number -->f(1) : () => number -->f : (a: T) => () => T -+>n : any -+>f(1)() : any -+>f(1) : () => any -+>f : (a: any) => () => any - >1 : 1 - - /** -@@= skipped -20, +20 lines =@@ +@@= skipped -25, +25 lines =@@ * @returns {function(): T} */ function g(a) { ->g : (a: T) => () => T -->a : T -+>g : (a: any) => () => any -+>a : any ++>g : (a: T) => function + >a : T return () => a -->() => a : () => T -->a : T -+>() => a : () => any -+>a : any +@@= skipped -8, +8 lines =@@ + >a : T } let s = g('hi')() ->s : string @@ -49,8 +19,8 @@ ->g : (a: T) => () => T +>s : any +>g('hi')() : any -+>g('hi') : () => any -+>g : (a: any) => () => any ++>g('hi') : function ++>g : (a: T) => function >'hi' : "hi" /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag2.errors.txt.diff new file mode 100644 index 0000000000..00574f819b --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag2.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.jsdocTemplateTag2.errors.txt ++++ new.jsdocTemplateTag2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++github17339.js(4,13): error TS2304: Cannot find name 'T'. ++github17339.js(5,15): error TS2304: Cannot find name 'T'. ++ ++ ++==== github17339.js (2 errors) ==== ++ var obj = { ++ /** ++ * @template T ++ * @param {T} a ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ * @returns {T} ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ */ ++ x: function (a) { ++ return a; ++ }, ++ }; ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag2.types.diff deleted file mode 100644 index 55c15deba8..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag2.types.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.jsdocTemplateTag2.types -+++ new.jsdocTemplateTag2.types -@@= skipped -1, +1 lines =@@ - - === github17339.js === - var obj = { -->obj : { x: (a: T) => T; } -->{ /** * @template T * @param {T} a * @returns {T} */ x: function (a) { return a; },} : { x: (a: T) => T; } -+>obj : { x: (a: any) => any; } -+>{ /** * @template T * @param {T} a * @returns {T} */ x: function (a) { return a; },} : { x: (a: any) => any; } - - /** - * @template T -@@= skipped -9, +9 lines =@@ - * @returns {T} - */ - x: function (a) { -->x : (a: T) => T -->function (a) { return a; } : (a: T) => T -->a : T -+>x : (a: any) => any -+>function (a) { return a; } : (a: any) => any -+>a : any - - return a; -->a : T -+>a : any - - }, - }; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.errors.txt.diff index 050a812ed7..6460702efd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.errors.txt.diff @@ -1,56 +1,47 @@ --- old.jsdocTemplateTag3.errors.txt +++ new.jsdocTemplateTag3.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -a.js(14,29): error TS2339: Property 'a' does not exist on type 'U'. -a.js(14,35): error TS2339: Property 'b' does not exist on type 'U'. -a.js(21,3): error TS2345: Argument of type '{ a: number; }' is not assignable to parameter of type '{ a: number; b: string; }'. - Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -a.js(24,15): error TS2304: Cannot find name 'NoLongerAllowed'. -a.js(25,2): error TS1069: Unexpected token. A type parameter name was expected without curly braces. -- -- ++a.js(21,3): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. + + -==== a.js (5 errors) ==== -- /** -- * @template {{ a: number, b: string }} T,U A Comment -- * @template {{ c: boolean }} V uh ... are comments even supported?? -- * @template W -- * @template X That last one had no comment -- * @param {T} t -- * @param {U} u -- * @param {V} v -- * @param {W} w -- * @param {X} x -- * @return {W | X} -- */ -- function f(t, u, v, w, x) { -- if(t.a + t.b.length > u.a - u.b.length && v.c) { ++==== a.js (1 errors) ==== + /** + * @template {{ a: number, b: string }} T,U A Comment + * @template {{ c: boolean }} V uh ... are comments even supported?? +@@= skipped -20, +15 lines =@@ + */ + function f(t, u, v, w, x) { + if(t.a + t.b.length > u.a - u.b.length && v.c) { - ~ -!!! error TS2339: Property 'a' does not exist on type 'U'. - ~ -!!! error TS2339: Property 'b' does not exist on type 'U'. -- return w; -- } -- return x; -- } -- -- f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); -- f({ a: 12 }, undefined, undefined, 101, 'nope'); -- ~~~~~~~~~~ + return w; + } + return x; +@@= skipped -12, +8 lines =@@ + f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); + f({ a: 12 }, undefined, undefined, 101, 'nope'); + ~~~~~~~~~~ -!!! error TS2345: Argument of type '{ a: number; }' is not assignable to parameter of type '{ a: number; b: string; }'. -!!! error TS2345: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. --!!! related TS2728 a.js:2:28: 'b' is declared here. -- -- /** -- * @template {NoLongerAllowed} ++!!! error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. + !!! related TS2728 a.js:2:28: 'b' is declared here. + + /** + * @template {NoLongerAllowed} - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'NoLongerAllowed'. -- * @template T preceding line's syntax is no longer allowed + * @template T preceding line's syntax is no longer allowed - ~ -!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. -- * @param {T} x -- */ -- function g(x) { } -- -- -@@= skipped --1, +1 lines =@@ -+ + * @param {T} x + */ + function g(x) { } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.types.diff index 6b30eedea2..e07fd8e33b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.types.diff @@ -5,104 +5,50 @@ */ function f(t, u, v, w, x) { ->f : (t: T, u: U, v: V, w: W, x: X) => W | X -->t : T -->u : U -->v : V -->w : W -->x : X -+>f : (t: any, u: any, v: any, w: any, x: any) => any -+>t : any -+>u : any -+>v : any -+>w : any -+>x : any - - if(t.a + t.b.length > u.a - u.b.length && v.c) { -->t.a + t.b.length > u.a - u.b.length && v.c : boolean -+>t.a + t.b.length > u.a - u.b.length && v.c : any - >t.a + t.b.length > u.a - u.b.length : boolean -->t.a + t.b.length : number -->t.a : number -->t : T -->a : number -->t.b.length : number -->t.b : string -->t : T -->b : string -->length : number -+>t.a + t.b.length : any -+>t.a : any -+>t : any -+>a : any -+>t.b.length : any -+>t.b : any -+>t : any -+>b : any -+>length : any ++>f : (t: T, u: U, v: V, w: W, x: X) => W | X + >t : T + >u : U + >v : V +@@= skipped -20, +20 lines =@@ + >b : string + >length : number >u.a - u.b.length : number - >u.a : any -->u : U -+>u : any - >a : any - >u.b.length : any - >u.b : any -->u : U -+>u : any - >b : any - >length : any -->v.c : boolean -->v : V -->c : boolean -+>v.c : any -+>v : any -+>c : any - - return w; -->w : W -+>w : any - } - return x; -->x : X -+>x : any +->u.a : any ++>u.a : number + >u : U +->a : any +->u.b.length : any +->u.b : any ++>a : number ++>u.b.length : number ++>u.b : string + >u : U +->b : any +->length : any ++>b : string ++>length : number + >v.c : boolean + >v : V + >c : boolean +@@= skipped -20, +20 lines =@@ } f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); ->f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope') : 101 | "nope" ->f : (t: T, u: U, v: V, w: W, x: X) => W | X -+>f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope') : any -+>f : (t: any, u: any, v: any, w: any, x: any) => any ++>f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope') : "nope" | 101 ++>f : (t: T, u: U, v: V, w: W, x: X) => W | X >{ a: 12, b: 'hi', c: null } : { a: number; b: string; c: null; } >a : number >12 : 12 -@@= skipped -49, +49 lines =@@ - >'hi' : "hi" - >c : null - >undefined : undefined -->{ c: false, d: 12, b: undefined } : { c: false; d: number; b: undefined; } -->c : false -+>{ c: false, d: 12, b: undefined } : { c: boolean; d: number; b: undefined; } -+>c : boolean - >false : false - >d : number - >12 : 12 -@@= skipped -11, +11 lines =@@ +@@= skipped -20, +20 lines =@@ >'nope' : "nope" f({ a: 12 }, undefined, undefined, 101, 'nope'); ->f({ a: 12 }, undefined, undefined, 101, 'nope') : 101 | "nope" ->f : (t: T, u: U, v: V, w: W, x: X) => W | X -+>f({ a: 12 }, undefined, undefined, 101, 'nope') : any -+>f : (t: any, u: any, v: any, w: any, x: any) => any ++>f({ a: 12 }, undefined, undefined, 101, 'nope') : "nope" | 101 ++>f : (t: T, u: U, v: V, w: W, x: X) => W | X >{ a: 12 } : { a: number; } >a : number >12 : 12 -@@= skipped -16, +16 lines =@@ - * @param {T} x - */ - function g(x) { } -->g : (x: T) => void -->x : T -+>g : (x: any) => void -+>x : any - - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag4.types.diff index 05e7d580dc..54eaeb9094 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag4.types.diff @@ -5,7 +5,7 @@ */ function Multimap() { ->Multimap : typeof Multimap -+>Multimap : () => void ++>Multimap : () => void /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {}; @@ -28,7 +28,7 @@ >Multimap.prototype.get : any >Multimap.prototype : any ->Multimap : typeof Multimap -+>Multimap : () => void ++>Multimap : () => void >prototype : any >get : any ->function (key) { return this._map[key + ''];} : (key: K) => V @@ -57,8 +57,8 @@ var Multimap2 = function() { ->Multimap2 : typeof Multimap2 ->function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : typeof Multimap2 -+>Multimap2 : () => void -+>function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void ++>Multimap2 : () => void ++>function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {}; @@ -81,7 +81,7 @@ >Multimap2.prototype.get : any >Multimap2.prototype : any ->Multimap2 : typeof Multimap2 -+>Multimap2 : () => void ++>Multimap2 : () => void >prototype : any >get : any ->function (key) { return this._map[key + ''];} : (key: K) => V diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag5.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag5.errors.txt.diff index 77b6c5ec32..06a4860016 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag5.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag5.errors.txt.diff @@ -4,14 +4,20 @@ - @@= skipped --1, +1 lines =@@ +a.js(9,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. ++a.js(14,16): error TS2304: Cannot find name 'K'. ++a.js(15,18): error TS2304: Cannot find name 'V'. ++a.js(18,21): error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. +a.js(30,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. ++a.js(35,16): error TS2304: Cannot find name 'K'. ++a.js(36,18): error TS2304: Cannot find name 'V'. +a.js(50,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. +a.js(52,10): error TS2339: Property '_map' does not exist on type '{}'. +a.js(55,4): error TS2339: Property 'Multimap3' does not exist on type '{}'. ++a.js(57,16): error TS2304: Cannot find name 'K'. ++a.js(58,18): error TS2304: Cannot find name 'V'. + + -+==== a.js (6 errors) ==== ++==== a.js (12 errors) ==== + /** + * Should work for function declarations + * @constructor @@ -28,12 +34,16 @@ + Multimap.prototype = { + /** + * @param {K} key the key ok ++ ~ ++!!! error TS2304: Cannot find name 'K'. + * @returns {V} the value ok ++ ~ ++!!! error TS2304: Cannot find name 'V'. + */ + get(key) { + return this._map[key + '']; + ~~~~ -+!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. ++!!! error TS2339: Property '_map' does not exist on type '{ get: (key: K) => V; }'. + } + } + @@ -53,7 +63,11 @@ + Multimap2.prototype = { + /** + * @param {K} key the key ok ++ ~ ++!!! error TS2304: Cannot find name 'K'. + * @returns {V} the value ok ++ ~ ++!!! error TS2304: Cannot find name 'V'. + */ + get: function(key) { + return this._map[key + '']; @@ -81,7 +95,11 @@ +!!! error TS2339: Property 'Multimap3' does not exist on type '{}'. + /** + * @param {K} key the key ok ++ ~ ++!!! error TS2304: Cannot find name 'K'. + * @returns {V} the value ok ++ ~ ++!!! error TS2304: Cannot find name 'V'. + */ + get(key) { + return this._map[key + '']; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag5.types.diff index d1de9f6cf0..711f71b54a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag5.types.diff @@ -5,7 +5,7 @@ */ function Multimap() { ->Multimap : typeof Multimap -+>Multimap : { (): void; prototype: { get: (key: any) => any; }; } ++>Multimap : { (): void; prototype: { get: (key: K) => V; }; } /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {}; @@ -26,21 +26,16 @@ ->Multimap : typeof Multimap ->prototype : { get(key: K): V; } ->{ /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get(key: K): V; } -+>Multimap.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } -+>Multimap.prototype : { get: (key: any) => any; } -+>Multimap : { (): void; prototype: { get: (key: any) => any; }; } -+>prototype : { get: (key: any) => any; } -+>{ /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } ++>Multimap.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: K) => V; } ++>Multimap.prototype : { get: (key: K) => V; } ++>Multimap : { (): void; prototype: { get: (key: K) => V; }; } ++>prototype : { get: (key: K) => V; } ++>{ /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: K) => V; } /** * @param {K} key the key ok - * @returns {V} the value ok - */ - get(key) { -->get : (key: K) => V -->key : K -+>get : (key: any) => any -+>key : any +@@= skipped -28, +28 lines =@@ + >key : K return this._map[key + '']; ->this._map[key + ''] : V @@ -49,22 +44,19 @@ ->_map : { [x: string]: V; } +>this._map[key + ''] : any +>this._map : any -+>this : { get: (key: any) => any; } ++>this : { get: (key: K) => V; } +>_map : any >key + '' : string -->key : K -+>key : any + >key : K >'' : "" - } - } -@@= skipped -45, +45 lines =@@ +@@= skipped -17, +17 lines =@@ * @template V */ var Multimap2 = function() { ->Multimap2 : typeof Multimap2 ->function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : typeof Multimap2 -+>Multimap2 : () => void -+>function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void ++>Multimap2 : () => void ++>function() { /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {};} : () => void /** @type {Object} TODO: Remove the prototype from the fresh object */ this._map = {}; @@ -80,28 +72,18 @@ }; Multimap2.prototype = { -->Multimap2.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get: function(key) { return this._map[key + '']; }} : { get: (key: K) => V; } + >Multimap2.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get: function(key) { return this._map[key + '']; }} : { get: (key: K) => V; } ->Multimap2.prototype : { get: (key: K) => V; } ->Multimap2 : typeof Multimap2 ->prototype : { get: (key: K) => V; } -->{ /** * @param {K} key the key ok * @returns {V} the value ok */ get: function(key) { return this._map[key + '']; }} : { get: (key: K) => V; } -+>Multimap2.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get: function(key) { return this._map[key + '']; }} : { get: (key: any) => any; } +>Multimap2.prototype : any -+>Multimap2 : () => void ++>Multimap2 : () => void +>prototype : any -+>{ /** * @param {K} key the key ok * @returns {V} the value ok */ get: function(key) { return this._map[key + '']; }} : { get: (key: any) => any; } + >{ /** * @param {K} key the key ok * @returns {V} the value ok */ get: function(key) { return this._map[key + '']; }} : { get: (key: K) => V; } /** - * @param {K} key the key ok - * @returns {V} the value ok - */ - get: function(key) { -->get : (key: K) => V -->function(key) { return this._map[key + '']; } : (key: K) => V -->key : K -+>get : (key: any) => any -+>function(key) { return this._map[key + '']; } : (key: any) => any -+>key : any +@@= skipped -30, +30 lines =@@ + >key : K return this._map[key + '']; ->this._map[key + ''] : V @@ -113,10 +95,9 @@ +>this : any +>_map : any >key + '' : string -->key : K -+>key : any + >key : K >'' : "" - } +@@= skipped -11, +11 lines =@@ } var Ns = {}; @@ -125,7 +106,7 @@ >{} : {} /** -@@= skipped -51, +51 lines =@@ +@@= skipped -10, +10 lines =@@ * @template V */ Ns.Multimap3 = function() { @@ -161,23 +142,18 @@ ->Multimap3 : typeof Multimap3 ->prototype : { get(key: K): V; } ->{ /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get(key: K): V; } -+>Ns.Multimap3.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } ++>Ns.Multimap3.prototype = { /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: K) => V; } +>Ns.Multimap3.prototype : any +>Ns.Multimap3 : any +>Ns : {} +>Multimap3 : any +>prototype : any -+>{ /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } ++>{ /** * @param {K} key the key ok * @returns {V} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: K) => V; } /** * @param {K} key the key ok - * @returns {V} the value ok - */ - get(key) { -->get : (key: K) => V -->key : K -+>get : (key: any) => any -+>key : any +@@= skipped -34, +34 lines =@@ + >key : K return this._map[key + '']; ->this._map[key + ''] : V @@ -189,8 +165,5 @@ +>this : any +>_map : any >key + '' : string -->key : K -+>key : any + >key : K >'' : "" - } - } 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 fb8ce84e04..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag6.errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.jsdocTemplateTag6.errors.txt -+++ new.jsdocTemplateTag6.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+a.js(6,13): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(18,13): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(30,13): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(41,13): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(52,13): error TS7006: Parameter 'obj' implicitly has an 'any' type. -+a.js(65,17): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(71,9): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(84,13): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. -+ -+ -+==== a.js (8 errors) ==== -+ /** -+ * @template const T -+ * @param {T} x -+ * @returns {T} -+ */ -+ function f1(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ 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 -+ * @param {T} x -+ * @returns {T} -+ */ -+ function f2(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ 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 -+ * @param {T} x -+ * @returns {T[]} -+ */ -+ function f3(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ return [x]; -+ } -+ const t7 = f3("hello"); -+ const t8 = f3("hello"); -+ -+ /** -+ * @template const T -+ * @param {[T, T]} x -+ * @returns {T} -+ */ -+ function f4(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ return x[0]; -+ } -+ const t9 = f4([[1, "x"], [2, "y"]]); -+ const t10 = f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]); -+ -+ /** -+ * @template const T -+ * @param {{ x: T, y: T}} obj -+ * @returns {T} -+ */ -+ function f5(obj) { -+ ~~~ -+!!! error TS7006: Parameter 'obj' implicitly has an 'any' type. -+ 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 -+ */ -+ class C { -+ /** -+ * @param {T} x -+ */ -+ constructor(x) {} -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ -+ /** -+ * @template const U -+ * @param {U} x -+ */ -+ foo(x) { -+ ~ -+!!! error TS7006: Parameter 'x' implicitly has an 'any' type. -+ 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) { -+ ~~~~~~~ -+!!! error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. -+ return args; -+ } -+ const t15 = f6(1, 'b', { a: 1, b: 'x' }); -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag6.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag6.types.diff index b8e9a90698..bd2aa87e0d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag6.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag6.types.diff @@ -5,402 +5,184 @@ */ function f1(x) { ->f1 : (x: T) => T -->x : T -+>f1 : (x: any) => any -+>x : any ++>f1 : (x: T) => T + >x : T return x; -->x : T -+>x : any - } +@@= skipped -9, +9 lines =@@ const t1 = f1("a"); -->t1 : "a" -->f1("a") : "a" + >t1 : "a" + >f1("a") : "a" ->f1 : (x: T) => T -+>t1 : any -+>f1("a") : any -+>f1 : (x: any) => any ++>f1 : (x: T) => T >"a" : "a" const t2 = f1(["a", ["b", "c"]]); -->t2 : readonly ["a", readonly ["b", "c"]] -->f1(["a", ["b", "c"]]) : readonly ["a", readonly ["b", "c"]] + >t2 : readonly ["a", readonly ["b", "c"]] + >f1(["a", ["b", "c"]]) : readonly ["a", readonly ["b", "c"]] ->f1 : (x: T) => T -->["a", ["b", "c"]] : ["a", ["b", "c"]] -+>t2 : any -+>f1(["a", ["b", "c"]]) : any -+>f1 : (x: any) => any -+>["a", ["b", "c"]] : (string | string[])[] ++>f1 : (x: T) => T + >["a", ["b", "c"]] : ["a", ["b", "c"]] >"a" : "a" -->["b", "c"] : ["b", "c"] -+>["b", "c"] : string[] - >"b" : "b" - >"c" : "c" - + >["b", "c"] : ["b", "c"] +@@= skipped -16, +16 lines =@@ const t3 = f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); -->t3 : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } -->f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } + >t3 : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } + >f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } ->f1 : (x: T) => T -->{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: 1; b: "c"; d: ["e", 2, true, { f: "g"; }]; } -->a : 1 -+>t3 : any -+>f1({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : any -+>f1 : (x: any) => any -+>{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: number; b: string; d: (string | number | boolean | { f: string; })[]; } -+>a : number ++>f1 : (x: T) => T + >{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: 1; b: "c"; d: ["e", 2, true, { f: "g"; }]; } + >a : 1 >1 : 1 -->b : "c" -+>b : string - >"c" : "c" -->d : ["e", 2, true, { f: "g"; }] -->["e", 2, true, { f: "g" }] : ["e", 2, true, { f: "g"; }] -+>d : (string | number | boolean | { f: string; })[] -+>["e", 2, true, { f: "g" }] : (string | number | boolean | { f: string; })[] - >"e" : "e" - >2 : 2 - >true : true -->{ f: "g" } : { f: "g"; } -->f : "g" -+>{ f: "g" } : { f: string; } -+>f : string - >"g" : "g" - - /** -@@= skipped -46, +46 lines =@@ +@@= skipped -21, +21 lines =@@ * @returns {T} */ function f2(x) { ->f2 : (x: T) => T -->x : T -+>f2 : (x: any) => any -+>x : any ++>f2 : (x: T) => T + >x : T return x; -->x : T -+>x : any - - }; +@@= skipped -10, +10 lines =@@ const t4 = f2('a'); -->t4 : "a" -->f2('a') : "a" + >t4 : "a" + >f2('a') : "a" ->f2 : (x: T) => T -+>t4 : any -+>f2('a') : any -+>f2 : (x: any) => any ++>f2 : (x: T) => T >'a' : "a" const t5 = f2(['a', ['b', 'c']]); -->t5 : readonly ["a", readonly ["b", "c"]] -->f2(['a', ['b', 'c']]) : readonly ["a", readonly ["b", "c"]] + >t5 : readonly ["a", readonly ["b", "c"]] + >f2(['a', ['b', 'c']]) : readonly ["a", readonly ["b", "c"]] ->f2 : (x: T) => T -->['a', ['b', 'c']] : ["a", ["b", "c"]] -+>t5 : any -+>f2(['a', ['b', 'c']]) : any -+>f2 : (x: any) => any -+>['a', ['b', 'c']] : (string | string[])[] ++>f2 : (x: T) => T + >['a', ['b', 'c']] : ["a", ["b", "c"]] >'a' : "a" -->['b', 'c'] : ["b", "c"] -+>['b', 'c'] : string[] - >'b' : "b" - >'c' : "c" - + >['b', 'c'] : ["b", "c"] +@@= skipped -16, +16 lines =@@ const t6 = f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); -->t6 : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } -->f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } + >t6 : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } + >f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : { readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; } ->f2 : (x: T) => T -->{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: 1; b: "c"; d: ["e", 2, true, { f: "g"; }]; } -->a : 1 -+>t6 : any -+>f2({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : any -+>f2 : (x: any) => any -+>{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: number; b: string; d: (string | number | boolean | { f: string; })[]; } -+>a : number ++>f2 : (x: T) => T + >{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: 1; b: "c"; d: ["e", 2, true, { f: "g"; }]; } + >a : 1 >1 : 1 -->b : "c" -+>b : string - >"c" : "c" -->d : ["e", 2, true, { f: "g"; }] -->["e", 2, true, { f: "g" }] : ["e", 2, true, { f: "g"; }] -+>d : (string | number | boolean | { f: string; })[] -+>["e", 2, true, { f: "g" }] : (string | number | boolean | { f: string; })[] - >"e" : "e" - >2 : 2 - >true : true -->{ f: "g" } : { f: "g"; } -->f : "g" -+>{ f: "g" } : { f: string; } -+>f : string - >"g" : "g" - - /** -@@= skipped -47, +47 lines =@@ +@@= skipped -21, +21 lines =@@ * @returns {T[]} */ function f3(x) { ->f3 : (x: T) => T[] -->x : T -+>f3 : (x: any) => any[] -+>x : any ++>f3 : (x: T) => T[] + >x : T return [x]; -->[x] : T[] -->x : T -+>[x] : any[] -+>x : any - } +@@= skipped -10, +10 lines =@@ const t7 = f3("hello"); -->t7 : "hello"[] -->f3("hello") : "hello"[] + >t7 : "hello"[] + >f3("hello") : "hello"[] ->f3 : (x: T) => T[] -+>t7 : any[] -+>f3("hello") : any[] -+>f3 : (x: any) => any[] ++>f3 : (x: T) => T[] >"hello" : "hello" const t8 = f3("hello"); -->t8 : "hello"[] -->f3("hello") : "hello"[] + >t8 : "hello"[] + >f3("hello") : "hello"[] ->f3 : (x: T) => T[] -+>t8 : any[] -+>f3("hello") : any[] -+>f3 : (x: any) => any[] ++>f3 : (x: T) => T[] >"hello" : "hello" /** -@@= skipped -25, +25 lines =@@ +@@= skipped -15, +15 lines =@@ * @returns {T} */ function f4(x) { ->f4 : (x: [T, T]) => T -->x : [T, T] -+>f4 : (x: any) => any -+>x : any ++>f4 : (x: [T, T]) => T + >x : [T, T] return x[0]; -->x[0] : T -->x : [T, T] -+>x[0] : any -+>x : any - >0 : 0 - } +@@= skipped -11, +11 lines =@@ const t9 = f4([[1, "x"], [2, "y"]]); -->t9 : readonly [1, "x"] | readonly [2, "y"] -->f4([[1, "x"], [2, "y"]]) : readonly [1, "x"] | readonly [2, "y"] + >t9 : readonly [1, "x"] | readonly [2, "y"] + >f4([[1, "x"], [2, "y"]]) : readonly [1, "x"] | readonly [2, "y"] ->f4 : (x: [T, T]) => T -->[[1, "x"], [2, "y"]] : [[1, "x"], [2, "y"]] -->[1, "x"] : [1, "x"] -+>t9 : any -+>f4([[1, "x"], [2, "y"]]) : any -+>f4 : (x: any) => any -+>[[1, "x"], [2, "y"]] : (string | number)[][] -+>[1, "x"] : (string | number)[] ++>f4 : (x: [T, T]) => T + >[[1, "x"], [2, "y"]] : [[1, "x"], [2, "y"]] + >[1, "x"] : [1, "x"] >1 : 1 - >"x" : "x" -->[2, "y"] : [2, "y"] -+>[2, "y"] : (string | number)[] - >2 : 2 - >"y" : "y" - +@@= skipped -12, +12 lines =@@ const t10 = f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]); -->t10 : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } -->f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]) : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } + >t10 : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } + >f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]) : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } ->f4 : (x: [T, T]) => T -->[{ a: 1, b: "x" }, { a: 2, b: "y" }] : [{ a: 1; b: "x"; }, { a: 2; b: "y"; }] -->{ a: 1, b: "x" } : { a: 1; b: "x"; } -->a : 1 -+>t10 : any -+>f4([{ a: 1, b: "x" }, { a: 2, b: "y" }]) : any -+>f4 : (x: any) => any -+>[{ a: 1, b: "x" }, { a: 2, b: "y" }] : { a: number; b: string; }[] -+>{ a: 1, b: "x" } : { a: number; b: string; } -+>a : number - >1 : 1 -->b : "x" -+>b : string - >"x" : "x" -->{ a: 2, b: "y" } : { a: 2; b: "y"; } -->a : 2 -+>{ a: 2, b: "y" } : { a: number; b: string; } -+>a : number - >2 : 2 -->b : "y" -+>b : string - >"y" : "y" - - /** -@@= skipped -42, +42 lines =@@ ++>f4 : (x: [T, T]) => T + >[{ a: 1, b: "x" }, { a: 2, b: "y" }] : [{ a: 1; b: "x"; }, { a: 2; b: "y"; }] + >{ a: 1, b: "x" } : { a: 1; b: "x"; } + >a : 1 +@@= skipped -19, +19 lines =@@ * @returns {T} */ function f5(obj) { ->f5 : (obj: { x: T; y: T; }) => T -->obj : { x: T; y: T; } -+>f5 : (obj: any) => any -+>obj : any ++>f5 : (obj: { x: T; y: T; }) => T + >obj : { x: T; y: T; } return obj.x; -->obj.x : T -->obj : { x: T; y: T; } -->x : T -+>obj.x : any -+>obj : any -+>x : any - } +@@= skipped -11, +11 lines =@@ const t11 = f5({ x: [1, "x"], y: [2, "y"] }); -->t11 : readonly [1, "x"] | readonly [2, "y"] -->f5({ x: [1, "x"], y: [2, "y"] }) : readonly [1, "x"] | readonly [2, "y"] + >t11 : readonly [1, "x"] | readonly [2, "y"] + >f5({ x: [1, "x"], y: [2, "y"] }) : readonly [1, "x"] | readonly [2, "y"] ->f5 : (obj: { x: T; y: T; }) => T -->{ x: [1, "x"], y: [2, "y"] } : { x: [1, "x"]; y: [2, "y"]; } -->x : [1, "x"] -->[1, "x"] : [1, "x"] -+>t11 : any -+>f5({ x: [1, "x"], y: [2, "y"] }) : any -+>f5 : (obj: any) => any -+>{ x: [1, "x"], y: [2, "y"] } : { x: (string | number)[]; y: (string | number)[]; } -+>x : (string | number)[] -+>[1, "x"] : (string | number)[] - >1 : 1 - >"x" : "x" -->y : [2, "y"] -->[2, "y"] : [2, "y"] -+>y : (string | number)[] -+>[2, "y"] : (string | number)[] - >2 : 2 - >"y" : "y" - ++>f5 : (obj: { x: T; y: T; }) => T + >{ x: [1, "x"], y: [2, "y"] } : { x: [1, "x"]; y: [2, "y"]; } + >x : [1, "x"] + >[1, "x"] : [1, "x"] +@@= skipped -14, +14 lines =@@ const t12 = f5({ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } }); -->t12 : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } -->f5({ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } }) : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } + >t12 : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } + >f5({ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } }) : { readonly a: 1; readonly b: "x"; } | { readonly a: 2; readonly b: "y"; } ->f5 : (obj: { x: T; y: T; }) => T -->{ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } } : { x: { a: 1; b: "x"; }; y: { a: 2; b: "y"; }; } -->x : { a: 1; b: "x"; } -->{ a: 1, b: "x" } : { a: 1; b: "x"; } -->a : 1 -+>t12 : any -+>f5({ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } }) : any -+>f5 : (obj: any) => any -+>{ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } } : { x: { a: number; b: string; }; y: { a: number; b: string; }; } -+>x : { a: number; b: string; } -+>{ a: 1, b: "x" } : { a: number; b: string; } -+>a : number - >1 : 1 -->b : "x" -+>b : string - >"x" : "x" -->y : { a: 2; b: "y"; } -->{ a: 2, b: "y" } : { a: 2; b: "y"; } -->a : 2 -+>y : { a: number; b: string; } -+>{ a: 2, b: "y" } : { a: number; b: string; } -+>a : number - >2 : 2 -->b : "y" -+>b : string - >"y" : "y" - - /** - * @template const T - */ - class C { -->C : C -+>C : C - - /** - * @param {T} x - */ - constructor(x) {} -->x : T -+>x : any - - /** - * @template const U ++>f5 : (obj: { x: T; y: T; }) => T + >{ x: { a: 1, b: "x" }, y: { a: 2, b: "y" } } : { x: { a: 1; b: "x"; }; y: { a: 2; b: "y"; }; } + >x : { a: 1; b: "x"; } + >{ a: 1, b: "x" } : { a: 1; b: "x"; } +@@= skipped -32, +32 lines =@@ * @param {U} x */ foo(x) { ->foo : (x: U) => U -->x : U -+>foo : (x: any) => any -+>x : any ++>foo : (x: U) => U + >x : U return x; -->x : U -+>x : any - } - } - - const t13 = new C({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }); -->t13 : C<{ readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; }> -->new C({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : C<{ readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; }> -+>t13 : C -+>new C({ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] }) : C - >C : typeof C -->{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: 1; b: "c"; d: ["e", 2, true, { f: "g"; }]; } -->a : 1 -+>{ a: 1, b: "c", d: ["e", 2, true, { f: "g" }] } : { a: number; b: string; d: (string | number | boolean | { f: string; })[]; } -+>a : number - >1 : 1 -->b : "c" -+>b : string - >"c" : "c" -->d : ["e", 2, true, { f: "g"; }] -->["e", 2, true, { f: "g" }] : ["e", 2, true, { f: "g"; }] -+>d : (string | number | boolean | { f: string; })[] -+>["e", 2, true, { f: "g" }] : (string | number | boolean | { f: string; })[] - >"e" : "e" - >2 : 2 - >true : true -->{ f: "g" } : { f: "g"; } -->f : "g" -+>{ f: "g" } : { f: string; } -+>f : string - >"g" : "g" - +@@= skipped -29, +29 lines =@@ const t14 = t13.foo(["a", ["b", "c"]]); -->t14 : readonly ["a", readonly ["b", "c"]] -->t13.foo(["a", ["b", "c"]]) : readonly ["a", readonly ["b", "c"]] + >t14 : readonly ["a", readonly ["b", "c"]] + >t13.foo(["a", ["b", "c"]]) : readonly ["a", readonly ["b", "c"]] ->t13.foo : (x: U) => U -->t13 : C<{ readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; }> ++>t13.foo : (x: U) => U + >t13 : C<{ readonly a: 1; readonly b: "c"; readonly d: readonly ["e", 2, true, { readonly f: "g"; }]; }> ->foo : (x: U) => U -->["a", ["b", "c"]] : ["a", ["b", "c"]] -+>t14 : any -+>t13.foo(["a", ["b", "c"]]) : any -+>t13.foo : (x: any) => any -+>t13 : C -+>foo : (x: any) => any -+>["a", ["b", "c"]] : (string | string[])[] ++>foo : (x: U) => U + >["a", ["b", "c"]] : ["a", ["b", "c"]] >"a" : "a" -->["b", "c"] : ["b", "c"] -+>["b", "c"] : string[] - >"b" : "b" - >"c" : "c" - -@@= skipped -101, +101 lines =@@ + >["b", "c"] : ["b", "c"] +@@= skipped -15, +15 lines =@@ * @returns {T} */ function f6(...args) { ->f6 : (...args: T) => T -->args : T -+>f6 : (...args: any[]) => any[] -+>args : any[] ++>f6 : (...args: T) => T + >args : T return args; -->args : T -+>args : any[] - } +@@= skipped -9, +9 lines =@@ const t15 = f6(1, 'b', { a: 1, b: 'x' }); -->t15 : readonly [1, "b", { readonly a: 1; readonly b: "x"; }] -->f6(1, 'b', { a: 1, b: 'x' }) : readonly [1, "b", { readonly a: 1; readonly b: "x"; }] + >t15 : readonly [1, "b", { readonly a: 1; readonly b: "x"; }] + >f6(1, 'b', { a: 1, b: 'x' }) : readonly [1, "b", { readonly a: 1; readonly b: "x"; }] ->f6 : (...args: T) => T -+>t15 : any[] -+>f6(1, 'b', { a: 1, b: 'x' }) : any[] -+>f6 : (...args: any[]) => any[] ++>f6 : (...args: T) => T >1 : 1 >'b' : "b" -->{ a: 1, b: 'x' } : { a: 1; b: "x"; } -->a : 1 -+>{ a: 1, b: 'x' } : { a: number; b: string; } -+>a : number - >1 : 1 -->b : "x" -+>b : string - >'x' : "x" - + >{ a: 1, b: 'x' } : { a: 1; b: "x"; } 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 44c8b6fc84..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag7.errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.jsdocTemplateTag7.errors.txt -+++ new.jsdocTemplateTag7.errors.txt -@@= skipped -0, +-1 lines =@@ --a.js(2,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) ==== -- /** -- * @template const T -- ~~~~~ --!!! error TS1277: 'const' modifier can only appear on a type parameter of a function, method or class -- * @typedef {[T]} X -- */ -- -- /** -- * @template const T -- */ -- class C { } -- -- /** -- * @template private T -- ~~~~~~~ --!!! error TS1273: 'private' modifier cannot appear on a type parameter -- * @param {T} x -- * @returns {T} -- */ -- function f(x) { -- return x; -- } -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag7.types.diff index f6a0ac8fde..0cdcf30892 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag7.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag7.types.diff @@ -1,25 +1,11 @@ --- old.jsdocTemplateTag7.types +++ new.jsdocTemplateTag7.types -@@= skipped -9, +9 lines =@@ +@@= skipped -3, +3 lines =@@ + /** * @template const T + * @typedef {[T]} X ++>X : any ++ */ - class C { } -->C : C -+>C : C /** - * @template private T -@@= skipped -8, +8 lines =@@ - * @returns {T} - */ - function f(x) { -->f : (x: T) => T -->x : T -+>f : (x: any) => any -+>x : any - - return x; -->x : T -+>x : any - } - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.errors.txt.diff index 2c159fbbe2..9b0fb0c535 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.errors.txt.diff @@ -1,41 +1,49 @@ --- old.jsdocTemplateTag8.errors.txt +++ new.jsdocTemplateTag8.errors.txt @@= skipped -0, +0 lines =@@ --a.js(18,1): error TS2322: Type 'Covariant' is not assignable to type 'Covariant'. -- Type 'unknown' is not assignable to type 'string'. --a.js(36,1): error TS2322: Type 'Contravariant' is not assignable to type 'Contravariant'. -- Type 'unknown' is not assignable to type 'string'. --a.js(55,1): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. ++a.js(2,14): error TS1274: 'out' modifier can only appear on a type parameter of a class, interface or type alias + 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(29,33): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(34,31): error TS7006: Parameter 'x' implicitly has an 'any' type. + 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(48,29): error TS7006: Parameter 'x' implicitly has an 'any' type. ++a.js(53,27): error TS7006: Parameter 'x' implicitly has an 'any' type. + 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'. --a.js(56,1): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. ++ 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'. --a.js(59,14): error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias -+a.js(29,33): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(34,31): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(48,29): error TS7006: Parameter 'x' implicitly has an 'any' type. -+a.js(53,27): error TS7006: Parameter 'x' implicitly has an 'any' type. ++ 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 (5 errors) ==== -+==== a.js (4 errors) ==== ++==== a.js (12 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 -@@= skipped -31, +22 lines =@@ - - super_covariant = sub_covariant; - sub_covariant = super_covariant; // Error -- ~~~~~~~~~~~~~ --!!! error TS2322: Type 'Covariant' is not assignable to type 'Covariant'. --!!! error TS2322: Type 'unknown' is not assignable to type 'string'. + * @property {T} x + */ +@@= skipped -37, +42 lines =@@ /** * @template in T -@@= skipped -14, +11 lines =@@ ++ ~~ ++!!! 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 + */ +@@= skipped -8, +10 lines =@@ * @type {Contravariant} */ let super_contravariant = { f: (x) => {} }; @@ -50,13 +58,17 @@ +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. super_contravariant = sub_contravariant; // Error -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2322: Type 'Contravariant' is not assignable to type 'Contravariant'. --!!! error TS2322: Type 'unknown' is not assignable to type 'string'. - sub_contravariant = super_contravariant; + ~~~~~~~~~~~~~~~~~~~ +@@= skipped -14, +18 lines =@@ /** -@@= skipped -22, +23 lines =@@ + * @template in out T ++ ~~ ++!!! 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 + */ +@@= skipped -8, +10 lines =@@ * @type {Invariant} */ let super_invariant = { f: (x) => {} }; @@ -71,22 +83,19 @@ +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. super_invariant = sub_invariant; // Error -- ~~~~~~~~~~~~~~~ --!!! error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. + ~~~~~~~~~~~~~~~ + !!! 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: 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 -- ~~ --!!! error TS1274: 'in' modifier can only appear on a type parameter of a class, interface or type alias - * @param {T} x - */ - function f(x) {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.types.diff index 31c7c84ea0..2fb37e9ea2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.types.diff @@ -1,52 +1,38 @@ --- old.jsdocTemplateTag8.types +++ new.jsdocTemplateTag8.types -@@= skipped -10, +10 lines =@@ - * @type {Covariant} - */ - let super_covariant = { x: 1 }; -->super_covariant : Covariant -+>super_covariant : { x: number; } - >{ x: 1 } : { x: number; } - >x : number - >1 : 1 -@@= skipped -9, +9 lines =@@ - * @type {Covariant} +@@= skipped -3, +3 lines =@@ + /** + * @template out T + * @typedef {Object} Covariant ++>Covariant : any ++ + * @property {T} x ++>x : any ++ */ - let sub_covariant = { x: '' }; -->sub_covariant : Covariant -+>sub_covariant : { x: string; } - >{ x: '' } : { x: string; } - >x : string - >'' : "" - - super_covariant = sub_covariant; -->super_covariant = sub_covariant : Covariant -->super_covariant : Covariant -->sub_covariant : Covariant -+>super_covariant = sub_covariant : { x: string; } -+>super_covariant : { x: number; } -+>sub_covariant : { x: string; } - - sub_covariant = super_covariant; // Error -->sub_covariant = super_covariant : Covariant -->sub_covariant : Covariant -->super_covariant : Covariant -+>sub_covariant = super_covariant : { x: number; } -+>sub_covariant : { x: string; } -+>super_covariant : { x: number; } + /** +@@= skipped -34, +38 lines =@@ /** * @template in T -@@= skipped -25, +25 lines =@@ - * @type {Contravariant} + * @typedef {Object} Contravariant ++>Contravariant : any ++ + * @property {(x: T) => void} f ++>f : any ++>x : T ++ + */ + + /** +@@= skipped -8, +13 lines =@@ */ let super_contravariant = { f: (x) => {} }; -->super_contravariant : Contravariant + >super_contravariant : Contravariant ->{ f: (x) => {} } : { f: (x: unknown) => void; } ->f : (x: unknown) => void ->(x) => {} : (x: unknown) => void ->x : unknown -+>super_contravariant : { f: (x: any) => void; } +>{ f: (x) => {} } : { f: (x: any) => void; } +>f : (x: any) => void +>(x) => {} : (x: any) => void @@ -56,45 +42,39 @@ * @type {Contravariant} */ let sub_contravariant = { f: (x) => {} }; -->sub_contravariant : Contravariant + >sub_contravariant : Contravariant ->{ f: (x) => {} } : { f: (x: string) => void; } ->f : (x: string) => void ->(x) => {} : (x: string) => void ->x : string -+>sub_contravariant : { f: (x: any) => void; } +>{ f: (x) => {} } : { f: (x: any) => void; } +>f : (x: any) => void +>(x) => {} : (x: any) => void +>x : any super_contravariant = sub_contravariant; // Error -->super_contravariant = sub_contravariant : Contravariant -->super_contravariant : Contravariant -->sub_contravariant : Contravariant -+>super_contravariant = sub_contravariant : { f: (x: any) => void; } -+>super_contravariant : { f: (x: any) => void; } -+>sub_contravariant : { f: (x: any) => void; } - - sub_contravariant = super_contravariant; -->sub_contravariant = super_contravariant : Contravariant -->sub_contravariant : Contravariant -->super_contravariant : Contravariant -+>sub_contravariant = super_contravariant : { f: (x: any) => void; } -+>sub_contravariant : { f: (x: any) => void; } -+>super_contravariant : { f: (x: any) => void; } - + >super_contravariant = sub_contravariant : Contravariant +@@= skipped -28, +28 lines =@@ /** * @template in out T -@@= skipped -36, +36 lines =@@ - * @type {Invariant} + * @typedef {Object} Invariant ++>Invariant : any ++ + * @property {(x: T) => T} f ++>f : any ++>x : T ++ + */ + + /** +@@= skipped -8, +13 lines =@@ */ let super_invariant = { f: (x) => {} }; -->super_invariant : Invariant + >super_invariant : Invariant ->{ f: (x) => {} } : { f: (x: unknown) => void; } ->f : (x: unknown) => void ->(x) => {} : (x: unknown) => void ->x : unknown -+>super_invariant : { f: (x: any) => void; } +>{ f: (x) => {} } : { f: (x: any) => void; } +>f : (x: any) => void +>(x) => {} : (x: any) => void @@ -104,12 +84,11 @@ * @type {Invariant} */ let sub_invariant = { f: (x) => { return "" } }; -->sub_invariant : Invariant + >sub_invariant : Invariant ->{ f: (x) => { return "" } } : { f: (x: string) => string; } ->f : (x: string) => string ->(x) => { return "" } : (x: string) => string ->x : string -+>sub_invariant : { f: (x: any) => string; } +>{ f: (x) => { return "" } } : { f: (x: any) => string; } +>f : (x: any) => string +>(x) => { return "" } : (x: any) => string @@ -117,28 +96,11 @@ >"" : "" super_invariant = sub_invariant; // Error -->super_invariant = sub_invariant : Invariant -->super_invariant : Invariant -->sub_invariant : Invariant -+>super_invariant = sub_invariant : { f: (x: any) => string; } -+>super_invariant : { f: (x: any) => void; } -+>sub_invariant : { f: (x: any) => string; } - - sub_invariant = super_invariant; // Error -->sub_invariant = super_invariant : Invariant -->sub_invariant : Invariant -->super_invariant : Invariant -+>sub_invariant = super_invariant : { f: (x: any) => void; } -+>sub_invariant : { f: (x: any) => string; } -+>super_invariant : { f: (x: any) => void; } - - /** - * @template in T +@@= skipped -31, +31 lines =@@ * @param {T} x */ function f(x) {} ->f : (x: T) => void -->x : T -+>f : (x: any) => void -+>x : any ++>f : (x: T) => void + >x : T diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff index eec04653f1..430cfcaa34 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff @@ -1,95 +1,78 @@ --- old.jsdocTemplateTagDefault.errors.txt +++ new.jsdocTemplateTagDefault.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -file.js(9,20): error TS2322: Type 'number' is not assignable to type 'string'. -file.js(22,34): error TS1005: '=' expected. -file.js(27,35): error TS1110: Type expected. -file.js(33,14): error TS2706: Required type parameters may not follow optional type parameters. --file.js(38,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. ++file.js(3,15): error TS2304: Cannot find name 'T'. + file.js(38,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. -file.js(53,14): error TS2706: Required type parameters may not follow optional type parameters. --file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. -- -- ++file.js(49,21): error TS2706: Required type parameters may not follow optional type parameters. ++file.js(57,1): error TS2706: Required type parameters may not follow optional type parameters. + file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. + + -==== file.js (7 errors) ==== -- /** -- * @template {string | number} [T=string] - ok: defaults are permitted -- * @typedef {[T]} A -- */ -- -- /** @type {A} */ // ok, default for `T` in `A` is `string` -- const aDefault1 = [""]; -- /** @type {A} */ // error: `number` is not assignable to string` -- const aDefault2 = [0]; ++==== file.js (5 errors) ==== + /** + * @template {string | number} [T=string] - ok: defaults are permitted + * @typedef {[T]} A ++ ~ ++!!! error TS2304: Cannot find name 'T'. + */ + + /** @type {A} */ // ok, default for `T` in `A` is `string` + const aDefault1 = [""]; + /** @type {A} */ // error: `number` is not assignable to string` + const aDefault2 = [0]; - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. -- /** @type {A} */ // ok, `T` is provided for `A` -- const aString = [""]; -- /** @type {A} */ // ok, `T` is provided for `A` -- const aNumber = [0]; -- -- /** -- * @template T -- * @template [U=T] - ok: default can reference earlier type parameter -- * @typedef {[T, U]} B -- */ -- -- /** -- * @template {string | number} [T] - error: default requires an `=type` + /** @type {A} */ // ok, `T` is provided for `A` + const aString = [""]; + /** @type {A} */ // ok, `T` is provided for `A` +@@= skipped -31, +29 lines =@@ + + /** + * @template {string | number} [T] - error: default requires an `=type` - ~ -!!! error TS1005: '=' expected. -- * @typedef {[T]} C -- */ -- -- /** -- * @template {string | number} [T=] - error: default requires a `type` + * @typedef {[T]} C + */ + + /** + * @template {string | number} [T=] - error: default requires a `type` - ~ -!!! error TS1110: Type expected. -- * @typedef {[T]} D -- */ -- -- /** -- * @template {string | number} [T=string] -- * @template U - error: Required type parameters cannot follow optional type parameters + * @typedef {[T]} D + */ + + /** + * @template {string | number} [T=string] + * @template U - error: Required type parameters cannot follow optional type parameters - ~ -!!! error TS2706: Required type parameters may not follow optional type parameters. -- * @typedef {[T, U]} E -- */ -- -- /** -- * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. -- ~ --!!! error TS2744: Type parameter defaults can only reference previously declared type parameters. -- * @template [U=T] -- * @typedef {[T, U]} G -- */ -- -- /** -- * @template T -- * @template [U=T] - ok: default can reference earlier type parameter -- * @param {T} a -- * @param {U} b -- */ -- function f1(a, b) {} -- -- /** -- * @template {string | number} [T=string] -- * @template U - error: Required type parameters cannot follow optional type parameters + * @typedef {[T, U]} E + */ + +@@= skipped -35, +29 lines =@@ + * @param {U} b + */ + function f1(a, b) {} ++ ++!!! error TS2706: Required type parameters may not follow optional type parameters. + + /** + * @template {string | number} [T=string] + * @template U - error: Required type parameters cannot follow optional type parameters - ~ -!!! error TS2706: Required type parameters may not follow optional type parameters. -- * @param {T} a -- * @param {U} b -- */ -- function f2(a, b) {} -- -- /** -- * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. -- ~ --!!! error TS2744: Type parameter defaults can only reference previously declared type parameters. -- * @template [U=T] -- * @param {T} a -- * @param {U} b -- */ -- function f3(a, b) {} -- -@@= skipped --1, +1 lines =@@ -+ + * @param {T} a + * @param {U} b + */ + function f2(a, b) {} ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2706: Required type parameters may not follow optional type parameters. + + /** + * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.types.diff index 18cbb392d4..de45178dc0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.types.diff @@ -1,74 +1,104 @@ --- old.jsdocTemplateTagDefault.types +++ new.jsdocTemplateTagDefault.types -@@= skipped -7, +7 lines =@@ +@@= skipped -3, +3 lines =@@ + /** + * @template {string | number} [T=string] - ok: defaults are permitted + * @typedef {[T]} A ++>A : any ++ + */ /** @type {A} */ // ok, default for `T` in `A` is `string` const aDefault1 = [""]; ->aDefault1 : A -->[""] : [string] -+>aDefault1 : string[] -+>[""] : string[] ++>aDefault1 : [T] + >[""] : [string] >"" : "" /** @type {A} */ // error: `number` is not assignable to string` const aDefault2 = [0]; ->aDefault2 : A -->[0] : [number] -+>aDefault2 : number[] -+>[0] : number[] ++>aDefault2 : [T] + >[0] : [number] >0 : 0 /** @type {A} */ // ok, `T` is provided for `A` const aString = [""]; ->aString : A -->[""] : [string] -+>aString : string[] -+>[""] : string[] ++>aString : [T] + >[""] : [string] >"" : "" /** @type {A} */ // ok, `T` is provided for `A` const aNumber = [0]; ->aNumber : A -->[0] : [number] -+>aNumber : number[] -+>[0] : number[] ++>aNumber : [T] + >[0] : [number] >0 : 0 +@@= skipped -30, +32 lines =@@ + * @template T + * @template [U=T] - ok: default can reference earlier type parameter + * @typedef {[T, U]} B ++>B : B ++ + */ + /** -@@= skipped -57, +57 lines =@@ + * @template {string | number} [T] - error: default requires an `=type` + * @typedef {[T]} C ++>C : C ++ + */ + + /** + * @template {string | number} [T=] - error: default requires a `type` + * @typedef {[T]} D ++>D : D ++ + */ + + /** + * @template {string | number} [T=string] + * @template U - error: Required type parameters cannot follow optional type parameters + * @typedef {[T, U]} E ++>E : E ++ + */ + + /** + * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. + * @template [U=T] + * @typedef {[T, U]} G ++>G : G ++ + */ + + /** +@@= skipped -31, +41 lines =@@ * @param {U} b */ function f1(a, b) {} ->f1 : (a: T, b: U) => void -->a : T -->b : U -+>f1 : (a: any, b: any) => void -+>a : any -+>b : any ++>f1 : (a: T, b: U) => void + >a : T + >b : U - /** - * @template {string | number} [T=string] @@= skipped -11, +11 lines =@@ * @param {U} b */ function f2(a, b) {} ->f2 : (a: T, b: U) => void -->a : T -->b : U -+>f2 : (a: any, b: any) => void -+>a : any -+>b : any ++>f2 : (a: T, b: U) => void + >a : T + >b : U - /** - * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. @@= skipped -11, +11 lines =@@ * @param {U} b */ function f3(a, b) {} ->f3 : (a: T, b: U) => void -->a : T -->b : U -+>f3 : (a: any, b: any) => void -+>a : any -+>b : any ++>f3 : (a: T, b: U) => void + >a : T + >b : U diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.errors.txt.diff index 5d4aec8581..1f58ae47d9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.errors.txt.diff @@ -1,21 +1,29 @@ --- old.jsdocTemplateTagNameResolution.errors.txt +++ new.jsdocTemplateTagNameResolution.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -file.js(10,7): error TS2322: Type 'string' is not assignable to type 'number'. -- -- ++file.js(3,21): error TS2304: Cannot find name 'T'. ++file.js(4,14): error TS2304: Cannot find name 'T'. ++file.js(4,16): error TS2304: Cannot find name 'K'. + + -==== file.js (1 errors) ==== -- /** -- * @template T -- * @template {keyof T} K -- * @typedef {T[K]} Foo -- */ -- -- const x = { a: 1 }; -- -- /** @type {Foo} */ -- const y = "a"; ++==== file.js (3 errors) ==== + /** + * @template T + * @template {keyof T} K ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @typedef {T[K]} Foo ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'K'. + */ + + const x = { a: 1 }; + + /** @type {Foo} */ + const y = "a"; - ~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.types.diff index 146d98e60d..dd5017d6cc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.types.diff @@ -1,10 +1,19 @@ --- old.jsdocTemplateTagNameResolution.types +++ new.jsdocTemplateTagNameResolution.types -@@= skipped -14, +14 lines =@@ +@@= skipped -4, +4 lines =@@ + * @template T + * @template {keyof T} K + * @typedef {T[K]} Foo ++>Foo : any ++ + */ + + const x = { a: 1 }; +@@= skipped -10, +12 lines =@@ /** @type {Foo} */ const y = "a"; ->y : number -+>y : "a" ++>y : T >"a" : "a" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.errors.txt.diff index 953254940d..2531a30be7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.errors.txt.diff @@ -1,63 +1,56 @@ --- old.jsdocThisType.errors.txt +++ new.jsdocThisType.errors.txt -@@= skipped -0, +-1 lines =@@ --/a.js(3,10): error TS2339: Property 'test' does not exist on type 'Foo'. +@@= skipped -0, +0 lines =@@ + /a.js(3,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(8,10): error TS2339: Property 'test' does not exist on type 'Foo'. --/a.js(13,10): error TS2339: Property 'test' does not exist on type 'Foo'. + /a.js(13,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(18,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(23,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(28,10): error TS2339: Property 'test' does not exist on type 'Foo'. -- -- --==== /types.d.ts (0 errors) ==== -- export interface Foo { -- foo: () => void; -- } -- -- export type M = (this: Foo) => void; -- ++/a.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? + + + ==== /types.d.ts (0 errors) ==== +@@= skipped -12, +9 lines =@@ + + export type M = (this: Foo) => void; + -==== /a.js (6 errors) ==== -- /** @type {import('./types').M} */ -- export const f1 = function() { -- this.test(); ++==== /a.js (3 errors) ==== + /** @type {import('./types').M} */ + export const f1 = function() { + this.test(); +@@= skipped -11, +11 lines =@@ + /** @type {import('./types').M} */ + export function f2() { + this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. -- } -- -- /** @type {import('./types').M} */ -- export function f2() { -- this.test(); + } + + /** @type {(this: import('./types').Foo) => void} */ +@@= skipped -14, +12 lines =@@ + /** @type {(this: import('./types').Foo) => void} */ + export function f4() { + this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. -- } -- -- /** @type {(this: import('./types').Foo) => void} */ -- export const f3 = function() { -- this.test(); + } + + /** @type {function(this: import('./types').Foo): void} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + export const f5 = function() { + this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. -- } -- -- /** @type {(this: import('./types').Foo) => void} */ -- export function f4() { -- this.test(); + } + + /** @type {function(this: import('./types').Foo): void} */ + export function f6() { + this.test(); - ~~~~ -!!! error TS2339: Property 'test' does not exist on type 'Foo'. -- } -- -- /** @type {function(this: import('./types').Foo): void} */ -- export const f5 = function() { -- this.test(); -- ~~~~ --!!! error TS2339: Property 'test' does not exist on type 'Foo'. -- } -- -- /** @type {function(this: import('./types').Foo): void} */ -- export function f6() { -- this.test(); -- ~~~~ --!!! error TS2339: Property 'test' does not exist on type 'Foo'. -- } -- -@@= skipped --1, +1 lines =@@ -+ + } + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.types.diff index eaec68714a..cb266d6e80 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.types.diff @@ -6,14 +6,14 @@ export const f1 = function() { ->f1 : import("/types").M ->function() { this.test();} : (this: import("/types").Foo) => void -+>f1 : () => void ++>f1 : M +>function() { this.test();} : () => void this.test(); >this.test() : any >this.test : any ->this : import("/types").Foo -+>this : any ++>this : Foo >test : any } @@ -41,7 +41,7 @@ >this.test() : any >this.test : any ->this : import("/types").Foo -+>this : any ++>this : Foo >test : any } @@ -62,7 +62,7 @@ export const f5 = function() { ->f5 : (this: import("./types").Foo) => void ->function() { this.test();} : (this: import("./types").Foo) => void -+>f5 : () => void ++>f5 : function +>function() { this.test();} : () => void this.test(); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeDefAtStartOfFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeDefAtStartOfFile.errors.txt.diff new file mode 100644 index 0000000000..e03e9d76e5 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeDefAtStartOfFile.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.jsdocTypeDefAtStartOfFile.errors.txt ++++ new.jsdocTypeDefAtStartOfFile.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++index.js(1,12): error TS2304: Cannot find name 'AnyEffect'. ++index.js(3,12): error TS2304: Cannot find name 'Third'. ++ ++ ++==== dtsEquivalent.js (0 errors) ==== ++ /** @typedef {{[k: string]: any}} AnyEffect */ ++ /** @typedef {number} Third */ ++==== index.js (2 errors) ==== ++ /** @type {AnyEffect} */ ++ ~~~~~~~~~ ++!!! error TS2304: Cannot find name 'AnyEffect'. ++ let b; ++ /** @type {Third} */ ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Third'. ++ let c; ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeDefAtStartOfFile.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeDefAtStartOfFile.types.diff index 02b68d0480..8b037dfbeb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeDefAtStartOfFile.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeDefAtStartOfFile.types.diff @@ -1,14 +1,9 @@ --- old.jsdocTypeDefAtStartOfFile.types +++ new.jsdocTypeDefAtStartOfFile.types -@@= skipped -6, +6 lines =@@ - === index.js === - /** @type {AnyEffect} */ - let b; -->b : AnyEffect -+>b : any +@@= skipped -10, +10 lines =@@ /** @type {Third} */ let c; ->c : number -+>c : any ++>c : Third diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceExports.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceExports.errors.txt.diff index b63d4bf21d..262c292351 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceExports.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceExports.errors.txt.diff @@ -4,14 +4,17 @@ - @@= skipped --1, +1 lines =@@ +bug27342.js(1,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++bug27342.js(3,11): error TS2304: Cannot find name 'exports'. + + -+==== bug27342.js (1 errors) ==== ++==== bug27342.js (2 errors) ==== + module.exports = {} + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** + * @type {exports} ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + */ + var x + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceExports.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceExports.types.diff index af427dd532..350242544a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceExports.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceExports.types.diff @@ -19,6 +19,6 @@ */ var x ->x : typeof import("bug27342") -+>x : any ++>x : exports diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImport.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImport.errors.txt.diff index 63e4a4f2bd..6e5a04bd5a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImport.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImport.errors.txt.diff @@ -5,9 +5,11 @@ @@= skipped --1, +1 lines =@@ +jsdocTypeReferenceToImport.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +jsdocTypeReferenceToImport.js(2,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++jsdocTypeReferenceToImport.js(3,12): error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? ++jsdocTypeReferenceToImport.js(8,12): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + + -+==== jsdocTypeReferenceToImport.js (2 errors) ==== ++==== jsdocTypeReferenceToImport.js (4 errors) ==== + const C = require('./ex').C; + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -15,11 +17,15 @@ + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @type {C} c */ ++ ~ ++!!! error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? + var c = new C() + c.start + c.end + + /** @type {D} c */ ++ ~ ++!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + var d = new D() + d.start + d.end diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImport.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImport.types.diff index 9af52988dc..48a451cab5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImport.types.diff @@ -29,27 +29,24 @@ /** @type {C} c */ var c = new C() -->c : C + >c : C ->new C() : C ->C : typeof C -+>c : any +>new C() : any +>C : any c.start ->c.start : number -->c : C -->start : number +>c.start : any -+>c : any + >c : C +->start : number +>start : any c.end ->c.end : number -->c : C -->end : number +>c.end : any -+>c : any + >c : C +->end : number +>end : any /** @type {D} c */ @@ -57,7 +54,7 @@ ->d : C ->new D() : C ->D : typeof C -+>d : any ++>d : D +>new D() : any +>D : any @@ -66,7 +63,7 @@ ->d : C ->start : number +>d.start : any -+>d : any ++>d : D +>start : any d.end @@ -74,7 +71,7 @@ ->d : C ->end : number +>d.end : any -+>d : any ++>d : D +>end : any === ex.d.ts === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff index bb54742cd7..a1edfeb0e3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff @@ -12,6 +12,7 @@ >"./MW" : "./MW" /** @typedef {number} Cictema */ ++>Cictema : any module.exports = class MC { ->module.exports = class MC { watch() { return new MW(this); }} : typeof import("MC") diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff index ccb01c3175..1c3bdfd70d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff @@ -11,7 +11,8 @@ >require : any >"./MW" : "./MW" -@@= skipped -9, +9 lines =@@ + /** @typedef {number} Meyerhauser */ ++>Meyerhauser : any /** @class */ module.exports = function MC() { @@ -30,17 +31,15 @@ /** @type {any} */ var x = {} -->x : any -+>x : {} +@@= skipped -22, +23 lines =@@ >{} : {} return new MW(x); ->new MW(x) : MW ->MW : typeof MW -->x : any +>new MW(x) : any +>MW : any -+>x : {} + >x : any }; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToMergedClass.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToMergedClass.errors.txt.diff index 1f84bbb30a..4f06122ae6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToMergedClass.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToMergedClass.errors.txt.diff @@ -3,13 +3,16 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++jsdocTypeReferenceToMergedClass.js(2,12): error TS2503: Cannot find namespace 'Workspace'. +jsdocTypeReferenceToMergedClass.js(6,11): error TS2339: Property 'Project' does not exist on type '{}'. +jsdocTypeReferenceToMergedClass.js(7,11): error TS2339: Property 'Project' does not exist on type '{}'. + + -+==== jsdocTypeReferenceToMergedClass.js (2 errors) ==== ++==== jsdocTypeReferenceToMergedClass.js (3 errors) ==== + var Workspace = {} + /** @type {Workspace.Project} */ ++ ~~~~~~~~~ ++!!! error TS2503: Cannot find namespace 'Workspace'. + var p; + p.isServiceProject() + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToMergedClass.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToMergedClass.types.diff index 6ea824b364..e2ad380e81 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToMergedClass.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToMergedClass.types.diff @@ -11,7 +11,7 @@ /** @type {Workspace.Project} */ var p; ->p : wp -+>p : any ++>p : Project p.isServiceProject() ->p.isServiceProject() : void @@ -20,7 +20,7 @@ ->isServiceProject : () => void +>p.isServiceProject() : any +>p.isServiceProject : any -+>p : any ++>p : Project +>isServiceProject : any Workspace.Project = function wp() { } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToValue.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToValue.errors.txt.diff new file mode 100644 index 0000000000..9ea73f0fd7 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToValue.errors.txt.diff @@ -0,0 +1,16 @@ +--- old.jsdocTypeReferenceToValue.errors.txt ++++ new.jsdocTypeReferenceToValue.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++foo.js(1,13): error TS2749: 'Image' refers to a value, but is being used as a type here. Did you mean 'typeof Image'? ++ ++ ++==== foo.js (1 errors) ==== ++ /** @param {Image} image */ ++ ~~~~~ ++!!! error TS2749: 'Image' refers to a value, but is being used as a type here. Did you mean 'typeof Image'? ++ function process(image) { ++ return new image(1, 1) ++ } ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToValue.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToValue.types.diff index 6b6cb40c9e..bf3b90b2d7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToValue.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToValue.types.diff @@ -6,14 +6,14 @@ function process(image) { ->process : (image: new (width?: number, height?: number) => HTMLImageElement) => HTMLImageElement ->image : new (width?: number, height?: number) => HTMLImageElement -+>process : (image: any) => any -+>image : any ++>process : (image: Image) => any ++>image : Image return new image(1, 1) ->new image(1, 1) : HTMLImageElement ->image : new (width?: number, height?: number) => HTMLImageElement +>new image(1, 1) : any -+>image : any ++>image : Image >1 : 1 >1 : 1 } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceUseBeforeDef.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceUseBeforeDef.types.diff deleted file mode 100644 index 2dabe2cf53..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceUseBeforeDef.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsdocTypeReferenceUseBeforeDef.types -+++ new.jsdocTypeReferenceUseBeforeDef.types -@@= skipped -2, +2 lines =@@ - === bug25097.js === - /** @type {C | null} */ - const c = null -->c : C -+>c : any - - class C { - >C : C diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.errors.txt.diff index 3b52250c34..0a8f07906a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.errors.txt.diff @@ -3,29 +3,20 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+b.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'any', but here has type 'string'. -+b.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 's' must be of type 'any', but here has type 'string'. -+b.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'any', but here has type 'number'. -+b.ts(4,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'any', but here has type 'number'. -+b.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'any', but here has type 'boolean'. -+b.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'any', but here has type 'boolean'. -+b.ts(7,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'V' must be of type 'any', but here has type 'void'. -+b.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type 'any', but here has type 'void'. -+b.ts(9,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'U' must be of type 'any', but here has type 'undefined'. -+b.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'u' must be of type 'any', but here has type 'undefined'. -+b.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Nl' must be of type 'any', but here has type 'null'. -+b.ts(12,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'nl' must be of type 'any', but here has type 'null'. -+b.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'A' must be of type 'any', but here has type 'any[]'. -+b.ts(14,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'any[]'. -+b.ts(15,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'P' must be of type 'any', but here has type 'Promise'. -+b.ts(16,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'any', but here has type 'Promise'. -+b.ts(17,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'nullable' must be of type 'any', but here has type 'number | null'. -+b.ts(20,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Func' must be of type 'any', but here has type 'Function'. -+b.ts(21,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type 'any', but here has type '(s: string) => number'. -+b.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'ctor' must be of type 'any', but here has type 'new (s: string) => { s: string; }'. ++a.js(19,12): error TS2304: Cannot find name 'Void'. ++a.js(25,12): error TS2304: Cannot find name 'Undefined'. ++a.js(31,12): error TS2304: Cannot find name 'Null'. ++a.js(37,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). ++a.js(40,12): error TS2552: Cannot find name 'array'. Did you mean 'Array'? ++a.js(43,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). ++a.js(46,12): error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? ++b.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. ++b.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. ++b.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. ++b.ts(18,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. + + -+==== a.js (0 errors) ==== ++==== a.js (7 errors) ==== + /** @type {String} */ + var S; + @@ -45,33 +36,48 @@ + var b; + + /** @type {Void} */ ++ ~~~~ ++!!! error TS2304: Cannot find name 'Void'. + var V; + + /** @type {void} */ + var v; + + /** @type {Undefined} */ ++ ~~~~~~~~~ ++!!! error TS2304: Cannot find name 'Undefined'. + var U; + + /** @type {undefined} */ + var u; + + /** @type {Null} */ ++ ~~~~ ++!!! error TS2304: Cannot find name 'Null'. + var Nl; + + /** @type {null} */ + var nl; + + /** @type {Array} */ ++ ~~~~~ ++!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + var A; + + /** @type {array} */ ++ ~~~~~ ++!!! error TS2552: Cannot find name 'array'. Did you mean 'Array'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Array' is declared here. + var a; + + /** @type {Promise} */ ++ ~~~~~~~ ++!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + var P; + + /** @type {promise} */ ++ ~~~~~~~ ++!!! error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? + var p; + + /** @type {?number} */ @@ -92,87 +98,39 @@ + /** @type {new (s: string) => { s: string }} */ + var ctor; + -+==== b.ts (20 errors) ==== ++==== b.ts (4 errors) ==== + var S: string; + ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'any', but here has type 'string'. ++!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. +!!! related TS6203 a.js:2:5: 'S' was also declared here. + var s: string; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 's' must be of type 'any', but here has type 'string'. -+!!! related TS6203 a.js:5:5: 's' was also declared here. + var N: number; + ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'any', but here has type 'number'. ++!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. +!!! related TS6203 a.js:8:5: 'N' was also declared here. + var n: number -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'any', but here has type 'number'. -+!!! related TS6203 a.js:11:5: 'n' was also declared here. + var B: boolean; + ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'any', but here has type 'boolean'. ++!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. +!!! related TS6203 a.js:14:5: 'B' was also declared here. + var b: boolean; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'any', but here has type 'boolean'. -+!!! related TS6203 a.js:17:5: 'b' was also declared here. + var V :void; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'V' must be of type 'any', but here has type 'void'. -+!!! related TS6203 a.js:20:5: 'V' was also declared here. + var v: void; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type 'any', but here has type 'void'. -+!!! related TS6203 a.js:23:5: 'v' was also declared here. + var U: undefined; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'U' must be of type 'any', but here has type 'undefined'. -+!!! related TS6203 a.js:26:5: 'U' was also declared here. + var u: undefined; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'u' must be of type 'any', but here has type 'undefined'. -+!!! related TS6203 a.js:29:5: 'u' was also declared here. + var Nl: null; -+ ~~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Nl' must be of type 'any', but here has type 'null'. -+!!! related TS6203 a.js:32:5: 'Nl' was also declared here. + var nl: null; -+ ~~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'nl' must be of type 'any', but here has type 'null'. -+!!! related TS6203 a.js:35:5: 'nl' was also declared here. + var A: any[]; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'A' must be of type 'any', but here has type 'any[]'. -+!!! related TS6203 a.js:38:5: 'A' was also declared here. + var a: any[]; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'any[]'. -+!!! related TS6203 a.js:41:5: 'a' was also declared here. + var P: Promise; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'P' must be of type 'any', but here has type 'Promise'. -+!!! related TS6203 a.js:44:5: 'P' was also declared here. + var p: Promise; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'any', but here has type 'Promise'. -+!!! related TS6203 a.js:47:5: 'p' was also declared here. + var nullable: number | null; -+ ~~~~~~~~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'nullable' must be of type 'any', but here has type 'number | null'. -+!!! related TS6203 a.js:50:5: 'nullable' was also declared here. + var Obj: any; ++ ~~~ ++!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. ++!!! related TS6203 a.js:53:5: 'Obj' was also declared here. + var obj: any; + var Func: Function; -+ ~~~~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Func' must be of type 'any', but here has type 'Function'. -+!!! related TS6203 a.js:59:5: 'Func' was also declared here. + var f: (s: string) => number; -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type 'any', but here has type '(s: string) => number'. -+!!! related TS6203 a.js:62:5: 'f' was also declared here. + var ctor: new (s: string) => { s: string }; -+ ~~~~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'ctor' must be of type 'any', but here has type 'new (s: string) => { s: string; }'. -+!!! related TS6203 a.js:65:5: 'ctor' was also declared here. + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.types.diff index d1863ee13d..4a8a35d9d3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.types.diff @@ -5,62 +5,56 @@ /** @type {String} */ var S; ->S : string -+>S : any ++>S : String /** @type {string} */ var s; -->s : string -+>s : any +@@= skipped -8, +8 lines =@@ /** @type {Number} */ var N; ->N : number -+>N : any ++>N : Number /** @type {number} */ var n; -->n : number -+>n : any +@@= skipped -8, +8 lines =@@ /** @type {Boolean} */ var B; ->B : boolean -+>B : any ++>B : Boolean /** @type {boolean} */ var b; -->b : boolean -+>b : any +@@= skipped -8, +8 lines =@@ /** @type {Void} */ var V; ->V : void -+>V : any ++>V : Void /** @type {void} */ var v; -->v : void -+>v : any +@@= skipped -8, +8 lines =@@ /** @type {Undefined} */ var U; ->U : undefined -+>U : any ++>U : Undefined /** @type {undefined} */ var u; -->u : undefined -+>u : any +@@= skipped -8, +8 lines =@@ /** @type {Null} */ var Nl; ->Nl : null -+>Nl : any ++>Nl : Null /** @type {null} */ var nl; -->nl : null -+>nl : any +@@= skipped -8, +8 lines =@@ /** @type {Array} */ var A; @@ -70,7 +64,7 @@ /** @type {array} */ var a; ->a : any[] -+>a : any ++>a : array /** @type {Promise} */ var P; @@ -80,80 +74,63 @@ /** @type {promise} */ var p; ->p : Promise -+>p : any ++>p : promise /** @type {?number} */ var nullable; -->nullable : number | null -+>nullable : any +@@= skipped -20, +20 lines =@@ /** @type {Object} */ var Obj; -@@= skipped -76, +76 lines =@@ +->Obj : any ++>Obj : Object - /** @type {Function} */ - var Func; -->Func : Function -+>Func : any - - /** @type {(s: string) => number} */ - var f; -->f : (s: string) => number -+>f : any - - /** @type {new (s: string) => { s: string }} */ - var ctor; -->ctor : new (s: string) => { s: string; } -+>ctor : any + /** @type {object} */ + var obj; +@@= skipped -20, +20 lines =@@ === b.ts === var S: string; ->S : string -+>S : any ++>S : String var s: string; -->s : string -+>s : any + >s : string var N: number; ->N : number -+>N : any ++>N : Number var n: number -->n : number -+>n : any + >n : number var B: boolean; ->B : boolean -+>B : any ++>B : Boolean var b: boolean; -->b : boolean -+>b : any + >b : boolean var V :void; ->V : void -+>V : any ++>V : Void var v: void; -->v : void -+>v : any + >v : void var U: undefined; ->U : undefined -+>U : any ++>U : Undefined var u: undefined; -->u : undefined -+>u : any + >u : undefined var Nl: null; ->Nl : null -+>Nl : any ++>Nl : Null var nl: null; -->nl : null -+>nl : any + >nl : null var A: any[]; ->A : any[] @@ -161,7 +138,7 @@ var a: any[]; ->a : any[] -+>a : any ++>a : array var P: Promise; ->P : Promise @@ -169,29 +146,14 @@ var p: Promise; ->p : Promise -+>p : any ++>p : promise var nullable: number | null; -->nullable : number | null -+>nullable : any + >nullable : number | null var Obj: any; - >Obj : any -@@= skipped -69, +69 lines =@@ - >obj : any - - var Func: Function; -->Func : Function -+>Func : any - - var f: (s: string) => number; -->f : (s: string) => number -+>f : any - >s : string - - var ctor: new (s: string) => { s: string }; -->ctor : new (s: string) => { s: string; } -+>ctor : any - >s : string - >s : string +->Obj : any ++>Obj : Object + var obj: any; + >obj : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagCast.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagCast.errors.txt.diff index c4f2e49124..5fe5450461 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagCast.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagCast.errors.txt.diff @@ -14,39 +14,29 @@ - Types of property 'p' are incompatible. - Type 'string | number' is not assignable to type 'number'. - Type 'string' is not assignable to type 'number'. --b.js(66,15): error TS1228: A type predicate is only allowed in return type position for functions and methods. --b.js(66,38): error TS2454: Variable 'numOrStr' is used before being assigned. --b.js(67,2): error TS2322: Type 'string | number' is not assignable to type 'string'. -- Type 'number' is not assignable to type 'string'. --b.js(67,8): error TS2454: Variable 'numOrStr' is used before being assigned. -+b.js(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. -+b.js(4,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. ++b.js(4,31): error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. +b.js(17,14): error TS2339: Property 'p' does not exist on type 'SomeBase'. +b.js(23,14): error TS2339: Property 'x' does not exist on type 'SomeDerived'. +b.js(28,14): error TS2339: Property 'q' does not exist on type 'SomeOther'. - - + b.js(66,15): error TS1228: A type predicate is only allowed in return type position for functions and methods. + b.js(66,38): error TS2454: Variable 'numOrStr' is used before being assigned. + b.js(67,2): error TS2322: Type 'string | number' is not assignable to type 'string'. +@@= skipped -20, +11 lines =@@ ==== a.ts (0 errors) ==== var W: string; -==== b.js (10 errors) ==== -+==== b.js (5 errors) ==== ++==== b.js (8 errors) ==== // @ts-check var W = /** @type {string} */(/** @type {*} */ (4)); -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. -+!!! related TS6203 a.ts:1:5: 'W' was also declared here. var W = /** @type {string} */(4); // Error - ~~~~~~ --!!! error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. -+ ~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'W' must be of type 'string', but here has type 'number'. -+!!! related TS6203 a.ts:1:5: 'W' was also declared here. ++ ~ + !!! error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. /** @type {*} */ - var a; -@@= skipped -40, +31 lines =@@ +@@= skipped -20, +20 lines =@@ class SomeBase { constructor() { this.p = 42; @@ -110,20 +100,3 @@ someBase = /** @type {SomeBase} */(someFakeClass); // Type assertion cannot be a type-predicate type -@@= skipped -41, +21 lines =@@ - /** @type {string} */ - var str; - if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error -- ~~~~~~~~~~~~~~~~~~ --!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. -- ~~~~~~~~ --!!! error TS2454: Variable 'numOrStr' is used before being assigned. - str = numOrStr; // Error, no narrowing occurred -- ~~~ --!!! error TS2322: Type 'string | number' is not assignable to type 'string'. --!!! error TS2322: Type 'number' is not assignable to type 'string'. -- ~~~~~~~~ --!!! error TS2454: Variable 'numOrStr' is used before being assigned. - } - - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagCast.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagCast.types.diff index 7d19fc5da4..7f91b86ec1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagCast.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagCast.types.diff @@ -1,48 +1,38 @@ --- old.jsdocTypeTagCast.types +++ new.jsdocTypeTagCast.types -@@= skipped -7, +7 lines =@@ - // @ts-check +@@= skipped -8, +8 lines =@@ var W = /** @type {string} */(/** @type {*} */ (4)); >W : string -->(/** @type {*} */ (4)) : string -->(4) : any -+>(/** @type {*} */ (4)) : 4 -+>(4) : 4 + >(/** @type {*} */ (4)) : string ++>(4) : string + >(4) : any ++>4 : any >4 : 4 var W = /** @type {string} */(4); // Error >W : string -->(4) : string -+>(4) : 4 + >(4) : string ++>4 : string >4 : 4 /** @type {*} */ -@@= skipped -15, +15 lines =@@ - - /** @type {string} */ - var s; -->s : string -+>s : any - +@@= skipped -19, +22 lines =@@ var a = /** @type {*} */("" + 4); >a : any -->("" + 4) : any -+>("" + 4) : string + >("" + 4) : any ++>"" + 4 : any >"" + 4 : string >"" : "" >4 : 4 - - var s = "" + /** @type {*} */(4); -->s : string -+>s : any +@@= skipped -9, +10 lines =@@ >"" + /** @type {*} */(4) : string >"" : "" -->(4) : any -+>(4) : 4 + >(4) : any ++>4 : any >4 : 4 class SomeBase { -@@= skipped -59, +59 lines =@@ +@@= skipped -45, +46 lines =@@ } function SomeFakeClass() { @@ -73,63 +63,67 @@ +>SomeFakeClass : () => void someBase = /** @type {SomeBase} */(someDerived); -->someBase = /** @type {SomeBase} */(someDerived) : SomeBase -+>someBase = /** @type {SomeBase} */(someDerived) : SomeDerived + >someBase = /** @type {SomeBase} */(someDerived) : SomeBase >someBase : SomeBase -->(someDerived) : SomeBase -+>(someDerived) : SomeDerived + >(someDerived) : SomeBase ++>someDerived : SomeBase >someDerived : SomeDerived someBase = /** @type {SomeBase} */(someBase); -@@= skipped -17, +17 lines =@@ +@@= skipped -15, +16 lines =@@ + >someBase : SomeBase + >(someBase) : SomeBase >someBase : SomeBase ++>someBase : SomeBase someBase = /** @type {SomeBase} */(someOther); // Error -->someBase = /** @type {SomeBase} */(someOther) : SomeBase -+>someBase = /** @type {SomeBase} */(someOther) : SomeOther + >someBase = /** @type {SomeBase} */(someOther) : SomeBase >someBase : SomeBase -->(someOther) : SomeBase -+>(someOther) : SomeOther + >(someOther) : SomeBase ++>someOther : SomeBase >someOther : SomeOther someDerived = /** @type {SomeDerived} */(someDerived); -@@= skipped -12, +12 lines =@@ +@@= skipped -12, +14 lines =@@ >someDerived : SomeDerived + >(someDerived) : SomeDerived + >someDerived : SomeDerived ++>someDerived : SomeDerived someDerived = /** @type {SomeDerived} */(someBase); -->someDerived = /** @type {SomeDerived} */(someBase) : SomeDerived -+>someDerived = /** @type {SomeDerived} */(someBase) : SomeBase + >someDerived = /** @type {SomeDerived} */(someBase) : SomeDerived >someDerived : SomeDerived -->(someBase) : SomeDerived -+>(someBase) : SomeBase + >(someBase) : SomeDerived ++>someBase : SomeDerived >someBase : SomeBase someDerived = /** @type {SomeDerived} */(someOther); // Error -->someDerived = /** @type {SomeDerived} */(someOther) : SomeDerived -+>someDerived = /** @type {SomeDerived} */(someOther) : SomeOther + >someDerived = /** @type {SomeDerived} */(someOther) : SomeDerived >someDerived : SomeDerived -->(someOther) : SomeDerived -+>(someOther) : SomeOther + >(someOther) : SomeDerived ++>someOther : SomeDerived >someOther : SomeOther someOther = /** @type {SomeOther} */(someDerived); // Error -->someOther = /** @type {SomeOther} */(someDerived) : SomeOther -+>someOther = /** @type {SomeOther} */(someDerived) : SomeDerived + >someOther = /** @type {SomeOther} */(someDerived) : SomeOther >someOther : SomeOther -->(someDerived) : SomeOther -+>(someDerived) : SomeDerived + >(someDerived) : SomeOther ++>someDerived : SomeOther >someDerived : SomeDerived someOther = /** @type {SomeOther} */(someBase); // Error -->someOther = /** @type {SomeOther} */(someBase) : SomeOther -+>someOther = /** @type {SomeOther} */(someBase) : SomeBase + >someOther = /** @type {SomeOther} */(someBase) : SomeOther >someOther : SomeOther -->(someBase) : SomeOther -+>(someBase) : SomeBase + >(someBase) : SomeOther ++>someBase : SomeOther >someBase : SomeBase someOther = /** @type {SomeOther} */(someOther); -@@= skipped -31, +31 lines =@@ +@@= skipped -30, +35 lines =@@ + >someOther : SomeOther + >(someOther) : SomeOther + >someOther : SomeOther ++>someOther : SomeOther someFakeClass = someBase; >someFakeClass = someBase : SomeBase @@ -151,59 +145,34 @@ +>someFakeClass : any someBase = /** @type {SomeBase} */(someFakeClass); -->someBase = /** @type {SomeBase} */(someFakeClass) : SomeBase -+>someBase = /** @type {SomeBase} */(someFakeClass) : any + >someBase = /** @type {SomeBase} */(someFakeClass) : SomeBase >someBase : SomeBase -->(someFakeClass) : SomeBase + >(someFakeClass) : SomeBase ->someFakeClass : SomeFakeClass -+>(someFakeClass) : any ++>someFakeClass : SomeBase +>someFakeClass : any // Type assertion cannot be a type-predicate type /** @type {number | string} */ - var numOrStr; -->numOrStr : string | number -+>numOrStr : any - - /** @type {string} */ - var str; -->str : string -+>str : any - +@@= skipped -34, +36 lines =@@ if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error >(numOrStr === undefined) : boolean >numOrStr === undefined : boolean -->numOrStr : string | number -+>numOrStr : any ++>numOrStr === undefined : boolean + >numOrStr : string | number >undefined : undefined - str = numOrStr; // Error, no narrowing occurred -->str = numOrStr : string | number -->str : string -->numOrStr : string | number -+>str = numOrStr : any -+>str : any -+>numOrStr : any - } - - - var asConst1 = /** @type {const} */(1); -->asConst1 : 1 -+>asConst1 : number +@@= skipped -14, +15 lines =@@ + >asConst1 : 1 >(1) : 1 >1 : 1 ++>1 : 1 var asConst2 = /** @type {const} */({ -->asConst2 : { readonly x: 1; } -->({ x: 1}) : { readonly x: 1; } -->{ x: 1} : { readonly x: 1; } -+>asConst2 : { x: number; } -+>({ x: 1}) : { x: number; } -+>{ x: 1} : { x: number; } + >asConst2 : { readonly x: 1; } + >({ x: 1}) : { readonly x: 1; } + >{ x: 1} : { readonly x: 1; } ++>{ x: 1} : { readonly x: 1; } x: 1 -->x : 1 -+>x : number - >1 : 1 - - }); + >x : 1 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.errors.txt.diff index efbaae8b0e..186716f23c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.errors.txt.diff @@ -3,12 +3,17 @@ @@= skipped -0, +0 lines =@@ -a.js(3,5): error TS2322: Type 'number' is not assignable to type 'string'. -a.js(7,5): error TS2322: Type 'number' is not assignable to type 'string'. ++a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. +a.js(6,12): error TS7006: Parameter 's' implicitly has an 'any' type. - ==== a.js (2 errors) ==== +-==== a.js (2 errors) ==== ++==== a.js (3 errors) ==== /** @type {function(string): void} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const f = (value) => { + ~~~~~ +!!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.types.diff index a682d47f42..53101cd728 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.types.diff @@ -7,7 +7,7 @@ ->f : (arg0: string) => void ->(value) => { value = 1 // should error} : (value: string) => void ->value : string -+>f : (value: any) => void ++>f : function +>(value) => { value = 1 // should error} : (value: any) => void +>value : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff index 7c75708ad3..f075ff78a8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff @@ -2,6 +2,7 @@ +++ new.jsdocTypeTagRequiredParameters.errors.txt @@= skipped -0, +0 lines =@@ -a.js(11,1): error TS2554: Expected 1 arguments, but got 0. ++a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. +a.js(5,12): error TS7006: Parameter 's' implicitly has an 'any' type. +a.js(8,12): error TS7006: Parameter 's' implicitly has an 'any' type. @@ -10,8 +11,11 @@ -==== a.js (3 errors) ==== -+==== a.js (5 errors) ==== ++==== a.js (6 errors) ==== /** @type {function(string): void} */ ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. const f = (value) => { + ~~~~~ +!!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.types.diff index d2585e8d6c..a3180ab39c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.types.diff @@ -7,7 +7,7 @@ ->f : (arg0: string) => void ->(value) => {} : (value: string) => void ->value : string -+>f : (value: any) => void ++>f : function +>(value) => {} : (value: any) => void +>value : any @@ -28,9 +28,10 @@ } f() // should error - >f() : void +->f() : void ->f : (arg0: string) => void -+>f : (value: any) => void ++>f() : any ++>f : function g() // should error >g() : void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariableDeclarationWithTypeAnnotation.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariableDeclarationWithTypeAnnotation.types.diff index 9792e36423..f759dcf1bc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariableDeclarationWithTypeAnnotation.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariableDeclarationWithTypeAnnotation.types.diff @@ -5,9 +5,9 @@ /** @type {boolean} */ var /** @type {string} */ x, ->x : string -+>x : any ++>x : boolean /** @type {number} */ y; ->y : number -+>y : any ++>y : boolean diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.errors.txt.diff new file mode 100644 index 0000000000..a1c6c35172 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.errors.txt.diff @@ -0,0 +1,20 @@ +--- old.jsdocVariadicType.errors.txt ++++ new.jsdocVariadicType.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++a.js(2,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++ ++ ++==== a.js (1 errors) ==== ++ /** ++ * @type {function(boolean, string, ...*):void} ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ */ ++ const foo = function (a, b, ...r) { }; ++ ++==== b.ts (0 errors) ==== ++ foo(false, ''); ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.types.diff index ec15ff1e12..395d30eb13 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.types.diff @@ -8,7 +8,7 @@ ->function (a, b, ...r) { } : (a: boolean, b: string, ...r: any[]) => void ->a : boolean ->b : string -+>foo : (a: any, b: any, ...r: any[]) => void ++>foo : function +>function (a, b, ...r) { } : (a: any, b: any, ...r: any[]) => void +>a : any +>b : any @@ -16,9 +16,10 @@ === b.ts === foo(false, ''); - >foo(false, '') : void +->foo(false, '') : void ->foo : (arg0: boolean, arg1: string, ...arg2: any[]) => void -+>foo : (a: any, b: any, ...r: any[]) => void ++>foo(false, '') : any ++>foo : function >false : false >'' : "" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/linkTagEmit1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/linkTagEmit1.types.diff index b857e75e28..867209700b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/linkTagEmit1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/linkTagEmit1.types.diff @@ -1,19 +1,25 @@ --- old.linkTagEmit1.types +++ new.linkTagEmit1.types -@@= skipped -18, +18 lines =@@ - * @param {number} integer {@link Z} +@@= skipped -6, +6 lines =@@ + } + === linkTagEmit1.js === + /** @typedef {number} N */ ++>N : number ++ + /** + * @typedef {Object} D1 ++>D1 : D1 ++ + * @property {1} e Just link to {@link NS.R} this time ++>e : any ++ + * @property {1} m Wyatt Earp loved {@link N integers} I bet. ++>m : any ++ */ - function computeCommonSourceDirectoryOfFilenames(integer) { -->computeCommonSourceDirectoryOfFilenames : (integer: number) => number -->integer : number -+>computeCommonSourceDirectoryOfFilenames : (integer: any) => any -+>integer : any - return integer + 1 // pls pls pls -->integer + 1 : number -->integer : number -+>integer + 1 : any -+>integer : any - >1 : 1 - } + /** @typedef {number} Z @see N {@link N} */ ++>Z : number + /** + * @param {number} integer {@link Z} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/malformedTags.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/malformedTags.types.diff deleted file mode 100644 index b6c25f2d7b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/malformedTags.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.malformedTags.types -+++ new.malformedTags.types -@@= skipped -6, +6 lines =@@ - * @type Function - */ - var isArray = Array.isArray; -->isArray : Function -+>isArray : (arg: any) => arg is any[] - >Array.isArray : (arg: any) => arg is any[] - >Array : ArrayConstructor - >isArray : (arg: any) => arg is any[] diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment6.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment6.types.diff index a7a1fc376f..66151eef5a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment6.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment6.types.diff @@ -1,38 +1,12 @@ --- old.moduleExportAssignment6.types +++ new.moduleExportAssignment6.types -@@= skipped -5, +5 lines =@@ - - /** @param {number} x */ - constructor(x) { -->x : number -+>x : any - - this.x = x -->this.x = x : number -+>this.x = x : any - >this.x : any - >this : this - >x : any -->x : number -+>x : any - - this.exports = [x] -->this.exports = [x] : number[] -+>this.exports = [x] : any[] - >this.exports : any - >this : this - >exports : any -->[x] : number[] -->x : number -+>[x] : any[] -+>x : any +@@= skipped -24, +24 lines =@@ } /** @param {number} y */ m(y) { ->m : (y: number) => number -->y : number -+>m : (y: any) => any -+>y : any ++>m : (y: number) => any + >y : number return this.x + y ->this.x + y : number @@ -41,9 +15,8 @@ +>this.x : any >this : this ->x : number -->y : number +>x : any -+>y : any + >y : number } } function exec() { @@ -52,7 +25,7 @@ const module = new C(12); >module : C -@@= skipped -40, +40 lines =@@ +@@= skipped -21, +21 lines =@@ >12 : 12 return module.exports; // should be fine because `module` is defined locally diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.errors.txt.diff index 9b2c9edf9d..05bc56ce6a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.errors.txt.diff @@ -14,7 +14,6 @@ +index.ts(4,24): error TS2694: Namespace '"mod"' has no exported member 'foo'. +index.ts(5,24): error TS2694: Namespace '"mod"' has no exported member 'qux'. +index.ts(6,24): error TS2694: Namespace '"mod"' has no exported member 'baz'. -+index.ts(7,24): error TS2694: Namespace '"mod"' has no exported member 'buz'. +index.ts(8,24): error TS2694: Namespace '"mod"' has no exported member 'literal'. +index.ts(14,31): error TS2694: Namespace '"mod"' has no exported member 'Thing'. +index.ts(15,31): error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. @@ -23,6 +22,19 @@ +index.ts(18,31): error TS2694: Namespace '"mod"' has no exported member 'baz'. +index.ts(19,31): error TS2694: Namespace '"mod"' has no exported member 'buz'. +index.ts(20,31): error TS2694: Namespace '"mod"' has no exported member 'literal'. ++main.js(2,28): error TS2694: Namespace '"mod"' has no exported member 'Thing'. ++main.js(3,28): error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. ++main.js(4,28): error TS2694: Namespace '"mod"' has no exported member 'foo'. ++main.js(5,28): error TS2694: Namespace '"mod"' has no exported member 'qux'. ++main.js(6,28): error TS2694: Namespace '"mod"' has no exported member 'baz'. ++main.js(8,28): error TS2694: Namespace '"mod"' has no exported member 'literal'. ++main.js(15,35): error TS2694: Namespace '"mod"' has no exported member 'Thing'. ++main.js(16,35): error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. ++main.js(17,35): error TS2694: Namespace '"mod"' has no exported member 'foo'. ++main.js(18,35): error TS2694: Namespace '"mod"' has no exported member 'qux'. ++main.js(19,35): error TS2694: Namespace '"mod"' has no exported member 'baz'. ++main.js(20,35): error TS2694: Namespace '"mod"' has no exported member 'buz'. ++main.js(21,35): error TS2694: Namespace '"mod"' has no exported member 'literal'. +mod.js(6,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -39,29 +51,67 @@ Thing, AnotherThing, foo, -@@= skipped -21, +30 lines =@@ +@@= skipped -21, +42 lines =@@ baz() { return 5 }, literal: "", } -==== main.js (1 errors) ==== -+==== main.js (0 errors) ==== ++==== main.js (13 errors) ==== /** * @param {import("./mod").Thing} a ++ ~~~~~ ++!!! error TS2694: Namespace '"mod"' has no exported member 'Thing'. * @param {import("./mod").AnotherThing} b -@@= skipped -21, +21 lines =@@ ++ ~~~~~~~~~~~~ ++!!! error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. + * @param {import("./mod").foo} c ++ ~~~ ++!!! error TS2694: Namespace '"mod"' has no exported member 'foo'. + * @param {import("./mod").qux} d ++ ~~~ ++!!! error TS2694: Namespace '"mod"' has no exported member 'qux'. + * @param {import("./mod").baz} e ++ ~~~ ++!!! error TS2694: Namespace '"mod"' has no exported member 'baz'. + * @param {import("./mod").buz} f + * @param {import("./mod").literal} g ++ ~~~~~~~ ++!!! error TS2694: Namespace '"mod"' has no exported member 'literal'. + */ + function jstypes(a, b, c, d, e, f, g) { + return a.x + b.y + c() + d() + e() + f() + g.length +@@= skipped -16, +28 lines =@@ + + /** + * @param {typeof import("./mod").Thing} a ++ ~~~~~ ++!!! error TS2694: Namespace '"mod"' has no exported member 'Thing'. + * @param {typeof import("./mod").AnotherThing} b ++ ~~~~~~~~~~~~ ++!!! error TS2694: Namespace '"mod"' has no exported member 'AnotherThing'. + * @param {typeof import("./mod").foo} c ++ ~~~ ++!!! error TS2694: Namespace '"mod"' has no exported member 'foo'. * @param {typeof import("./mod").qux} d ++ ~~~ ++!!! error TS2694: Namespace '"mod"' has no exported member 'qux'. * @param {typeof import("./mod").baz} e ++ ~~~ ++!!! error TS2694: Namespace '"mod"' has no exported member 'baz'. * @param {typeof import("./mod").buz} f -- ~~~ + ~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'buz'. ++!!! error TS2694: Namespace '"mod"' has no exported member 'buz'. * @param {typeof import("./mod").literal} g ++ ~~~~~~~ ++!!! error TS2694: Namespace '"mod"' has no exported member 'literal'. */ function jsvalues(a, b, c, d, e, f, g) { return a.length + b.length + c() + d() + e() + f() + g.length } -==== index.ts (7 errors) ==== -+==== index.ts (14 errors) ==== ++==== index.ts (13 errors) ==== function types( a: import('./mod').Thing, ~~~~~ @@ -84,8 +134,6 @@ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'baz'. +!!! error TS2694: Namespace '"mod"' has no exported member 'baz'. f: import('./mod').buz, -+ ~~~ -+!!! error TS2694: Namespace '"mod"' has no exported member 'buz'. g: import('./mod').literal, ~~~~~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'literal'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.types.diff index d6f8be2170..42e6715e24 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.types.diff @@ -1,8 +1,11 @@ --- old.moduleExportAssignment7.types +++ new.moduleExportAssignment7.types -@@= skipped -20, +20 lines =@@ +@@= skipped -19, +19 lines =@@ + >4 : 4 /** @typedef {() => number} buz */ ++>buz : any ++ module.exports = { ->module.exports = { Thing, AnotherThing, foo, qux: bar, baz() { return 5 }, literal: "",} : { Thing: typeof Thing; AnotherThing: typeof AnotherThing; foo: () => number; qux: () => number; baz(): number; literal: string; } ->module.exports : { Thing: typeof Thing; AnotherThing: typeof AnotherThing; foo: () => number; qux: () => number; baz(): number; literal: string; } @@ -17,7 +20,7 @@ Thing, >Thing : typeof Thing -@@= skipped -38, +38 lines =@@ +@@= skipped -39, +41 lines =@@ * @param {import("./mod").literal} g */ function jstypes(a, b, c, d, e, f, g) { @@ -29,13 +32,13 @@ ->e : () => number ->f : import("mod").buz ->g : string -+>jstypes : (a: any, b: any, c: any, d: any, e: any, f: any, g: any) => any ++>jstypes : (a: any, b: any, c: any, d: any, e: any, f: () => number, g: any) => any +>a : any +>b : any +>c : any +>d : any +>e : any -+>f : any ++>f : () => number +>g : any return a.x + b.y + c() + d() + e() + f() + g.length @@ -57,11 +60,6 @@ ->d : () => number ->e() : number ->e : () => number -->f() : number -->f : import("mod").buz -->g.length : number -->g : string -->length : number +>a.x + b.y + c() + d() + e() + f() + g.length : any +>a.x + b.y + c() + d() + e() + f() : any +>a.x + b.y + c() + d() + e() : any @@ -80,8 +78,12 @@ +>d : any +>e() : any +>e : any -+>f() : any -+>f : any + >f() : number +->f : import("mod").buz +->g.length : number +->g : string +->length : number ++>f : () => number +>g.length : any +>g : any +>length : any @@ -156,7 +158,7 @@ === index.ts === function types( ->types : (a: import("./mod").Thing, b: import("./mod").AnotherThing, c: import("./mod").foo, d: import("./mod").qux, e: import("./mod").baz, f: import("./mod").buz, g: import("./mod").literal) => any -+>types : (a: any, b: any, c: any, d: any, e: any, f: any, g: any) => any ++>types : (a: any, b: any, c: any, d: any, e: any, f: () => number, g: any) => any a: import('./mod').Thing, >a : any @@ -165,18 +167,16 @@ f: import('./mod').buz, ->f : import("mod").buz -+>f : any ++>f : () => number g: import('./mod').literal, >g : any -@@= skipped -25, +25 lines =@@ - >d : any +@@= skipped -26, +26 lines =@@ >e() : any >e : any -->f() : number + >f() : number ->f : import("mod").buz -+>f() : any -+>f : any ++>f : () => number >g.length : any >g : any >length : any @@ -212,7 +212,7 @@ >baz : any f: typeof import('./mod').buz, -@@= skipped -35, +35 lines =@@ +@@= skipped -34, +34 lines =@@ >buz : any g: typeof import('./mod').literal, diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportNestedNamespaces.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportNestedNamespaces.types.diff index 30171e2aa0..60b579adb4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportNestedNamespaces.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportNestedNamespaces.types.diff @@ -113,16 +113,16 @@ ->f : (c: C, classic: s.Classic) => void ->c : C ->classic : s.Classic -+>f : (c: any, classic: any) => void -+>c : any -+>classic : any ++>f : (c: K, classic: Classic) => void ++>c : K ++>classic : Classic c.x ->c.x : number ->c : C ->x : number +>c.x : any -+>c : any ++>c : K +>x : any classic.p @@ -130,7 +130,7 @@ ->classic : s.Classic ->p : number +>classic.p : any -+>classic : any ++>classic : Classic +>p : any } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment2.errors.txt.diff deleted file mode 100644 index c114c2ddd7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment2.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.moduleExportsElementAccessAssignment2.errors.txt -+++ new.moduleExportsElementAccessAssignment2.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+file1.js(9,12): error TS7006: Parameter 'type' implicitly has an 'any' type. -+file1.js(9,18): error TS7006: Parameter 'ctor' implicitly has an 'any' type. -+file1.js(9,24): error TS7006: Parameter 'exports' implicitly has an 'any' type. -+ -+ -+==== file1.js (3 errors) ==== -+ // this file _should_ be a global file -+ var GlobalThing = { x: 12 }; -+ -+ /** -+ * @param {*} type -+ * @param {*} ctor -+ * @param {*} exports -+ */ -+ function f(type, ctor, exports) { -+ ~~~~ -+!!! error TS7006: Parameter 'type' implicitly has an 'any' type. -+ ~~~~ -+!!! error TS7006: Parameter 'ctor' implicitly has an 'any' type. -+ ~~~~~~~ -+!!! error TS7006: Parameter 'exports' implicitly has an 'any' type. -+ if (typeof exports !== "undefined") { -+ exports["AST_" + type] = ctor; -+ } -+ } -+ -+==== ref.js (0 errors) ==== -+ GlobalThing.x -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.errors.txt.diff new file mode 100644 index 0000000000..3dc274ce71 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.errors.txt.diff @@ -0,0 +1,15 @@ +--- old.noAssertForUnparseableTypedefs.errors.txt ++++ new.noAssertForUnparseableTypedefs.errors.txt +@@= skipped -0, +0 lines =@@ ++bug26693.js(1,15): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + bug26693.js(2,22): error TS2307: Cannot find module 'nope' or its corresponding type declarations. + + +-==== bug26693.js (1 errors) ==== ++==== bug26693.js (2 errors) ==== + /** @typedef {module:locale} hi */ ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + import { nope } from 'nope'; + ~~~~~~ + !!! error TS2307: Cannot find module 'nope' or its corresponding type declarations. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.types.diff new file mode 100644 index 0000000000..67cf570ef4 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.types.diff @@ -0,0 +1,11 @@ +--- old.noAssertForUnparseableTypedefs.types ++++ new.noAssertForUnparseableTypedefs.types +@@= skipped -1, +1 lines =@@ + + === bug26693.js === + /** @typedef {module:locale} hi */ ++> : any ++ + import { nope } from 'nope'; + >nope : any + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/optionalBindingParameters3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/optionalBindingParameters3.types.diff index 8630bf2469..eae2af0876 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/optionalBindingParameters3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/optionalBindingParameters3.types.diff @@ -1,6 +1,17 @@ --- old.optionalBindingParameters3.types +++ new.optionalBindingParameters3.types -@@= skipped -9, +9 lines =@@ +@@= skipped -2, +2 lines =@@ + === /a.js === + /** + * @typedef Foo ++>Foo : Foo ++ + * @property {string} a ++>a : any ++ + */ + + /** * @param {Foo} [options] */ function f({ a = "a" }) {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag1.errors.txt.diff index ada3f5d3c0..1b93fe96e9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag1.errors.txt.diff @@ -1,6 +1,6 @@ --- old.overloadTag1.errors.txt +++ new.overloadTag1.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -overloadTag1.js(7,5): error TS2394: This overload signature is not compatible with its implementation signature. -overloadTag1.js(25,10): error TS2769: No overload matches this call. - Overload 1 of 2, '(a: number, b: number): number', gave the following error. @@ -12,67 +12,48 @@ - Argument of type 'string' is not assignable to parameter of type 'number'. - Overload 2 of 2, '(a: string, b: boolean): string', gave the following error. - Argument of type 'string' is not assignable to parameter of type 'boolean'. -- -- ++overloadTag1.js(26,25): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. + + -==== overloadTag1.js (3 errors) ==== -- /** -- * @overload -- * @param {number} a -- * @param {number} b -- * @returns {number} -- * -- * @overload ++==== overloadTag1.js (1 errors) ==== + /** + * @overload + * @param {number} a +@@= skipped -18, +8 lines =@@ + * @returns {number} + * + * @overload - ~~~~~~~~ -!!! error TS2394: This overload signature is not compatible with its implementation signature. -!!! related TS2750 overloadTag1.js:16:17: The implementation signature is declared here. -- * @param {string} a -- * @param {boolean} b -- * @returns {string} -- * -- * @param {string | number} a -- * @param {string | number} b -- * @returns {string | number} -- */ -- export function overloaded(a,b) { -- if (typeof a === "string" && typeof b === "string") { -- return a + b; -- } else if (typeof a === "number" && typeof b === "number") { -- return a + b; -- } -- throw new Error("Invalid arguments"); -- } -- var o1 = overloaded(1,2) -- var o2 = overloaded("zero", "one") + * @param {string} a + * @param {boolean} b + * @returns {string} +@@= skipped -21, +18 lines =@@ + } + var o1 = overloaded(1,2) + var o2 = overloaded("zero", "one") - ~~~~~~~~~~ -!!! error TS2769: No overload matches this call. -!!! error TS2769: Overload 1 of 2, '(a: number, b: number): number', gave the following error. -!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'number'. -!!! error TS2769: Overload 2 of 2, '(a: string, b: boolean): string', gave the following error. -!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'boolean'. -- var o3 = overloaded("a",false) -- -- /** -- * @overload -- * @param {number} a -- * @param {number} b -- * @returns {number} -- * -- * @overload -- * @param {string} a -- * @param {boolean} b -- * @returns {string} -- */ -- export function uncheckedInternally(a, b) { -- return a + b; -- } -- uncheckedInternally(1,2) -- uncheckedInternally("zero", "one") + var o3 = overloaded("a",false) ++ ~~~~~ ++!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. + + /** + * @overload +@@= skipped -24, +20 lines =@@ + } + uncheckedInternally(1,2) + uncheckedInternally("zero", "one") - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2769: No overload matches this call. -!!! error TS2769: Overload 1 of 2, '(a: number, b: number): number', gave the following error. -!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'number'. -!!! error TS2769: Overload 2 of 2, '(a: string, b: boolean): string', gave the following error. -!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'boolean'. -- -@@= skipped --1, +1 lines =@@ -+ + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag1.types.diff index 28b3ba13b1..c1be92c52a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag1.types.diff @@ -5,45 +5,37 @@ */ export function overloaded(a,b) { ->overloaded : { (a: number, b: number): number; (a: string, b: boolean): string; } -->a : string | number -->b : string | number -+>overloaded : (a: any, b: any) => string | number -+>a : any -+>b : any ++>overloaded : (a: string | number, b: string | number) => string | number + >a : string | number + >b : string | number if (typeof a === "string" && typeof b === "string") { >typeof a === "string" && typeof b === "string" : boolean >typeof a === "string" : boolean ->typeof a : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" -->a : string | number +>typeof a : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" -+>a : any + >a : string | number >"string" : "string" >typeof b === "string" : boolean ->typeof b : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" -->b : string | number +>typeof b : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" -+>b : any + >b : string | number >"string" : "string" - return a + b; @@= skipped -23, +23 lines =@@ } else if (typeof a === "number" && typeof b === "number") { >typeof a === "number" && typeof b === "number" : boolean >typeof a === "number" : boolean ->typeof a : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" -->a : string | number +>typeof a : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" -+>a : any + >a : string | number >"number" : "number" >typeof b === "number" : boolean ->typeof b : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" -->b : string | number +>typeof b : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" -+>b : any + >b : string | number >"number" : "number" - return a + b; @@= skipped -19, +19 lines =@@ >"Invalid arguments" : "Invalid arguments" } @@ -53,7 +45,7 @@ ->overloaded : { (a: number, b: number): number; (a: string, b: boolean): string; } +>o1 : string | number +>overloaded(1,2) : string | number -+>overloaded : (a: any, b: any) => string | number ++>overloaded : (a: string | number, b: string | number) => string | number >1 : 1 >2 : 2 @@ -63,7 +55,7 @@ ->overloaded : { (a: number, b: number): number; (a: string, b: boolean): string; } +>o2 : string | number +>overloaded("zero", "one") : string | number -+>overloaded : (a: any, b: any) => string | number ++>overloaded : (a: string | number, b: string | number) => string | number >"zero" : "zero" >"one" : "one" @@ -73,7 +65,7 @@ ->overloaded : { (a: number, b: number): number; (a: string, b: boolean): string; } +>o3 : string | number +>overloaded("a",false) : string | number -+>overloaded : (a: any, b: any) => string | number ++>overloaded : (a: string | number, b: string | number) => string | number >"a" : "a" >false : false diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag2.types.diff index 8190dffd53..b9e26f5f5e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag2.types.diff @@ -9,21 +9,3 @@ >true : true >1 : 1 >"1" : "1" -@@= skipped -29, +29 lines =@@ - * @param {number | string} a - */ - constructor(a, b) { -->a : string | number -+>a : any - >b : any - - this.#a = a -->this.#a = a : string | number -+>this.#a = a : any - >this.#a : string | number - >this : this -->a : string | number -+>a : any - - this.#b = b - >this.#b = b : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag3.errors.txt.diff deleted file mode 100644 index d6d68c5bc2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag3.errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.overloadTag3.errors.txt -+++ new.overloadTag3.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+/a.js(14,9): error TS7006: Parameter 'value' implicitly has an 'any' type. -+ -+ -+==== /a.js (1 errors) ==== -+ /** -+ * @template T -+ */ -+ export class Foo { -+ /** -+ * @constructor -+ * @overload -+ */ -+ constructor() { } -+ -+ /** -+ * @param {T} value -+ */ -+ bar(value) { } -+ ~~~~~ -+!!! error TS7006: Parameter 'value' implicitly has an 'any' type. -+ } -+ -+ /** @type {Foo} */ -+ let foo; -+ foo = new Foo(); -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag3.types.diff deleted file mode 100644 index 82af181382..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/overloadTag3.types.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.overloadTag3.types -+++ new.overloadTag3.types -@@= skipped -4, +4 lines =@@ - * @template T - */ - export class Foo { -->Foo : Foo -+>Foo : Foo - - /** - * @constructor -@@= skipped -12, +12 lines =@@ - * @param {T} value - */ - bar(value) { } -->bar : (value: T) => void -->value : T -+>bar : (value: any) => void -+>value : any - } - - /** @type {Foo} */ - let foo; -->foo : Foo -+>foo : any - - foo = new Foo(); -->foo = new Foo() : Foo -->foo : Foo -->new Foo() : Foo -+>foo = new Foo() : Foo -+>foo : any -+>new Foo() : Foo - >Foo : typeof Foo - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagBracketsAddOptionalUndefined.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagBracketsAddOptionalUndefined.errors.txt.diff deleted file mode 100644 index ec0b259876..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagBracketsAddOptionalUndefined.errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.paramTagBracketsAddOptionalUndefined.errors.txt -+++ new.paramTagBracketsAddOptionalUndefined.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+a.js(13,1): error TS2554: Expected 3 arguments, but got 0. -+ -+ -+==== a.js (1 errors) ==== -+ /** -+ * @param {number} [p] -+ * @param {number=} q -+ * @param {number} [r=101] -+ */ -+ function f(p, q, r) { -+ p = undefined -+ q = undefined -+ // note that, unlike TS, JSDOC [r=101] retains | undefined because -+ // there's no code emitted to get rid of it. -+ r = undefined -+ } -+ f() -+ ~ -+!!! error TS2554: Expected 3 arguments, but got 0. -+!!! related TS6210 a.js:6:12: An argument for 'p' was not provided. -+ f(undefined, undefined, undefined) -+ f(1, 2, 3) -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagBracketsAddOptionalUndefined.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagBracketsAddOptionalUndefined.types.diff index 68f4e41698..f0c2d340d8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagBracketsAddOptionalUndefined.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagBracketsAddOptionalUndefined.types.diff @@ -5,43 +5,21 @@ */ function f(p, q, r) { ->f : (p?: number, q?: number | undefined, r?: number) => void -->p : number | undefined -->q : number | undefined -->r : number | undefined -+>f : (p: any, q: any, r: any) => void -+>p : any -+>q : any -+>r : any - - p = undefined - >p = undefined : undefined -->p : number | undefined -+>p : any - >undefined : undefined - - q = undefined - >q = undefined : undefined -->q : number | undefined -+>q : any - >undefined : undefined - - // note that, unlike TS, JSDOC [r=101] retains | undefined because - // there's no code emitted to get rid of it. - r = undefined - >r = undefined : undefined -->r : number | undefined -+>r : any - >undefined : undefined ++>f : (p?: number | undefined, q?: number | undefined, r?: number | undefined) => void + >p : number | undefined + >q : number | undefined + >r : number | undefined +@@= skipped -24, +24 lines =@@ } f() >f() : void ->f : (p?: number, q?: number | undefined, r?: number) => void -+>f : (p: any, q: any, r: any) => void ++>f : (p?: number | undefined, q?: number | undefined, r?: number | undefined) => void f(undefined, undefined, undefined) >f(undefined, undefined, undefined) : void ->f : (p?: number, q?: number | undefined, r?: number) => void -+>f : (p: any, q: any, r: any) => void ++>f : (p?: number | undefined, q?: number | undefined, r?: number | undefined) => void >undefined : undefined >undefined : undefined >undefined : undefined @@ -49,7 +27,7 @@ f(1, 2, 3) >f(1, 2, 3) : void ->f : (p?: number, q?: number | undefined, r?: number) => void -+>f : (p: any, q: any, r: any) => void ++>f : (p?: number | undefined, q?: number | undefined, r?: number | undefined) => void >1 : 1 >2 : 2 >3 : 3 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.errors.txt.diff new file mode 100644 index 0000000000..f95cacd22b --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.errors.txt.diff @@ -0,0 +1,21 @@ +--- old.paramTagTypeResolution2.errors.txt ++++ new.paramTagTypeResolution2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++38572.js(4,39): error TS2304: Cannot find name 'K'. ++ ++ ++==== 38572.js (1 errors) ==== ++ /** ++ * @template T ++ * @param {T} a ++ * @param {{[K in keyof T]: (value: T[K]) => void }} b ++ ~ ++!!! error TS2304: Cannot find name 'K'. ++ */ ++ function f(a, b) { ++ } ++ ++ f({ x: 42 }, { x(param) { param.toFixed() } }); ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.types.diff index 2cff69ce23..0416624f81 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution2.types.diff @@ -5,17 +5,16 @@ */ function f(a, b) { ->f : (a: T, b: { [K in keyof T]: (value: T[K]) => void; }) => void -->a : T ++>f : (a: T, b: { [K in keyof T]: (value: T[K]) => void }) => void + >a : T ->b : { [K in keyof T]: (value: T[K]) => void; } -+>f : (a: any, b: any) => void -+>a : any -+>b : any ++>b : { [K in keyof T]: (value: T[K]) => void } } f({ x: 42 }, { x(param) { param.toFixed() } }); >f({ x: 42 }, { x(param) { param.toFixed() } }) : void ->f : (a: T, b: { [K in keyof T]: (value: T[K]) => void; }) => void -+>f : (a: any, b: any) => void ++>f : (a: T, b: { [K in keyof T]: (value: T[K]) => void }) => void >{ x: 42 } : { x: number; } >x : number >42 : 42 @@ -26,11 +25,11 @@ ->param.toFixed : (fractionDigits?: number) => string ->param : number ->toFixed : (fractionDigits?: number) => string -+>{ x(param) { param.toFixed() } } : { x: (param: any) => void; } -+>x : (param: any) => void -+>param : any ++>{ x(param) { param.toFixed() } } : { x: (param: K) => void; } ++>x : (param: K) => void ++>param : K +>param.toFixed() : any +>param.toFixed : any -+>param : any ++>param : K +>toFixed : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagWrapping.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagWrapping.types.diff deleted file mode 100644 index 42ae0e6a8b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagWrapping.types.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.paramTagWrapping.types -+++ new.paramTagWrapping.types -@@= skipped -9, +9 lines =@@ - * Arg z. - */ - function good(x, y, z) { -->good : (x: number, y: number, z: number) => void -->x : number -->y : number -->z : number -+>good : (x: any, y: any, z: any) => void -+>x : any -+>y : any -+>z : any - } - - good(1, 2, 3) - >good(1, 2, 3) : void -->good : (x: number, y: number, z: number) => void -+>good : (x: any, y: any, z: any) => void - >1 : 1 - >2 : 2 - >3 : 3 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff new file mode 100644 index 0000000000..e410109eb6 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/propertiesOfGenericConstructorFunctions.errors.txt.diff @@ -0,0 +1,63 @@ +--- old.propertiesOfGenericConstructorFunctions.errors.txt ++++ new.propertiesOfGenericConstructorFunctions.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++propertiesOfGenericConstructorFunctions.js(14,12): error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? ++ ++ ++==== propertiesOfGenericConstructorFunctions.js (1 errors) ==== ++ /** ++ * @template {string} K ++ * @template V ++ * @param {string} ik ++ * @param {V} iv ++ */ ++ function Multimap(ik, iv) { ++ /** @type {{ [s: string]: V }} */ ++ this._map = {}; ++ // without type annotation ++ this._map2 = { [ik]: iv }; ++ }; ++ ++ /** @type {Multimap<"a" | "b", number>} with type annotation */ ++ ~~~~~~~~ ++!!! error TS2749: 'Multimap' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap'? ++ const map = new Multimap("a", 1); ++ // without type annotation ++ const map2 = new Multimap("m", 2); ++ ++ /** @type {number} */ ++ var n = map._map['hi'] ++ /** @type {number} */ ++ var n = map._map2['hi'] ++ /** @type {number} */ ++ var n = map2._map['hi'] ++ /** @type {number} */ ++ var n = map._map2['hi'] ++ ++ /** ++ * @class ++ * @template T ++ * @param {T} t ++ */ ++ function Cp(t) { ++ this.x = 1 ++ this.y = t ++ } ++ Cp.prototype = { ++ m1() { return this.x }, ++ m2() { this.z = this.x + 1; return this.y } ++ } ++ var cp = new Cp(1) ++ ++ /** @type {number} */ ++ var n = cp.x ++ /** @type {number} */ ++ var n = cp.y ++ /** @type {number} */ ++ var n = cp.m1() ++ /** @type {number} */ ++ var n = cp.m2() ++ ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/propertiesOfGenericConstructorFunctions.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/propertiesOfGenericConstructorFunctions.types.diff index 27bf5eb03d..bca3fe886a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/propertiesOfGenericConstructorFunctions.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/propertiesOfGenericConstructorFunctions.types.diff @@ -5,11 +5,9 @@ */ function Multimap(ik, iv) { ->Multimap : typeof Multimap -->ik : string -->iv : V -+>Multimap : (ik: any, iv: any) => void -+>ik : any -+>iv : any ++>Multimap : (ik: string, iv: V) => void + >ik : string + >iv : V /** @type {{ [s: string]: V }} */ this._map = {}; @@ -24,31 +22,21 @@ // without type annotation this._map2 = { [ik]: iv }; -->this._map2 = { [ik]: iv } : { [x: string]: V; } -+>this._map2 = { [ik]: iv } : { [x: number]: any; } + >this._map2 = { [ik]: iv } : { [x: string]: V; } >this._map2 : any ->this : this +>this : any >_map2 : any -->{ [ik]: iv } : { [x: string]: V; } -->[ik] : V -->ik : string -->iv : V -+>{ [ik]: iv } : { [x: number]: any; } -+>[ik] : any -+>ik : any -+>iv : any - - }; - + >{ [ik]: iv } : { [x: string]: V; } + >[ik] : V +@@= skipped -28, +28 lines =@@ /** @type {Multimap<"a" | "b", number>} with type annotation */ const map = new Multimap("a", 1); -->map : Multimap<"a" | "b", number> + >map : Multimap<"a" | "b", number> ->new Multimap("a", 1) : Multimap<"a" | "b", number> ->Multimap : typeof Multimap -+>map : any +>new Multimap("a", 1) : any -+>Multimap : (ik: any, iv: any) => void ++>Multimap : (ik: string, iv: V) => void >"a" : "a" >1 : 1 @@ -59,46 +47,41 @@ ->Multimap : typeof Multimap +>map2 : any +>new Multimap("m", 2) : any -+>Multimap : (ik: any, iv: any) => void ++>Multimap : (ik: string, iv: V) => void >"m" : "m" >2 : 2 /** @type {number} */ var n = map._map['hi'] -->n : number + >n : number ->map._map['hi'] : number ->map._map : { [s: string]: number; } -->map : Multimap<"a" | "b", number> -->_map : { [s: string]: number; } -+>n : any +>map._map['hi'] : any +>map._map : any -+>map : any + >map : Multimap<"a" | "b", number> +->_map : { [s: string]: number; } +>_map : any >'hi' : "hi" /** @type {number} */ var n = map._map2['hi'] -->n : number + >n : number ->map._map2['hi'] : number ->map._map2 : { [x: string]: number; } -->map : Multimap<"a" | "b", number> -->_map2 : { [x: string]: number; } -+>n : any +>map._map2['hi'] : any +>map._map2 : any -+>map : any + >map : Multimap<"a" | "b", number> +->_map2 : { [x: string]: number; } +>_map2 : any >'hi' : "hi" /** @type {number} */ var n = map2._map['hi'] -->n : number + >n : number ->map2._map['hi'] : number ->map2._map : { [s: string]: number; } ->map2 : Multimap ->_map : { [s: string]: number; } -+>n : any +>map2._map['hi'] : any +>map2._map : any +>map2 : any @@ -107,27 +90,24 @@ /** @type {number} */ var n = map._map2['hi'] -->n : number + >n : number ->map._map2['hi'] : number ->map._map2 : { [x: string]: number; } -->map : Multimap<"a" | "b", number> -->_map2 : { [x: string]: number; } -+>n : any +>map._map2['hi'] : any +>map._map2 : any -+>map : any + >map : Multimap<"a" | "b", number> +->_map2 : { [x: string]: number; } +>_map2 : any >'hi' : "hi" /** -@@= skipped -83, +83 lines =@@ +@@= skipped -55, +55 lines =@@ * @param {T} t */ function Cp(t) { ->Cp : typeof Cp -->t : T -+>Cp : { (t: any): void; prototype: { m1: () => any; m2: () => any; }; } -+>t : any ++>Cp : { (t: T): void; prototype: { m1: () => any; m2: () => any; }; } + >t : T this.x = 1 >this.x = 1 : 1 @@ -138,14 +118,12 @@ >1 : 1 this.y = t -->this.y = t : T -+>this.y = t : any + >this.y = t : T >this.y : any ->this : this +>this : any >y : any -->t : T -+>t : any + >t : T } Cp.prototype = { ->Cp.prototype = { m1() { return this.x }, m2() { this.z = this.x + 1; return this.y }} : { m1(): number; m2(): T; } @@ -155,7 +133,7 @@ ->{ m1() { return this.x }, m2() { this.z = this.x + 1; return this.y }} : { m1(): number; m2(): T; } +>Cp.prototype = { m1() { return this.x }, m2() { this.z = this.x + 1; return this.y }} : { m1: () => any; m2: () => any; } +>Cp.prototype : { m1: () => any; m2: () => any; } -+>Cp : { (t: any): void; prototype: { m1: () => any; m2: () => any; }; } ++>Cp : { (t: T): void; prototype: { m1: () => any; m2: () => any; }; } +>prototype : { m1: () => any; m2: () => any; } +>{ m1() { return this.x }, m2() { this.z = this.x + 1; return this.y }} : { m1: () => any; m2: () => any; } @@ -202,39 +180,36 @@ ->Cp : typeof Cp +>cp : any +>new Cp(1) : any -+>Cp : { (t: any): void; prototype: { m1: () => any; m2: () => any; }; } ++>Cp : { (t: T): void; prototype: { m1: () => any; m2: () => any; }; } >1 : 1 /** @type {number} */ var n = cp.x -->n : number + >n : number ->cp.x : number ->cp : Cp ->x : number -+>n : any +>cp.x : any +>cp : any +>x : any /** @type {number} */ var n = cp.y -->n : number + >n : number ->cp.y : number ->cp : Cp ->y : number -+>n : any +>cp.y : any +>cp : any +>y : any /** @type {number} */ var n = cp.m1() -->n : number + >n : number ->cp.m1() : number ->cp.m1 : () => number ->cp : Cp ->m1 : () => number -+>n : any +>cp.m1() : any +>cp.m1 : any +>cp : any @@ -242,12 +217,11 @@ /** @type {number} */ var n = cp.m2() -->n : number + >n : number ->cp.m2() : number ->cp.m2 : () => number ->cp : Cp ->m2 : () => number -+>n : any +>cp.m2() : any +>cp.m2 : any +>cp : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/propertyAssignmentUseParentType2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/propertyAssignmentUseParentType2.errors.txt.diff index 4d69dc31f4..242581f4dc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/propertyAssignmentUseParentType2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/propertyAssignmentUseParentType2.errors.txt.diff @@ -1,29 +1,46 @@ --- old.propertyAssignmentUseParentType2.errors.txt +++ new.propertyAssignmentUseParentType2.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -propertyAssignmentUseParentType2.js(11,14): error TS2322: Type '{ (): boolean; nuo: 1000; }' is not assignable to type '{ (): boolean; nuo: 789; }'. -- Types of property 'nuo' are incompatible. ++propertyAssignmentUseParentType2.js(2,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. + Types of property 'nuo' are incompatible. - Type '1000' is not assignable to type '789'. -- -- ++ Type 'number' is not assignable to type '789'. ++propertyAssignmentUseParentType2.js(6,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. ++ Types of property 'nuo' are incompatible. ++ Type 'number' is not assignable to type '789'. ++propertyAssignmentUseParentType2.js(11,14): error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. ++ Types of property 'nuo' are incompatible. ++ Type 'number' is not assignable to type '789'. + + -==== propertyAssignmentUseParentType2.js (1 errors) ==== -- /** @type {{ (): boolean; nuo: 789 }} */ -- export const inlined = () => true -- inlined.nuo = 789 -- -- /** @type {{ (): boolean; nuo: 789 }} */ -- export const duplicated = () => true -- /** @type {789} */ -- duplicated.nuo = 789 -- -- /** @type {{ (): boolean; nuo: 789 }} */ -- export const conflictingDuplicated = () => true -- ~~~~~~~~~~~~~~~~~~~~~ ++==== propertyAssignmentUseParentType2.js (3 errors) ==== + /** @type {{ (): boolean; nuo: 789 }} */ + export const inlined = () => true ++ ~~~~~~~ ++!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. ++!!! error TS2322: Types of property 'nuo' are incompatible. ++!!! error TS2322: Type 'number' is not assignable to type '789'. + inlined.nuo = 789 + + /** @type {{ (): boolean; nuo: 789 }} */ + export const duplicated = () => true ++ ~~~~~~~~~~ ++!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. ++!!! error TS2322: Types of property 'nuo' are incompatible. ++!!! error TS2322: Type 'number' is not assignable to type '789'. + /** @type {789} */ + duplicated.nuo = 789 + + /** @type {{ (): boolean; nuo: 789 }} */ + export const conflictingDuplicated = () => true + ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ (): boolean; nuo: 1000; }' is not assignable to type '{ (): boolean; nuo: 789; }'. --!!! error TS2322: Types of property 'nuo' are incompatible. ++!!! error TS2322: Type '{ (): true; nuo: number; }' is not assignable to type '{ (): boolean; nuo: 789; }'. + !!! error TS2322: Types of property 'nuo' are incompatible. -!!! error TS2322: Type '1000' is not assignable to type '789'. -- /** @type {1000} */ -- conflictingDuplicated.nuo = 789 -- -@@= skipped --1, +1 lines =@@ -+ ++!!! error TS2322: Type 'number' is not assignable to type '789'. + /** @type {1000} */ + conflictingDuplicated.nuo = 789 + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/propertyAssignmentUseParentType2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/propertyAssignmentUseParentType2.types.diff index 6765d1b21c..c84cf97e0b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/propertyAssignmentUseParentType2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/propertyAssignmentUseParentType2.types.diff @@ -1,60 +1,29 @@ --- old.propertyAssignmentUseParentType2.types +++ new.propertyAssignmentUseParentType2.types -@@= skipped -2, +2 lines =@@ - === propertyAssignmentUseParentType2.js === +@@= skipped -3, +3 lines =@@ /** @type {{ (): boolean; nuo: 789 }} */ export const inlined = () => true -->inlined : { (): boolean; nuo: 789; } + >inlined : { (): boolean; nuo: 789; } ->() => true : { (): boolean; nuo: 789; } -+>inlined : { (): boolean; nuo: number; } -+>() => true : { (): boolean; nuo: number; } ++>() => true : { (): true; nuo: number; } >true : true inlined.nuo = 789 - >inlined.nuo = 789 : 789 -->inlined.nuo : 789 -->inlined : { (): boolean; nuo: 789; } -->nuo : 789 -+>inlined.nuo : number -+>inlined : { (): boolean; nuo: number; } -+>nuo : number - >789 : 789 - +@@= skipped -13, +13 lines =@@ /** @type {{ (): boolean; nuo: 789 }} */ export const duplicated = () => true -->duplicated : { (): boolean; nuo: 789; } + >duplicated : { (): boolean; nuo: 789; } ->() => true : { (): boolean; nuo: 789; } -+>duplicated : { (): boolean; nuo: number; } -+>() => true : { (): boolean; nuo: number; } ++>() => true : { (): true; nuo: number; } >true : true /** @type {789} */ - duplicated.nuo = 789 - >duplicated.nuo = 789 : 789 -->duplicated.nuo : 789 -->duplicated : { (): boolean; nuo: 789; } -->nuo : 789 -+>duplicated.nuo : number -+>duplicated : { (): boolean; nuo: number; } -+>nuo : number - >789 : 789 - +@@= skipped -14, +14 lines =@@ /** @type {{ (): boolean; nuo: 789 }} */ export const conflictingDuplicated = () => true -->conflictingDuplicated : { (): boolean; nuo: 789; } + >conflictingDuplicated : { (): boolean; nuo: 789; } ->() => true : { (): boolean; nuo: 1000; } -+>conflictingDuplicated : { (): boolean; nuo: number; } -+>() => true : { (): boolean; nuo: number; } ++>() => true : { (): true; nuo: number; } >true : true /** @type {1000} */ - conflictingDuplicated.nuo = 789 - >conflictingDuplicated.nuo = 789 : 789 -->conflictingDuplicated.nuo : 789 -->conflictingDuplicated : { (): boolean; nuo: 789; } -->nuo : 789 -+>conflictingDuplicated.nuo : number -+>conflictingDuplicated : { (): boolean; nuo: number; } -+>nuo : number - >789 : 789 - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt.diff index bf58b928b2..3249e91f43 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergeAcrossFiles2.errors.txt.diff @@ -3,6 +3,8 @@ @@= skipped -0, +0 lines =@@ -other.js(5,5): error TS2339: Property 'wat' does not exist on type 'One'. -other.js(10,5): error TS2339: Property 'wat' does not exist on type 'Two'. ++other.js(2,11): error TS2503: Cannot find namespace 'Ns'. ++other.js(7,11): error TS2503: Cannot find namespace 'Ns'. +prototypePropertyAssignmentMergeAcrossFiles2.js(2,4): error TS2339: Property 'One' does not exist on type '{}'. +prototypePropertyAssignmentMergeAcrossFiles2.js(3,4): error TS2339: Property 'Two' does not exist on type '{}'. +prototypePropertyAssignmentMergeAcrossFiles2.js(5,4): error TS2339: Property 'One' does not exist on type '{}'. @@ -29,10 +31,11 @@ +!!! error TS2339: Property 'Two' does not exist on type '{}'. } --==== other.js (2 errors) ==== -+==== other.js (0 errors) ==== + ==== other.js (2 errors) ==== /** * @type {Ns.One} ++ ~~ ++!!! error TS2503: Cannot find namespace 'Ns'. */ var one; one.wat; @@ -40,6 +43,8 @@ -!!! error TS2339: Property 'wat' does not exist on type 'One'. /** * @type {Ns.Two} ++ ~~ ++!!! error TS2503: Cannot find namespace 'Ns'. */ var two; two.wat; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergeAcrossFiles2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergeAcrossFiles2.types.diff index e3ad5f2302..d751eaec59 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergeAcrossFiles2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergeAcrossFiles2.types.diff @@ -67,29 +67,3 @@ >{} : {} } -@@= skipped -13, +13 lines =@@ - * @type {Ns.One} - */ - var one; -->one : One -+>one : any - - one.wat; - >one.wat : any -->one : One -+>one : any - >wat : any - - /** - * @type {Ns.Two} - */ - var two; -->two : Two -+>two : any - - two.wat; - >two.wat : any -->two : Two -+>two : any - >wat : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt.diff new file mode 100644 index 0000000000..ff3362d846 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergedTypeReference.errors.txt.diff @@ -0,0 +1,26 @@ +--- old.prototypePropertyAssignmentMergedTypeReference.errors.txt ++++ new.prototypePropertyAssignmentMergedTypeReference.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++prototypePropertyAssignmentMergedTypeReference.js(7,22): error TS2749: 'f' refers to a value, but is being used as a type here. Did you mean 'typeof f'? ++prototypePropertyAssignmentMergedTypeReference.js(8,5): error TS2322: Type '() => number' is not assignable to type 'new () => f'. ++ Type '() => number' provides no match for the signature 'new (): f'. ++ ++ ++==== prototypePropertyAssignmentMergedTypeReference.js (2 errors) ==== ++ var f = function() { ++ return 12; ++ }; ++ ++ f.prototype.a = "a"; ++ ++ /** @type {new () => f} */ ++ ~ ++!!! error TS2749: 'f' refers to a value, but is being used as a type here. Did you mean 'typeof f'? ++ var x = f; ++ ~ ++!!! error TS2322: Type '() => number' is not assignable to type 'new () => f'. ++!!! error TS2322: Type '() => number' provides no match for the signature 'new (): f'. ++ ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergedTypeReference.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergedTypeReference.types.diff index 599c98f5bc..f05f0940dc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergedTypeReference.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/prototypePropertyAssignmentMergedTypeReference.types.diff @@ -20,12 +20,11 @@ >prototype : any >a : any >"a" : "a" - +@@= skipped -8, +8 lines =@@ /** @type {new () => f} */ var x = f; -->x : new () => f + >x : new () => f ->f : typeof f -+>x : () => number +>f : () => number diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.errors.txt.diff index 84778a0c58..293599179b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.errors.txt.diff @@ -1,39 +1,72 @@ --- old.recursiveTypeReferences2.errors.txt +++ new.recursiveTypeReferences2.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -bug39372.js(25,7): error TS2322: Type '{}' is not assignable to type 'XMLObject<{ foo: string; }>'. - Type '{}' is missing the following properties from type '{ $A: { foo?: XMLObject[]; }; $O: { foo?: { $$?: Record; } & { $: string; }; }; $$?: Record; }': $A, $O -- -- ++bug39372.js(1,36): error TS2456: Type alias 'JsonArray' circularly references itself. ++bug39372.js(3,88): error TS2456: Type alias 'Json' circularly references itself. ++bug39372.js(9,17): error TS2304: Cannot find name 'T'. ++bug39372.js(9,32): error TS2304: Cannot find name 'T'. ++bug39372.js(12,17): error TS2304: Cannot find name 'T'. ++bug39372.js(14,10): error TS2304: Cannot find name 'T'. ++bug39372.js(14,55): error TS2304: Cannot find name 'T'. ++bug39372.js(18,15): error TS2304: Cannot find name 'T'. ++bug39372.js(19,5): error TS2304: Cannot find name 'T'. ++bug39372.js(20,19): error TS2304: Cannot find name 'T'. ++bug39372.js(25,7): error TS2322: Type '{}' is not assignable to type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; } & { [x: string]: string | { $A: { [x: string]: (??? & ???)[]; }; $O: { [x: string]: { $$?: Record; } & (??? | ??? & ???); }; $$?: Record; } & ???; }'. ++ Type '{}' is missing the following properties from type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; }': $A, $O + + -==== bug39372.js (1 errors) ==== -- /** @typedef {ReadonlyArray} JsonArray */ -- /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ -- /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ -- -- /** -- * @template T -- * @typedef {{ -- $A: { -- [K in keyof T]?: XMLObject[] -- }, -- $O: { -- [K in keyof T]?: { -- $$?: Record -- } & (T[K] extends string ? {$:string} : XMLObject) -- }, -- $$?: Record, -- } & { -- [K in keyof T]?: ( -- T[K] extends string ? string -- : XMLObject -- ) -- }} XMLObject */ -- -- /** @type {XMLObject<{foo:string}>} */ -- const p = {}; -- ~ ++==== bug39372.js (11 errors) ==== + /** @typedef {ReadonlyArray} JsonArray */ ++ ~~~~~~~~~ ++!!! error TS2456: Type alias 'JsonArray' circularly references itself. + /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ + /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ ++ ~~~~ ++!!! error TS2456: Type alias 'Json' circularly references itself. + + /** + * @template T + * @typedef {{ + $A: { + [K in keyof T]?: XMLObject[] ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'T'. + }, + $O: { + [K in keyof T]?: { ++ ~ ++!!! error TS2304: Cannot find name 'T'. + $$?: Record + } & (T[K] extends string ? {$:string} : XMLObject) ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'T'. + }, + $$?: Record, + } & { + [K in keyof T]?: ( ++ ~ ++!!! error TS2304: Cannot find name 'T'. + T[K] extends string ? string ++ ~ ++!!! error TS2304: Cannot find name 'T'. + : XMLObject ++ ~ ++!!! error TS2304: Cannot find name 'T'. + ) + }} XMLObject */ + + /** @type {XMLObject<{foo:string}>} */ + const p = {}; + ~ -!!! error TS2322: Type '{}' is not assignable to type 'XMLObject<{ foo: string; }>'. -!!! error TS2322: Type '{}' is missing the following properties from type '{ $A: { foo?: XMLObject[]; }; $O: { foo?: { $$?: Record; } & { $: string; }; }; $$?: Record; }': $A, $O -- -@@= skipped --1, +1 lines =@@ -+ ++!!! error TS2322: Type '{}' is not assignable to type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; } & { [x: string]: string | { $A: { [x: string]: (??? & ???)[]; }; $O: { [x: string]: { $$?: Record; } & (??? | ??? & ???); }; $$?: Record; } & ???; }'. ++!!! error TS2322: Type '{}' is missing the following properties from type '{ $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; }': $A, $O + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.types.diff index d2e2a5d4fd..d9e6b787ba 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.types.diff @@ -1,10 +1,29 @@ --- old.recursiveTypeReferences2.types +++ new.recursiveTypeReferences2.types -@@= skipped -25, +25 lines =@@ +@@= skipped -1, +1 lines =@@ + + === bug39372.js === + /** @typedef {ReadonlyArray} JsonArray */ ++>JsonArray : any ++ + /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ ++>JsonRecord : any ++>key : string ++ + /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ ++>Json : any + + /** + * @template T +@@= skipped -21, +27 lines =@@ + : XMLObject + ) + }} XMLObject */ ++>XMLObject : any /** @type {XMLObject<{foo:string}>} */ const p = {}; ->p : XMLObject<{ foo: string; }> -+>p : {} ++>p : { $A: { [x: string]: (??? & { [x: string]: string | ??? & ???; })[]; }; $O: { [x: string]: { $$?: Record; } & ({ $: string; } | ??? & { [x: string]: string | ??? & ???; }); }; $$?: Record; } & { [x: string]: string | { $A: { [x: string]: (??? & ???)[]; }; $O: { [x: string]: { $$?: Record; } & (??? | ??? & ???); }; $$?: Record; } & ???; } >{} : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/returnTagTypeGuard.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/returnTagTypeGuard.errors.txt.diff index 99e9a0c170..ccb15f3f75 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/returnTagTypeGuard.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/returnTagTypeGuard.errors.txt.diff @@ -5,9 +5,11 @@ @@= skipped --1, +1 lines =@@ +bug25127.js(3,14): error TS2339: Property 'c' does not exist on type 'Entry'. +bug25127.js(15,14): error TS2339: Property 'd' does not exist on type 'Group'. ++bug25127.js(27,41): error TS2339: Property 'c' does not exist on type 'Entry'. ++bug25127.js(27,51): error TS2339: Property 'd' does not exist on type 'Group'. + + -+==== bug25127.js (2 errors) ==== ++==== bug25127.js (4 errors) ==== + class Entry { + constructor() { + this.c = 1 @@ -39,6 +41,10 @@ + /** @param {Entry | Group} chunk */ + function f(chunk) { + let x = chunk.isInit(chunk) ? chunk.c : chunk.d ++ ~ ++!!! error TS2339: Property 'c' does not exist on type 'Entry'. ++ ~ ++!!! error TS2339: Property 'd' does not exist on type 'Group'. + return x + } + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/returnTagTypeGuard.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/returnTagTypeGuard.types.diff index 143de1e2be..74672e8095 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/returnTagTypeGuard.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/returnTagTypeGuard.types.diff @@ -1,58 +1,34 @@ --- old.returnTagTypeGuard.types +++ new.returnTagTypeGuard.types -@@= skipped -16, +16 lines =@@ - * @return {this is Entry} - */ - isInit(x) { -->isInit : (x: any) => this is Entry -+>isInit : (x: any) => boolean - >x : any - - return true -@@= skipped -23, +23 lines =@@ - * @return {false} - */ - isInit(x) { -->isInit : (x: any) => false -+>isInit : (x: any) => boolean - >x : any - - return false -@@= skipped -9, +9 lines =@@ +@@= skipped -48, +48 lines =@@ } /** @param {Entry | Group} chunk */ function f(chunk) { ->f : (chunk: Entry | Group) => string | number -->chunk : Entry | Group -+>f : (chunk: any) => any -+>chunk : any ++>f : (chunk: Entry | Group) => any + >chunk : Entry | Group let x = chunk.isInit(chunk) ? chunk.c : chunk.d ->x : string | number ->chunk.isInit(chunk) ? chunk.c : chunk.d : string | number -->chunk.isInit(chunk) : boolean ++>x : any ++>chunk.isInit(chunk) ? chunk.c : chunk.d : any + >chunk.isInit(chunk) : boolean ->chunk.isInit : ((x: any) => this is Entry) | ((x: any) => false) -->chunk : Entry | Group ++>chunk.isInit : (x: any) => this is Entry | (x: any) => false + >chunk : Entry | Group ->isInit : ((x: any) => this is Entry) | ((x: any) => false) -->chunk : Entry | Group ++>isInit : (x: any) => this is Entry | (x: any) => false + >chunk : Entry | Group ->chunk.c : number -->chunk : Entry ++>chunk.c : any + >chunk : Entry ->c : number ->chunk.d : string -->chunk : Group -->d : string -+>x : any -+>chunk.isInit(chunk) ? chunk.c : chunk.d : any -+>chunk.isInit(chunk) : any -+>chunk.isInit : any -+>chunk : any -+>isInit : any -+>chunk : any -+>chunk.c : any -+>chunk : any +>c : any +>chunk.d : any -+>chunk : any + >chunk : Group +->d : string +>d : any return x @@ -74,18 +50,10 @@ /** @param {boolean | number} val */ function foo(val) { ->foo : (val: boolean | number) => void -->val : number | boolean -+>foo : (val: any) => void -+>val : any ++>foo : (val: number | boolean) => void + >val : number | boolean if (isBoolean(val)) { - >isBoolean(val) : boolean - >isBoolean : (value: any) => value is boolean -->val : number | boolean -+>val : any - - val; - >val : boolean @@= skipped -28, +28 lines =@@ /** @type {Cb} */ @@ -102,18 +70,12 @@ >"number" : "number" /** @param {unknown} x */ - function g(x) { -->g : (x: unknown) => void -->x : unknown -+>g : (x: any) => void -+>x : any +@@= skipped -14, +14 lines =@@ if (isNumber(x)) { >isNumber(x) : boolean ->isNumber : (x: unknown) => x is number -->x : unknown +>isNumber : (x: any) => x is number -+>x : any + >x : unknown x * 2; - >x * 2 : number diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/seeTag4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/seeTag4.types.diff new file mode 100644 index 0000000000..62d58d7a9f --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/seeTag4.types.diff @@ -0,0 +1,11 @@ +--- old.seeTag4.types ++++ new.seeTag4.types +@@= skipped -2, +2 lines =@@ + === seeTag4.js === + /** + * @typedef {any} A ++>A : any ++ + */ + + /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/syntaxErrors.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/syntaxErrors.types.diff deleted file mode 100644 index f4e09c027d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/syntaxErrors.types.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.syntaxErrors.types -+++ new.syntaxErrors.types -@@= skipped -10, +10 lines =@@ - // @ts-ignore - /** @param {C.} skipped */ - function f(x, y, skipped) { -->f : (x: any, y: any, skipped: C) => any -+>f : (x: any, y: any, skipped: any) => any - >x : any - >y : any -->skipped : C -+>skipped : any - - return x.t + y.t; - >x.t + y.t : any -@@= skipped -17, +17 lines =@@ - var x = f({ t: 1000 }, { t: 3000 }, { t: 5000 }); - >x : any - >f({ t: 1000 }, { t: 3000 }, { t: 5000 }) : any -->f : (x: any, y: any, skipped: C) => any -+>f : (x: any, y: any, skipped: any) => any - >{ t: 1000 } : { t: number; } - >t : number - >1000 : 1000 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.errors.txt.diff index 0bce3810f9..458377b651 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.errors.txt.diff @@ -6,6 +6,8 @@ -templateInsideCallback.js(9,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -templateInsideCallback.js(10,12): error TS2304: Cannot find name 'T'. -templateInsideCallback.js(15,11): error TS2315: Type 'Call' is not generic. ++templateInsideCallback.js(15,11): error TS2304: Cannot find name 'Call'. ++templateInsideCallback.js(15,16): error TS2304: Cannot find name 'T'. templateInsideCallback.js(17,18): error TS7006: Parameter 'x' implicitly has an 'any' type. -templateInsideCallback.js(23,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -templateInsideCallback.js(30,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag @@ -20,7 +22,7 @@ -!!! related TS7012 templateInsideCallback.js:29:5: This overload implicitly returns the type 'any' because it lacks a return type annotation. -!!! related TS7012 templateInsideCallback.js:37:5: This overload implicitly returns the type 'any' because it lacks a return type annotation. -==== templateInsideCallback.js (11 errors) ==== -+==== templateInsideCallback.js (1 errors) ==== ++==== templateInsideCallback.js (3 errors) ==== /** * @typedef Oops - ~~~~ @@ -28,7 +30,7 @@ * @template T * @property {T} a * @property {T} b -@@= skipped -27, +10 lines =@@ +@@= skipped -27, +12 lines =@@ /** * @callback Call * @template T @@ -44,10 +46,14 @@ * @type {Call} - ~~~~~~~ -!!! error TS2315: Type 'Call' is not generic. ++ ~~~~ ++!!! error TS2304: Cannot find name 'Call'. ++ ~ ++!!! error TS2304: Cannot find name 'T'. */ const identity = x => x; ~ -@@= skipped -22, +16 lines =@@ +@@= skipped -22, +20 lines =@@ * @property {Object} oh * @property {number} oh.no * @template T diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.types.diff index c6c1f66648..8b925683fb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.types.diff @@ -5,70 +5,50 @@ */ const identity = x => x; ->identity : any -->x => x : (x: any) => any -+>identity : (x: any) => any -+>x => x : (x: any) => any ++>identity : Call + >x => x : (x: any) => any >x : any >x : any -@@= skipped -34, +34 lines =@@ + /** + * @typedef Nested ++>Nested : Nested ++ + * @property {Object} oh ++>oh : any ++ + * @property {number} oh.no ++>property : any ++>oh : any ++>no : any ++ + * @template T + * @property {string} oh.noooooo ++>property : any ++>oh : any ++>noooooo : any ++ + */ + + +@@= skipped -34, +46 lines =@@ * @returns {unknown[]} */ function flatMap(array, iterable = identity) { ->flatMap : { (): any; (): any; } -->array : unknown[] -->iterable : (x: unknown) => unknown ++>flatMap : (array: unknown[], iterable?: (x: unknown) => unknown) => unknown[] + >array : unknown[] + >iterable : (x: unknown) => unknown ->identity : any -+>flatMap : (array: any, iterable?: (x: any) => any) => any[] -+>array : any -+>iterable : (x: any) => any -+>identity : (x: any) => any ++>identity : Call /** @type {unknown[]} */ const result = []; -->result : unknown[] -+>result : any[] - >[] : never[] - - for (let i = 0; i < array.length; i += 1) { -@@= skipped -15, +15 lines =@@ - >0 : 0 - >i < array.length : boolean - >i : number -->array.length : number -->array : unknown[] -->length : number -+>array.length : any -+>array : any -+>length : any - >i += 1 : number - >i : number - >1 : 1 - - result.push(.../** @type {unknown[]} */(iterable(array[i]))); - >result.push(.../** @type {unknown[]} */(iterable(array[i]))) : number -->result.push : (...items: unknown[]) => number -->result : unknown[] -->push : (...items: unknown[]) => number -->.../** @type {unknown[]} */(iterable(array[i])) : unknown -->(iterable(array[i])) : unknown[] -->iterable(array[i]) : unknown -->iterable : (x: unknown) => unknown -->array[i] : unknown -->array : unknown[] -+>result.push : (...items: any[]) => number -+>result : any[] -+>push : (...items: any[]) => number -+>.../** @type {unknown[]} */(iterable(array[i])) : any -+>(iterable(array[i])) : any -+>iterable(array[i]) : any -+>iterable : (x: any) => any -+>array[i] : any -+>array : any - >i : number - } - return result; -->result : unknown[] -+>result : any[] - } - +@@= skipped -29, +29 lines =@@ + >push : (...items: unknown[]) => number + >.../** @type {unknown[]} */(iterable(array[i])) : unknown + >(iterable(array[i])) : unknown[] ++>iterable(array[i]) : unknown[] + >iterable(array[i]) : unknown + >iterable : (x: unknown) => unknown + >array[i] : unknown diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/thisPropertyAssignmentInherited.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/thisPropertyAssignmentInherited.types.diff new file mode 100644 index 0000000000..8684595695 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/thisPropertyAssignmentInherited.types.diff @@ -0,0 +1,49 @@ +--- old.thisPropertyAssignmentInherited.types ++++ new.thisPropertyAssignmentInherited.types +@@= skipped -7, +7 lines =@@ + * @returns {String} + */ + get textContent() { +->textContent : string ++>textContent : String + + return '' + >'' : "" + } + set textContent(x) {} +->textContent : string +->x : string ++>textContent : String ++>x : String + + cloneNode() { return this} + >cloneNode : () => this +@@= skipped -22, +22 lines =@@ + >HTMLElement : HTMLElement + + get innerHTML() { return this.textContent; } +->innerHTML : string +->this.textContent : string ++>innerHTML : String ++>this.textContent : String + >this : this +->textContent : string ++>textContent : String + + set innerHTML(html) { this.textContent = html; } +->innerHTML : string +->html : string +->this.textContent = html : string +->this.textContent : string ++>innerHTML : String ++>html : String ++>this.textContent = html : String ++>this.textContent : String + >this : this +->textContent : string +->html : string ++>textContent : String ++>html : String + + toString() { + >toString : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/thisTag1.types.diff index b516e2cef8..50643a4e40 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/thisTag1.types.diff @@ -5,49 +5,44 @@ */ function f(s) { ->f : (this: { n: number; }, s: string) => number -->s : string -+>f : (s: any) => any -+>s : any ++>f : (s: string) => number + >s : string return this.n + s.length ->this.n + s.length : number ->this.n : number ->this : { n: number; } ->n : number -->s.length : number -->s : string -->length : number +>this.n + s.length : any +>this.n : any +>this : any +>n : any -+>s.length : any -+>s : any -+>length : any + >s.length : number + >s : string + >length : number } const o = { ->o : { f: (this: { n: number; }, s: string) => number; n: number; } ->{ f, n: 1} : { f: (this: { n: number; }, s: string) => number; n: number; } -+>o : { f: (s: any) => any; n: number; } -+>{ f, n: 1} : { f: (s: any) => any; n: number; } ++>o : { f: (s: string) => number; n: number; } ++>{ f, n: 1} : { f: (s: string) => number; n: number; } f, ->f : (this: { n: number; }, s: string) => number -+>f : (s: any) => any ++>f : (s: string) => number n: 1 >n : number - >1 : 1 +@@= skipped -26, +26 lines =@@ } o.f('hi') -->o.f('hi') : number + >o.f('hi') : number ->o.f : (this: { n: number; }, s: string) => number ->o : { f: (this: { n: number; }, s: string) => number; n: number; } ->f : (this: { n: number; }, s: string) => number -+>o.f('hi') : any -+>o.f : (s: any) => any -+>o : { f: (s: any) => any; n: number; } -+>f : (s: any) => any ++>o.f : (s: string) => number ++>o : { f: (s: string) => number; n: number; } ++>f : (s: string) => number >'hi' : "hi" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.types.diff index 13c4636b9c..04caa8ef53 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.types.diff @@ -1,22 +1,24 @@ --- old.thisTag3.types +++ new.thisTag3.types -@@= skipped -12, +12 lines =@@ +@@= skipped -2, +2 lines =@@ + === /a.js === + /** + * @typedef {{fn(a: string): void}} T ++>T : any ++>fn : (a: string) => void ++>a : string ++ + */ + + class C { +@@= skipped -10, +14 lines =@@ * @param {string} a */ p = (a) => this.fn("" + a); ->p : (this: T, a: string) => any ->(a) => this.fn("" + a) : (this: T, a: string) => any -->a : string -+>p : (a: any) => any -+>(a) => this.fn("" + a) : (a: any) => any -+>a : any ++>p : (a: string) => any ++>(a) => this.fn("" + a) : (a: string) => any + >a : string >this.fn("" + a) : any >this.fn : any - >this : this - >fn : any - >"" + a : string - >"" : "" -->a : string -+>a : any - } - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/thisTypeOfConstructorFunctions.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/thisTypeOfConstructorFunctions.errors.txt.diff new file mode 100644 index 0000000000..ad89e66e54 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/thisTypeOfConstructorFunctions.errors.txt.diff @@ -0,0 +1,66 @@ +--- old.thisTypeOfConstructorFunctions.errors.txt ++++ new.thisTypeOfConstructorFunctions.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++thisTypeOfConstructorFunctions.js(15,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface. ++thisTypeOfConstructorFunctions.js(38,12): error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? ++thisTypeOfConstructorFunctions.js(41,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? ++thisTypeOfConstructorFunctions.js(43,12): error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? ++ ++ ++==== thisTypeOfConstructorFunctions.js (4 errors) ==== ++ /** ++ * @class ++ * @template T ++ * @param {T} t ++ */ ++ function Cp(t) { ++ /** @type {this} */ ++ this.dit = this ++ this.y = t ++ /** @return {this} */ ++ this.m3 = () => this ++ } ++ ++ Cp.prototype = { ++ /** @return {this} */ ++ ~~~~ ++!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. ++ m4() { ++ this.z = this.y; return this ++ } ++ } ++ ++ /** ++ * @class ++ * @template T ++ * @param {T} t ++ */ ++ function Cpp(t) { ++ this.y = t ++ } ++ /** @return {this} */ ++ Cpp.prototype.m2 = function () { ++ this.z = this.y; return this ++ } ++ ++ var cp = new Cp(1) ++ var cpp = new Cpp(2) ++ cp.dit ++ ++ /** @type {Cpp} */ ++ ~~~ ++!!! error TS2749: 'Cpp' refers to a value, but is being used as a type here. Did you mean 'typeof Cpp'? ++ var cppn = cpp.m2() ++ ++ /** @type {Cp} */ ++ ~~ ++!!! error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? ++ var cpn = cp.m3() ++ /** @type {Cp} */ ++ ~~ ++!!! error TS2749: 'Cp' refers to a value, but is being used as a type here. Did you mean 'typeof Cp'? ++ var cpn = cp.m4() ++ ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/thisTypeOfConstructorFunctions.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/thisTypeOfConstructorFunctions.types.diff index f80f1e19f7..a6eb6b1c7c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/thisTypeOfConstructorFunctions.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/thisTypeOfConstructorFunctions.types.diff @@ -5,9 +5,8 @@ */ function Cp(t) { ->Cp : typeof Cp -->t : T -+>Cp : { (t: any): void; prototype: { m4: () => any; }; } -+>t : any ++>Cp : { (t: T): void; prototype: { m4: () => any; }; } + >t : T /** @type {this} */ this.dit = this @@ -23,14 +22,12 @@ +>this : any this.y = t -->this.y = t : T -+>this.y = t : any + >this.y = t : T >this.y : any ->this : this +>this : any >y : any -->t : T -+>t : any + >t : T /** @return {this} */ this.m3 = () => this @@ -54,7 +51,7 @@ ->{ /** @return {this} */ m4() { this.z = this.y; return this }} : { m4(): this; } +>Cp.prototype = { /** @return {this} */ m4() { this.z = this.y; return this }} : { m4: () => any; } +>Cp.prototype : { m4: () => any; } -+>Cp : { (t: any): void; prototype: { m4: () => any; }; } ++>Cp : { (t: T): void; prototype: { m4: () => any; }; } +>prototype : { m4: () => any; } +>{ /** @return {this} */ m4() { this.z = this.y; return this }} : { m4: () => any; } @@ -88,19 +85,16 @@ */ function Cpp(t) { ->Cpp : typeof Cpp -->t : T -+>Cpp : (t: any) => void -+>t : any ++>Cpp : (t: T) => void + >t : T this.y = t -->this.y = t : T -+>this.y = t : any + >this.y = t : T >this.y : any ->this : this +>this : any >y : any -->t : T -+>t : any + >t : T } /** @return {this} */ Cpp.prototype.m2 = function () { @@ -109,7 +103,7 @@ >Cpp.prototype.m2 : any >Cpp.prototype : any ->Cpp : typeof Cpp -+>Cpp : (t: any) => void ++>Cpp : (t: T) => void >prototype : any >m2 : any ->function () { this.z = this.y; return this} : () => this @@ -140,7 +134,7 @@ ->Cp : typeof Cp +>cp : any +>new Cp(1) : any -+>Cp : { (t: any): void; prototype: { m4: () => any; }; } ++>Cp : { (t: T): void; prototype: { m4: () => any; }; } >1 : 1 var cpp = new Cpp(2) @@ -149,7 +143,7 @@ ->Cpp : typeof Cpp +>cpp : any +>new Cpp(2) : any -+>Cpp : (t: any) => void ++>Cpp : (t: T) => void >2 : 2 cp.dit @@ -162,12 +156,11 @@ /** @type {Cpp} */ var cppn = cpp.m2() -->cppn : Cpp + >cppn : Cpp ->cpp.m2() : Cpp ->cpp.m2 : () => Cpp ->cpp : Cpp ->m2 : () => Cpp -+>cppn : any +>cpp.m2() : any +>cpp.m2 : any +>cpp : any @@ -175,12 +168,11 @@ /** @type {Cp} */ var cpn = cp.m3() -->cpn : Cp + >cpn : Cp ->cp.m3() : Cp ->cp.m3 : () => Cp ->cp : Cp ->m3 : () => Cp -+>cpn : any +>cp.m3() : any +>cp.m3 : any +>cp : any @@ -188,12 +180,11 @@ /** @type {Cp} */ var cpn = cp.m4() -->cpn : Cp + >cpn : Cp ->cp.m4() : Cp ->cp.m4 : () => Cp ->cp : Cp ->m4 : () => Cp -+>cpn : any +>cp.m4() : any +>cp.m4 : any +>cp : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromContextualThisType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromContextualThisType.errors.txt.diff deleted file mode 100644 index 025e58a5f6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromContextualThisType.errors.txt.diff +++ /dev/null @@ -1,29 +0,0 @@ ---- old.typeFromContextualThisType.errors.txt -+++ new.typeFromContextualThisType.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+bug25926.js(4,18): error TS7006: Parameter 'n' implicitly has an 'any' type. -+bug25926.js(11,27): error TS7006: Parameter 'm' implicitly has an 'any' type. -+ -+ -+==== bug25926.js (2 errors) ==== -+ /** @type {{ a(): void; b?(n: number): number; }} */ -+ const o1 = { -+ a() { -+ this.b = n => n; -+ ~ -+!!! error TS7006: Parameter 'n' implicitly has an 'any' type. -+ } -+ }; -+ -+ /** @type {{ d(): void; e?(n: number): number; f?(n: number): number; g?: number }} */ -+ const o2 = { -+ d() { -+ this.e = this.f = m => this.g || m; -+ ~ -+!!! error TS7006: Parameter 'm' implicitly has an 'any' type. -+ } -+ }; -+ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromContextualThisType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromContextualThisType.types.diff index 6a31f32550..5678076671 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromContextualThisType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromContextualThisType.types.diff @@ -6,71 +6,56 @@ const o1 = { ->o1 : { a(): void; b?(n: number): number; } ->{ a() { this.b = n => n; }} : { a(): void; } -+>o1 : { a: () => void; } ++>o1 : { a: () => void; b?: (n: number) => number | undefined; } +>{ a() { this.b = n => n; }} : { a: () => void; } a() { >a : () => void this.b = n => n; -->this.b = n => n : (n: number) => number + >this.b = n => n : (n: number) => number ->this.b : ((n: number) => number) | undefined ->this : { a(): void; b?(n: number): number; } ->b : ((n: number) => number) | undefined -->n => n : (n: number) => number -->n : number -->n : number -+>this.b = n => n : (n: any) => any -+>this.b : any -+>this : { a: () => void; } -+>b : any -+>n => n : (n: any) => any -+>n : any -+>n : any - } - }; ++>this.b : (n: number) => number | undefined ++>this : { a: () => void; b?: (n: number) => number | undefined; } ++>b : (n: number) => number | undefined + >n => n : (n: number) => number + >n : number + >n : number +@@= skipped -19, +19 lines =@@ /** @type {{ d(): void; e?(n: number): number; f?(n: number): number; g?: number }} */ const o2 = { ->o2 : { d(): void; e?(n: number): number; f?(n: number): number; g?: number; } ->{ d() { this.e = this.f = m => this.g || m; }} : { d(): void; } -+>o2 : { d: () => void; } ++>o2 : { d: () => void; e?: (n: number) => number | undefined; f?: (n: number) => number | undefined; g?: number | undefined; } +>{ d() { this.e = this.f = m => this.g || m; }} : { d: () => void; } d() { >d : () => void this.e = this.f = m => this.g || m; -->this.e = this.f = m => this.g || m : (m: number) => number + >this.e = this.f = m => this.g || m : (m: number) => number ->this.e : ((n: number) => number) | undefined ->this : { d(): void; e?(n: number): number; f?(n: number): number; g?: number; } ->e : ((n: number) => number) | undefined -->this.f = m => this.g || m : (m: number) => number ++>this.e : (n: number) => number | undefined ++>this : { d: () => void; e?: (n: number) => number | undefined; f?: (n: number) => number | undefined; g?: number | undefined; } ++>e : (n: number) => number | undefined + >this.f = m => this.g || m : (m: number) => number ->this.f : ((n: number) => number) | undefined ->this : { d(): void; e?(n: number): number; f?(n: number): number; g?: number; } ->f : ((n: number) => number) | undefined -->m => this.g || m : (m: number) => number -->m : number -->this.g || m : number -->this.g : number | undefined ++>this.f : (n: number) => number | undefined ++>this : { d: () => void; e?: (n: number) => number | undefined; f?: (n: number) => number | undefined; g?: number | undefined; } ++>f : (n: number) => number | undefined + >m => this.g || m : (m: number) => number + >m : number + >this.g || m : number + >this.g : number | undefined ->this : { d(): void; e?(n: number): number; f?(n: number): number; g?: number; } -->g : number | undefined -->m : number -+>this.e = this.f = m => this.g || m : (m: any) => any -+>this.e : any -+>this : { d: () => void; } -+>e : any -+>this.f = m => this.g || m : (m: any) => any -+>this.f : any -+>this : { d: () => void; } -+>f : any -+>m => this.g || m : (m: any) => any -+>m : any -+>this.g || m : any -+>this.g : any -+>this : { d: () => void; } -+>g : any -+>m : any ++>this : { d: () => void; e?: (n: number) => number | undefined; f?: (n: number) => number | undefined; g?: number | undefined; } + >g : number | undefined + >m : number } - }; - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer.errors.txt.diff index 55300f97e4..627d899f5b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer.errors.txt.diff @@ -11,10 +11,9 @@ a.js(30,5): error TS2322: Type 'true' is not assignable to type 'null'. a.js(31,5): error TS2322: Type '{}' is not assignable to type 'null'. a.js(32,5): error TS2322: Type '"ok"' is not assignable to type 'null'. --a.js(37,5): error TS2322: Type 'string' is not assignable to type 'number'. + a.js(37,5): error TS2322: Type 'string' is not assignable to type 'number'. +a.js(40,12): error TS2345: Argument of type '1' is not assignable to parameter of type 'never'. +a.js(41,12): error TS2345: Argument of type '"ok"' is not assignable to parameter of type 'never'. -+a.js(56,17): error TS7006: Parameter 'v' implicitly has an 'any' type. -==== a.js (10 errors) ==== @@ -46,12 +45,7 @@ // a should be null in strict mode a = undefined ~ -@@= skipped -24, +22 lines =@@ - b = 1 - b = undefined - b = 'error' -- ~ --!!! error TS2322: Type 'string' is not assignable to type 'number'. +@@= skipped -29, +27 lines =@@ // l should be any[] l.push(1) @@ -63,12 +57,3 @@ } // should get any on variable initialisers -@@= skipped -21, +23 lines =@@ - - /** @type {(v: unknown) => v is undefined} */ - const isUndef = v => v === undefined; -+ ~ -+!!! error TS7006: Parameter 'v' implicitly has an 'any' type. - const e = [1, undefined]; - - // should be undefined[] diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer.types.diff index ca15caa722..eff302c05c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer.types.diff @@ -164,44 +164,21 @@ >'hi' : "hi" /** @type {number | undefined} */ - var n; -->n : number | undefined -+>n : any +@@= skipped -126, +126 lines =@@ // should get any on parameter initialisers function f(a = null, b = n, l = []) { ->f : (a?: null, b?: number | undefined, l?: any[]) => void -+>f : (a?: null, b?: any, l?: never[]) => void ++>f : (a?: null, b?: number | undefined, l?: never[]) => void >a : null -->b : number | undefined -->n : number | undefined + >b : number | undefined + >n : number | undefined ->l : any[] -+>b : any -+>n : any +>l : never[] >[] : never[] // a should be null in strict mode -@@= skipped -166, +166 lines =@@ - // b should be number | undefined, not any - b = 1 - >b = 1 : 1 -->b : number | undefined -+>b : any - >1 : 1 - - b = undefined - >b = undefined : undefined -->b : number | undefined -+>b : any - >undefined : undefined - - b = 'error' - >b = 'error' : "error" -->b : number | undefined -+>b : any - >'error' : "error" - +@@= skipped -56, +56 lines =@@ // l should be any[] l.push(1) >l.push(1) : number @@ -224,33 +201,3 @@ >'ok' : "ok" } -@@= skipped -72, +72 lines =@@ - - /** @type {(v: unknown) => v is undefined} */ - const isUndef = v => v === undefined; -->isUndef : (v: unknown) => v is undefined -->v => v === undefined : (v: unknown) => v is undefined -->v : unknown -+>isUndef : (v: any) => boolean -+>v => v === undefined : (v: any) => boolean -+>v : any - >v === undefined : boolean -->v : unknown -+>v : any - >undefined : undefined - - const e = [1, undefined]; -@@= skipped -15, +15 lines =@@ - - // should be undefined[] - const g = e.filter(isUndef); -->g : undefined[] -->e.filter(isUndef) : undefined[] -+>g : (number | undefined)[] -+>e.filter(isUndef) : (number | undefined)[] - >e.filter : { (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => unknown, thisArg?: any): (number | undefined)[]; } - >e : (number | undefined)[] - >filter : { (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => unknown, thisArg?: any): (number | undefined)[]; } -->isUndef : (v: unknown) => v is undefined -+>isUndef : (v: any) => boolean - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer4.errors.txt.diff deleted file mode 100644 index 86d203d0e2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer4.errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.typeFromJSInitializer4.errors.txt -+++ new.typeFromJSInitializer4.errors.txt -@@= skipped -0, +0 lines =@@ - a.js(5,12): error TS7006: Parameter 'a' implicitly has an 'any' type. - a.js(5,29): error TS7006: Parameter 'l' implicitly has an 'any[]' type. --a.js(17,5): error TS2322: Type 'string' is not assignable to type 'number'. - - --==== a.js (3 errors) ==== -+==== a.js (2 errors) ==== - /** @type {number | undefined} */ - var n; - -@@= skipped -24, +23 lines =@@ - b = 1 - b = undefined - b = 'error' -- ~ --!!! error TS2322: Type 'string' is not assignable to type 'number'. - - // l should be any[] - l.push(1) diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer4.types.diff deleted file mode 100644 index a46c728105..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromJSInitializer4.types.diff +++ /dev/null @@ -1,42 +0,0 @@ ---- old.typeFromJSInitializer4.types -+++ new.typeFromJSInitializer4.types -@@= skipped -2, +2 lines =@@ - === a.js === - /** @type {number | undefined} */ - var n; -->n : number -+>n : any - - // should get any on parameter initialisers - function f(a = null, b = n, l = []) { -->f : (a?: any, b?: number, l?: any[]) => void -+>f : (a?: any, b?: any, l?: any[]) => void - >a : any -->b : number -->n : number -+>b : any -+>n : any - >l : any[] - >[] : undefined[] - -@@= skipped -44, +44 lines =@@ - // b should be number | undefined, not any - b = 1 - >b = 1 : 1 -->b : number -+>b : any - >1 : 1 - - b = undefined - >b = undefined : undefined -->b : number -+>b : any - >undefined : undefined - - b = 'error' - >b = 'error' : "error" -->b : number -+>b : any - >'error' : "error" - - // l should be any[] diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.errors.txt.diff index 9b8e49178a..1f35e42090 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.errors.txt.diff @@ -3,9 +3,17 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++a.js(3,13): error TS2749: 'A' refers to a value, but is being used as a type here. Did you mean 'typeof A'? +b-ext.js(3,14): error TS2339: Property 'x' does not exist on type 'B'. ++b.js(3,13): error TS2749: 'B' refers to a value, but is being used as a type here. Did you mean 'typeof B'? ++c.js(3,13): error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? ++d.js(3,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? +e-ext.js(3,14): error TS2339: Property 'x' does not exist on type 'E'. ++e.js(3,13): error TS2749: 'E' refers to a value, but is being used as a type here. Did you mean 'typeof E'? ++f.js(5,13): error TS2749: 'F' refers to a value, but is being used as a type here. Did you mean 'typeof F'? ++g.js(5,13): error TS2749: 'G' refers to a value, but is being used as a type here. Did you mean 'typeof G'? +h.js(3,14): error TS2339: Property 'x' does not exist on type 'H'. ++h.js(8,19): error TS2339: Property 'x' does not exist on type 'H'. + + +==== node.d.ts (0 errors) ==== @@ -17,10 +25,12 @@ + this.x = 1; + }; + -+==== a.js (0 errors) ==== ++==== a.js (1 errors) ==== + const { A } = require("./a-ext"); + + /** @param {A} p */ ++ ~ ++!!! error TS2749: 'A' refers to a value, but is being used as a type here. Did you mean 'typeof A'? + function a(p) { p.x; } + +==== b-ext.js (1 errors) ==== @@ -32,10 +42,12 @@ + } + }; + -+==== b.js (0 errors) ==== ++==== b.js (1 errors) ==== + const { B } = require("./b-ext"); + + /** @param {B} p */ ++ ~ ++!!! error TS2749: 'B' refers to a value, but is being used as a type here. Did you mean 'typeof B'? + function b(p) { p.x; } + +==== c-ext.js (0 errors) ==== @@ -43,10 +55,12 @@ + this.x = 1; + } + -+==== c.js (0 errors) ==== ++==== c.js (1 errors) ==== + const { C } = require("./c-ext"); + + /** @param {C} p */ ++ ~ ++!!! error TS2749: 'C' refers to a value, but is being used as a type here. Did you mean 'typeof C'? + function c(p) { p.x; } + +==== d-ext.js (0 errors) ==== @@ -54,10 +68,12 @@ + this.x = 1; + }; + -+==== d.js (0 errors) ==== ++==== d.js (1 errors) ==== + const { D } = require("./d-ext"); + + /** @param {D} p */ ++ ~ ++!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? + function d(p) { p.x; } + +==== e-ext.js (1 errors) ==== @@ -69,29 +85,35 @@ + } + } + -+==== e.js (0 errors) ==== ++==== e.js (1 errors) ==== + const { E } = require("./e-ext"); + + /** @param {E} p */ ++ ~ ++!!! error TS2749: 'E' refers to a value, but is being used as a type here. Did you mean 'typeof E'? + function e(p) { p.x; } + -+==== f.js (0 errors) ==== ++==== f.js (1 errors) ==== + var F = function () { + this.x = 1; + }; + + /** @param {F} p */ ++ ~ ++!!! error TS2749: 'F' refers to a value, but is being used as a type here. Did you mean 'typeof F'? + function f(p) { p.x; } + -+==== g.js (0 errors) ==== ++==== g.js (1 errors) ==== + function G() { + this.x = 1; + } + + /** @param {G} p */ ++ ~ ++!!! error TS2749: 'G' refers to a value, but is being used as a type here. Did you mean 'typeof G'? + function g(p) { p.x; } + -+==== h.js (1 errors) ==== ++==== h.js (2 errors) ==== + class H { + constructor() { + this.x = 1; @@ -102,3 +124,5 @@ + + /** @param {H} p */ + function h(p) { p.x; } ++ ~ ++!!! error TS2339: Property 'x' does not exist on type 'H'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff index 114c2049c0..70f281743d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff @@ -34,17 +34,14 @@ >require : (id: string) => any >"./a-ext" : "./a-ext" - /** @param {A} p */ +@@= skipped -9, +9 lines =@@ function a(p) { p.x; } -->a : (p: A) => void -->p : A + >a : (p: A) => void + >p : A ->p.x : number -->p : A -->x : number -+>a : (p: any) => void -+>p : any +>p.x : any -+>p : any + >p : A +->x : number +>x : any === b-ext.js === @@ -59,7 +56,7 @@ >class { constructor() { this.x = 1; }} : typeof B constructor() { -@@= skipped -33, +33 lines =@@ +@@= skipped -24, +24 lines =@@ === b.js === const { B } = require("./b-ext"); @@ -70,17 +67,14 @@ >require : (id: string) => any >"./b-ext" : "./b-ext" - /** @param {B} p */ +@@= skipped -9, +9 lines =@@ function b(p) { p.x; } -->b : (p: B) => void -->p : B + >b : (p: B) => void + >p : B ->p.x : number -->p : B -->x : number -+>b : (p: any) => void -+>p : any +>p.x : any -+>p : any + >p : B +->x : number +>x : any === c-ext.js === @@ -106,17 +100,14 @@ >require : (id: string) => any >"./c-ext" : "./c-ext" - /** @param {C} p */ +@@= skipped -27, +27 lines =@@ function c(p) { p.x; } -->c : (p: C) => void -->p : C + >c : (p: C) => void + >p : C ->p.x : number -->p : C -->x : number -+>c : (p: any) => void -+>p : any +>p.x : any -+>p : any + >p : C +->x : number +>x : any === d-ext.js === @@ -134,7 +125,7 @@ >x : any >1 : 1 -@@= skipped -56, +56 lines =@@ +@@= skipped -20, +20 lines =@@ === d.js === const { D } = require("./d-ext"); @@ -145,22 +136,19 @@ >require : (id: string) => any >"./d-ext" : "./d-ext" - /** @param {D} p */ +@@= skipped -9, +9 lines =@@ function d(p) { p.x; } -->d : (p: D) => void -->p : D + >d : (p: D) => void + >p : D ->p.x : number -->p : D -->x : number -+>d : (p: any) => void -+>p : any +>p.x : any -+>p : any + >p : D +->x : number +>x : any === e-ext.js === export class E { -@@= skipped -29, +29 lines =@@ +@@= skipped -20, +20 lines =@@ === e.js === const { E } = require("./e-ext"); @@ -171,17 +159,14 @@ >require : (id: string) => any >"./e-ext" : "./e-ext" - /** @param {E} p */ +@@= skipped -9, +9 lines =@@ function e(p) { p.x; } -->e : (p: E) => void -->p : E + >e : (p: E) => void + >p : E ->p.x : number -->p : E -->x : number -+>e : (p: any) => void -+>p : any +>p.x : any -+>p : any + >p : E +->x : number +>x : any === f.js === @@ -199,19 +184,14 @@ >x : any >1 : 1 -@@= skipped -29, +29 lines =@@ - - /** @param {F} p */ +@@= skipped -22, +22 lines =@@ function f(p) { p.x; } -->f : (p: F) => void -->p : F + >f : (p: F) => void + >p : F ->p.x : number -->p : F -->x : number -+>f : (p: any) => void -+>p : any +>p.x : any -+>p : any + >p : F +->x : number +>x : any === g.js === @@ -227,34 +207,25 @@ >x : any >1 : 1 } - - /** @param {G} p */ +@@= skipped -20, +20 lines =@@ function g(p) { p.x; } -->g : (p: G) => void -->p : G + >g : (p: G) => void + >p : G ->p.x : number -->p : G -->x : number -+>g : (p: any) => void -+>p : any +>p.x : any -+>p : any + >p : G +->x : number +>x : any === h.js === class H { -@@= skipped -42, +42 lines =@@ - - /** @param {H} p */ +@@= skipped -22, +22 lines =@@ function h(p) { p.x; } -->h : (p: H) => void -->p : H + >h : (p: H) => void + >p : H ->p.x : number -->p : H -->x : number -+>h : (p: any) => void -+>p : any +>p.x : any -+>p : any + >p : H +->x : number +>x : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrivatePropertyAssignmentJs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrivatePropertyAssignmentJs.types.diff deleted file mode 100644 index e7d7ff0d52..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrivatePropertyAssignmentJs.types.diff +++ /dev/null @@ -1,40 +0,0 @@ ---- old.typeFromPrivatePropertyAssignmentJs.types -+++ new.typeFromPrivatePropertyAssignmentJs.types -@@= skipped -7, +7 lines =@@ - - /** @type {{ foo?: string } | undefined } */ - #a; -->#a : { foo?: string; } -+>#a : any - - /** @type {{ foo?: string } | undefined } */ - #b; -->#b : { foo?: string; } -+>#b : any - - m() { - >m : () => void - - const a = this.#a || {}; -->a : { foo?: string; } -->this.#a || {} : { foo?: string; } -->this.#a : { foo?: string; } -+>a : any -+>this.#a || {} : any -+>this.#a : any - >this : this - >{} : {} - - this.#b = this.#b || {}; -->this.#b = this.#b || {} : { foo?: string; } -->this.#b : { foo?: string; } -+>this.#b = this.#b || {} : any -+>this.#b : any - >this : this -->this.#b || {} : { foo?: string; } -->this.#b : { foo?: string; } -+>this.#b || {} : any -+>this.#b : any - >this : this - >{} : {} - } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment.errors.txt.diff index 9ba0b36eb2..e664ba81d5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment.errors.txt.diff @@ -4,9 +4,11 @@ - @@= skipped --1, +1 lines =@@ +a.js(4,7): error TS2339: Property 'Inner' does not exist on type 'typeof O'. ++a.js(8,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? ++a.js(11,12): error TS2503: Cannot find namespace 'Outer'. + + -+==== a.js (1 errors) ==== ++==== a.js (3 errors) ==== + var Outer = class O { + m(x, y) { } + } @@ -17,9 +19,13 @@ + + } + /** @type {Outer} */ ++ ~~~~~ ++!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? + var si + si.m + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var oi + oi.n + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment.types.diff index 4b7e36e323..1033acc3a8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment.types.diff @@ -17,27 +17,27 @@ /** @type {Outer} */ var si ->si : O -+>si : any ++>si : Outer si.m ->si.m : (x: any, y: any) => void ->si : O ->m : (x: any, y: any) => void +>si.m : any -+>si : any ++>si : Outer +>m : any /** @type {Outer.Inner} */ var oi ->oi : I -+>oi : any ++>oi : Inner oi.n ->oi.n : (a: any, b: any) => void ->oi : I ->n : (a: any, b: any) => void +>oi.n : any -+>oi : any ++>oi : Inner +>n : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10.errors.txt.diff index 9f8abcdd71..97079b8545 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10.errors.txt.diff @@ -3,6 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++main.js(4,12): error TS2503: Cannot find namespace 'Outer'. +someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. + + @@ -44,11 +45,13 @@ + }; + return Application; + })(); -+==== main.js (0 errors) ==== ++==== main.js (1 errors) ==== + var app = new Outer.app.Application(); + var inner = new Outer.app.Inner(); + inner.y; + /** @type {Outer.app.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var x; + x.y; + Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10.types.diff index 98ed7e19e4..73beb34e90 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10.types.diff @@ -229,15 +229,13 @@ /** @type {Outer.app.Inner} */ var x; -->x : Inner -+>x : any + >x : Inner x.y; ->x.y : number -->x : Inner -->y : number +>x.y : any -+>x : any + >x : Inner +->y : number +>y : any Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10_1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10_1.errors.txt.diff index 2e5bbae387..86f508d4ff 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10_1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10_1.errors.txt.diff @@ -3,6 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++main.js(4,12): error TS2503: Cannot find namespace 'Outer'. +someview.js(10,14): error TS2339: Property 'y' does not exist on type 'Inner'. + + @@ -44,11 +45,13 @@ + }; + return Application; + })(); -+==== main.js (0 errors) ==== ++==== main.js (1 errors) ==== + var app = new Outer.app.Application(); + var inner = new Outer.app.Inner(); + inner.y; + /** @type {Outer.app.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var x; + x.y; + Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10_1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10_1.types.diff index 5e1fbbc7ae..b516be9775 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10_1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment10_1.types.diff @@ -229,15 +229,13 @@ /** @type {Outer.app.Inner} */ var x; -->x : Inner -+>x : any + >x : Inner x.y; ->x.y : number -->x : Inner -->y : number +>x.y : any -+>x : any + >x : Inner +->y : number +>y : any Outer.app.statische(101); // Infinity, duh diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment14.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment14.errors.txt.diff index 1b358dcf1a..709710d9f3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment14.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment14.errors.txt.diff @@ -3,6 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++use.js(1,12): error TS2503: Cannot find namespace 'Outer'. +use.js(5,22): error TS2339: Property 'Inner' does not exist on type '{}'. +work.js(1,7): error TS2339: Property 'Inner' does not exist on type '{}'. +work.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. @@ -22,8 +23,10 @@ + m() { } + } + -+==== use.js (1 errors) ==== ++==== use.js (2 errors) ==== + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var inner + inner.x + inner.m() diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment14.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment14.types.diff index 39fb252707..d5de076c03 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment14.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment14.types.diff @@ -39,29 +39,23 @@ x: 1, >x : number -@@= skipped -31, +31 lines =@@ - === use.js === - /** @type {Outer.Inner} */ - var inner -->inner : Inner -+>inner : any +@@= skipped -34, +34 lines =@@ + >inner : Inner inner.x ->inner.x : number -->inner : Inner -->x : number +>inner.x : any -+>inner : any + >inner : Inner +->x : number +>x : any inner.m() ->inner.m() : void ->inner.m : () => void -->inner : Inner -->m : () => void +>inner.m() : any +>inner.m : any -+>inner : any + >inner : Inner +->m : () => void +>m : any var inno = new Outer.Inner() diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment15.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment15.errors.txt.diff index c885063aab..5079f95655 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment15.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment15.errors.txt.diff @@ -5,10 +5,11 @@ @@= skipped --1, +1 lines =@@ +a.js(3,7): error TS2339: Property 'Inner' does not exist on type '{}'. +a.js(5,14): error TS2339: Property 'x' does not exist on type 'Inner'. ++a.js(10,12): error TS2503: Cannot find namespace 'Outer'. +a.js(14,22): error TS2339: Property 'Inner' does not exist on type '{}'. + + -+==== a.js (3 errors) ==== ++==== a.js (4 errors) ==== + var Outer = {}; + + Outer.Inner = class { @@ -23,6 +24,8 @@ + } + + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var inner + inner.x + inner.m() diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment15.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment15.types.diff index 85a4de6536..4f37048588 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment15.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment15.types.diff @@ -19,29 +19,23 @@ >class { constructor() { this.x = 1 } m() { }} : typeof Inner constructor() { -@@= skipped -24, +24 lines =@@ - - /** @type {Outer.Inner} */ - var inner -->inner : Inner -+>inner : any +@@= skipped -27, +27 lines =@@ + >inner : Inner inner.x ->inner.x : number -->inner : Inner -->x : number +>inner.x : any -+>inner : any + >inner : Inner +->x : number +>x : any inner.m() ->inner.m() : void ->inner.m : () => void -->inner : Inner -->m : () => void +>inner.m() : any +>inner.m : any -+>inner : any + >inner : Inner +->m : () => void +>m : any var inno = new Outer.Inner() diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment16.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment16.errors.txt.diff index d6e59f438d..4e3e2fba37 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment16.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment16.errors.txt.diff @@ -5,10 +5,11 @@ @@= skipped --1, +1 lines =@@ +a.js(3,7): error TS2339: Property 'Inner' does not exist on type '{}'. +a.js(4,7): error TS2339: Property 'Inner' does not exist on type '{}'. ++a.js(9,12): error TS2503: Cannot find namespace 'Outer'. +a.js(13,22): error TS2339: Property 'Inner' does not exist on type '{}'. + + -+==== a.js (3 errors) ==== ++==== a.js (4 errors) ==== + var Outer = {}; + + Outer.Inner = function () {} @@ -22,6 +23,8 @@ + } + + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var inner + inner.x + inner.m() diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment16.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment16.types.diff index 3db28a4f32..adab055b2c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment16.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment16.types.diff @@ -38,29 +38,23 @@ x: 1, >x : number -@@= skipped -29, +29 lines =@@ - - /** @type {Outer.Inner} */ - var inner -->inner : Inner -+>inner : any +@@= skipped -32, +32 lines =@@ + >inner : Inner inner.x ->inner.x : number -->inner : Inner -->x : number +>inner.x : any -+>inner : any + >inner : Inner +->x : number +>x : any inner.m() ->inner.m() : void ->inner.m : () => void -->inner : Inner -->m : () => void +>inner.m() : any +>inner.m : any -+>inner : any + >inner : Inner +->m : () => void +>m : any var inno = new Outer.Inner() diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment2.errors.txt.diff index 4fb290638b..cca49f15f0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment2.errors.txt.diff @@ -4,9 +4,11 @@ - @@= skipped --1, +1 lines =@@ +a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. ++a.js(9,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? ++a.js(12,12): error TS2503: Cannot find namespace 'Outer'. + + -+==== a.js (1 errors) ==== ++==== a.js (3 errors) ==== + function Outer() { + this.y = 2 + } @@ -18,9 +20,13 @@ + } + } + /** @type {Outer} */ ++ ~~~~~ ++!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? + var ok + ok.y + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var oc + oc.x + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment2.types.diff index 636477172b..aea9aa8662 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment2.types.diff @@ -23,31 +23,26 @@ >Inner : typeof I >class I { constructor() { this.x = 1 }} : typeof I >I : typeof I -@@= skipped -28, +28 lines =@@ - } - /** @type {Outer} */ - var ok -->ok : Outer -+>ok : any +@@= skipped -31, +31 lines =@@ + >ok : Outer ok.y ->ok.y : number -->ok : Outer -->y : number +>ok.y : any -+>ok : any + >ok : Outer +->y : number +>y : any /** @type {Outer.Inner} */ var oc ->oc : I -+>oc : any ++>oc : Inner oc.x ->oc.x : number ->oc : I ->x : number +>oc.x : any -+>oc : any ++>oc : Inner +>x : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment24.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment24.errors.txt.diff index 794b24d9de..3a0a45820f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment24.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment24.errors.txt.diff @@ -6,9 +6,10 @@ +def.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. +usage.js(2,7): error TS2339: Property 'Inner' does not exist on type '{}'. +usage.js(5,19): error TS2339: Property 'Inner' does not exist on type '{}'. ++usage.js(7,12): error TS2503: Cannot find namespace 'Outer'. + + -+==== usage.js (2 errors) ==== ++==== usage.js (3 errors) ==== + // note that usage is first in the compilation + Outer.Inner.Message = function() { + ~~~~~ @@ -20,6 +21,8 @@ +!!! error TS2339: Property 'Inner' does not exist on type '{}'. + y.name + /** @type {Outer.Inner} should be instance type, not static type */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var x; + x.name + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment24.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment24.types.diff index 84e7dee675..b58936acfc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment24.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment24.types.diff @@ -40,15 +40,13 @@ /** @type {Outer.Inner} should be instance type, not static type */ var x; -->x : Inner -+>x : any + >x : Inner x.name ->x.name : () => string -->x : Inner -->name : () => string +>x.name : any -+>x : any + >x : Inner +->name : () => string +>name : any === def.js === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment3.errors.txt.diff index f2a1bb765e..4531ff7bdf 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment3.errors.txt.diff @@ -5,9 +5,11 @@ @@= skipped --1, +1 lines =@@ +a.js(4,7): error TS2339: Property 'Inner' does not exist on type '() => void'. +a.js(6,14): error TS2339: Property 'x' does not exist on type 'I'. ++a.js(9,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? ++a.js(12,12): error TS2503: Cannot find namespace 'Outer'. + + -+==== a.js (2 errors) ==== ++==== a.js (4 errors) ==== + var Outer = function O() { + this.y = 2 + } @@ -21,9 +23,13 @@ + } + } + /** @type {Outer} */ ++ ~~~~~ ++!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? + var ja + ja.y + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var da + da.x + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment3.types.diff index 3894166bdc..4ecbd6d9d7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment3.types.diff @@ -35,26 +35,26 @@ /** @type {Outer} */ var ja ->ja : O -+>ja : any ++>ja : Outer ja.y ->ja.y : number ->ja : O ->y : number +>ja.y : any -+>ja : any ++>ja : Outer +>y : any /** @type {Outer.Inner} */ var da ->da : I -+>da : any ++>da : Inner da.x ->da.x : number ->da : I ->x : number +>da.x : any -+>da : any ++>da : Inner +>x : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment35.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment35.errors.txt.diff index 128ce049a7..4a037f26e0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment35.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment35.errors.txt.diff @@ -3,6 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++bug26877.js(1,13): error TS2503: Cannot find namespace 'Emu'. +bug26877.js(4,23): error TS2339: Property 'D' does not exist on type '{}'. +bug26877.js(5,19): error TS2339: Property 'D' does not exist on type '{}'. +bug26877.js(7,5): error TS2339: Property 'D' does not exist on type '{}'. @@ -10,8 +11,10 @@ +second.js(3,5): error TS2339: Property 'D' does not exist on type '{}'. + + -+==== bug26877.js (4 errors) ==== ++==== bug26877.js (5 errors) ==== + /** @param {Emu.D} x */ ++ ~~~ ++!!! error TS2503: Cannot find namespace 'Emu'. + function ollKorrect(x) { + x._model + const y = new Emu.D() diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment35.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment35.types.diff index 4022dd01d4..d98fcf8ad9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment35.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment35.types.diff @@ -1,20 +1,13 @@ --- old.typeFromPropertyAssignment35.types +++ new.typeFromPropertyAssignment35.types -@@= skipped -2, +2 lines =@@ - === bug26877.js === - /** @param {Emu.D} x */ - function ollKorrect(x) { -->ollKorrect : (x: D) => void -->x : D -+>ollKorrect : (x: any) => void -+>x : any +@@= skipped -6, +6 lines =@@ + >x : D x._model ->x._model : number -->x : D -->_model : number +>x._model : any -+>x : any + >x : D +->_model : number +>_model : any const y = new Emu.D() @@ -54,7 +47,7 @@ >class { constructor() { this._model = 1 }} : typeof D constructor() { -@@= skipped -42, +42 lines =@@ +@@= skipped -38, +38 lines =@@ === second.js === var Emu = {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment4.errors.txt.diff index ac91c9aa73..1160915612 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment4.errors.txt.diff @@ -5,14 +5,16 @@ @@= skipped --1, +1 lines =@@ +a.js(1,7): error TS2339: Property 'Inner' does not exist on type '{}'. +a.js(4,14): error TS2339: Property 'y' does not exist on type 'Inner'. ++a.js(8,12): error TS2503: Cannot find namespace 'Outer'. +a.js(11,23): error TS2339: Property 'Inner' does not exist on type '{}'. ++b.js(1,12): error TS2503: Cannot find namespace 'Outer'. +b.js(4,19): error TS2339: Property 'Inner' does not exist on type '{}'. + + +==== def.js (0 errors) ==== + var Outer = {}; + -+==== a.js (3 errors) ==== ++==== a.js (4 errors) ==== + Outer.Inner = class { + ~~~~~ +!!! error TS2339: Property 'Inner' does not exist on type '{}'. @@ -25,6 +27,8 @@ + } + + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var local + local.y + var inner = new Outer.Inner() @@ -32,8 +36,10 @@ +!!! error TS2339: Property 'Inner' does not exist on type '{}'. + inner.y + -+==== b.js (1 errors) ==== ++==== b.js (2 errors) ==== + /** @type {Outer.Inner} */ ++ ~~~~~ ++!!! error TS2503: Cannot find namespace 'Outer'. + var x + x.y + var z = new Outer.Inner() diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment4.types.diff index 78803b4f81..55e3a4920e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment4.types.diff @@ -31,18 +31,14 @@ >12 : 12 } } - - /** @type {Outer.Inner} */ - var local -->local : Inner -+>local : any +@@= skipped -27, +27 lines =@@ + >local : Inner local.y ->local.y : number -->local : Inner -->y : number +>local.y : any -+>local : any + >local : Inner +->y : number +>y : any var inner = new Outer.Inner() @@ -67,16 +63,14 @@ === b.js === /** @type {Outer.Inner} */ - var x -->x : Inner -+>x : any +@@= skipped -22, +22 lines =@@ + >x : Inner x.y ->x.y : number -->x : Inner -->y : number +>x.y : any -+>x : any + >x : Inner +->y : number +>y : any var z = new Outer.Inner() diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment40.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment40.errors.txt.diff new file mode 100644 index 0000000000..c0e369b6ff --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment40.errors.txt.diff @@ -0,0 +1,19 @@ +--- old.typeFromPropertyAssignment40.errors.txt ++++ new.typeFromPropertyAssignment40.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++typeFromPropertyAssignment40.js(5,12): error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? ++ ++ ++==== typeFromPropertyAssignment40.js (1 errors) ==== ++ function Outer() { ++ var self = this ++ self.y = 2 ++ } ++ /** @type {Outer} */ ++ ~~~~~ ++!!! error TS2749: 'Outer' refers to a value, but is being used as a type here. Did you mean 'typeof Outer'? ++ var ok ++ ok.y ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment40.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment40.types.diff index 43d4292953..ec0d98d775 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment40.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment40.types.diff @@ -21,16 +21,13 @@ >y : any >2 : 2 } - /** @type {Outer} */ - var ok -->ok : Outer -+>ok : any +@@= skipped -18, +18 lines =@@ + >ok : Outer ok.y ->ok.y : number -->ok : Outer -->y : number +>ok.y : any -+>ok : any + >ok : Outer +->y : number +>y : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment5.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment5.errors.txt.diff new file mode 100644 index 0000000000..d058564af3 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment5.errors.txt.diff @@ -0,0 +1,23 @@ +--- old.typeFromPropertyAssignment5.errors.txt ++++ new.typeFromPropertyAssignment5.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++b.js(3,12): error TS2503: Cannot find namespace 'MC'. ++ ++ ++==== a.js (0 errors) ==== ++ export default function MyClass() { ++ } ++ MyClass.bar = class C { ++ } ++ MyClass.bar ++ ++==== b.js (1 errors) ==== ++ import MC from './a' ++ MC.bar ++ /** @type {MC.bar} */ ++ ~~ ++!!! error TS2503: Cannot find namespace 'MC'. ++ var x ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment5.types.diff index db487ef655..66b96da179 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment5.types.diff @@ -36,5 +36,5 @@ /** @type {MC.bar} */ var x ->x : C -+>x : any ++>x : bar diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment6.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment6.errors.txt.diff index f67d4b476a..c9d605435f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment6.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment6.errors.txt.diff @@ -6,6 +6,7 @@ +a.js(1,7): error TS2339: Property 'Inner' does not exist on type 'typeof Outer'. +a.js(5,7): error TS2339: Property 'i' does not exist on type 'typeof Outer'. +b.js(1,18): error TS2339: Property 'i' does not exist on type 'typeof Outer'. ++b.js(3,13): error TS2702: 'Outer' only refers to a type, but is being used as a namespace here. + + +==== def.js (0 errors) ==== @@ -22,12 +23,14 @@ + ~ +!!! error TS2339: Property 'i' does not exist on type 'typeof Outer'. + -+==== b.js (1 errors) ==== ++==== b.js (2 errors) ==== + var msgs = Outer.i.messages() + ~ +!!! error TS2339: Property 'i' does not exist on type 'typeof Outer'. + + /** @param {Outer.Inner} inner */ ++ ~~~~~ ++!!! error TS2702: 'Outer' only refers to a type, but is being used as a namespace here. + function x(inner) { + } + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment6.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment6.types.diff index 4c769ac50d..bb8040fe5d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment6.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment6.types.diff @@ -42,7 +42,7 @@ function x(inner) { ->x : (inner: I) => void ->inner : I -+>x : (inner: any) => void -+>inner : any ++>x : (inner: Inner) => void ++>inner : Inner } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt.diff index 79eee8a1cf..1369c11c34 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignmentOutOfOrder.errors.txt.diff @@ -8,9 +8,10 @@ +index.js(2,37): error TS2339: Property 'Item' does not exist on type '{}'. +index.js(4,11): error TS2339: Property 'Object' does not exist on type '{}'. +index.js(4,41): error TS2339: Property 'Object' does not exist on type '{}'. ++index.js(6,12): error TS2503: Cannot find namespace 'Workspace'. + + -+==== index.js (5 errors) ==== ++==== index.js (6 errors) ==== + First.Item = class I {} + ~~~~ +!!! error TS2339: Property 'Item' does not exist on type '{}'. @@ -27,6 +28,8 @@ +!!! error TS2339: Property 'Object' does not exist on type '{}'. + + /** @type {Workspace.Object} */ ++ ~~~~~~~~~ ++!!! error TS2503: Cannot find namespace 'Workspace'. + var am; + +==== roots.js (0 errors) ==== diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignmentOutOfOrder.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignmentOutOfOrder.types.diff index 4abdd979c8..22bda480dd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignmentOutOfOrder.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignmentOutOfOrder.types.diff @@ -47,8 +47,7 @@ /** @type {Workspace.Object} */ var am; -->am : Object -+>am : any +@@= skipped -32, +32 lines =@@ === roots.js === var First = {}; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrototypeAssignment3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrototypeAssignment3.errors.txt.diff index 37b1cd3e6d..1244d23302 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrototypeAssignment3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrototypeAssignment3.errors.txt.diff @@ -4,12 +4,13 @@ -bug26885.js(11,16): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. - No index signature with a parameter of type 'string' was found on type '{}'. +bug26885.js(2,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -+bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. ++bug26885.js(11,21): error TS2339: Property '_map' does not exist on type '{ get: (key: string) => number; }'. ++bug26885.js(15,12): error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? +bug26885.js(16,13): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -==== bug26885.js (1 errors) ==== -+==== bug26885.js (3 errors) ==== ++==== bug26885.js (4 errors) ==== function Multimap3() { this._map = {}; + ~~~~ @@ -17,7 +18,7 @@ }; Multimap3.prototype = { -@@= skipped -13, +16 lines =@@ +@@= skipped -13, +17 lines =@@ */ get(key) { return this._map[key + '']; @@ -25,11 +26,13 @@ -!!! error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. -!!! error TS7053: No index signature with a parameter of type 'string' was found on type '{}'. + ~~~~ -+!!! error TS2339: Property '_map' does not exist on type '{ get: (key: any) => any; }'. ++!!! error TS2339: Property '_map' does not exist on type '{ get: (key: string) => number; }'. } } /** @type {Multimap3} */ ++ ~~~~~~~~~ ++!!! error TS2749: 'Multimap3' refers to a value, but is being used as a type here. Did you mean 'typeof Multimap3'? const map = new Multimap3(); + ~~~~~~~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrototypeAssignment3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrototypeAssignment3.types.diff index 99e80a05c2..aa3930f09c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrototypeAssignment3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrototypeAssignment3.types.diff @@ -5,7 +5,7 @@ === bug26885.js === function Multimap3() { ->Multimap3 : typeof Multimap3 -+>Multimap3 : { (): void; prototype: { get: (key: any) => any; }; } ++>Multimap3 : { (): void; prototype: { get: (key: string) => number; }; } this._map = {}; >this._map = {} : {} @@ -23,21 +23,15 @@ ->Multimap3 : typeof Multimap3 ->prototype : { get(key: string): number; } ->{ /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get(key: string): number; } -+>Multimap3.prototype = { /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } -+>Multimap3.prototype : { get: (key: any) => any; } -+>Multimap3 : { (): void; prototype: { get: (key: any) => any; }; } -+>prototype : { get: (key: any) => any; } -+>{ /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } ++>Multimap3.prototype = { /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: string) => number; } ++>Multimap3.prototype : { get: (key: string) => number; } ++>Multimap3 : { (): void; prototype: { get: (key: string) => number; }; } ++>prototype : { get: (key: string) => number; } ++>{ /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: string) => number; } /** * @param {string} key - * @returns {number} the value ok - */ - get(key) { -->get : (key: string) => number -->key : string -+>get : (key: any) => any -+>key : any +@@= skipped -28, +28 lines =@@ return this._map[key + '']; >this._map[key + ''] : any @@ -45,34 +39,29 @@ ->this : this ->_map : {} +>this._map : any -+>this : { get: (key: any) => any; } ++>this : { get: (key: string) => number; } +>_map : any >key + '' : string -->key : string -+>key : any + >key : string >'' : "" - } - } - +@@= skipped -12, +12 lines =@@ /** @type {Multimap3} */ const map = new Multimap3(); -->map : Multimap3 + >map : Multimap3 ->new Multimap3() : Multimap3 ->Multimap3 : typeof Multimap3 -+>map : any +>new Multimap3() : any -+>Multimap3 : { (): void; prototype: { get: (key: any) => any; }; } ++>Multimap3 : { (): void; prototype: { get: (key: string) => number; }; } const n = map.get('hi') ->n : number ->map.get('hi') : number ->map.get : (key: string) => number -->map : Multimap3 -->get : (key: string) => number +>n : any +>map.get('hi') : any +>map.get : any -+>map : any + >map : Multimap3 +->get : (key: string) => number +>get : any >'hi' : "hi" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrototypeAssignment4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrototypeAssignment4.types.diff index 9f2419b7f1..a5dd1b1fb4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrototypeAssignment4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPrototypeAssignment4.types.diff @@ -5,7 +5,7 @@ === a.js === function Multimap4() { ->Multimap4 : typeof Multimap4 -+>Multimap4 : { (): void; prototype: { get: (key: any) => any; }; } ++>Multimap4 : { (): void; prototype: { get: (key: string) => number; }; } this._map = {}; >this._map = {} : {} @@ -21,22 +21,16 @@ ->Multimap4["prototype"] = { /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get(key: string): number; } ->Multimap4["prototype"] : { get(key: string): number; } ->Multimap4 : typeof Multimap4 -+>Multimap4["prototype"] = { /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } -+>Multimap4["prototype"] : { get: (key: any) => any; } -+>Multimap4 : { (): void; prototype: { get: (key: any) => any; }; } ++>Multimap4["prototype"] = { /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: string) => number; } ++>Multimap4["prototype"] : { get: (key: string) => number; } ++>Multimap4 : { (): void; prototype: { get: (key: string) => number; }; } >"prototype" : "prototype" ->{ /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get(key: string): number; } -+>{ /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: any) => any; } ++>{ /** * @param {string} key * @returns {number} the value ok */ get(key) { return this._map[key + '']; }} : { get: (key: string) => number; } /** * @param {string} key - * @returns {number} the value ok - */ - get(key) { -->get : (key: string) => number -->key : string -+>get : (key: any) => any -+>key : any +@@= skipped -28, +28 lines =@@ return this._map[key + '']; >this._map[key + ''] : any @@ -47,19 +41,16 @@ +>this : any +>_map : any >key + '' : string -->key : string -+>key : any + >key : string >'' : "" - } - }; -@@= skipped -40, +40 lines =@@ +@@= skipped -12, +12 lines =@@ Multimap4["prototype"]["add-on"] = function() {}; >Multimap4["prototype"]["add-on"] = function() {} : () => void >Multimap4["prototype"]["add-on"] : any ->Multimap4["prototype"] : { get(key: string): number; } ->Multimap4 : typeof Multimap4 -+>Multimap4["prototype"] : { get: (key: any) => any; } -+>Multimap4 : { (): void; prototype: { get: (key: any) => any; }; } ++>Multimap4["prototype"] : { get: (key: string) => number; } ++>Multimap4 : { (): void; prototype: { get: (key: string) => number; }; } >"prototype" : "prototype" >"add-on" : "add-on" >function() {} : () => void @@ -69,8 +60,8 @@ >Multimap4["prototype"]["addon"] : any ->Multimap4["prototype"] : { get(key: string): number; } ->Multimap4 : typeof Multimap4 -+>Multimap4["prototype"] : { get: (key: any) => any; } -+>Multimap4 : { (): void; prototype: { get: (key: any) => any; }; } ++>Multimap4["prototype"] : { get: (key: string) => number; } ++>Multimap4 : { (): void; prototype: { get: (key: string) => number; }; } >"prototype" : "prototype" >"addon" : "addon" >function() {} : () => void @@ -80,8 +71,8 @@ >Multimap4["prototype"]["__underscores__"] : any ->Multimap4["prototype"] : { get(key: string): number; } ->Multimap4 : typeof Multimap4 -+>Multimap4["prototype"] : { get: (key: any) => any; } -+>Multimap4 : { (): void; prototype: { get: (key: any) => any; }; } ++>Multimap4["prototype"] : { get: (key: string) => number; } ++>Multimap4 : { (): void; prototype: { get: (key: string) => number; }; } >"prototype" : "prototype" >"__underscores__" : "__underscores__" >function() {} : () => void @@ -92,7 +83,7 @@ ->Multimap4 : typeof Multimap4 +>map4 : any +>new Multimap4() : any -+>Multimap4 : { (): void; prototype: { get: (key: any) => any; }; } ++>Multimap4 : { (): void; prototype: { get: (key: string) => number; }; } map4.get(""); ->map4.get("") : number diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeLookupInIIFE.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeLookupInIIFE.errors.txt.diff index 5710e50dc9..9db1564091 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeLookupInIIFE.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeLookupInIIFE.errors.txt.diff @@ -1,16 +1,17 @@ --- old.typeLookupInIIFE.errors.txt +++ new.typeLookupInIIFE.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -a.js(3,15): error TS2694: Namespace 'ns' has no exported member 'NotFound'. -- -- --==== a.js (1 errors) ==== -- // #22973 -- var ns = (function() {})(); -- /** @type {ns.NotFound} */ ++a.js(3,12): error TS2503: Cannot find namespace 'ns'. + + + ==== a.js (1 errors) ==== + // #22973 + var ns = (function() {})(); + /** @type {ns.NotFound} */ - ~~~~~~~~ -!!! error TS2694: Namespace 'ns' has no exported member 'NotFound'. -- var crash; -- -@@= skipped --1, +1 lines =@@ -+ ++ ~~ ++!!! error TS2503: Cannot find namespace 'ns'. + var crash; + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeLookupInIIFE.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeLookupInIIFE.types.diff index 9875c4ff5b..8ea9da074c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeLookupInIIFE.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeLookupInIIFE.types.diff @@ -5,5 +5,5 @@ /** @type {ns.NotFound} */ var crash; ->crash : ns.NotFound -+>crash : any ++>crash : NotFound diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.errors.txt.diff index 67ef76739b..1a0afdd749 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.errors.txt.diff @@ -1,19 +1,20 @@ --- old.typeTagNoErasure.errors.txt +++ new.typeTagNoErasure.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -typeTagNoErasure.js(7,6): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -- -- --==== typeTagNoErasure.js (1 errors) ==== -- /** @template T @typedef {(data: T1) => T1} Test */ -- -- /** @type {Test} */ -- const test = dibbity => dibbity -- -- test(1) // ok, T=1 -- test('hi') // error, T=number ++typeTagNoErasure.js(1,39): error TS2304: Cannot find name 'T'. + + + ==== typeTagNoErasure.js (1 errors) ==== + /** @template T @typedef {(data: T1) => T1} Test */ ++ ~ ++!!! error TS2304: Cannot find name 'T'. + + /** @type {Test} */ + const test = dibbity => dibbity + + test(1) // ok, T=1 + test('hi') // error, T=number - ~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -- -@@= skipped --1, +1 lines =@@ -+ + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.types.diff index 2739ad0fc1..344349d7a9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.types.diff @@ -1,29 +1,31 @@ --- old.typeTagNoErasure.types +++ new.typeTagNoErasure.types -@@= skipped -4, +4 lines =@@ +@@= skipped -1, +1 lines =@@ + + === typeTagNoErasure.js === + /** @template T @typedef {(data: T1) => T1} Test */ ++>Test : any ++>data : T1 /** @type {Test} */ const test = dibbity => dibbity ->test : Test ->dibbity => dibbity : (dibbity: T1) => T1 -->dibbity : T1 -->dibbity : T1 -+>test : (dibbity: any) => any -+>dibbity => dibbity : (dibbity: any) => any -+>dibbity : any -+>dibbity : any ++>test : (data: T1) => T1 ++>dibbity => dibbity : (dibbity: T1) => T1 + >dibbity : T1 + >dibbity : T1 test(1) // ok, T=1 -->test(1) : 1 + >test(1) : 1 ->test : Test -+>test(1) : any -+>test : (dibbity: any) => any ++>test : (data: T1) => T1 >1 : 1 test('hi') // error, T=number ->test('hi') : number ->test : Test -+>test('hi') : any -+>test : (dibbity: any) => any ++>test('hi') : "hi" ++>test : (data: T1) => T1 >'hi' : "hi" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff index 7a799288f6..455957b016 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff @@ -1,6 +1,13 @@ --- old.typeTagOnFunctionReferencesGeneric.types +++ new.typeTagOnFunctionReferencesGeneric.types -@@= skipped -6, +6 lines =@@ +@@= skipped -2, +2 lines =@@ + === typeTagOnFunctionReferencesGeneric.js === + /** + * @typedef {(m : T) => T} IFn ++>IFn : IFn ++>m : T ++ + */ /**@type {IFn}*/ export function inJs(l) { @@ -21,22 +28,3 @@ >1 : 1 /**@type {IFn}*/ - const inJsArrow = (j) => { -->inJsArrow : IFn -->(j) => { return j;} : (j: T) => T -->j : T -+>inJsArrow : (j: any) => any -+>(j) => { return j;} : (j: any) => any -+>j : any - - return j; -->j : T -+>j : any - } - inJsArrow(2); // no error gets linted as expected -->inJsArrow(2) : 2 -->inJsArrow : IFn -+>inJsArrow(2) : any -+>inJsArrow : (j: any) => any - >2 : 2 - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnPropertyAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnPropertyAssignment.types.diff index 5e05570c5f..1fad76b3aa 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnPropertyAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnPropertyAssignment.types.diff @@ -1,44 +1,16 @@ --- old.typeTagOnPropertyAssignment.types +++ new.typeTagOnPropertyAssignment.types -@@= skipped -1, +1 lines =@@ - - === typeTagOnPropertyAssignment.js === - const o = { -->o : { a: "a"; n: () => "b"; } -->{ /** * @type {"a"} */ a: "a", /** @type {() => 'b'} */ n: () => 'b'} : { a: "a"; n: () => "b"; } -+>o : { a: string; n: () => string; } -+>{ /** * @type {"a"} */ a: "a", /** @type {() => 'b'} */ n: () => 'b'} : { a: string; n: () => string; } - - /** - * @type {"a"} - */ +@@= skipped -10, +10 lines =@@ a: "a", -->a : "a" -+>a : string + >a : "a" >"a" : "a" ++>"a" : "a" /** @type {() => 'b'} */ n: () => 'b' -->n : () => "b" -->() => 'b' : () => "b" -+>n : () => string -+>() => 'b' : () => string + >n : () => "b" + >() => 'b' : () => "b" ++>() => 'b' : () => "b" >'b' : "b" }; - o.a -->o.a : "a" -->o : { a: "a"; n: () => "b"; } -->a : "a" -+>o.a : string -+>o : { a: string; n: () => string; } -+>a : string - - o.n -->o.n : () => "b" -->o : { a: "a"; n: () => "b"; } -->n : () => "b" -+>o.n : () => string -+>o : { a: string; n: () => string; } -+>n : () => string - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff index 90298bbdc2..37a90e7398 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff @@ -1,8 +1,21 @@ --- old.typedefCrossModule.types +++ new.typedefCrossModule.types -@@= skipped -10, +10 lines =@@ +@@= skipped -7, +7 lines =@@ + === mod1.js === + /// + /** @typedef {{ type: "a", x: 1 }} A */ ++>A : any ++>type : "a" ++>x : 1 ++ /** @typedef {{ type: "b", y: 1 }} B */ ++>B : any ++>type : "b" ++>y : 1 ++ /** @typedef {A | B} Both */ ++>Both : any ++ module.exports = C ->module.exports = C : typeof C ->module.exports : typeof C @@ -27,8 +40,21 @@ >p : any >1 : 1 } -@@= skipped -24, +24 lines =@@ +@@= skipped -23, +33 lines =@@ + === mod2.js === + /// + /** @typedef {{ type: "a", x: 1 }} A */ ++>A : A ++>type : "a" ++>x : 1 ++ + /** @typedef {{ type: "b", y: 1 }} B */ ++>B : B ++>type : "b" ++>y : 1 ++ /** @typedef {A | B} Both */ ++>Both : Both export function C() { ->C : typeof C @@ -42,8 +68,21 @@ >p : any >1 : 1 } -@@= skipped -17, +17 lines =@@ +@@= skipped -17, +26 lines =@@ + === mod3.js === + /// + /** @typedef {{ type: "a", x: 1 }} A */ ++>A : any ++>type : "a" ++>x : 1 ++ + /** @typedef {{ type: "b", y: 1 }} B */ ++>B : any ++>type : "b" ++>y : 1 ++ /** @typedef {A | B} Both */ ++>Both : any exports.C = function() { ->exports.C = function() { this.p = 1} : typeof C @@ -65,34 +104,30 @@ >p : any >1 : 1 } -@@= skipped -17, +17 lines =@@ +@@= skipped -21, +30 lines =@@ === use.js === /** @type {import('./mod1').Both} */ var both1 = { type: 'a', x: 1 }; ->both1 : import("mod1").Both -->{ type: 'a', x: 1 } : { type: "a"; x: 1; } -->type : "a" -+>both1 : { type: string; x: number; } -+>{ type: 'a', x: 1 } : { type: string; x: number; } -+>type : string ++>both1 : { type: "a"; x: 1; } | { type: "b"; y: 1; } + >{ type: 'a', x: 1 } : { type: "a"; x: 1; } + >type : "a" >'a' : "a" -->x : 1 -+>x : number - >1 : 1 +@@= skipped -9, +9 lines =@@ /** @type {import('./mod2').Both} */ var both2 = both1; ->both2 : import("mod2").Both ->both1 : import("mod1").A -+>both2 : { type: string; x: number; } -+>both1 : { type: string; x: number; } ++>both2 : Both ++>both1 : { type: "a"; x: 1; } /** @type {import('./mod3').Both} */ var both3 = both2; ->both3 : import("mod3").Both ->both2 : import("mod2").A -+>both3 : { type: string; x: number; } -+>both2 : { type: string; x: number; } ++>both3 : { type: "a"; x: 1; } | { type: "b"; y: 1; } ++>both2 : A diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff index ecc36a9d6a..5b880ebdd3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff @@ -6,16 +6,22 @@ -mod1.js(9,23): error TS2300: Duplicate identifier 'Baz'. -mod1.js(11,5): error TS2300: Duplicate identifier 'Baz'. +use.js(1,11): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++use.js(2,19): error TS2307: Cannot find module './mod1.js' or its corresponding type declarations. ++use.js(4,12): error TS2503: Cannot find namespace 'mod'. -==== use.js (0 errors) ==== -+==== use.js (1 errors) ==== ++==== use.js (3 errors) ==== var mod = require('./mod1.js'); + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @type {import("./mod1.js").Baz} */ ++ ~~~~~~~~~~~ ++!!! error TS2307: Cannot find module './mod1.js' or its corresponding type declarations. var b; /** @type {mod.Baz} */ ++ ~~~ ++!!! error TS2503: Cannot find namespace 'mod'. var bb; var bbb = new mod.Baz(); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff index 86ddece588..f9e773a56d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff @@ -19,7 +19,7 @@ /** @type {mod.Baz} */ var bb; ->bb : number -+>bb : any ++>bb : Baz var bbb = new mod.Baz(); ->bbb : Baz diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff index aa5c941749..43095c5c77 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff @@ -1,8 +1,11 @@ --- old.typedefCrossModule3.types +++ new.typedefCrossModule3.types -@@= skipped -2, +2 lines =@@ +@@= skipped -1, +1 lines =@@ + === mod2.js === /** @typedef {number} Foo */ ++>Foo : any ++ const ns = {}; ->ns : typeof ns +>ns : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.types.diff index ab8b6a5e92..b09cfd298f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.types.diff @@ -1,6 +1,13 @@ --- old.typedefCrossModule4.types +++ new.typedefCrossModule4.types -@@= skipped -6, +6 lines =@@ +@@= skipped -1, +1 lines =@@ + + === mod3.js === + /** @typedef {number} Foo */ ++>Foo : any ++ + class Bar { } + >Bar : Bar module.exports = { Foo: Bar }; >module.exports = { Foo: Bar } : { Foo: typeof Bar; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule5.types.diff new file mode 100644 index 0000000000..beb1545e68 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule5.types.diff @@ -0,0 +1,11 @@ +--- old.typedefCrossModule5.types ++++ new.typedefCrossModule5.types +@@= skipped -1, +1 lines =@@ + + === mod1.js === + /** @typedef {number} Foo */ ++>Foo : any ++ + class Bar {} + >Bar : Bar + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.types.diff new file mode 100644 index 0000000000..e8c96fdeac --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.types.diff @@ -0,0 +1,14 @@ +--- old.typedefInnerNamepaths.types ++++ new.typedefInnerNamepaths.types +@@= skipped -5, +5 lines =@@ + + /** + * @typedef {C~A} C~B ++> : any ++ + * @typedef {object} C~A ++>C : any ++ + */ + /** @param {C~A} o */ + constructor(o) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.errors.txt.diff index dff9383d64..afbdcbf1dc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.errors.txt.diff @@ -3,31 +3,50 @@ @@= skipped -0, +0 lines =@@ -a.js(12,23): error TS2344: Type '{ a: number; }' does not satisfy the constraint '{ a: number; b: string; }'. - Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. --a.js(15,12): error TS2314: Generic type 'Everything' requires 5 type argument(s). ++a.js(6,19): error TS2304: Cannot find name 'T'. ++a.js(6,25): error TS2304: Cannot find name 'U'. ++a.js(6,31): error TS2304: Cannot find name 'V'. ++a.js(6,37): error TS2304: Cannot find name 'W'. ++a.js(6,43): error TS2304: Cannot find name 'X'. ++a.js(12,23): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. + a.js(15,12): error TS2314: Generic type 'Everything' requires 5 type argument(s). -test.ts(1,34): error TS2344: Type '{ a: number; }' does not satisfy the constraint '{ a: number; b: string; }'. - Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. +test.ts(1,23): error TS2304: Cannot find name 'Everything'. -==== a.js (2 errors) ==== -+==== a.js (0 errors) ==== ++==== a.js (7 errors) ==== /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? -@@= skipped -17, +13 lines =@@ - var tuvwx; + * @template W + * @template X That last one had no comment + * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything ++ ~ ++!!! error TS2304: Cannot find name 'T'. ++ ~ ++!!! error TS2304: Cannot find name 'U'. ++ ~ ++!!! error TS2304: Cannot find name 'V'. ++ ~ ++!!! error TS2304: Cannot find name 'W'. ++ ~ ++!!! error TS2304: Cannot find name 'X'. + */ + + /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ +@@= skipped -18, +31 lines =@@ /** @type {Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>} */ -- ~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~ -!!! error TS2344: Type '{ a: number; }' does not satisfy the constraint '{ a: number; b: string; }'. -!!! error TS2344: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. --!!! related TS2728 a.js:2:28: 'b' is declared here. ++!!! error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. + !!! related TS2728 a.js:2:28: 'b' is declared here. var wrong; - /** @type {Everything<{ a: number }>} */ -- ~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2314: Generic type 'Everything' requires 5 type argument(s). - var insufficient; +@@= skipped -12, +11 lines =@@ ==== test.ts (1 errors) ==== declare var actually: Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.types.diff index 4301003998..fca5b5ec44 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.types.diff @@ -1,16 +1,27 @@ --- old.typedefMultipleTypeParameters.types +++ new.typedefMultipleTypeParameters.types -@@= skipped -10, +10 lines =@@ +@@= skipped -6, +6 lines =@@ + * @template W + * @template X That last one had no comment + * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything ++>Everything : any ++>t : T ++>u : U ++>v : V ++>w : W ++>x : X ++ + */ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ var tuvwx; ->tuvwx : Everything<{ a: number; b: "hi"; c: never; }, undefined, { c: true; d: 1; }, number, string> -+>tuvwx : any ++>tuvwx : { t: T; u: U; v: V; w: W; x: X; } /** @type {Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>} */ var wrong; ->wrong : Everything<{ a: number; }, undefined, { c: 1; d: 1; }, number, string> -+>wrong : any ++>wrong : { t: T; u: U; v: V; w: W; x: X; } /** @type {Everything<{ a: number }>} */ var insufficient; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnSemicolonClassElement.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnSemicolonClassElement.types.diff new file mode 100644 index 0000000000..5ae33ec7c3 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnSemicolonClassElement.types.diff @@ -0,0 +1,11 @@ +--- old.typedefOnSemicolonClassElement.types ++++ new.typedefOnSemicolonClassElement.types +@@= skipped -4, +4 lines =@@ + >Preferences : Preferences + + /** @typedef {string} A */ ++>A : any ++ + ; + /** @type {A} */ + a = 'ok' diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.errors.txt.diff deleted file mode 100644 index a67879ad94..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.errors.txt.diff +++ /dev/null @@ -1,123 +0,0 @@ ---- old.typedefOnStatements.errors.txt -+++ new.typedefOnStatements.errors.txt -@@= skipped -1, +1 lines =@@ - typedefOnStatements.js(31,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. - typedefOnStatements.js(33,1): error TS1101: 'with' statements are not allowed in strict mode. - typedefOnStatements.js(33,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. - - --==== typedefOnStatements.js (4 errors) ==== -<<<<<<< HEAD -+==== typedefOnStatements.js (3 errors) ==== -||||||| 2904ecfed -+==== typedefOnStatements.js (20 errors) ==== -======= -+==== typedefOnStatements.js (21 errors) ==== ->>>>>>> main - /** @typedef {{a: string}} A */ - ; - /** @typedef {{ b: string }} B */ -<<<<<<< HEAD -@@= skipped -41, +40 lines =@@ - !!! error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. - /** @typedef {{ m: string }} M */ - with (name) { -- ~~~~ --!!! error TS1101: 'with' statements are not allowed in strict mode. - ~~~~~~~~~~~ - !!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. - } -||||||| 2904ecfed -@@= skipped -41, +57 lines =@@ - !!! error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. - /** @typedef {{ m: string }} M */ - with (name) { -- ~~~~ --!!! error TS1101: 'with' statements are not allowed in strict mode. - ~~~~~~~~~~~ - !!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. - } -@@= skipped -42, +40 lines =@@ - * @param {Q} q - */ - function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'c' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'd' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'e' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'f' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'g' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'h' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'i' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'j' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'k' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'l' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'm' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'n' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'o' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'p' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'q' implicitly has an 'any' type. - console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) - /** @type {Alpha} */ - var alpha = { alpha: "aleph" } -======= -@@= skipped -82, +99 lines =@@ - * @param {Q} q - */ - function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { -+ ~ -+!!! error TS7006: Parameter 'a' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'b' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'c' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'd' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'e' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'f' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'g' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'h' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'i' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'j' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'k' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'l' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'm' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'n' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'o' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'p' implicitly has an 'any' type. -+ ~ -+!!! error TS7006: Parameter 'q' implicitly has an 'any' type. - console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) - /** @type {Alpha} */ - var alpha = { alpha: "aleph" } ->>>>>>> main diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.types.diff index 5d3701bc42..42100359be 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.types.diff @@ -1,6 +1,128 @@ --- old.typedefOnStatements.types +++ new.typedefOnStatements.types -@@= skipped -92, +92 lines =@@ +@@= skipped -1, +1 lines =@@ + + === typedefOnStatements.js === + /** @typedef {{a: string}} A */ ++>A : any ++>a : string ++ + ; + /** @typedef {{ b: string }} B */ ++>B : any ++>b : string ++ + debugger; + /** @typedef {{ c: string }} C */ ++>C : any ++>c : string + { + } + /** @typedef {{ d: string }} D */ ++>D : any ++>d : string ++ + 1 + 1; + >1 + 1 : number + >1 : 1 + >1 : 1 + + /** @typedef {{ e: string }} E */ ++>E : any ++>e : string ++ + if (false) { + >false : false + } + /** @typedef {{ f: string }} F */ ++>F : any ++>f : string ++ + do { + } while (false); + >false : false + + /** @typedef {{ g: string }} G */ ++>G : any ++>g : string ++ + while (false) { + >false : false + } + /** @typedef {{ h: string }} H */ ++>H : any ++>h : string ++ + for (;; false) { + >false : false + } + /** @typedef {{ i: string }} I */ ++>I : any ++>i : string ++ + for (let i in []) { + >i : string + >[] : never[] + } + /** @typedef {{ j: string }} J */ ++>J : any ++>j : string ++ + break; + /** @typedef {{ k: string }} K */ ++>K : any ++>k : string ++ + for (let k of []) { + >k : never + >[] : never[] + } + /** @typedef {{ l: string }} L */ ++>L : any ++>l : string ++ + continue; + /** @typedef {{ m: string }} M */ ++>M : any ++>m : string ++ + with (name) { + >name : void + } + /** @typedef {{ n: string }} N */ ++>N : any ++>n : string ++ + switch (name) { + >name : void + } + + /** @typedef {{ o: string }} O */ ++>O : any ++>o : string ++ + fork: while (false) { + >fork : any + >false : false + } + + /** @typedef {{ p: string }} P */ ++>P : any ++>p : string ++ + throw new Error('Unreachable') + >new Error('Unreachable') : Error + >Error : ErrorConstructor + >'Unreachable' : "Unreachable" + + /** @typedef {{ q: string }} Q */ ++>Q : any ++>q : string ++ + try { + } + catch (e) { +@@= skipped -91, +141 lines =@@ * @param {Q} q */ function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { @@ -22,132 +144,107 @@ ->o : O ->p : P ->q : Q -+>proof : (a: any, b: any, c: any, d: any, e: any, f: any, g: any, h: any, i: any, j: any, k: any, l: any, m: any, n: any, o: any, p: any, q: any) => void -+>a : any -+>b : any -+>c : any -+>d : any -+>e : any -+>f : any -+>g : any -+>h : any -+>i : any -+>j : any -+>k : any -+>l : any -+>m : any -+>n : any -+>o : any -+>p : any -+>q : any ++>proof : (a: { a: string; }, b: { b: string; }, c: { c: string; }, d: { d: string; }, e: { e: string; }, f: { f: string; }, g: { g: string; }, h: { h: string; }, i: { i: string; }, j: { j: string; }, k: { k: string; }, l: { l: string; }, m: { m: string; }, n: { n: string; }, o: { o: string; }, p: { p: string; }, q: { q: string; }) => void ++>a : { a: string; } ++>b : { b: string; } ++>c : { c: string; } ++>d : { d: string; } ++>e : { e: string; } ++>f : { f: string; } ++>g : { g: string; } ++>h : { h: string; } ++>i : { i: string; } ++>j : { j: string; } ++>k : { k: string; } ++>l : { l: string; } ++>m : { m: string; } ++>n : { n: string; } ++>o : { o: string; } ++>p : { p: string; } ++>q : { q: string; } console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) >console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) : void - >console.log : (...data: any[]) => void +@@= skipped -25, +25 lines =@@ >console : Console >log : (...data: any[]) => void -->a.a : string + >a.a : string ->a : A -->a : string -->b.b : string ++>a : { a: string; } + >a : string + >b.b : string ->b : B -->b : string -->c.c : string ++>b : { b: string; } + >b : string + >c.c : string ->c : C -->c : string -->d.d : string ++>c : { c: string; } + >c : string + >d.d : string ->d : D -->d : string -->e.e : string ++>d : { d: string; } + >d : string + >e.e : string ->e : E -->e : string -->f.f : string ++>e : { e: string; } + >e : string + >f.f : string ->f : F -->f : string -->g.g : string ++>f : { f: string; } + >f : string + >g.g : string ->g : G -->g : string -->h.h : string ++>g : { g: string; } + >g : string + >h.h : string ->h : H -->h : string -->i.i : string ++>h : { h: string; } + >h : string + >i.i : string ->i : I -->i : string -->j.j : string ++>i : { i: string; } + >i : string + >j.j : string ->j : J -->j : string -->k.k : string ++>j : { j: string; } + >j : string + >k.k : string ->k : K -->k : string -->l.l : string ++>k : { k: string; } + >k : string + >l.l : string ->l : L -->l : string -->m.m : string ++>l : { l: string; } + >l : string + >m.m : string ->m : M -->m : string -->n.n : string ++>m : { m: string; } + >m : string + >n.n : string ->n : N -->n : string -->o.o : string ++>n : { n: string; } + >n : string + >o.o : string ->o : O -->o : string -->p.p : string ++>o : { o: string; } + >o : string + >p.p : string ->p : P -->p : string -->q.q : string ++>p : { p: string; } + >p : string + >q.q : string ->q : Q -->q : string -+>a.a : any -+>a : any -+>a : any -+>b.b : any -+>b : any -+>b : any -+>c.c : any -+>c : any -+>c : any -+>d.d : any -+>d : any -+>d : any -+>e.e : any -+>e : any -+>e : any -+>f.f : any -+>f : any -+>f : any -+>g.g : any -+>g : any -+>g : any -+>h.h : any -+>h : any -+>h : any -+>i.i : any -+>i : any -+>i : any -+>j.j : any -+>j : any -+>j : any -+>k.k : any -+>k : any -+>k : any -+>l.l : any -+>l : any -+>l : any -+>m.m : any -+>m : any -+>m : any -+>n.n : any -+>n : any -+>n : any -+>o.o : any -+>o : any -+>o : any -+>p.p : any -+>p : any -+>p : any -+>q.q : any -+>q : any -+>q : any ++>q : { q: string; } + >q : string /** @type {Alpha} */ - var alpha = { alpha: "aleph" } +@@= skipped -59, +59 lines =@@ + >"aleph" : "aleph" + + /** @typedef {{ alpha: string }} Alpha */ ++>Alpha : any ++>alpha : string ++ + return + } + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefScope1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefScope1.errors.txt.diff deleted file mode 100644 index e138e63ed9..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefScope1.errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.typedefScope1.errors.txt -+++ new.typedefScope1.errors.txt -@@= skipped -0, +-1 lines =@@ --typedefScope1.js(13,12): error TS2304: Cannot find name 'B'. -- -- --==== typedefScope1.js (1 errors) ==== -- function B1() { -- /** @typedef {number} B */ -- /** @type {B} */ -- var ok1 = 0; -- } -- -- function B2() { -- /** @typedef {string} B */ -- /** @type {B} */ -- var ok2 = 'hi'; -- } -- -- /** @type {B} */ -- ~ --!!! error TS2304: Cannot find name 'B'. -- var notOK = 0; -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefScope1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefScope1.types.diff index 90a72ae370..9cef73e704 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefScope1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefScope1.types.diff @@ -1,10 +1,20 @@ --- old.typedefScope1.types +++ new.typedefScope1.types -@@= skipped -22, +22 lines =@@ +@@= skipped -4, +4 lines =@@ + >B1 : () => void - /** @type {B} */ - var notOK = 0; -->notOK : B -+>notOK : number - >0 : 0 + /** @typedef {number} B */ ++>B : any ++ + /** @type {B} */ + var ok1 = 0; + >ok1 : number +@@= skipped -10, +12 lines =@@ + >B2 : () => void + /** @typedef {string} B */ ++>B : any ++ + /** @type {B} */ + var ok2 = 'hi'; + >ok2 : string diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagExtraneousProperty.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagExtraneousProperty.errors.txt.diff index 676cf65d09..3e7d658ddd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagExtraneousProperty.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagExtraneousProperty.errors.txt.diff @@ -3,11 +3,16 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+typedefTagExtraneousProperty.js(8,3): error TS2339: Property 'ignoreMe' does not exist on type '{ bye: string; }'. ++typedefTagExtraneousProperty.js(1,15): error TS2315: Type 'Object' is not generic. ++typedefTagExtraneousProperty.js(1,21): error TS8020: JSDoc types can only be used inside documentation comments. + + -+==== typedefTagExtraneousProperty.js (1 errors) ==== ++==== typedefTagExtraneousProperty.js (2 errors) ==== + /** @typedef {Object.} Mmap ++ ~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. ++ ~ ++!!! error TS8020: JSDoc types can only be used inside documentation comments. + * @property {string} ignoreMe - should be ignored + */ + @@ -15,7 +20,5 @@ + var y = { bye: "no" }; + y + y.ignoreMe = "ok but just because of the index signature" -+ ~~~~~~~~ -+!!! error TS2339: Property 'ignoreMe' does not exist on type '{ bye: string; }'. + y['hi'] = "yes" + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagExtraneousProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagExtraneousProperty.types.diff index fbe92872ff..358fef1a19 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagExtraneousProperty.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagExtraneousProperty.types.diff @@ -1,18 +1,25 @@ --- old.typedefTagExtraneousProperty.types +++ new.typedefTagExtraneousProperty.types -@@= skipped -6, +6 lines =@@ +@@= skipped -1, +1 lines =@@ + + === typedefTagExtraneousProperty.js === + /** @typedef {Object.} Mmap ++>Mmap : any ++ + * @property {string} ignoreMe - should be ignored + */ /** @type {Mmap} */ var y = { bye: "no" }; ->y : { [x: string]: string; } -+>y : { bye: string; } ++>y : any >{ bye: "no" } : { bye: string; } >bye : string >"no" : "no" y ->y : { [x: string]: string; } -+>y : { bye: string; } ++>y : any y.ignoreMe = "ok but just because of the index signature" >y.ignoreMe = "ok but just because of the index signature" : "ok but just because of the index signature" @@ -20,7 +27,7 @@ ->y : { [x: string]: string; } ->ignoreMe : string +>y.ignoreMe : any -+>y : { bye: string; } ++>y : any +>ignoreMe : any >"ok but just because of the index signature" : "ok but just because of the index signature" @@ -29,7 +36,7 @@ ->y['hi'] : string ->y : { [x: string]: string; } +>y['hi'] : any -+>y : { bye: string; } ++>y : any >'hi' : "hi" >"yes" : "yes" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagNested.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagNested.types.diff index dea71370e6..8aa2fc151f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagNested.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagNested.types.diff @@ -1,51 +1,78 @@ --- old.typedefTagNested.types +++ new.typedefTagNested.types -@@= skipped -11, +11 lines =@@ +@@= skipped -1, +1 lines =@@ - /** @type {App} */ - const app = { -->app : App -+>app : { name: string; icons: { image32: string; image64: string; }; } - >{ name: 'name', icons: { image32: 'x.png', image64: 'y.png', }} : { name: string; icons: { image32: string; image64: string; }; } - - name: 'name', -@@= skipped -33, +33 lines =@@ + === a.js === + /** @typedef {Object} App ++>App : any ++ + * @property {string} name ++>name : any ++ + * @property {Object} icons ++>icons : any ++ + * @property {string} icons.image32 ++>property : any ++>icons : any ++>image32 : any ++ + * @property {string} icons.image64 ++>property : any ++>icons : any ++>image64 : any ++ + */ + var ex; + >ex : any +@@= skipped -32, +46 lines =@@ + } - /** @type {Opp} */ - var mistake; -->mistake : string -+>mistake : any + /** @typedef {Object} Opp ++>Opp : any ++ + * @property {string} name + * @property {Object} oops + * @property {string} horrible +@@= skipped -14, +16 lines =@@ + >mistake : string /** @typedef {Object} Upp ++>Upp : any ++ * @property {string} name -@@= skipped -10, +10 lines =@@ ++>name : any ++ + * @property {Object} not ++>not : any ++ + * @property {string} nested ++>nested : any ++ + */ /** @type {Upp} */ - var sala = { name: 'uppsala', not: 0, nested: "ok" }; -->sala : Upp -+>sala : { name: string; not: number; nested: string; } - >{ name: 'uppsala', not: 0, nested: "ok" } : { name: string; not: number; nested: string; } - >name : string - >'uppsala' : "uppsala" -@@= skipped -11, +11 lines =@@ +@@= skipped -17, +25 lines =@@ + >"ok" : "ok" sala.name - >sala.name : string -->sala : Upp -+>sala : { name: string; not: number; nested: string; } - >name : string +->sala.name : string ++>sala.name : any + >sala : Upp +->name : string ++>name : any sala.not ->sala.not : Object -->sala : Upp ++>sala.not : any + >sala : Upp ->not : Object -+>sala.not : number -+>sala : { name: string; not: number; nested: string; } -+>not : number ++>not : any sala.nested - >sala.nested : string -->sala : Upp -+>sala : { name: string; not: number; nested: string; } - >nested : string +->sala.nested : string ++>sala.nested : any + >sala : Upp +->nested : string ++>nested : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagTypeResolution.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagTypeResolution.errors.txt.diff index 0f73f88c40..b94f2d4579 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagTypeResolution.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagTypeResolution.errors.txt.diff @@ -1,42 +1,26 @@ --- old.typedefTagTypeResolution.errors.txt +++ new.typedefTagTypeResolution.errors.txt -@@= skipped -0, +-1 lines =@@ --github20832.js(2,15): error TS2304: Cannot find name 'U'. +@@= skipped -0, +0 lines =@@ + github20832.js(2,15): error TS2304: Cannot find name 'U'. -github20832.js(17,12): error TS2304: Cannot find name 'V'. -- -- --==== github20832.js (2 errors) ==== -- // #20832 -- /** @typedef {U} T - should be "error, can't find type named 'U' */ -- ~ --!!! error TS2304: Cannot find name 'U'. -- /** -- * @template U -- * @param {U} x -- * @return {T} -- */ -- function f(x) { -- return x; -- } -- -- /** @type T - should be fine, since T will be any */ -- const x = 3; -- -- /** -- * @callback Cb -- * @param {V} firstParam ++github20832.js(26,12): error TS2304: Cannot find name 'Cb'. + + + ==== github20832.js (2 errors) ==== +@@= skipped -21, +21 lines =@@ + /** + * @callback Cb + * @param {V} firstParam - ~ -!!! error TS2304: Cannot find name 'V'. -- */ -- /** -- * @template V -- * @param {V} vvvvv -- */ -- function g(vvvvv) { -- } -- -- /** @type {Cb} */ -- const cb = x => {} -- -@@= skipped --1, +1 lines =@@ -+ + */ + /** + * @template V +@@= skipped -11, +9 lines =@@ + } + + /** @type {Cb} */ ++ ~~ ++!!! error TS2304: Cannot find name 'Cb'. + const cb = x => {} + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagTypeResolution.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagTypeResolution.types.diff index c54c2f7fbe..209e22f8df 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagTypeResolution.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagTypeResolution.types.diff @@ -1,42 +1,28 @@ --- old.typedefTagTypeResolution.types +++ new.typedefTagTypeResolution.types -@@= skipped -8, +8 lines =@@ +@@= skipped -2, +2 lines =@@ + === github20832.js === + // #20832 + /** @typedef {U} T - should be "error, can't find type named 'U' */ ++>T : U ++ + /** + * @template U + * @param {U} x * @return {T} */ function f(x) { ->f : (x: U) => T -->x : U -+>f : (x: any) => any -+>x : any ++>f : (x: U) => U + >x : U return x; -->x : U -+>x : any - } - - /** @type T - should be fine, since T will be any */ - const x = 3; -->x : U -+>x : 3 - >3 : 3 - - /** -@@= skipped -21, +21 lines =@@ - * @param {V} vvvvv - */ - function g(vvvvv) { -->g : (vvvvv: V) => void -->vvvvv : V -+>g : (vvvvv: any) => void -+>vvvvv : any - } - +@@= skipped -34, +36 lines =@@ /** @type {Cb} */ const cb = x => {} -->cb : Cb + >cb : Cb ->x => {} : (x: V) => any ->x : V -+>cb : (x: any) => void +>x => {} : (x: any) => void +>x : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.errors.txt.diff index 128f3065bf..7d07fa40d3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.errors.txt.diff @@ -1,141 +1,101 @@ --- old.typedefTagWrapping.errors.txt +++ new.typedefTagWrapping.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -mod7.js(5,7): error TS1110: Type expected. -mod7.js(8,4): error TS1110: Type expected. -- -- ++mod1.js(2,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++mod1.js(9,12): error TS2304: Cannot find name 'Type1'. ++mod3.js(4,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++mod3.js(10,12): error TS2304: Cannot find name 'StringOrNumber1'. ++mod4.js(4,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. + + -==== mod1.js (0 errors) ==== -- /** -- * @typedef {function(string): boolean} -- * Type1 -- */ -- -- /** -- * Tries to use a type whose name is on a different -- * line than the typedef tag. -- * @param {Type1} func The function to call. -- * @param {string} arg The argument to call it with. -- * @returns {boolean} The return. -- */ -- function callIt(func, arg) { -- return func(arg); -- } -- --==== mod2.js (0 errors) ==== -- /** -- * @typedef {{ -- * num: number, -- * str: string, -- * boo: boolean -- * }} Type2 -- */ -- -- /** -- * Makes use of a type with a multiline type expression. -- * @param {Type2} obj The object. -- * @returns {string|number} The return. -- */ -- function check(obj) { -- return obj.boo ? obj.num : obj.str; -- } -- ++==== mod1.js (2 errors) ==== + /** + * @typedef {function(string): boolean} ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + * Type1 + */ + +@@= skipped -11, +18 lines =@@ + * Tries to use a type whose name is on a different + * line than the typedef tag. + * @param {Type1} func The function to call. ++ ~~~~~ ++!!! error TS2304: Cannot find name 'Type1'. + * @param {string} arg The argument to call it with. + * @returns {boolean} The return. + */ +@@= skipped -25, +27 lines =@@ + return obj.boo ? obj.num : obj.str; + } + -==== mod3.js (0 errors) ==== -- /** -- * A function whose signature is very long. -- * -- * @typedef {function(boolean, string, number): -- * (string|number)} StringOrNumber1 -- */ -- -- /** -- * Makes use of a function type with a long signature. -- * @param {StringOrNumber1} func The function. -- * @param {boolean} bool The condition. -- * @param {string} str The string. -- * @param {number} num The number. -- * @returns {string|number} The return. -- */ -- function use1(func, bool, str, num) { -- return func(bool, str, num) -- } -- ++==== mod3.js (2 errors) ==== + /** + * A function whose signature is very long. + * + * @typedef {function(boolean, string, number): ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + * (string|number)} StringOrNumber1 + */ + + /** + * Makes use of a function type with a long signature. + * @param {StringOrNumber1} func The function. ++ ~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'StringOrNumber1'. + * @param {boolean} bool The condition. + * @param {string} str The string. + * @param {number} num The number. +@@= skipped -20, +25 lines =@@ + return func(bool, str, num) + } + -==== mod4.js (0 errors) ==== -- /** -- * A function whose signature is very long. -- * -- * @typedef {function(boolean, string, -- * number): -- * (string|number)} StringOrNumber2 -- */ -- -- /** -- * Makes use of a function type with a long signature. -- * @param {StringOrNumber2} func The function. -- * @param {boolean} bool The condition. -- * @param {string} str The string. -- * @param {number} num The number. -- * @returns {string|number} The return. -- */ -- function use2(func, bool, str, num) { -- return func(bool, str, num) -- } -- --==== mod5.js (0 errors) ==== -- /** -- * @typedef {{ -- * num: -- * number, -- * str: -- * string, -- * boo: -- * boolean -- * }} Type5 -- */ -- -- /** -- * Makes use of a type with a multiline type expression. -- * @param {Type5} obj The object. -- * @returns {string|number} The return. -- */ -- function check5(obj) { -- return obj.boo ? obj.num : obj.str; -- } -- --==== mod6.js (0 errors) ==== -- /** -- * @typedef {{ -- * foo: -- * *, -- * bar: -- * * -- * }} Type6 -- */ -- -- /** -- * Makes use of a type with a multiline type expression. -- * @param {Type6} obj The object. -- * @returns {*} The return. -- */ -- function check6(obj) { -- return obj.foo; -- } -- -- ++==== mod4.js (2 errors) ==== + /** + * A function whose signature is very long. + * + * @typedef {function(boolean, string, ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + * number): + * (string|number)} StringOrNumber2 + */ +@@= skipped -12, +15 lines =@@ + /** + * Makes use of a function type with a long signature. + * @param {StringOrNumber2} func The function. ++ ~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'StringOrNumber2'. + * @param {boolean} bool The condition. + * @param {string} str The string. + * @param {number} num The number. +@@= skipped -50, +52 lines =@@ + } + + -==== mod7.js (2 errors) ==== -- /** -- Multiline type expressions in comments without leading * are not supported. -- @typedef {{ -- foo: -- *, ++==== mod7.js (0 errors) ==== + /** + Multiline type expressions in comments without leading * are not supported. + @typedef {{ + foo: + *, - ~ -!!! error TS1110: Type expected. -- bar: -- * -- }} Type7 + bar: + * + }} Type7 - ~ -!!! error TS1110: Type expected. -- */ -- -@@= skipped --1, +1 lines =@@ -+ + */ + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.types.diff index fe1baa88ac..30a923d424 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.types.diff @@ -1,163 +1,83 @@ --- old.typedefTagWrapping.types +++ new.typedefTagWrapping.types -@@= skipped -13, +13 lines =@@ - * @returns {boolean} The return. +@@= skipped -2, +2 lines =@@ + === mod1.js === + /** + * @typedef {function(string): boolean} ++> : function ++ + * Type1 */ - function callIt(func, arg) { -->callIt : (func: Type1, arg: string) => boolean -->func : Type1 -->arg : string -+>callIt : (func: any, arg: any) => any -+>func : any -+>arg : any + +@@= skipped -16, +18 lines =@@ + >arg : string return func(arg); ->func(arg) : boolean -->func : Type1 -->arg : string +>func(arg) : any -+>func : any -+>arg : any + >func : Type1 + >arg : string } - - === mod2.js === -@@= skipped -25, +25 lines =@@ - * @returns {string|number} The return. +@@= skipped -12, +12 lines =@@ + * str: string, + * boo: boolean + * }} Type2 ++>Type2 : Type2 ++ */ - function check(obj) { -->check : (obj: Type2) => string | number -->obj : Type2 -+>check : (obj: any) => any -+>obj : any - - return obj.boo ? obj.num : obj.str; -->obj.boo ? obj.num : obj.str : string | number -->obj.boo : boolean -->obj : Type2 -->boo : boolean -->obj.num : number -->obj : Type2 -->num : number -->obj.str : string -->obj : Type2 -->str : string -+>obj.boo ? obj.num : obj.str : any -+>obj.boo : any -+>obj : any -+>boo : any -+>obj.num : any -+>obj : any -+>num : any -+>obj.str : any -+>obj : any -+>str : any - } - === mod3.js === -@@= skipped -33, +33 lines =@@ - * @returns {string|number} The return. + /** +@@= skipped -29, +31 lines =@@ + * A function whose signature is very long. + * + * @typedef {function(boolean, string, number): ++> : function ++ + * (string|number)} StringOrNumber1 */ - function use1(func, bool, str, num) { -->use1 : (func: StringOrNumber1, bool: boolean, str: string, num: number) => string | number -->func : StringOrNumber1 -->bool : boolean -->str : string -->num : number -+>use1 : (func: any, bool: any, str: any, num: any) => any -+>func : any -+>bool : any -+>str : any -+>num : any + +@@= skipped -19, +21 lines =@@ + >num : number return func(bool, str, num) ->func(bool, str, num) : string | number -->func : StringOrNumber1 -->bool : boolean -->str : string -->num : number +>func(bool, str, num) : any -+>func : any -+>bool : any -+>str : any -+>num : any - } - - === mod4.js === -@@= skipped -32, +32 lines =@@ - * @returns {string|number} The return. + >func : StringOrNumber1 + >bool : boolean + >str : string +@@= skipped -12, +12 lines =@@ + * A function whose signature is very long. + * + * @typedef {function(boolean, string, ++> : function ++ + * number): + * (string|number)} StringOrNumber2 */ - function use2(func, bool, str, num) { -->use2 : (func: StringOrNumber2, bool: boolean, str: string, num: number) => string | number -->func : StringOrNumber2 -->bool : boolean -->str : string -->num : number -+>use2 : (func: any, bool: any, str: any, num: any) => any -+>func : any -+>bool : any -+>str : any -+>num : any +@@= skipped -20, +22 lines =@@ + >num : number return func(bool, str, num) ->func(bool, str, num) : string | number -->func : StringOrNumber2 -->bool : boolean -->str : string -->num : number +>func(bool, str, num) : any -+>func : any -+>bool : any -+>str : any -+>num : any - } - - === mod5.js === -@@= skipped -32, +32 lines =@@ - * @returns {string|number} The return. + >func : StringOrNumber2 + >bool : boolean + >str : string +@@= skipped -17, +17 lines =@@ + * boo: + * boolean + * }} Type5 ++>Type5 : Type5 ++ */ - function check5(obj) { -->check5 : (obj: Type5) => string | number -->obj : Type5 -+>check5 : (obj: any) => any -+>obj : any - - return obj.boo ? obj.num : obj.str; -->obj.boo ? obj.num : obj.str : string | number -->obj.boo : boolean -->obj : Type5 -->boo : boolean -->obj.num : number -->obj : Type5 -->num : number -->obj.str : string -->obj : Type5 -->str : string -+>obj.boo ? obj.num : obj.str : any -+>obj.boo : any -+>obj : any -+>boo : any -+>obj.num : any -+>obj : any -+>num : any -+>obj.str : any -+>obj : any -+>str : any - } - === mod6.js === -@@= skipped -32, +32 lines =@@ - * @returns {*} The return. + /** +@@= skipped -32, +34 lines =@@ + * bar: + * * + * }} Type6 ++>Type6 : Type6 ++ */ - function check6(obj) { -->check6 : (obj: Type6) => any -->obj : Type6 -+>check6 : (obj: any) => any -+>obj : any - - return obj.foo; - >obj.foo : any -->obj : Type6 -+>obj : any - >foo : any - } + /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.errors.txt.diff new file mode 100644 index 0000000000..d9ecf89023 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.errors.txt.diff @@ -0,0 +1,42 @@ +--- old.uniqueSymbolsDeclarationsInJs.errors.txt ++++ new.uniqueSymbolsDeclarationsInJs.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++uniqueSymbolsDeclarationsInJs.js(11,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. ++uniqueSymbolsDeclarationsInJs.js(16,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. ++ ++ ++==== uniqueSymbolsDeclarationsInJs.js (2 errors) ==== ++ // classes ++ class C { ++ /** ++ * @readonly ++ */ ++ static readonlyStaticCall = Symbol(); ++ /** ++ * @type {unique symbol} ++ * @readonly ++ */ ++ static readonlyStaticType; ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. ++ /** ++ * @type {unique symbol} ++ * @readonly ++ */ ++ static readonlyStaticTypeAndCall = Symbol(); ++ ~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. ++ static readwriteStaticCall = Symbol(); ++ ++ /** ++ * @readonly ++ */ ++ readonlyCall = Symbol(); ++ readwriteCall = Symbol(); ++ } ++ ++ /** @type {unique symbol} */ ++ const a = Symbol(); ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.types.diff index 7737d224db..8443abafa1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.types.diff @@ -16,7 +16,7 @@ */ static readonlyStaticType; ->readonlyStaticType : unique symbol -+>readonlyStaticType : any ++>readonlyStaticType : symbol /** * @type {unique symbol} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt.diff index d3069a0b6d..83db4d5e84 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt.diff @@ -1,30 +1,22 @@ --- old.uniqueSymbolsDeclarationsInJsErrors.errors.txt +++ new.uniqueSymbolsDeclarationsInJsErrors.errors.txt -@@= skipped -0, +-1 lines =@@ --uniqueSymbolsDeclarationsInJsErrors.js(5,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. --uniqueSymbolsDeclarationsInJsErrors.js(14,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. -- -- +@@= skipped -0, +0 lines =@@ + uniqueSymbolsDeclarationsInJsErrors.js(5,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. ++uniqueSymbolsDeclarationsInJsErrors.js(10,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + uniqueSymbolsDeclarationsInJsErrors.js(14,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + + -==== uniqueSymbolsDeclarationsInJsErrors.js (2 errors) ==== -- class C { -- /** -- * @type {unique symbol} -- */ -- static readwriteStaticType; -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. -- /** -- * @type {unique symbol} -- * @readonly -- */ -- static readonlyType; -- /** -- * @type {unique symbol} -- */ -- static readwriteType; -- ~~~~~~~~~~~~~ --!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. -- } -- -@@= skipped --1, +1 lines =@@ -+ ++==== uniqueSymbolsDeclarationsInJsErrors.js (3 errors) ==== + class C { + /** + * @type {unique symbol} +@@= skipped -14, +15 lines =@@ + * @readonly + */ + static readonlyType; ++ ~~~~~~~~~~~~ ++!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + /** + * @type {unique symbol} + */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.types.diff index 0a94059f83..e4b437654f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.types.diff @@ -1,25 +1,11 @@ --- old.uniqueSymbolsDeclarationsInJsErrors.types +++ new.uniqueSymbolsDeclarationsInJsErrors.types -@@= skipped -7, +7 lines =@@ - * @type {unique symbol} - */ - static readwriteStaticType; -->readwriteStaticType : symbol -+>readwriteStaticType : any - - /** - * @type {unique symbol} +@@= skipped -14, +14 lines =@@ * @readonly */ static readonlyType; ->readonlyType : unique symbol -+>readonlyType : any ++>readonlyType : symbol /** * @type {unique symbol} - */ - static readwriteType; -->readwriteType : symbol -+>readwriteType : any - } - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.errors.txt.diff index e64541e1ba..69e845ec0f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.errors.txt.diff @@ -4,9 +4,10 @@ - @@= skipped --1, +1 lines =@@ +use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++use.js(10,12): error TS2503: Cannot find namespace 'ex'. + + -+==== use.js (1 errors) ==== ++==== use.js (2 errors) ==== + var ex = require('./ex') + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -19,6 +20,8 @@ + // types work + /** + * @param {ex.Crunch} wrap ++ ~~ ++!!! error TS2503: Cannot find namespace 'ex'. + */ + function f(wrap) { + wrap.n diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.types.diff index a64feb6d8f..b723fd3e3d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.types.diff @@ -41,8 +41,8 @@ function f(wrap) { ->f : (wrap: ex.Crunch) => void ->wrap : ex.Crunch -+>f : (wrap: any) => void -+>wrap : any ++>f : (wrap: Crunch) => void ++>wrap : Crunch wrap.n ->wrap.n : number @@ -63,7 +63,7 @@ ->this.n : any ->this : this +>wrap.n : any -+>wrap : any ++>wrap : Crunch >n : any ->n : number - } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromTypescript.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromTypescript.errors.txt.diff index a125326dac..26a8cc3d72 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromTypescript.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromTypescript.errors.txt.diff @@ -4,9 +4,11 @@ - @@= skipped --1, +1 lines =@@ +use.js(1,10): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++use.js(10,12): error TS2503: Cannot find namespace 'ex'. ++use.js(11,12): error TS2503: Cannot find namespace 'ex'. + + -+==== use.js (1 errors) ==== ++==== use.js (3 errors) ==== + var ex = require('./ex') + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. @@ -19,7 +21,11 @@ + // types work + /** + * @param {ex.Greatest} greatest ++ ~~ ++!!! error TS2503: Cannot find namespace 'ex'. + * @param {ex.Crunch} wrap ++ ~~ ++!!! error TS2503: Cannot find namespace 'ex'. + */ + function f(greatest, wrap) { + greatest.day diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromTypescript.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromTypescript.types.diff index e35dbdf8b4..93df86ffc7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromTypescript.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromTypescript.types.diff @@ -42,16 +42,16 @@ ->f : (greatest: ex.Greatest, wrap: ex.Crunch) => void ->greatest : ex.Greatest ->wrap : ex.Crunch -+>f : (greatest: any, wrap: any) => void -+>greatest : any -+>wrap : any ++>f : (greatest: Greatest, wrap: Crunch) => void ++>greatest : Greatest ++>wrap : Crunch greatest.day ->greatest.day : 1 ->greatest : ex.Greatest ->day : 1 +>greatest.day : any -+>greatest : any ++>greatest : Greatest +>day : any wrap.n @@ -59,7 +59,7 @@ ->wrap : ex.Crunch ->n : number +>wrap.n : any -+>wrap : any ++>wrap : Crunch +>n : any } From 85a68a11108b21ef63d42afaa8679edc8230548d Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 21 Mar 2025 07:01:59 -0700 Subject: [PATCH 10/25] Add Host pointer to JSDocTypeExpression,fix name resolution nameresolver still needs to check for JS nodes because it will often start a walk upward looking at the *original* type nodes deeply nested in JSDoc. When it hits the JSDocTypeExpression, it should move over to the type expression's hosted position in the tree, such as a real parameter. The JS code is much less intrusive than before though. --- internal/ast/ast.go | 1 + internal/ast/utilities.go | 4 +- internal/binder/nameresolver.go | 28 +++---- internal/parser/jsdoc.go | 72 +++++++++--------- .../jsFileFunctionOverloads.errors.txt | 67 ---------------- .../jsFileFunctionOverloads2.errors.txt | 62 --------------- ...ypeParameterOnVariableStatement.errors.txt | 25 ------ ...eTagTypeParameterOnVariableStatement.types | 4 +- .../jsDeclarationsFunctions.errors.txt | 71 +++++++++++++++++ .../conformance/jsDeclarationsFunctions.types | 34 ++++----- .../conformance/jsdocTemplateTag2.errors.txt | 20 ----- .../jsdocTemplateTagDefault.errors.txt | 12 ++- .../jsFileFunctionOverloads.errors.txt.diff | 72 ------------------ .../jsFileFunctionOverloads2.errors.txt.diff | 67 ---------------- ...rameterOnVariableStatement.errors.txt.diff | 30 -------- ...ypeParameterOnVariableStatement.types.diff | 13 ---- .../jsDeclarationsFunctions.errors.txt.diff | 76 +++++++++++++++++++ .../jsDeclarationsFunctions.types.diff | 42 +++++----- .../jsdocTemplateTag2.errors.txt.diff | 25 ------ .../jsdocTemplateTagDefault.errors.txt.diff | 27 +++++-- 20 files changed, 270 insertions(+), 482 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag2.errors.txt.diff diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 31760df868..30ae6cf236 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -7676,6 +7676,7 @@ func (node *JSDocLinkCode) Name() *DeclarationName { type JSDocTypeExpression struct { TypeNodeBase + Host *Node Type *TypeNode } diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index 47445ed063..c8b4193a85 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -2286,9 +2286,9 @@ func IsGlobalSourceFile(node *Node) bool { return node.Kind == KindSourceFile && !IsExternalOrCommonJsModule(node.AsSourceFile()) } -func IsParameterLikeOrReturnTag(node *Node) bool { +func IsParameterLike(node *Node) bool { switch node.Kind { - case KindParameter, KindTypeParameter, KindJSDocParameterTag, KindJSDocReturnTag: + case KindParameter, KindTypeParameter: return true } return false diff --git a/internal/binder/nameresolver.go b/internal/binder/nameresolver.go index 3bb9a420f2..5f87e5f542 100644 --- a/internal/binder/nameresolver.go +++ b/internal/binder/nameresolver.go @@ -55,12 +55,10 @@ loop: // - Type parameters of a function are in scope in the entire function declaration, including the parameter // list and return type. However, local types are only in scope in the function body. // - parameters are only in the scope of function body - // This restriction does not apply to JSDoc comment types because they are parented - // at a higher level than type parameters would normally be - if meaning&result.Flags&ast.SymbolFlagsType != 0 && lastLocation.Kind != ast.KindJSDoc { - useResult = result.Flags&ast.SymbolFlagsTypeParameter != 0 && (lastLocation.Flags&ast.NodeFlagsSynthesized != 0 || - lastLocation == location.Type() || - ast.IsParameterLikeOrReturnTag(lastLocation)) + if meaning&result.Flags&ast.SymbolFlagsType != 0 { + useResult = result.Flags&ast.SymbolFlagsTypeParameter != 0 && + // TODO: Right now, the synthetic check isn't needed here. I'm pretty sure. + (lastLocation.Flags&ast.NodeFlagsSynthesized != 0 || lastLocation == location.Type() || ast.IsParameterLike(lastLocation)) } if meaning&result.Flags&ast.SymbolFlagsVariable != 0 { // expression inside parameter will lookup as normal variable scope when targeting es2015+ @@ -290,19 +288,11 @@ loop: if isSelfReferenceLocation(location, lastLocation) { lastSelfReferenceLocation = location } - lastLocation = location - switch { - // case isJSDocTemplateTag(location): - // location = getEffectiveContainerForJSDocTemplateTag(location.(*JSDocTemplateTag)) - // if location == nil { - // location = location.parent - // } - // case isJSDocParameterTag(location) || isJSDocReturnTag(location): - // location = getHostSignatureFromJSDoc(location) - // if location == nil { - // location = location.parent - // } - default: + if location.Kind == ast.KindJSDocTypeExpression && location.AsJSDocTypeExpression().Host != nil { + lastLocation = location.AsJSDocTypeExpression().Host.Type() + location = location.AsJSDocTypeExpression().Host + } else { + lastLocation = location location = location.Parent } } diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index 66ab309350..62a71e15f6 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -89,9 +89,10 @@ func (p *Parser) withJSDoc(node *ast.Node, hasJSDoc bool) { // Case 1 means that property access et al need look down to their children in the same way // And all the cases might need to be recursive (but probably not in practise) -func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { + +func (p *Parser) attachJSDoc(parent *ast.Node, jsDoc []*ast.Node) { // 1. modify the attached node - // 1b. Tags that modify their host node should only be taken from the last JSDoc (@overload is 'attached' but actually emits a separate signature node) + // 1b. Tags that modify their host node should only be taken from the parent's last JSDoc (@overload is 'attached' but actually emits a separate signature node) // 2. later, output additional sibling nodes (probably unrelated) into the nearest containing node list for _, j := range jsDoc { isLast := j == jsDoc[len(jsDoc)-1] @@ -142,53 +143,53 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { } switch tag.Kind { case ast.KindJSDocTypeTag: - if host.Kind == ast.KindVariableStatement && host.AsVariableStatement().DeclarationList != nil { + if parent.Kind == ast.KindVariableStatement && parent.AsVariableStatement().DeclarationList != nil { // TODO: Could still clone the node and mark it synthetic - for _, declaration := range host.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { + for _, declaration := range parent.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { if declaration.AsVariableDeclaration().Type == nil { - declaration.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression) + declaration.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, declaration) } } - } else if host.Kind == ast.KindPropertyDeclaration { - decl := host.AsPropertyDeclaration() + } else if parent.Kind == ast.KindPropertyDeclaration { + decl := parent.AsPropertyDeclaration() if decl.Type == nil { - decl.Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression) + decl.Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent) } - } else if host.Kind == ast.KindPropertyAssignment { - prop := host.AsPropertyAssignment() - prop.Initializer = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), prop.Initializer) - } else if host.Kind == ast.KindExportAssignment { - export := host.AsExportAssignment() - export.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), export.Expression) - } else if host.Kind == ast.KindReturnStatement { - ret := host.AsReturnStatement() - ret.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), ret.Expression) - } else if host.Kind == ast.KindParenthesizedExpression { - paren:= host.AsParenthesizedExpression() - paren.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression), paren.Expression) + } else if parent.Kind == ast.KindPropertyAssignment { + prop := parent.AsPropertyAssignment() + prop.Initializer = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), prop.Initializer) + } else if parent.Kind == ast.KindExportAssignment { + export := parent.AsExportAssignment() + export.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), export.Expression) + } else if parent.Kind == ast.KindReturnStatement { + ret := parent.AsReturnStatement() + ret.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), ret.Expression) + } else if parent.Kind == ast.KindParenthesizedExpression { + paren := parent.AsParenthesizedExpression() + paren.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), paren.Expression) } case ast.KindJSDocTemplateTag: - if fun, ok := getFunctionLikeHost(host); ok { + if fun, ok := getFunctionLikeHost(parent); ok { if fun.TypeParameters() == nil { fun.FunctionLikeData().TypeParameters = p.gatherTypeParameters(j, fun.Loc) } - } else if host.Kind == ast.KindClassDeclaration { - class := host.AsClassDeclaration() + } else if parent.Kind == ast.KindClassDeclaration { + class := parent.AsClassDeclaration() if class.TypeParameters == nil { - class.TypeParameters = p.gatherTypeParameters(j, host.Loc) + class.TypeParameters = p.gatherTypeParameters(j, parent.Loc) } - } else if host.Kind == ast.KindClassExpression { - class := host.AsClassExpression() + } else if parent.Kind == ast.KindClassExpression { + class := parent.AsClassExpression() if class.TypeParameters == nil { - class.TypeParameters = p.gatherTypeParameters(j, host.Loc) + class.TypeParameters = p.gatherTypeParameters(j, parent.Loc) } } case ast.KindJSDocParameterTag: - if fun, ok := getFunctionLikeHost(host); ok { + if fun, ok := getFunctionLikeHost(parent); ok { jsparam := tag.AsJSDocParameterTag() if param, ok := findMatchingParameter(fun, jsparam); ok { if param.Type() == nil { - param.AsParameterDeclaration().Type = p.makeNewType(jsparam.TypeExpression) + param.AsParameterDeclaration().Type = p.makeNewType(jsparam.TypeExpression, param) if param.AsParameterDeclaration().QuestionToken == nil && param.AsParameterDeclaration().Initializer == nil && (jsparam.IsBracketed || jsparam.TypeExpression != nil && jsparam.TypeExpression.Type().Kind == ast.KindJSDocOptionalType) { @@ -199,9 +200,9 @@ func (p *Parser) attachJSDoc(host *ast.Node, jsDoc []*ast.Node) { } } case ast.KindJSDocReturnTag: - if fun, ok := getFunctionLikeHost(host); ok { + if fun, ok := getFunctionLikeHost(parent); ok { if fun.Type() == nil { - fun.FunctionLikeData().Type = p.makeNewType(tag.AsJSDocReturnTag().TypeExpression) + fun.FunctionLikeData().Type = p.makeNewType(tag.AsJSDocReturnTag().TypeExpression, fun) } } } @@ -273,14 +274,17 @@ func (p *Parser) makeNewTypeAssertion(t *ast.TypeNode, e *ast.Node) *ast.Node { return assert } -func (p *Parser) makeNewType(typeExpression *ast.TypeNode) *ast.Node { +func (p *Parser) makeNewType(typeExpression *ast.TypeNode, host *ast.Node) *ast.Node { if typeExpression == nil || typeExpression.Type() == nil { return nil } - + // TODO: Panic if Host is already set + typeExpression.AsJSDocTypeExpression().Host = host t := typeExpression.Type().Clone(&p.factory) - // TODO: What other flags? Copy from decl? from tag's typeexpression? t.Flags |= typeExpression.Flags | ast.NodeFlagsSynthesized + if host != nil { + t.Parent = host + } return t } diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt deleted file mode 100644 index c6c7b6c8e6..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads.errors.txt +++ /dev/null @@ -1,67 +0,0 @@ -jsFileFunctionOverloads.js(26,12): error TS2304: Cannot find name 'T'. -jsFileFunctionOverloads.js(27,14): error TS2304: Cannot find name 'T'. - - -==== jsFileFunctionOverloads.js (2 errors) ==== - /** - * @overload - * @param {number} x - * @returns {'number'} - */ - /** - * @overload - * @param {string} x - * @returns {'string'} - */ - /** - * @overload - * @param {boolean} x - * @returns {'boolean'} - */ - /** - * @param {unknown} x - * @returns {string} - */ - function getTypeName(x) { - return typeof x; - } - - /** - * @template T - * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T} - ~ -!!! error TS2304: Cannot find name 'T'. - */ - const identity = x => x; - - /** - * @template T - * @template U - * @overload - * @param {T[]} array - * @param {(x: T) => U[]} iterable - * @returns {U[]} - */ - /** - * @template T - * @overload - * @param {T[][]} array - * @returns {T[]} - */ - /** - * @param {unknown[]} array - * @param {(x: unknown) => unknown} iterable - * @returns {unknown[]} - */ - function flatMap(array, iterable = identity) { - /** @type {unknown[]} */ - const result = []; - for (let i = 0; i < array.length; i += 1) { - result.push(.../** @type {unknown[]} */(iterable(array[i]))); - } - return result; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt deleted file mode 100644 index 5b3c661435..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionOverloads2.errors.txt +++ /dev/null @@ -1,62 +0,0 @@ -jsFileFunctionOverloads2.js(24,12): error TS2304: Cannot find name 'T'. -jsFileFunctionOverloads2.js(25,14): error TS2304: Cannot find name 'T'. - - -==== jsFileFunctionOverloads2.js (2 errors) ==== - // Also works if all @overload tags are combined in one comment. - /** - * @overload - * @param {number} x - * @returns {'number'} - * - * @overload - * @param {string} x - * @returns {'string'} - * - * @overload - * @param {boolean} x - * @returns {'boolean'} - * - * @param {unknown} x - * @returns {string} - */ - function getTypeName(x) { - return typeof x; - } - - /** - * @template T - * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T} - ~ -!!! error TS2304: Cannot find name 'T'. - */ - const identity = x => x; - - /** - * @template T - * @template U - * @overload - * @param {T[]} array - * @param {(x: T) => U[]} iterable - * @returns {U[]} - * - * @overload - * @param {T[][]} array - * @returns {T[]} - * - * @param {unknown[]} array - * @param {(x: unknown) => unknown} iterable - * @returns {unknown[]} - */ - function flatMap(array, iterable = identity) { - /** @type {unknown[]} */ - const result = []; - for (let i = 0; i < array.length; i += 1) { - result.push(.../** @type {unknown[]} */(iterable(array[i]))); - } - return result; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt deleted file mode 100644 index bd258156de..0000000000 --- a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt +++ /dev/null @@ -1,25 +0,0 @@ -instantiateTemplateTagTypeParameterOnVariableStatement.js(3,12): error TS2304: Cannot find name 'T'. -instantiateTemplateTagTypeParameterOnVariableStatement.js(4,18): error TS2304: Cannot find name 'T'. -instantiateTemplateTagTypeParameterOnVariableStatement.js(4,24): error TS2304: Cannot find name 'T'. - - -==== instantiateTemplateTagTypeParameterOnVariableStatement.js (3 errors) ==== - /** - * @template T - * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {(b: T) => T} - ~ -!!! error TS2304: Cannot find name 'T'. - ~ -!!! error TS2304: Cannot find name 'T'. - */ - const seq = a => b => b; - - const text1 = "hello"; - const text2 = "world"; - - /** @type {string} */ - var text3 = seq(text1)(text2); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types index 3c17660135..72bbe8f04d 100644 --- a/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types +++ b/testdata/baselines/reference/submodule/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types @@ -25,8 +25,8 @@ const text2 = "world"; /** @type {string} */ var text3 = seq(text1)(text2); >text3 : string ->seq(text1)(text2) : T ->seq(text1) : (b: T) => T +>seq(text1)(text2) : string +>seq(text1) : (b: string) => string >seq : (a: T) => (b: T) => T >text1 : "hello" >text2 : "world" diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt new file mode 100644 index 0000000000..b5b272ad82 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.errors.txt @@ -0,0 +1,71 @@ +index.js(38,21): error TS2349: This expression is not callable. + Type '{ y: ???; }' has no call signatures. +index.js(48,21): error TS2349: This expression is not callable. + Type '{ y: ???; }' has no call signatures. + + +==== index.js (2 errors) ==== + export function a() {} + + export function b() {} + b.cat = "cat"; + + export function c() {} + c.Cls = class {} + + /** + * @param {number} a + * @param {number} b + * @return {string} + */ + export function d(a, b) { return /** @type {*} */(null); } + + /** + * @template T,U + * @param {T} a + * @param {U} b + * @return {T & U} + */ + export function e(a, b) { return /** @type {*} */(null); } + + /** + * @template T + * @param {T} a + */ + export function f(a) { + return a; + } + f.self = f; + + /** + * @param {{x: string}} a + * @param {{y: typeof b}} b + */ + function g(a, b) { + return a.x && b.y(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type '{ y: ???; }' has no call signatures. + } + + export { g }; + + /** + * @param {{x: string}} a + * @param {{y: typeof b}} b + */ + function hh(a, b) { + return a.x && b.y(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type '{ y: ???; }' has no call signatures. + } + + export { hh as h }; + + export function i() {} + export { i as ii }; + + export { j as jj }; + export function j() {} + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.types index e5dda8b3cf..ad9acc5c28 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.types @@ -72,47 +72,47 @@ f.self = f; * @param {{y: typeof b}} b */ function g(a, b) { ->g : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void +>g : (a: { x: string; }, b: { y: ???; }) => any >a : { x: string; } ->b : { y: { (): void; cat: string; }; } +>b : { y: ???; } return a.x && b.y(); ->a.x && b.y() : void +>a.x && b.y() : any >a.x : string >a : { x: string; } >x : string ->b.y() : void ->b.y : { (): void; cat: string; } ->b : { y: { (): void; cat: string; }; } ->y : { (): void; cat: string; } +>b.y() : any +>b.y : { y: ???; } +>b : { y: ???; } +>y : { y: ???; } } export { g }; ->g : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void +>g : (a: { x: string; }, b: { y: ???; }) => any /** * @param {{x: string}} a * @param {{y: typeof b}} b */ function hh(a, b) { ->hh : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void +>hh : (a: { x: string; }, b: { y: ???; }) => any >a : { x: string; } ->b : { y: { (): void; cat: string; }; } +>b : { y: ???; } return a.x && b.y(); ->a.x && b.y() : void +>a.x && b.y() : any >a.x : string >a : { x: string; } >x : string ->b.y() : void ->b.y : { (): void; cat: string; } ->b : { y: { (): void; cat: string; }; } ->y : { (): void; cat: string; } +>b.y() : any +>b.y : { y: ???; } +>b : { y: ???; } +>y : { y: ???; } } export { hh as h }; ->hh : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void ->h : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void +>hh : (a: { x: string; }, b: { y: ???; }) => any +>h : (a: { x: string; }, b: { y: ???; }) => any export function i() {} >i : () => void diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt deleted file mode 100644 index 5513f1c711..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag2.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -github17339.js(4,13): error TS2304: Cannot find name 'T'. -github17339.js(5,15): error TS2304: Cannot find name 'T'. - - -==== github17339.js (2 errors) ==== - var obj = { - /** - * @template T - * @param {T} a - ~ -!!! error TS2304: Cannot find name 'T'. - * @returns {T} - ~ -!!! error TS2304: Cannot find name 'T'. - */ - x: function (a) { - return a; - }, - }; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt index 2d72bf6032..217f2360ef 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt @@ -1,11 +1,13 @@ file.js(3,15): error TS2304: Cannot find name 'T'. file.js(38,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. +file.js(45,17): error TS2304: Cannot find name 'T'. file.js(49,21): error TS2706: Required type parameters may not follow optional type parameters. file.js(57,1): error TS2706: Required type parameters may not follow optional type parameters. -file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. +file.js(60,17): error TS2304: Cannot find name 'U'. +file.js(61,17): error TS2304: Cannot find name 'T'. -==== file.js (5 errors) ==== +==== file.js (7 errors) ==== /** * @template {string | number} [T=string] - ok: defaults are permitted * @typedef {[T]} A @@ -55,6 +57,8 @@ file.js(60,17): error TS2744: Type parameter defaults can only reference previou /** * @template T * @template [U=T] - ok: default can reference earlier type parameter + ~ +!!! error TS2304: Cannot find name 'T'. * @param {T} a * @param {U} b */ @@ -75,8 +79,10 @@ file.js(60,17): error TS2744: Type parameter defaults can only reference previou /** * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. ~ -!!! error TS2744: Type parameter defaults can only reference previously declared type parameters. +!!! error TS2304: Cannot find name 'U'. * @template [U=T] + ~ +!!! error TS2304: Cannot find name 'T'. * @param {T} a * @param {U} b */ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.errors.txt.diff deleted file mode 100644 index 1c31c374eb..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads.errors.txt.diff +++ /dev/null @@ -1,72 +0,0 @@ ---- old.jsFileFunctionOverloads.errors.txt -+++ new.jsFileFunctionOverloads.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+jsFileFunctionOverloads.js(26,12): error TS2304: Cannot find name 'T'. -+jsFileFunctionOverloads.js(27,14): error TS2304: Cannot find name 'T'. -+ -+ -+==== jsFileFunctionOverloads.js (2 errors) ==== -+ /** -+ * @overload -+ * @param {number} x -+ * @returns {'number'} -+ */ -+ /** -+ * @overload -+ * @param {string} x -+ * @returns {'string'} -+ */ -+ /** -+ * @overload -+ * @param {boolean} x -+ * @returns {'boolean'} -+ */ -+ /** -+ * @param {unknown} x -+ * @returns {string} -+ */ -+ function getTypeName(x) { -+ return typeof x; -+ } -+ -+ /** -+ * @template T -+ * @param {T} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ const identity = x => x; -+ -+ /** -+ * @template T -+ * @template U -+ * @overload -+ * @param {T[]} array -+ * @param {(x: T) => U[]} iterable -+ * @returns {U[]} -+ */ -+ /** -+ * @template T -+ * @overload -+ * @param {T[][]} array -+ * @returns {T[]} -+ */ -+ /** -+ * @param {unknown[]} array -+ * @param {(x: unknown) => unknown} iterable -+ * @returns {unknown[]} -+ */ -+ function flatMap(array, iterable = identity) { -+ /** @type {unknown[]} */ -+ const result = []; -+ for (let i = 0; i < array.length; i += 1) { -+ result.push(.../** @type {unknown[]} */(iterable(array[i]))); -+ } -+ return result; -+ } -+ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.errors.txt.diff deleted file mode 100644 index cd7137f8a7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionOverloads2.errors.txt.diff +++ /dev/null @@ -1,67 +0,0 @@ ---- old.jsFileFunctionOverloads2.errors.txt -+++ new.jsFileFunctionOverloads2.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+jsFileFunctionOverloads2.js(24,12): error TS2304: Cannot find name 'T'. -+jsFileFunctionOverloads2.js(25,14): error TS2304: Cannot find name 'T'. -+ -+ -+==== jsFileFunctionOverloads2.js (2 errors) ==== -+ // Also works if all @overload tags are combined in one comment. -+ /** -+ * @overload -+ * @param {number} x -+ * @returns {'number'} -+ * -+ * @overload -+ * @param {string} x -+ * @returns {'string'} -+ * -+ * @overload -+ * @param {boolean} x -+ * @returns {'boolean'} -+ * -+ * @param {unknown} x -+ * @returns {string} -+ */ -+ function getTypeName(x) { -+ return typeof x; -+ } -+ -+ /** -+ * @template T -+ * @param {T} x -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ const identity = x => x; -+ -+ /** -+ * @template T -+ * @template U -+ * @overload -+ * @param {T[]} array -+ * @param {(x: T) => U[]} iterable -+ * @returns {U[]} -+ * -+ * @overload -+ * @param {T[][]} array -+ * @returns {T[]} -+ * -+ * @param {unknown[]} array -+ * @param {(x: unknown) => unknown} iterable -+ * @returns {unknown[]} -+ */ -+ function flatMap(array, iterable = identity) { -+ /** @type {unknown[]} */ -+ const result = []; -+ for (let i = 0; i < array.length; i += 1) { -+ result.push(.../** @type {unknown[]} */(iterable(array[i]))); -+ } -+ return result; -+ } -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff deleted file mode 100644 index b2e4887db6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt -+++ new.instantiateTemplateTagTypeParameterOnVariableStatement.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+instantiateTemplateTagTypeParameterOnVariableStatement.js(3,12): error TS2304: Cannot find name 'T'. -+instantiateTemplateTagTypeParameterOnVariableStatement.js(4,18): error TS2304: Cannot find name 'T'. -+instantiateTemplateTagTypeParameterOnVariableStatement.js(4,24): error TS2304: Cannot find name 'T'. -+ -+ -+==== instantiateTemplateTagTypeParameterOnVariableStatement.js (3 errors) ==== -+ /** -+ * @template T -+ * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {(b: T) => T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ const seq = a => b => b; -+ -+ const text1 = "hello"; -+ const text2 = "world"; -+ -+ /** @type {string} */ -+ var text3 = seq(text1)(text2); -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types.diff deleted file mode 100644 index 0a221061c3..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/instantiateTemplateTagTypeParameterOnVariableStatement.types.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.instantiateTemplateTagTypeParameterOnVariableStatement.types -+++ new.instantiateTemplateTagTypeParameterOnVariableStatement.types -@@= skipped -24, +24 lines =@@ - /** @type {string} */ - var text3 = seq(text1)(text2); - >text3 : string -->seq(text1)(text2) : string -->seq(text1) : (b: string) => string -+>seq(text1)(text2) : T -+>seq(text1) : (b: T) => T - >seq : (a: T) => (b: T) => T - >text1 : "hello" - >text2 : "world" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.errors.txt.diff new file mode 100644 index 0000000000..cd02080146 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.errors.txt.diff @@ -0,0 +1,76 @@ +--- old.jsDeclarationsFunctions.errors.txt ++++ new.jsDeclarationsFunctions.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++index.js(38,21): error TS2349: This expression is not callable. ++ Type '{ y: ???; }' has no call signatures. ++index.js(48,21): error TS2349: This expression is not callable. ++ Type '{ y: ???; }' has no call signatures. ++ ++ ++==== index.js (2 errors) ==== ++ export function a() {} ++ ++ export function b() {} ++ b.cat = "cat"; ++ ++ export function c() {} ++ c.Cls = class {} ++ ++ /** ++ * @param {number} a ++ * @param {number} b ++ * @return {string} ++ */ ++ export function d(a, b) { return /** @type {*} */(null); } ++ ++ /** ++ * @template T,U ++ * @param {T} a ++ * @param {U} b ++ * @return {T & U} ++ */ ++ export function e(a, b) { return /** @type {*} */(null); } ++ ++ /** ++ * @template T ++ * @param {T} a ++ */ ++ export function f(a) { ++ return a; ++ } ++ f.self = f; ++ ++ /** ++ * @param {{x: string}} a ++ * @param {{y: typeof b}} b ++ */ ++ function g(a, b) { ++ return a.x && b.y(); ++ ~ ++!!! error TS2349: This expression is not callable. ++!!! error TS2349: Type '{ y: ???; }' has no call signatures. ++ } ++ ++ export { g }; ++ ++ /** ++ * @param {{x: string}} a ++ * @param {{y: typeof b}} b ++ */ ++ function hh(a, b) { ++ return a.x && b.y(); ++ ~ ++!!! error TS2349: This expression is not callable. ++!!! error TS2349: Type '{ y: ???; }' has no call signatures. ++ } ++ ++ export { hh as h }; ++ ++ export function i() {} ++ export { i as ii }; ++ ++ export { j as jj }; ++ export function j() {} ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.types.diff index 054c33ddb3..293446ff19 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctions.types.diff @@ -71,28 +71,30 @@ */ function g(a, b) { ->g : (a: { x: string; }, b: { y: typeof import("index").b; }) => void -+>g : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void ++>g : (a: { x: string; }, b: { y: ???; }) => any >a : { x: string; } ->b : { y: typeof import("index").b; } -+>b : { y: { (): void; cat: string; }; } ++>b : { y: ???; } return a.x && b.y(); - >a.x && b.y() : void -@@= skipped -34, +35 lines =@@ +->a.x && b.y() : void ++>a.x && b.y() : any + >a.x : string >a : { x: string; } >x : string - >b.y() : void +->b.y() : void ->b.y : typeof import("index").b ->b : { y: typeof import("index").b; } ->y : typeof import("index").b -+>b.y : { (): void; cat: string; } -+>b : { y: { (): void; cat: string; }; } -+>y : { (): void; cat: string; } ++>b.y() : any ++>b.y : { y: ???; } ++>b : { y: ???; } ++>y : { y: ???; } } export { g }; ->g : (a: { x: string; }, b: { y: typeof import("index").b; }) => void -+>g : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void ++>g : (a: { x: string; }, b: { y: ???; }) => any /** * @param {{x: string}} a @@ -100,30 +102,32 @@ */ function hh(a, b) { ->hh : (a: { x: string; }, b: { y: typeof import("index").b; }) => void -+>hh : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void ++>hh : (a: { x: string; }, b: { y: ???; }) => any >a : { x: string; } ->b : { y: typeof import("index").b; } -+>b : { y: { (): void; cat: string; }; } ++>b : { y: ???; } return a.x && b.y(); - >a.x && b.y() : void -@@= skipped -23, +23 lines =@@ +->a.x && b.y() : void ++>a.x && b.y() : any + >a.x : string >a : { x: string; } >x : string - >b.y() : void +->b.y() : void ->b.y : typeof import("index").b ->b : { y: typeof import("index").b; } ->y : typeof import("index").b -+>b.y : { (): void; cat: string; } -+>b : { y: { (): void; cat: string; }; } -+>y : { (): void; cat: string; } ++>b.y() : any ++>b.y : { y: ???; } ++>b : { y: ???; } ++>y : { y: ???; } } export { hh as h }; ->hh : (a: { x: string; }, b: { y: typeof import("index").b; }) => void ->h : (a: { x: string; }, b: { y: typeof import("index").b; }) => void -+>hh : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void -+>h : (a: { x: string; }, b: { y: { (): void; cat: string; }; }) => void ++>hh : (a: { x: string; }, b: { y: ???; }) => any ++>h : (a: { x: string; }, b: { y: ???; }) => any export function i() {} >i : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag2.errors.txt.diff deleted file mode 100644 index 00574f819b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag2.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.jsdocTemplateTag2.errors.txt -+++ new.jsdocTemplateTag2.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+github17339.js(4,13): error TS2304: Cannot find name 'T'. -+github17339.js(5,15): error TS2304: Cannot find name 'T'. -+ -+ -+==== github17339.js (2 errors) ==== -+ var obj = { -+ /** -+ * @template T -+ * @param {T} a -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ * @returns {T} -+ ~ -+!!! error TS2304: Cannot find name 'T'. -+ */ -+ x: function (a) { -+ return a; -+ }, -+ }; -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff index 430cfcaa34..ec14f86377 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff @@ -8,13 +8,15 @@ +file.js(3,15): error TS2304: Cannot find name 'T'. file.js(38,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. -file.js(53,14): error TS2706: Required type parameters may not follow optional type parameters. +-file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. ++file.js(45,17): error TS2304: Cannot find name 'T'. +file.js(49,21): error TS2706: Required type parameters may not follow optional type parameters. +file.js(57,1): error TS2706: Required type parameters may not follow optional type parameters. - file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. ++file.js(60,17): error TS2304: Cannot find name 'U'. ++file.js(61,17): error TS2304: Cannot find name 'T'. --==== file.js (7 errors) ==== -+==== file.js (5 errors) ==== + ==== file.js (7 errors) ==== /** * @template {string | number} [T=string] - ok: defaults are permitted * @typedef {[T]} A @@ -31,7 +33,7 @@ /** @type {A} */ // ok, `T` is provided for `A` const aString = [""]; /** @type {A} */ // ok, `T` is provided for `A` -@@= skipped -31, +29 lines =@@ +@@= skipped -31, +31 lines =@@ /** * @template {string | number} [T] - error: default requires an `=type` @@ -55,7 +57,13 @@ * @typedef {[T, U]} E */ -@@= skipped -35, +29 lines =@@ +@@= skipped -31, +25 lines =@@ + /** + * @template T + * @template [U=T] - ok: default can reference earlier type parameter ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @param {T} a * @param {U} b */ function f1(a, b) {} @@ -76,3 +84,12 @@ /** * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. + ~ +-!!! error TS2744: Type parameter defaults can only reference previously declared type parameters. ++!!! error TS2304: Cannot find name 'U'. + * @template [U=T] ++ ~ ++!!! error TS2304: Cannot find name 'T'. + * @param {T} a + * @param {U} b + */ From a74d9a8272ed4bc7988a9ac0ff25fea8549e6582 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 21 Mar 2025 08:07:40 -0700 Subject: [PATCH 11/25] support variabledeclaration as well --- internal/ast/ast.go | 3 +- internal/binder/nameresolver.go | 4 +- internal/parser/jsdoc.go | 11 +++- ...ocCatchClauseWithTypeAnnotation.errors.txt | 26 ++++++++- ...jsdocCatchClauseWithTypeAnnotation.symbols | 9 ++++ ...CatchClauseWithTypeAnnotation.symbols.diff | 49 +++++++++++++++-- .../jsdocCatchClauseWithTypeAnnotation.types | 20 +++---- ...ariableDeclarationWithTypeAnnotation.types | 4 +- ...chClauseWithTypeAnnotation.errors.txt.diff | 54 ------------------- ...ocCatchClauseWithTypeAnnotation.types.diff | 53 ------------------ ...leDeclarationWithTypeAnnotation.types.diff | 13 ----- 11 files changed, 104 insertions(+), 142 deletions(-) delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariableDeclarationWithTypeAnnotation.types.diff diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 30ae6cf236..d0127931c9 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -8564,7 +8564,7 @@ func (node *JSDocOverloadTag) Clone(f *NodeFactory) *Node { type JSDocTypedefTag struct { JSDocTagBase TypeExpression *Node - name *IdentifierNode + name *IdentifierNode } func (f *NodeFactory) NewJSDocTypedefTag(tagName *IdentifierNode, typeExpression *Node, name *IdentifierNode, comment *NodeList) *Node { @@ -8599,6 +8599,7 @@ func (node *JSDocTypedefTag) Clone(f *NodeFactory) *Node { } func (node *JSDocTypedefTag) Name() *DeclarationName { return node.name } + // JSDocTypeLiteral type JSDocTypeLiteral struct { TypeNodeBase diff --git a/internal/binder/nameresolver.go b/internal/binder/nameresolver.go index 5f87e5f542..73ba80aab3 100644 --- a/internal/binder/nameresolver.go +++ b/internal/binder/nameresolver.go @@ -56,9 +56,7 @@ loop: // list and return type. However, local types are only in scope in the function body. // - parameters are only in the scope of function body if meaning&result.Flags&ast.SymbolFlagsType != 0 { - useResult = result.Flags&ast.SymbolFlagsTypeParameter != 0 && - // TODO: Right now, the synthetic check isn't needed here. I'm pretty sure. - (lastLocation.Flags&ast.NodeFlagsSynthesized != 0 || lastLocation == location.Type() || ast.IsParameterLike(lastLocation)) + useResult = result.Flags&ast.SymbolFlagsTypeParameter != 0 && (lastLocation == location.Type() || ast.IsParameterLike(lastLocation)) } if meaning&result.Flags&ast.SymbolFlagsVariable != 0 { // expression inside parameter will lookup as normal variable scope when targeting es2015+ diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index 62a71e15f6..b8fe3ed870 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -150,6 +150,10 @@ func (p *Parser) attachJSDoc(parent *ast.Node, jsDoc []*ast.Node) { declaration.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, declaration) } } + } else if parent.Kind == ast.KindVariableDeclaration { + if parent.AsVariableDeclaration().Type == nil { + parent.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent) + } } else if parent.Kind == ast.KindPropertyDeclaration { decl := parent.AsPropertyDeclaration() if decl.Type == nil { @@ -278,8 +282,11 @@ func (p *Parser) makeNewType(typeExpression *ast.TypeNode, host *ast.Node) *ast. if typeExpression == nil || typeExpression.Type() == nil { return nil } - // TODO: Panic if Host is already set - typeExpression.AsJSDocTypeExpression().Host = host + if typeExpression.AsJSDocTypeExpression().Host == nil { + typeExpression.AsJSDocTypeExpression().Host = host + } else { + panic("JSDoc type expression already has a host: " + typeExpression.AsJSDocTypeExpression().Host.Kind.String()) + } t := typeExpression.Type().Clone(&p.factory) t.Flags |= typeExpression.Flags | ast.NodeFlagsSynthesized if host != nil { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.errors.txt index e67b0151cb..38388986e6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.errors.txt @@ -1,7 +1,15 @@ +foo.js(20,54): error TS2339: Property 'foo' does not exist on type 'unknown'. +foo.js(21,54): error TS2339: Property 'foo' does not exist on type 'unknown'. +foo.js(22,31): error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. +foo.js(23,31): error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. foo.js(35,7): error TS2492: Cannot redeclare identifier 'err' in catch clause. +foo.js(46,45): error TS2339: Property 'x' does not exist on type '{}'. +foo.js(47,45): error TS2339: Property 'x' does not exist on type '{}'. +foo.js(48,31): error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. +foo.js(49,31): error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. -==== foo.js (1 errors) ==== +==== foo.js (9 errors) ==== /** * @typedef {any} Any */ @@ -22,9 +30,17 @@ foo.js(35,7): error TS2492: Cannot redeclare identifier 'err' in catch clause. try { } catch (/** @type {unknown} */ err) { console.log(err); } // should be OK try { } catch (/** @type {Unknown} */ err) { console.log(err); } // should be OK try { } catch (/** @type {unknown} */ err) { err.foo; } // error in the body + ~~~ +!!! error TS2339: Property 'foo' does not exist on type 'unknown'. try { } catch (/** @type {Unknown} */ err) { err.foo; } // error in the body + ~~~ +!!! error TS2339: Property 'foo' does not exist on type 'unknown'. try { } catch (/** @type {Error} */ err) { } // error in the type + ~~~~~ +!!! error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. try { } catch (/** @type {object} */ err) { } // error in the type + ~~~~~~ +!!! error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. try { console.log(); } // @ts-ignore @@ -50,8 +66,16 @@ foo.js(35,7): error TS2492: Cannot redeclare identifier 'err' in catch clause. try { } catch (/** @type {any} */ { x }) { x.foo; } // should be OK try { } catch (/** @type {Any} */ { x }) { x.foo;} // should be OK try { } catch (/** @type {unknown} */ { x }) { console.log(x); } // error in the destructure + ~ +!!! error TS2339: Property 'x' does not exist on type '{}'. try { } catch (/** @type {Unknown} */ { x }) { console.log(x); } // error in the destructure + ~ +!!! error TS2339: Property 'x' does not exist on type '{}'. try { } catch (/** @type {Error} */ { x }) { } // error in the type + ~~~~~ +!!! error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. try { } catch (/** @type {object} */ { x }) { } // error in the type + ~~~~~~ +!!! error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols index 701095964e..b978506cf1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols @@ -24,12 +24,14 @@ function fn() { try { } catch (/** @type {Any} */ err) { } // should be OK >err : Symbol(err, Decl(foo.js, 11, 19)) +>Any : Symbol(Any, Decl(foo.js, 49, 1)) try { } catch (/** @type {unknown} */ err) { } // should be OK >err : Symbol(err, Decl(foo.js, 12, 19)) try { } catch (/** @type {Unknown} */ err) { } // should be OK >err : Symbol(err, Decl(foo.js, 13, 19)) +>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) try { } catch (err) { err.foo; } // should be OK >err : Symbol(err, Decl(foo.js, 14, 19)) @@ -41,6 +43,7 @@ function fn() { try { } catch (/** @type {Any} */ err) { err.foo; } // should be OK >err : Symbol(err, Decl(foo.js, 16, 19)) +>Any : Symbol(Any, Decl(foo.js, 49, 1)) >err : Symbol(err, Decl(foo.js, 16, 19)) try { } catch (/** @type {unknown} */ err) { console.log(err); } // should be OK @@ -52,6 +55,7 @@ function fn() { try { } catch (/** @type {Unknown} */ err) { console.log(err); } // should be OK >err : Symbol(err, Decl(foo.js, 18, 19)) +>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) >console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) @@ -63,10 +67,12 @@ function fn() { try { } catch (/** @type {Unknown} */ err) { err.foo; } // error in the body >err : Symbol(err, Decl(foo.js, 20, 19)) +>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) >err : Symbol(err, Decl(foo.js, 20, 19)) try { } catch (/** @type {Error} */ err) { } // error in the type >err : Symbol(err, Decl(foo.js, 21, 19)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) try { } catch (/** @type {object} */ err) { } // error in the type >err : Symbol(err, Decl(foo.js, 22, 19)) @@ -114,6 +120,7 @@ function fn() { try { } catch (/** @type {Any} */ { x }) { x.foo;} // should be OK >x : Symbol(x, Decl(foo.js, 44, 39)) +>Any : Symbol(Any, Decl(foo.js, 49, 1)) >x : Symbol(x, Decl(foo.js, 44, 39)) try { } catch (/** @type {unknown} */ { x }) { console.log(x); } // error in the destructure @@ -125,6 +132,7 @@ function fn() { try { } catch (/** @type {Unknown} */ { x }) { console.log(x); } // error in the destructure >x : Symbol(x, Decl(foo.js, 46, 43)) +>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) >console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) @@ -132,6 +140,7 @@ function fn() { try { } catch (/** @type {Error} */ { x }) { } // error in the type >x : Symbol(x, Decl(foo.js, 47, 41)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) try { } catch (/** @type {object} */ { x }) { } // error in the type >x : Symbol(x, Decl(foo.js, 48, 42)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff index 33cd135a03..89e91a843d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff @@ -15,7 +15,27 @@ */ function fn() { -@@= skipped -38, +42 lines =@@ +@@= skipped -17, +21 lines =@@ + + try { } catch (/** @type {Any} */ err) { } // should be OK + >err : Symbol(err, Decl(foo.js, 11, 19)) ++>Any : Symbol(Any, Decl(foo.js, 49, 1)) + + try { } catch (/** @type {unknown} */ err) { } // should be OK + >err : Symbol(err, Decl(foo.js, 12, 19)) + + try { } catch (/** @type {Unknown} */ err) { } // should be OK + >err : Symbol(err, Decl(foo.js, 13, 19)) ++>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) + + try { } catch (err) { err.foo; } // should be OK + >err : Symbol(err, Decl(foo.js, 14, 19)) +@@= skipped -17, +19 lines =@@ + + try { } catch (/** @type {Any} */ err) { err.foo; } // should be OK + >err : Symbol(err, Decl(foo.js, 16, 19)) ++>Any : Symbol(Any, Decl(foo.js, 49, 1)) + >err : Symbol(err, Decl(foo.js, 16, 19)) try { } catch (/** @type {unknown} */ err) { console.log(err); } // should be OK >err : Symbol(err, Decl(foo.js, 17, 19)) @@ -29,6 +49,7 @@ try { } catch (/** @type {Unknown} */ err) { console.log(err); } // should be OK >err : Symbol(err, Decl(foo.js, 18, 19)) ->console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) ++>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) +>console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) ->log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) @@ -36,7 +57,18 @@ >err : Symbol(err, Decl(foo.js, 18, 19)) try { } catch (/** @type {unknown} */ err) { err.foo; } // error in the body -@@= skipped -27, +27 lines =@@ +@@= skipped -22, +24 lines =@@ + + try { } catch (/** @type {Unknown} */ err) { err.foo; } // error in the body + >err : Symbol(err, Decl(foo.js, 20, 19)) ++>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) + >err : Symbol(err, Decl(foo.js, 20, 19)) + + try { } catch (/** @type {Error} */ err) { } // error in the type + >err : Symbol(err, Decl(foo.js, 21, 19)) ++>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) + + try { } catch (/** @type {object} */ err) { } // error in the type >err : Symbol(err, Decl(foo.js, 22, 19)) try { console.log(); } @@ -59,7 +91,12 @@ >err : Symbol(err, Decl(foo.js, 26, 11)) } -@@= skipped -46, +46 lines =@@ +@@= skipped -51, +53 lines =@@ + + try { } catch (/** @type {Any} */ { x }) { x.foo;} // should be OK + >x : Symbol(x, Decl(foo.js, 44, 39)) ++>Any : Symbol(Any, Decl(foo.js, 49, 1)) + >x : Symbol(x, Decl(foo.js, 44, 39)) try { } catch (/** @type {unknown} */ { x }) { console.log(x); } // error in the destructure >x : Symbol(x, Decl(foo.js, 45, 43)) @@ -73,6 +110,7 @@ try { } catch (/** @type {Unknown} */ { x }) { console.log(x); } // error in the destructure >x : Symbol(x, Decl(foo.js, 46, 43)) ->console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) ++>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) +>console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) ->log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) @@ -80,3 +118,8 @@ >x : Symbol(x, Decl(foo.js, 46, 43)) try { } catch (/** @type {Error} */ { x }) { } // error in the type + >x : Symbol(x, Decl(foo.js, 47, 41)) ++>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) + + try { } catch (/** @type {object} */ { x }) { } // error in the type + >x : Symbol(x, Decl(foo.js, 48, 42)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.types b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.types index cd5dc2a483..1c0986b44d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.types @@ -26,10 +26,10 @@ function fn() { >err : any try { } catch (/** @type {unknown} */ err) { } // should be OK ->err : any +>err : unknown try { } catch (/** @type {Unknown} */ err) { } // should be OK ->err : any +>err : unknown try { } catch (err) { err.foo; } // should be OK >err : any @@ -50,31 +50,31 @@ function fn() { >foo : any try { } catch (/** @type {unknown} */ err) { console.log(err); } // should be OK ->err : any +>err : unknown >console.log(err) : void >console.log : (...data: any[]) => void >console : Console >log : (...data: any[]) => void ->err : any +>err : unknown try { } catch (/** @type {Unknown} */ err) { console.log(err); } // should be OK ->err : any +>err : unknown >console.log(err) : void >console.log : (...data: any[]) => void >console : Console >log : (...data: any[]) => void ->err : any +>err : unknown try { } catch (/** @type {unknown} */ err) { err.foo; } // error in the body ->err : any +>err : unknown >err.foo : any ->err : any +>err : unknown >foo : any try { } catch (/** @type {Unknown} */ err) { err.foo; } // error in the body ->err : any +>err : unknown >err.foo : any ->err : any +>err : unknown >foo : any try { } catch (/** @type {Error} */ err) { } // error in the type diff --git a/testdata/baselines/reference/submodule/conformance/jsdocVariableDeclarationWithTypeAnnotation.types b/testdata/baselines/reference/submodule/conformance/jsdocVariableDeclarationWithTypeAnnotation.types index cc479bff05..f53bb4b55f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocVariableDeclarationWithTypeAnnotation.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocVariableDeclarationWithTypeAnnotation.types @@ -3,8 +3,8 @@ === foo.js === /** @type {boolean} */ var /** @type {string} */ x, ->x : boolean +>x : string /** @type {number} */ y; ->y : boolean +>y : number diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.errors.txt.diff deleted file mode 100644 index e4de43455a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.errors.txt.diff +++ /dev/null @@ -1,54 +0,0 @@ ---- old.jsdocCatchClauseWithTypeAnnotation.errors.txt -+++ new.jsdocCatchClauseWithTypeAnnotation.errors.txt -@@= skipped -0, +0 lines =@@ --foo.js(20,54): error TS2339: Property 'foo' does not exist on type 'unknown'. --foo.js(21,54): error TS2339: Property 'foo' does not exist on type 'unknown'. --foo.js(22,31): error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. --foo.js(23,31): error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. - foo.js(35,7): error TS2492: Cannot redeclare identifier 'err' in catch clause. --foo.js(46,45): error TS2339: Property 'x' does not exist on type '{}'. --foo.js(47,45): error TS2339: Property 'x' does not exist on type '{}'. --foo.js(48,31): error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. --foo.js(49,31): error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. - - --==== foo.js (9 errors) ==== -+==== foo.js (1 errors) ==== - /** - * @typedef {any} Any - */ -@@= skipped -29, +21 lines =@@ - try { } catch (/** @type {unknown} */ err) { console.log(err); } // should be OK - try { } catch (/** @type {Unknown} */ err) { console.log(err); } // should be OK - try { } catch (/** @type {unknown} */ err) { err.foo; } // error in the body -- ~~~ --!!! error TS2339: Property 'foo' does not exist on type 'unknown'. - try { } catch (/** @type {Unknown} */ err) { err.foo; } // error in the body -- ~~~ --!!! error TS2339: Property 'foo' does not exist on type 'unknown'. - try { } catch (/** @type {Error} */ err) { } // error in the type -- ~~~~~ --!!! error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. - try { } catch (/** @type {object} */ err) { } // error in the type -- ~~~~~~ --!!! error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. - - try { console.log(); } - // @ts-ignore -@@= skipped -36, +28 lines =@@ - try { } catch (/** @type {any} */ { x }) { x.foo; } // should be OK - try { } catch (/** @type {Any} */ { x }) { x.foo;} // should be OK - try { } catch (/** @type {unknown} */ { x }) { console.log(x); } // error in the destructure -- ~ --!!! error TS2339: Property 'x' does not exist on type '{}'. - try { } catch (/** @type {Unknown} */ { x }) { console.log(x); } // error in the destructure -- ~ --!!! error TS2339: Property 'x' does not exist on type '{}'. - try { } catch (/** @type {Error} */ { x }) { } // error in the type -- ~~~~~ --!!! error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. - try { } catch (/** @type {object} */ { x }) { } // error in the type -- ~~~~~~ --!!! error TS1196: Catch clause variable type annotation must be 'any' or 'unknown' if specified. - } - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.types.diff index 8908ee9aa5..e58f2bc33b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.types.diff @@ -15,56 +15,3 @@ */ function fn() { -@@= skipped -19, +23 lines =@@ - >err : any - - try { } catch (/** @type {unknown} */ err) { } // should be OK -->err : unknown -+>err : any - - try { } catch (/** @type {Unknown} */ err) { } // should be OK -->err : unknown -+>err : any - - try { } catch (err) { err.foo; } // should be OK - >err : any -@@= skipped -24, +24 lines =@@ - >foo : any - - try { } catch (/** @type {unknown} */ err) { console.log(err); } // should be OK -->err : unknown -+>err : any - >console.log(err) : void - >console.log : (...data: any[]) => void - >console : Console - >log : (...data: any[]) => void -->err : unknown -+>err : any - - try { } catch (/** @type {Unknown} */ err) { console.log(err); } // should be OK -->err : unknown -+>err : any - >console.log(err) : void - >console.log : (...data: any[]) => void - >console : Console - >log : (...data: any[]) => void -->err : unknown -+>err : any - - try { } catch (/** @type {unknown} */ err) { err.foo; } // error in the body -->err : unknown -+>err : any - >err.foo : any -->err : unknown -+>err : any - >foo : any - - try { } catch (/** @type {Unknown} */ err) { err.foo; } // error in the body -->err : unknown -+>err : any - >err.foo : any -->err : unknown -+>err : any - >foo : any - - try { } catch (/** @type {Error} */ err) { } // error in the type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariableDeclarationWithTypeAnnotation.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariableDeclarationWithTypeAnnotation.types.diff deleted file mode 100644 index f759dcf1bc..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariableDeclarationWithTypeAnnotation.types.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.jsdocVariableDeclarationWithTypeAnnotation.types -+++ new.jsdocVariableDeclarationWithTypeAnnotation.types -@@= skipped -2, +2 lines =@@ - === foo.js === - /** @type {boolean} */ - var /** @type {string} */ x, -->x : string -+>x : boolean - - /** @type {number} */ y; -->y : number -+>y : boolean - From c0056b3b538e1c05d5d95d0ceae3438626dacf50 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 24 Mar 2025 09:10:46 -0700 Subject: [PATCH 12/25] undo stray merge change --- internal/binder/binder.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/binder/binder.go b/internal/binder/binder.go index 75e67e54a4..9c90597edf 100644 --- a/internal/binder/binder.go +++ b/internal/binder/binder.go @@ -1389,7 +1389,7 @@ func (b *Binder) bindContainer(node *ast.Node, containerFlags ContainerFlags) { b.blockScopeContainer = node if containerFlags&ContainerFlagsHasLocals != 0 { // localsContainer := node - // localsContainer.LocalsContainerData().locals = make(ast.SymbolTable) + // localsContainer.LocalsContainerData().locals = make(SymbolTable) b.addToContainerChain(node) } } else if containerFlags&ContainerFlagsIsBlockScopedContainer != 0 { From f13059fba3136d084458005df22440e3475859c0 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 24 Mar 2025 10:29:34 -0700 Subject: [PATCH 13/25] cosmetic cleanup --- internal/checker/checker.go | 3 - internal/parser/jsdoc.go | 95 +++++++------------ .../argumentsReferenceInConstructor1_Js.types | 6 +- .../argumentsReferenceInConstructor2_Js.types | 6 +- .../argumentsReferenceInConstructor3_Js.types | 6 +- ...mentsReferenceInConstructor4_Js.errors.txt | 5 +- .../argumentsReferenceInConstructor4_Js.types | 16 ++-- .../argumentsReferenceInConstructor5_Js.types | 6 +- .../argumentsReferenceInMethod1_Js.types | 8 +- .../argumentsReferenceInMethod2_Js.types | 8 +- .../argumentsReferenceInMethod3_Js.types | 8 +- .../argumentsReferenceInMethod4_Js.errors.txt | 5 +- .../argumentsReferenceInMethod4_Js.types | 18 ++-- .../argumentsReferenceInMethod5_Js.types | 8 +- .../conformance/checkJsdocTypeTag1.errors.txt | 4 +- .../conformance/checkJsdocTypeTag1.types | 4 +- .../conformance/jsdocTypeTag.errors.txt | 6 +- .../submodule/conformance/jsdocTypeTag.types | 4 +- ...TagNestedWithoutTopLevelObject3.errors.txt | 13 +++ ...paramTagNestedWithoutTopLevelObject3.types | 6 +- ...mentsReferenceInConstructor1_Js.types.diff | 24 +++++ ...mentsReferenceInConstructor2_Js.types.diff | 24 +++++ ...mentsReferenceInConstructor3_Js.types.diff | 23 ++++- ...ReferenceInConstructor4_Js.errors.txt.diff | 7 +- ...mentsReferenceInConstructor4_Js.types.diff | 63 ++++++++++++ ...mentsReferenceInConstructor5_Js.types.diff | 24 +++++ .../argumentsReferenceInMethod1_Js.types.diff | 23 ++++- .../argumentsReferenceInMethod2_Js.types.diff | 23 ++++- .../argumentsReferenceInMethod3_Js.types.diff | 23 ++++- ...mentsReferenceInMethod4_Js.errors.txt.diff | 7 +- .../argumentsReferenceInMethod4_Js.types.diff | 62 +++++++++++- .../argumentsReferenceInMethod5_Js.types.diff | 23 ++++- .../checkJsdocTypeTag1.errors.txt.diff | 4 +- .../conformance/checkJsdocTypeTag1.types.diff | 15 +++ .../conformance/jsdocTypeTag.errors.txt.diff | 6 +- .../conformance/jsdocTypeTag.types.diff | 11 ++- ...stedWithoutTopLevelObject3.errors.txt.diff | 27 +++--- ...TagNestedWithoutTopLevelObject3.types.diff | 16 +++- 38 files changed, 466 insertions(+), 174 deletions(-) create mode 100644 testdata/baselines/reference/submodule/conformance/paramTagNestedWithoutTopLevelObject3.errors.txt create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor1_Js.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor2_Js.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor4_Js.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor5_Js.types.diff diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 45f1c20753..860049c169 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -6347,9 +6347,6 @@ func (c *Checker) checkTypeAliasDeclaration(node *ast.Node) { func (c *Checker) checkTypeNameIsReserved(name *ast.Node, message *diagnostics.Message) { // TS 1.0 spec (April 2014): 3.6.1 // The predefined type keywords are reserved and cannot be used as names of user defined types. - if name == nil { // TODO: Check when this happens - return - } switch name.Text() { case "any", "unknown", "never", "number", "bigint", "boolean", "string", "symbol", "void", "object", "undefined": c.error(name, message, name.Text()) diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index b8fe3ed870..aa397da9be 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -57,43 +57,14 @@ func (p *Parser) withJSDoc(node *ast.Node, hasJSDoc bool) { node.Flags |= ast.NodeFlagsDeprecated } if p.scriptKind == core.ScriptKindJS || p.scriptKind == core.ScriptKindJSX { - // TODO: This will attach type-system information, but it doesn't have a plan for attaching - // non-type-system tags to the right place. - // The most likely place this will be a problem is TSDoc, if TSDoc lets people write their tags - // on arrow initialisers of constants. - // The most likely solution is to re-implement getJSDocCommentsAndTags exclusively for external use. - // TODO: In general Strada has multiple ownership of JSDoc tags. I'm going to NOT do this and see what breaks. (Probably same as above) - p.attachJSDoc(node, jsDoc) + p.attachTagsToHost(node, jsDoc) } p.jsdocCache[node] = jsDoc } } -// for a variable-like host, like a parameter declaration, with an initialiser that itself has jsdoc, -// those jsdoc also belong to the parameter declaration: -// function f(p = /** @type {number} */ 1) {} -// is equivalent to /** @param {number} p */ ... -// and function f(/** @type {number} */ p = 1) {} -// this is true of all tags, not just type tags. -// HOWEVER, I think it's fine to not support this at first. It is confusing and seems wrong. - -// looking upward, there are 3 cases that iterate (plus param/type param): -// 1. parent is property access/assignment/declaration/export assignment/return/namespace x.y.z/almost any assignment (!): -// - check parent for jsdoc as well -// 2. parent.parent is a variable statement and parent is almost any assignment (!): -// - check parent.parent for jsdoc as well -// 3. parent.parent.parent is a variable statement or parent.parent.parent is a variable statement whose initialiser is the host -// - check parent.parent.parent for jsdoc as well - -// inverting this to looking downward, cases (2) and (3) are covered by the existing code, mostly -// Case 1 means that property access et al need look down to their children in the same way - -// And all the cases might need to be recursive (but probably not in practise) - -func (p *Parser) attachJSDoc(parent *ast.Node, jsDoc []*ast.Node) { - // 1. modify the attached node - // 1b. Tags that modify their host node should only be taken from the parent's last JSDoc (@overload is 'attached' but actually emits a separate signature node) - // 2. later, output additional sibling nodes (probably unrelated) into the nearest containing node list +// Unhosted tags add synthetic nodes to the reparse list instead of finding and modifying a host +func (p *Parser) attachTagsToHost(parent *ast.Node, jsDoc []*ast.Node) { for _, j := range jsDoc { isLast := j == jsDoc[len(jsDoc)-1] tags := j.AsJSDoc().Tags @@ -104,13 +75,13 @@ func (p *Parser) attachJSDoc(parent *ast.Node, jsDoc []*ast.Node) { switch tag.Kind { case ast.KindJSDocTypedefTag: // !!! Don't mark typedefs as exported if they are not in a module - typeexpr := tag.AsJSDocTypedefTag().TypeExpression - if typeexpr == nil { + typeExpression := tag.AsJSDocTypedefTag().TypeExpression + if typeExpression == nil { break } export := p.factory.NewModifier(ast.KindExportKeyword) export.Loc = core.NewTextRange(p.nodePos(), p.nodePos()) - export.Flags = ast.NodeFlagsSynthesized + export.Flags = p.contextFlags | ast.NodeFlagsReparsed nodes := p.nodeSlicePool.NewSlice(1) nodes[0] = export modifiers := p.newModifierList(export.Loc, nodes) @@ -118,24 +89,27 @@ func (p *Parser) attachJSDoc(parent *ast.Node, jsDoc []*ast.Node) { typeParameters := p.gatherTypeParameters(j, export.Loc) var t *ast.Node - switch typeexpr.Kind { + switch typeExpression.Kind { case ast.KindJSDocTypeExpression: - t = typeexpr.Type() + t = typeExpression.Type() case ast.KindJSDocTypeLiteral: members := p.nodeSlicePool.NewSlice(0) - for _, member := range typeexpr.AsJSDocTypeLiteral().JsDocPropertyTags { + for _, member := range typeExpression.AsJSDocTypeLiteral().JsDocPropertyTags { prop := p.factory.NewPropertySignatureDeclaration(nil, member.Name(), nil /*postfixToken*/, member.Type(), nil /*initializer*/) prop.Loc = export.Loc + prop.Flags = p.contextFlags | ast.NodeFlagsReparsed members = append(members, prop) } t = p.factory.NewTypeLiteralNode(p.newNodeList(export.Loc, members)) t.Loc = export.Loc + t.Flags = p.contextFlags | ast.NodeFlagsReparsed default: - panic("typedef tag type expression should be a name reference or a type expression" + typeexpr.Kind.String()) + panic("typedef tag type expression should be a name reference or a type expression" + typeExpression.Kind.String()) } - jstype := p.factory.NewJSTypeAliasDeclaration(modifiers, tag.AsJSDocTypedefTag().Name(), typeParameters, t) - jstype.Loc = core.NewTextRange(p.nodePos(), p.nodePos()) - p.reparseList = append(p.reparseList, jstype) + typeAlias := p.factory.NewJSTypeAliasDeclaration(modifiers, tag.AsJSDocTypedefTag().Name(), typeParameters, t) + typeAlias.Loc = core.NewTextRange(p.nodePos(), p.nodePos()) + typeAlias.Flags = p.contextFlags | ast.NodeFlagsReparsed + p.reparseList = append(p.reparseList, typeAlias) // !!! @overload and other unattached tags (@callback, @import et al) support goes here } if !isLast { @@ -144,7 +118,6 @@ func (p *Parser) attachJSDoc(parent *ast.Node, jsDoc []*ast.Node) { switch tag.Kind { case ast.KindJSDocTypeTag: if parent.Kind == ast.KindVariableStatement && parent.AsVariableStatement().DeclarationList != nil { - // TODO: Could still clone the node and mark it synthetic for _, declaration := range parent.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { if declaration.AsVariableDeclaration().Type == nil { declaration.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, declaration) @@ -155,9 +128,9 @@ func (p *Parser) attachJSDoc(parent *ast.Node, jsDoc []*ast.Node) { parent.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent) } } else if parent.Kind == ast.KindPropertyDeclaration { - decl := parent.AsPropertyDeclaration() - if decl.Type == nil { - decl.Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent) + declaration := parent.AsPropertyDeclaration() + if declaration.Type == nil { + declaration.Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent) } } else if parent.Kind == ast.KindPropertyAssignment { prop := parent.AsPropertyAssignment() @@ -199,6 +172,7 @@ func (p *Parser) attachJSDoc(parent *ast.Node, jsDoc []*ast.Node) { (jsparam.IsBracketed || jsparam.TypeExpression != nil && jsparam.TypeExpression.Type().Kind == ast.KindJSDocOptionalType) { param.AsParameterDeclaration().QuestionToken = p.factory.NewToken(ast.KindQuestionToken) param.AsParameterDeclaration().QuestionToken.Loc = core.NewTextRange(param.End(), param.End()) + param.AsParameterDeclaration().QuestionToken.Flags = p.contextFlags | ast.NodeFlagsReparsed } } } @@ -214,10 +188,10 @@ func (p *Parser) attachJSDoc(parent *ast.Node, jsDoc []*ast.Node) { } } -func findMatchingParameter(fun *ast.Node, jsparam *ast.JSDocParameterTag) (*ast.Node, bool) { +func findMatchingParameter(fun *ast.Node, tag *ast.JSDocParameterTag) (*ast.Node, bool) { for _, parameter := range fun.Parameters() { - if parameter.Name().Kind == ast.KindIdentifier && jsparam.Name().Kind == ast.KindIdentifier && - parameter.Name().Text() == jsparam.Name().Text() { + if parameter.Name().Kind == ast.KindIdentifier && tag.Name().Kind == ast.KindIdentifier && + parameter.Name().Text() == tag.Name().Text() { return parameter, true } } @@ -225,29 +199,28 @@ func findMatchingParameter(fun *ast.Node, jsparam *ast.JSDocParameterTag) (*ast. } func (p *Parser) gatherTypeParameters(j *ast.Node, loc core.TextRange) *ast.NodeList { - nodes := p.nodeSlicePool.NewSlice(0) + typeParameters := p.nodeSlicePool.NewSlice(0) for _, tag := range j.AsJSDoc().Tags.Nodes { if tag.Kind == ast.KindJSDocTemplateTag { template := tag.AsJSDocTemplateTag() - for _, tp := range template.TypeParameters().Nodes { - // TODO: decide whether this clone/location update is needed - tp2 := tp.Clone(&p.factory) - tp2.Loc = loc - nodes = append(nodes, tp2) + for _, typeParameter := range template.TypeParameters().Nodes { + clone := typeParameter.Clone(&p.factory) + clone.Loc = loc + clone.Flags |= ast.NodeFlagsReparsed + typeParameters = append(typeParameters, clone) } } } - if len(nodes) == 0 { + if len(typeParameters) == 0 { return nil } else { - return p.newNodeList(loc, nodes) + return p.newNodeList(loc, typeParameters) } } func getFunctionLikeHost(host *ast.Node) (*ast.Node, bool) { fun := host if host.Kind == ast.KindVariableStatement && host.AsVariableStatement().DeclarationList != nil { - // NOTE: This takes the first decl but in Strada it applied to every decl for _, declaration := range host.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { if ast.IsFunctionLike(declaration.Initializer()) { fun = declaration.Initializer() @@ -269,11 +242,9 @@ func getFunctionLikeHost(host *ast.Node) (*ast.Node, bool) { return nil, false } -// TODO: assertions don't have the same error reporting behaviour as actual annotations. -// I need to decide whether it's OK to have different errors. (Yeah, it's OK.) func (p *Parser) makeNewTypeAssertion(t *ast.TypeNode, e *ast.Node) *ast.Node { assert := p.factory.NewTypeAssertion(t, e) - assert.Flags |= p.contextFlags | ast.NodeFlagsSynthesized + assert.Flags = p.contextFlags | ast.NodeFlagsReparsed assert.Loc = core.NewTextRange(e.Pos(), e.End()) return assert } @@ -288,7 +259,7 @@ func (p *Parser) makeNewType(typeExpression *ast.TypeNode, host *ast.Node) *ast. panic("JSDoc type expression already has a host: " + typeExpression.AsJSDocTypeExpression().Host.Kind.String()) } t := typeExpression.Type().Clone(&p.factory) - t.Flags |= typeExpression.Flags | ast.NodeFlagsSynthesized + t.Flags |= ast.NodeFlagsReparsed if host != nil { t.Parent = host } diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor1_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor1_Js.types index 3c02f4aa76..5ec6e757bb 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor1_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor1_Js.types @@ -10,18 +10,18 @@ class A { * @param {object} [foo={}] */ constructor(foo = {}) { ->foo : any +>foo : object >{} : {} /** * @type object */ this.arguments = foo; ->this.arguments = foo : any +>this.arguments = foo : object >this.arguments : any >this : this >arguments : any ->foo : any +>foo : object } } diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor2_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor2_Js.types index 8e1333a737..124673f048 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor2_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor2_Js.types @@ -10,18 +10,18 @@ class A { * @param {object} [foo={}] */ constructor(foo = {}) { ->foo : any +>foo : object >{} : {} /** * @type object */ this["arguments"] = foo; ->this["arguments"] = foo : any +>this["arguments"] = foo : object >this["arguments"] : any >this : this >"arguments" : "arguments" ->foo : any +>foo : object } } diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor3_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor3_Js.types index 1d4ef25097..4c52d5ccde 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor3_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor3_Js.types @@ -24,7 +24,7 @@ class B extends A { * @param {object} [foo={}] */ constructor(foo = {}) { ->foo : any +>foo : object >{} : {} super(); @@ -35,11 +35,11 @@ class B extends A { * @type object */ this.foo = foo; ->this.foo = foo : any +>this.foo = foo : object >this.foo : any >this : this >foo : any ->foo : any +>foo : object /** * @type object diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.errors.txt b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.errors.txt index 0bb2037a2d..fad3097c1e 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.errors.txt @@ -1,11 +1,12 @@ /a.js(13,8): error TS2339: Property 'foo' does not exist on type 'A'. /a.js(18,9): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. /a.js(23,8): error TS2339: Property 'bar' does not exist on type 'A'. +/a.js(23,24): error TS2339: Property 'bar' does not exist on type 'object'. /a.js(28,8): error TS2339: Property 'baz' does not exist on type 'A'. /a.js(33,8): error TS2339: Property 'options' does not exist on type 'A'. -==== /a.js (5 errors) ==== +==== /a.js (6 errors) ==== class A { /** * Constructor @@ -35,6 +36,8 @@ this.bar = arguments.bar; ~~~ !!! error TS2339: Property 'bar' does not exist on type 'A'. + ~~~ +!!! error TS2339: Property 'bar' does not exist on type 'object'. /** * @type object diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.types index 7ab9056758..849ed640e4 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor4_Js.types @@ -10,7 +10,7 @@ class A { * @param {object} [foo={}] */ constructor(foo = {}) { ->foo : any +>foo : object >{} : {} const key = "bar"; @@ -21,17 +21,17 @@ class A { * @type object */ this.foo = foo; ->this.foo = foo : any +>this.foo = foo : object >this.foo : any >this : this >foo : any ->foo : any +>foo : object /** * @type object */ const arguments = this.arguments; ->arguments : any +>arguments : object >this.arguments : { bar: {}; } >this : this >arguments : { bar: {}; } @@ -45,7 +45,7 @@ class A { >this : this >bar : any >arguments.bar : any ->arguments : any +>arguments : object >bar : any /** @@ -57,18 +57,18 @@ class A { >this : this >baz : any >arguments[key] : any ->arguments : any +>arguments : object >key : "bar" /** * @type object */ this.options = arguments; ->this.options = arguments : any +>this.options = arguments : object >this.options : any >this : this >options : any ->arguments : any +>arguments : object } get arguments() { diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor5_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor5_Js.types index f1072a762b..e5e5a9b627 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor5_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInConstructor5_Js.types @@ -19,18 +19,18 @@ class A { * @param {object} [foo={}] */ constructor(foo = {}) { ->foo : any +>foo : object >{} : {} /** * @type object */ this.foo = foo; ->this.foo = foo : any +>this.foo = foo : object >this.foo : any >this : this >foo : any ->foo : any +>foo : object /** * @type object diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod1_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod1_Js.types index 72b228c366..354cf5c742 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod1_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod1_Js.types @@ -8,19 +8,19 @@ class A { * @param {object} [foo={}] */ m(foo = {}) { ->m : (foo?: any) => void ->foo : any +>m : (foo?: object) => void +>foo : object >{} : {} /** * @type object */ this.arguments = foo; ->this.arguments = foo : any +>this.arguments = foo : object >this.arguments : any >this : this >arguments : any ->foo : any +>foo : object } } diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod2_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod2_Js.types index c027df1933..456fc6fecf 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod2_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod2_Js.types @@ -8,19 +8,19 @@ class A { * @param {object} [foo={}] */ m(foo = {}) { ->m : (foo?: any) => void ->foo : any +>m : (foo?: object) => void +>foo : object >{} : {} /** * @type object */ this["arguments"] = foo; ->this["arguments"] = foo : any +>this["arguments"] = foo : object >this["arguments"] : any >this : this >"arguments" : "arguments" ->foo : any +>foo : object } } diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod3_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod3_Js.types index 79b0bed3d5..d7f5de01af 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod3_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod3_Js.types @@ -22,19 +22,19 @@ class B extends A { * @param {object} [foo={}] */ m(foo = {}) { ->m : (foo?: any) => void ->foo : any +>m : (foo?: object) => void +>foo : object >{} : {} /** * @type object */ this.x = foo; ->this.x = foo : any +>this.x = foo : object >this.x : any >this : this >x : any ->foo : any +>foo : object /** * @type object diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.errors.txt b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.errors.txt index ca8e4ed0a1..9dd493e140 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.errors.txt @@ -1,11 +1,12 @@ /a.js(11,8): error TS2339: Property 'foo' does not exist on type 'A'. /a.js(16,9): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. /a.js(21,8): error TS2339: Property 'bar' does not exist on type 'A'. +/a.js(21,24): error TS2339: Property 'bar' does not exist on type 'object'. /a.js(26,8): error TS2339: Property 'baz' does not exist on type 'A'. /a.js(31,8): error TS2339: Property 'options' does not exist on type 'A'. -==== /a.js (5 errors) ==== +==== /a.js (6 errors) ==== class A { /** * @param {object} [foo={}] @@ -33,6 +34,8 @@ this.bar = arguments.bar; ~~~ !!! error TS2339: Property 'bar' does not exist on type 'A'. + ~~~ +!!! error TS2339: Property 'bar' does not exist on type 'object'. /** * @type object diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.types index 719a0e7a2c..0aff6a399e 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod4_Js.types @@ -8,8 +8,8 @@ class A { * @param {object} [foo={}] */ m(foo = {}) { ->m : (foo?: any) => void ->foo : any +>m : (foo?: object) => void +>foo : object >{} : {} const key = "bar"; @@ -20,17 +20,17 @@ class A { * @type object */ this.foo = foo; ->this.foo = foo : any +>this.foo = foo : object >this.foo : any >this : this >foo : any ->foo : any +>foo : object /** * @type object */ const arguments = this.arguments; ->arguments : any +>arguments : object >this.arguments : { bar: {}; } >this : this >arguments : { bar: {}; } @@ -44,7 +44,7 @@ class A { >this : this >bar : any >arguments.bar : any ->arguments : any +>arguments : object >bar : any /** @@ -56,18 +56,18 @@ class A { >this : this >baz : any >arguments[key] : any ->arguments : any +>arguments : object >key : "bar" /** * @type object */ this.options = arguments; ->this.options = arguments : any +>this.options = arguments : object >this.options : any >this : this >options : any ->arguments : any +>arguments : object } get arguments() { diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod5_Js.types b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod5_Js.types index ca0dbe7f59..98385d5311 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod5_Js.types +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInMethod5_Js.types @@ -17,19 +17,19 @@ class A { * @param {object} [foo={}] */ m(foo = {}) { ->m : (foo?: any) => void ->foo : any +>m : (foo?: object) => void +>foo : object >{} : {} /** * @type object */ this.foo = foo; ->this.foo = foo : any +>this.foo = foo : object >this.foo : any >this : this >foo : any ->foo : any +>foo : object /** * @type object diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt index 3523f4ecbe..beeb1723a4 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt @@ -1,7 +1,7 @@ 0.js(20,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? 0.js(24,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? 0.js(28,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -0.js(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. +0.js(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'object', but here has type 'Object'. ==== 0.js (4 errors) ==== @@ -55,6 +55,6 @@ */ var props = {}; ~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'object', but here has type 'Object'. !!! related TS6203 0.js:35:5: 'props' was also declared here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.types index d6326f0bf5..35991b8037 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.types @@ -92,13 +92,13 @@ x2(0); * @type {object} */ var props = {}; ->props : any +>props : object >{} : {} /** * @type {Object} */ var props = {}; ->props : any +>props : object >{} : {} diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt index 8ef37b875d..399860b673 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.errors.txt @@ -9,6 +9,7 @@ b.ts(1,5): error TS2403: Subsequent variable declarations must have the same typ b.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. b.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. b.ts(18,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. +b.ts(19,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'obj' must be of type 'object', but here has type 'any'. ==== a.js (7 errors) ==== @@ -93,7 +94,7 @@ b.ts(18,5): error TS2403: Subsequent variable declarations must have the same ty /** @type {new (s: string) => { s: string }} */ var ctor; -==== b.ts (4 errors) ==== +==== b.ts (5 errors) ==== var S: string; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. @@ -125,6 +126,9 @@ b.ts(18,5): error TS2403: Subsequent variable declarations must have the same ty !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. !!! related TS6203 a.js:53:5: 'Obj' was also declared here. var obj: any; + ~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'obj' must be of type 'object', but here has type 'any'. +!!! related TS6203 a.js:56:5: 'obj' was also declared here. var Func: Function; var f: (s: string) => number; var ctor: new (s: string) => { s: string }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.types index a7588de06b..612c3866a0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.types @@ -75,7 +75,7 @@ var Obj; /** @type {object} */ var obj; ->obj : any +>obj : object /** @type {Function} */ var Func; @@ -145,7 +145,7 @@ var Obj: any; >Obj : Object var obj: any; ->obj : any +>obj : object var Func: Function; >Func : Function diff --git a/testdata/baselines/reference/submodule/conformance/paramTagNestedWithoutTopLevelObject3.errors.txt b/testdata/baselines/reference/submodule/conformance/paramTagNestedWithoutTopLevelObject3.errors.txt new file mode 100644 index 0000000000..5d76f62a2f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/paramTagNestedWithoutTopLevelObject3.errors.txt @@ -0,0 +1,13 @@ +paramTagNestedWithoutTopLevelObject3.js(6,16): error TS2339: Property 'bar' does not exist on type 'object'. + + +==== paramTagNestedWithoutTopLevelObject3.js (1 errors) ==== + /** + * @param {object} xyz + * @param {number} xyz.bar.p + */ + function g(xyz) { + return xyz.bar.p; + ~~~ +!!! error TS2339: Property 'bar' does not exist on type 'object'. + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/paramTagNestedWithoutTopLevelObject3.types b/testdata/baselines/reference/submodule/conformance/paramTagNestedWithoutTopLevelObject3.types index 6863a2531b..6c0bf1240f 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagNestedWithoutTopLevelObject3.types +++ b/testdata/baselines/reference/submodule/conformance/paramTagNestedWithoutTopLevelObject3.types @@ -6,13 +6,13 @@ * @param {number} xyz.bar.p */ function g(xyz) { ->g : (xyz: any) => any ->xyz : any +>g : (xyz: object) => any +>xyz : object return xyz.bar.p; >xyz.bar.p : any >xyz.bar : any ->xyz : any +>xyz : object >bar : any >p : any } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor1_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor1_Js.types.diff new file mode 100644 index 0000000000..e2548a1038 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor1_Js.types.diff @@ -0,0 +1,24 @@ +--- old.argumentsReferenceInConstructor1_Js.types ++++ new.argumentsReferenceInConstructor1_Js.types +@@= skipped -9, +9 lines =@@ + * @param {object} [foo={}] + */ + constructor(foo = {}) { +->foo : any ++>foo : object + >{} : {} + + /** + * @type object + */ + this.arguments = foo; +->this.arguments = foo : any ++>this.arguments = foo : object + >this.arguments : any + >this : this + >arguments : any +->foo : any ++>foo : object + } + } + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor2_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor2_Js.types.diff new file mode 100644 index 0000000000..60842c2b62 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor2_Js.types.diff @@ -0,0 +1,24 @@ +--- old.argumentsReferenceInConstructor2_Js.types ++++ new.argumentsReferenceInConstructor2_Js.types +@@= skipped -9, +9 lines =@@ + * @param {object} [foo={}] + */ + constructor(foo = {}) { +->foo : any ++>foo : object + >{} : {} + + /** + * @type object + */ + this["arguments"] = foo; +->this["arguments"] = foo : any ++>this["arguments"] = foo : object + >this["arguments"] : any + >this : this + >"arguments" : "arguments" +->foo : any ++>foo : object + } + } + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor3_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor3_Js.types.diff index 1a9b89c2d4..015c013c5a 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor3_Js.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor3_Js.types.diff @@ -1,6 +1,27 @@ --- old.argumentsReferenceInConstructor3_Js.types +++ new.argumentsReferenceInConstructor3_Js.types -@@= skipped -44, +44 lines =@@ +@@= skipped -23, +23 lines =@@ + * @param {object} [foo={}] + */ + constructor(foo = {}) { +->foo : any ++>foo : object + >{} : {} + + super(); +@@= skipped -11, +11 lines =@@ + * @type object + */ + this.foo = foo; +->this.foo = foo : any ++>this.foo = foo : object + >this.foo : any + >this : this + >foo : any +->foo : any ++>foo : object + + /** * @type object */ this.bar = super.arguments.foo; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor4_Js.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor4_Js.errors.txt.diff index 9234266d65..4a145d31da 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor4_Js.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor4_Js.errors.txt.diff @@ -4,16 +4,17 @@ +/a.js(13,8): error TS2339: Property 'foo' does not exist on type 'A'. /a.js(18,9): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. +/a.js(23,8): error TS2339: Property 'bar' does not exist on type 'A'. ++/a.js(23,24): error TS2339: Property 'bar' does not exist on type 'object'. +/a.js(28,8): error TS2339: Property 'baz' does not exist on type 'A'. +/a.js(33,8): error TS2339: Property 'options' does not exist on type 'A'. -==== /a.js (1 errors) ==== -+==== /a.js (5 errors) ==== ++==== /a.js (6 errors) ==== class A { /** * Constructor -@@= skipped -14, +18 lines =@@ +@@= skipped -14, +19 lines =@@ * @type object */ this.foo = foo; @@ -28,6 +29,8 @@ this.bar = arguments.bar; + ~~~ +!!! error TS2339: Property 'bar' does not exist on type 'A'. ++ ~~~ ++!!! error TS2339: Property 'bar' does not exist on type 'object'. /** * @type object diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor4_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor4_Js.types.diff new file mode 100644 index 0000000000..449dbd05f8 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor4_Js.types.diff @@ -0,0 +1,63 @@ +--- old.argumentsReferenceInConstructor4_Js.types ++++ new.argumentsReferenceInConstructor4_Js.types +@@= skipped -9, +9 lines =@@ + * @param {object} [foo={}] + */ + constructor(foo = {}) { +->foo : any ++>foo : object + >{} : {} + + const key = "bar"; +@@= skipped -11, +11 lines =@@ + * @type object + */ + this.foo = foo; +->this.foo = foo : any ++>this.foo = foo : object + >this.foo : any + >this : this + >foo : any +->foo : any ++>foo : object + + /** + * @type object + */ + const arguments = this.arguments; +->arguments : any ++>arguments : object + >this.arguments : { bar: {}; } + >this : this + >arguments : { bar: {}; } +@@= skipped -24, +24 lines =@@ + >this : this + >bar : any + >arguments.bar : any +->arguments : any ++>arguments : object + >bar : any + + /** +@@= skipped -12, +12 lines =@@ + >this : this + >baz : any + >arguments[key] : any +->arguments : any ++>arguments : object + >key : "bar" + + /** + * @type object + */ + this.options = arguments; +->this.options = arguments : any ++>this.options = arguments : object + >this.options : any + >this : this + >options : any +->arguments : any ++>arguments : object + } + + get arguments() { diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor5_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor5_Js.types.diff new file mode 100644 index 0000000000..0dd69b0a71 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInConstructor5_Js.types.diff @@ -0,0 +1,24 @@ +--- old.argumentsReferenceInConstructor5_Js.types ++++ new.argumentsReferenceInConstructor5_Js.types +@@= skipped -18, +18 lines =@@ + * @param {object} [foo={}] + */ + constructor(foo = {}) { +->foo : any ++>foo : object + >{} : {} + + /** + * @type object + */ + this.foo = foo; +->this.foo = foo : any ++>this.foo = foo : object + >this.foo : any + >this : this + >foo : any +->foo : any ++>foo : object + + /** + * @type object diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod1_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod1_Js.types.diff index c426286efd..afc0903395 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod1_Js.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod1_Js.types.diff @@ -1,11 +1,24 @@ --- old.argumentsReferenceInMethod1_Js.types +++ new.argumentsReferenceInMethod1_Js.types -@@= skipped -7, +7 lines =@@ - * @param {object} [foo={}] +@@= skipped -8, +8 lines =@@ */ m(foo = {}) { -->m : (foo?: object) => void -+>m : (foo?: any) => void - >foo : any + >m : (foo?: object) => void +->foo : any ++>foo : object >{} : {} + /** + * @type object + */ + this.arguments = foo; +->this.arguments = foo : any ++>this.arguments = foo : object + >this.arguments : any + >this : this + >arguments : any +->foo : any ++>foo : object + } + } + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod2_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod2_Js.types.diff index f70895d5ee..0b6bfccd7d 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod2_Js.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod2_Js.types.diff @@ -1,11 +1,24 @@ --- old.argumentsReferenceInMethod2_Js.types +++ new.argumentsReferenceInMethod2_Js.types -@@= skipped -7, +7 lines =@@ - * @param {object} [foo={}] +@@= skipped -8, +8 lines =@@ */ m(foo = {}) { -->m : (foo?: object) => void -+>m : (foo?: any) => void - >foo : any + >m : (foo?: object) => void +->foo : any ++>foo : object >{} : {} + /** + * @type object + */ + this["arguments"] = foo; +->this["arguments"] = foo : any ++>this["arguments"] = foo : object + >this["arguments"] : any + >this : this + >"arguments" : "arguments" +->foo : any ++>foo : object + } + } + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod3_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod3_Js.types.diff index c99c256f0a..c5176342a1 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod3_Js.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod3_Js.types.diff @@ -1,11 +1,24 @@ --- old.argumentsReferenceInMethod3_Js.types +++ new.argumentsReferenceInMethod3_Js.types -@@= skipped -21, +21 lines =@@ - * @param {object} [foo={}] +@@= skipped -22, +22 lines =@@ */ m(foo = {}) { -->m : (foo?: object) => void -+>m : (foo?: any) => void - >foo : any + >m : (foo?: object) => void +->foo : any ++>foo : object >{} : {} + /** + * @type object + */ + this.x = foo; +->this.x = foo : any ++>this.x = foo : object + >this.x : any + >this : this + >x : any +->foo : any ++>foo : object + + /** + * @type object diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod4_Js.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod4_Js.errors.txt.diff index ae9b1b7f21..8a1b1f64d1 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod4_Js.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod4_Js.errors.txt.diff @@ -4,16 +4,17 @@ +/a.js(11,8): error TS2339: Property 'foo' does not exist on type 'A'. /a.js(16,9): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. +/a.js(21,8): error TS2339: Property 'bar' does not exist on type 'A'. ++/a.js(21,24): error TS2339: Property 'bar' does not exist on type 'object'. +/a.js(26,8): error TS2339: Property 'baz' does not exist on type 'A'. +/a.js(31,8): error TS2339: Property 'options' does not exist on type 'A'. -==== /a.js (1 errors) ==== -+==== /a.js (5 errors) ==== ++==== /a.js (6 errors) ==== class A { /** * @param {object} [foo={}] -@@= skipped -12, +16 lines =@@ +@@= skipped -12, +17 lines =@@ * @type object */ this.foo = foo; @@ -28,6 +29,8 @@ this.bar = arguments.bar; + ~~~ +!!! error TS2339: Property 'bar' does not exist on type 'A'. ++ ~~~ ++!!! error TS2339: Property 'bar' does not exist on type 'object'. /** * @type object diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod4_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod4_Js.types.diff index 887cf06749..1a227db627 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod4_Js.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod4_Js.types.diff @@ -1,11 +1,63 @@ --- old.argumentsReferenceInMethod4_Js.types +++ new.argumentsReferenceInMethod4_Js.types -@@= skipped -7, +7 lines =@@ - * @param {object} [foo={}] +@@= skipped -8, +8 lines =@@ */ m(foo = {}) { -->m : (foo?: object) => void -+>m : (foo?: any) => void - >foo : any + >m : (foo?: object) => void +->foo : any ++>foo : object >{} : {} + const key = "bar"; +@@= skipped -11, +11 lines =@@ + * @type object + */ + this.foo = foo; +->this.foo = foo : any ++>this.foo = foo : object + >this.foo : any + >this : this + >foo : any +->foo : any ++>foo : object + + /** + * @type object + */ + const arguments = this.arguments; +->arguments : any ++>arguments : object + >this.arguments : { bar: {}; } + >this : this + >arguments : { bar: {}; } +@@= skipped -24, +24 lines =@@ + >this : this + >bar : any + >arguments.bar : any +->arguments : any ++>arguments : object + >bar : any + + /** +@@= skipped -12, +12 lines =@@ + >this : this + >baz : any + >arguments[key] : any +->arguments : any ++>arguments : object + >key : "bar" + + /** + * @type object + */ + this.options = arguments; +->this.options = arguments : any ++>this.options = arguments : object + >this.options : any + >this : this + >options : any +->arguments : any ++>arguments : object + } + + get arguments() { diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod5_Js.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod5_Js.types.diff index 7e0607bdaf..3727d48396 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod5_Js.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInMethod5_Js.types.diff @@ -1,11 +1,24 @@ --- old.argumentsReferenceInMethod5_Js.types +++ new.argumentsReferenceInMethod5_Js.types -@@= skipped -16, +16 lines =@@ - * @param {object} [foo={}] +@@= skipped -17, +17 lines =@@ */ m(foo = {}) { -->m : (foo?: object) => void -+>m : (foo?: any) => void - >foo : any + >m : (foo?: object) => void +->foo : any ++>foo : object >{} : {} + /** + * @type object + */ + this.foo = foo; +->this.foo = foo : any ++>this.foo = foo : object + >this.foo : any + >this : this + >foo : any +->foo : any ++>foo : object + + /** + * @type object diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff index 621cec769f..beb14a9d96 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff @@ -5,7 +5,7 @@ +0.js(20,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(24,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(28,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+0.js(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. ++0.js(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'object', but here has type 'Object'. -==== 0.js (1 errors) ==== @@ -44,6 +44,6 @@ */ var props = {}; + ~~~~~ -+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'any', but here has type 'Object'. ++!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'object', but here has type 'Object'. +!!! related TS6203 0.js:35:5: 'props' was also declared here. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.types.diff index 00334ca703..cb967e9d68 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.types.diff @@ -68,3 +68,18 @@ >0 : 0 /** + * @type {object} + */ + var props = {}; +->props : any ++>props : object + >{} : {} + + /** + * @type {Object} + */ + var props = {}; +->props : any ++>props : object + >{} : {} + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.errors.txt.diff index 0a8f07906a..b0be4b125c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.errors.txt.diff @@ -14,6 +14,7 @@ +b.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'N' must be of type 'Number', but here has type 'number'. +b.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'B' must be of type 'Boolean', but here has type 'boolean'. +b.ts(18,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. ++b.ts(19,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'obj' must be of type 'object', but here has type 'any'. + + +==== a.js (7 errors) ==== @@ -98,7 +99,7 @@ + /** @type {new (s: string) => { s: string }} */ + var ctor; + -+==== b.ts (4 errors) ==== ++==== b.ts (5 errors) ==== + var S: string; + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'S' must be of type 'String', but here has type 'string'. @@ -130,6 +131,9 @@ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Obj' must be of type 'Object', but here has type 'any'. +!!! related TS6203 a.js:53:5: 'Obj' was also declared here. + var obj: any; ++ ~~~ ++!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'obj' must be of type 'object', but here has type 'any'. ++!!! related TS6203 a.js:56:5: 'obj' was also declared here. + var Func: Function; + var f: (s: string) => number; + var ctor: new (s: string) => { s: string }; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.types.diff index 4a8a35d9d3..4c97134fce 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.types.diff @@ -87,6 +87,11 @@ /** @type {object} */ var obj; +->obj : any ++>obj : object + + /** @type {Function} */ + var Func; @@= skipped -20, +20 lines =@@ === b.ts === @@ -156,4 +161,8 @@ +>Obj : Object var obj: any; - >obj : any +->obj : any ++>obj : object + + var Func: Function; + >Func : Function diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagNestedWithoutTopLevelObject3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagNestedWithoutTopLevelObject3.errors.txt.diff index e4df1be6db..50618fcb05 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagNestedWithoutTopLevelObject3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagNestedWithoutTopLevelObject3.errors.txt.diff @@ -1,18 +1,19 @@ --- old.paramTagNestedWithoutTopLevelObject3.errors.txt +++ new.paramTagNestedWithoutTopLevelObject3.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -paramTagNestedWithoutTopLevelObject3.js(3,20): error TS8032: Qualified name 'xyz.bar.p' is not allowed without a leading '@param {object} xyz.bar'. -- -- --==== paramTagNestedWithoutTopLevelObject3.js (1 errors) ==== -- /** -- * @param {object} xyz -- * @param {number} xyz.bar.p ++paramTagNestedWithoutTopLevelObject3.js(6,16): error TS2339: Property 'bar' does not exist on type 'object'. + + + ==== paramTagNestedWithoutTopLevelObject3.js (1 errors) ==== + /** + * @param {object} xyz + * @param {number} xyz.bar.p - ~~~~~~~~~ -!!! error TS8032: Qualified name 'xyz.bar.p' is not allowed without a leading '@param {object} xyz.bar'. -- */ -- function g(xyz) { -- return xyz.bar.p; -- } -@@= skipped --1, +1 lines =@@ -+ + */ + function g(xyz) { + return xyz.bar.p; ++ ~~~ ++!!! error TS2339: Property 'bar' does not exist on type 'object'. + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagNestedWithoutTopLevelObject3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagNestedWithoutTopLevelObject3.types.diff index bddb3a5c20..11c74c421f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagNestedWithoutTopLevelObject3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagNestedWithoutTopLevelObject3.types.diff @@ -1,11 +1,17 @@ --- old.paramTagNestedWithoutTopLevelObject3.types +++ new.paramTagNestedWithoutTopLevelObject3.types -@@= skipped -5, +5 lines =@@ - * @param {number} xyz.bar.p +@@= skipped -6, +6 lines =@@ */ function g(xyz) { -->g : (xyz: object) => any -+>g : (xyz: any) => any - >xyz : any + >g : (xyz: object) => any +->xyz : any ++>xyz : object return xyz.bar.p; + >xyz.bar.p : any + >xyz.bar : any +->xyz : any ++>xyz : object + >bar : any + >p : any + } From 49fb0061549555ea8f4c8b96c3f32a0be9ac8f3e Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 24 Mar 2025 10:51:13 -0700 Subject: [PATCH 14/25] undo bad typedef parsing simplification --- internal/ast/ast.go | 16 +++++++++------- internal/parser/jsdoc.go | 35 +++++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/internal/ast/ast.go b/internal/ast/ast.go index bfb84cb2f1..efa5532cf8 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -7947,34 +7947,36 @@ func IsJSDocUnknownTag(node *Node) bool { // JSDocTemplateTag type JSDocTemplateTag struct { JSDocTagBase + Constraint *Node typeParameters *TypeParameterList } -func (f *NodeFactory) NewJSDocTemplateTag(tagName *IdentifierNode, typeParameters *TypeParameterList, comment *NodeList) *Node { +func (f *NodeFactory) NewJSDocTemplateTag(tagName *IdentifierNode, constraint *Node, typeParameters *TypeParameterList, comment *NodeList) *Node { data := &JSDocTemplateTag{} data.TagName = tagName + data.Constraint = constraint data.typeParameters = typeParameters data.Comment = comment return newNode(KindJSDocTemplateTag, data, f.hooks) } -func (f *NodeFactory) UpdateJSDocTemplateTag(node *JSDocTemplateTag, tagName *IdentifierNode, typeParameters *TypeParameterList, comment *NodeList) *Node { - if tagName != node.TagName || typeParameters != node.typeParameters || comment != node.Comment { - return updateNode(f.NewJSDocTemplateTag(tagName, typeParameters, comment), node.AsNode(), f.hooks) +func (f *NodeFactory) UpdateJSDocTemplateTag(node *JSDocTemplateTag, tagName *IdentifierNode, constraint *Node, typeParameters *TypeParameterList, comment *NodeList) *Node { + if tagName != node.TagName || constraint != node.Constraint || typeParameters != node.typeParameters || comment != node.Comment { + return updateNode(f.NewJSDocTemplateTag(tagName, constraint, typeParameters, comment), node.AsNode(), f.hooks) } return node.AsNode() } func (node *JSDocTemplateTag) ForEachChild(v Visitor) bool { - return visit(v, node.TagName) || visitNodeList(v, node.typeParameters) || visitNodeList(v, node.Comment) + return visit(v, node.TagName) || visit(v, node.Constraint) || visitNodeList(v, node.typeParameters) || visitNodeList(v, node.Comment) } func (node *JSDocTemplateTag) VisitEachChild(v *NodeVisitor) *Node { - return v.Factory.UpdateJSDocTemplateTag(node, v.visitNode(node.TagName), v.visitNodes(node.typeParameters), v.visitNodes(node.Comment)) + return v.Factory.UpdateJSDocTemplateTag(node, v.visitNode(node.TagName), v.visitNode(node.Constraint), v.visitNodes(node.typeParameters), v.visitNodes(node.Comment)) } func (node *JSDocTemplateTag) Clone(f *NodeFactory) *Node { - return cloneNode(f.NewJSDocTemplateTag(node.TagName, node.TypeParameters(), node.Comment), node.AsNode(), f.hooks) + return cloneNode(f.NewJSDocTemplateTag(node.TagName, node.Constraint, node.TypeParameters(), node.Comment), node.AsNode(), f.hooks) } func (node *JSDocTemplateTag) TypeParameters() *TypeParameterList { return node.typeParameters } diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index aa397da9be..f31f33ac95 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -203,11 +203,21 @@ func (p *Parser) gatherTypeParameters(j *ast.Node, loc core.TextRange) *ast.Node for _, tag := range j.AsJSDoc().Tags.Nodes { if tag.Kind == ast.KindJSDocTemplateTag { template := tag.AsJSDocTemplateTag() - for _, typeParameter := range template.TypeParameters().Nodes { - clone := typeParameter.Clone(&p.factory) - clone.Loc = loc - clone.Flags |= ast.NodeFlagsReparsed - typeParameters = append(typeParameters, clone) + constraint := template.Constraint + for _, tp := range template.TypeParameters().Nodes { + typeParameter := tp.AsTypeParameter() + var reparse *ast.Node + if constraint == nil { + reparse = typeParameter.Clone(&p.factory) + } else { + clone := constraint.Type().Clone(&p.factory) + clone.Loc = loc + clone.Flags |= ast.NodeFlagsReparsed + reparse = p.factory.NewTypeParameterDeclaration(typeParameter.Modifiers(), typeParameter.Name(), clone, typeParameter.DefaultType) + } + reparse.Loc = loc + reparse.Flags |= ast.NodeFlagsReparsed + typeParameters = append(typeParameters, reparse) } } } @@ -1332,7 +1342,7 @@ func (p *Parser) tryParseChildTag(target propertyLikeParse, indent int) *ast.Nod return p.parseParameterOrPropertyTag(start, tagName, target, indent) } -func (p *Parser) parseTemplateTagTypeParameter(constraint *ast.Node) *ast.Node { +func (p *Parser) parseTemplateTagTypeParameter() *ast.Node { typeParameterPos := p.nodePos() isBracketed := p.parseOptionalJsdoc(ast.KindOpenBracketToken) if isBracketed { @@ -1355,16 +1365,16 @@ func (p *Parser) parseTemplateTagTypeParameter(constraint *ast.Node) *ast.Node { if ast.NodeIsMissing(name) { return nil } - result := p.factory.NewTypeParameterDeclaration(modifiers, name, constraint, defaultType) + result := p.factory.NewTypeParameterDeclaration(modifiers, name, nil /*constraint*/, defaultType) p.finishNode(result, typeParameterPos) return result } -func (p *Parser) parseTemplateTagTypeParameters(constraint *ast.Node) *ast.TypeParameterList { +func (p *Parser) parseTemplateTagTypeParameters() *ast.TypeParameterList { typeParameters := ast.TypeParameterList{} for ok := true; ok; ok = p.parseOptionalJsdoc(ast.KindCommaToken) { // do-while loop p.skipWhitespace() - node := p.parseTemplateTagTypeParameter(constraint) + node := p.parseTemplateTagTypeParameter() if node != nil { typeParameters.Nodes = append(typeParameters.Nodes, node) } @@ -1388,12 +1398,9 @@ func (p *Parser) parseTemplateTag(start int, tagName *ast.IdentifierNode, indent var constraint *ast.Node if p.token == ast.KindOpenBraceToken { constraint = p.parseJSDocTypeExpression(false) - if constraint != nil { - constraint = constraint.Type() - } } - typeParameters := p.parseTemplateTagTypeParameters(constraint) - result := p.factory.NewJSDocTemplateTag(tagName, typeParameters, p.parseTrailingTagComments(start, p.nodePos(), indent, indentText)) + typeParameters := p.parseTemplateTagTypeParameters() + result := p.factory.NewJSDocTemplateTag(tagName, constraint, typeParameters, p.parseTrailingTagComments(start, p.nodePos(), indent, indentText)) p.finishNode(result, start) return result } From f2852a81b44401c148255bfbe21bf99f27c28d21 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 24 Mar 2025 11:20:03 -0700 Subject: [PATCH 15/25] remove unused JS checks in checker --- internal/ast/ast.go | 4 ++-- internal/checker/checker.go | 6 +----- internal/checker/utilities.go | 9 ++++----- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/internal/ast/ast.go b/internal/ast/ast.go index efa5532cf8..c6facb437f 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -7981,8 +7981,7 @@ func (node *JSDocTemplateTag) Clone(f *NodeFactory) *Node { func (node *JSDocTemplateTag) TypeParameters() *TypeParameterList { return node.typeParameters } -// JSDocParameterTag - +// JSDocPropertyTag type JSDocPropertyTag struct { JSDocTagBase name *EntityName @@ -8034,6 +8033,7 @@ func (node *JSDocPropertyTag) Clone(f *NodeFactory) *Node { func (node *JSDocPropertyTag) Name() *EntityName { return node.name } +// JSDocParameterTag type JSDocParameterTag struct { JSDocTagBase name *EntityName diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 860049c169..f9462fb538 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -21034,11 +21034,7 @@ func (c *Checker) getTypeFromTypeNodeWorker(node *ast.Node) *Type { case ast.KindNeverKeyword: return c.neverType case ast.KindObjectKeyword: - if node.Flags&ast.NodeFlagsJavaScriptFile != 0 && !c.noImplicitAny { - return c.anyType - } else { - return c.nonPrimitiveType - } + return c.nonPrimitiveType case ast.KindIntrinsicKeyword: return c.intrinsicMarkerType case ast.KindThisType, ast.KindThisKeyword: diff --git a/internal/checker/utilities.go b/internal/checker/utilities.go index 9dcbcd3a06..386737fbb3 100644 --- a/internal/checker/utilities.go +++ b/internal/checker/utilities.go @@ -391,14 +391,13 @@ func canHaveSymbol(node *ast.Node) bool { ast.KindConstructSignature, ast.KindElementAccessExpression, ast.KindEnumDeclaration, ast.KindEnumMember, ast.KindExportAssignment, ast.KindExportDeclaration, ast.KindExportSpecifier, ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindFunctionType, ast.KindGetAccessor, ast.KindIdentifier, ast.KindImportClause, ast.KindImportEqualsDeclaration, ast.KindImportSpecifier, - ast.KindIndexSignature, ast.KindInterfaceDeclaration, ast.KindJSDocCallbackTag, - ast.KindJSDocParameterTag, ast.KindJSDocPropertyTag, ast.KindJSDocSignature, ast.KindJSDocTypedefTag, ast.KindJSDocTypeLiteral, + ast.KindIndexSignature, ast.KindInterfaceDeclaration, ast.KindJSDocSignature, ast.KindJSDocTypeLiteral, ast.KindJsxAttribute, ast.KindJsxAttributes, ast.KindJsxSpreadAttribute, ast.KindMappedType, ast.KindMethodDeclaration, ast.KindMethodSignature, ast.KindModuleDeclaration, ast.KindNamedTupleMember, ast.KindNamespaceExport, ast.KindNamespaceExportDeclaration, ast.KindNamespaceImport, ast.KindNewExpression, ast.KindNoSubstitutionTemplateLiteral, ast.KindNumericLiteral, ast.KindObjectLiteralExpression, ast.KindParameter, ast.KindPropertyAccessExpression, ast.KindPropertyAssignment, ast.KindPropertyDeclaration, ast.KindPropertySignature, ast.KindSetAccessor, ast.KindShorthandPropertyAssignment, ast.KindSourceFile, ast.KindSpreadAssignment, ast.KindStringLiteral, - ast.KindTypeAliasDeclaration, ast.KindTypeLiteral, ast.KindTypeParameter, ast.KindVariableDeclaration, ast.KindJSTypeAliasDeclaration: + ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration, ast.KindTypeLiteral, ast.KindTypeParameter, ast.KindVariableDeclaration: return true } return false @@ -409,8 +408,8 @@ func canHaveLocals(node *ast.Node) bool { case ast.KindArrowFunction, ast.KindBlock, ast.KindCallSignature, ast.KindCaseBlock, ast.KindCatchClause, ast.KindClassStaticBlockDeclaration, ast.KindConditionalType, ast.KindConstructor, ast.KindConstructorType, ast.KindConstructSignature, ast.KindForStatement, ast.KindForInStatement, ast.KindForOfStatement, ast.KindFunctionDeclaration, - ast.KindFunctionExpression, ast.KindFunctionType, ast.KindGetAccessor, ast.KindIndexSignature, ast.KindJSDocCallbackTag, - ast.KindJSDocSignature, ast.KindJSDocTypedefTag, ast.KindMappedType, + ast.KindFunctionExpression, ast.KindFunctionType, ast.KindGetAccessor, ast.KindIndexSignature, + ast.KindJSDocSignature, ast.KindMappedType, ast.KindMethodDeclaration, ast.KindMethodSignature, ast.KindModuleDeclaration, ast.KindSetAccessor, ast.KindSourceFile, ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration: return true From d448d648487390be495cefd7a3e40e2aaaf2bd89 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 26 Mar 2025 09:14:42 -0700 Subject: [PATCH 16/25] remove JSTypeAliasDeclaration type, keep kind Keep the constructors and some predicates separate as well. --- internal/ast/ast.go | 61 +++++-------------- internal/checker/checker.go | 15 ++--- internal/checker/utilities.go | 4 +- internal/printer/printer.go | 23 +------ internal/printer/utilities.go | 6 +- .../tsbaseline/type_symbol_baseline.go | 2 +- 6 files changed, 27 insertions(+), 84 deletions(-) diff --git a/internal/ast/ast.go b/internal/ast/ast.go index c6facb437f..4838d011f6 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -392,10 +392,8 @@ func (n *Node) TypeParameterList() *NodeList { return n.AsClassExpression().TypeParameters case KindInterfaceDeclaration: return n.AsInterfaceDeclaration().TypeParameters - case KindTypeAliasDeclaration: + case KindTypeAliasDeclaration, KindJSTypeAliasDeclaration: return n.AsTypeAliasDeclaration().TypeParameters - case KindJSTypeAliasDeclaration: - return n.AsJSTypeAliasDeclaration().TypeParameters default: funcLike := n.FunctionLikeData() if funcLike != nil { @@ -479,10 +477,8 @@ func (n *Node) Type() *Node { return n.AsAsExpression().Type case KindSatisfiesExpression: return n.AsSatisfiesExpression().Type - case KindTypeAliasDeclaration: + case KindTypeAliasDeclaration, KindJSTypeAliasDeclaration: return n.AsTypeAliasDeclaration().Type - case KindJSTypeAliasDeclaration: - return n.AsJSTypeAliasDeclaration().Type case KindNamedTupleMember: return n.AsNamedTupleMember().Type case KindOptionalType: @@ -1060,10 +1056,6 @@ func (n *Node) AsTypeAliasDeclaration() *TypeAliasDeclaration { return n.data.(*TypeAliasDeclaration) } -func (n *Node) AsJSTypeAliasDeclaration() *JSTypeAliasDeclaration { - return n.data.(*JSTypeAliasDeclaration) -} - func (n *Node) AsJsxAttribute() *JsxAttribute { return n.data.(*JsxAttribute) } @@ -3249,13 +3241,17 @@ type TypeAliasDeclaration struct { Type *TypeNode // TypeNode } -func (f *NodeFactory) NewTypeAliasDeclaration(modifiers *ModifierList, name *IdentifierNode, typeParameters *NodeList, typeNode *TypeNode) *Node { +func (f *NodeFactory) newTypeOrJSTypeAliasDeclaration(kind Kind, modifiers *ModifierList, name *IdentifierNode, typeParameters *NodeList, typeNode *TypeNode) *Node { data := &TypeAliasDeclaration{} data.modifiers = modifiers data.name = name data.TypeParameters = typeParameters data.Type = typeNode - return newNode(KindTypeAliasDeclaration, data, f.hooks) + return newNode(kind, data, f.hooks) +} + +func (f *NodeFactory) NewTypeAliasDeclaration(modifiers *ModifierList, name *IdentifierNode, typeParameters *NodeList, typeNode *TypeNode) *Node { + return f.newTypeOrJSTypeAliasDeclaration(KindTypeAliasDeclaration, modifiers, name, typeParameters, typeNode) } func (f *NodeFactory) UpdateTypeAliasDeclaration(node *TypeAliasDeclaration, modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, typeNode *TypeNode) *Node { @@ -3270,6 +3266,9 @@ func (node *TypeAliasDeclaration) ForEachChild(v Visitor) bool { } func (node *TypeAliasDeclaration) VisitEachChild(v *NodeVisitor) *Node { + if node.Kind == KindJSTypeAliasDeclaration { + return v.Factory.UpdateJSTypeAliasDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitNode(node.Type)) + } return v.Factory.UpdateTypeAliasDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitNode(node.Type)) } @@ -3282,52 +3281,22 @@ func (node *TypeAliasDeclaration) Name() *DeclarationName { return node.name } func IsTypeAliasDeclaration(node *Node) bool { return node.Kind == KindTypeAliasDeclaration } - -func IsEitherTypeAliasDeclaration(node *Node) bool { +// TODO: See if this is still necessary +func IsTypeOrJSTypeAliasDeclaration(node *Node) bool { return node.Kind == KindTypeAliasDeclaration || node.Kind == KindJSTypeAliasDeclaration } -type JSTypeAliasDeclaration struct { - StatementBase - DeclarationBase - ExportableBase - ModifiersBase - LocalsContainerBase - name *IdentifierNode // IdentifierNode - TypeParameters *NodeList // NodeList[*TypeParameterDeclarationNode]. Optional - Type *TypeNode // TypeNode -} - func (f *NodeFactory) NewJSTypeAliasDeclaration(modifiers *ModifierList, name *IdentifierNode, typeParameters *NodeList, typeNode *TypeNode) *Node { - data := &JSTypeAliasDeclaration{} - data.modifiers = modifiers - data.name = name - data.TypeParameters = typeParameters - data.Type = typeNode - return newNode(KindJSTypeAliasDeclaration, data, f.hooks) + return f.newTypeOrJSTypeAliasDeclaration(KindJSTypeAliasDeclaration, modifiers, name, typeParameters, typeNode) } -func (f *NodeFactory) UpdateJSTypeAliasDeclaration(node *JSTypeAliasDeclaration, modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, typeNode *TypeNode) *Node { +func (f *NodeFactory) UpdateJSTypeAliasDeclaration(node *TypeAliasDeclaration, modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, typeNode *TypeNode) *Node { if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || typeNode != node.Type { return updateNode(f.NewJSTypeAliasDeclaration(modifiers, name, typeParameters, typeNode), node.AsNode(), f.hooks) } return node.AsNode() } -func (node *JSTypeAliasDeclaration) ForEachChild(v Visitor) bool { - return visitModifiers(v, node.modifiers) || visit(v, node.name) || visitNodeList(v, node.TypeParameters) || visit(v, node.Type) -} - -func (node *JSTypeAliasDeclaration) VisitEachChild(v *NodeVisitor) *Node { - return v.Factory.UpdateJSTypeAliasDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitNode(node.Type)) -} - -func (node *JSTypeAliasDeclaration) Clone(f *NodeFactory) *Node { - return cloneNode(f.NewJSTypeAliasDeclaration(node.Modifiers(), node.Name(), node.TypeParameters, node.Type), node.AsNode(), f.hooks) -} - -func (node *JSTypeAliasDeclaration) Name() *DeclarationName { return node.name } - func IsJSTypeAliasDeclaration(node *Node) bool { return node.Kind == KindJSTypeAliasDeclaration } diff --git a/internal/checker/checker.go b/internal/checker/checker.go index ac0a41a5b3..ad0a58b84c 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -2344,12 +2344,12 @@ func (c *Checker) checkTypeParameter(node *ast.Node) { } func (c *Checker) checkTypeParameterDeferred(node *ast.Node) { - if ast.IsInterfaceDeclaration(node.Parent) || ast.IsClassLike(node.Parent) || ast.IsTypeAliasDeclaration(node.Parent) || ast.IsJSTypeAliasDeclaration(node.Parent) { + if ast.IsInterfaceDeclaration(node.Parent) || ast.IsClassLike(node.Parent) || ast.IsTypeOrJSTypeAliasDeclaration(node.Parent) { typeParameter := c.getDeclaredTypeOfTypeParameter(c.getSymbolOfDeclaration(node)) modifiers := c.getTypeParameterModifiers(typeParameter) & (ast.ModifierFlagsIn | ast.ModifierFlagsOut) if modifiers != 0 { symbol := c.getSymbolOfDeclaration(node.Parent) - if (ast.IsTypeAliasDeclaration(node.Parent) || ast.IsJSTypeAliasDeclaration(node.Parent)) && c.getDeclaredTypeOfSymbol(symbol).objectFlags&(ObjectFlagsAnonymous|ObjectFlagsMapped) == 0 { + if ast.IsTypeOrJSTypeAliasDeclaration(node.Parent) && c.getDeclaredTypeOfSymbol(symbol).objectFlags&(ObjectFlagsAnonymous|ObjectFlagsMapped) == 0 { c.error(node, diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types) } else if modifiers == ast.ModifierFlagsIn || modifiers == ast.ModifierFlagsOut { source := c.createMarkerType(symbol, typeParameter, core.IfElse(modifiers == ast.ModifierFlagsOut, c.markerSubTypeForCheck, c.markerSuperTypeForCheck)) @@ -6331,12 +6331,7 @@ func (c *Checker) checkTypeAliasDeclaration(node *ast.Node) { c.checkTypeNameIsReserved(node.Name(), diagnostics.Type_alias_name_cannot_be_0) c.checkExportsOnMergedDeclarations(node) - var typeNode *ast.Node - if node.Kind == ast.KindTypeAliasDeclaration { - typeNode = node.AsTypeAliasDeclaration().Type - } else if node.Kind == ast.KindJSTypeAliasDeclaration { - typeNode = node.AsJSTypeAliasDeclaration().Type - } + typeNode := node.AsTypeAliasDeclaration().Type typeParameters := node.TypeParameters() c.checkTypeParameters(typeParameters) if typeNode != nil && typeNode.Kind == ast.KindIntrinsicKeyword { @@ -22059,8 +22054,8 @@ func (c *Checker) getDeclaredTypeOfTypeAlias(symbol *ast.Symbol) *Type { if !c.pushTypeResolution(symbol, TypeSystemPropertyNameDeclaredType) { return c.errorType } - declaration := core.Find(symbol.Declarations, ast.IsEitherTypeAliasDeclaration) - typeNode := declaration.Type() + declaration := core.Find(symbol.Declarations, ast.IsTypeOrJSTypeAliasDeclaration) + typeNode := declaration.AsTypeAliasDeclaration().Type t := c.getTypeFromTypeNode(typeNode) if c.popTypeResolution() { typeParameters := c.getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) diff --git a/internal/checker/utilities.go b/internal/checker/utilities.go index 7b1f13e5c7..eaa90faa3d 100644 --- a/internal/checker/utilities.go +++ b/internal/checker/utilities.go @@ -524,7 +524,7 @@ func hasExportAssignmentSymbol(moduleSymbol *ast.Symbol) bool { } func isTypeAlias(node *ast.Node) bool { - return ast.IsEitherTypeAliasDeclaration(node) + return ast.IsTypeOrJSTypeAliasDeclaration(node) } func hasOnlyExpressionInitializer(node *ast.Node) bool { @@ -1444,7 +1444,7 @@ func (c *Checker) isMutableLocalVariableDeclaration(declaration *ast.Node) bool func isInAmbientOrTypeNode(node *ast.Node) bool { return node.Flags&ast.NodeFlagsAmbient != 0 || ast.FindAncestor(node, func(n *ast.Node) bool { - return ast.IsInterfaceDeclaration(n) || ast.IsTypeAliasDeclaration(n) || ast.IsJSTypeAliasDeclaration(n) || ast.IsTypeLiteralNode(n) + return ast.IsInterfaceDeclaration(n) || ast.IsTypeOrJSTypeAliasDeclaration(n) || ast.IsTypeLiteralNode(n) }) != nil } diff --git a/internal/printer/printer.go b/internal/printer/printer.go index 4e0ee527cb..52661b9231 100644 --- a/internal/printer/printer.go +++ b/internal/printer/printer.go @@ -1725,7 +1725,7 @@ func (p *Printer) emitClassElement(node *ast.ClassElement) { case ast.KindNotEmittedStatement: p.emitNotEmittedStatement(node.AsNotEmittedStatement()) case ast.KindJSTypeAliasDeclaration: - p.emitJSTypeAliasDeclaration(node.AsJSTypeAliasDeclaration()) + p.emitTypeAliasDeclaration(node.AsTypeAliasDeclaration()) default: panic(fmt.Sprintf("unexpected ClassElement: %v", node.Kind)) } @@ -3485,21 +3485,6 @@ func (p *Printer) emitTypeAliasDeclaration(node *ast.TypeAliasDeclaration) { p.exitNode(node.AsNode(), state) } -func (p *Printer) emitJSTypeAliasDeclaration(node *ast.JSTypeAliasDeclaration) { - state := p.enterNode(node.AsNode()) - p.emitModifierList(node.AsNode(), node.Modifiers(), false /*allowDecorators*/) - p.writeKeyword("jstype") - p.writeSpace() - p.emitBindingIdentifier(node.Name().AsIdentifier()) - p.emitTypeParameters(node.AsNode(), node.TypeParameters) - p.writeSpace() - p.writePunctuation("=") - p.writeSpace() - p.emitTypeNodeOutsideExtends(node.Type) - p.writeTrailingSemicolon() - p.exitNode(node.AsNode(), state) -} - func (p *Printer) emitEnumDeclaration(node *ast.EnumDeclaration) { state := p.enterNode(node.AsNode()) p.emitModifierList(node.AsNode(), node.Modifiers(), false /*allowDecorators*/) @@ -3885,10 +3870,8 @@ func (p *Printer) emitStatement(node *ast.Statement) { p.emitClassDeclaration(node.AsClassDeclaration()) case ast.KindInterfaceDeclaration: p.emitInterfaceDeclaration(node.AsInterfaceDeclaration()) - case ast.KindTypeAliasDeclaration: + case ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration: p.emitTypeAliasDeclaration(node.AsTypeAliasDeclaration()) - case ast.KindJSTypeAliasDeclaration: - p.emitJSTypeAliasDeclaration(node.AsJSTypeAliasDeclaration()) case ast.KindEnumDeclaration: p.emitEnumDeclaration(node.AsEnumDeclaration()) case ast.KindModuleDeclaration: @@ -4507,7 +4490,7 @@ func (p *Printer) hasTrailingComma(parentNode *ast.Node, children *ast.NodeList) case parentNode.ParameterList(): originalList = originalParent.ParameterList() } - case ast.KindClassDeclaration, ast.KindClassExpression, ast.KindInterfaceDeclaration, ast.KindTypeAliasDeclaration: + case ast.KindClassDeclaration, ast.KindClassExpression, ast.KindInterfaceDeclaration, ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration: switch children { case parentNode.TypeParameterList(): originalList = originalParent.TypeParameterList() diff --git a/internal/printer/utilities.go b/internal/printer/utilities.go index 9bf5560de8..b4ef948b40 100644 --- a/internal/printer/utilities.go +++ b/internal/printer/utilities.go @@ -452,12 +452,8 @@ func getContainingNodeArray(node *ast.Node) *ast.NodeList { return parent.ClassLikeData().TypeParameters case ast.IsInterfaceDeclaration(parent): return parent.AsInterfaceDeclaration().TypeParameters - case ast.IsTypeAliasDeclaration(parent): + case ast.IsTypeOrJSTypeAliasDeclaration(parent): return parent.AsTypeAliasDeclaration().TypeParameters - case ast.IsJSTypeAliasDeclaration(parent): - return parent.AsJSTypeAliasDeclaration().TypeParameters - // case ast.IsJSDocTemplateTag(parent): - // return parent.AsJSDocTemplateTag().TypeParameters case ast.IsInferTypeNode(parent): break default: diff --git a/internal/testutil/tsbaseline/type_symbol_baseline.go b/internal/testutil/tsbaseline/type_symbol_baseline.go index 7d065ac79c..bbb80c5332 100644 --- a/internal/testutil/tsbaseline/type_symbol_baseline.go +++ b/internal/testutil/tsbaseline/type_symbol_baseline.go @@ -342,7 +342,7 @@ func (walker *typeWriterWalker) writeTypeOrSymbol(node *ast.Node, isSymbolWalk b if ast.IsPartOfTypeNode(node) || ast.IsIdentifier(node) && (ast.GetMeaningFromDeclaration(node.Parent)&ast.SemanticMeaningValue) == 0 && - !(ast.IsEitherTypeAliasDeclaration(node.Parent) && node == node.Parent.Name()) { + !(ast.IsTypeOrJSTypeAliasDeclaration(node.Parent) && node == node.Parent.Name()) { return nil } From fc6199be967fa1570ceb3502bf220dc84702042c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 26 Mar 2025 09:37:49 -0700 Subject: [PATCH 17/25] remove another jsdoc todo --- internal/checker/checker.go | 38 +++++++++++++++---------------- internal/checker/emitresolver.go | 2 +- internal/checker/flow.go | 2 +- internal/checker/grammarchecks.go | 2 +- internal/checker/relater.go | 6 ++--- internal/checker/utilities.go | 22 ++++++++---------- 6 files changed, 34 insertions(+), 38 deletions(-) diff --git a/internal/checker/checker.go b/internal/checker/checker.go index ad0a58b84c..69788d5806 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -2659,8 +2659,8 @@ func (c *Checker) checkAccessorDeclaration(node *ast.Node) { setter := ast.GetDeclarationOfKind(symbol, ast.KindSetAccessor) if getter != nil && setter != nil && c.nodeLinks.Get(getter).flags&NodeCheckFlagsTypeChecked == 0 { c.nodeLinks.Get(getter).flags |= NodeCheckFlagsTypeChecked - getterFlags := getEffectiveModifierFlags(getter) - setterFlags := getEffectiveModifierFlags(setter) + getterFlags := getter.ModifierFlags() + setterFlags := setter.ModifierFlags() if (getterFlags & ast.ModifierFlagsAbstract) != (setterFlags & ast.ModifierFlagsAbstract) { c.error(getter.Name(), diagnostics.Accessors_must_both_be_abstract_or_non_abstract) c.error(setter.Name(), diagnostics.Accessors_must_both_be_abstract_or_non_abstract) @@ -4100,7 +4100,7 @@ func (c *Checker) checkBaseTypeAccessibility(t *Type, node *ast.Node) { signatures := c.getSignaturesOfType(t, SignatureKindConstruct) if len(signatures) != 0 { declaration := signatures[0].declaration - if declaration != nil && hasEffectiveModifier(declaration, ast.ModifierFlagsPrivate) { + if declaration != nil && hasModifier(declaration, ast.ModifierFlagsPrivate) { typeClassDeclaration := getClassLikeDeclarationOfSymbol(t.symbol) if !c.isNodeWithinClass(node, typeClassDeclaration) { c.error(node, diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, c.getFullyQualifiedName(t.symbol, nil)) @@ -4550,7 +4550,7 @@ func (c *Checker) checkPropertyInitialization(node *ast.Node) { } constructor := ast.FindConstructorDeclaration(node) for _, member := range node.Members() { - if getEffectiveModifierFlags(member)&ast.ModifierFlagsAmbient != 0 { + if member.ModifierFlags()&ast.ModifierFlagsAmbient != 0 { continue } if !ast.IsStatic(member) && c.isPropertyWithoutInitializer(member) { @@ -6268,7 +6268,7 @@ func (c *Checker) checkAliasSymbol(node *ast.Node) { name := node.PropertyNameOrName().Text() c.addTypeOnlyDeclarationRelatedInfo(c.error(node, message, name), core.IfElse(isType, nil, typeOnlyAlias), name) } - if isType && node.Kind == ast.KindImportEqualsDeclaration && hasEffectiveModifier(node, ast.ModifierFlagsExport) { + if isType && node.Kind == ast.KindImportEqualsDeclaration && hasModifier(node, ast.ModifierFlagsExport) { c.error(node, diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled, c.getIsolatedModulesLikeFlagName()) } case ast.KindExportSpecifier: @@ -6322,7 +6322,7 @@ func (c *Checker) areDeclarationFlagsIdentical(left *ast.Declaration, right *ast return false } interestingFlags := ast.ModifierFlagsPrivate | ast.ModifierFlagsProtected | ast.ModifierFlagsAsync | ast.ModifierFlagsAbstract | ast.ModifierFlagsReadonly | ast.ModifierFlagsStatic - return getSelectedEffectiveModifierFlags(left, interestingFlags) == getSelectedEffectiveModifierFlags(right, interestingFlags) + return getSelectedModifierFlags(left, interestingFlags) == getSelectedModifierFlags(right, interestingFlags) } func (c *Checker) checkTypeAliasDeclaration(node *ast.Node) { @@ -6552,7 +6552,7 @@ func (c *Checker) checkUnusedClassMembers(node *ast.Node) { break // Already would have reported an error on the getter. } symbol := c.getSymbolOfDeclaration(member) - if !c.isReferenced(symbol) && (hasEffectiveModifier(member, ast.ModifierFlagsPrivate) || member.Name() != nil && ast.IsPrivateIdentifier(member.Name())) && member.Flags&ast.NodeFlagsAmbient == 0 { + if !c.isReferenced(symbol) && (hasModifier(member, ast.ModifierFlagsPrivate) || member.Name() != nil && ast.IsPrivateIdentifier(member.Name())) && member.Flags&ast.NodeFlagsAmbient == 0 { c.reportUnused(member, UnusedKindLocal, NewDiagnosticForNode(member.Name(), diagnostics.X_0_is_declared_but_its_value_is_never_read, c.symbolToString(symbol))) } case ast.KindConstructor: @@ -8098,7 +8098,7 @@ func (c *Checker) resolveNewExpression(node *ast.Node, candidatesOutArray *[]*Si } if expressionType.symbol != nil { valueDecl := getClassLikeDeclarationOfSymbol(expressionType.symbol) - if valueDecl != nil && hasEffectiveModifier(valueDecl, ast.ModifierFlagsAbstract) { + if valueDecl != nil && hasModifier(valueDecl, ast.ModifierFlagsAbstract) { c.error(node, diagnostics.Cannot_create_an_instance_of_an_abstract_class) return c.resolveErrorCall(node) } @@ -8131,7 +8131,7 @@ func (c *Checker) isConstructorAccessible(node *ast.Node, signature *Signature) return true } declaration := signature.declaration - modifiers := getSelectedEffectiveModifierFlags(declaration, ast.ModifierFlagsNonPublicAccessibilityModifier) + modifiers := getSelectedModifierFlags(declaration, ast.ModifierFlagsNonPublicAccessibilityModifier) // (1) Public constructors and (2) constructor functions are always accessible. if modifiers == 0 || !ast.IsConstructorDeclaration(declaration) { return true @@ -10769,7 +10769,7 @@ func (c *Checker) getControlFlowContainer(node *ast.Node) *ast.Node { func (c *Checker) getFlowTypeOfProperty(reference *ast.Node, prop *ast.Symbol) *Type { initialType := c.undefinedType - if prop != nil && prop.ValueDeclaration != nil && (!c.isAutoTypedProperty(prop) || getEffectiveModifierFlags(prop.ValueDeclaration)&ast.ModifierFlagsAmbient != 0) { + if prop != nil && prop.ValueDeclaration != nil && (!c.isAutoTypedProperty(prop) || prop.ValueDeclaration.ModifierFlags()&ast.ModifierFlagsAmbient != 0) { initialType = c.getTypeOfPropertyInBaseClass(prop) } return c.getFlowTypeOfReferenceEx(reference, c.autoType, initialType, nil, nil) @@ -15294,7 +15294,7 @@ func (c *Checker) getTypeForVariableLikeDeclaration(declaration *ast.Node, inclu isProperty := ast.IsPropertyDeclaration(declaration) && !ast.HasAccessorModifier(declaration) || ast.IsPropertySignatureDeclaration(declaration) isOptional := includeOptionality && isOptionalDeclaration(declaration) // Use type from type annotation if one is present - declaredType := c.tryGetTypeFromEffectiveTypeNode(declaration) + declaredType := c.tryGetTypeFromTypeNode(declaration) if ast.IsCatchClauseVariableDeclarationOrBindingElement(declaration) { if declaredType != nil { // If the catch clause is explicitly annotated with any or unknown, accept it, otherwise error. @@ -17022,7 +17022,7 @@ func (c *Checker) getExportAssignmentType(symbol *ast.Symbol) *Type { if symbol != nil { for _, d := range symbol.Declarations { if ast.IsExportAssignment(d) { - t := c.tryGetTypeFromEffectiveTypeNode(d) + t := c.tryGetTypeFromTypeNode(d) if t != nil { return t } @@ -18047,7 +18047,7 @@ func (c *Checker) getIndexInfosOfIndexSymbol(indexSymbol *ast.Symbol, siblingSym } forEachType(c.getTypeFromTypeNode(typeNode), func(keyType *Type) { if c.isValidIndexKeyType(keyType) && findIndexInfo(indexInfos, keyType) == nil { - indexInfo := c.newIndexInfo(keyType, valueType, hasEffectiveModifier(declaration, ast.ModifierFlagsReadonly), declaration) + indexInfo := c.newIndexInfo(keyType, valueType, hasModifier(declaration, ast.ModifierFlagsReadonly), declaration) indexInfos = append(indexInfos, indexInfo) } }) @@ -18073,17 +18073,17 @@ func (c *Checker) getIndexInfosOfIndexSymbol(indexSymbol *ast.Symbol, siblingSym if c.isTypeAssignableTo(keyType, c.stringNumberSymbolType) { if c.isTypeAssignableTo(keyType, c.numberType) { hasComputedNumberProperty = true - if !hasEffectiveReadonlyModifier(declaration) { + if !hasReadonlyModifier(declaration) { readonlyComputedNumberProperty = false } } else if c.isTypeAssignableTo(keyType, c.esSymbolType) { hasComputedSymbolProperty = true - if !hasEffectiveReadonlyModifier(declaration) { + if !hasReadonlyModifier(declaration) { readonlyComputedSymbolProperty = false } } else { hasComputedStringProperty = true - if !hasEffectiveReadonlyModifier(declaration) { + if !hasReadonlyModifier(declaration) { readonlyComputedStringProperty = false } } @@ -21091,7 +21091,7 @@ func instantiateList[T comparable](c *Checker, values []T, m *TypeMapper, instan return values } -func (c *Checker) tryGetTypeFromEffectiveTypeNode(node *ast.Node) *Type { +func (c *Checker) tryGetTypeFromTypeNode(node *ast.Node) *Type { typeNode := node.Type() if typeNode != nil { return c.getTypeFromTypeNode(typeNode) @@ -25810,7 +25810,7 @@ func (c *Checker) markPropertyAsReferenced(prop *ast.Symbol, nodeForCheckWriteOn if prop.Flags&ast.SymbolFlagsClassMember == 0 || prop.ValueDeclaration == nil { return } - hasPrivateModifier := hasEffectiveModifier(prop.ValueDeclaration, ast.ModifierFlagsPrivate) + hasPrivateModifier := hasModifier(prop.ValueDeclaration, ast.ModifierFlagsPrivate) hasPrivateIdentifier := prop.ValueDeclaration.Name() != nil && ast.IsPrivateIdentifier(prop.ValueDeclaration.Name()) if !hasPrivateModifier && !hasPrivateIdentifier { return @@ -27044,7 +27044,7 @@ func (c *Checker) getContextualType(node *ast.Node, contextFlags ContextFlags) * case ast.KindSatisfiesExpression: return c.getTypeFromTypeNode(parent.AsSatisfiesExpression().Type) case ast.KindExportAssignment: - return c.tryGetTypeFromEffectiveTypeNode(parent) + return c.tryGetTypeFromTypeNode(parent) case ast.KindJsxExpression: return c.getContextualTypeForJsxExpression(parent, contextFlags) case ast.KindJsxAttribute, ast.KindJsxSpreadAttribute: diff --git a/internal/checker/emitresolver.go b/internal/checker/emitresolver.go index a40e52f8b3..1b2bca67c0 100644 --- a/internal/checker/emitresolver.go +++ b/internal/checker/emitresolver.go @@ -38,7 +38,7 @@ func (r *emitResolver) IsReferencedAliasDeclaration(node *ast.Node) bool { return true } target := aliasLinks.aliasTarget - if target != nil && getEffectiveModifierFlags(node)&ast.ModifierFlagsExport != 0 && + if target != nil && node.ModifierFlags()&ast.ModifierFlagsExport != 0 && c.getSymbolFlags(target)&ast.SymbolFlagsValue != 0 && (c.compilerOptions.ShouldPreserveConstEnums() || !isConstEnumOrConstEnumOnlyModule(target)) { return true diff --git a/internal/checker/flow.go b/internal/checker/flow.go index 5a366610b0..b5e0961e68 100644 --- a/internal/checker/flow.go +++ b/internal/checker/flow.go @@ -1713,7 +1713,7 @@ func (c *Checker) tryGetNameFromEntityNameExpression(node *ast.Node) (string, bo if declaration == nil { return "", false } - t := c.tryGetTypeFromEffectiveTypeNode(declaration) + t := c.tryGetTypeFromTypeNode(declaration) if t != nil { if name, ok := tryGetNameFromType(t); ok { return name, true diff --git a/internal/checker/grammarchecks.go b/internal/checker/grammarchecks.go index d9f143cb1d..7a43a5371f 100644 --- a/internal/checker/grammarchecks.go +++ b/internal/checker/grammarchecks.go @@ -1404,7 +1404,7 @@ func (c *Checker) checkGrammarTypeOperatorNode(node *ast.TypeOperatorNode) bool return c.grammarErrorOnNode((parent.AsVariableDeclaration()).Name(), diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const) } case ast.KindPropertyDeclaration: - if !ast.IsStatic(parent) || !hasEffectiveReadonlyModifier(parent) { + if !ast.IsStatic(parent) || !hasReadonlyModifier(parent) { return c.grammarErrorOnNode((parent.AsPropertyDeclaration()).Name(), diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly) } case ast.KindPropertySignature: diff --git a/internal/checker/relater.go b/internal/checker/relater.go index c3281879da..8381ddf0f0 100644 --- a/internal/checker/relater.go +++ b/internal/checker/relater.go @@ -1411,7 +1411,7 @@ func (c *Checker) getTypeParameterModifiers(tp *Type) ast.ModifierFlags { var flags ast.ModifierFlags if tp.symbol != nil { for _, d := range tp.symbol.Declarations { - flags |= getEffectiveModifierFlags(d) + flags |= d.ModifierFlags() } } return flags & (ast.ModifierFlagsIn | ast.ModifierFlagsOut | ast.ModifierFlagsConst) @@ -4435,8 +4435,8 @@ func (r *Relater) constructorVisibilitiesAreCompatible(sourceSignature *Signatur if sourceSignature.declaration == nil || targetSignature.declaration == nil { return true } - sourceAccessibility := getEffectiveModifierFlags(sourceSignature.declaration) & ast.ModifierFlagsNonPublicAccessibilityModifier - targetAccessibility := getEffectiveModifierFlags(targetSignature.declaration) & ast.ModifierFlagsNonPublicAccessibilityModifier + sourceAccessibility := sourceSignature.declaration.ModifierFlags() & ast.ModifierFlagsNonPublicAccessibilityModifier + targetAccessibility := targetSignature.declaration.ModifierFlags() & ast.ModifierFlagsNonPublicAccessibilityModifier // A public, protected and private signature is assignable to a private signature. if targetAccessibility == ast.ModifierFlagsPrivate { return true diff --git a/internal/checker/utilities.go b/internal/checker/utilities.go index eaa90faa3d..30176357a2 100644 --- a/internal/checker/utilities.go +++ b/internal/checker/utilities.go @@ -89,20 +89,16 @@ func hasDecorators(node *ast.Node) bool { return ast.HasSyntacticModifier(node, ast.ModifierFlagsDecorator) } -func getEffectiveModifierFlags(node *ast.Node) ast.ModifierFlags { - return node.ModifierFlags() // !!! Handle JSDoc +func getSelectedModifierFlags(node *ast.Node, flags ast.ModifierFlags) ast.ModifierFlags { + return node.ModifierFlags() & flags } -func getSelectedEffectiveModifierFlags(node *ast.Node, flags ast.ModifierFlags) ast.ModifierFlags { - return getEffectiveModifierFlags(node) & flags +func hasModifier(node *ast.Node, flags ast.ModifierFlags) bool { + return node.ModifierFlags()&flags != 0 } -func hasEffectiveModifier(node *ast.Node, flags ast.ModifierFlags) bool { - return getEffectiveModifierFlags(node)&flags != 0 -} - -func hasEffectiveReadonlyModifier(node *ast.Node) bool { - return hasEffectiveModifier(node, ast.ModifierFlagsReadonly) +func hasReadonlyModifier(node *ast.Node) bool { + return hasModifier(node, ast.ModifierFlagsReadonly) } func isBindingElementOfBareOrAccessedRequire(node *ast.Node) bool { @@ -595,7 +591,7 @@ func declarationBelongsToPrivateAmbientMember(declaration *ast.Node) bool { } func isPrivateWithinAmbient(node *ast.Node) bool { - return (hasEffectiveModifier(node, ast.ModifierFlagsPrivate) || ast.IsPrivateIdentifierClassElementDeclaration(node)) && node.Flags&ast.NodeFlagsAmbient != 0 + return (hasModifier(node, ast.ModifierFlagsPrivate) || ast.IsPrivateIdentifierClassElementDeclaration(node)) && node.Flags&ast.NodeFlagsAmbient != 0 } func isTypeAssertion(node *ast.Node) bool { @@ -1244,9 +1240,9 @@ func isValidESSymbolDeclaration(node *ast.Node) bool { return ast.IsVarConst(node) && ast.IsIdentifier(node.AsVariableDeclaration().Name()) && isVariableDeclarationInVariableStatement(node) } if ast.IsPropertyDeclaration(node) { - return hasEffectiveReadonlyModifier(node) && ast.HasStaticModifier(node) + return hasReadonlyModifier(node) && ast.HasStaticModifier(node) } - return ast.IsPropertySignatureDeclaration(node) && hasEffectiveReadonlyModifier(node) + return ast.IsPropertySignatureDeclaration(node) && hasReadonlyModifier(node) } func isVariableDeclarationInVariableStatement(node *ast.Node) bool { From 6146316a89c93840931da8829e69e2c8f1e978e5 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 26 Mar 2025 13:52:36 -0700 Subject: [PATCH 18/25] fix formatting --- internal/ast/ast.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 4838d011f6..5106287910 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -3281,7 +3281,7 @@ func (node *TypeAliasDeclaration) Name() *DeclarationName { return node.name } func IsTypeAliasDeclaration(node *Node) bool { return node.Kind == KindTypeAliasDeclaration } -// TODO: See if this is still necessary + func IsTypeOrJSTypeAliasDeclaration(node *Node) bool { return node.Kind == KindTypeAliasDeclaration || node.Kind == KindJSTypeAliasDeclaration } From f39861f42fda60e5eadc7759dcd90cdf84396fda Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 1 Apr 2025 10:56:53 -0700 Subject: [PATCH 19/25] delete unused baselines --- .../conformance/es2022SharedMemory.errors.txt | 26 ----- .../es2022SharedMemory.errors.txt.diff | 31 ------ .../conformance/es2022SharedMemory.symbols | 66 ------------- .../es2022SharedMemory.symbols.diff | 59 ------------ .../conformance/es2022SharedMemory.types | 94 ------------------- .../conformance/es2022SharedMemory.types.diff | 77 --------------- 6 files changed, 353 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols delete mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types delete mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types.diff diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt deleted file mode 100644 index ee76b11975..0000000000 --- a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -es2022SharedMemory.ts(6,34): error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. -es2022SharedMemory.ts(7,52): error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. - - -==== es2022SharedMemory.ts (2 errors) ==== - const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); - const int32 = new Int32Array(sab); - const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); - const int64 = new BigInt64Array(sab64); - const waitValue = Atomics.wait(int32, 0, 0); - const { async, value } = Atomics.waitAsync(int32, 0, 0); - ~~~~~~~~~ -!!! error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. - const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); - ~~~~~~~~~ -!!! error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. - - const main = async () => { - if (async) { - await value; - } - if (async64) { - await value64; - } - } - main(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt.diff deleted file mode 100644 index 8b2e2f9704..0000000000 --- a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.es2022SharedMemory.errors.txt -+++ new.es2022SharedMemory.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+es2022SharedMemory.ts(6,34): error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. -+es2022SharedMemory.ts(7,52): error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. -+ -+ -+==== es2022SharedMemory.ts (2 errors) ==== -+ const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); -+ const int32 = new Int32Array(sab); -+ const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); -+ const int64 = new BigInt64Array(sab64); -+ const waitValue = Atomics.wait(int32, 0, 0); -+ const { async, value } = Atomics.waitAsync(int32, 0, 0); -+ ~~~~~~~~~ -+!!! error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. -+ const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); -+ ~~~~~~~~~ -+!!! error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. -+ -+ const main = async () => { -+ if (async) { -+ await value; -+ } -+ if (async64) { -+ await value64; -+ } -+ } -+ main(); diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols deleted file mode 100644 index 1868a63088..0000000000 --- a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols +++ /dev/null @@ -1,66 +0,0 @@ -//// [tests/cases/conformance/es2022/es2022SharedMemory.ts] //// - -=== es2022SharedMemory.ts === -const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); ->sab : Symbol(sab, Decl(es2022SharedMemory.ts, 0, 5)) ->SharedArrayBuffer : Symbol(SharedArrayBuffer, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --)) ->Int32Array.BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) ->BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) - -const int32 = new Int32Array(sab); ->int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) ->Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) ->sab : Symbol(sab, Decl(es2022SharedMemory.ts, 0, 5)) - -const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); ->sab64 : Symbol(sab64, Decl(es2022SharedMemory.ts, 2, 5)) ->SharedArrayBuffer : Symbol(SharedArrayBuffer, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --)) ->BigInt64Array.BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) ->BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) ->BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) - -const int64 = new BigInt64Array(sab64); ->int64 : Symbol(int64, Decl(es2022SharedMemory.ts, 3, 5)) ->BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) ->sab64 : Symbol(sab64, Decl(es2022SharedMemory.ts, 2, 5)) - -const waitValue = Atomics.wait(int32, 0, 0); ->waitValue : Symbol(waitValue, Decl(es2022SharedMemory.ts, 4, 5)) ->Atomics.wait : Symbol(wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) ->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) ->wait : Symbol(wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) ->int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) - -const { async, value } = Atomics.waitAsync(int32, 0, 0); ->async : Symbol(async, Decl(es2022SharedMemory.ts, 5, 7)) ->value : Symbol(value, Decl(es2022SharedMemory.ts, 5, 14)) ->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) ->int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) - -const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); ->async64 : Symbol(async64, Decl(es2022SharedMemory.ts, 6, 7)) ->value64 : Symbol(value64, Decl(es2022SharedMemory.ts, 6, 23)) ->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) ->int64 : Symbol(int64, Decl(es2022SharedMemory.ts, 3, 5)) ->BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) - -const main = async () => { ->main : Symbol(main, Decl(es2022SharedMemory.ts, 8, 5)) - - if (async) { ->async : Symbol(async, Decl(es2022SharedMemory.ts, 5, 7)) - - await value; ->value : Symbol(value, Decl(es2022SharedMemory.ts, 5, 14)) - } - if (async64) { ->async64 : Symbol(async64, Decl(es2022SharedMemory.ts, 6, 7)) - - await value64; ->value64 : Symbol(value64, Decl(es2022SharedMemory.ts, 6, 23)) - } -} -main(); ->main : Symbol(main, Decl(es2022SharedMemory.ts, 8, 5)) - diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols.diff b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols.diff deleted file mode 100644 index 575a61fa8c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols.diff +++ /dev/null @@ -1,59 +0,0 @@ ---- old.es2022SharedMemory.symbols -+++ new.es2022SharedMemory.symbols -@@= skipped -3, +3 lines =@@ - const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); - >sab : Symbol(sab, Decl(es2022SharedMemory.ts, 0, 5)) - >SharedArrayBuffer : Symbol(SharedArrayBuffer, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --)) -->Int32Array.BYTES_PER_ELEMENT : Symbol(Int32ArrayConstructor.BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) -+>Int32Array.BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) - >Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) -->BYTES_PER_ELEMENT : Symbol(Int32ArrayConstructor.BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) -+>BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) - - const int32 = new Int32Array(sab); - >int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) -@@= skipped -12, +12 lines =@@ - const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); - >sab64 : Symbol(sab64, Decl(es2022SharedMemory.ts, 2, 5)) - >SharedArrayBuffer : Symbol(SharedArrayBuffer, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --)) -->BigInt64Array.BYTES_PER_ELEMENT : Symbol(BigInt64ArrayConstructor.BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) -+>BigInt64Array.BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) - >BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) -->BYTES_PER_ELEMENT : Symbol(BigInt64ArrayConstructor.BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) -+>BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) - - const int64 = new BigInt64Array(sab64); - >int64 : Symbol(int64, Decl(es2022SharedMemory.ts, 3, 5)) -@@= skipped -11, +11 lines =@@ - - const waitValue = Atomics.wait(int32, 0, 0); - >waitValue : Symbol(waitValue, Decl(es2022SharedMemory.ts, 4, 5)) -->Atomics.wait : Symbol(Atomics.wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) -->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -->wait : Symbol(Atomics.wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) -+>Atomics.wait : Symbol(wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) -+>Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) -+>wait : Symbol(wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) - >int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) - - const { async, value } = Atomics.waitAsync(int32, 0, 0); - >async : Symbol(async, Decl(es2022SharedMemory.ts, 5, 7)) - >value : Symbol(value, Decl(es2022SharedMemory.ts, 5, 14)) -->Atomics.waitAsync : Symbol(Atomics.waitAsync, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -->waitAsync : Symbol(Atomics.waitAsync, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -+>Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) - >int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) - - const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); -->async : Symbol(async, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) - >async64 : Symbol(async64, Decl(es2022SharedMemory.ts, 6, 7)) -->value : Symbol(value, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) - >value64 : Symbol(value64, Decl(es2022SharedMemory.ts, 6, 23)) -->Atomics.waitAsync : Symbol(Atomics.waitAsync, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -->waitAsync : Symbol(Atomics.waitAsync, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -+>Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) - >int64 : Symbol(int64, Decl(es2022SharedMemory.ts, 3, 5)) - >BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) - diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types deleted file mode 100644 index 25e4b08e4c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types +++ /dev/null @@ -1,94 +0,0 @@ -//// [tests/cases/conformance/es2022/es2022SharedMemory.ts] //// - -=== es2022SharedMemory.ts === -const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); ->sab : SharedArrayBuffer ->new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024) : SharedArrayBuffer ->SharedArrayBuffer : SharedArrayBufferConstructor ->Int32Array.BYTES_PER_ELEMENT * 1024 : number ->Int32Array.BYTES_PER_ELEMENT : number ->Int32Array : Int32ArrayConstructor ->BYTES_PER_ELEMENT : number ->1024 : 1024 - -const int32 = new Int32Array(sab); ->int32 : Int32Array ->new Int32Array(sab) : Int32Array ->Int32Array : Int32ArrayConstructor ->sab : SharedArrayBuffer - -const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); ->sab64 : SharedArrayBuffer ->new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024) : SharedArrayBuffer ->SharedArrayBuffer : SharedArrayBufferConstructor ->BigInt64Array.BYTES_PER_ELEMENT * 1024 : number ->BigInt64Array.BYTES_PER_ELEMENT : number ->BigInt64Array : BigInt64ArrayConstructor ->BYTES_PER_ELEMENT : number ->1024 : 1024 - -const int64 = new BigInt64Array(sab64); ->int64 : BigInt64Array ->new BigInt64Array(sab64) : BigInt64Array ->BigInt64Array : BigInt64ArrayConstructor ->sab64 : SharedArrayBuffer - -const waitValue = Atomics.wait(int32, 0, 0); ->waitValue : "not-equal" | "ok" | "timed-out" ->Atomics.wait(int32, 0, 0) : "not-equal" | "ok" | "timed-out" ->Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; } ->Atomics : Atomics ->wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; } ->int32 : Int32Array ->0 : 0 ->0 : 0 - -const { async, value } = Atomics.waitAsync(int32, 0, 0); ->async : any ->value : any ->Atomics.waitAsync(int32, 0, 0) : any ->Atomics.waitAsync : any ->Atomics : Atomics ->waitAsync : any ->int32 : Int32Array ->0 : 0 ->0 : 0 - -const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); ->async : any ->async64 : any ->value : any ->value64 : any ->Atomics.waitAsync(int64, 0, BigInt(0)) : any ->Atomics.waitAsync : any ->Atomics : Atomics ->waitAsync : any ->int64 : BigInt64Array ->0 : 0 ->BigInt(0) : bigint ->BigInt : BigIntConstructor ->0 : 0 - -const main = async () => { ->main : () => Promise ->async () => { if (async) { await value; } if (async64) { await value64; }} : () => Promise - - if (async) { ->async : any - - await value; ->await value : any ->value : any - } - if (async64) { ->async64 : any - - await value64; ->await value64 : any ->value64 : any - } -} -main(); ->main() : Promise ->main : () => Promise - diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types.diff b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types.diff deleted file mode 100644 index 5cb5eec562..0000000000 --- a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.es2022SharedMemory.types -+++ new.es2022SharedMemory.types -@@= skipped -33, +33 lines =@@ - >sab64 : SharedArrayBuffer - - const waitValue = Atomics.wait(int32, 0, 0); -->waitValue : "ok" | "not-equal" | "timed-out" -->Atomics.wait(int32, 0, 0) : "ok" | "not-equal" | "timed-out" -->Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } -+>waitValue : "not-equal" | "ok" | "timed-out" -+>Atomics.wait(int32, 0, 0) : "not-equal" | "ok" | "timed-out" -+>Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; } - >Atomics : Atomics -->wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } -+>wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; } - >int32 : Int32Array - >0 : 0 - >0 : 0 - - const { async, value } = Atomics.waitAsync(int32, 0, 0); -->async : boolean -->value : "not-equal" | "timed-out" | Promise<"ok" | "timed-out"> -->Atomics.waitAsync(int32, 0, 0) : { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; } -->Atomics.waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } -+>async : any -+>value : any -+>Atomics.waitAsync(int32, 0, 0) : any -+>Atomics.waitAsync : any - >Atomics : Atomics -->waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } -+>waitAsync : any - >int32 : Int32Array - >0 : 0 - >0 : 0 - - const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); - >async : any -->async64 : boolean -+>async64 : any - >value : any -->value64 : "not-equal" | "timed-out" | Promise<"ok" | "timed-out"> -->Atomics.waitAsync(int64, 0, BigInt(0)) : { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; } -->Atomics.waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } -+>value64 : any -+>Atomics.waitAsync(int64, 0, BigInt(0)) : any -+>Atomics.waitAsync : any - >Atomics : Atomics -->waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } -+>waitAsync : any - >int64 : BigInt64Array - >0 : 0 - >BigInt(0) : bigint -@@= skipped -40, +40 lines =@@ - >async () => { if (async) { await value; } if (async64) { await value64; }} : () => Promise - - if (async) { -->async : boolean -+>async : any - - await value; -->await value : "ok" | "timed-out" -->value : Promise<"ok" | "timed-out"> -+>await value : any -+>value : any - } - if (async64) { -->async64 : boolean -+>async64 : any - - await value64; -->await value64 : "ok" | "timed-out" -->value64 : Promise<"ok" | "timed-out"> -+>await value64 : any -+>value64 : any - } - } - main(); From 13ec1c35f9324ed2f382b72c9e3e402da07b7df3 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 3 Apr 2025 11:58:32 -0700 Subject: [PATCH 20/25] Improve locations of reparsed nodes --- internal/checker/grammarchecks.go | 10 --- internal/parser/jsdoc.go | 39 ++++++----- .../checkJsTypeDefNoUnusedLocalMarked.symbols | 4 +- ...kJsTypeDefNoUnusedLocalMarked.symbols.diff | 4 +- ...eckJsdocTypeTagOnExportAssignment1.symbols | 2 +- ...docTypeTagOnExportAssignment1.symbols.diff | 2 +- ...eckJsdocTypeTagOnExportAssignment3.symbols | 2 +- ...docTypeTagOnExportAssignment3.symbols.diff | 2 +- ...eckJsdocTypeTagOnExportAssignment4.symbols | 2 +- ...docTypeTagOnExportAssignment4.symbols.diff | 2 +- ...eckJsdocTypeTagOnExportAssignment5.symbols | 2 +- ...docTypeTagOnExportAssignment5.symbols.diff | 2 +- ...eckJsdocTypeTagOnExportAssignment6.symbols | 2 +- ...docTypeTagOnExportAssignment6.symbols.diff | 2 +- ...eckJsdocTypeTagOnExportAssignment7.symbols | 2 +- ...docTypeTagOnExportAssignment7.symbols.diff | 2 +- ...eckJsdocTypeTagOnExportAssignment8.symbols | 2 +- ...docTypeTagOnExportAssignment8.symbols.diff | 2 +- ...lyInferenceFromAnnotatedFunctionJs.symbols | 6 +- ...erenceFromAnnotatedFunctionJs.symbols.diff | 6 +- .../compiler/exportDefaultWithJSDoc1.symbols | 2 +- .../exportDefaultWithJSDoc1.symbols.diff | 2 +- .../compiler/exportDefaultWithJSDoc2.symbols | 2 +- .../exportDefaultWithJSDoc2.symbols.diff | 2 +- ...DeclarationEmitDoesNotRenameImport.symbols | 8 +-- ...rationEmitDoesNotRenameImport.symbols.diff | 20 ++---- .../compiler/jsEnumCrossFileExport.symbols | 8 +-- .../jsEnumCrossFileExport.symbols.diff | 8 +-- .../compiler/jsdocIllegalTags.errors.txt | 6 +- .../compiler/jsdocPropertyTagInvalid.symbols | 4 +- .../jsdocPropertyTagInvalid.symbols.diff | 4 +- .../strictOptionalProperties4.symbols | 12 ++-- .../strictOptionalProperties4.symbols.diff | 18 ++--- .../compiler/topLevelBlockExpando.symbols | 6 +- .../topLevelBlockExpando.symbols.diff | 6 +- ...nusedTypeParameters_templateTag.errors.txt | 6 +- ...usedTypeParameters_templateTag2.errors.txt | 58 ++++------------ .../assertionTypePredicates2.symbols | 4 +- .../assertionTypePredicates2.symbols.diff | 4 +- .../conformance/checkJsdocTypeTag5.symbols | 4 +- .../checkJsdocTypeTag5.symbols.diff | 4 +- .../checkJsdocTypedefInParamTag1.errors.txt | 8 +-- .../checkJsdocTypedefInParamTag1.symbols | 38 +++++------ .../checkJsdocTypedefInParamTag1.symbols.diff | 66 +++++-------------- .../conformance/importTypeInJSDoc.symbols | 2 +- .../importTypeInJSDoc.symbols.diff | 2 +- .../importingExportingTypes.symbols | 4 +- .../importingExportingTypes.symbols.diff | 4 +- ...FunctionClassesCjsExportAssignment.symbols | 30 ++++----- ...ionClassesCjsExportAssignment.symbols.diff | 30 ++++----- ...sImportAliasExposedWithinNamespace.symbols | 10 +-- ...rtAliasExposedWithinNamespace.symbols.diff | 10 +-- ...portAliasExposedWithinNamespaceCjs.symbols | 4 +- ...liasExposedWithinNamespaceCjs.symbols.diff | 4 +- .../jsDeclarationsTypeAliases.symbols | 2 +- .../jsDeclarationsTypeAliases.symbols.diff | 2 +- ...TypedefPropertyAndExportAssignment.symbols | 8 +-- ...efPropertyAndExportAssignment.symbols.diff | 8 +-- ...jsdocCatchClauseWithTypeAnnotation.symbols | 18 ++--- ...CatchClauseWithTypeAnnotation.symbols.diff | 18 ++--- ...docImportTypeReferenceToClassAlias.symbols | 2 +- ...portTypeReferenceToClassAlias.symbols.diff | 2 +- .../conformance/jsdocTemplateClass.symbols | 8 +-- .../jsdocTemplateClass.symbols.diff | 8 +-- .../jsdocTemplateConstructorFunction.symbols | 6 +- ...ocTemplateConstructorFunction.symbols.diff | 6 +- .../conformance/jsdocTemplateTag7.symbols | 2 +- .../jsdocTemplateTag7.symbols.diff | 2 +- .../jsdocTemplateTagDefault.errors.txt | 12 ++-- .../jsdocTemplateTagDefault.symbols | 26 ++++---- .../jsdocTemplateTagDefault.symbols.diff | 26 ++++---- .../conformance/linkTagEmit1.symbols | 10 +-- .../conformance/linkTagEmit1.symbols.diff | 10 +-- .../moduleExportAssignment7.symbols | 2 +- .../moduleExportAssignment7.symbols.diff | 11 +--- .../optionalBindingParameters3.symbols | 4 +- .../optionalBindingParameters3.symbols.diff | 4 +- .../recursiveTypeReferences2.symbols | 14 ++-- .../recursiveTypeReferences2.symbols.diff | 14 ++-- .../templateInsideCallback.symbols | 4 +- .../templateInsideCallback.symbols.diff | 4 +- ...typeTagOnFunctionReferencesGeneric.symbols | 2 +- ...agOnFunctionReferencesGeneric.symbols.diff | 2 +- .../conformance/typedefCrossModule.symbols | 18 ++--- .../typedefCrossModule.symbols.diff | 18 ++--- .../conformance/typedefInnerNamepaths.symbols | 2 +- .../typedefInnerNamepaths.symbols.diff | 2 +- .../conformance/typedefTagNested.symbols | 12 ++-- .../conformance/typedefTagNested.symbols.diff | 24 ------- .../typedefTagTypeResolution.symbols | 2 +- .../typedefTagTypeResolution.symbols.diff | 2 +- .../conformance/typedefTagWrapping.symbols | 12 ++-- .../typedefTagWrapping.symbols.diff | 12 ++-- .../compiler/jsdocIllegalTags.errors.txt.diff | 9 +-- ...TypeParameters_templateTag.errors.txt.diff | 6 +- ...ypeParameters_templateTag2.errors.txt.diff | 60 ++++------------- ...eckJsdocTypedefInParamTag1.errors.txt.diff | 8 +-- .../jsdocTemplateTagDefault.errors.txt.diff | 35 ++-------- 98 files changed, 386 insertions(+), 570 deletions(-) diff --git a/internal/checker/grammarchecks.go b/internal/checker/grammarchecks.go index 7a43a5371f..7216e9c44e 100644 --- a/internal/checker/grammarchecks.go +++ b/internal/checker/grammarchecks.go @@ -1857,16 +1857,6 @@ func (c *Checker) checkGrammarMetaProperty(node *ast.MetaProperty) bool { } func (c *Checker) checkGrammarConstructorTypeParameters(node *ast.ConstructorDeclaration) bool { - // !!! - // var jsdocTypeParameters []*ast.TypeParameterDeclaration - // if ast.IsInJSFile(node.AsNode()) { - // jsdocTypeParameters = getJSDocTypeParameterDeclarations(node) - // } else { - // jsdocTypeParameters = nil - // } - // if range_ == nil { - // range_ = core.FirstOrNil(jsdocTypeParameters) - // } range_ := node.TypeParameters if range_ != nil { var pos int diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index c6a0643b03..1698941b9c 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -80,13 +80,13 @@ func (p *Parser) attachTagsToHost(parent *ast.Node, jsDoc []*ast.Node) { break } export := p.factory.NewModifier(ast.KindExportKeyword) - export.Loc = core.NewTextRange(p.nodePos(), p.nodePos()) + export.Loc = tag.Loc export.Flags = p.contextFlags | ast.NodeFlagsReparsed nodes := p.nodeSlicePool.NewSlice(1) nodes[0] = export modifiers := p.newModifierList(export.Loc, nodes) - typeParameters := p.gatherTypeParameters(j, export.Loc) + typeParameters := p.gatherTypeParameters(j) var t *ast.Node switch typeExpression.Kind { @@ -96,18 +96,18 @@ func (p *Parser) attachTagsToHost(parent *ast.Node, jsDoc []*ast.Node) { members := p.nodeSlicePool.NewSlice(0) for _, member := range typeExpression.AsJSDocTypeLiteral().JsDocPropertyTags { prop := p.factory.NewPropertySignatureDeclaration(nil, member.Name(), nil /*postfixToken*/, member.Type(), nil /*initializer*/) - prop.Loc = export.Loc + prop.Loc = member.Loc prop.Flags = p.contextFlags | ast.NodeFlagsReparsed members = append(members, prop) } - t = p.factory.NewTypeLiteralNode(p.newNodeList(export.Loc, members)) - t.Loc = export.Loc + t = p.factory.NewTypeLiteralNode(p.newNodeList(typeExpression.Loc, members)) + t.Loc = typeExpression.Loc t.Flags = p.contextFlags | ast.NodeFlagsReparsed default: panic("typedef tag type expression should be a name reference or a type expression" + typeExpression.Kind.String()) } typeAlias := p.factory.NewJSTypeAliasDeclaration(modifiers, tag.AsJSDocTypedefTag().Name(), typeParameters, t) - typeAlias.Loc = core.NewTextRange(p.nodePos(), p.nodePos()) + typeAlias.Loc = core.NewTextRange(tag.Pos(), tag.End()) typeAlias.Flags = p.contextFlags | ast.NodeFlagsReparsed p.reparseList = append(p.reparseList, typeAlias) // !!! @overload and other unattached tags (@callback, @import et al) support goes here @@ -148,17 +148,17 @@ func (p *Parser) attachTagsToHost(parent *ast.Node, jsDoc []*ast.Node) { case ast.KindJSDocTemplateTag: if fun, ok := getFunctionLikeHost(parent); ok { if fun.TypeParameters() == nil { - fun.FunctionLikeData().TypeParameters = p.gatherTypeParameters(j, fun.Loc) + fun.FunctionLikeData().TypeParameters = p.gatherTypeParameters(j) } } else if parent.Kind == ast.KindClassDeclaration { class := parent.AsClassDeclaration() if class.TypeParameters == nil { - class.TypeParameters = p.gatherTypeParameters(j, parent.Loc) + class.TypeParameters = p.gatherTypeParameters(j) } } else if parent.Kind == ast.KindClassExpression { class := parent.AsClassExpression() if class.TypeParameters == nil { - class.TypeParameters = p.gatherTypeParameters(j, parent.Loc) + class.TypeParameters = p.gatherTypeParameters(j) } } case ast.KindJSDocParameterTag: @@ -198,24 +198,31 @@ func findMatchingParameter(fun *ast.Node, tag *ast.JSDocParameterTag) (*ast.Node return nil, false } -func (p *Parser) gatherTypeParameters(j *ast.Node, loc core.TextRange) *ast.NodeList { +func (p *Parser) gatherTypeParameters(j *ast.Node) *ast.NodeList { typeParameters := p.nodeSlicePool.NewSlice(0) + pos := -1 + end := -1 + first := true for _, tag := range j.AsJSDoc().Tags.Nodes { if tag.Kind == ast.KindJSDocTemplateTag { - template := tag.AsJSDocTemplateTag() - constraint := template.Constraint - for _, tp := range template.TypeParameters().Nodes { + if first { + pos = tag.Pos() + first = false + } + end = tag.End() + + constraint := tag.AsJSDocTemplateTag().Constraint + for _, tp := range tag.AsJSDocTemplateTag().TypeParameters().Nodes { typeParameter := tp.AsTypeParameter() var reparse *ast.Node if constraint == nil { reparse = typeParameter.Clone(&p.factory) } else { clone := constraint.Type().Clone(&p.factory) - clone.Loc = loc clone.Flags |= ast.NodeFlagsReparsed reparse = p.factory.NewTypeParameterDeclaration(typeParameter.Modifiers(), typeParameter.Name(), clone, typeParameter.DefaultType) + reparse.Loc = typeParameter.Loc } - reparse.Loc = loc reparse.Flags |= ast.NodeFlagsReparsed typeParameters = append(typeParameters, reparse) } @@ -224,7 +231,7 @@ func (p *Parser) gatherTypeParameters(j *ast.Node, loc core.TextRange) *ast.Node if len(typeParameters) == 0 { return nil } else { - return p.newNodeList(loc, typeParameters) + return p.newNodeList(core.NewTextRange(pos, end), typeParameters) } } diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols index 85b419e608..cea04c23ee 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols @@ -23,9 +23,9 @@ export = Foo; /** @typedef {(foo: Foo) => string} FooFun */ >foo : Symbol(foo, Decl(something.js, 2, 15)) ->Foo : Symbol(Foo, Decl(something.js, 4, 47)) +>Foo : Symbol(Foo, Decl(something.js, 0, 4)) module.exports = /** @type {FooFun} */(void 0); >module : Symbol(module, Decl(file.ts, 5, 7)) ->FooFun : Symbol(FooFun, Decl(something.js, 4, 47)) +>FooFun : Symbol(FooFun, Decl(something.js, 2, 4)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff index 3a6c75588a..3f396012f9 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff @@ -14,12 +14,12 @@ /** @typedef {(foo: Foo) => string} FooFun */ +>foo : Symbol(foo, Decl(something.js, 2, 15)) -+>Foo : Symbol(Foo, Decl(something.js, 4, 47)) ++>Foo : Symbol(Foo, Decl(something.js, 0, 4)) module.exports = /** @type {FooFun} */(void 0); ->module.exports : Symbol(module.exports, Decl(something.js, 0, 0)) ->module : Symbol(export=, Decl(something.js, 0, 0)) ->exports : Symbol(export=, Decl(something.js, 0, 0)) +>module : Symbol(module, Decl(file.ts, 5, 7)) -+>FooFun : Symbol(FooFun, Decl(something.js, 4, 47)) ++>FooFun : Symbol(FooFun, Decl(something.js, 2, 4)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols index f7c628c471..a355940acc 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols @@ -10,7 +10,7 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 7, 28)) +>Foo : Symbol(Foo, Decl(a.js, 1, 3)) export default { c: false }; >c : Symbol(c, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff index 2cb0989496..b7dd7b02a7 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff @@ -4,7 +4,7 @@ */ /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 7, 28)) ++>Foo : Symbol(Foo, Decl(a.js, 1, 3)) + export default { c: false }; >c : Symbol(c, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols index f478826e83..a815307498 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols @@ -14,7 +14,7 @@ const bar = { c: 1 }; >c : Symbol(c, Decl(a.js, 6, 13)) /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 6, 21)) +>Foo : Symbol(Foo, Decl(a.js, 1, 3)) export default bar; >bar : Symbol(bar, Decl(a.js, 6, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff index 0de6c3b6b3..ff530648ef 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff @@ -4,7 +4,7 @@ >c : Symbol(c, Decl(a.js, 6, 13)) /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 6, 21)) ++>Foo : Symbol(Foo, Decl(a.js, 1, 3)) + export default bar; >bar : Symbol(bar, Decl(a.js, 6, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols index a4cdb4aa24..580af32d8a 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols @@ -8,7 +8,7 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 5, 18)) +>Foo : Symbol(Foo, Decl(a.js, 1, 3)) export default ""; diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff index 267d68ece8..0e18346152 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff @@ -10,7 +10,7 @@ */ /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 5, 18)) ++>Foo : Symbol(Foo, Decl(a.js, 1, 3)) + export default ""; diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols index d35080a8e7..3200a3d610 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols @@ -10,7 +10,7 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 7, 30)) +>Foo : Symbol(Foo, Decl(a.js, 1, 3)) export default { a: 1, b: 1 }; >a : Symbol(a, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff index cc3892dce9..4915f00693 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff @@ -4,7 +4,7 @@ */ /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 7, 30)) ++>Foo : Symbol(Foo, Decl(a.js, 1, 3)) + export default { a: 1, b: 1 }; >a : Symbol(a, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols index 1ded111234..c93e85fc46 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols @@ -10,7 +10,7 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 7, 36)) +>Foo : Symbol(Foo, Decl(a.js, 1, 3)) export default { a: 1, b: 1, c: 1 }; >a : Symbol(a, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff index 3bcc91f392..f30dde3a1f 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff @@ -4,7 +4,7 @@ */ /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 7, 36)) ++>Foo : Symbol(Foo, Decl(a.js, 1, 3)) + export default { a: 1, b: 1, c: 1 }; >a : Symbol(a, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols index 8403bfccb8..2215eccc83 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols @@ -16,7 +16,7 @@ const abc = { a: 1, b: 1, c: 1 }; >c : Symbol(c, Decl(a.js, 6, 25)) /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 6, 33)) +>Foo : Symbol(Foo, Decl(a.js, 1, 3)) export default abc; >abc : Symbol(abc, Decl(a.js, 6, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff index 7455da0598..20acc5bdd3 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff @@ -4,7 +4,7 @@ >c : Symbol(c, Decl(a.js, 6, 25)) /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 6, 33)) ++>Foo : Symbol(Foo, Decl(a.js, 1, 3)) + export default abc; >abc : Symbol(abc, Decl(a.js, 6, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols index 5d3601dc5f..5d5368d511 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols @@ -10,7 +10,7 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 10, 1)) +>Foo : Symbol(Foo, Decl(a.js, 1, 3)) export default { a: 'a', diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff index 9708171c07..9a2d222cfd 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff @@ -4,7 +4,7 @@ */ /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 10, 1)) ++>Foo : Symbol(Foo, Decl(a.js, 1, 3)) + export default { a: 'a', diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols index 9ab915f497..a4bcfa0e77 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols @@ -3,13 +3,13 @@ === index.js === /** * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs ->Funcs : Symbol(Funcs, Decl(index.js, 14, 1)) +>Funcs : Symbol(Funcs, Decl(index.js, 1, 3)) * @template A ->A : Symbol(A, Decl(index.js, 14, 1)) +>A : Symbol(A, Decl(index.js, 2, 13)) * @template {Record} B ->B : Symbol(B, Decl(index.js, 14, 1)) +>B : Symbol(B, Decl(index.js, 3, 39)) >Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) */ diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff index a681e0dea7..c1dd5f32c1 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff @@ -4,13 +4,13 @@ === index.js === /** * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs -+>Funcs : Symbol(Funcs, Decl(index.js, 14, 1)) ++>Funcs : Symbol(Funcs, Decl(index.js, 1, 3)) + * @template A -+>A : Symbol(A, Decl(index.js, 14, 1)) ++>A : Symbol(A, Decl(index.js, 2, 13)) + * @template {Record} B -+>B : Symbol(B, Decl(index.js, 14, 1)) ++>B : Symbol(B, Decl(index.js, 3, 39)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) + */ diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols index 111f4d447d..43128a1875 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols @@ -7,7 +7,7 @@ */ /** @type {NumberLike[]} */export default ([ ]); ->NumberLike : Symbol(NumberLike, Decl(a.js, 5, 48)) +>NumberLike : Symbol(NumberLike, Decl(a.js, 2, 3)) === b.ts === import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff index 3d847d134a..8849d09e2f 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff @@ -11,7 +11,7 @@ */ /** @type {NumberLike[]} */export default ([ ]); -+>NumberLike : Symbol(NumberLike, Decl(a.js, 5, 48)) ++>NumberLike : Symbol(NumberLike, Decl(a.js, 2, 3)) === b.ts === import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols index 846041b992..cef7615dbd 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols @@ -7,7 +7,7 @@ */ export default /** @type {NumberLike[]} */([ ]); ->NumberLike : Symbol(NumberLike, Decl(a.js, 5, 48)) +>NumberLike : Symbol(NumberLike, Decl(a.js, 2, 3)) === b.ts === import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols.diff index 28dc2ea488..7e477e9cc1 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols.diff @@ -11,7 +11,7 @@ */ export default /** @type {NumberLike[]} */([ ]); -+>NumberLike : Symbol(NumberLike, Decl(a.js, 5, 48)) ++>NumberLike : Symbol(NumberLike, Decl(a.js, 2, 3)) === b.ts === import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols index 17370bd147..800b1f390e 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols @@ -41,15 +41,15 @@ class X extends Test { >super : Symbol(Test, Decl(Test.js, 0, 0)) if (options.test) { ->options.test : Symbol(test, Decl(index.js, 17, 1)) +>options.test : Symbol(test, Decl(index.js, 4, 3)) >options : Symbol(options, Decl(index.js, 11, 16)) ->test : Symbol(test, Decl(index.js, 17, 1)) +>test : Symbol(test, Decl(index.js, 4, 3)) this.test = new options.test(); >this : Symbol(X, Decl(index.js, 0, 33)) ->options.test : Symbol(test, Decl(index.js, 17, 1)) +>options.test : Symbol(test, Decl(index.js, 4, 3)) >options : Symbol(options, Decl(index.js, 11, 16)) ->test : Symbol(test, Decl(index.js, 17, 1)) +>test : Symbol(test, Decl(index.js, 4, 3)) } } } diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff index 60a2335ef1..6b5df32b6e 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff @@ -9,25 +9,13 @@ */ class X extends Test { -@@= skipped -16, +18 lines =@@ - >super : Symbol(Test, Decl(Test.js, 0, 0)) - - if (options.test) { -->options.test : Symbol(test, Decl(index.js, 4, 3)) -+>options.test : Symbol(test, Decl(index.js, 17, 1)) - >options : Symbol(options, Decl(index.js, 11, 16)) -->test : Symbol(test, Decl(index.js, 4, 3)) -+>test : Symbol(test, Decl(index.js, 17, 1)) +@@= skipped -21, +23 lines =@@ + >test : Symbol(test, Decl(index.js, 4, 3)) this.test = new options.test(); ->this.test : Symbol(X.test, Decl(index.js, 13, 27)) >this : Symbol(X, Decl(index.js, 0, 33)) ->test : Symbol(X.test, Decl(index.js, 13, 27)) -->options.test : Symbol(test, Decl(index.js, 4, 3)) -+>options.test : Symbol(test, Decl(index.js, 17, 1)) + >options.test : Symbol(test, Decl(index.js, 4, 3)) >options : Symbol(options, Decl(index.js, 11, 16)) -->test : Symbol(test, Decl(index.js, 4, 3)) -+>test : Symbol(test, Decl(index.js, 17, 1)) - } - } - } + >test : Symbol(test, Decl(index.js, 4, 3)) diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols index 24c166f1f3..ac90bfca9d 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols @@ -2,14 +2,14 @@ === enumDef.js === var Host = {}; ->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) +>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3)) Host.UserMetrics = {}; ->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) +>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3)) /** @enum {number} */ Host.UserMetrics.Action = { ->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) +>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3)) WindowDocked: 1, >WindowDocked : Symbol(WindowDocked, Decl(enumDef.js, 3, 27)) @@ -31,7 +31,7 @@ Host.UserMetrics.Action = { * @typedef {string} */ Host.UserMetrics.Blah = { ->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) +>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3)) x: 12 >x : Symbol(x, Decl(enumDef.js, 15, 25)) diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff index 40818b7f44..517a97f509 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.symbols.diff @@ -5,13 +5,13 @@ === enumDef.js === var Host = {}; ->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 0, 14), Decl(enumDef.js, 1, 22), Decl(enumDef.js, 8, 2), Decl(enumDef.js, 10, 21)) -+>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) ++>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3)) Host.UserMetrics = {}; ->Host.UserMetrics : Symbol(Host.UserMetrics, Decl(enumDef.js, 0, 14), Decl(enumDef.js, 3, 5), Decl(enumDef.js, 15, 5), Decl(enumDef.js, 10, 26)) ->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 0, 14), Decl(enumDef.js, 1, 22), Decl(enumDef.js, 8, 2), Decl(enumDef.js, 10, 21)) ->UserMetrics : Symbol(Host.UserMetrics, Decl(enumDef.js, 0, 14), Decl(enumDef.js, 3, 5), Decl(enumDef.js, 15, 5), Decl(enumDef.js, 10, 26)) -+>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) ++>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3)) /** @enum {number} */ Host.UserMetrics.Action = { @@ -20,7 +20,7 @@ ->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 0, 14), Decl(enumDef.js, 1, 22), Decl(enumDef.js, 8, 2), Decl(enumDef.js, 10, 21)) ->UserMetrics : Symbol(Host.UserMetrics, Decl(enumDef.js, 0, 14), Decl(enumDef.js, 3, 5), Decl(enumDef.js, 15, 5), Decl(enumDef.js, 10, 26)) ->Action : Symbol(Host.UserMetrics.Action, Decl(enumDef.js, 1, 22), Decl(enumDef.js, 3, 17), Decl(enumDef.js, 2, 4)) -+>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) ++>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3)) WindowDocked: 1, >WindowDocked : Symbol(WindowDocked, Decl(enumDef.js, 3, 27)) @@ -33,7 +33,7 @@ ->Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 0, 14), Decl(enumDef.js, 1, 22), Decl(enumDef.js, 8, 2), Decl(enumDef.js, 10, 21)) ->UserMetrics : Symbol(Host.UserMetrics, Decl(enumDef.js, 0, 14), Decl(enumDef.js, 3, 5), Decl(enumDef.js, 15, 5), Decl(enumDef.js, 10, 26)) ->Blah : Symbol(Host.UserMetrics.Blah, Decl(enumDef.js, 8, 2), Decl(enumDef.js, 15, 17), Decl(enumDef.js, 13, 3)) -+>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 17, 1)) ++>Host : Symbol(Host, Decl(enumDef.js, 0, 3), Decl(enumDef.js, 10, 3)) x: 12 >x : Symbol(x, Decl(enumDef.js, 15, 25)) diff --git a/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt index 16acaa3f0c..018ec07e52 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocIllegalTags.errors.txt @@ -1,13 +1,13 @@ -/a.js(3,5): error TS1092: Type parameters cannot appear on a constructor declaration. +/a.js(2,9): error TS1092: Type parameters cannot appear on a constructor declaration. /a.js(6,18): error TS1093: Type annotation cannot appear on a constructor declaration. ==== /a.js (2 errors) ==== class C { /** @template T */ - constructor() { } - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~ !!! error TS1092: Type parameters cannot appear on a constructor declaration. + constructor() { } } class D { /** @return {number} */ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols index 802c84dfae..e7ace365e2 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols @@ -3,10 +3,10 @@ === /a.js === /** * @typedef MyType ->MyType : Symbol(MyType, Decl(a.js, 6, 24)) +>MyType : Symbol(MyType, Decl(a.js, 1, 3)) * @property {sting} [x] ->x : Symbol(x, Decl(a.js, 6, 24)) +>x : Symbol(x, Decl(a.js, 2, 3)) >sting : Symbol(sting) */ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff index b79f3f0a5b..2f081da31f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff @@ -4,10 +4,10 @@ === /a.js === /** * @typedef MyType -+>MyType : Symbol(MyType, Decl(a.js, 6, 24)) ++>MyType : Symbol(MyType, Decl(a.js, 1, 3)) + * @property {sting} [x] -+>x : Symbol(x, Decl(a.js, 6, 24)) ++>x : Symbol(x, Decl(a.js, 2, 3)) +>sting : Symbol(sting) + */ diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols index 5a6fdae2ef..0a0d1c6bfa 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols @@ -8,20 +8,20 @@ const x = /** @type {Foo} */ ({}); >x : Symbol(x, Decl(a.js, 5, 5)) ->Foo : Symbol(Foo, Decl(a.js, 5, 34)) +>Foo : Symbol(Foo, Decl(a.js, 1, 3)) x.foo; // number | undefined ->x.foo : Symbol(foo, Decl(a.js, 5, 34)) +>x.foo : Symbol(foo, Decl(a.js, 2, 3)) >x : Symbol(x, Decl(a.js, 5, 5)) ->foo : Symbol(foo, Decl(a.js, 5, 34)) +>foo : Symbol(foo, Decl(a.js, 2, 3)) const y = /** @type {Required} */ ({}); >y : Symbol(y, Decl(a.js, 8, 5)) >Required : Symbol(Required, Decl(lib.es5.d.ts, --, --)) ->Foo : Symbol(Foo, Decl(a.js, 5, 34)) +>Foo : Symbol(Foo, Decl(a.js, 1, 3)) y.foo; // number ->y.foo : Symbol(foo, Decl(a.js, 5, 34)) +>y.foo : Symbol(foo, Decl(a.js, 2, 3)) >y : Symbol(y, Decl(a.js, 8, 5)) ->foo : Symbol(foo, Decl(a.js, 5, 34)) +>foo : Symbol(foo, Decl(a.js, 2, 3)) diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff index 2fa051e115..35464aa841 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff @@ -4,24 +4,16 @@ const x = /** @type {Foo} */ ({}); >x : Symbol(x, Decl(a.js, 5, 5)) -+>Foo : Symbol(Foo, Decl(a.js, 5, 34)) ++>Foo : Symbol(Foo, Decl(a.js, 1, 3)) x.foo; // number | undefined -->x.foo : Symbol(foo, Decl(a.js, 2, 3)) -+>x.foo : Symbol(foo, Decl(a.js, 5, 34)) - >x : Symbol(x, Decl(a.js, 5, 5)) -->foo : Symbol(foo, Decl(a.js, 2, 3)) -+>foo : Symbol(foo, Decl(a.js, 5, 34)) + >x.foo : Symbol(foo, Decl(a.js, 2, 3)) +@@= skipped -8, +9 lines =@@ const y = /** @type {Required} */ ({}); >y : Symbol(y, Decl(a.js, 8, 5)) +>Required : Symbol(Required, Decl(lib.es5.d.ts, --, --)) -+>Foo : Symbol(Foo, Decl(a.js, 5, 34)) ++>Foo : Symbol(Foo, Decl(a.js, 1, 3)) y.foo; // number -->y.foo : Symbol(foo, Decl(a.js, 2, 3)) -+>y.foo : Symbol(foo, Decl(a.js, 5, 34)) - >y : Symbol(y, Decl(a.js, 8, 5)) -->foo : Symbol(foo, Decl(a.js, 2, 3)) -+>foo : Symbol(foo, Decl(a.js, 5, 34)) - + >y.foo : Symbol(foo, Decl(a.js, 2, 3)) diff --git a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols index 9e59702891..2664bb14e8 100644 --- a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols +++ b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols @@ -42,13 +42,13 @@ interface Person { // Creates a type { first:string, last: string } /** * @typedef {Object} Human - creates a new type named 'SpecialType' ->Human : Symbol(Human, Decl(check.js, 10, 32)) +>Human : Symbol(Human, Decl(check.js, 2, 3)) * @property {string} first - a string property of SpecialType ->first : Symbol(first, Decl(check.js, 10, 32)) +>first : Symbol(first, Decl(check.js, 3, 3)) * @property {string} last - a number property of SpecialType ->last : Symbol(last, Decl(check.js, 10, 32)) +>last : Symbol(last, Decl(check.js, 4, 3)) */ diff --git a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols.diff b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols.diff index b1009db373..7c82553382 100644 --- a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols.diff @@ -46,13 +46,13 @@ // Creates a type { first:string, last: string } /** * @typedef {Object} Human - creates a new type named 'SpecialType' -+>Human : Symbol(Human, Decl(check.js, 10, 32)) ++>Human : Symbol(Human, Decl(check.js, 2, 3)) + * @property {string} first - a string property of SpecialType -+>first : Symbol(first, Decl(check.js, 10, 32)) ++>first : Symbol(first, Decl(check.js, 3, 3)) + * @property {string} last - a number property of SpecialType -+>last : Symbol(last, Decl(check.js, 10, 32)) ++>last : Symbol(last, Decl(check.js, 4, 3)) + */ diff --git a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.errors.txt b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.errors.txt index b8aec3b5b7..cfd276ebcd 100644 --- a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag.errors.txt @@ -1,9 +1,9 @@ -/a.js(2,1): error TS6196: 'T' is declared but never used. +/a.js(1,15): error TS6196: 'T' is declared but never used. ==== /a.js (1 errors) ==== /** @template T */ - function f() {} - ~~~~~~~~~~~~~~~ + ~ !!! error TS6196: 'T' is declared but never used. + function f() {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.errors.txt b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.errors.txt index a88e77ffd9..941b063cbf 100644 --- a/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/unusedTypeParameters_templateTag2.errors.txt @@ -1,81 +1,49 @@ -/a.js(1,1): error TS6205: All type parameters are unused. +/a.js(2,3): error TS6205: All type parameters are unused. /a.js(8,14): error TS2339: Property 'p' does not exist on type 'C1'. -/a.js(10,1): error TS6205: All type parameters are unused. -/a.js(17,1): error TS6205: All type parameters are unused. +/a.js(13,3): error TS6205: All type parameters are unused. +/a.js(20,3): error TS6205: All type parameters are unused. /a.js(25,14): error TS2339: Property 'p' does not exist on type 'C3'. ==== /a.js (5 errors) ==== /** - ~~~ * @template T - ~~~~~~~~~~~~~~ + ~~~~~~~~~~~~ * @template V ~~~~~~~~~~~~~~ */ - ~~~ + ~~ +!!! error TS6205: All type parameters are unused. class C1 { - ~~~~~~~~~~ constructor() { - ~~~~~~~~~~~~~~~~~~~ /** @type {T} */ - ~~~~~~~~~~~~~~~~~~~~~~~~ this.p; - ~~~~~~~~~~~~~~~ ~ !!! error TS2339: Property 'p' does not exist on type 'C1'. } - ~~~~~ } - ~ - ~ - - /** - ~~~ - ~~~ * @template T,V - ~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~ */ - ~~~ - ~~~ - class C2 { - ~ + ~~ !!! error TS6205: All type parameters are unused. - ~~~~~~~~~~ + class C2 { constructor() { } - ~~~~~~~~~~~~~~~~~~~~~ } - ~ - ~ - - /** - ~~~ - ~~~ * @template T,V,X - ~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~ */ - ~~~ - ~~~ - class C3 { - ~ + ~~ !!! error TS6205: All type parameters are unused. - ~~~~~~~~~~ + class C3 { constructor() { - ~~~~~~~~~~~~~~~~~~~ /** @type {T} */ - ~~~~~~~~~~~~~~~~~~~~~~~~ this.p; - ~~~~~~~~~~~~~~~ ~ !!! error TS2339: Property 'p' does not exist on type 'C3'. } - ~~~~~ - } - ~ -!!! error TS6205: All type parameters are unused. \ No newline at end of file + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols index 1b99348d4f..fdaa9d2161 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols @@ -9,7 +9,7 @@ /** * @typedef { A & { y: number } } B ->A : Symbol(A, Decl(assertionTypePredicates2.js, 15, 2)) +>A : Symbol(A, Decl(assertionTypePredicates2.js, 1, 3)) >y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) */ @@ -24,7 +24,7 @@ const foo = (a) => { if (/** @type { B } */ (a).y !== 0) throw TypeError(); >(a).y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) ->B : Symbol(B, Decl(assertionTypePredicates2.js, 15, 2)) +>B : Symbol(B, Decl(assertionTypePredicates2.js, 5, 3)) >a : Symbol(a, Decl(assertionTypePredicates2.js, 12, 13)) >y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) >TypeError : Symbol(TypeError, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff index b4549172a3..22d84b1ddb 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff @@ -10,7 +10,7 @@ /** * @typedef { A & { y: number } } B -+>A : Symbol(A, Decl(assertionTypePredicates2.js, 15, 2)) ++>A : Symbol(A, Decl(assertionTypePredicates2.js, 1, 3)) +>y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) + */ @@ -20,7 +20,7 @@ if (/** @type { B } */ (a).y !== 0) throw TypeError(); >(a).y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) -+>B : Symbol(B, Decl(assertionTypePredicates2.js, 15, 2)) ++>B : Symbol(B, Decl(assertionTypePredicates2.js, 5, 3)) >a : Symbol(a, Decl(assertionTypePredicates2.js, 12, 13)) >y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) >TypeError : Symbol(TypeError, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols index 58b8eff2b9..08daa8dfc3 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols @@ -40,7 +40,7 @@ var k = function (x) { return x } /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ ->Argle : Symbol(Argle, Decl(test.js, 20, 1)) +>Argle : Symbol(Argle, Decl(test.js, 16, 4)) >x : Symbol(x, Decl(test.js, 16, 15)) /** @type {Argle} */ @@ -57,7 +57,7 @@ var zeroonetwo = blargle('hi') >blargle : Symbol(blargle, Decl(test.js, 13, 33)) /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ ->Gioconda : Symbol(Gioconda, Decl(test.js, 30, 1)) +>Gioconda : Symbol(Gioconda, Decl(test.js, 25, 4)) >s : Symbol(s, Decl(test.js, 25, 16)) >b : Symbol(b, Decl(test.js, 25, 36)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff index d10dbedd7f..0a6004dae3 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff @@ -4,7 +4,7 @@ /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ -+>Argle : Symbol(Argle, Decl(test.js, 20, 1)) ++>Argle : Symbol(Argle, Decl(test.js, 16, 4)) +>x : Symbol(x, Decl(test.js, 16, 15)) + /** @type {Argle} */ @@ -14,7 +14,7 @@ >blargle : Symbol(blargle, Decl(test.js, 13, 33)) /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ -+>Gioconda : Symbol(Gioconda, Decl(test.js, 30, 1)) ++>Gioconda : Symbol(Gioconda, Decl(test.js, 25, 4)) +>s : Symbol(s, Decl(test.js, 25, 16)) +>b : Symbol(b, Decl(test.js, 25, 36)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt index 233ec17f1c..5c9948e856 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.errors.txt @@ -1,6 +1,6 @@ -0.js(15,5): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': w, y, z +0.js(15,5): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': y, z, w 0.js(28,6): error TS2741: Property 'anotherY' is missing in type '{ anotherX: string; }' but required in type 'AnotherOpts'. -0.js(42,6): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': w, y, z +0.js(42,6): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': y, z, w ==== 0.js (3 errors) ==== @@ -20,7 +20,7 @@ foo({x: 'abc'}); ~~~~~~~~~~ -!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': w, y, z +!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': y, z, w /** * @typedef {Object} AnotherOpts @@ -52,5 +52,5 @@ } foo2({x: 'abc'}); ~~~~~~~~~~ -!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': w, y, z +!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': y, z, w \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols index ec8369bf1d..05b8d7c9f3 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols @@ -4,19 +4,19 @@ // @ts-check /** * @typedef {Object} Opts ->Opts : Symbol(Opts, Decl(0.js, 12, 1)) +>Opts : Symbol(Opts, Decl(0.js, 2, 3)) * @property {string} x ->x : Symbol(x, Decl(0.js, 12, 1)) +>x : Symbol(x, Decl(0.js, 3, 3)) * @property {string=} y ->y : Symbol(y, Decl(0.js, 12, 1)) +>y : Symbol(y, Decl(0.js, 4, 3)) * @property {string} [z] ->z : Symbol(z, Decl(0.js, 12, 1)) +>z : Symbol(z, Decl(0.js, 5, 3)) * @property {string} [w="hi"] ->w : Symbol(w, Decl(0.js, 12, 1)) +>w : Symbol(w, Decl(0.js, 6, 3)) * * @param {Opts} opts @@ -26,9 +26,9 @@ function foo(opts) { >opts : Symbol(opts, Decl(0.js, 10, 13)) opts.x; ->opts.x : Symbol(x, Decl(0.js, 12, 1)) +>opts.x : Symbol(x, Decl(0.js, 3, 3)) >opts : Symbol(opts, Decl(0.js, 10, 13)) ->x : Symbol(x, Decl(0.js, 12, 1)) +>x : Symbol(x, Decl(0.js, 3, 3)) } foo({x: 'abc'}); @@ -37,13 +37,13 @@ foo({x: 'abc'}); /** * @typedef {Object} AnotherOpts ->AnotherOpts : Symbol(AnotherOpts, Decl(0.js, 25, 1)) +>AnotherOpts : Symbol(AnotherOpts, Decl(0.js, 17, 3)) * @property anotherX {string} ->anotherX : Symbol(anotherX, Decl(0.js, 25, 1)) +>anotherX : Symbol(anotherX, Decl(0.js, 18, 3)) * @property anotherY {string=} ->anotherY : Symbol(anotherY, Decl(0.js, 25, 1)) +>anotherY : Symbol(anotherY, Decl(0.js, 19, 3)) * * @param {AnotherOpts} opts @@ -53,9 +53,9 @@ function foo1(opts) { >opts : Symbol(opts, Decl(0.js, 23, 14)) opts.anotherX; ->opts.anotherX : Symbol(anotherX, Decl(0.js, 25, 1)) +>opts.anotherX : Symbol(anotherX, Decl(0.js, 18, 3)) >opts : Symbol(opts, Decl(0.js, 23, 14)) ->anotherX : Symbol(anotherX, Decl(0.js, 25, 1)) +>anotherX : Symbol(anotherX, Decl(0.js, 18, 3)) } foo1({anotherX: "world"}); @@ -64,19 +64,19 @@ foo1({anotherX: "world"}); /** * @typedef {object} Opts1 ->Opts1 : Symbol(Opts1, Decl(0.js, 40, 1)) +>Opts1 : Symbol(Opts1, Decl(0.js, 30, 3)) * @property {string} x ->x : Symbol(x, Decl(0.js, 40, 1)) +>x : Symbol(x, Decl(0.js, 31, 3)) * @property {string=} y ->y : Symbol(y, Decl(0.js, 40, 1)) +>y : Symbol(y, Decl(0.js, 32, 3)) * @property {string} [z] ->z : Symbol(z, Decl(0.js, 40, 1)) +>z : Symbol(z, Decl(0.js, 33, 3)) * @property {string} [w="hi"] ->w : Symbol(w, Decl(0.js, 40, 1)) +>w : Symbol(w, Decl(0.js, 34, 3)) * * @param {Opts1} opts @@ -86,9 +86,9 @@ function foo2(opts) { >opts : Symbol(opts, Decl(0.js, 38, 14)) opts.x; ->opts.x : Symbol(x, Decl(0.js, 40, 1)) +>opts.x : Symbol(x, Decl(0.js, 31, 3)) >opts : Symbol(opts, Decl(0.js, 38, 14)) ->x : Symbol(x, Decl(0.js, 40, 1)) +>x : Symbol(x, Decl(0.js, 31, 3)) } foo2({x: 'abc'}); >foo2 : Symbol(foo2, Decl(0.js, 27, 26)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff index cf5e555700..31d0fdb146 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff @@ -4,92 +4,56 @@ // @ts-check /** * @typedef {Object} Opts -+>Opts : Symbol(Opts, Decl(0.js, 12, 1)) ++>Opts : Symbol(Opts, Decl(0.js, 2, 3)) + * @property {string} x -+>x : Symbol(x, Decl(0.js, 12, 1)) ++>x : Symbol(x, Decl(0.js, 3, 3)) + * @property {string=} y -+>y : Symbol(y, Decl(0.js, 12, 1)) ++>y : Symbol(y, Decl(0.js, 4, 3)) + * @property {string} [z] -+>z : Symbol(z, Decl(0.js, 12, 1)) ++>z : Symbol(z, Decl(0.js, 5, 3)) + * @property {string} [w="hi"] -+>w : Symbol(w, Decl(0.js, 12, 1)) ++>w : Symbol(w, Decl(0.js, 6, 3)) + * * @param {Opts} opts */ -@@= skipped -12, +22 lines =@@ - >opts : Symbol(opts, Decl(0.js, 10, 13)) - - opts.x; -->opts.x : Symbol(x, Decl(0.js, 3, 3)) -+>opts.x : Symbol(x, Decl(0.js, 12, 1)) - >opts : Symbol(opts, Decl(0.js, 10, 13)) -->x : Symbol(x, Decl(0.js, 3, 3)) -+>x : Symbol(x, Decl(0.js, 12, 1)) - } - - foo({x: 'abc'}); -@@= skipped -11, +11 lines =@@ +@@= skipped -23, +33 lines =@@ /** * @typedef {Object} AnotherOpts -+>AnotherOpts : Symbol(AnotherOpts, Decl(0.js, 25, 1)) ++>AnotherOpts : Symbol(AnotherOpts, Decl(0.js, 17, 3)) + * @property anotherX {string} -+>anotherX : Symbol(anotherX, Decl(0.js, 25, 1)) ++>anotherX : Symbol(anotherX, Decl(0.js, 18, 3)) + * @property anotherY {string=} -+>anotherY : Symbol(anotherY, Decl(0.js, 25, 1)) ++>anotherY : Symbol(anotherY, Decl(0.js, 19, 3)) + * * @param {AnotherOpts} opts */ -@@= skipped -10, +16 lines =@@ - >opts : Symbol(opts, Decl(0.js, 23, 14)) - - opts.anotherX; -->opts.anotherX : Symbol(anotherX, Decl(0.js, 18, 3)) -+>opts.anotherX : Symbol(anotherX, Decl(0.js, 25, 1)) - >opts : Symbol(opts, Decl(0.js, 23, 14)) -->anotherX : Symbol(anotherX, Decl(0.js, 18, 3)) -+>anotherX : Symbol(anotherX, Decl(0.js, 25, 1)) - } - - foo1({anotherX: "world"}); -@@= skipped -11, +11 lines =@@ +@@= skipped -21, +27 lines =@@ /** * @typedef {object} Opts1 -+>Opts1 : Symbol(Opts1, Decl(0.js, 40, 1)) ++>Opts1 : Symbol(Opts1, Decl(0.js, 30, 3)) + * @property {string} x -+>x : Symbol(x, Decl(0.js, 40, 1)) ++>x : Symbol(x, Decl(0.js, 31, 3)) + * @property {string=} y -+>y : Symbol(y, Decl(0.js, 40, 1)) ++>y : Symbol(y, Decl(0.js, 32, 3)) + * @property {string} [z] -+>z : Symbol(z, Decl(0.js, 40, 1)) ++>z : Symbol(z, Decl(0.js, 33, 3)) + * @property {string} [w="hi"] -+>w : Symbol(w, Decl(0.js, 40, 1)) ++>w : Symbol(w, Decl(0.js, 34, 3)) + * * @param {Opts1} opts */ -@@= skipped -12, +22 lines =@@ - >opts : Symbol(opts, Decl(0.js, 38, 14)) - - opts.x; -->opts.x : Symbol(x, Decl(0.js, 31, 3)) -+>opts.x : Symbol(x, Decl(0.js, 40, 1)) - >opts : Symbol(opts, Decl(0.js, 38, 14)) -->x : Symbol(x, Decl(0.js, 31, 3)) -+>x : Symbol(x, Decl(0.js, 40, 1)) - } - foo2({x: 'abc'}); - >foo2 : Symbol(foo2, Decl(0.js, 27, 26)) diff --git a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols index 33bb5418f1..ece6ff9849 100644 --- a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols +++ b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols @@ -45,7 +45,7 @@ export = MyClass; let a = /** @type {Foo} */(/** @type {*} */(undefined)); >a : Symbol(a, Decl(index.js, 4, 3)) ->Foo : Symbol(Foo, Decl(index.js, 4, 56)) +>Foo : Symbol(Foo, Decl(index.js, 1, 3)) >undefined : Symbol(undefined) a = new Foo({doer: Foo.Bar}); diff --git a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols.diff b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols.diff index 98d81bb38f..aebf74277b 100644 --- a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols.diff @@ -41,7 +41,7 @@ let a = /** @type {Foo} */(/** @type {*} */(undefined)); >a : Symbol(a, Decl(index.js, 4, 3)) -+>Foo : Symbol(Foo, Decl(index.js, 4, 56)) ++>Foo : Symbol(Foo, Decl(index.js, 1, 3)) >undefined : Symbol(undefined) a = new Foo({doer: Foo.Bar}); diff --git a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols index 387a98964b..aebf7be31f 100644 --- a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols +++ b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols @@ -29,10 +29,10 @@ import { writeFile, WriteFileOptions, WriteFileOptions as OtherName } from "fs"; >x : Symbol(x, Decl(index.js, 2, 15)) export { JSDocType }; ->JSDocType : Symbol(JSDocType, Decl(index.js, 4, 21), Decl(index.js, 4, 8)) +>JSDocType : Symbol(JSDocType, Decl(index.js, 2, 4), Decl(index.js, 4, 8)) export { JSDocType as ThisIsFine }; ->JSDocType : Symbol(JSDocType, Decl(index.js, 4, 21), Decl(index.js, 4, 8)) +>JSDocType : Symbol(JSDocType, Decl(index.js, 2, 4), Decl(index.js, 4, 8)) >ThisIsFine : Symbol(ThisIsFine, Decl(index.js, 5, 8)) export { WriteFileOptions }; diff --git a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff index 3528e1c5db..4b42e6e157 100644 --- a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff @@ -8,11 +8,11 @@ export { JSDocType }; ->JSDocType : Symbol(JSDocType, Decl(index.js, 4, 8), Decl(index.js, 2, 4)) -+>JSDocType : Symbol(JSDocType, Decl(index.js, 4, 21), Decl(index.js, 4, 8)) ++>JSDocType : Symbol(JSDocType, Decl(index.js, 2, 4), Decl(index.js, 4, 8)) export { JSDocType as ThisIsFine }; ->JSDocType : Symbol(JSDocType, Decl(index.js, 4, 8), Decl(index.js, 2, 4)) -+>JSDocType : Symbol(JSDocType, Decl(index.js, 4, 21), Decl(index.js, 4, 8)) ++>JSDocType : Symbol(JSDocType, Decl(index.js, 2, 4), Decl(index.js, 4, 8)) >ThisIsFine : Symbol(ThisIsFine, Decl(index.js, 5, 8)) export { WriteFileOptions }; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols index 945f3efcda..d3ca2b12db 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols @@ -17,7 +17,7 @@ module.exports = Timer; === hook.js === /** * @typedef {(arg: import("./context")) => void} HookHandler ->HookHandler : Symbol(HookHandler, Decl(hook.js, 8, 1)) +>HookHandler : Symbol(HookHandler, Decl(hook.js, 1, 3)) >arg : Symbol(arg, Decl(hook.js, 1, 14)) */ @@ -39,14 +39,14 @@ module.exports = Hook; * Imports * * @typedef {import("./timer")} Timer ->Timer : Symbol(Timer, Decl(context.js, 36, 1)) +>Timer : Symbol(Timer, Decl(context.js, 3, 3)) * @typedef {import("./hook")} Hook ->Hook : Symbol(Hook, Decl(context.js, 36, 1)) +>Hook : Symbol(Hook, Decl(context.js, 4, 3)) * @typedef {import("./hook").HookHandler} HookHandler ->HookHandler : Symbol(HookHandler, Decl(context.js, 36, 1)) ->HookHandler : Symbol(HookHandler, Decl(hook.js, 8, 1)) +>HookHandler : Symbol(HookHandler, Decl(context.js, 5, 3)) +>HookHandler : Symbol(HookHandler, Decl(hook.js, 1, 3)) */ @@ -54,15 +54,15 @@ module.exports = Hook; * Input type definition * * @typedef {Object} Input ->Input : Symbol(Input, Decl(context.js, 36, 1)) +>Input : Symbol(Input, Decl(context.js, 11, 3)) * @prop {Timer} timer ->timer : Symbol(timer, Decl(context.js, 36, 1)) ->Timer : Symbol(Timer, Decl(context.js, 36, 1)) +>timer : Symbol(timer, Decl(context.js, 12, 3)) +>Timer : Symbol(Timer, Decl(context.js, 3, 3)) * @prop {Hook} hook ->hook : Symbol(hook, Decl(context.js, 36, 1)) ->Hook : Symbol(Hook, Decl(context.js, 36, 1)) +>hook : Symbol(hook, Decl(context.js, 13, 3)) +>Hook : Symbol(Hook, Decl(context.js, 4, 3)) */ @@ -70,15 +70,15 @@ module.exports = Hook; * State type definition * * @typedef {Object} State ->State : Symbol(State, Decl(context.js, 36, 1)) +>State : Symbol(State, Decl(context.js, 19, 3)) * @prop {Timer} timer ->timer : Symbol(timer, Decl(context.js, 36, 1)) ->Timer : Symbol(Timer, Decl(context.js, 36, 1)) +>timer : Symbol(timer, Decl(context.js, 20, 3)) +>Timer : Symbol(Timer, Decl(context.js, 3, 3)) * @prop {Hook} hook ->hook : Symbol(hook, Decl(context.js, 36, 1)) ->Hook : Symbol(Hook, Decl(context.js, 36, 1)) +>hook : Symbol(hook, Decl(context.js, 21, 3)) +>Hook : Symbol(Hook, Decl(context.js, 4, 3)) */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff index b319aa57e1..c47664c53b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff @@ -18,7 +18,7 @@ === hook.js === /** * @typedef {(arg: import("./context")) => void} HookHandler -+>HookHandler : Symbol(HookHandler, Decl(hook.js, 8, 1)) ++>HookHandler : Symbol(HookHandler, Decl(hook.js, 1, 3)) +>arg : Symbol(arg, Decl(hook.js, 1, 14)) + */ @@ -44,14 +44,14 @@ * Imports * * @typedef {import("./timer")} Timer -+>Timer : Symbol(Timer, Decl(context.js, 36, 1)) ++>Timer : Symbol(Timer, Decl(context.js, 3, 3)) + * @typedef {import("./hook")} Hook -+>Hook : Symbol(Hook, Decl(context.js, 36, 1)) ++>Hook : Symbol(Hook, Decl(context.js, 4, 3)) + * @typedef {import("./hook").HookHandler} HookHandler -+>HookHandler : Symbol(HookHandler, Decl(context.js, 36, 1)) -+>HookHandler : Symbol(HookHandler, Decl(hook.js, 8, 1)) ++>HookHandler : Symbol(HookHandler, Decl(context.js, 5, 3)) ++>HookHandler : Symbol(HookHandler, Decl(hook.js, 1, 3)) + */ @@ -59,15 +59,15 @@ * Input type definition * * @typedef {Object} Input -+>Input : Symbol(Input, Decl(context.js, 36, 1)) ++>Input : Symbol(Input, Decl(context.js, 11, 3)) + * @prop {Timer} timer -+>timer : Symbol(timer, Decl(context.js, 36, 1)) -+>Timer : Symbol(Timer, Decl(context.js, 36, 1)) ++>timer : Symbol(timer, Decl(context.js, 12, 3)) ++>Timer : Symbol(Timer, Decl(context.js, 3, 3)) + * @prop {Hook} hook -+>hook : Symbol(hook, Decl(context.js, 36, 1)) -+>Hook : Symbol(Hook, Decl(context.js, 36, 1)) ++>hook : Symbol(hook, Decl(context.js, 13, 3)) ++>Hook : Symbol(Hook, Decl(context.js, 4, 3)) + */ @@ -75,15 +75,15 @@ * State type definition * * @typedef {Object} State -+>State : Symbol(State, Decl(context.js, 36, 1)) ++>State : Symbol(State, Decl(context.js, 19, 3)) + * @prop {Timer} timer -+>timer : Symbol(timer, Decl(context.js, 36, 1)) -+>Timer : Symbol(Timer, Decl(context.js, 36, 1)) ++>timer : Symbol(timer, Decl(context.js, 20, 3)) ++>Timer : Symbol(Timer, Decl(context.js, 3, 3)) + * @prop {Hook} hook -+>hook : Symbol(hook, Decl(context.js, 36, 1)) -+>Hook : Symbol(Hook, Decl(context.js, 36, 1)) ++>hook : Symbol(hook, Decl(context.js, 21, 3)) ++>Hook : Symbol(Hook, Decl(context.js, 4, 3)) + */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols index 481eba3d4a..5b64978758 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols @@ -7,7 +7,7 @@ * @type {Object} */ const myTypes = { ->myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 19, 17), Decl(file.js, 19, 17), Decl(file.js, 19, 17)) +>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 4), Decl(file.js, 12, 3), Decl(file.js, 17, 4)) // SOME PROPS HERE }; @@ -32,7 +32,7 @@ const myTypes = { >Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) export {myTypes}; ->myTypes : Symbol(myTypes, Decl(file.js, 19, 17), Decl(file.js, 19, 8)) +>myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 19, 8)) === file2.js === import {myTypes} from './file.js'; @@ -44,13 +44,13 @@ import {myTypes} from './file.js'; * @type {Object} */ const testFnTypes = { ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 25, 1)) +>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 11, 4)) // SOME PROPS HERE }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 25, 1), Decl(file2.js, 27, 15)) +>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 11, 4), Decl(file2.js, 27, 15)) >myTypes : Symbol(myTypes) >typeC : Symbol(typeC) @@ -77,5 +77,5 @@ function testFn(input) { export {testFn, testFnTypes}; >testFn : Symbol(testFn, Decl(file2.js, 27, 8)) ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 25, 1), Decl(file2.js, 27, 15)) +>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 11, 4), Decl(file2.js, 27, 15)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff index 00436bd325..b908d8ddfa 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff @@ -5,7 +5,7 @@ */ const myTypes = { ->myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 50), Decl(file.js, 12, 12), Decl(file.js, 17, 38)) -+>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 19, 17), Decl(file.js, 19, 17), Decl(file.js, 19, 17)) ++>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 4), Decl(file.js, 12, 3), Decl(file.js, 17, 4)) // SOME PROPS HERE }; @@ -31,7 +31,7 @@ export {myTypes}; ->myTypes : Symbol(myTypes, Decl(file.js, 19, 8), Decl(file.js, 9, 50), Decl(file.js, 12, 12), Decl(file.js, 17, 38)) -+>myTypes : Symbol(myTypes, Decl(file.js, 19, 17), Decl(file.js, 19, 8)) ++>myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 19, 8)) === file2.js === import {myTypes} from './file.js'; @@ -40,13 +40,13 @@ */ const testFnTypes = { ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 11, 37)) -+>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 25, 1)) ++>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 11, 4)) // SOME PROPS HERE }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ -+>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 25, 1), Decl(file2.js, 27, 15)) ++>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 11, 4), Decl(file2.js, 27, 15)) +>myTypes : Symbol(myTypes) +>typeC : Symbol(typeC) @@ -57,5 +57,5 @@ export {testFn, testFnTypes}; >testFn : Symbol(testFn, Decl(file2.js, 27, 8)) ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 27, 15), Decl(file2.js, 11, 37)) -+>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 25, 1), Decl(file2.js, 27, 15)) ++>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 11, 4), Decl(file2.js, 27, 15)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols index 94d4ce8fad..ee54f6f4b3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols @@ -10,13 +10,13 @@ const {myTypes} = require('./file.js'); * @type {Object} */ const testFnTypes = { ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 25, 1)) +>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 11, 4)) // SOME PROPS HERE }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 25, 1)) +>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 11, 4)) >myTypes : Symbol(myTypes) >typeC : Symbol(typeC) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff index 2e8561f631..443dafbe78 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff @@ -14,13 +14,13 @@ */ const testFnTypes = { ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 11, 37)) -+>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 25, 1)) ++>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 7, 5), Decl(file2.js, 11, 4)) // SOME PROPS HERE }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ -+>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 25, 1)) ++>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 11, 4)) +>myTypes : Symbol(myTypes) +>typeC : Symbol(typeC) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols index 8c505d2e21..b57843828b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols @@ -32,7 +32,7 @@ export {}; // flag file as module === mixed.js === /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType ->SomeType : Symbol(SomeType, Decl(mixed.js, 9, 1)) +>SomeType : Symbol(SomeType, Decl(mixed.js, 1, 3)) >x : Symbol(x, Decl(mixed.js, 1, 14)) >LocalThing : Symbol(LocalThing, Decl(mixed.js, 16, 2)) >ExportedThing : Symbol(ExportedThing, Decl(mixed.js, 9, 1)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff index dab2d9a560..0f0faca6d1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff @@ -4,7 +4,7 @@ === mixed.js === /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType -+>SomeType : Symbol(SomeType, Decl(mixed.js, 9, 1)) ++>SomeType : Symbol(SomeType, Decl(mixed.js, 1, 3)) +>x : Symbol(x, Decl(mixed.js, 1, 14)) +>LocalThing : Symbol(LocalThing, Decl(mixed.js, 16, 2)) +>ExportedThing : Symbol(ExportedThing, Decl(mixed.js, 9, 1)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols index 86fdbbc8ac..48c822fc00 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols @@ -10,20 +10,20 @@ const {taskGroups, taskNameToGroup} = require('./module.js'); /** * @typedef TaskNode * @prop {TaskNode[]} children ->TaskNode : Symbol(TaskNode, Decl(index.js, 18, 1)) +>TaskNode : Symbol(TaskNode, Decl(index.js, 5, 3)) * @prop {TaskNode|undefined} parent ->TaskNode : Symbol(TaskNode, Decl(index.js, 18, 1)) +>TaskNode : Symbol(TaskNode, Decl(index.js, 5, 3)) * @prop {TaskGroup} group ->TaskGroup : Symbol(TaskGroup, Decl(index.js, 18, 1)) +>TaskGroup : Symbol(TaskGroup, Decl(index.js, 2, 4)) */ /** @typedef {{timers: Map}} PriorTaskData */ >timers : Symbol(timers, Decl(index.js, 11, 15)) >Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ->TaskNode : Symbol(TaskNode, Decl(index.js, 18, 1)) +>TaskNode : Symbol(TaskNode, Decl(index.js, 5, 3)) class MainThreadTasks { >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff index 8bc14f9bc0..e14dfd56bf 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff @@ -12,20 +12,20 @@ /** * @typedef TaskNode * @prop {TaskNode[]} children -+>TaskNode : Symbol(TaskNode, Decl(index.js, 18, 1)) ++>TaskNode : Symbol(TaskNode, Decl(index.js, 5, 3)) + * @prop {TaskNode|undefined} parent -+>TaskNode : Symbol(TaskNode, Decl(index.js, 18, 1)) ++>TaskNode : Symbol(TaskNode, Decl(index.js, 5, 3)) + * @prop {TaskGroup} group -+>TaskGroup : Symbol(TaskGroup, Decl(index.js, 18, 1)) ++>TaskGroup : Symbol(TaskGroup, Decl(index.js, 2, 4)) + */ /** @typedef {{timers: Map}} PriorTaskData */ +>timers : Symbol(timers, Decl(index.js, 11, 15)) +>Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -+>TaskNode : Symbol(TaskNode, Decl(index.js, 18, 1)) ++>TaskNode : Symbol(TaskNode, Decl(index.js, 5, 3)) + class MainThreadTasks { >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols index b978506cf1..c7658c125d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols @@ -3,13 +3,13 @@ === foo.js === /** * @typedef {any} Any ->Any : Symbol(Any, Decl(foo.js, 49, 1)) +>Any : Symbol(Any, Decl(foo.js, 1, 3)) */ /** * @typedef {unknown} Unknown ->Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) +>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) */ @@ -24,14 +24,14 @@ function fn() { try { } catch (/** @type {Any} */ err) { } // should be OK >err : Symbol(err, Decl(foo.js, 11, 19)) ->Any : Symbol(Any, Decl(foo.js, 49, 1)) +>Any : Symbol(Any, Decl(foo.js, 1, 3)) try { } catch (/** @type {unknown} */ err) { } // should be OK >err : Symbol(err, Decl(foo.js, 12, 19)) try { } catch (/** @type {Unknown} */ err) { } // should be OK >err : Symbol(err, Decl(foo.js, 13, 19)) ->Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) +>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) try { } catch (err) { err.foo; } // should be OK >err : Symbol(err, Decl(foo.js, 14, 19)) @@ -43,7 +43,7 @@ function fn() { try { } catch (/** @type {Any} */ err) { err.foo; } // should be OK >err : Symbol(err, Decl(foo.js, 16, 19)) ->Any : Symbol(Any, Decl(foo.js, 49, 1)) +>Any : Symbol(Any, Decl(foo.js, 1, 3)) >err : Symbol(err, Decl(foo.js, 16, 19)) try { } catch (/** @type {unknown} */ err) { console.log(err); } // should be OK @@ -55,7 +55,7 @@ function fn() { try { } catch (/** @type {Unknown} */ err) { console.log(err); } // should be OK >err : Symbol(err, Decl(foo.js, 18, 19)) ->Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) +>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) >console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) @@ -67,7 +67,7 @@ function fn() { try { } catch (/** @type {Unknown} */ err) { err.foo; } // error in the body >err : Symbol(err, Decl(foo.js, 20, 19)) ->Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) +>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) >err : Symbol(err, Decl(foo.js, 20, 19)) try { } catch (/** @type {Error} */ err) { } // error in the type @@ -120,7 +120,7 @@ function fn() { try { } catch (/** @type {Any} */ { x }) { x.foo;} // should be OK >x : Symbol(x, Decl(foo.js, 44, 39)) ->Any : Symbol(Any, Decl(foo.js, 49, 1)) +>Any : Symbol(Any, Decl(foo.js, 1, 3)) >x : Symbol(x, Decl(foo.js, 44, 39)) try { } catch (/** @type {unknown} */ { x }) { console.log(x); } // error in the destructure @@ -132,7 +132,7 @@ function fn() { try { } catch (/** @type {Unknown} */ { x }) { console.log(x); } // error in the destructure >x : Symbol(x, Decl(foo.js, 46, 43)) ->Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) +>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) >console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff index 89e91a843d..ee741e81a8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff @@ -4,13 +4,13 @@ === foo.js === /** * @typedef {any} Any -+>Any : Symbol(Any, Decl(foo.js, 49, 1)) ++>Any : Symbol(Any, Decl(foo.js, 1, 3)) + */ /** * @typedef {unknown} Unknown -+>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) ++>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) + */ @@ -19,14 +19,14 @@ try { } catch (/** @type {Any} */ err) { } // should be OK >err : Symbol(err, Decl(foo.js, 11, 19)) -+>Any : Symbol(Any, Decl(foo.js, 49, 1)) ++>Any : Symbol(Any, Decl(foo.js, 1, 3)) try { } catch (/** @type {unknown} */ err) { } // should be OK >err : Symbol(err, Decl(foo.js, 12, 19)) try { } catch (/** @type {Unknown} */ err) { } // should be OK >err : Symbol(err, Decl(foo.js, 13, 19)) -+>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) ++>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) try { } catch (err) { err.foo; } // should be OK >err : Symbol(err, Decl(foo.js, 14, 19)) @@ -34,7 +34,7 @@ try { } catch (/** @type {Any} */ err) { err.foo; } // should be OK >err : Symbol(err, Decl(foo.js, 16, 19)) -+>Any : Symbol(Any, Decl(foo.js, 49, 1)) ++>Any : Symbol(Any, Decl(foo.js, 1, 3)) >err : Symbol(err, Decl(foo.js, 16, 19)) try { } catch (/** @type {unknown} */ err) { console.log(err); } // should be OK @@ -49,7 +49,7 @@ try { } catch (/** @type {Unknown} */ err) { console.log(err); } // should be OK >err : Symbol(err, Decl(foo.js, 18, 19)) ->console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) -+>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) ++>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) +>console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) ->log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) @@ -61,7 +61,7 @@ try { } catch (/** @type {Unknown} */ err) { err.foo; } // error in the body >err : Symbol(err, Decl(foo.js, 20, 19)) -+>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) ++>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) >err : Symbol(err, Decl(foo.js, 20, 19)) try { } catch (/** @type {Error} */ err) { } // error in the type @@ -95,7 +95,7 @@ try { } catch (/** @type {Any} */ { x }) { x.foo;} // should be OK >x : Symbol(x, Decl(foo.js, 44, 39)) -+>Any : Symbol(Any, Decl(foo.js, 49, 1)) ++>Any : Symbol(Any, Decl(foo.js, 1, 3)) >x : Symbol(x, Decl(foo.js, 44, 39)) try { } catch (/** @type {unknown} */ { x }) { console.log(x); } // error in the destructure @@ -110,7 +110,7 @@ try { } catch (/** @type {Unknown} */ { x }) { console.log(x); } // error in the destructure >x : Symbol(x, Decl(foo.js, 46, 43)) ->console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) -+>Unknown : Symbol(Unknown, Decl(foo.js, 49, 1)) ++>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) +>console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) ->log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols index db400879f2..904bda9f34 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols @@ -12,7 +12,7 @@ module.exports.C = C === test.js === /** @typedef {import('./mod1').C} X */ ->X : Symbol(X, Decl(test.js, 4, 1)) +>X : Symbol(X, Decl(test.js, 0, 4)) /** @param {X} c */ function demo(c) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols.diff index 7f9a315b72..d47544f1cd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols.diff @@ -17,7 +17,7 @@ === test.js === /** @typedef {import('./mod1').C} X */ -+>X : Symbol(X, Decl(test.js, 4, 1)) ++>X : Symbol(X, Decl(test.js, 0, 4)) + /** @param {X} c */ function demo(c) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols index a38a774188..cee94ac2de 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols @@ -5,8 +5,8 @@ * @template T * @typedef {(t: T) => T} Id >t : Symbol(t, Decl(templateTagOnClasses.js, 2, 14)) ->T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) ->T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) +>T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) +>T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) */ /** @template T */ @@ -15,8 +15,8 @@ class Foo { /** @typedef {(t: T) => T} Id2 */ >t : Symbol(t, Decl(templateTagOnClasses.js, 6, 19)) ->T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) ->T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) +>T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) +>T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) /** @param {T} x */ constructor (x) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff index 0208bb60f8..840d674735 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff @@ -5,8 +5,8 @@ * @template T * @typedef {(t: T) => T} Id +>t : Symbol(t, Decl(templateTagOnClasses.js, 2, 14)) -+>T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) -+>T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) ++>T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) ++>T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) + */ /** @template T */ @@ -15,8 +15,8 @@ /** @typedef {(t: T) => T} Id2 */ +>t : Symbol(t, Decl(templateTagOnClasses.js, 6, 19)) -+>T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) -+>T : Symbol(T, Decl(templateTagOnClasses.js, 0, 0)) ++>T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) ++>T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) + /** @param {T} x */ constructor (x) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols index 7966eb39c4..6672d2842f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols @@ -4,10 +4,10 @@ /** * @template U * @typedef {(u: U) => U} Id ->Id : Symbol(Id, Decl(templateTagOnConstructorFunctions.js, 12, 1)) +>Id : Symbol(Id, Decl(templateTagOnConstructorFunctions.js, 2, 3)) >u : Symbol(u, Decl(templateTagOnConstructorFunctions.js, 2, 14)) ->U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 12, 1)) ->U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 12, 1)) +>U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 1, 13)) +>U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 1, 13)) */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff index 95f7db6caa..e35d27904e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff @@ -4,10 +4,10 @@ /** * @template U * @typedef {(u: U) => U} Id -+>Id : Symbol(Id, Decl(templateTagOnConstructorFunctions.js, 12, 1)) ++>Id : Symbol(Id, Decl(templateTagOnConstructorFunctions.js, 2, 3)) +>u : Symbol(u, Decl(templateTagOnConstructorFunctions.js, 2, 14)) -+>U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 12, 1)) -+>U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 12, 1)) ++>U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 1, 13)) ++>U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 1, 13)) + */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols index 2f758249d0..af62c28993 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols @@ -4,7 +4,7 @@ /** * @template const T * @typedef {[T]} X ->T : Symbol(T, Decl(a.js, 0, 0)) +>T : Symbol(T, Decl(a.js, 6, 13)) */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff index ac2a205e82..4ab7ad7f94 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff @@ -4,7 +4,7 @@ /** * @template const T * @typedef {[T]} X -+>T : Symbol(T, Decl(a.js, 0, 0)) ++>T : Symbol(T, Decl(a.js, 6, 13)) + */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt index 217f2360ef..3e6ab1d570 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt @@ -1,8 +1,8 @@ file.js(3,15): error TS2304: Cannot find name 'T'. +file.js(33,14): error TS2706: Required type parameters may not follow optional type parameters. file.js(38,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. file.js(45,17): error TS2304: Cannot find name 'T'. -file.js(49,21): error TS2706: Required type parameters may not follow optional type parameters. -file.js(57,1): error TS2706: Required type parameters may not follow optional type parameters. +file.js(53,14): error TS2706: Required type parameters may not follow optional type parameters. file.js(60,17): error TS2304: Cannot find name 'U'. file.js(61,17): error TS2304: Cannot find name 'T'. @@ -43,6 +43,8 @@ file.js(61,17): error TS2304: Cannot find name 'T'. /** * @template {string | number} [T=string] * @template U - error: Required type parameters cannot follow optional type parameters + ~ +!!! error TS2706: Required type parameters may not follow optional type parameters. * @typedef {[T, U]} E */ @@ -63,18 +65,16 @@ file.js(61,17): error TS2304: Cannot find name 'T'. * @param {U} b */ function f1(a, b) {} - -!!! error TS2706: Required type parameters may not follow optional type parameters. /** * @template {string | number} [T=string] * @template U - error: Required type parameters cannot follow optional type parameters + ~ +!!! error TS2706: Required type parameters may not follow optional type parameters. * @param {T} a * @param {U} b */ function f2(a, b) {} - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2706: Required type parameters may not follow optional type parameters. /** * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols index 897ba41cdf..34cb3c6184 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols @@ -28,25 +28,25 @@ const aNumber = [0]; * @template T * @template [U=T] - ok: default can reference earlier type parameter * @typedef {[T, U]} B ->B : Symbol(B, Decl(file.js, 48, 20)) ->T : Symbol(T, Decl(file.js, 48, 20)) ->U : Symbol(U, Decl(file.js, 48, 20)) +>B : Symbol(B, Decl(file.js, 17, 3)) +>T : Symbol(T, Decl(file.js, 15, 13)) +>U : Symbol(U, Decl(file.js, 16, 13)) */ /** * @template {string | number} [T] - error: default requires an `=type` * @typedef {[T]} C ->C : Symbol(C, Decl(file.js, 48, 20)) ->T : Symbol(T, Decl(file.js, 48, 20)) +>C : Symbol(C, Decl(file.js, 22, 3)) +>T : Symbol(T, Decl(file.js, 21, 31)) */ /** * @template {string | number} [T=] - error: default requires a `type` * @typedef {[T]} D ->D : Symbol(D, Decl(file.js, 48, 20)) ->T : Symbol(T, Decl(file.js, 48, 20)) +>D : Symbol(D, Decl(file.js, 27, 3)) +>T : Symbol(T, Decl(file.js, 26, 31)) */ @@ -54,9 +54,9 @@ const aNumber = [0]; * @template {string | number} [T=string] * @template U - error: Required type parameters cannot follow optional type parameters * @typedef {[T, U]} E ->E : Symbol(E, Decl(file.js, 48, 20)) ->T : Symbol(T, Decl(file.js, 48, 20)) ->U : Symbol(U, Decl(file.js, 48, 20)) +>E : Symbol(E, Decl(file.js, 33, 3)) +>T : Symbol(T, Decl(file.js, 31, 31)) +>U : Symbol(U, Decl(file.js, 32, 13)) */ @@ -64,9 +64,9 @@ const aNumber = [0]; * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. * @template [U=T] * @typedef {[T, U]} G ->G : Symbol(G, Decl(file.js, 48, 20)) ->T : Symbol(T, Decl(file.js, 48, 20)) ->U : Symbol(U, Decl(file.js, 48, 20)) +>G : Symbol(G, Decl(file.js, 39, 3)) +>T : Symbol(T, Decl(file.js, 37, 13)) +>U : Symbol(U, Decl(file.js, 38, 13)) */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff index 0e09ce59fe..8704cd6af0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff @@ -13,25 +13,25 @@ * @template T * @template [U=T] - ok: default can reference earlier type parameter * @typedef {[T, U]} B -+>B : Symbol(B, Decl(file.js, 48, 20)) -+>T : Symbol(T, Decl(file.js, 48, 20)) -+>U : Symbol(U, Decl(file.js, 48, 20)) ++>B : Symbol(B, Decl(file.js, 17, 3)) ++>T : Symbol(T, Decl(file.js, 15, 13)) ++>U : Symbol(U, Decl(file.js, 16, 13)) + */ /** * @template {string | number} [T] - error: default requires an `=type` * @typedef {[T]} C -+>C : Symbol(C, Decl(file.js, 48, 20)) -+>T : Symbol(T, Decl(file.js, 48, 20)) ++>C : Symbol(C, Decl(file.js, 22, 3)) ++>T : Symbol(T, Decl(file.js, 21, 31)) + */ /** * @template {string | number} [T=] - error: default requires a `type` * @typedef {[T]} D -+>D : Symbol(D, Decl(file.js, 48, 20)) -+>T : Symbol(T, Decl(file.js, 48, 20)) ++>D : Symbol(D, Decl(file.js, 27, 3)) ++>T : Symbol(T, Decl(file.js, 26, 31)) + */ @@ -39,9 +39,9 @@ * @template {string | number} [T=string] * @template U - error: Required type parameters cannot follow optional type parameters * @typedef {[T, U]} E -+>E : Symbol(E, Decl(file.js, 48, 20)) -+>T : Symbol(T, Decl(file.js, 48, 20)) -+>U : Symbol(U, Decl(file.js, 48, 20)) ++>E : Symbol(E, Decl(file.js, 33, 3)) ++>T : Symbol(T, Decl(file.js, 31, 31)) ++>U : Symbol(U, Decl(file.js, 32, 13)) + */ @@ -49,9 +49,9 @@ * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. * @template [U=T] * @typedef {[T, U]} G -+>G : Symbol(G, Decl(file.js, 48, 20)) -+>T : Symbol(T, Decl(file.js, 48, 20)) -+>U : Symbol(U, Decl(file.js, 48, 20)) ++>G : Symbol(G, Decl(file.js, 39, 3)) ++>T : Symbol(T, Decl(file.js, 37, 13)) ++>U : Symbol(U, Decl(file.js, 38, 13)) + */ diff --git a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols index 44627e7d25..789cb1695a 100644 --- a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols +++ b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols @@ -9,22 +9,22 @@ declare namespace NS { } === linkTagEmit1.js === /** @typedef {number} N */ ->N : Symbol(N, Decl(linkTagEmit1.js, 14, 1)) +>N : Symbol(N, Decl(linkTagEmit1.js, 0, 4)) /** * @typedef {Object} D1 ->D1 : Symbol(D1, Decl(linkTagEmit1.js, 14, 1)) +>D1 : Symbol(D1, Decl(linkTagEmit1.js, 2, 3)) * @property {1} e Just link to {@link NS.R} this time ->e : Symbol(e, Decl(linkTagEmit1.js, 14, 1)) +>e : Symbol(e, Decl(linkTagEmit1.js, 3, 3)) * @property {1} m Wyatt Earp loved {@link N integers} I bet. ->m : Symbol(m, Decl(linkTagEmit1.js, 14, 1)) +>m : Symbol(m, Decl(linkTagEmit1.js, 4, 3)) */ /** @typedef {number} Z @see N {@link N} */ ->Z : Symbol(Z, Decl(linkTagEmit1.js, 14, 1)) +>Z : Symbol(Z, Decl(linkTagEmit1.js, 7, 4)) /** * @param {number} integer {@link Z} diff --git a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols.diff b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols.diff index aa124be68a..ee2cf90c29 100644 --- a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols.diff @@ -4,22 +4,22 @@ } === linkTagEmit1.js === /** @typedef {number} N */ -+>N : Symbol(N, Decl(linkTagEmit1.js, 14, 1)) ++>N : Symbol(N, Decl(linkTagEmit1.js, 0, 4)) + /** * @typedef {Object} D1 -+>D1 : Symbol(D1, Decl(linkTagEmit1.js, 14, 1)) ++>D1 : Symbol(D1, Decl(linkTagEmit1.js, 2, 3)) + * @property {1} e Just link to {@link NS.R} this time -+>e : Symbol(e, Decl(linkTagEmit1.js, 14, 1)) ++>e : Symbol(e, Decl(linkTagEmit1.js, 3, 3)) + * @property {1} m Wyatt Earp loved {@link N integers} I bet. -+>m : Symbol(m, Decl(linkTagEmit1.js, 14, 1)) ++>m : Symbol(m, Decl(linkTagEmit1.js, 4, 3)) + */ /** @typedef {number} Z @see N {@link N} */ -+>Z : Symbol(Z, Decl(linkTagEmit1.js, 14, 1)) ++>Z : Symbol(Z, Decl(linkTagEmit1.js, 7, 4)) /** * @param {number} integer {@link Z} diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols index 558400d848..318be9ed2b 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols @@ -116,7 +116,7 @@ function types( f: import('./mod').buz, >f : Symbol(f, Decl(index.ts, 5, 27)) ->buz : Symbol(buz, Decl(mod.js, 12, 1)) +>buz : Symbol(buz, Decl(mod.js, 4, 4)) g: import('./mod').literal, >g : Symbol(g, Decl(index.ts, 6, 27)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff index 5c1793231e..cf0b78e146 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff @@ -65,16 +65,7 @@ } === index.ts === -@@= skipped -36, +30 lines =@@ - - f: import('./mod').buz, - >f : Symbol(f, Decl(index.ts, 5, 27)) -->buz : Symbol(buz, Decl(mod.js, 4, 4)) -+>buz : Symbol(buz, Decl(mod.js, 12, 1)) - - g: import('./mod').literal, - >g : Symbol(g, Decl(index.ts, 6, 27)) -@@= skipped -21, +21 lines =@@ +@@= skipped -57, +51 lines =@@ a: typeof import('./mod').Thing, >a : Symbol(a, Decl(index.ts, 12, 16)) diff --git a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols index f404fbce17..0b79027f14 100644 --- a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols +++ b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols @@ -3,10 +3,10 @@ === /a.js === /** * @typedef Foo ->Foo : Symbol(Foo, Decl(a.js, 8, 26)) +>Foo : Symbol(Foo, Decl(a.js, 1, 3)) * @property {string} a ->a : Symbol(a, Decl(a.js, 8, 26)) +>a : Symbol(a, Decl(a.js, 2, 3)) */ diff --git a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols.diff b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols.diff index 316f1b59e1..51c8fc1ae6 100644 --- a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols.diff @@ -4,10 +4,10 @@ === /a.js === /** * @typedef Foo -+>Foo : Symbol(Foo, Decl(a.js, 8, 26)) ++>Foo : Symbol(Foo, Decl(a.js, 1, 3)) + * @property {string} a -+>a : Symbol(a, Decl(a.js, 8, 26)) ++>a : Symbol(a, Decl(a.js, 2, 3)) + */ diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols index 5bf80899b6..dfd24249e5 100644 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols @@ -3,15 +3,15 @@ === bug39372.js === /** @typedef {ReadonlyArray} JsonArray */ >ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --)) ->Json : Symbol(Json, Decl(bug39372.js, 24, 13)) +>Json : Symbol(Json, Decl(bug39372.js, 2, 4)) /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ >key : Symbol(key, Decl(bug39372.js, 1, 26)) ->Json : Symbol(Json, Decl(bug39372.js, 24, 13)) +>Json : Symbol(Json, Decl(bug39372.js, 2, 4)) /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ ->JsonRecord : Symbol(JsonRecord, Decl(bug39372.js, 24, 13)) ->JsonArray : Symbol(JsonArray, Decl(bug39372.js, 24, 13)) +>JsonRecord : Symbol(JsonRecord, Decl(bug39372.js, 1, 4)) +>JsonArray : Symbol(JsonArray, Decl(bug39372.js, 0, 4)) /** * @template T @@ -22,7 +22,7 @@ [K in keyof T]?: XMLObject[] >K : Symbol(K, Decl(bug39372.js, 8, 5)) >T : Symbol(T) ->XMLObject : Symbol(XMLObject, Decl(bug39372.js, 24, 13)) +>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 6, 3)) >T : Symbol(T) >K : Symbol(K, Decl(bug39372.js, 8, 5)) @@ -42,7 +42,7 @@ >T : Symbol(T) >K : Symbol(K, Decl(bug39372.js, 11, 5)) >$ : Symbol($, Decl(bug39372.js, 13, 32)) ->XMLObject : Symbol(XMLObject, Decl(bug39372.js, 24, 13)) +>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 6, 3)) >T : Symbol(T) >K : Symbol(K, Decl(bug39372.js, 11, 5)) @@ -61,7 +61,7 @@ >K : Symbol(K, Decl(bug39372.js, 17, 3)) : XMLObject ->XMLObject : Symbol(XMLObject, Decl(bug39372.js, 24, 13)) +>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 6, 3)) >T : Symbol(T) >K : Symbol(K, Decl(bug39372.js, 17, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff index e07255cdb2..583b8ecb8a 100644 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff @@ -5,15 +5,15 @@ === bug39372.js === /** @typedef {ReadonlyArray} JsonArray */ +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --)) -+>Json : Symbol(Json, Decl(bug39372.js, 24, 13)) ++>Json : Symbol(Json, Decl(bug39372.js, 2, 4)) + /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ +>key : Symbol(key, Decl(bug39372.js, 1, 26)) -+>Json : Symbol(Json, Decl(bug39372.js, 24, 13)) ++>Json : Symbol(Json, Decl(bug39372.js, 2, 4)) + /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ -+>JsonRecord : Symbol(JsonRecord, Decl(bug39372.js, 24, 13)) -+>JsonArray : Symbol(JsonArray, Decl(bug39372.js, 24, 13)) ++>JsonRecord : Symbol(JsonRecord, Decl(bug39372.js, 1, 4)) ++>JsonArray : Symbol(JsonArray, Decl(bug39372.js, 0, 4)) /** * @template T @@ -24,7 +24,7 @@ [K in keyof T]?: XMLObject[] +>K : Symbol(K, Decl(bug39372.js, 8, 5)) +>T : Symbol(T) -+>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 24, 13)) ++>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 6, 3)) +>T : Symbol(T) +>K : Symbol(K, Decl(bug39372.js, 8, 5)) + @@ -44,7 +44,7 @@ +>T : Symbol(T) +>K : Symbol(K, Decl(bug39372.js, 11, 5)) +>$ : Symbol($, Decl(bug39372.js, 13, 32)) -+>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 24, 13)) ++>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 6, 3)) +>T : Symbol(T) +>K : Symbol(K, Decl(bug39372.js, 11, 5)) + @@ -63,7 +63,7 @@ +>K : Symbol(K, Decl(bug39372.js, 17, 3)) + : XMLObject -+>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 24, 13)) ++>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 6, 3)) +>T : Symbol(T) +>K : Symbol(K, Decl(bug39372.js, 17, 3)) + diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols index a961128c84..6e8e4c6176 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols @@ -24,10 +24,10 @@ const identity = x => x; /** * @typedef Nested ->Nested : Symbol(Nested, Decl(templateInsideCallback.js, 53, 1)) +>Nested : Symbol(Nested, Decl(templateInsideCallback.js, 19, 3)) * @property {Object} oh ->oh : Symbol(oh, Decl(templateInsideCallback.js, 53, 1)) +>oh : Symbol(oh, Decl(templateInsideCallback.js, 20, 3)) * @property {number} oh.no * @template T diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff index e5ca168a18..14c0dfa290 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff @@ -4,10 +4,10 @@ /** * @typedef Nested -+>Nested : Symbol(Nested, Decl(templateInsideCallback.js, 53, 1)) ++>Nested : Symbol(Nested, Decl(templateInsideCallback.js, 19, 3)) + * @property {Object} oh -+>oh : Symbol(oh, Decl(templateInsideCallback.js, 53, 1)) ++>oh : Symbol(oh, Decl(templateInsideCallback.js, 20, 3)) + * @property {number} oh.no * @template T diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols index c9a011a4e0..1c91c05ffe 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols @@ -3,7 +3,7 @@ === typeTagOnFunctionReferencesGeneric.js === /** * @typedef {(m : T) => T} IFn ->IFn : Symbol(IFn, Decl(typeTagOnFunctionReferencesGeneric.js, 7, 1)) +>IFn : Symbol(IFn, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 3)) >T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) >m : Symbol(m, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 17)) >T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff index 19d91b2e52..c8d1067a80 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff @@ -4,7 +4,7 @@ === typeTagOnFunctionReferencesGeneric.js === /** * @typedef {(m : T) => T} IFn -+>IFn : Symbol(IFn, Decl(typeTagOnFunctionReferencesGeneric.js, 7, 1)) ++>IFn : Symbol(IFn, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 3)) +>T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) +>m : Symbol(m, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 17)) +>T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols index 0f2bc0d78c..b6827b632e 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols @@ -16,8 +16,8 @@ declare var module: { exports: any}; >y : Symbol(y, Decl(mod1.js, 2, 26)) /** @typedef {A | B} Both */ ->A : Symbol(A, Decl(mod1.js, 4, 18)) ->B : Symbol(B, Decl(mod1.js, 4, 18)) +>A : Symbol(A, Decl(mod1.js, 1, 4)) +>B : Symbol(B, Decl(mod1.js, 2, 4)) module.exports = C >module.exports : Symbol(exports, Decl(commonjs.d.ts, 0, 21)) @@ -34,19 +34,19 @@ function C() { === mod2.js === /// /** @typedef {{ type: "a", x: 1 }} A */ ->A : Symbol(A, Decl(mod2.js, 7, 1)) +>A : Symbol(A, Decl(mod2.js, 1, 4)) >type : Symbol(type, Decl(mod2.js, 1, 15)) >x : Symbol(x, Decl(mod2.js, 1, 26)) /** @typedef {{ type: "b", y: 1 }} B */ ->B : Symbol(B, Decl(mod2.js, 7, 1)) +>B : Symbol(B, Decl(mod2.js, 2, 4)) >type : Symbol(type, Decl(mod2.js, 2, 15)) >y : Symbol(y, Decl(mod2.js, 2, 26)) /** @typedef {A | B} Both */ ->Both : Symbol(Both, Decl(mod2.js, 7, 1)) ->A : Symbol(A, Decl(mod2.js, 7, 1)) ->B : Symbol(B, Decl(mod2.js, 7, 1)) +>Both : Symbol(Both, Decl(mod2.js, 3, 4)) +>A : Symbol(A, Decl(mod2.js, 1, 4)) +>B : Symbol(B, Decl(mod2.js, 2, 4)) export function C() { >C : Symbol(C, Decl(mod2.js, 0, 0)) @@ -65,8 +65,8 @@ export function C() { >y : Symbol(y, Decl(mod3.js, 2, 26)) /** @typedef {A | B} Both */ ->A : Symbol(A, Decl(mod3.js, 7, 1)) ->B : Symbol(B, Decl(mod3.js, 7, 1)) +>A : Symbol(A, Decl(mod3.js, 1, 4)) +>B : Symbol(B, Decl(mod3.js, 2, 4)) exports.C = function() { this.p = 1 diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff index 7552df24bd..753887e3f3 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff @@ -12,8 +12,8 @@ +>y : Symbol(y, Decl(mod1.js, 2, 26)) + /** @typedef {A | B} Both */ -+>A : Symbol(A, Decl(mod1.js, 4, 18)) -+>B : Symbol(B, Decl(mod1.js, 4, 18)) ++>A : Symbol(A, Decl(mod1.js, 1, 4)) ++>B : Symbol(B, Decl(mod1.js, 2, 4)) + module.exports = C ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) @@ -36,19 +36,19 @@ === mod2.js === /// /** @typedef {{ type: "a", x: 1 }} A */ -+>A : Symbol(A, Decl(mod2.js, 7, 1)) ++>A : Symbol(A, Decl(mod2.js, 1, 4)) +>type : Symbol(type, Decl(mod2.js, 1, 15)) +>x : Symbol(x, Decl(mod2.js, 1, 26)) + /** @typedef {{ type: "b", y: 1 }} B */ -+>B : Symbol(B, Decl(mod2.js, 7, 1)) ++>B : Symbol(B, Decl(mod2.js, 2, 4)) +>type : Symbol(type, Decl(mod2.js, 2, 15)) +>y : Symbol(y, Decl(mod2.js, 2, 26)) + /** @typedef {A | B} Both */ -+>Both : Symbol(Both, Decl(mod2.js, 7, 1)) -+>A : Symbol(A, Decl(mod2.js, 7, 1)) -+>B : Symbol(B, Decl(mod2.js, 7, 1)) ++>Both : Symbol(Both, Decl(mod2.js, 3, 4)) ++>A : Symbol(A, Decl(mod2.js, 1, 4)) ++>B : Symbol(B, Decl(mod2.js, 2, 4)) export function C() { >C : Symbol(C, Decl(mod2.js, 0, 0)) @@ -70,8 +70,8 @@ +>y : Symbol(y, Decl(mod3.js, 2, 26)) + /** @typedef {A | B} Both */ -+>A : Symbol(A, Decl(mod3.js, 7, 1)) -+>B : Symbol(B, Decl(mod3.js, 7, 1)) ++>A : Symbol(A, Decl(mod3.js, 1, 4)) ++>B : Symbol(B, Decl(mod3.js, 2, 4)) exports.C = function() { ->exports.C : Symbol(C, Decl(mod3.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols index 9194502e53..f8731a1ce0 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols @@ -6,7 +6,7 @@ class C { /** * @typedef {C~A} C~B ->C : Symbol(C, Decl(bug25104.js, 7, 5)) +>C : Symbol(C, Decl(bug25104.js, 3, 7)) * @typedef {object} C~A */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff index 1c716492f9..23fd3af66a 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff @@ -4,7 +4,7 @@ /** * @typedef {C~A} C~B -+>C : Symbol(C, Decl(bug25104.js, 7, 5)) ++>C : Symbol(C, Decl(bug25104.js, 3, 7)) + * @typedef {object} C~A */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols index f5ce0d08e3..5540ff6d2b 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols @@ -57,17 +57,17 @@ var sala = { name: 'uppsala', not: 0, nested: "ok" }; >nested : Symbol(nested, Decl(a.js, 35, 37)) sala.name ->sala.name : Symbol(name, Decl(a.js, 35, 53)) +>sala.name : Symbol(name, Decl(a.js, 29, 3)) >sala : Symbol(sala, Decl(a.js, 35, 3)) ->name : Symbol(name, Decl(a.js, 35, 53)) +>name : Symbol(name, Decl(a.js, 29, 3)) sala.not ->sala.not : Symbol(not, Decl(a.js, 35, 53)) +>sala.not : Symbol(not, Decl(a.js, 30, 3)) >sala : Symbol(sala, Decl(a.js, 35, 3)) ->not : Symbol(not, Decl(a.js, 35, 53)) +>not : Symbol(not, Decl(a.js, 30, 3)) sala.nested ->sala.nested : Symbol(nested, Decl(a.js, 35, 53)) +>sala.nested : Symbol(nested, Decl(a.js, 31, 3)) >sala : Symbol(sala, Decl(a.js, 35, 3)) ->nested : Symbol(nested, Decl(a.js, 35, 53)) +>nested : Symbol(nested, Decl(a.js, 31, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff index 9a4ab0ea33..24027037a7 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff @@ -9,27 +9,3 @@ * @property {string} nested */ -@@= skipped -11, +13 lines =@@ - >nested : Symbol(nested, Decl(a.js, 35, 37)) - - sala.name -->sala.name : Symbol(name, Decl(a.js, 29, 3)) -+>sala.name : Symbol(name, Decl(a.js, 35, 53)) - >sala : Symbol(sala, Decl(a.js, 35, 3)) -->name : Symbol(name, Decl(a.js, 29, 3)) -+>name : Symbol(name, Decl(a.js, 35, 53)) - - sala.not -->sala.not : Symbol(not, Decl(a.js, 30, 3)) -+>sala.not : Symbol(not, Decl(a.js, 35, 53)) - >sala : Symbol(sala, Decl(a.js, 35, 3)) -->not : Symbol(not, Decl(a.js, 30, 3)) -+>not : Symbol(not, Decl(a.js, 35, 53)) - - sala.nested -->sala.nested : Symbol(nested, Decl(a.js, 31, 3)) -+>sala.nested : Symbol(nested, Decl(a.js, 35, 53)) - >sala : Symbol(sala, Decl(a.js, 35, 3)) -->nested : Symbol(nested, Decl(a.js, 31, 3)) -+>nested : Symbol(nested, Decl(a.js, 35, 53)) - diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols index 3edf1c0f5c..c30683a460 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols @@ -3,7 +3,7 @@ === github20832.js === // #20832 /** @typedef {U} T - should be "error, can't find type named 'U' */ ->T : Symbol(T, Decl(github20832.js, 9, 1)) +>T : Symbol(T, Decl(github20832.js, 1, 4)) >U : Symbol(U) /** diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff index 61fd07da00..97ad80965f 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff @@ -4,7 +4,7 @@ === github20832.js === // #20832 /** @typedef {U} T - should be "error, can't find type named 'U' */ -+>T : Symbol(T, Decl(github20832.js, 9, 1)) ++>T : Symbol(T, Decl(github20832.js, 1, 4)) +>U : Symbol(U) + /** diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols index 6cc5f9d19b..9eaee970ec 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols @@ -3,7 +3,7 @@ === mod1.js === /** * @typedef {function(string): boolean} -> : Symbol(, Decl(mod1.js, 14, 1)) +> : Symbol(, Decl(mod1.js, 1, 3)) >function : Symbol(function) * Type1 @@ -33,7 +33,7 @@ function callIt(func, arg) { * str: string, * boo: boolean * }} Type2 ->Type2 : Symbol(Type2, Decl(mod2.js, 15, 1)) +>Type2 : Symbol(Type2, Decl(mod2.js, 1, 3)) */ @@ -63,7 +63,7 @@ function check(obj) { * A function whose signature is very long. * * @typedef {function(boolean, string, number): -> : Symbol(, Decl(mod3.js, 17, 1)) +> : Symbol(, Decl(mod3.js, 3, 3)) >function : Symbol(function) * (string|number)} StringOrNumber1 @@ -96,7 +96,7 @@ function use1(func, bool, str, num) { * A function whose signature is very long. * * @typedef {function(boolean, string, -> : Symbol(, Decl(mod4.js, 18, 1)) +> : Symbol(, Decl(mod4.js, 3, 3)) >function : Symbol(function) * number): @@ -135,7 +135,7 @@ function use2(func, bool, str, num) { * boo: * boolean * }} Type5 ->Type5 : Symbol(Type5, Decl(mod5.js, 18, 1)) +>Type5 : Symbol(Type5, Decl(mod5.js, 1, 3)) */ @@ -168,7 +168,7 @@ function check5(obj) { * bar: * * * }} Type6 ->Type6 : Symbol(Type6, Decl(mod6.js, 16, 1)) +>Type6 : Symbol(Type6, Decl(mod6.js, 1, 3)) */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff index 627c12d3da..879893b7a7 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff @@ -4,7 +4,7 @@ === mod1.js === /** * @typedef {function(string): boolean} -+> : Symbol(, Decl(mod1.js, 14, 1)) ++> : Symbol(, Decl(mod1.js, 1, 3)) +>function : Symbol(function) + * Type1 @@ -14,7 +14,7 @@ * str: string, * boo: boolean * }} Type2 -+>Type2 : Symbol(Type2, Decl(mod2.js, 15, 1)) ++>Type2 : Symbol(Type2, Decl(mod2.js, 1, 3)) + */ @@ -23,7 +23,7 @@ * A function whose signature is very long. * * @typedef {function(boolean, string, number): -+> : Symbol(, Decl(mod3.js, 17, 1)) ++> : Symbol(, Decl(mod3.js, 3, 3)) +>function : Symbol(function) + * (string|number)} StringOrNumber1 @@ -33,7 +33,7 @@ * A function whose signature is very long. * * @typedef {function(boolean, string, -+> : Symbol(, Decl(mod4.js, 18, 1)) ++> : Symbol(, Decl(mod4.js, 3, 3)) +>function : Symbol(function) + * number): @@ -43,7 +43,7 @@ * boo: * boolean * }} Type5 -+>Type5 : Symbol(Type5, Decl(mod5.js, 18, 1)) ++>Type5 : Symbol(Type5, Decl(mod5.js, 1, 3)) + */ @@ -52,7 +52,7 @@ * bar: * * * }} Type6 -+>Type6 : Symbol(Type6, Decl(mod6.js, 16, 1)) ++>Type6 : Symbol(Type6, Decl(mod6.js, 1, 3)) + */ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocIllegalTags.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocIllegalTags.errors.txt.diff index 83cfa52421..a19b5cc0ae 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocIllegalTags.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocIllegalTags.errors.txt.diff @@ -2,7 +2,7 @@ +++ new.jsdocIllegalTags.errors.txt @@= skipped -0, +0 lines =@@ -/a.js(2,19): error TS1092: Type parameters cannot appear on a constructor declaration. -+/a.js(3,5): error TS1092: Type parameters cannot appear on a constructor declaration. ++/a.js(2,9): error TS1092: Type parameters cannot appear on a constructor declaration. /a.js(6,18): error TS1093: Type annotation cannot appear on a constructor declaration. @@ -10,10 +10,7 @@ class C { /** @template T */ - ~ --!!! error TS1092: Type parameters cannot appear on a constructor declaration. ++ ~~~~~~~~~~~~ + !!! error TS1092: Type parameters cannot appear on a constructor declaration. constructor() { } -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS1092: Type parameters cannot appear on a constructor declaration. } - class D { - /** @return {number} */ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag.errors.txt.diff index 3f50c11b6e..0c8b74d1d4 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag.errors.txt.diff @@ -2,14 +2,14 @@ +++ new.unusedTypeParameters_templateTag.errors.txt @@= skipped -0, +0 lines =@@ -/a.js(1,5): error TS6133: 'T' is declared but its value is never read. -+/a.js(2,1): error TS6196: 'T' is declared but never used. ++/a.js(1,15): error TS6196: 'T' is declared but never used. ==== /a.js (1 errors) ==== /** @template T */ - ~~~~~~~~~~~~ -!!! error TS6133: 'T' is declared but its value is never read. - function f() {} -+ ~~~~~~~~~~~~~~~ ++ ~ +!!! error TS6196: 'T' is declared but never used. + function f() {} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag2.errors.txt.diff index 41fbdf9f5e..fd58898148 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/unusedTypeParameters_templateTag2.errors.txt.diff @@ -5,94 +5,62 @@ -/a.js(13,4): error TS6205: All type parameters are unused. -/a.js(20,16): error TS6133: 'V' is declared but its value is never read. -/a.js(20,18): error TS6133: 'X' is declared but its value is never read. -+/a.js(1,1): error TS6205: All type parameters are unused. ++/a.js(2,3): error TS6205: All type parameters are unused. +/a.js(8,14): error TS2339: Property 'p' does not exist on type 'C1'. -+/a.js(10,1): error TS6205: All type parameters are unused. -+/a.js(17,1): error TS6205: All type parameters are unused. ++/a.js(13,3): error TS6205: All type parameters are unused. ++/a.js(20,3): error TS6205: All type parameters are unused. +/a.js(25,14): error TS2339: Property 'p' does not exist on type 'C3'. -==== /a.js (4 errors) ==== +==== /a.js (5 errors) ==== /** -+ ~~~ * @template T -+ ~~~~~~~~~~~~~~ ++ ~~~~~~~~~~~~ * @template V - ~~~~~~~~~~~ + ~~~~~~~~~~~~~~ */ - ~ -!!! error TS6133: 'V' is declared but its value is never read. -+ ~~~ ++ ~~ ++!!! error TS6205: All type parameters are unused. class C1 { -+ ~~~~~~~~~~ constructor() { -+ ~~~~~~~~~~~~~~~~~~~ /** @type {T} */ -+ ~~~~~~~~~~~~~~~~~~~~~~~~ this.p; -+ ~~~~~~~~~~~~~~~ + ~ +!!! error TS2339: Property 'p' does not exist on type 'C1'. } -+ ~~~~~ } -+ ~ -+ ~ -+ -+ /** -+ ~~~ -+ ~~~ * @template T,V - ~~~~~~~~~~~~~ -+ ~~~~~~~~~~~~~~~~ -+ ~~~~~~~~~~~~~~~~ ++ ~~~~~~~~~~~~~~ */ -+ ~~~ -+ ~~~ -+ class C2 { - ~ +- ~ ++ ~~ !!! error TS6205: All type parameters are unused. -- class C2 { -+ ~~~~~~~~~~ + class C2 { constructor() { } -+ ~~~~~~~~~~~~~~~~~~~~~ - } -+ ~ -+ ~ +@@= skipped -30, +34 lines =@@ -+ -+ /** -+ ~~~ -+ ~~~ * @template T,V,X - ~ -!!! error TS6133: 'V' is declared but its value is never read. - ~ -!!! error TS6133: 'X' is declared but its value is never read. -+ ~~~~~~~~~~~~~~~~~~ -+ ~~~~~~~~~~~~~~~~~~ ++ ~~~~~~~~~~~~~~~~ */ -+ ~~~ -+ ~~~ - class C3 { -+ ~ ++ ~~ +!!! error TS6205: All type parameters are unused. -+ ~~~~~~~~~~ + class C3 { constructor() { -+ ~~~~~~~~~~~~~~~~~~~ /** @type {T} */ -+ ~~~~~~~~~~~~~~~~~~~~~~~~ this.p; -+ ~~~~~~~~~~~~~~~ + ~ +!!! error TS2339: Property 'p' does not exist on type 'C3'. } -+ ~~~~~ } -+ ~ -+!!! error TS6205: All type parameters are unused. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff index 24d6542318..d1d0f17779 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.errors.txt.diff @@ -3,9 +3,9 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+0.js(15,5): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': w, y, z ++0.js(15,5): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': y, z, w +0.js(28,6): error TS2741: Property 'anotherY' is missing in type '{ anotherX: string; }' but required in type 'AnotherOpts'. -+0.js(42,6): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': w, y, z ++0.js(42,6): error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': y, z, w + + +==== 0.js (3 errors) ==== @@ -25,7 +25,7 @@ + + foo({x: 'abc'}); + ~~~~~~~~~~ -+!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': w, y, z ++!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts': y, z, w + + /** + * @typedef {Object} AnotherOpts @@ -57,5 +57,5 @@ + } + foo2({x: 'abc'}); + ~~~~~~~~~~ -+!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': w, y, z ++!!! error TS2739: Type '{ x: string; }' is missing the following properties from type 'Opts1': y, z, w + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff index ec14f86377..e636f4616c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff @@ -4,14 +4,12 @@ -file.js(9,20): error TS2322: Type 'number' is not assignable to type 'string'. -file.js(22,34): error TS1005: '=' expected. -file.js(27,35): error TS1110: Type expected. --file.js(33,14): error TS2706: Required type parameters may not follow optional type parameters. +file.js(3,15): error TS2304: Cannot find name 'T'. + file.js(33,14): error TS2706: Required type parameters may not follow optional type parameters. file.js(38,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. --file.js(53,14): error TS2706: Required type parameters may not follow optional type parameters. --file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. +file.js(45,17): error TS2304: Cannot find name 'T'. -+file.js(49,21): error TS2706: Required type parameters may not follow optional type parameters. -+file.js(57,1): error TS2706: Required type parameters may not follow optional type parameters. + file.js(53,14): error TS2706: Required type parameters may not follow optional type parameters. +-file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. +file.js(60,17): error TS2304: Cannot find name 'U'. +file.js(61,17): error TS2304: Cannot find name 'T'. @@ -49,15 +47,7 @@ * @typedef {[T]} D */ - /** - * @template {string | number} [T=string] - * @template U - error: Required type parameters cannot follow optional type parameters -- ~ --!!! error TS2706: Required type parameters may not follow optional type parameters. - * @typedef {[T, U]} E - */ - -@@= skipped -31, +25 lines =@@ +@@= skipped -31, +27 lines =@@ /** * @template T * @template [U=T] - ok: default can reference earlier type parameter @@ -66,22 +56,7 @@ * @param {T} a * @param {U} b */ - function f1(a, b) {} -+ -+!!! error TS2706: Required type parameters may not follow optional type parameters. - - /** - * @template {string | number} [T=string] - * @template U - error: Required type parameters cannot follow optional type parameters -- ~ --!!! error TS2706: Required type parameters may not follow optional type parameters. - * @param {T} a - * @param {U} b - */ - function f2(a, b) {} -+ ~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2706: Required type parameters may not follow optional type parameters. - +@@= skipped -18, +20 lines =@@ /** * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. ~ From 8e71486af4676b33a378cb48de55bdea9bf915ce Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 3 Apr 2025 12:01:20 -0700 Subject: [PATCH 21/25] remove now-unneeded check in rangeOfTypeParameters --- internal/checker/utilities.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/checker/utilities.go b/internal/checker/utilities.go index 63794cf430..f76728d5c8 100644 --- a/internal/checker/utilities.go +++ b/internal/checker/utilities.go @@ -2093,7 +2093,7 @@ var getFeatureMap = sync.OnceValue(func() map[string][]FeatureMapEntry { }) func rangeOfTypeParameters(sourceFile *ast.SourceFile, typeParameters *ast.NodeList) core.TextRange { - return core.NewTextRange(max(0, typeParameters.Pos()-1), min(len(sourceFile.Text), scanner.SkipTrivia(sourceFile.Text, typeParameters.End())+1)) + return core.NewTextRange(typeParameters.Pos()-1, min(len(sourceFile.Text), scanner.SkipTrivia(sourceFile.Text, typeParameters.End())+1)) } func tryGetPropertyAccessOrIdentifierToString(expr *ast.Node) string { From c7ae38420919333aa150a76c9821efa11970e0af Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 3 Apr 2025 14:00:21 -0700 Subject: [PATCH 22/25] hereby format --- internal/parser/jsdoc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index 1698941b9c..f9e3d40105 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -210,7 +210,7 @@ func (p *Parser) gatherTypeParameters(j *ast.Node) *ast.NodeList { first = false } end = tag.End() - + constraint := tag.AsJSDocTemplateTag().Constraint for _, tp := range tag.AsJSDocTemplateTag().TypeParameters().Nodes { typeParameter := tp.AsTypeParameter() From 7af2df555ca94af5083298878c66642ef6104e3e Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 7 Apr 2025 10:38:02 -0700 Subject: [PATCH 23/25] update tests after merge --- .../conformance/es2022SharedMemory.errors.txt | 26 ++++ .../es2022SharedMemory.errors.txt.diff | 31 +++++ .../conformance/es2022SharedMemory.symbols | 66 +++++++++ .../es2022SharedMemory.symbols.diff | 59 +++++++++ .../conformance/es2022SharedMemory.types | 94 +++++++++++++ .../conformance/es2022SharedMemory.types.diff | 77 +++++++++++ .../jsDeclarationsReactComponents.errors.txt | 120 ----------------- .../jsDeclarationsReactComponents.symbols | 2 + ...jsDeclarationsReactComponents.symbols.diff | 4 +- .../jsDeclarationsReactComponents.types | 10 +- ...eclarationsReactComponents.errors.txt.diff | 125 ------------------ .../jsDeclarationsReactComponents.types.diff | 18 +-- 12 files changed, 370 insertions(+), 262 deletions(-) create mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols create mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols.diff create mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types create mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.errors.txt.diff diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt new file mode 100644 index 0000000000..ee76b11975 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt @@ -0,0 +1,26 @@ +es2022SharedMemory.ts(6,34): error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. +es2022SharedMemory.ts(7,52): error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. + + +==== es2022SharedMemory.ts (2 errors) ==== + const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); + const int32 = new Int32Array(sab); + const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); + const int64 = new BigInt64Array(sab64); + const waitValue = Atomics.wait(int32, 0, 0); + const { async, value } = Atomics.waitAsync(int32, 0, 0); + ~~~~~~~~~ +!!! error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. + const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); + ~~~~~~~~~ +!!! error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. + + const main = async () => { + if (async) { + await value; + } + if (async64) { + await value64; + } + } + main(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt.diff new file mode 100644 index 0000000000..8b2e2f9704 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt.diff @@ -0,0 +1,31 @@ +--- old.es2022SharedMemory.errors.txt ++++ new.es2022SharedMemory.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++es2022SharedMemory.ts(6,34): error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. ++es2022SharedMemory.ts(7,52): error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. ++ ++ ++==== es2022SharedMemory.ts (2 errors) ==== ++ const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); ++ const int32 = new Int32Array(sab); ++ const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); ++ const int64 = new BigInt64Array(sab64); ++ const waitValue = Atomics.wait(int32, 0, 0); ++ const { async, value } = Atomics.waitAsync(int32, 0, 0); ++ ~~~~~~~~~ ++!!! error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. ++ const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); ++ ~~~~~~~~~ ++!!! error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. ++ ++ const main = async () => { ++ if (async) { ++ await value; ++ } ++ if (async64) { ++ await value64; ++ } ++ } ++ main(); diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols new file mode 100644 index 0000000000..1868a63088 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols @@ -0,0 +1,66 @@ +//// [tests/cases/conformance/es2022/es2022SharedMemory.ts] //// + +=== es2022SharedMemory.ts === +const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); +>sab : Symbol(sab, Decl(es2022SharedMemory.ts, 0, 5)) +>SharedArrayBuffer : Symbol(SharedArrayBuffer, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --)) +>Int32Array.BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) + +const int32 = new Int32Array(sab); +>int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>sab : Symbol(sab, Decl(es2022SharedMemory.ts, 0, 5)) + +const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); +>sab64 : Symbol(sab64, Decl(es2022SharedMemory.ts, 2, 5)) +>SharedArrayBuffer : Symbol(SharedArrayBuffer, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --)) +>BigInt64Array.BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) +>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) +>BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) + +const int64 = new BigInt64Array(sab64); +>int64 : Symbol(int64, Decl(es2022SharedMemory.ts, 3, 5)) +>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) +>sab64 : Symbol(sab64, Decl(es2022SharedMemory.ts, 2, 5)) + +const waitValue = Atomics.wait(int32, 0, 0); +>waitValue : Symbol(waitValue, Decl(es2022SharedMemory.ts, 4, 5)) +>Atomics.wait : Symbol(wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) +>Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) +>wait : Symbol(wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) +>int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) + +const { async, value } = Atomics.waitAsync(int32, 0, 0); +>async : Symbol(async, Decl(es2022SharedMemory.ts, 5, 7)) +>value : Symbol(value, Decl(es2022SharedMemory.ts, 5, 14)) +>Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) +>int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) + +const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); +>async64 : Symbol(async64, Decl(es2022SharedMemory.ts, 6, 7)) +>value64 : Symbol(value64, Decl(es2022SharedMemory.ts, 6, 23)) +>Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) +>int64 : Symbol(int64, Decl(es2022SharedMemory.ts, 3, 5)) +>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) + +const main = async () => { +>main : Symbol(main, Decl(es2022SharedMemory.ts, 8, 5)) + + if (async) { +>async : Symbol(async, Decl(es2022SharedMemory.ts, 5, 7)) + + await value; +>value : Symbol(value, Decl(es2022SharedMemory.ts, 5, 14)) + } + if (async64) { +>async64 : Symbol(async64, Decl(es2022SharedMemory.ts, 6, 7)) + + await value64; +>value64 : Symbol(value64, Decl(es2022SharedMemory.ts, 6, 23)) + } +} +main(); +>main : Symbol(main, Decl(es2022SharedMemory.ts, 8, 5)) + diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols.diff b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols.diff new file mode 100644 index 0000000000..575a61fa8c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols.diff @@ -0,0 +1,59 @@ +--- old.es2022SharedMemory.symbols ++++ new.es2022SharedMemory.symbols +@@= skipped -3, +3 lines =@@ + const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); + >sab : Symbol(sab, Decl(es2022SharedMemory.ts, 0, 5)) + >SharedArrayBuffer : Symbol(SharedArrayBuffer, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --)) +->Int32Array.BYTES_PER_ELEMENT : Symbol(Int32ArrayConstructor.BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) ++>Int32Array.BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) + >Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +->BYTES_PER_ELEMENT : Symbol(Int32ArrayConstructor.BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) ++>BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) + + const int32 = new Int32Array(sab); + >int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) +@@= skipped -12, +12 lines =@@ + const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); + >sab64 : Symbol(sab64, Decl(es2022SharedMemory.ts, 2, 5)) + >SharedArrayBuffer : Symbol(SharedArrayBuffer, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --)) +->BigInt64Array.BYTES_PER_ELEMENT : Symbol(BigInt64ArrayConstructor.BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) ++>BigInt64Array.BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) + >BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) +->BYTES_PER_ELEMENT : Symbol(BigInt64ArrayConstructor.BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) ++>BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) + + const int64 = new BigInt64Array(sab64); + >int64 : Symbol(int64, Decl(es2022SharedMemory.ts, 3, 5)) +@@= skipped -11, +11 lines =@@ + + const waitValue = Atomics.wait(int32, 0, 0); + >waitValue : Symbol(waitValue, Decl(es2022SharedMemory.ts, 4, 5)) +->Atomics.wait : Symbol(Atomics.wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) +->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) +->wait : Symbol(Atomics.wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) ++>Atomics.wait : Symbol(wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) ++>Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) ++>wait : Symbol(wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) + >int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) + + const { async, value } = Atomics.waitAsync(int32, 0, 0); + >async : Symbol(async, Decl(es2022SharedMemory.ts, 5, 7)) + >value : Symbol(value, Decl(es2022SharedMemory.ts, 5, 14)) +->Atomics.waitAsync : Symbol(Atomics.waitAsync, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) +->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) +->waitAsync : Symbol(Atomics.waitAsync, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) ++>Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) + >int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) + + const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); +->async : Symbol(async, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) + >async64 : Symbol(async64, Decl(es2022SharedMemory.ts, 6, 7)) +->value : Symbol(value, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) + >value64 : Symbol(value64, Decl(es2022SharedMemory.ts, 6, 23)) +->Atomics.waitAsync : Symbol(Atomics.waitAsync, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) +->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) +->waitAsync : Symbol(Atomics.waitAsync, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) ++>Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) + >int64 : Symbol(int64, Decl(es2022SharedMemory.ts, 3, 5)) + >BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) + diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types new file mode 100644 index 0000000000..25e4b08e4c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types @@ -0,0 +1,94 @@ +//// [tests/cases/conformance/es2022/es2022SharedMemory.ts] //// + +=== es2022SharedMemory.ts === +const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); +>sab : SharedArrayBuffer +>new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024) : SharedArrayBuffer +>SharedArrayBuffer : SharedArrayBufferConstructor +>Int32Array.BYTES_PER_ELEMENT * 1024 : number +>Int32Array.BYTES_PER_ELEMENT : number +>Int32Array : Int32ArrayConstructor +>BYTES_PER_ELEMENT : number +>1024 : 1024 + +const int32 = new Int32Array(sab); +>int32 : Int32Array +>new Int32Array(sab) : Int32Array +>Int32Array : Int32ArrayConstructor +>sab : SharedArrayBuffer + +const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); +>sab64 : SharedArrayBuffer +>new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024) : SharedArrayBuffer +>SharedArrayBuffer : SharedArrayBufferConstructor +>BigInt64Array.BYTES_PER_ELEMENT * 1024 : number +>BigInt64Array.BYTES_PER_ELEMENT : number +>BigInt64Array : BigInt64ArrayConstructor +>BYTES_PER_ELEMENT : number +>1024 : 1024 + +const int64 = new BigInt64Array(sab64); +>int64 : BigInt64Array +>new BigInt64Array(sab64) : BigInt64Array +>BigInt64Array : BigInt64ArrayConstructor +>sab64 : SharedArrayBuffer + +const waitValue = Atomics.wait(int32, 0, 0); +>waitValue : "not-equal" | "ok" | "timed-out" +>Atomics.wait(int32, 0, 0) : "not-equal" | "ok" | "timed-out" +>Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; } +>Atomics : Atomics +>wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; } +>int32 : Int32Array +>0 : 0 +>0 : 0 + +const { async, value } = Atomics.waitAsync(int32, 0, 0); +>async : any +>value : any +>Atomics.waitAsync(int32, 0, 0) : any +>Atomics.waitAsync : any +>Atomics : Atomics +>waitAsync : any +>int32 : Int32Array +>0 : 0 +>0 : 0 + +const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); +>async : any +>async64 : any +>value : any +>value64 : any +>Atomics.waitAsync(int64, 0, BigInt(0)) : any +>Atomics.waitAsync : any +>Atomics : Atomics +>waitAsync : any +>int64 : BigInt64Array +>0 : 0 +>BigInt(0) : bigint +>BigInt : BigIntConstructor +>0 : 0 + +const main = async () => { +>main : () => Promise +>async () => { if (async) { await value; } if (async64) { await value64; }} : () => Promise + + if (async) { +>async : any + + await value; +>await value : any +>value : any + } + if (async64) { +>async64 : any + + await value64; +>await value64 : any +>value64 : any + } +} +main(); +>main() : Promise +>main : () => Promise + diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types.diff b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types.diff new file mode 100644 index 0000000000..5cb5eec562 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types.diff @@ -0,0 +1,77 @@ +--- old.es2022SharedMemory.types ++++ new.es2022SharedMemory.types +@@= skipped -33, +33 lines =@@ + >sab64 : SharedArrayBuffer + + const waitValue = Atomics.wait(int32, 0, 0); +->waitValue : "ok" | "not-equal" | "timed-out" +->Atomics.wait(int32, 0, 0) : "ok" | "not-equal" | "timed-out" +->Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } ++>waitValue : "not-equal" | "ok" | "timed-out" ++>Atomics.wait(int32, 0, 0) : "not-equal" | "ok" | "timed-out" ++>Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; } + >Atomics : Atomics +->wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } ++>wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; } + >int32 : Int32Array + >0 : 0 + >0 : 0 + + const { async, value } = Atomics.waitAsync(int32, 0, 0); +->async : boolean +->value : "not-equal" | "timed-out" | Promise<"ok" | "timed-out"> +->Atomics.waitAsync(int32, 0, 0) : { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; } +->Atomics.waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } ++>async : any ++>value : any ++>Atomics.waitAsync(int32, 0, 0) : any ++>Atomics.waitAsync : any + >Atomics : Atomics +->waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } ++>waitAsync : any + >int32 : Int32Array + >0 : 0 + >0 : 0 + + const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); + >async : any +->async64 : boolean ++>async64 : any + >value : any +->value64 : "not-equal" | "timed-out" | Promise<"ok" | "timed-out"> +->Atomics.waitAsync(int64, 0, BigInt(0)) : { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; } +->Atomics.waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } ++>value64 : any ++>Atomics.waitAsync(int64, 0, BigInt(0)) : any ++>Atomics.waitAsync : any + >Atomics : Atomics +->waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } ++>waitAsync : any + >int64 : BigInt64Array + >0 : 0 + >BigInt(0) : bigint +@@= skipped -40, +40 lines =@@ + >async () => { if (async) { await value; } if (async64) { await value64; }} : () => Promise + + if (async) { +->async : boolean ++>async : any + + await value; +->await value : "ok" | "timed-out" +->value : Promise<"ok" | "timed-out"> ++>await value : any ++>value : any + } + if (async64) { +->async64 : boolean ++>async64 : any + + await value64; +->await value64 : "ok" | "timed-out" +->value64 : Promise<"ok" | "timed-out"> ++>await value64 : any ++>value64 : any + } + } + main(); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt deleted file mode 100644 index 0925027326..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.errors.txt +++ /dev/null @@ -1,120 +0,0 @@ -jsDeclarationsReactComponents1.jsx(2,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. -jsDeclarationsReactComponents1.jsx(3,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. -jsDeclarationsReactComponents2.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. -jsDeclarationsReactComponents3.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. -jsDeclarationsReactComponents3.jsx(3,73): error TS2503: Cannot find namespace 'JSX'. -jsDeclarationsReactComponents4.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. -jsDeclarationsReactComponents5.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. -jsDeclarationsReactComponents5.jsx(2,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. - - -==== jsDeclarationsReactComponents1.jsx (2 errors) ==== - /// - import React from "react"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'react' or its corresponding type declarations. - import PropTypes from "prop-types" - ~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. - - const TabbedShowLayout = ({ - }) => { - return ( -
- ); - }; - - TabbedShowLayout.propTypes = { - version: PropTypes.number, - - }; - - TabbedShowLayout.defaultProps = { - tabs: undefined - }; - - export default TabbedShowLayout; - -==== jsDeclarationsReactComponents2.jsx (1 errors) ==== - import React from "react"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'react' or its corresponding type declarations. - /** - * @type {React.SFC} - */ - const TabbedShowLayout = () => { - return ( -
- ok -
- ); - }; - - TabbedShowLayout.defaultProps = { - tabs: "default value" - }; - - export default TabbedShowLayout; - -==== jsDeclarationsReactComponents3.jsx (2 errors) ==== - import React from "react"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'react' or its corresponding type declarations. - /** - * @type {{defaultProps: {tabs: string}} & ((props?: {elem: string}) => JSX.Element)} - ~~~ -!!! error TS2503: Cannot find namespace 'JSX'. - */ - const TabbedShowLayout = () => { - return ( -
- ok -
- ); - }; - - TabbedShowLayout.defaultProps = { - tabs: "default value" - }; - - export default TabbedShowLayout; - -==== jsDeclarationsReactComponents4.jsx (1 errors) ==== - import React from "react"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'react' or its corresponding type declarations. - const TabbedShowLayout = (/** @type {{className: string}}*/prop) => { - return ( -
- ok -
- ); - }; - - TabbedShowLayout.defaultProps = { - tabs: "default value" - }; - - export default TabbedShowLayout; -==== jsDeclarationsReactComponents5.jsx (2 errors) ==== - import React from 'react'; - ~~~~~~~ -!!! error TS2307: Cannot find module 'react' or its corresponding type declarations. - import PropTypes from 'prop-types'; - ~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. - - function Tree({ allowDropOnRoot }) { - return
- } - - Tree.propTypes = { - classes: PropTypes.object, - }; - - Tree.defaultProps = { - classes: {}, - parentSource: 'parent_id', - }; - - export default Tree; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols index efd5117b92..475c71ac51 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols @@ -65,7 +65,9 @@ const TabbedShowLayout = () => { }; TabbedShowLayout.defaultProps = { +>TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(react16.d.ts, 410, 46)) >TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents2.jsx, 4, 5)) +>defaultProps : Symbol(defaultProps, Decl(react16.d.ts, 410, 46)) tabs: "default value" >tabs : Symbol(tabs, Decl(jsDeclarationsReactComponents2.jsx, 12, 33)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff index cb0d89340c..67542a169f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.symbols.diff @@ -76,11 +76,13 @@ ->TabbedShowLayout.defaultProps : Symbol(React.StatelessComponent.defaultProps, Decl(react16.d.ts, 410, 46)) ->TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents2.jsx, 4, 5), Decl(jsDeclarationsReactComponents2.jsx, 10, 2)) ->defaultProps : Symbol(React.StatelessComponent.defaultProps, Decl(react16.d.ts, 410, 46)) ++>TabbedShowLayout.defaultProps : Symbol(defaultProps, Decl(react16.d.ts, 410, 46)) +>TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents2.jsx, 4, 5)) ++>defaultProps : Symbol(defaultProps, Decl(react16.d.ts, 410, 46)) tabs: "default value" >tabs : Symbol(tabs, Decl(jsDeclarationsReactComponents2.jsx, 12, 33)) -@@= skipped -26, +21 lines =@@ +@@= skipped -26, +23 lines =@@ }; export default TabbedShowLayout; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.types index 57afa3b866..072fa5c285 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.types @@ -62,7 +62,7 @@ import React from "react"; * @type {React.SFC} */ const TabbedShowLayout = () => { ->TabbedShowLayout : SFC +>TabbedShowLayout : SFC<{}> >() => { return (
ok
);} : { (): any; defaultProps: { tabs: string; }; } return ( @@ -83,9 +83,9 @@ const TabbedShowLayout = () => { TabbedShowLayout.defaultProps = { >TabbedShowLayout.defaultProps = { tabs: "default value"} : { tabs: string; } ->TabbedShowLayout.defaultProps : any ->TabbedShowLayout : SFC ->defaultProps : any +>TabbedShowLayout.defaultProps : Partial<{}> | undefined +>TabbedShowLayout : SFC<{}> +>defaultProps : Partial<{}> | undefined >{ tabs: "default value"} : { tabs: string; } tabs: "default value" @@ -95,7 +95,7 @@ TabbedShowLayout.defaultProps = { }; export default TabbedShowLayout; ->TabbedShowLayout : SFC +>TabbedShowLayout : SFC<{}> === jsDeclarationsReactComponents3.jsx === import React from "react"; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.errors.txt.diff deleted file mode 100644 index ba62b06bd8..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.errors.txt.diff +++ /dev/null @@ -1,125 +0,0 @@ ---- old.jsDeclarationsReactComponents.errors.txt -+++ new.jsDeclarationsReactComponents.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+jsDeclarationsReactComponents1.jsx(2,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. -+jsDeclarationsReactComponents1.jsx(3,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. -+jsDeclarationsReactComponents2.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. -+jsDeclarationsReactComponents3.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. -+jsDeclarationsReactComponents3.jsx(3,73): error TS2503: Cannot find namespace 'JSX'. -+jsDeclarationsReactComponents4.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. -+jsDeclarationsReactComponents5.jsx(1,19): error TS2307: Cannot find module 'react' or its corresponding type declarations. -+jsDeclarationsReactComponents5.jsx(2,23): error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. -+ -+ -+==== jsDeclarationsReactComponents1.jsx (2 errors) ==== -+ /// -+ import React from "react"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'react' or its corresponding type declarations. -+ import PropTypes from "prop-types" -+ ~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. -+ -+ const TabbedShowLayout = ({ -+ }) => { -+ return ( -+
-+ ); -+ }; -+ -+ TabbedShowLayout.propTypes = { -+ version: PropTypes.number, -+ -+ }; -+ -+ TabbedShowLayout.defaultProps = { -+ tabs: undefined -+ }; -+ -+ export default TabbedShowLayout; -+ -+==== jsDeclarationsReactComponents2.jsx (1 errors) ==== -+ import React from "react"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'react' or its corresponding type declarations. -+ /** -+ * @type {React.SFC} -+ */ -+ const TabbedShowLayout = () => { -+ return ( -+
-+ ok -+
-+ ); -+ }; -+ -+ TabbedShowLayout.defaultProps = { -+ tabs: "default value" -+ }; -+ -+ export default TabbedShowLayout; -+ -+==== jsDeclarationsReactComponents3.jsx (2 errors) ==== -+ import React from "react"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'react' or its corresponding type declarations. -+ /** -+ * @type {{defaultProps: {tabs: string}} & ((props?: {elem: string}) => JSX.Element)} -+ ~~~ -+!!! error TS2503: Cannot find namespace 'JSX'. -+ */ -+ const TabbedShowLayout = () => { -+ return ( -+
-+ ok -+
-+ ); -+ }; -+ -+ TabbedShowLayout.defaultProps = { -+ tabs: "default value" -+ }; -+ -+ export default TabbedShowLayout; -+ -+==== jsDeclarationsReactComponents4.jsx (1 errors) ==== -+ import React from "react"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'react' or its corresponding type declarations. -+ const TabbedShowLayout = (/** @type {{className: string}}*/prop) => { -+ return ( -+
-+ ok -+
-+ ); -+ }; -+ -+ TabbedShowLayout.defaultProps = { -+ tabs: "default value" -+ }; -+ -+ export default TabbedShowLayout; -+==== jsDeclarationsReactComponents5.jsx (2 errors) ==== -+ import React from 'react'; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'react' or its corresponding type declarations. -+ import PropTypes from 'prop-types'; -+ ~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'prop-types' or its corresponding type declarations. -+ -+ function Tree({ allowDropOnRoot }) { -+ return
-+ } -+ -+ Tree.propTypes = { -+ classes: PropTypes.object, -+ }; -+ -+ Tree.defaultProps = { -+ classes: {}, -+ parentSource: 'parent_id', -+ }; -+ -+ export default Tree; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.types.diff index c36cc2be15..015bf47609 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReactComponents.types.diff @@ -73,7 +73,7 @@ const TabbedShowLayout = () => { ->TabbedShowLayout : React.SFC<{}> ->() => { return (
ok
);} : { (): JSX.Element; defaultProps: Partial<{}> | undefined; } -+>TabbedShowLayout : SFC ++>TabbedShowLayout : SFC<{}> +>() => { return (
ok
);} : { (): any; defaultProps: { tabs: string; }; } return ( @@ -91,25 +91,21 @@ ok
-@@= skipped -21, +21 lines =@@ - +@@= skipped -22, +22 lines =@@ TabbedShowLayout.defaultProps = { >TabbedShowLayout.defaultProps = { tabs: "default value"} : { tabs: string; } -->TabbedShowLayout.defaultProps : Partial<{}> | undefined + >TabbedShowLayout.defaultProps : Partial<{}> | undefined ->TabbedShowLayout : React.SFC<{}> -->defaultProps : Partial<{}> | undefined -+>TabbedShowLayout.defaultProps : any -+>TabbedShowLayout : SFC -+>defaultProps : any ++>TabbedShowLayout : SFC<{}> + >defaultProps : Partial<{}> | undefined >{ tabs: "default value"} : { tabs: string; } - tabs: "default value" -@@= skipped -12, +12 lines =@@ +@@= skipped -11, +11 lines =@@ }; export default TabbedShowLayout; ->TabbedShowLayout : React.SFC<{}> -+>TabbedShowLayout : SFC ++>TabbedShowLayout : SFC<{}> === jsDeclarationsReactComponents3.jsx === import React from "react"; From 57badaeb32739d66ab10bee4e3d1bff8c0a6c8ce Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 7 Apr 2025 10:54:36 -0700 Subject: [PATCH 24/25] re-delete unused baselines --- .../conformance/es2022SharedMemory.errors.txt | 26 ----- .../es2022SharedMemory.errors.txt.diff | 31 ------ .../conformance/es2022SharedMemory.symbols | 66 ------------- .../es2022SharedMemory.symbols.diff | 59 ------------ .../conformance/es2022SharedMemory.types | 94 ------------------- .../conformance/es2022SharedMemory.types.diff | 77 --------------- 6 files changed, 353 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols delete mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types delete mode 100644 testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types.diff diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt deleted file mode 100644 index ee76b11975..0000000000 --- a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -es2022SharedMemory.ts(6,34): error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. -es2022SharedMemory.ts(7,52): error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. - - -==== es2022SharedMemory.ts (2 errors) ==== - const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); - const int32 = new Int32Array(sab); - const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); - const int64 = new BigInt64Array(sab64); - const waitValue = Atomics.wait(int32, 0, 0); - const { async, value } = Atomics.waitAsync(int32, 0, 0); - ~~~~~~~~~ -!!! error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. - const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); - ~~~~~~~~~ -!!! error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. - - const main = async () => { - if (async) { - await value; - } - if (async64) { - await value64; - } - } - main(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt.diff deleted file mode 100644 index 8b2e2f9704..0000000000 --- a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.es2022SharedMemory.errors.txt -+++ new.es2022SharedMemory.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+es2022SharedMemory.ts(6,34): error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. -+es2022SharedMemory.ts(7,52): error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. -+ -+ -+==== es2022SharedMemory.ts (2 errors) ==== -+ const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); -+ const int32 = new Int32Array(sab); -+ const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); -+ const int64 = new BigInt64Array(sab64); -+ const waitValue = Atomics.wait(int32, 0, 0); -+ const { async, value } = Atomics.waitAsync(int32, 0, 0); -+ ~~~~~~~~~ -+!!! error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. -+ const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); -+ ~~~~~~~~~ -+!!! error TS2550: Property 'waitAsync' does not exist on type 'Atomics'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2024' or later. -+ -+ const main = async () => { -+ if (async) { -+ await value; -+ } -+ if (async64) { -+ await value64; -+ } -+ } -+ main(); diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols deleted file mode 100644 index 1868a63088..0000000000 --- a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols +++ /dev/null @@ -1,66 +0,0 @@ -//// [tests/cases/conformance/es2022/es2022SharedMemory.ts] //// - -=== es2022SharedMemory.ts === -const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); ->sab : Symbol(sab, Decl(es2022SharedMemory.ts, 0, 5)) ->SharedArrayBuffer : Symbol(SharedArrayBuffer, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --)) ->Int32Array.BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) ->BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) - -const int32 = new Int32Array(sab); ->int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) ->Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) ->sab : Symbol(sab, Decl(es2022SharedMemory.ts, 0, 5)) - -const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); ->sab64 : Symbol(sab64, Decl(es2022SharedMemory.ts, 2, 5)) ->SharedArrayBuffer : Symbol(SharedArrayBuffer, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --)) ->BigInt64Array.BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) ->BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) ->BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) - -const int64 = new BigInt64Array(sab64); ->int64 : Symbol(int64, Decl(es2022SharedMemory.ts, 3, 5)) ->BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) ->sab64 : Symbol(sab64, Decl(es2022SharedMemory.ts, 2, 5)) - -const waitValue = Atomics.wait(int32, 0, 0); ->waitValue : Symbol(waitValue, Decl(es2022SharedMemory.ts, 4, 5)) ->Atomics.wait : Symbol(wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) ->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) ->wait : Symbol(wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) ->int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) - -const { async, value } = Atomics.waitAsync(int32, 0, 0); ->async : Symbol(async, Decl(es2022SharedMemory.ts, 5, 7)) ->value : Symbol(value, Decl(es2022SharedMemory.ts, 5, 14)) ->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) ->int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) - -const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); ->async64 : Symbol(async64, Decl(es2022SharedMemory.ts, 6, 7)) ->value64 : Symbol(value64, Decl(es2022SharedMemory.ts, 6, 23)) ->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) ->int64 : Symbol(int64, Decl(es2022SharedMemory.ts, 3, 5)) ->BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) - -const main = async () => { ->main : Symbol(main, Decl(es2022SharedMemory.ts, 8, 5)) - - if (async) { ->async : Symbol(async, Decl(es2022SharedMemory.ts, 5, 7)) - - await value; ->value : Symbol(value, Decl(es2022SharedMemory.ts, 5, 14)) - } - if (async64) { ->async64 : Symbol(async64, Decl(es2022SharedMemory.ts, 6, 7)) - - await value64; ->value64 : Symbol(value64, Decl(es2022SharedMemory.ts, 6, 23)) - } -} -main(); ->main : Symbol(main, Decl(es2022SharedMemory.ts, 8, 5)) - diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols.diff b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols.diff deleted file mode 100644 index 575a61fa8c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.symbols.diff +++ /dev/null @@ -1,59 +0,0 @@ ---- old.es2022SharedMemory.symbols -+++ new.es2022SharedMemory.symbols -@@= skipped -3, +3 lines =@@ - const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); - >sab : Symbol(sab, Decl(es2022SharedMemory.ts, 0, 5)) - >SharedArrayBuffer : Symbol(SharedArrayBuffer, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --)) -->Int32Array.BYTES_PER_ELEMENT : Symbol(Int32ArrayConstructor.BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) -+>Int32Array.BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) - >Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) -->BYTES_PER_ELEMENT : Symbol(Int32ArrayConstructor.BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) -+>BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es5.d.ts, --, --)) - - const int32 = new Int32Array(sab); - >int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) -@@= skipped -12, +12 lines =@@ - const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); - >sab64 : Symbol(sab64, Decl(es2022SharedMemory.ts, 2, 5)) - >SharedArrayBuffer : Symbol(SharedArrayBuffer, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --)) -->BigInt64Array.BYTES_PER_ELEMENT : Symbol(BigInt64ArrayConstructor.BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) -+>BigInt64Array.BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) - >BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) -->BYTES_PER_ELEMENT : Symbol(BigInt64ArrayConstructor.BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) -+>BYTES_PER_ELEMENT : Symbol(BYTES_PER_ELEMENT, Decl(lib.es2020.bigint.d.ts, --, --)) - - const int64 = new BigInt64Array(sab64); - >int64 : Symbol(int64, Decl(es2022SharedMemory.ts, 3, 5)) -@@= skipped -11, +11 lines =@@ - - const waitValue = Atomics.wait(int32, 0, 0); - >waitValue : Symbol(waitValue, Decl(es2022SharedMemory.ts, 4, 5)) -->Atomics.wait : Symbol(Atomics.wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) -->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -->wait : Symbol(Atomics.wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) -+>Atomics.wait : Symbol(wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) -+>Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) -+>wait : Symbol(wait, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) - >int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) - - const { async, value } = Atomics.waitAsync(int32, 0, 0); - >async : Symbol(async, Decl(es2022SharedMemory.ts, 5, 7)) - >value : Symbol(value, Decl(es2022SharedMemory.ts, 5, 14)) -->Atomics.waitAsync : Symbol(Atomics.waitAsync, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -->waitAsync : Symbol(Atomics.waitAsync, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -+>Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) - >int32 : Symbol(int32, Decl(es2022SharedMemory.ts, 1, 5)) - - const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); -->async : Symbol(async, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) - >async64 : Symbol(async64, Decl(es2022SharedMemory.ts, 6, 7)) -->value : Symbol(value, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) - >value64 : Symbol(value64, Decl(es2022SharedMemory.ts, 6, 23)) -->Atomics.waitAsync : Symbol(Atomics.waitAsync, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -->Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -->waitAsync : Symbol(Atomics.waitAsync, Decl(lib.es2022.sharedmemory.d.ts, --, --), Decl(lib.es2022.sharedmemory.d.ts, --, --)) -+>Atomics : Symbol(Atomics, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2020.sharedmemory.d.ts, --, --)) - >int64 : Symbol(int64, Decl(es2022SharedMemory.ts, 3, 5)) - >BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) - diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types deleted file mode 100644 index 25e4b08e4c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types +++ /dev/null @@ -1,94 +0,0 @@ -//// [tests/cases/conformance/es2022/es2022SharedMemory.ts] //// - -=== es2022SharedMemory.ts === -const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024); ->sab : SharedArrayBuffer ->new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024) : SharedArrayBuffer ->SharedArrayBuffer : SharedArrayBufferConstructor ->Int32Array.BYTES_PER_ELEMENT * 1024 : number ->Int32Array.BYTES_PER_ELEMENT : number ->Int32Array : Int32ArrayConstructor ->BYTES_PER_ELEMENT : number ->1024 : 1024 - -const int32 = new Int32Array(sab); ->int32 : Int32Array ->new Int32Array(sab) : Int32Array ->Int32Array : Int32ArrayConstructor ->sab : SharedArrayBuffer - -const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024); ->sab64 : SharedArrayBuffer ->new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024) : SharedArrayBuffer ->SharedArrayBuffer : SharedArrayBufferConstructor ->BigInt64Array.BYTES_PER_ELEMENT * 1024 : number ->BigInt64Array.BYTES_PER_ELEMENT : number ->BigInt64Array : BigInt64ArrayConstructor ->BYTES_PER_ELEMENT : number ->1024 : 1024 - -const int64 = new BigInt64Array(sab64); ->int64 : BigInt64Array ->new BigInt64Array(sab64) : BigInt64Array ->BigInt64Array : BigInt64ArrayConstructor ->sab64 : SharedArrayBuffer - -const waitValue = Atomics.wait(int32, 0, 0); ->waitValue : "not-equal" | "ok" | "timed-out" ->Atomics.wait(int32, 0, 0) : "not-equal" | "ok" | "timed-out" ->Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; } ->Atomics : Atomics ->wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; } ->int32 : Int32Array ->0 : 0 ->0 : 0 - -const { async, value } = Atomics.waitAsync(int32, 0, 0); ->async : any ->value : any ->Atomics.waitAsync(int32, 0, 0) : any ->Atomics.waitAsync : any ->Atomics : Atomics ->waitAsync : any ->int32 : Int32Array ->0 : 0 ->0 : 0 - -const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); ->async : any ->async64 : any ->value : any ->value64 : any ->Atomics.waitAsync(int64, 0, BigInt(0)) : any ->Atomics.waitAsync : any ->Atomics : Atomics ->waitAsync : any ->int64 : BigInt64Array ->0 : 0 ->BigInt(0) : bigint ->BigInt : BigIntConstructor ->0 : 0 - -const main = async () => { ->main : () => Promise ->async () => { if (async) { await value; } if (async64) { await value64; }} : () => Promise - - if (async) { ->async : any - - await value; ->await value : any ->value : any - } - if (async64) { ->async64 : any - - await value64; ->await value64 : any ->value64 : any - } -} -main(); ->main() : Promise ->main : () => Promise - diff --git a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types.diff b/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types.diff deleted file mode 100644 index 5cb5eec562..0000000000 --- a/testdata/baselines/reference/submodule/conformance/es2022SharedMemory.types.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.es2022SharedMemory.types -+++ new.es2022SharedMemory.types -@@= skipped -33, +33 lines =@@ - >sab64 : SharedArrayBuffer - - const waitValue = Atomics.wait(int32, 0, 0); -->waitValue : "ok" | "not-equal" | "timed-out" -->Atomics.wait(int32, 0, 0) : "ok" | "not-equal" | "timed-out" -->Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } -+>waitValue : "not-equal" | "ok" | "timed-out" -+>Atomics.wait(int32, 0, 0) : "not-equal" | "ok" | "timed-out" -+>Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; } - >Atomics : Atomics -->wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } -+>wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number | undefined): "not-equal" | "ok" | "timed-out"; } - >int32 : Int32Array - >0 : 0 - >0 : 0 - - const { async, value } = Atomics.waitAsync(int32, 0, 0); -->async : boolean -->value : "not-equal" | "timed-out" | Promise<"ok" | "timed-out"> -->Atomics.waitAsync(int32, 0, 0) : { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; } -->Atomics.waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } -+>async : any -+>value : any -+>Atomics.waitAsync(int32, 0, 0) : any -+>Atomics.waitAsync : any - >Atomics : Atomics -->waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } -+>waitAsync : any - >int32 : Int32Array - >0 : 0 - >0 : 0 - - const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0)); - >async : any -->async64 : boolean -+>async64 : any - >value : any -->value64 : "not-equal" | "timed-out" | Promise<"ok" | "timed-out"> -->Atomics.waitAsync(int64, 0, BigInt(0)) : { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; } -->Atomics.waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } -+>value64 : any -+>Atomics.waitAsync(int64, 0, BigInt(0)) : any -+>Atomics.waitAsync : any - >Atomics : Atomics -->waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } -+>waitAsync : any - >int64 : BigInt64Array - >0 : 0 - >BigInt(0) : bigint -@@= skipped -40, +40 lines =@@ - >async () => { if (async) { await value; } if (async64) { await value64; }} : () => Promise - - if (async) { -->async : boolean -+>async : any - - await value; -->await value : "ok" | "timed-out" -->value : Promise<"ok" | "timed-out"> -+>await value : any -+>value : any - } - if (async64) { -->async64 : boolean -+>async64 : any - - await value64; -->await value64 : "ok" | "timed-out" -->value64 : Promise<"ok" | "timed-out"> -+>await value64 : any -+>value64 : any - } - } - main(); From 807d725c74a94cfa07a25ffca0f6aa008e0eb47a Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 8 Apr 2025 13:20:43 -0700 Subject: [PATCH 25/25] skip baselining all reparsed nodes except `as` --- .../tsbaseline/type_symbol_baseline.go | 12 +- .../checkJsTypeDefNoUnusedLocalMarked.symbols | 3 - ...kJsTypeDefNoUnusedLocalMarked.symbols.diff | 7 +- .../checkJsTypeDefNoUnusedLocalMarked.types | 3 - ...eckJsdocTypeTagOnExportAssignment1.symbols | 2 - ...docTypeTagOnExportAssignment1.symbols.diff | 11 -- ...checkJsdocTypeTagOnExportAssignment1.types | 6 - ...eckJsdocTypeTagOnExportAssignment2.symbols | 2 - ...docTypeTagOnExportAssignment2.symbols.diff | 6 - ...eckJsdocTypeTagOnExportAssignment3.symbols | 2 - ...docTypeTagOnExportAssignment3.symbols.diff | 11 -- ...checkJsdocTypeTagOnExportAssignment3.types | 6 - ...eckJsdocTypeTagOnExportAssignment4.symbols | 3 +- ...docTypeTagOnExportAssignment4.symbols.diff | 17 --- ...checkJsdocTypeTagOnExportAssignment4.types | 2 - ...eckJsdocTypeTagOnExportAssignment5.symbols | 2 - ...docTypeTagOnExportAssignment5.symbols.diff | 11 -- ...checkJsdocTypeTagOnExportAssignment5.types | 6 - ...eckJsdocTypeTagOnExportAssignment6.symbols | 2 - ...docTypeTagOnExportAssignment6.symbols.diff | 11 -- ...checkJsdocTypeTagOnExportAssignment6.types | 6 - ...eckJsdocTypeTagOnExportAssignment7.symbols | 2 - ...docTypeTagOnExportAssignment7.symbols.diff | 11 -- ...checkJsdocTypeTagOnExportAssignment7.types | 6 - ...eckJsdocTypeTagOnExportAssignment8.symbols | 2 - ...docTypeTagOnExportAssignment8.symbols.diff | 11 -- ...checkJsdocTypeTagOnExportAssignment8.types | 6 - ...allyTypedParametersOptionalInJSDoc.symbols | 3 - ...ypedParametersOptionalInJSDoc.symbols.diff | 12 -- ...tuallyTypedParametersOptionalInJSDoc.types | 4 - ...lyInferenceFromAnnotatedFunctionJs.symbols | 7 - ...erenceFromAnnotatedFunctionJs.symbols.diff | 18 --- ...OnlyInferenceFromAnnotatedFunctionJs.types | 6 - .../expandoFunctionContextualTypesJs.symbols | 4 - ...andoFunctionContextualTypesJs.symbols.diff | 17 +-- .../expandoFunctionContextualTypesJs.types | 4 - .../compiler/exportDefaultWithJSDoc1.symbols | 2 +- .../exportDefaultWithJSDoc1.symbols.diff | 17 --- .../compiler/exportDefaultWithJSDoc1.types | 2 - .../compiler/exportDefaultWithJSDoc2.symbols | 2 +- .../exportDefaultWithJSDoc2.symbols.diff | 17 --- .../compiler/exportDefaultWithJSDoc2.types | 2 - ...DeclarationEmitDoesNotRenameImport.symbols | 2 - ...rationEmitDoesNotRenameImport.symbols.diff | 11 +- ...jsDeclarationEmitDoesNotRenameImport.types | 5 - ...gnedFunctionWithExtraTypedefsMembers.types | 4 - .../jsDeclarationsInheritedTypes.types | 8 -- ...sNotUseNodeModulesPathWithoutError.symbols | 2 - ...seNodeModulesPathWithoutError.symbols.diff | 9 +- ...oesNotUseNodeModulesPathWithoutError.types | 2 - .../compiler/jsEnumCrossFileExport.types | 4 - .../compiler/jsEnumTagOnObjectFrozen.types | 6 - .../jsdocImportTypeResolution.symbols | 2 - .../jsdocImportTypeResolution.symbols.diff | 11 -- .../compiler/jsdocImportTypeResolution.types | 4 - .../compiler/jsdocPropertyTagInvalid.symbols | 5 - .../jsdocPropertyTagInvalid.symbols.diff | 15 -- .../compiler/jsdocPropertyTagInvalid.types | 4 - ...TypedefBeforeParenthesizedExpression.types | 2 - .../compiler/jsdocTypedefMissingType.types | 4 - .../compiler/jsdocTypedefNoCrash.types | 2 - .../compiler/jsdocTypedefNoCrash2.types | 2 - .../jsdocTypedef_propertyWithNoType.types | 4 - .../misspelledJsDocTypedefTags.symbols | 7 - .../misspelledJsDocTypedefTags.symbols.diff | 10 +- .../compiler/misspelledJsDocTypedefTags.types | 8 -- .../strictOptionalProperties3.symbols | 2 - .../strictOptionalProperties3.symbols.diff | 11 -- .../compiler/strictOptionalProperties3.types | 7 - .../strictOptionalProperties4.symbols | 3 - .../strictOptionalProperties4.symbols.diff | 19 --- .../compiler/strictOptionalProperties4.types | 4 - .../compiler/topLevelBlockExpando.symbols | 6 - .../topLevelBlockExpando.symbols.diff | 17 +-- .../compiler/topLevelBlockExpando.types | 6 - ...metTypeConstraintInJSDocImportCall.symbols | 4 +- ...peConstraintInJSDocImportCall.symbols.diff | 16 --- ...unmetTypeConstraintInJSDocImportCall.types | 3 - .../assertionTypePredicates2.symbols | 6 - .../assertionTypePredicates2.symbols.diff | 26 ---- .../assertionTypePredicates2.types | 6 - ...assertionsAndNonReturningFunctions.symbols | 2 - ...tionsAndNonReturningFunctions.symbols.diff | 11 +- .../assertionsAndNonReturningFunctions.types | 2 - .../checkJsdocSatisfiesTag1.symbols | 2 - .../checkJsdocSatisfiesTag1.symbols.diff | 11 +- .../conformance/checkJsdocSatisfiesTag1.types | 15 -- .../checkJsdocSatisfiesTag10.types | 1 - .../checkJsdocSatisfiesTag11.types | 8 -- .../checkJsdocSatisfiesTag12.types | 12 -- .../checkJsdocSatisfiesTag14.types | 4 - .../checkJsdocSatisfiesTag2.symbols | 2 - .../checkJsdocSatisfiesTag2.symbols.diff | 11 -- .../conformance/checkJsdocSatisfiesTag2.types | 2 - .../conformance/checkJsdocSatisfiesTag4.types | 8 -- .../checkJsdocSatisfiesTag5.symbols | 2 - .../checkJsdocSatisfiesTag5.symbols.diff | 11 -- .../conformance/checkJsdocSatisfiesTag5.types | 3 - .../conformance/checkJsdocSatisfiesTag6.types | 6 - .../conformance/checkJsdocSatisfiesTag7.types | 1 - .../checkJsdocSatisfiesTag8.symbols | 1 - .../checkJsdocSatisfiesTag8.symbols.diff | 10 -- .../conformance/checkJsdocSatisfiesTag8.types | 1 - .../conformance/checkJsdocSatisfiesTag9.types | 8 -- .../conformance/checkJsdocTypeTag4.symbols | 3 - .../checkJsdocTypeTag4.symbols.diff | 12 -- .../conformance/checkJsdocTypeTag4.types | 3 - .../conformance/checkJsdocTypeTag5.symbols | 6 - .../checkJsdocTypeTag5.symbols.diff | 22 --- .../conformance/checkJsdocTypeTag5.types | 6 - .../conformance/checkJsdocTypeTag7.symbols | 3 - .../checkJsdocTypeTag7.symbols.diff | 12 +- .../conformance/checkJsdocTypeTag7.types | 4 - .../checkJsdocTypedefInParamTag1.symbols | 26 ---- .../checkJsdocTypedefInParamTag1.symbols.diff | 59 -------- .../checkJsdocTypedefInParamTag1.types | 26 ---- .../checkJsdocTypedefOnlySourceFile.types | 2 - .../contextualTypedSpecialAssignment.symbols | 5 - ...textualTypedSpecialAssignment.symbols.diff | 14 +- .../contextualTypedSpecialAssignment.types | 1 - .../conformance/enumTagImported.types | 2 - .../submodule/conformance/extendsTag5.symbols | 4 - .../conformance/extendsTag5.symbols.diff | 14 -- .../submodule/conformance/extendsTag5.types | 2 - .../conformance/importTypeInJSDoc.symbols | 3 - .../importTypeInJSDoc.symbols.diff | 18 +-- .../conformance/importTypeInJSDoc.types | 3 - .../importingExportingTypes.symbols | 1 - .../importingExportingTypes.symbols.diff | 5 +- .../conformance/importingExportingTypes.types | 2 - .../conformance/jsDeclarationsDefault.symbols | 2 - .../jsDeclarationsDefault.symbols.diff | 6 +- ...FunctionClassesCjsExportAssignment.symbols | 26 ---- ...ionClassesCjsExportAssignment.symbols.diff | 60 +------- ...nsFunctionClassesCjsExportAssignment.types | 21 --- ...sImportAliasExposedWithinNamespace.symbols | 12 -- ...rtAliasExposedWithinNamespace.symbols.diff | 31 +--- ...onsImportAliasExposedWithinNamespace.types | 12 -- ...portAliasExposedWithinNamespaceCjs.symbols | 3 - ...liasExposedWithinNamespaceCjs.symbols.diff | 10 +- ...ImportAliasExposedWithinNamespaceCjs.types | 2 - .../jsDeclarationsImportNamespacedType.types | 2 - .../jsDeclarationsImportTypeBundled.symbols | 2 - ...DeclarationsImportTypeBundled.symbols.diff | 11 +- .../jsDeclarationsImportTypeBundled.types | 3 - ...DeclarationsJSDocRedirectedLookups.symbols | 17 --- ...rationsJSDocRedirectedLookups.symbols.diff | 77 +--------- ...nsParameterTagReusesInputNodeInEmit1.types | 2 - ...nsParameterTagReusesInputNodeInEmit2.types | 1 - .../jsDeclarationsTypeAliases.symbols | 5 - .../jsDeclarationsTypeAliases.symbols.diff | 14 +- .../jsDeclarationsTypeAliases.types | 3 - .../jsDeclarationsTypedefAndImportTypes.types | 4 - .../jsDeclarationsTypedefAndLatebound.symbols | 2 - ...clarationsTypedefAndLatebound.symbols.diff | 11 +- .../jsDeclarationsTypedefAndLatebound.types | 2 - .../jsDeclarationsTypedefFunction.symbols | 4 - ...jsDeclarationsTypedefFunction.symbols.diff | 13 -- .../jsDeclarationsTypedefFunction.types | 2 - ...TypedefPropertyAndExportAssignment.symbols | 10 -- ...efPropertyAndExportAssignment.symbols.diff | 23 +-- ...nsTypedefPropertyAndExportAssignment.types | 12 -- ...jsdocCatchClauseWithTypeAnnotation.symbols | 13 -- ...CatchClauseWithTypeAnnotation.symbols.diff | 64 +-------- .../jsdocCatchClauseWithTypeAnnotation.types | 4 - .../conformance/jsdocImportType.types | 2 - .../conformance/jsdocImportType2.types | 2 - ...docImportTypeReferenceToClassAlias.symbols | 2 - ...portTypeReferenceToClassAlias.symbols.diff | 7 +- ...jsdocImportTypeReferenceToClassAlias.types | 2 - .../jsdocSignatureOnReturnedFunction.symbols | 6 - ...ocSignatureOnReturnedFunction.symbols.diff | 22 --- .../conformance/jsdocTemplateClass.symbols | 8 -- .../jsdocTemplateClass.symbols.diff | 23 +-- .../conformance/jsdocTemplateClass.types | 6 - .../jsdocTemplateConstructorFunction.symbols | 5 - ...ocTemplateConstructorFunction.symbols.diff | 14 +- .../jsdocTemplateConstructorFunction.types | 3 - .../jsdocTemplateConstructorFunction2.symbols | 2 - ...cTemplateConstructorFunction2.symbols.diff | 8 -- .../jsdocTemplateConstructorFunction2.types | 4 - .../conformance/jsdocTemplateTag7.symbols | 2 - .../jsdocTemplateTag7.symbols.diff | 11 -- .../conformance/jsdocTemplateTag7.types | 2 - .../conformance/jsdocTemplateTag8.symbols | 9 -- .../jsdocTemplateTag8.symbols.diff | 32 ----- .../conformance/jsdocTemplateTag8.types | 14 -- .../jsdocTemplateTagDefault.symbols | 20 --- .../jsdocTemplateTagDefault.symbols.diff | 58 -------- .../conformance/jsdocTemplateTagDefault.types | 12 -- .../jsdocTemplateTagNameResolution.symbols | 5 - ...sdocTemplateTagNameResolution.symbols.diff | 15 -- .../jsdocTemplateTagNameResolution.types | 2 - ...peReferenceToImportOfClassExpression.types | 1 - ...eferenceToImportOfFunctionExpression.types | 1 - .../conformance/jsdocTypeTagCast.symbols | 13 -- .../conformance/jsdocTypeTagCast.symbols.diff | 76 ---------- .../conformance/linkTagEmit1.symbols | 9 -- .../conformance/linkTagEmit1.symbols.diff | 25 ---- .../submodule/conformance/linkTagEmit1.types | 9 -- .../conformance/moduleExportAssignment7.types | 2 - .../noAssertForUnparseableTypedefs.symbols | 2 - ...oAssertForUnparseableTypedefs.symbols.diff | 11 -- .../noAssertForUnparseableTypedefs.types | 2 - .../optionalBindingParameters3.symbols | 4 - .../optionalBindingParameters3.symbols.diff | 14 -- .../optionalBindingParameters3.types | 4 - .../recursiveTypeReferences2.symbols | 44 ------ .../recursiveTypeReferences2.symbols.diff | 72 ---------- .../recursiveTypeReferences2.types | 7 - .../submodule/conformance/seeTag4.types | 2 - .../templateInsideCallback.symbols | 4 - .../templateInsideCallback.symbols.diff | 14 +- .../conformance/templateInsideCallback.types | 12 -- .../submodule/conformance/thisTag3.symbols | 3 - .../conformance/thisTag3.symbols.diff | 12 +- .../submodule/conformance/thisTag3.types | 4 - .../conformance/typeTagNoErasure.symbols | 5 - .../conformance/typeTagNoErasure.symbols.diff | 14 -- .../conformance/typeTagNoErasure.types | 2 - ...typeTagOnFunctionReferencesGeneric.symbols | 6 - ...agOnFunctionReferencesGeneric.symbols.diff | 15 -- .../typeTagOnFunctionReferencesGeneric.types | 3 - .../conformance/typedefCrossModule.symbols | 29 +--- .../typedefCrossModule.symbols.diff | 41 +----- .../conformance/typedefCrossModule.types | 28 ---- .../conformance/typedefCrossModule3.types | 2 - .../conformance/typedefCrossModule4.types | 2 - .../conformance/typedefCrossModule5.types | 2 - .../conformance/typedefInnerNamepaths.symbols | 2 - .../typedefInnerNamepaths.symbols.diff | 11 -- .../conformance/typedefInnerNamepaths.types | 4 - .../typedefMultipleTypeParameters.symbols | 18 --- ...typedefMultipleTypeParameters.symbols.diff | 31 +--- .../typedefMultipleTypeParameters.types | 7 - .../typedefOnSemicolonClassElement.types | 2 - .../conformance/typedefOnStatements.symbols | 35 ----- .../typedefOnStatements.symbols.diff | 101 +------------ .../conformance/typedefOnStatements.types | 53 ------- .../submodule/conformance/typedefScope1.types | 4 - .../typedefTagExtraneousProperty.symbols | 2 - .../typedefTagExtraneousProperty.symbols.diff | 9 +- .../typedefTagExtraneousProperty.types | 2 - .../conformance/typedefTagNested.symbols | 2 - .../conformance/typedefTagNested.symbols.diff | 11 -- .../conformance/typedefTagNested.types | 24 ---- .../typedefTagTypeResolution.symbols | 3 - .../typedefTagTypeResolution.symbols.diff | 12 -- .../typedefTagTypeResolution.types | 2 - .../conformance/typedefTagWrapping.symbols | 15 -- .../typedefTagWrapping.symbols.diff | 59 -------- .../conformance/typedefTagWrapping.types | 12 -- ...eckJsTypeDefNoUnusedLocalMarked.types.diff | 9 +- ...JsdocTypeTagOnExportAssignment1.types.diff | 14 +- ...JsdocTypeTagOnExportAssignment3.types.diff | 17 +-- ...JsdocTypeTagOnExportAssignment4.types.diff | 2 - ...JsdocTypeTagOnExportAssignment5.types.diff | 16 +-- ...JsdocTypeTagOnExportAssignment6.types.diff | 16 +-- ...JsdocTypeTagOnExportAssignment7.types.diff | 17 +-- ...JsdocTypeTagOnExportAssignment8.types.diff | 14 +- ...yTypedParametersOptionalInJSDoc.types.diff | 12 +- ...nferenceFromAnnotatedFunctionJs.types.diff | 15 +- ...xpandoFunctionContextualTypesJs.types.diff | 17 +-- .../exportDefaultWithJSDoc1.types.diff | 7 +- .../exportDefaultWithJSDoc2.types.diff | 7 +- ...larationEmitDoesNotRenameImport.types.diff | 15 +- ...unctionWithExtraTypedefsMembers.types.diff | 13 +- .../jsDeclarationsInheritedTypes.types.diff | 23 --- ...tUseNodeModulesPathWithoutError.types.diff | 11 +- .../compiler/jsEnumCrossFileExport.types.diff | 14 +- .../jsEnumTagOnObjectFrozen.types.diff | 11 +- .../jsdocImportTypeResolution.types.diff | 14 -- .../jsdocPropertyTagInvalid.types.diff | 14 -- ...efBeforeParenthesizedExpression.types.diff | 18 --- .../jsdocTypedefMissingType.types.diff | 14 -- .../compiler/jsdocTypedefNoCrash.types.diff | 11 -- .../compiler/jsdocTypedefNoCrash2.types.diff | 11 -- ...jsdocTypedef_propertyWithNoType.types.diff | 14 -- .../misspelledJsDocTypedefTags.types.diff | 11 +- .../strictOptionalProperties3.types.diff | 21 +-- .../strictOptionalProperties4.types.diff | 12 +- .../compiler/topLevelBlockExpando.types.diff | 17 --- ...TypeConstraintInJSDocImportCall.types.diff | 12 -- .../assertionTypePredicates2.types.diff | 19 +-- ...ertionsAndNonReturningFunctions.types.diff | 9 +- .../checkJsdocSatisfiesTag1.types.diff | 39 +---- .../checkJsdocSatisfiesTag10.types.diff | 10 -- .../checkJsdocSatisfiesTag11.types.diff | 23 --- .../checkJsdocSatisfiesTag12.types.diff | 32 +---- .../checkJsdocSatisfiesTag14.types.diff | 14 -- .../checkJsdocSatisfiesTag2.types.diff | 6 +- .../checkJsdocSatisfiesTag4.types.diff | 26 ---- .../checkJsdocSatisfiesTag5.types.diff | 7 +- .../checkJsdocSatisfiesTag6.types.diff | 17 --- .../checkJsdocSatisfiesTag7.types.diff | 10 -- .../checkJsdocSatisfiesTag8.types.diff | 6 +- .../checkJsdocSatisfiesTag9.types.diff | 20 --- .../conformance/checkJsdocTypeTag4.types.diff | 12 +- .../conformance/checkJsdocTypeTag5.types.diff | 13 +- .../conformance/checkJsdocTypeTag7.types.diff | 13 +- .../checkJsdocTypedefInParamTag1.types.diff | 63 +------- ...checkJsdocTypedefOnlySourceFile.types.diff | 11 +- ...ontextualTypedSpecialAssignment.types.diff | 8 +- .../conformance/enumTagImported.types.diff | 8 +- .../conformance/extendsTag5.types.diff | 11 +- .../conformance/importTypeInJSDoc.types.diff | 10 +- .../importingExportingTypes.types.diff | 11 -- ...ctionClassesCjsExportAssignment.types.diff | 51 +------ ...portAliasExposedWithinNamespace.types.diff | 33 +---- ...tAliasExposedWithinNamespaceCjs.types.diff | 10 +- ...eclarationsImportNamespacedType.types.diff | 5 - ...jsDeclarationsImportTypeBundled.types.diff | 10 +- ...ameterTagReusesInputNodeInEmit1.types.diff | 8 +- ...ameterTagReusesInputNodeInEmit2.types.diff | 7 +- .../jsDeclarationsTypeAliases.types.diff | 12 +- ...clarationsTypedefAndImportTypes.types.diff | 20 +-- ...DeclarationsTypedefAndLatebound.types.diff | 11 +- .../jsDeclarationsTypedefFunction.types.diff | 11 +- ...edefPropertyAndExportAssignment.types.diff | 27 +--- ...ocCatchClauseWithTypeAnnotation.types.diff | 17 --- .../conformance/jsdocImportType.types.diff | 8 +- .../conformance/jsdocImportType2.types.diff | 8 +- ...ImportTypeReferenceToClassAlias.types.diff | 2 - .../conformance/jsdocTemplateClass.types.diff | 21 +-- ...sdocTemplateConstructorFunction.types.diff | 13 +- ...docTemplateConstructorFunction2.types.diff | 12 -- .../conformance/jsdocTemplateTag7.types.diff | 11 -- .../conformance/jsdocTemplateTag8.types.diff | 42 +----- .../jsdocTemplateTagDefault.types.diff | 49 +------ .../jsdocTemplateTagNameResolution.types.diff | 11 +- ...erenceToImportOfClassExpression.types.diff | 1 - ...nceToImportOfFunctionExpression.types.diff | 5 +- .../conformance/linkTagEmit1.types.diff | 25 ---- .../moduleExportAssignment7.types.diff | 7 +- .../noAssertForUnparseableTypedefs.types.diff | 11 -- .../optionalBindingParameters3.types.diff | 13 +- .../recursiveTypeReferences2.types.diff | 21 +-- .../conformance/seeTag4.types.diff | 11 -- .../templateInsideCallback.types.diff | 24 +--- .../conformance/thisTag3.types.diff | 13 +- .../conformance/typeTagNoErasure.types.diff | 7 +- ...eTagOnFunctionReferencesGeneric.types.diff | 9 +- .../conformance/typedefCrossModule.types.diff | 47 +----- .../typedefCrossModule3.types.diff | 5 +- .../typedefCrossModule4.types.diff | 9 +- .../typedefCrossModule5.types.diff | 11 -- .../typedefInnerNamepaths.types.diff | 14 -- .../typedefMultipleTypeParameters.types.diff | 13 +- .../typedefOnSemicolonClassElement.types.diff | 11 -- .../typedefOnStatements.types.diff | 134 +----------------- .../conformance/typedefScope1.types.diff | 20 --- .../typedefTagExtraneousProperty.types.diff | 9 +- .../conformance/typedefTagNested.types.diff | 54 +------ .../typedefTagTypeResolution.types.diff | 12 +- .../conformance/typedefTagWrapping.types.diff | 60 +------- 355 files changed, 153 insertions(+), 4257 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/extendsTag5.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationsInheritedTypes.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeResolution.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocPropertyTagInvalid.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefBeforeParenthesizedExpression.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefMissingType.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash2.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedef_propertyWithNoType.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/topLevelBlockExpando.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag10.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag11.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag4.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag6.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag7.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag9.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importingExportingTypes.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag7.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/linkTagEmit1.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/seeTag4.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule5.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typedefOnSemicolonClassElement.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typedefScope1.types.diff diff --git a/internal/testutil/tsbaseline/type_symbol_baseline.go b/internal/testutil/tsbaseline/type_symbol_baseline.go index f70ec986cd..fdb9bda55a 100644 --- a/internal/testutil/tsbaseline/type_symbol_baseline.go +++ b/internal/testutil/tsbaseline/type_symbol_baseline.go @@ -202,9 +202,6 @@ func iterateBaseline(allFiles []*harnessutil.TestFile, fullWalker *typeWriterWal if isSymbolBaseline && result.symbol == "" { return baselines } - if lastIndexWritten > result.line { - continue - } if lastIndexWritten == -1 { typeLines.WriteString(strings.Join(codeLines[:result.line+1], "\r\n")) typeLines.WriteString("\r\n") @@ -213,10 +210,8 @@ func iterateBaseline(allFiles []*harnessutil.TestFile, fullWalker *typeWriterWal (bracketLineRegex.MatchString(codeLines[lastIndexWritten+1]) || strings.TrimSpace(codeLines[lastIndexWritten+1]) == "")) { typeLines.WriteString("\r\n") } - if lastIndexWritten < result.line { - typeLines.WriteString(strings.Join(codeLines[lastIndexWritten+1:result.line+1], "\r\n")) - typeLines.WriteString("\r\n") - } + typeLines.WriteString(strings.Join(codeLines[lastIndexWritten+1:result.line+1], "\r\n")) + typeLines.WriteString("\r\n") } lastIndexWritten = result.line typeOrSymbolString := core.IfElse(isSymbolBaseline, result.symbol, result.typ) @@ -321,6 +316,9 @@ func forEachASTNode(node *ast.Node) []*ast.Node { for len(work) > 0 { elem := work[len(work)-1] work = work[:len(work)-1] + if elem.Flags&ast.NodeFlagsReparsed != 0 && elem.Kind != ast.KindTypeAssertionExpression { + continue + } result = append(result, elem) elem.ForEachChild(addChild) slices.Reverse(resChildren) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols index cea04c23ee..5eb7764d5b 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols @@ -22,10 +22,7 @@ export = Foo; /** @typedef {typeof import("./file")} Foo */ /** @typedef {(foo: Foo) => string} FooFun */ ->foo : Symbol(foo, Decl(something.js, 2, 15)) ->Foo : Symbol(Foo, Decl(something.js, 0, 4)) module.exports = /** @type {FooFun} */(void 0); >module : Symbol(module, Decl(file.ts, 5, 7)) ->FooFun : Symbol(FooFun, Decl(something.js, 2, 4)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff index 3f396012f9..f3ed430fc8 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.symbols.diff @@ -9,17 +9,12 @@ } declare global { -@@= skipped -17, +17 lines =@@ - /** @typedef {typeof import("./file")} Foo */ - +@@= skipped -19, +19 lines =@@ /** @typedef {(foo: Foo) => string} FooFun */ -+>foo : Symbol(foo, Decl(something.js, 2, 15)) -+>Foo : Symbol(Foo, Decl(something.js, 0, 4)) module.exports = /** @type {FooFun} */(void 0); ->module.exports : Symbol(module.exports, Decl(something.js, 0, 0)) ->module : Symbol(export=, Decl(something.js, 0, 0)) ->exports : Symbol(export=, Decl(something.js, 0, 0)) +>module : Symbol(module, Decl(file.ts, 5, 7)) -+>FooFun : Symbol(FooFun, Decl(something.js, 2, 4)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types index 9f8cb54598..2ebc2e80a2 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.types @@ -20,11 +20,8 @@ export = Foo; === something.js === /** @typedef {typeof import("./file")} Foo */ ->Foo : any /** @typedef {(foo: Foo) => string} FooFun */ ->FooFun : any ->foo : typeof Foo module.exports = /** @type {FooFun} */(void 0); >module.exports = /** @type {FooFun} */(void 0) : (foo: typeof Foo) => string diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols index a355940acc..7d4e43a11e 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols @@ -10,8 +10,6 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 1, 3)) - export default { c: false }; >c : Symbol(c, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff deleted file mode 100644 index b7dd7b02a7..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment1.symbols -+++ new.checkJsdocTypeTagOnExportAssignment1.symbols -@@= skipped -9, +9 lines =@@ - */ - - /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 1, 3)) -+ - export default { c: false }; - >c : Symbol(c, Decl(a.js, 7, 16)) - diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.types index fbf2b1f948..fdc4ba3385 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.types @@ -5,14 +5,8 @@ === a.js === /** * @typedef {Object} Foo ->Foo : any - * @property {boolean} a ->a : any - * @property {boolean} b ->b : any - */ /** @type {Foo} */ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols index 8df54fabcf..8b219df576 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols @@ -15,8 +15,6 @@ export interface Foo { === b.js === /** @type {import("./a").Foo} */ ->Foo : Symbol(Foo, Decl(a.ts, 0, 0)) - export default { c: false }; >c : Symbol(c, Decl(b.js, 1, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols.diff index c443ee0b44..9392533fce 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.symbols.diff @@ -13,9 +13,3 @@ } === b.js === - /** @type {import("./a").Foo} */ -+>Foo : Symbol(Foo, Decl(a.ts, 0, 0)) -+ - export default { c: false }; - >c : Symbol(c, Decl(b.js, 1, 16)) - diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols index a815307498..ed178d097d 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols @@ -14,8 +14,6 @@ const bar = { c: 1 }; >c : Symbol(c, Decl(a.js, 6, 13)) /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 1, 3)) - export default bar; >bar : Symbol(bar, Decl(a.js, 6, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff deleted file mode 100644 index ff530648ef..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment3.symbols -+++ new.checkJsdocTypeTagOnExportAssignment3.symbols -@@= skipped -13, +13 lines =@@ - >c : Symbol(c, Decl(a.js, 6, 13)) - - /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 1, 3)) -+ - export default bar; - >bar : Symbol(bar, Decl(a.js, 6, 5)) - diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.types index 472f1f9e39..4d9d2874d4 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.types @@ -5,14 +5,8 @@ === a.js === /** * @typedef {Object} Foo ->Foo : any - * @property {boolean} a ->a : any - * @property {boolean} b ->b : any - */ const bar = { c: 1 }; diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols index 580af32d8a..0a31928944 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols @@ -3,13 +3,12 @@ === checkJsdocTypeTagOnExportAssignment4.js === === a.js === + /** * @typedef {number} Foo */ /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 1, 3)) - export default ""; diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff deleted file mode 100644 index 0e18346152..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.symbols.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment4.symbols -+++ new.checkJsdocTypeTagOnExportAssignment4.symbols -@@= skipped -2, +2 lines =@@ - === checkJsdocTypeTagOnExportAssignment4.js === - - === a.js === -- - /** - * @typedef {number} Foo - */ - - /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 1, 3)) -+ - export default ""; - - diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.types index ffe0cd121c..1917332358 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.types @@ -5,8 +5,6 @@ === a.js === /** * @typedef {number} Foo ->Foo : any - */ /** @type {Foo} */ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols index 3200a3d610..7241719456 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols @@ -10,8 +10,6 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 1, 3)) - export default { a: 1, b: 1 }; >a : Symbol(a, Decl(a.js, 7, 16)) >b : Symbol(b, Decl(a.js, 7, 22)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff deleted file mode 100644 index 4915f00693..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment5.symbols -+++ new.checkJsdocTypeTagOnExportAssignment5.symbols -@@= skipped -9, +9 lines =@@ - */ - - /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 1, 3)) -+ - export default { a: 1, b: 1 }; - >a : Symbol(a, Decl(a.js, 7, 16)) - >b : Symbol(b, Decl(a.js, 7, 22)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.types index 0f6a37eeb8..f90d3c5440 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.types @@ -5,14 +5,8 @@ === a.js === /** * @typedef {Object} Foo ->Foo : any - * @property {number} a ->a : any - * @property {number} b ->b : any - */ /** @type {Foo} */ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols index c93e85fc46..6ad4743a12 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols @@ -10,8 +10,6 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 1, 3)) - export default { a: 1, b: 1, c: 1 }; >a : Symbol(a, Decl(a.js, 7, 16)) >b : Symbol(b, Decl(a.js, 7, 22)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff deleted file mode 100644 index f30dde3a1f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment6.symbols -+++ new.checkJsdocTypeTagOnExportAssignment6.symbols -@@= skipped -9, +9 lines =@@ - */ - - /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 1, 3)) -+ - export default { a: 1, b: 1, c: 1 }; - >a : Symbol(a, Decl(a.js, 7, 16)) - >b : Symbol(b, Decl(a.js, 7, 22)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.types index f13666367e..6a755b6417 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.types @@ -5,14 +5,8 @@ === a.js === /** * @typedef {Object} Foo ->Foo : any - * @property {number} a ->a : any - * @property {number} b ->b : any - */ /** @type {Foo} */ diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols index 2215eccc83..679099f3e2 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols @@ -16,8 +16,6 @@ const abc = { a: 1, b: 1, c: 1 }; >c : Symbol(c, Decl(a.js, 6, 25)) /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 1, 3)) - export default abc; >abc : Symbol(abc, Decl(a.js, 6, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff deleted file mode 100644 index 20acc5bdd3..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment7.symbols -+++ new.checkJsdocTypeTagOnExportAssignment7.symbols -@@= skipped -15, +15 lines =@@ - >c : Symbol(c, Decl(a.js, 6, 25)) - - /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 1, 3)) -+ - export default abc; - >abc : Symbol(abc, Decl(a.js, 6, 5)) - diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.types index fba666e3db..981d52c5eb 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.types @@ -5,14 +5,8 @@ === a.js === /** * @typedef {Object} Foo ->Foo : any - * @property {number} a ->a : any - * @property {number} b ->b : any - */ const abc = { a: 1, b: 1, c: 1 }; diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols index 5d5368d511..4e606e8a8b 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols @@ -10,8 +10,6 @@ */ /** @type {Foo} */ ->Foo : Symbol(Foo, Decl(a.js, 1, 3)) - export default { a: 'a', >a : Symbol(a, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff deleted file mode 100644 index 9a2d222cfd..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment8.symbols -+++ new.checkJsdocTypeTagOnExportAssignment8.symbols -@@= skipped -9, +9 lines =@@ - */ - - /** @type {Foo} */ -+>Foo : Symbol(Foo, Decl(a.js, 1, 3)) -+ - export default { - a: 'a', - >a : Symbol(a, Decl(a.js, 7, 16)) diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.types b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.types index 0360a6c914..7b4ec2e042 100644 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.types +++ b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment8.types @@ -5,14 +5,8 @@ === a.js === /** * @typedef Foo ->Foo : any - * @property {string} a ->a : any - * @property {'b'} b ->b : any - */ /** @type {Foo} */ diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols index 0f44c6a207..d269ac573e 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols @@ -11,9 +11,6 @@ function acceptNum(num) {} /** * @typedef {(a: string, b: number) => void} Fn ->a : Symbol(a, Decl(index.js, 7, 14)) ->b : Symbol(b, Decl(index.js, 7, 24)) - */ /** @type {Fn} */ diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols.diff b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols.diff deleted file mode 100644 index fdc1613862..0000000000 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.symbols.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.contextuallyTypedParametersOptionalInJSDoc.symbols -+++ new.contextuallyTypedParametersOptionalInJSDoc.symbols -@@= skipped -10, +10 lines =@@ - - /** - * @typedef {(a: string, b: number) => void} Fn -+>a : Symbol(a, Decl(index.js, 7, 14)) -+>b : Symbol(b, Decl(index.js, 7, 24)) -+ - */ - - /** @type {Fn} */ diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.types b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.types index 6da5e45104..7fe7125499 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.types +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersOptionalInJSDoc.types @@ -11,10 +11,6 @@ function acceptNum(num) {} /** * @typedef {(a: string, b: number) => void} Fn ->Fn : any ->a : string ->b : number - */ /** @type {Fn} */ diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols index a4bcfa0e77..447299b80a 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols @@ -3,15 +3,8 @@ === index.js === /** * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs ->Funcs : Symbol(Funcs, Decl(index.js, 1, 3)) - * @template A ->A : Symbol(A, Decl(index.js, 2, 13)) - * @template {Record} B ->B : Symbol(B, Decl(index.js, 3, 39)) ->Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) - */ /** diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff deleted file mode 100644 index c1dd5f32c1..0000000000 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols -+++ new.contravariantOnlyInferenceFromAnnotatedFunctionJs.symbols -@@= skipped -2, +2 lines =@@ - === index.js === - /** - * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs -+>Funcs : Symbol(Funcs, Decl(index.js, 1, 3)) -+ - * @template A -+>A : Symbol(A, Decl(index.js, 2, 13)) -+ - * @template {Record} B -+>B : Symbol(B, Decl(index.js, 3, 39)) -+>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) -+ - */ - - /** diff --git a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types index d1a366ae78..1e4bd26212 100644 --- a/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types +++ b/testdata/baselines/reference/submodule/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types @@ -3,12 +3,6 @@ === index.js === /** * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs ->Funcs : Funcs ->fn : (a: A, b: B) => void ->a : A ->b : B ->thing : B[K] - * @template A * @template {Record} B */ diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols index 1108ab436e..6096d22301 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols @@ -2,14 +2,10 @@ === input.js === /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ ->color : Symbol(color, Decl(input.js, 0, 15)) /** * @template P * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ ->defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23)) ->Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) ->P : Symbol(P) /** * @type {StatelessComponent} diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff index 4a522827b0..372acfcf31 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.symbols.diff @@ -1,19 +1,6 @@ --- old.expandoFunctionContextualTypesJs.symbols +++ new.expandoFunctionContextualTypesJs.symbols -@@= skipped -1, +1 lines =@@ - - === input.js === - /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ -+>color : Symbol(color, Decl(input.js, 0, 15)) - - /** - * @template P - * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ -+>defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23)) -+>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) -+>P : Symbol(P) - - /** +@@= skipped -10, +10 lines =@@ * @type {StatelessComponent} */ const MyComponent = () => /* @type {any} */(null); @@ -27,7 +14,7 @@ >defaultProps : Symbol(defaultProps, Decl(input.js, 4, 23)) color: "red" -@@= skipped -22, +26 lines =@@ +@@= skipped -13, +13 lines =@@ }; const MyComponent2 = () => null; diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types index 6168f17d72..002b1288c6 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.types @@ -2,14 +2,10 @@ === input.js === /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ ->MyComponentProps : any ->color : "blue" | "red" /** * @template P * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ ->StatelessComponent : any ->defaultProps : P /** * @type {StatelessComponent} diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols index 43128a1875..43a0a20b31 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols @@ -1,13 +1,13 @@ //// [tests/cases/compiler/exportDefaultWithJSDoc1.ts] //// === a.js === + /** * A number, or a string containing a number. * @typedef {(number|string)} NumberLike */ /** @type {NumberLike[]} */export default ([ ]); ->NumberLike : Symbol(NumberLike, Decl(a.js, 2, 3)) === b.ts === import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff deleted file mode 100644 index 8849d09e2f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.symbols.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.exportDefaultWithJSDoc1.symbols -+++ new.exportDefaultWithJSDoc1.symbols -@@= skipped -0, +0 lines =@@ - //// [tests/cases/compiler/exportDefaultWithJSDoc1.ts] //// - - === a.js === -- - /** - * A number, or a string containing a number. - * @typedef {(number|string)} NumberLike - */ - - /** @type {NumberLike[]} */export default ([ ]); -+>NumberLike : Symbol(NumberLike, Decl(a.js, 2, 3)) - - === b.ts === - import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types index f135d8d52e..03b13b004b 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc1.types @@ -4,8 +4,6 @@ /** * A number, or a string containing a number. * @typedef {(number|string)} NumberLike ->NumberLike : any - */ /** @type {NumberLike[]} */export default ([ ]); diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols index cef7615dbd..fe525263a6 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols @@ -1,13 +1,13 @@ //// [tests/cases/compiler/exportDefaultWithJSDoc2.ts] //// === a.js === + /** * A number, or a string containing a number. * @typedef {(number|string)} NumberLike */ export default /** @type {NumberLike[]} */([ ]); ->NumberLike : Symbol(NumberLike, Decl(a.js, 2, 3)) === b.ts === import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols.diff deleted file mode 100644 index 7e477e9cc1..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.symbols.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.exportDefaultWithJSDoc2.symbols -+++ new.exportDefaultWithJSDoc2.symbols -@@= skipped -0, +0 lines =@@ - //// [tests/cases/compiler/exportDefaultWithJSDoc2.ts] //// - - === a.js === -- - /** - * A number, or a string containing a number. - * @typedef {(number|string)} NumberLike - */ - - export default /** @type {NumberLike[]} */([ ]); -+>NumberLike : Symbol(NumberLike, Decl(a.js, 2, 3)) - - === b.ts === - import A from './a' diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types index 157888535f..cf343ba62c 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultWithJSDoc2.types @@ -4,8 +4,6 @@ /** * A number, or a string containing a number. * @typedef {(number|string)} NumberLike ->NumberLike : any - */ export default /** @type {NumberLike[]} */([ ]); diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols index 800b1f390e..8918628870 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols @@ -23,8 +23,6 @@ import Test from './test/Test.js' /** * @typedef {Object} Options * @property {typeof import("./Test.js").default} [test] ->default : Symbol(default, Decl(Test.js, 1, 13)) - */ class X extends Test { diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff index 6b5df32b6e..23c36473e0 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.symbols.diff @@ -1,15 +1,6 @@ --- old.jsDeclarationEmitDoesNotRenameImport.symbols +++ new.jsDeclarationEmitDoesNotRenameImport.symbols -@@= skipped -22, +22 lines =@@ - /** - * @typedef {Object} Options - * @property {typeof import("./Test.js").default} [test] -+>default : Symbol(default, Decl(Test.js, 1, 13)) -+ - */ - - class X extends Test { -@@= skipped -21, +23 lines =@@ +@@= skipped -43, +43 lines =@@ >test : Symbol(test, Decl(index.js, 4, 3)) this.test = new options.test(); diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.types b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.types index f25e100567..7153b102ef 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.types +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitDoesNotRenameImport.types @@ -22,12 +22,7 @@ import Test from './test/Test.js' /** * @typedef {Object} Options ->Options : any - * @property {typeof import("./Test.js").default} [test] ->test : any ->default : any - */ class X extends Test { diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types index 37be3d3b60..3297612520 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types @@ -3,11 +3,7 @@ === index.js === /** * @typedef Options ->Options : any - * @property {string} opt ->opt : any - */ /** diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.types b/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.types index 22dc7e1940..1dadd19467 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.types +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationsInheritedTypes.types @@ -3,20 +3,12 @@ === a.js === /** * @typedef A ->A : any - * @property {string} a ->a : any - */ /** * @typedef B ->B : any - * @property {number} b ->b : any - */ class C1 { diff --git a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols index 735cd9e75e..720799fe65 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols @@ -16,8 +16,6 @@ export interface LionRequestInit { === index.js === /** * @typedef {import('@lion/ajax').LionRequestInit} LionRequestInit ->LionRequestInit : Symbol(LionRequestInit, Decl(index.d.ts, 0, 0)) - */ export class NewAjax { diff --git a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols.diff index 22c27784e1..481d6e020e 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.symbols.diff @@ -9,14 +9,7 @@ >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) } === index.js === - /** - * @typedef {import('@lion/ajax').LionRequestInit} LionRequestInit -+>LionRequestInit : Symbol(LionRequestInit, Decl(index.d.ts, 0, 0)) -+ - */ - - export class NewAjax { -@@= skipped -15, +17 lines =@@ +@@= skipped -15, +15 lines =@@ * @param {LionRequestInit} [init] */ case5_unexpectedlyResolvesPathToNodeModules(init) {} diff --git a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types index 9cfdb8fa8f..da661d7226 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types +++ b/testdata/baselines/reference/submodule/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types @@ -12,8 +12,6 @@ export interface LionRequestInit { === index.js === /** * @typedef {import('@lion/ajax').LionRequestInit} LionRequestInit ->LionRequestInit : any - */ export class NewAjax { diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types index b28e537bba..f3d61380fc 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.types @@ -41,14 +41,10 @@ Host.UserMetrics.Action = { }; /** * @typedef {string} Host.UserMetrics.Bargh ->Host : any - */ /** * @typedef {string} */ -> : any - Host.UserMetrics.Blah = { >Host.UserMetrics.Blah = { x: 12} : { x: number; } >Host.UserMetrics.Blah : any diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types index 83333f0cb4..a845130443 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types @@ -18,14 +18,8 @@ useThing(Thing.a); /** * @typedef {Object} LogEntry ->LogEntry : any - * @property {string} type ->type : any - * @property {number} time ->time : any - */ cbThing(type => { diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols index d915577cf7..460e4edd9d 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols @@ -9,8 +9,6 @@ export class MyClass { /** * @typedef {Object} options * @property {import("./module").MyClass} option ->MyClass : Symbol(MyClass, Decl(module.js, 0, 0)) - */ /** @type {options} */ let v; diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols.diff deleted file mode 100644 index 1844e275a7..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsdocImportTypeResolution.symbols -+++ new.jsdocImportTypeResolution.symbols -@@= skipped -8, +8 lines =@@ - /** - * @typedef {Object} options - * @property {import("./module").MyClass} option -+>MyClass : Symbol(MyClass, Decl(module.js, 0, 0)) -+ - */ - /** @type {options} */ - let v; diff --git a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.types b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.types index 30790eb71a..5dfcd2bb11 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocImportTypeResolution.types @@ -8,11 +8,7 @@ export class MyClass { === usage.js === /** * @typedef {Object} options ->options : any - * @property {import("./module").MyClass} option ->option : any - */ /** @type {options} */ let v; diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols index e7ace365e2..6e1d52ce2c 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols @@ -3,12 +3,7 @@ === /a.js === /** * @typedef MyType ->MyType : Symbol(MyType, Decl(a.js, 1, 3)) - * @property {sting} [x] ->x : Symbol(x, Decl(a.js, 2, 3)) ->sting : Symbol(sting) - */ /** @param {MyType} p */ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff deleted file mode 100644 index 2f081da31f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.symbols.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.jsdocPropertyTagInvalid.symbols -+++ new.jsdocPropertyTagInvalid.symbols -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef MyType -+>MyType : Symbol(MyType, Decl(a.js, 1, 3)) -+ - * @property {sting} [x] -+>x : Symbol(x, Decl(a.js, 2, 3)) -+>sting : Symbol(sting) -+ - */ - - /** @param {MyType} p */ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.types b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.types index 896580c8ba..53f50b7fe4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocPropertyTagInvalid.types @@ -3,11 +3,7 @@ === /a.js === /** * @typedef MyType ->MyType : MyType - * @property {sting} [x] ->x : any - */ /** @param {MyType} p */ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.types b/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.types index 8971fa2a51..6a018ffbb1 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefBeforeParenthesizedExpression.types @@ -3,7 +3,6 @@ === test.js === // @ts-check /** @typedef {number} NotADuplicateIdentifier */ ->NotADuplicateIdentifier : any (2 * 2); >(2 * 2) : number @@ -12,7 +11,6 @@ >2 : 2 /** @typedef {number} AlsoNotADuplicate */ ->AlsoNotADuplicate : any (2 * 2) + 1; >(2 * 2) + 1 : number diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.types b/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.types index 6632c27319..f011988191 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefMissingType.types @@ -11,11 +11,7 @@ const t = 0; // OK: missing a type, but have property tags. /** * @typedef Person ->Person : any - * @property {string} name ->name : any - */ /** @type Person */ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash.types b/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash.types index f6c2cab92f..6ec8528809 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash.types @@ -5,8 +5,6 @@ * @typedef {{ * }} */ -> : any - export const foo = 5; >foo : 5 >5 : 5 diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash2.types b/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash2.types index f02a712c37..52022acf9f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash2.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedefNoCrash2.types @@ -8,8 +8,6 @@ export type foo = 5; * @typedef {{ * }} */ -> : any - export const foo = 5; >foo : 5 >5 : 5 diff --git a/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.types b/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.types index 464ba9c003..3b56be2744 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocTypedef_propertyWithNoType.types @@ -3,11 +3,7 @@ === /a.js === /** * @typedef Foo ->Foo : any - * @property foo ->foo : any - */ /** @type {Foo} */ diff --git a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols index e62fc831b9..8966879565 100644 --- a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols +++ b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols @@ -2,17 +2,10 @@ === a.js === /** @typedef {{ endTime: number, screenshots: number}} A.*/ ->endTime : Symbol(endTime, Decl(a.js, 0, 15)) ->screenshots : Symbol(screenshots, Decl(a.js, 0, 32)) - Animation.AnimationModel.ScreenshotCapture.Request; >Animation : Symbol(Animation, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) /** @typedef {{ endTime: number, screenshots: !B.}} */ ->endTime : Symbol(endTime, Decl(a.js, 3, 15)) ->screenshots : Symbol(screenshots, Decl(a.js, 3, 32)) ->B : Symbol(B) - Animation.AnimationModel.ScreenshotCapture.Request; >Animation : Symbol(Animation, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols.diff b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols.diff index 8f9abaee28..f0f580cc36 100644 --- a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.symbols.diff @@ -1,21 +1,13 @@ --- old.misspelledJsDocTypedefTags.symbols +++ new.misspelledJsDocTypedefTags.symbols -@@= skipped -1, +1 lines =@@ - +@@= skipped -2, +2 lines =@@ === a.js === /** @typedef {{ endTime: number, screenshots: number}} A.*/ -+>endTime : Symbol(endTime, Decl(a.js, 0, 15)) -+>screenshots : Symbol(screenshots, Decl(a.js, 0, 32)) -+ Animation.AnimationModel.ScreenshotCapture.Request; ->Animation : Symbol(Animation, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(a.js, 1, 51)) +>Animation : Symbol(Animation, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) /** @typedef {{ endTime: number, screenshots: !B.}} */ -+>endTime : Symbol(endTime, Decl(a.js, 3, 15)) -+>screenshots : Symbol(screenshots, Decl(a.js, 3, 32)) -+>B : Symbol(B) -+ Animation.AnimationModel.ScreenshotCapture.Request; ->Animation : Symbol(Animation, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(a.js, 1, 51)) +>Animation : Symbol(Animation, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.types b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.types index 9fc00e5e93..a9510d2efc 100644 --- a/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.types +++ b/testdata/baselines/reference/submodule/compiler/misspelledJsDocTypedefTags.types @@ -2,10 +2,6 @@ === a.js === /** @typedef {{ endTime: number, screenshots: number}} A.*/ ->A : any ->endTime : number ->screenshots : number - Animation.AnimationModel.ScreenshotCapture.Request; >Animation.AnimationModel.ScreenshotCapture.Request : any >Animation.AnimationModel.ScreenshotCapture : any @@ -16,10 +12,6 @@ Animation.AnimationModel.ScreenshotCapture.Request; >Request : any /** @typedef {{ endTime: number, screenshots: !B.}} */ -> : any ->endTime : number ->screenshots : B - Animation.AnimationModel.ScreenshotCapture.Request; >Animation.AnimationModel.ScreenshotCapture.Request : any >Animation.AnimationModel.ScreenshotCapture : any diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols index ba44e726eb..955e08e186 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols @@ -14,8 +14,6 @@ const a = { value: undefined }; // error /** * @typedef {{ value?: number }} B ->value : Symbol(value, Decl(a.js, 9, 14)) - */ /** @type {B} */ diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols.diff b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols.diff deleted file mode 100644 index ea8ef43ced..0000000000 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.strictOptionalProperties3.symbols -+++ new.strictOptionalProperties3.symbols -@@= skipped -13, +13 lines =@@ - - /** - * @typedef {{ value?: number }} B -+>value : Symbol(value, Decl(a.js, 9, 14)) -+ - */ - - /** @type {B} */ diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types index 76173298d4..72d35c1e04 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties3.types @@ -3,11 +3,7 @@ === a.js === /** * @typedef {object} A ->A : any - * @property {number} [value] ->value : any - */ /** @type {A} */ @@ -19,9 +15,6 @@ const a = { value: undefined }; // error /** * @typedef {{ value?: number }} B ->B : any ->value : number | undefined - */ /** @type {B} */ diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols index 0a0d1c6bfa..f048b853b5 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols @@ -8,7 +8,6 @@ const x = /** @type {Foo} */ ({}); >x : Symbol(x, Decl(a.js, 5, 5)) ->Foo : Symbol(Foo, Decl(a.js, 1, 3)) x.foo; // number | undefined >x.foo : Symbol(foo, Decl(a.js, 2, 3)) @@ -17,8 +16,6 @@ x.foo; // number | undefined const y = /** @type {Required} */ ({}); >y : Symbol(y, Decl(a.js, 8, 5)) ->Required : Symbol(Required, Decl(lib.es5.d.ts, --, --)) ->Foo : Symbol(Foo, Decl(a.js, 1, 3)) y.foo; // number >y.foo : Symbol(foo, Decl(a.js, 2, 3)) diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff deleted file mode 100644 index 35464aa841..0000000000 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.symbols.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.strictOptionalProperties4.symbols -+++ new.strictOptionalProperties4.symbols -@@= skipped -7, +7 lines =@@ - - const x = /** @type {Foo} */ ({}); - >x : Symbol(x, Decl(a.js, 5, 5)) -+>Foo : Symbol(Foo, Decl(a.js, 1, 3)) - - x.foo; // number | undefined - >x.foo : Symbol(foo, Decl(a.js, 2, 3)) -@@= skipped -8, +9 lines =@@ - - const y = /** @type {Required} */ ({}); - >y : Symbol(y, Decl(a.js, 8, 5)) -+>Required : Symbol(Required, Decl(lib.es5.d.ts, --, --)) -+>Foo : Symbol(Foo, Decl(a.js, 1, 3)) - - y.foo; // number - >y.foo : Symbol(foo, Decl(a.js, 2, 3)) diff --git a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types index 94bd2ffabb..1773918b3c 100644 --- a/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types +++ b/testdata/baselines/reference/submodule/compiler/strictOptionalProperties4.types @@ -3,11 +3,7 @@ === a.js === /** * @typedef Foo ->Foo : any - * @property {number} [foo] ->foo : any - */ const x = /** @type {Foo} */ ({}); diff --git a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols index 2664bb14e8..6cbefeb2fe 100644 --- a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols +++ b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols @@ -42,14 +42,8 @@ interface Person { // Creates a type { first:string, last: string } /** * @typedef {Object} Human - creates a new type named 'SpecialType' ->Human : Symbol(Human, Decl(check.js, 2, 3)) - * @property {string} first - a string property of SpecialType ->first : Symbol(first, Decl(check.js, 3, 3)) - * @property {string} last - a number property of SpecialType ->last : Symbol(last, Decl(check.js, 4, 3)) - */ /** diff --git a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols.diff b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols.diff index 7c82553382..4c70cc91e9 100644 --- a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.symbols.diff @@ -42,22 +42,7 @@ const diceP: Person = dice; >diceP : Symbol(diceP, Decl(check.ts, 10, 7)) -@@= skipped -36, +36 lines =@@ - // Creates a type { first:string, last: string } - /** - * @typedef {Object} Human - creates a new type named 'SpecialType' -+>Human : Symbol(Human, Decl(check.js, 2, 3)) -+ - * @property {string} first - a string property of SpecialType -+>first : Symbol(first, Decl(check.js, 3, 3)) -+ - * @property {string} last - a number property of SpecialType -+>last : Symbol(last, Decl(check.js, 4, 3)) -+ - */ - - /** -@@= skipped -12, +18 lines =@@ +@@= skipped -48, +48 lines =@@ >param : Symbol(param, Decl(check.js, 10, 23)) const dice1 = () => Math.floor(Math.random() * 6); diff --git a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.types b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.types index 65a91cc07c..04cb4fe45a 100644 --- a/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.types +++ b/testdata/baselines/reference/submodule/compiler/topLevelBlockExpando.types @@ -48,14 +48,8 @@ interface Person { // Creates a type { first:string, last: string } /** * @typedef {Object} Human - creates a new type named 'SpecialType' ->Human : Human - * @property {string} first - a string property of SpecialType ->first : any - * @property {string} last - a number property of SpecialType ->last : any - */ /** diff --git a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols index 92068f8345..3261aa97e0 100644 --- a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols +++ b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols @@ -1,12 +1,10 @@ //// [tests/cases/compiler/unmetTypeConstraintInJSDocImportCall.ts] //// === file1.js === + /** * @template {string} T * @typedef {{ foo: T }} Foo ->foo : Symbol(foo, Decl(file1.js, 2, 14)) ->T : Symbol(T) - */ export default {}; diff --git a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols.diff b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols.diff deleted file mode 100644 index a14c8a2cce..0000000000 --- a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.symbols.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.unmetTypeConstraintInJSDocImportCall.symbols -+++ new.unmetTypeConstraintInJSDocImportCall.symbols -@@= skipped -0, +0 lines =@@ - //// [tests/cases/compiler/unmetTypeConstraintInJSDocImportCall.ts] //// - - === file1.js === -- - /** - * @template {string} T - * @typedef {{ foo: T }} Foo -+>foo : Symbol(foo, Decl(file1.js, 2, 14)) -+>T : Symbol(T) -+ - */ - - export default {}; diff --git a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.types b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.types index 264a48a540..e954cca2fb 100644 --- a/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.types +++ b/testdata/baselines/reference/submodule/compiler/unmetTypeConstraintInJSDocImportCall.types @@ -4,9 +4,6 @@ /** * @template {string} T * @typedef {{ foo: T }} Foo ->Foo : any ->foo : T - */ export default {}; diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols index fdaa9d2161..2bb05c5574 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols @@ -3,15 +3,10 @@ === assertionTypePredicates2.js === /** * @typedef {{ x: number }} A ->x : Symbol(x, Decl(assertionTypePredicates2.js, 1, 14)) - */ /** * @typedef { A & { y: number } } B ->A : Symbol(A, Decl(assertionTypePredicates2.js, 1, 3)) ->y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) - */ /** @@ -24,7 +19,6 @@ const foo = (a) => { if (/** @type { B } */ (a).y !== 0) throw TypeError(); >(a).y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) ->B : Symbol(B, Decl(assertionTypePredicates2.js, 5, 3)) >a : Symbol(a, Decl(assertionTypePredicates2.js, 12, 13)) >y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) >TypeError : Symbol(TypeError, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff deleted file mode 100644 index 22d84b1ddb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.symbols.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.assertionTypePredicates2.symbols -+++ new.assertionTypePredicates2.symbols -@@= skipped -2, +2 lines =@@ - === assertionTypePredicates2.js === - /** - * @typedef {{ x: number }} A -+>x : Symbol(x, Decl(assertionTypePredicates2.js, 1, 14)) -+ - */ - - /** - * @typedef { A & { y: number } } B -+>A : Symbol(A, Decl(assertionTypePredicates2.js, 1, 3)) -+>y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) -+ - */ - - /** -@@= skipped -16, +21 lines =@@ - - if (/** @type { B } */ (a).y !== 0) throw TypeError(); - >(a).y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) -+>B : Symbol(B, Decl(assertionTypePredicates2.js, 5, 3)) - >a : Symbol(a, Decl(assertionTypePredicates2.js, 12, 13)) - >y : Symbol(y, Decl(assertionTypePredicates2.js, 5, 19)) - >TypeError : Symbol(TypeError, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types index d6c2d6f444..8aaa0c1341 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types +++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.types @@ -3,16 +3,10 @@ === assertionTypePredicates2.js === /** * @typedef {{ x: number }} A ->A : any ->x : number - */ /** * @typedef { A & { y: number } } B ->B : any ->y : number - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols index 62da319359..5f8301528a 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols @@ -2,8 +2,6 @@ === assertionsAndNonReturningFunctions.js === /** @typedef {(check: boolean) => asserts check} AssertFunc */ ->check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 0, 15)) ->check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 0, 15)) /** @type {AssertFunc} */ const assert = check => { diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff index 1348a4378f..9040133d0e 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.symbols.diff @@ -1,15 +1,6 @@ --- old.assertionsAndNonReturningFunctions.symbols +++ new.assertionsAndNonReturningFunctions.symbols -@@= skipped -1, +1 lines =@@ - - === assertionsAndNonReturningFunctions.js === - /** @typedef {(check: boolean) => asserts check} AssertFunc */ -+>check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 0, 15)) -+>check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 0, 15)) - - /** @type {AssertFunc} */ - const assert = check => { -@@= skipped -57, +59 lines =@@ +@@= skipped -58, +58 lines =@@ >x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) x.length; diff --git a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types index fddd606b3a..460c077286 100644 --- a/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types +++ b/testdata/baselines/reference/submodule/conformance/assertionsAndNonReturningFunctions.types @@ -2,8 +2,6 @@ === assertionsAndNonReturningFunctions.js === /** @typedef {(check: boolean) => asserts check} AssertFunc */ ->AssertFunc : any ->check : boolean /** @type {AssertFunc} */ const assert = check => { diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols index 6d630c1741..41e26adfcd 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols @@ -13,8 +13,6 @@ /** * @typedef {(x: string) => string} T3 ->x : Symbol(x, Decl(a.js, 11, 14)) - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff index f794869a16..d1e4e15083 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.symbols.diff @@ -1,15 +1,6 @@ --- old.checkJsdocSatisfiesTag1.symbols +++ new.checkJsdocSatisfiesTag1.symbols -@@= skipped -12, +12 lines =@@ - - /** - * @typedef {(x: string) => string} T3 -+>x : Symbol(x, Decl(a.js, 11, 14)) -+ - */ - - /** -@@= skipped -28, +30 lines =@@ +@@= skipped -40, +40 lines =@@ const t5 = /** @satisfies {T3} */((m) => m.substring(0)); >t5 : Symbol(t5, Decl(a.js, 27, 5)) >m : Symbol(m, Decl(a.js, 27, 35)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types index e634920431..565314abff 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag1.types @@ -3,36 +3,21 @@ === /a.js === /** * @typedef {Object} T1 ->T1 : any - * @property {number} a ->a : any - */ /** * @typedef {Object} T2 ->T2 : any - * @property {"a" | "b"} a ->a : any - */ /** * @typedef {(x: string) => string} T3 ->T3 : any ->x : string - */ /** * @typedef {Object} T4 ->T4 : any - * @property {string} a ->a : any - */ const t1 = /** @satisfies {T1} */ ({ a: 1 }); diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag10.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag10.types index f887551f83..19bb42f761 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag10.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag10.types @@ -2,7 +2,6 @@ === /a.js === /** @typedef {"a" | "b" | "c" | "d"} Keys */ ->Keys : any const p = /** @satisfies {Partial>} */ ({ >p : { a: number; b: string; x: number; } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag11.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag11.types index 3a3cc9f3d5..a9dfcaf190 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag11.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag11.types @@ -3,20 +3,12 @@ === /a.js === /** * @typedef {Object} T1 ->T1 : any - * @property {number} a ->a : any - */ /** * @typedef {Object} T2 ->T2 : any - * @property {number} a ->a : any - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag12.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag12.types index 2cdf70a246..fcfbd26652 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag12.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag12.types @@ -3,29 +3,17 @@ === /a.js === /** * @typedef {Object} T1 ->T1 : any - * @property {number} a ->a : any - */ /** * @typedef {Object} T2 ->T2 : any - * @property {string} a ->a : any - */ /** * @typedef {Object} T3 ->T3 : any - * @property {"a" | "b"} a ->a : any - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.types index 742c37edf6..be25ed76fd 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.types @@ -3,11 +3,7 @@ === /a.js === /** * @typedef {Object} T1 ->T1 : any - * @property {number} a ->a : any - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols index 18be0a482f..c40b2a537b 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols @@ -2,8 +2,6 @@ === /a.js === /** @typedef {Object. boolean>} Predicates */ ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->n : Symbol(n, Decl(a.js, 0, 31)) const p = /** @satisfies {Predicates} */ ({ >p : Symbol(p, Decl(a.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols.diff deleted file mode 100644 index 9da3a96d3b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.checkJsdocSatisfiesTag2.symbols -+++ new.checkJsdocSatisfiesTag2.symbols -@@= skipped -1, +1 lines =@@ - - === /a.js === - /** @typedef {Object. boolean>} Predicates */ -+>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -+>n : Symbol(n, Decl(a.js, 0, 31)) - - const p = /** @satisfies {Predicates} */ ({ - >p : Symbol(p, Decl(a.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.types index 87511df84e..8682c675f8 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag2.types @@ -2,8 +2,6 @@ === /a.js === /** @typedef {Object. boolean>} Predicates */ ->Predicates : any ->n : number const p = /** @satisfies {Predicates} */ ({ >p : { isEven: (n: any) => boolean; isOdd: (n: any) => boolean; } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag4.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag4.types index 2763282f44..0d01dd7d19 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag4.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag4.types @@ -3,11 +3,7 @@ === /a.js === /** * @typedef {Object} Foo ->Foo : any - * @property {number} a ->a : any - */ export default /** @satisfies {Foo} */ ({}); >({}) : {} @@ -16,11 +12,7 @@ export default /** @satisfies {Foo} */ ({}); === /b.js === /** * @typedef {Object} Foo ->Foo : any - * @property {number} a ->a : any - */ export default /** @satisfies {Foo} */ ({ a: 1 }); diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols index 10a0d373c8..93b511fee3 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols @@ -2,8 +2,6 @@ === /a.js === /** @typedef {{ move(distance: number): void }} Movable */ ->move : Symbol(move, Decl(a.js, 0, 15)) ->distance : Symbol(distance, Decl(a.js, 0, 21)) const car = /** @satisfies {Movable & Record} */ ({ >car : Symbol(car, Decl(a.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols.diff deleted file mode 100644 index 9e24738eab..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.checkJsdocSatisfiesTag5.symbols -+++ new.checkJsdocSatisfiesTag5.symbols -@@= skipped -1, +1 lines =@@ - - === /a.js === - /** @typedef {{ move(distance: number): void }} Movable */ -+>move : Symbol(move, Decl(a.js, 0, 15)) -+>distance : Symbol(distance, Decl(a.js, 0, 21)) - - const car = /** @satisfies {Movable & Record} */ ({ - >car : Symbol(car, Decl(a.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.types index c5d953e0fd..4c316ff692 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag5.types @@ -2,9 +2,6 @@ === /a.js === /** @typedef {{ move(distance: number): void }} Movable */ ->Movable : any ->move : (distance: number) => void ->distance : number const car = /** @satisfies {Movable & Record} */ ({ >car : { start: () => void; move: (d: any) => void; stop: () => void; } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag6.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag6.types index 8d53affe53..27731e2ff5 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag6.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag6.types @@ -3,14 +3,8 @@ === /a.js === /** * @typedef {Object} Point2d ->Point2d : any - * @property {number} x ->x : any - * @property {number} y ->y : any - */ // Undesirable behavior today with type annotation diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag7.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag7.types index 934ae0d22d..e5a245e579 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag7.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag7.types @@ -2,7 +2,6 @@ === /a.js === /** @typedef {"a" | "b" | "c" | "d"} Keys */ ->Keys : any const p = /** @satisfies {Record} */ ({ >p : { a: number; b: string; x: number; } diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols index 8c372d319a..1f6e6afdbe 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols @@ -2,7 +2,6 @@ === /a.js === /** @typedef {Object.} Facts */ ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) // Should be able to detect a failure here const x = /** @satisfies {Facts} */ ({ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols.diff deleted file mode 100644 index 9d362ca9db..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.symbols.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.checkJsdocSatisfiesTag8.symbols -+++ new.checkJsdocSatisfiesTag8.symbols -@@= skipped -1, +1 lines =@@ - - === /a.js === - /** @typedef {Object.} Facts */ -+>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - - // Should be able to detect a failure here - const x = /** @satisfies {Facts} */ ({ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.types index 71cf68353b..201e3b22d0 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag8.types @@ -2,7 +2,6 @@ === /a.js === /** @typedef {Object.} Facts */ ->Facts : any // Should be able to detect a failure here const x = /** @satisfies {Facts} */ ({ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag9.types b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag9.types index 4f81b91674..98fe398fad 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag9.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag9.types @@ -3,17 +3,9 @@ === /a.js === /** * @typedef {Object} Color ->Color : any - * @property {number} r ->r : any - * @property {number} g ->g : any - * @property {number} b ->b : any - */ // All of these should be Colors, but I only use some of them here. diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols index 73bc7d93b2..3916d709ab 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols @@ -11,9 +11,6 @@ type A = { a: T } /** Also should error for jsdoc typedefs * @template {string} U * @typedef {{ b: U }} B ->b : Symbol(b, Decl(test.js, 2, 14)) ->U : Symbol(U) - */ /** @type {A} */ var a; diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols.diff deleted file mode 100644 index 6713369d09..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.symbols.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.checkJsdocTypeTag4.symbols -+++ new.checkJsdocTypeTag4.symbols -@@= skipped -10, +10 lines =@@ - /** Also should error for jsdoc typedefs - * @template {string} U - * @typedef {{ b: U }} B -+>b : Symbol(b, Decl(test.js, 2, 14)) -+>U : Symbol(U) -+ - */ - /** @type {A} */ - var a; diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types index be90ea7133..5004b47a1a 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag4.types @@ -9,9 +9,6 @@ type A = { a: T } /** Also should error for jsdoc typedefs * @template {string} U * @typedef {{ b: U }} B ->B : any ->b : U - */ /** @type {A} */ var a; diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols index 08daa8dfc3..f6b32107aa 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols @@ -40,9 +40,6 @@ var k = function (x) { return x } /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ ->Argle : Symbol(Argle, Decl(test.js, 16, 4)) ->x : Symbol(x, Decl(test.js, 16, 15)) - /** @type {Argle} */ function blargle(s) { >blargle : Symbol(blargle, Decl(test.js, 13, 33)) @@ -57,9 +54,6 @@ var zeroonetwo = blargle('hi') >blargle : Symbol(blargle, Decl(test.js, 13, 33)) /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ ->Gioconda : Symbol(Gioconda, Decl(test.js, 25, 4)) ->s : Symbol(s, Decl(test.js, 25, 16)) ->b : Symbol(b, Decl(test.js, 25, 36)) /** @type {Gioconda} */ function monaLisa(sb) { diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff deleted file mode 100644 index 0a6004dae3..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.symbols.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.checkJsdocTypeTag5.symbols -+++ new.checkJsdocTypeTag5.symbols -@@= skipped -39, +39 lines =@@ - - - /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ -+>Argle : Symbol(Argle, Decl(test.js, 16, 4)) -+>x : Symbol(x, Decl(test.js, 16, 15)) -+ - /** @type {Argle} */ - function blargle(s) { - >blargle : Symbol(blargle, Decl(test.js, 13, 33)) -@@= skipped -14, +17 lines =@@ - >blargle : Symbol(blargle, Decl(test.js, 13, 33)) - - /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ -+>Gioconda : Symbol(Gioconda, Decl(test.js, 25, 4)) -+>s : Symbol(s, Decl(test.js, 25, 16)) -+>b : Symbol(b, Decl(test.js, 25, 36)) - - /** @type {Gioconda} */ - function monaLisa(sb) { diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types index 2ceaceedc7..e571cb95ec 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types @@ -44,9 +44,6 @@ var k = function (x) { return x } /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ ->Argle : Argle ->x : "bye" | "hi" - /** @type {Argle} */ function blargle(s) { >blargle : (s: any) => number @@ -64,9 +61,6 @@ var zeroonetwo = blargle('hi') >'hi' : "hi" /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ ->Gioconda : Gioconda ->s : string ->b : boolean /** @type {Gioconda} */ function monaLisa(sb) { diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols index 9868a91ea5..7cc5d38702 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols @@ -3,9 +3,6 @@ === test.js === /** * @typedef {(a: string, b: number) => void} Foo ->a : Symbol(a, Decl(test.js, 1, 14)) ->b : Symbol(b, Decl(test.js, 1, 24)) - */ class C { diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols.diff index 2c9439a9d9..4748e16f44 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.symbols.diff @@ -1,16 +1,6 @@ --- old.checkJsdocTypeTag7.symbols +++ new.checkJsdocTypeTag7.symbols -@@= skipped -2, +2 lines =@@ - === test.js === - /** - * @typedef {(a: string, b: number) => void} Foo -+>a : Symbol(a, Decl(test.js, 1, 14)) -+>b : Symbol(b, Decl(test.js, 1, 24)) -+ - */ - - class C { -@@= skipped -7, +10 lines =@@ +@@= skipped -9, +9 lines =@@ /** @type {Foo} */ foo(a, b) {} diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.types index e25a2799ef..d1ecda7ac4 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.types @@ -3,10 +3,6 @@ === test.js === /** * @typedef {(a: string, b: number) => void} Foo ->Foo : any ->a : string ->b : number - */ class C { diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols index 05b8d7c9f3..f0f06c6fc0 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols @@ -4,20 +4,10 @@ // @ts-check /** * @typedef {Object} Opts ->Opts : Symbol(Opts, Decl(0.js, 2, 3)) - * @property {string} x ->x : Symbol(x, Decl(0.js, 3, 3)) - * @property {string=} y ->y : Symbol(y, Decl(0.js, 4, 3)) - * @property {string} [z] ->z : Symbol(z, Decl(0.js, 5, 3)) - * @property {string} [w="hi"] ->w : Symbol(w, Decl(0.js, 6, 3)) - * * @param {Opts} opts */ @@ -37,14 +27,8 @@ foo({x: 'abc'}); /** * @typedef {Object} AnotherOpts ->AnotherOpts : Symbol(AnotherOpts, Decl(0.js, 17, 3)) - * @property anotherX {string} ->anotherX : Symbol(anotherX, Decl(0.js, 18, 3)) - * @property anotherY {string=} ->anotherY : Symbol(anotherY, Decl(0.js, 19, 3)) - * * @param {AnotherOpts} opts */ @@ -64,20 +48,10 @@ foo1({anotherX: "world"}); /** * @typedef {object} Opts1 ->Opts1 : Symbol(Opts1, Decl(0.js, 30, 3)) - * @property {string} x ->x : Symbol(x, Decl(0.js, 31, 3)) - * @property {string=} y ->y : Symbol(y, Decl(0.js, 32, 3)) - * @property {string} [z] ->z : Symbol(z, Decl(0.js, 33, 3)) - * @property {string} [w="hi"] ->w : Symbol(w, Decl(0.js, 34, 3)) - * * @param {Opts1} opts */ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff deleted file mode 100644 index 31d0fdb146..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.symbols.diff +++ /dev/null @@ -1,59 +0,0 @@ ---- old.checkJsdocTypedefInParamTag1.symbols -+++ new.checkJsdocTypedefInParamTag1.symbols -@@= skipped -3, +3 lines =@@ - // @ts-check - /** - * @typedef {Object} Opts -+>Opts : Symbol(Opts, Decl(0.js, 2, 3)) -+ - * @property {string} x -+>x : Symbol(x, Decl(0.js, 3, 3)) -+ - * @property {string=} y -+>y : Symbol(y, Decl(0.js, 4, 3)) -+ - * @property {string} [z] -+>z : Symbol(z, Decl(0.js, 5, 3)) -+ - * @property {string} [w="hi"] -+>w : Symbol(w, Decl(0.js, 6, 3)) -+ - * - * @param {Opts} opts - */ -@@= skipped -23, +33 lines =@@ - - /** - * @typedef {Object} AnotherOpts -+>AnotherOpts : Symbol(AnotherOpts, Decl(0.js, 17, 3)) -+ - * @property anotherX {string} -+>anotherX : Symbol(anotherX, Decl(0.js, 18, 3)) -+ - * @property anotherY {string=} -+>anotherY : Symbol(anotherY, Decl(0.js, 19, 3)) -+ - * - * @param {AnotherOpts} opts - */ -@@= skipped -21, +27 lines =@@ - - /** - * @typedef {object} Opts1 -+>Opts1 : Symbol(Opts1, Decl(0.js, 30, 3)) -+ - * @property {string} x -+>x : Symbol(x, Decl(0.js, 31, 3)) -+ - * @property {string=} y -+>y : Symbol(y, Decl(0.js, 32, 3)) -+ - * @property {string} [z] -+>z : Symbol(z, Decl(0.js, 33, 3)) -+ - * @property {string} [w="hi"] -+>w : Symbol(w, Decl(0.js, 34, 3)) -+ - * - * @param {Opts1} opts - */ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.types index cf4ec7993f..1f9d8338ed 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefInParamTag1.types @@ -4,20 +4,10 @@ // @ts-check /** * @typedef {Object} Opts ->Opts : Opts - * @property {string} x ->x : any - * @property {string=} y ->y : any - * @property {string} [z] ->z : any - * @property {string} [w="hi"] ->w : any - * * @param {Opts} opts */ @@ -40,14 +30,8 @@ foo({x: 'abc'}); /** * @typedef {Object} AnotherOpts ->AnotherOpts : AnotherOpts - * @property anotherX {string} ->anotherX : any - * @property anotherY {string=} ->anotherY : any - * * @param {AnotherOpts} opts */ @@ -70,20 +54,10 @@ foo1({anotherX: "world"}); /** * @typedef {object} Opts1 ->Opts1 : Opts1 - * @property {string} x ->x : any - * @property {string=} y ->y : any - * @property {string} [z] ->z : any - * @property {string} [w="hi"] ->w : any - * * @param {Opts1} opts */ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.types index 4fdfe4e89a..7adcabd12e 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.types @@ -10,8 +10,6 @@ var exports = {}; /** * @typedef {string} */ -> : any - exports.SomeName; >exports.SomeName : any >exports : {} diff --git a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols index e0ec9b3331..cb6013b96f 100644 --- a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols @@ -3,12 +3,7 @@ === test.js === /** @typedef {{ status: 'done' ->status : Symbol(status, Decl(test.js, 0, 15)) - m(n: number): void ->m : Symbol(m, Decl(test.js, 1, 18)) ->n : Symbol(n, Decl(test.js, 2, 6)) - }} DoneStatus */ // property assignment diff --git a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols.diff index 2ec796dbe0..593b1bee8f 100644 --- a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.symbols.diff @@ -1,16 +1,6 @@ --- old.contextualTypedSpecialAssignment.symbols +++ new.contextualTypedSpecialAssignment.symbols -@@= skipped -2, +2 lines =@@ - === test.js === - /** @typedef {{ - status: 'done' -+>status : Symbol(status, Decl(test.js, 0, 15)) -+ - m(n: number): void -+>m : Symbol(m, Decl(test.js, 1, 18)) -+>n : Symbol(n, Decl(test.js, 2, 6)) -+ - }} DoneStatus */ +@@= skipped -7, +7 lines =@@ // property assignment var ns = {} @@ -26,7 +16,7 @@ status: 'done', >status : Symbol(status, Decl(test.js, 8, 8)) -@@= skipped -22, +25 lines =@@ +@@= skipped -17, +15 lines =@@ } ns.x = { diff --git a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.types b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.types index 7a472a474b..1a662b4fb9 100644 --- a/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.types @@ -5,7 +5,6 @@ status: 'done' m(n: number): void }} DoneStatus */ ->DoneStatus : any // property assignment var ns = {} diff --git a/testdata/baselines/reference/submodule/conformance/enumTagImported.types b/testdata/baselines/reference/submodule/conformance/enumTagImported.types index be1f86a3e1..a7e576e4d9 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTagImported.types +++ b/testdata/baselines/reference/submodule/conformance/enumTagImported.types @@ -2,8 +2,6 @@ === type.js === /** @typedef {import("./mod1").TestEnum} TE */ ->TE : any - /** @type {TE} */ const test = 'add' >test : any diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols b/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols index 56c1dbebd0..252ac152b9 100644 --- a/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols +++ b/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols @@ -4,11 +4,7 @@ /** * @typedef {{ * a: number | string; ->a : Symbol(a, Decl(a.js, 1, 14)) - * b: boolean | string[]; ->b : Symbol(b, Decl(a.js, 2, 25)) - * }} Foo */ diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols.diff b/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols.diff deleted file mode 100644 index 55fc2ac800..0000000000 --- a/testdata/baselines/reference/submodule/conformance/extendsTag5.symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.extendsTag5.symbols -+++ new.extendsTag5.symbols -@@= skipped -3, +3 lines =@@ - /** - * @typedef {{ - * a: number | string; -+>a : Symbol(a, Decl(a.js, 1, 14)) -+ - * b: boolean | string[]; -+>b : Symbol(b, Decl(a.js, 2, 25)) -+ - * }} Foo - */ - diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.types b/testdata/baselines/reference/submodule/conformance/extendsTag5.types index d5e4753447..ac03511a17 100644 --- a/testdata/baselines/reference/submodule/conformance/extendsTag5.types +++ b/testdata/baselines/reference/submodule/conformance/extendsTag5.types @@ -6,8 +6,6 @@ * a: number | string; * b: boolean | string[]; * }} Foo ->Foo : any - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols index ece6ff9849..708cd0edc7 100644 --- a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols +++ b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols @@ -45,7 +45,6 @@ export = MyClass; let a = /** @type {Foo} */(/** @type {*} */(undefined)); >a : Symbol(a, Decl(index.js, 4, 3)) ->Foo : Symbol(Foo, Decl(index.js, 1, 3)) >undefined : Symbol(undefined) a = new Foo({doer: Foo.Bar}); @@ -58,14 +57,12 @@ a = new Foo({doer: Foo.Bar}); const q = /** @type {import("./externs").Bar} */({ doer: q => q }); >q : Symbol(q, Decl(index.js, 6, 5)) ->Bar : Symbol(Bar, Decl(externs.d.ts, 0, 27), Decl(externs.d.ts, 6, 18)) >doer : Symbol(doer, Decl(index.js, 6, 50)) >q : Symbol(q, Decl(index.js, 6, 56)) >q : Symbol(q, Decl(index.js, 6, 56)) const r = /** @type {typeof import("./externs").Bar} */(r => r); >r : Symbol(r, Decl(index.js, 7, 5)) ->Bar : Symbol(Bar, Decl(externs.d.ts, 0, 27), Decl(externs.d.ts, 6, 18)) >r : Symbol(r, Decl(index.js, 7, 56)) >r : Symbol(r, Decl(index.js, 7, 56)) diff --git a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols.diff b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols.diff index aebf74277b..7cddf0f690 100644 --- a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.symbols.diff @@ -37,12 +37,7 @@ >MyClass : Symbol(MyClass, Decl(externs.d.ts, 0, 0), Decl(externs.d.ts, 4, 1)) } export = MyClass; -@@= skipped -29, +29 lines =@@ - - let a = /** @type {Foo} */(/** @type {*} */(undefined)); - >a : Symbol(a, Decl(index.js, 4, 3)) -+>Foo : Symbol(Foo, Decl(index.js, 1, 3)) - >undefined : Symbol(undefined) +@@= skipped -33, +33 lines =@@ a = new Foo({doer: Foo.Bar}); >a : Symbol(a, Decl(index.js, 4, 3)) @@ -58,14 +53,3 @@ const q = /** @type {import("./externs").Bar} */({ doer: q => q }); >q : Symbol(q, Decl(index.js, 6, 5)) -+>Bar : Symbol(Bar, Decl(externs.d.ts, 0, 27), Decl(externs.d.ts, 6, 18)) - >doer : Symbol(doer, Decl(index.js, 6, 50)) - >q : Symbol(q, Decl(index.js, 6, 56)) - >q : Symbol(q, Decl(index.js, 6, 56)) - - const r = /** @type {typeof import("./externs").Bar} */(r => r); - >r : Symbol(r, Decl(index.js, 7, 5)) -+>Bar : Symbol(Bar, Decl(externs.d.ts, 0, 27), Decl(externs.d.ts, 6, 18)) - >r : Symbol(r, Decl(index.js, 7, 56)) - >r : Symbol(r, Decl(index.js, 7, 56)) - diff --git a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.types b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.types index 16b792520a..54cd2d1c4f 100644 --- a/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.types +++ b/testdata/baselines/reference/submodule/conformance/importTypeInJSDoc.types @@ -36,8 +36,6 @@ export = MyClass; === index.js === /** * @typedef {import("./externs")} Foo ->Foo : any - */ let a = /** @type {Foo} */(/** @type {*} */(undefined)); @@ -73,7 +71,6 @@ const r = /** @type {typeof import("./externs").Bar} */(r => r); >r : (x: string, y?: number) => void >(r => r) : (x: string, y?: number) => void >r => r : (x: string, y?: number) => void ->Bar : any >r => r : (r: string) => string >r : string >r : string diff --git a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols index aebf7be31f..e3d5cf7c06 100644 --- a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols +++ b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols @@ -26,7 +26,6 @@ import { writeFile, WriteFileOptions, WriteFileOptions as OtherName } from "fs"; >OtherName : Symbol(OtherName, Decl(index.js, 0, 37)) /** @typedef {{ x: any }} JSDocType */ ->x : Symbol(x, Decl(index.js, 2, 15)) export { JSDocType }; >JSDocType : Symbol(JSDocType, Decl(index.js, 2, 4), Decl(index.js, 4, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff index 4b42e6e157..202b95d863 100644 --- a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff @@ -1,10 +1,7 @@ --- old.importingExportingTypes.symbols +++ new.importingExportingTypes.symbols -@@= skipped -25, +25 lines =@@ - >OtherName : Symbol(OtherName, Decl(index.js, 0, 37)) - +@@= skipped -27, +27 lines =@@ /** @typedef {{ x: any }} JSDocType */ -+>x : Symbol(x, Decl(index.js, 2, 15)) export { JSDocType }; ->JSDocType : Symbol(JSDocType, Decl(index.js, 4, 8), Decl(index.js, 2, 4)) diff --git a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.types b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.types index 85e2ea8e3b..a760c64ad3 100644 --- a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.types +++ b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.types @@ -22,8 +22,6 @@ import { writeFile, WriteFileOptions, WriteFileOptions as OtherName } from "fs"; >OtherName : any /** @typedef {{ x: any }} JSDocType */ ->JSDocType : any ->x : any export { JSDocType }; >JSDocType : any diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols index 840e1b395c..fd8d6c99cb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols @@ -25,7 +25,6 @@ export default class Foo { a = /** @type {Foo} */(null); >a : Symbol(a, Decl(index3.js, 0, 26)) ->Foo : Symbol(default, Decl(index3.js, 0, 0)) }; export const X = Foo; @@ -46,7 +45,6 @@ class Bar extends Fab { x = /** @type {Bar} */(null); >x : Symbol(x, Decl(index4.js, 1, 23)) ->Bar : Symbol(Bar, Decl(index4.js, 0, 27)) } export default Bar; >Bar : Symbol(Bar, Decl(index4.js, 0, 27)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols.diff index 327d53525f..7dd86f096f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsDefault.symbols.diff @@ -29,7 +29,6 @@ a = /** @type {Foo} */(null); ->a : Symbol(Foo.a, Decl(index3.js, 0, 26)) +>a : Symbol(a, Decl(index3.js, 0, 26)) -+>Foo : Symbol(default, Decl(index3.js, 0, 0)) }; export const X = Foo; @@ -43,17 +42,16 @@ >Bar : Symbol(Bar, Decl(index3.js, 4, 8)) === index4.js === -@@= skipped -38, +39 lines =@@ +@@= skipped -38, +38 lines =@@ >Fab : Symbol(Fab, Decl(index4.js, 0, 6)) x = /** @type {Bar} */(null); ->x : Symbol(Bar.x, Decl(index4.js, 1, 23)) +>x : Symbol(x, Decl(index4.js, 1, 23)) -+>Bar : Symbol(Bar, Decl(index4.js, 0, 27)) } export default Bar; >Bar : Symbol(Bar, Decl(index4.js, 0, 27)) -@@= skipped -16, +17 lines =@@ +@@= skipped -16, +16 lines =@@ === index6.js === // merge type alias and function (OK) export default function func() {}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols index d3ca2b12db..f27ae66370 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols @@ -17,9 +17,6 @@ module.exports = Timer; === hook.js === /** * @typedef {(arg: import("./context")) => void} HookHandler ->HookHandler : Symbol(HookHandler, Decl(hook.js, 1, 3)) ->arg : Symbol(arg, Decl(hook.js, 1, 14)) - */ /** * @param {HookHandler} handle @@ -39,47 +36,24 @@ module.exports = Hook; * Imports * * @typedef {import("./timer")} Timer ->Timer : Symbol(Timer, Decl(context.js, 3, 3)) - * @typedef {import("./hook")} Hook ->Hook : Symbol(Hook, Decl(context.js, 4, 3)) - * @typedef {import("./hook").HookHandler} HookHandler ->HookHandler : Symbol(HookHandler, Decl(context.js, 5, 3)) ->HookHandler : Symbol(HookHandler, Decl(hook.js, 1, 3)) - */ /** * Input type definition * * @typedef {Object} Input ->Input : Symbol(Input, Decl(context.js, 11, 3)) - * @prop {Timer} timer ->timer : Symbol(timer, Decl(context.js, 12, 3)) ->Timer : Symbol(Timer, Decl(context.js, 3, 3)) - * @prop {Hook} hook ->hook : Symbol(hook, Decl(context.js, 13, 3)) ->Hook : Symbol(Hook, Decl(context.js, 4, 3)) - */ /** * State type definition * * @typedef {Object} State ->State : Symbol(State, Decl(context.js, 19, 3)) - * @prop {Timer} timer ->timer : Symbol(timer, Decl(context.js, 20, 3)) ->Timer : Symbol(Timer, Decl(context.js, 3, 3)) - * @prop {Hook} hook ->hook : Symbol(hook, Decl(context.js, 21, 3)) ->Hook : Symbol(Hook, Decl(context.js, 4, 3)) - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff index c47664c53b..02b65ce5ed 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff @@ -16,15 +16,7 @@ >Timer : Symbol(Timer, Decl(timer.js, 0, 0)) === hook.js === - /** - * @typedef {(arg: import("./context")) => void} HookHandler -+>HookHandler : Symbol(HookHandler, Decl(hook.js, 1, 3)) -+>arg : Symbol(arg, Decl(hook.js, 1, 14)) -+ - */ - /** - * @param {HookHandler} handle -@@= skipped -23, +20 lines =@@ +@@= skipped -23, +17 lines =@@ >handle : Symbol(handle, Decl(hook.js, 6, 14)) this.handle = handle; @@ -40,55 +32,7 @@ >Hook : Symbol(Hook, Decl(hook.js, 0, 0)) === context.js === -@@= skipped -16, +10 lines =@@ - * Imports - * - * @typedef {import("./timer")} Timer -+>Timer : Symbol(Timer, Decl(context.js, 3, 3)) -+ - * @typedef {import("./hook")} Hook -+>Hook : Symbol(Hook, Decl(context.js, 4, 3)) -+ - * @typedef {import("./hook").HookHandler} HookHandler -+>HookHandler : Symbol(HookHandler, Decl(context.js, 5, 3)) -+>HookHandler : Symbol(HookHandler, Decl(hook.js, 1, 3)) -+ - */ - - /** - * Input type definition - * - * @typedef {Object} Input -+>Input : Symbol(Input, Decl(context.js, 11, 3)) -+ - * @prop {Timer} timer -+>timer : Symbol(timer, Decl(context.js, 12, 3)) -+>Timer : Symbol(Timer, Decl(context.js, 3, 3)) -+ - * @prop {Hook} hook -+>hook : Symbol(hook, Decl(context.js, 13, 3)) -+>Hook : Symbol(Hook, Decl(context.js, 4, 3)) -+ - */ - - /** - * State type definition - * - * @typedef {Object} State -+>State : Symbol(State, Decl(context.js, 19, 3)) -+ - * @prop {Timer} timer -+>timer : Symbol(timer, Decl(context.js, 20, 3)) -+>Timer : Symbol(Timer, Decl(context.js, 3, 3)) -+ - * @prop {Hook} hook -+>hook : Symbol(hook, Decl(context.js, 21, 3)) -+>Hook : Symbol(Hook, Decl(context.js, 4, 3)) -+ - */ - - /** -@@= skipped -28, +51 lines =@@ +@@= skipped -44, +38 lines =@@ */ function Context(input) { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types index e729c73dcb..3fc5508b7f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types @@ -25,9 +25,6 @@ module.exports = Timer; === hook.js === /** * @typedef {(arg: import("./context")) => void} HookHandler ->HookHandler : HookHandler ->arg : any - */ /** * @param {HookHandler} handle @@ -55,42 +52,24 @@ module.exports = Hook; * Imports * * @typedef {import("./timer")} Timer ->Timer : any - * @typedef {import("./hook")} Hook ->Hook : any - * @typedef {import("./hook").HookHandler} HookHandler ->HookHandler : HookHandler - */ /** * Input type definition * * @typedef {Object} Input ->Input : Input - * @prop {Timer} timer ->timer : any - * @prop {Hook} hook ->hook : any - */ /** * State type definition * * @typedef {Object} State ->State : State - * @prop {Timer} timer ->timer : any - * @prop {Hook} hook ->hook : any - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols index 5b64978758..0c301bfa5c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols @@ -13,23 +13,14 @@ const myTypes = { }; /** @typedef {string|RegExp|Array} myTypes.typeA */ ->RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ->RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) /** * @typedef myTypes.typeB * @property {myTypes.typeA} prop1 - Prop 1. ->myTypes : Symbol(myTypes) ->typeA : Symbol(typeA) - * @property {string} prop2 - Prop 2. */ /** @typedef {myTypes.typeB|Function} myTypes.typeC */ ->myTypes : Symbol(myTypes) ->typeB : Symbol(typeB) ->Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) export {myTypes}; >myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 19, 8)) @@ -50,9 +41,6 @@ const testFnTypes = { }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 11, 4), Decl(file2.js, 27, 15)) ->myTypes : Symbol(myTypes) ->typeC : Symbol(typeC) /** * @function testFn diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff index b908d8ddfa..e5fd12a887 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff @@ -9,25 +9,8 @@ // SOME PROPS HERE }; - - /** @typedef {string|RegExp|Array} myTypes.typeA */ -+>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -+>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -+>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) - - /** - * @typedef myTypes.typeB - * @property {myTypes.typeA} prop1 - Prop 1. -+>myTypes : Symbol(myTypes) -+>typeA : Symbol(typeA) -+ - * @property {string} prop2 - Prop 2. - */ - +@@= skipped -16, +16 lines =@@ /** @typedef {myTypes.typeB|Function} myTypes.typeC */ -+>myTypes : Symbol(myTypes) -+>typeB : Symbol(typeB) -+>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) export {myTypes}; ->myTypes : Symbol(myTypes, Decl(file.js, 19, 8), Decl(file.js, 9, 50), Decl(file.js, 12, 12), Decl(file.js, 17, 38)) @@ -35,7 +18,7 @@ === file2.js === import {myTypes} from './file.js'; -@@= skipped -28, +37 lines =@@ +@@= skipped -12, +12 lines =@@ * @type {Object} */ const testFnTypes = { @@ -44,15 +27,7 @@ // SOME PROPS HERE }; - - /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ -+>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 11, 4), Decl(file2.js, 27, 15)) -+>myTypes : Symbol(myTypes) -+>typeC : Symbol(typeC) - - /** - * @function testFn -@@= skipped -30, +33 lines =@@ +@@= skipped -30, +30 lines =@@ export {testFn, testFnTypes}; >testFn : Symbol(testFn, Decl(file2.js, 27, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types index b8f870c932..3ecfd6cb66 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types @@ -14,24 +14,14 @@ const myTypes = { }; /** @typedef {string|RegExp|Array} myTypes.typeA */ ->myTypes : any /** * @typedef myTypes.typeB ->myTypes : any - * @property {myTypes.typeA} prop1 - Prop 1. ->prop1 : any ->myTypes : any - * @property {string} prop2 - Prop 2. ->prop2 : any - */ /** @typedef {myTypes.typeB|Function} myTypes.typeC */ ->myTypes : any ->myTypes : any export {myTypes}; >myTypes : any @@ -53,8 +43,6 @@ const testFnTypes = { }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ->testFnTypes : any ->myTypes : any /** * @function testFn diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols index ee54f6f4b3..2ee8b34843 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols @@ -16,9 +16,6 @@ const testFnTypes = { }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 11, 4)) ->myTypes : Symbol(myTypes) ->typeC : Symbol(typeC) /** * @function testFn diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff index 443dafbe78..2dac9e6ef4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff @@ -18,15 +18,7 @@ // SOME PROPS HERE }; - - /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ -+>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 11, 4)) -+>myTypes : Symbol(myTypes) -+>typeC : Symbol(typeC) - - /** - * @function testFn -@@= skipped -29, +32 lines =@@ +@@= skipped -29, +29 lines =@@ } module.exports = {testFn, testFnTypes}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types index 718fde9ae5..f3b4df0bf2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types @@ -20,8 +20,6 @@ const testFnTypes = { }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ->testFnTypes : any ->myTypes : any /** * @function testFn diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.types index 659dbd397c..29e2531a50 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportNamespacedType.types @@ -10,8 +10,6 @@ var dot2 === mod1.js === /** @typedef {number} Dotted.Name */ ->Dotted : any - export var dummy = 1 >dummy : number >1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols index 84fead8e32..da7ddca71e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols @@ -3,8 +3,6 @@ === folder/mod1.js === /** * @typedef {{x: number}} Item ->x : Symbol(x, Decl(mod1.js, 1, 14)) - */ /** * @type {Item}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff index dce5d2e782..4b85a14daa 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff @@ -1,15 +1,6 @@ --- old.jsDeclarationsImportTypeBundled.symbols +++ new.jsDeclarationsImportTypeBundled.symbols -@@= skipped -2, +2 lines =@@ - === folder/mod1.js === - /** - * @typedef {{x: number}} Item -+>x : Symbol(x, Decl(mod1.js, 1, 14)) -+ - */ - /** - * @type {Item}; -@@= skipped -9, +11 lines =@@ +@@= skipped -11, +11 lines =@@ >x : Symbol(x, Decl(mod1.js, 6, 11)) module.exports = x; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types index 9b7a644242..c066349aef 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types @@ -3,9 +3,6 @@ === folder/mod1.js === /** * @typedef {{x: number}} Item ->Item : any ->x : number - */ /** * @type {Item}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols index 1c1b13b931..48c0bc148d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols @@ -4,52 +4,41 @@ // these are recognized as TS concepts by the checker /** @type {String} */const a = ""; >a : Symbol(a, Decl(index.js, 1, 26)) ->String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 1 more) /** @type {Number} */const b = 0; >b : Symbol(b, Decl(index.js, 2, 26)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) /** @type {Boolean} */const c = true; >c : Symbol(c, Decl(index.js, 3, 27)) ->Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) /** @type {Void} */const d = undefined; >d : Symbol(d, Decl(index.js, 4, 24)) ->Void : Symbol(Void) >undefined : Symbol(undefined) /** @type {Undefined} */const e = undefined; >e : Symbol(e, Decl(index.js, 5, 29)) ->Undefined : Symbol(Undefined) >undefined : Symbol(undefined) /** @type {Null} */const f = null; >f : Symbol(f, Decl(index.js, 6, 24)) ->Null : Symbol(Null) /** @type {Function} */const g = () => void 0; >g : Symbol(g, Decl(index.js, 8, 28)) ->Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) /** @type {function} */const h = () => void 0; >h : Symbol(h, Decl(index.js, 9, 28)) ->function : Symbol(function) /** @type {array} */const i = []; >i : Symbol(i, Decl(index.js, 10, 25)) ->array : Symbol(array) /** @type {promise} */const j = Promise.resolve(0); >j : Symbol(j, Decl(index.js, 11, 27)) ->promise : Symbol(promise) >Promise.resolve : Symbol(resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >resolve : Symbol(resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) /** @type {Object} */const k = {x: "x"}; >k : Symbol(k, Decl(index.js, 12, 42)) ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(index.js, 12, 48)) @@ -58,31 +47,25 @@ // @ts-ignore /** @type {class} */const l = true; >l : Symbol(l, Decl(index.js, 18, 25)) ->class : Symbol(class) // @ts-ignore /** @type {bool} */const m = true; >m : Symbol(m, Decl(index.js, 20, 24)) ->bool : Symbol(bool) // @ts-ignore /** @type {int} */const n = true; >n : Symbol(n, Decl(index.js, 22, 23)) ->int : Symbol(int) // @ts-ignore /** @type {float} */const o = true; >o : Symbol(o, Decl(index.js, 24, 25)) ->float : Symbol(float) // @ts-ignore /** @type {integer} */const p = true; >p : Symbol(p, Decl(index.js, 26, 27)) ->integer : Symbol(integer) // or, in the case of `event` likely erroneously refers to the type of the global Event object /** @type {event} */const q = undefined; >q : Symbol(q, Decl(index.js, 29, 25)) ->event : Symbol(event) >undefined : Symbol(undefined) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols.diff index 4923d831bb..b8a502cec1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJSDocRedirectedLookups.symbols.diff @@ -1,49 +1,10 @@ --- old.jsDeclarationsJSDocRedirectedLookups.symbols +++ new.jsDeclarationsJSDocRedirectedLookups.symbols -@@= skipped -3, +3 lines =@@ - // these are recognized as TS concepts by the checker - /** @type {String} */const a = ""; - >a : Symbol(a, Decl(index.js, 1, 26)) -+>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 1 more) - - /** @type {Number} */const b = 0; - >b : Symbol(b, Decl(index.js, 2, 26)) -+>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - - /** @type {Boolean} */const c = true; - >c : Symbol(c, Decl(index.js, 3, 27)) -+>Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - - /** @type {Void} */const d = undefined; - >d : Symbol(d, Decl(index.js, 4, 24)) -+>Void : Symbol(Void) - >undefined : Symbol(undefined) - - /** @type {Undefined} */const e = undefined; - >e : Symbol(e, Decl(index.js, 5, 29)) -+>Undefined : Symbol(Undefined) - >undefined : Symbol(undefined) - - /** @type {Null} */const f = null; - >f : Symbol(f, Decl(index.js, 6, 24)) -+>Null : Symbol(Null) - - /** @type {Function} */const g = () => void 0; - >g : Symbol(g, Decl(index.js, 8, 28)) -+>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) - - /** @type {function} */const h = () => void 0; - >h : Symbol(h, Decl(index.js, 9, 28)) -+>function : Symbol(function) - - /** @type {array} */const i = []; - >i : Symbol(i, Decl(index.js, 10, 25)) -+>array : Symbol(array) +@@= skipped -32, +32 lines =@@ /** @type {promise} */const j = Promise.resolve(0); >j : Symbol(j, Decl(index.js, 11, 27)) ->Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -+>promise : Symbol(promise) +>Promise.resolve : Symbol(resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ->resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) @@ -51,39 +12,3 @@ /** @type {Object} */const k = {x: "x"}; >k : Symbol(k, Decl(index.js, 12, 42)) -+>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - >x : Symbol(x, Decl(index.js, 12, 48)) - - -@@= skipped -43, +54 lines =@@ - // @ts-ignore - /** @type {class} */const l = true; - >l : Symbol(l, Decl(index.js, 18, 25)) -+>class : Symbol(class) - - // @ts-ignore - /** @type {bool} */const m = true; - >m : Symbol(m, Decl(index.js, 20, 24)) -+>bool : Symbol(bool) - - // @ts-ignore - /** @type {int} */const n = true; - >n : Symbol(n, Decl(index.js, 22, 23)) -+>int : Symbol(int) - - // @ts-ignore - /** @type {float} */const o = true; - >o : Symbol(o, Decl(index.js, 24, 25)) -+>float : Symbol(float) - - // @ts-ignore - /** @type {integer} */const p = true; - >p : Symbol(p, Decl(index.js, 26, 27)) -+>integer : Symbol(integer) - - // or, in the case of `event` likely erroneously refers to the type of the global Event object - /** @type {event} */const q = undefined; - >q : Symbol(q, Decl(index.js, 29, 25)) -+>event : Symbol(event) - >undefined : Symbol(undefined) - diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types index 4adcc56813..706b7ca980 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types @@ -33,8 +33,6 @@ module.exports = BaseFactory; === file.js === /** @typedef {import('./base')} BaseFactory */ ->BaseFactory : any - /** * @callback BaseFactoryFactory * @param {import('./base')} factory diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types index 8ee4d28ead..cec99d135f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types @@ -33,7 +33,6 @@ module.exports = BaseFactory; === file.js === /** @typedef {typeof import('./base')} BaseFactory */ ->BaseFactory : any /** * diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols index b57843828b..db15a82914 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols @@ -32,11 +32,6 @@ export {}; // flag file as module === mixed.js === /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType ->SomeType : Symbol(SomeType, Decl(mixed.js, 1, 3)) ->x : Symbol(x, Decl(mixed.js, 1, 14)) ->LocalThing : Symbol(LocalThing, Decl(mixed.js, 16, 2)) ->ExportedThing : Symbol(ExportedThing, Decl(mixed.js, 9, 1)) - */ /** * @param {number} x diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff index 0f0faca6d1..deb9304353 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.symbols.diff @@ -1,18 +1,6 @@ --- old.jsDeclarationsTypeAliases.symbols +++ new.jsDeclarationsTypeAliases.symbols -@@= skipped -31, +31 lines =@@ - === mixed.js === - /** - * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType -+>SomeType : Symbol(SomeType, Decl(mixed.js, 1, 3)) -+>x : Symbol(x, Decl(mixed.js, 1, 14)) -+>LocalThing : Symbol(LocalThing, Decl(mixed.js, 16, 2)) -+>ExportedThing : Symbol(ExportedThing, Decl(mixed.js, 9, 1)) -+ - */ - /** - * @param {number} x -@@= skipped -17, +22 lines =@@ +@@= skipped -48, +48 lines =@@ >ExportedThing : Symbol(ExportedThing, Decl(mixed.js, 9, 1)) z = "ok" diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.types index 87a7692655..b81b70e809 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.types @@ -32,9 +32,6 @@ export {}; // flag file as module === mixed.js === /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType ->SomeType : SomeType ->x : string - */ /** * @param {number} x diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types index abf877d245..d384caf838 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types @@ -3,8 +3,6 @@ === conn.js === /** * @typedef {string | number} Whatever ->Whatever : any - */ class Conn { @@ -29,8 +27,6 @@ module.exports = Conn; === usage.js === /** * @typedef {import("./conn")} Conn ->Conn : any - */ class Wrap { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols index 9028164243..b792c9fb28 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols @@ -18,8 +18,6 @@ stringSet.addAll(stringSet); // Comment out this JSDoc, and note that the errors index.js go away. /** * @typedef {Object} SomeObject ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - */ class LazySet { >LazySet : Symbol(LazySet, Decl(LazySet.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff index 78bddf8bcf..f0002b54f6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff @@ -19,16 +19,7 @@ >stringSet : Symbol(stringSet, Decl(index.js, 3, 5)) -@@= skipped -10, +8 lines =@@ - // Comment out this JSDoc, and note that the errors index.js go away. - /** - * @typedef {Object} SomeObject -+>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -+ - */ - class LazySet { - >LazySet : Symbol(LazySet, Decl(LazySet.js, 0, 0)) -@@= skipped -8, +10 lines =@@ +@@= skipped -18, +16 lines =@@ * @param {LazySet} iterable */ addAll(iterable) {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types index 80a77ea98a..d00f82d698 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types @@ -24,8 +24,6 @@ stringSet.addAll(stringSet); // Comment out this JSDoc, and note that the errors index.js go away. /** * @typedef {Object} SomeObject ->SomeObject : any - */ class LazySet { >LazySet : LazySet diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols index 986a4941e4..3db734f68d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols @@ -4,10 +4,6 @@ /** * @typedef {{ * [id: string]: [Function, Function]; ->id : Symbol(id, Decl(foo.js, 2, 6)) ->Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) ->Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) - * }} ResolveRejectMap */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols.diff deleted file mode 100644 index 348578b5a4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.symbols.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.jsDeclarationsTypedefFunction.symbols -+++ new.jsDeclarationsTypedefFunction.symbols -@@= skipped -3, +3 lines =@@ - /** - * @typedef {{ - * [id: string]: [Function, Function]; -+>id : Symbol(id, Decl(foo.js, 2, 6)) -+>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) -+>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) -+ - * }} ResolveRejectMap - */ - diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.types index b2a9a3d802..f0d37471f2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefFunction.types @@ -5,8 +5,6 @@ * @typedef {{ * [id: string]: [Function, Function]; * }} ResolveRejectMap ->ResolveRejectMap : any - */ let id = 0 diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols index 48c822fc00..e18f140418 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols @@ -10,21 +10,11 @@ const {taskGroups, taskNameToGroup} = require('./module.js'); /** * @typedef TaskNode * @prop {TaskNode[]} children ->TaskNode : Symbol(TaskNode, Decl(index.js, 5, 3)) - * @prop {TaskNode|undefined} parent ->TaskNode : Symbol(TaskNode, Decl(index.js, 5, 3)) - * @prop {TaskGroup} group ->TaskGroup : Symbol(TaskGroup, Decl(index.js, 2, 4)) - */ /** @typedef {{timers: Map}} PriorTaskData */ ->timers : Symbol(timers, Decl(index.js, 11, 15)) ->Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ->TaskNode : Symbol(TaskNode, Decl(index.js, 5, 3)) - class MainThreadTasks { >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff index e14dfd56bf..c196b877bd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff @@ -9,28 +9,7 @@ /** @typedef {import('./module.js').TaskGroup} TaskGroup */ - /** - * @typedef TaskNode - * @prop {TaskNode[]} children -+>TaskNode : Symbol(TaskNode, Decl(index.js, 5, 3)) -+ - * @prop {TaskNode|undefined} parent -+>TaskNode : Symbol(TaskNode, Decl(index.js, 5, 3)) -+ - * @prop {TaskGroup} group -+>TaskGroup : Symbol(TaskGroup, Decl(index.js, 2, 4)) -+ - */ - - /** @typedef {{timers: Map}} PriorTaskData */ -+>timers : Symbol(timers, Decl(index.js, 11, 15)) -+>Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -+>TaskNode : Symbol(TaskNode, Decl(index.js, 5, 3)) -+ - class MainThreadTasks { - >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) - -@@= skipped -26, +34 lines =@@ +@@= skipped -26, +24 lines =@@ } module.exports = MainThreadTasks; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types index 61457d18ff..e63e30c6b2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types @@ -9,27 +9,15 @@ const {taskGroups, taskNameToGroup} = require('./module.js'); >'./module.js' : "./module.js" /** @typedef {import('./module.js').TaskGroup} TaskGroup */ ->TaskGroup : any /** * @typedef TaskNode ->TaskNode : any - * @prop {TaskNode[]} children ->children : any - * @prop {TaskNode|undefined} parent ->parent : any - * @prop {TaskGroup} group ->group : any - */ /** @typedef {{timers: Map}} PriorTaskData */ ->PriorTaskData : any ->timers : Map - class MainThreadTasks { >MainThreadTasks : MainThreadTasks diff --git a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols index c7658c125d..60c6893c1b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols @@ -3,14 +3,10 @@ === foo.js === /** * @typedef {any} Any ->Any : Symbol(Any, Decl(foo.js, 1, 3)) - */ /** * @typedef {unknown} Unknown ->Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) - */ function fn() { @@ -24,14 +20,12 @@ function fn() { try { } catch (/** @type {Any} */ err) { } // should be OK >err : Symbol(err, Decl(foo.js, 11, 19)) ->Any : Symbol(Any, Decl(foo.js, 1, 3)) try { } catch (/** @type {unknown} */ err) { } // should be OK >err : Symbol(err, Decl(foo.js, 12, 19)) try { } catch (/** @type {Unknown} */ err) { } // should be OK >err : Symbol(err, Decl(foo.js, 13, 19)) ->Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) try { } catch (err) { err.foo; } // should be OK >err : Symbol(err, Decl(foo.js, 14, 19)) @@ -43,7 +37,6 @@ function fn() { try { } catch (/** @type {Any} */ err) { err.foo; } // should be OK >err : Symbol(err, Decl(foo.js, 16, 19)) ->Any : Symbol(Any, Decl(foo.js, 1, 3)) >err : Symbol(err, Decl(foo.js, 16, 19)) try { } catch (/** @type {unknown} */ err) { console.log(err); } // should be OK @@ -55,7 +48,6 @@ function fn() { try { } catch (/** @type {Unknown} */ err) { console.log(err); } // should be OK >err : Symbol(err, Decl(foo.js, 18, 19)) ->Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) >console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) @@ -67,12 +59,10 @@ function fn() { try { } catch (/** @type {Unknown} */ err) { err.foo; } // error in the body >err : Symbol(err, Decl(foo.js, 20, 19)) ->Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) >err : Symbol(err, Decl(foo.js, 20, 19)) try { } catch (/** @type {Error} */ err) { } // error in the type >err : Symbol(err, Decl(foo.js, 21, 19)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) try { } catch (/** @type {object} */ err) { } // error in the type >err : Symbol(err, Decl(foo.js, 22, 19)) @@ -120,7 +110,6 @@ function fn() { try { } catch (/** @type {Any} */ { x }) { x.foo;} // should be OK >x : Symbol(x, Decl(foo.js, 44, 39)) ->Any : Symbol(Any, Decl(foo.js, 1, 3)) >x : Symbol(x, Decl(foo.js, 44, 39)) try { } catch (/** @type {unknown} */ { x }) { console.log(x); } // error in the destructure @@ -132,7 +121,6 @@ function fn() { try { } catch (/** @type {Unknown} */ { x }) { console.log(x); } // error in the destructure >x : Symbol(x, Decl(foo.js, 46, 43)) ->Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) >console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) @@ -140,7 +128,6 @@ function fn() { try { } catch (/** @type {Error} */ { x }) { } // error in the type >x : Symbol(x, Decl(foo.js, 47, 41)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) try { } catch (/** @type {object} */ { x }) { } // error in the type >x : Symbol(x, Decl(foo.js, 48, 42)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff index ee741e81a8..78b7464469 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.symbols.diff @@ -1,41 +1,6 @@ --- old.jsdocCatchClauseWithTypeAnnotation.symbols +++ new.jsdocCatchClauseWithTypeAnnotation.symbols -@@= skipped -2, +2 lines =@@ - === foo.js === - /** - * @typedef {any} Any -+>Any : Symbol(Any, Decl(foo.js, 1, 3)) -+ - */ - - /** - * @typedef {unknown} Unknown -+>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) -+ - */ - - function fn() { -@@= skipped -17, +21 lines =@@ - - try { } catch (/** @type {Any} */ err) { } // should be OK - >err : Symbol(err, Decl(foo.js, 11, 19)) -+>Any : Symbol(Any, Decl(foo.js, 1, 3)) - - try { } catch (/** @type {unknown} */ err) { } // should be OK - >err : Symbol(err, Decl(foo.js, 12, 19)) - - try { } catch (/** @type {Unknown} */ err) { } // should be OK - >err : Symbol(err, Decl(foo.js, 13, 19)) -+>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) - - try { } catch (err) { err.foo; } // should be OK - >err : Symbol(err, Decl(foo.js, 14, 19)) -@@= skipped -17, +19 lines =@@ - - try { } catch (/** @type {Any} */ err) { err.foo; } // should be OK - >err : Symbol(err, Decl(foo.js, 16, 19)) -+>Any : Symbol(Any, Decl(foo.js, 1, 3)) - >err : Symbol(err, Decl(foo.js, 16, 19)) +@@= skipped -40, +40 lines =@@ try { } catch (/** @type {unknown} */ err) { console.log(err); } // should be OK >err : Symbol(err, Decl(foo.js, 17, 19)) @@ -49,7 +14,6 @@ try { } catch (/** @type {Unknown} */ err) { console.log(err); } // should be OK >err : Symbol(err, Decl(foo.js, 18, 19)) ->console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) -+>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) +>console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) ->log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) @@ -57,18 +21,7 @@ >err : Symbol(err, Decl(foo.js, 18, 19)) try { } catch (/** @type {unknown} */ err) { err.foo; } // error in the body -@@= skipped -22, +24 lines =@@ - - try { } catch (/** @type {Unknown} */ err) { err.foo; } // error in the body - >err : Symbol(err, Decl(foo.js, 20, 19)) -+>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) - >err : Symbol(err, Decl(foo.js, 20, 19)) - - try { } catch (/** @type {Error} */ err) { } // error in the type - >err : Symbol(err, Decl(foo.js, 21, 19)) -+>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) - - try { } catch (/** @type {object} */ err) { } // error in the type +@@= skipped -27, +27 lines =@@ >err : Symbol(err, Decl(foo.js, 22, 19)) try { console.log(); } @@ -91,12 +44,7 @@ >err : Symbol(err, Decl(foo.js, 26, 11)) } -@@= skipped -51, +53 lines =@@ - - try { } catch (/** @type {Any} */ { x }) { x.foo;} // should be OK - >x : Symbol(x, Decl(foo.js, 44, 39)) -+>Any : Symbol(Any, Decl(foo.js, 1, 3)) - >x : Symbol(x, Decl(foo.js, 44, 39)) +@@= skipped -46, +46 lines =@@ try { } catch (/** @type {unknown} */ { x }) { console.log(x); } // error in the destructure >x : Symbol(x, Decl(foo.js, 45, 43)) @@ -110,7 +58,6 @@ try { } catch (/** @type {Unknown} */ { x }) { console.log(x); } // error in the destructure >x : Symbol(x, Decl(foo.js, 46, 43)) ->console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) -+>Unknown : Symbol(Unknown, Decl(foo.js, 5, 3)) +>console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) ->log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) @@ -118,8 +65,3 @@ >x : Symbol(x, Decl(foo.js, 46, 43)) try { } catch (/** @type {Error} */ { x }) { } // error in the type - >x : Symbol(x, Decl(foo.js, 47, 41)) -+>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) - - try { } catch (/** @type {object} */ { x }) { } // error in the type - >x : Symbol(x, Decl(foo.js, 48, 42)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.types b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.types index 1c0986b44d..242800d865 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocCatchClauseWithTypeAnnotation.types @@ -3,14 +3,10 @@ === foo.js === /** * @typedef {any} Any ->Any : any - */ /** * @typedef {unknown} Unknown ->Unknown : unknown - */ function fn() { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.types b/testdata/baselines/reference/submodule/conformance/jsdocImportType.types index 5caeeb2fcd..b8e71d9b26 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.types @@ -3,8 +3,6 @@ === use.js === /// /** @typedef {import("./mod1")} C ->C : any - * @type {C} */ var c; >c : any diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types index f253db4008..68968909e1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types @@ -3,8 +3,6 @@ === use.js === /// /** @typedef {import("./mod1")} C ->C : any - * @type {C} */ var c; >c : any diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols index 904bda9f34..ad46e0cc6f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols @@ -12,8 +12,6 @@ module.exports.C = C === test.js === /** @typedef {import('./mod1').C} X */ ->X : Symbol(X, Decl(test.js, 0, 4)) - /** @param {X} c */ function demo(c) { >demo : Symbol(demo, Decl(test.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols.diff index d47544f1cd..729ff3ce9d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.symbols.diff @@ -16,12 +16,7 @@ >C : Symbol(C, Decl(mod1.js, 0, 0)) === test.js === - /** @typedef {import('./mod1').C} X */ -+>X : Symbol(X, Decl(test.js, 0, 4)) -+ - /** @param {X} c */ - function demo(c) { - >demo : Symbol(demo, Decl(test.js, 0, 0)) +@@= skipped -18, +13 lines =@@ >c : Symbol(c, Decl(test.js, 2, 14)) c.s diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.types b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.types index fbfd1623f1..708c0cd094 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportTypeReferenceToClassAlias.types @@ -18,8 +18,6 @@ module.exports.C = C === test.js === /** @typedef {import('./mod1').C} X */ ->X : any - /** @param {X} c */ function demo(c) { >demo : (c: any) => void diff --git a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols index 9ed7e5c846..01a5bad5e6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols @@ -41,9 +41,6 @@ function f3() { >f3 : Symbol(f3, Decl(jsdocSignatureOnReturnedFunction.js, 20, 1)) /** @type {(a: number, b: number) => number} */ ->a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 23, 16)) ->b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 23, 26)) - return (a, b) => { >a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 24, 12)) >b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 24, 14)) @@ -58,9 +55,6 @@ function f4() { >f4 : Symbol(f4, Decl(jsdocSignatureOnReturnedFunction.js, 27, 1)) /** @type {(a: number, b: number) => number} */ ->a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 30, 16)) ->b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 30, 26)) - return function (a, b){ >a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 31, 21)) >b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 31, 23)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols.diff deleted file mode 100644 index 9ecd04b0b1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocSignatureOnReturnedFunction.symbols.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.jsdocSignatureOnReturnedFunction.symbols -+++ new.jsdocSignatureOnReturnedFunction.symbols -@@= skipped -40, +40 lines =@@ - >f3 : Symbol(f3, Decl(jsdocSignatureOnReturnedFunction.js, 20, 1)) - - /** @type {(a: number, b: number) => number} */ -+>a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 23, 16)) -+>b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 23, 26)) -+ - return (a, b) => { - >a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 24, 12)) - >b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 24, 14)) -@@= skipped -14, +17 lines =@@ - >f4 : Symbol(f4, Decl(jsdocSignatureOnReturnedFunction.js, 27, 1)) - - /** @type {(a: number, b: number) => number} */ -+>a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 30, 16)) -+>b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 30, 26)) -+ - return function (a, b){ - >a : Symbol(a, Decl(jsdocSignatureOnReturnedFunction.js, 31, 21)) - >b : Symbol(b, Decl(jsdocSignatureOnReturnedFunction.js, 31, 23)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols index cee94ac2de..7d58faf926 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols @@ -4,20 +4,12 @@ /** * @template T * @typedef {(t: T) => T} Id ->t : Symbol(t, Decl(templateTagOnClasses.js, 2, 14)) ->T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) ->T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) - */ /** @template T */ class Foo { >Foo : Symbol(Foo, Decl(templateTagOnClasses.js, 0, 0)) /** @typedef {(t: T) => T} Id2 */ ->t : Symbol(t, Decl(templateTagOnClasses.js, 6, 19)) ->T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) ->T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) - /** @param {T} x */ constructor (x) { >x : Symbol(x, Decl(templateTagOnClasses.js, 8, 17)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff index 840d674735..9cdeba9d93 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.symbols.diff @@ -1,25 +1,6 @@ --- old.jsdocTemplateClass.symbols +++ new.jsdocTemplateClass.symbols -@@= skipped -3, +3 lines =@@ - /** - * @template T - * @typedef {(t: T) => T} Id -+>t : Symbol(t, Decl(templateTagOnClasses.js, 2, 14)) -+>T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) -+>T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) -+ - */ - /** @template T */ - class Foo { - >Foo : Symbol(Foo, Decl(templateTagOnClasses.js, 0, 0)) - - /** @typedef {(t: T) => T} Id2 */ -+>t : Symbol(t, Decl(templateTagOnClasses.js, 6, 19)) -+>T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) -+>T : Symbol(T, Decl(templateTagOnClasses.js, 4, 14)) -+ - /** @param {T} x */ - constructor (x) { +@@= skipped -14, +14 lines =@@ >x : Symbol(x, Decl(templateTagOnClasses.js, 8, 17)) this.a = x @@ -29,7 +10,7 @@ >x : Symbol(x, Decl(templateTagOnClasses.js, 8, 17)) } /** -@@= skipped -24, +30 lines =@@ +@@= skipped -13, +11 lines =@@ * @return {T} */ foo(x, y, alpha) { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.types index 0861a80600..34bdf98718 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateClass.types @@ -4,18 +4,12 @@ /** * @template T * @typedef {(t: T) => T} Id ->Id : any ->t : T - */ /** @template T */ class Foo { >Foo : Foo /** @typedef {(t: T) => T} Id2 */ ->Id2 : any ->t : T - /** @param {T} x */ constructor (x) { >x : T diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols index 6672d2842f..1506ef41bc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols @@ -4,11 +4,6 @@ /** * @template U * @typedef {(u: U) => U} Id ->Id : Symbol(Id, Decl(templateTagOnConstructorFunctions.js, 2, 3)) ->u : Symbol(u, Decl(templateTagOnConstructorFunctions.js, 2, 14)) ->U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 1, 13)) ->U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 1, 13)) - */ /** * @param {T} t diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff index e35d27904e..f5ca3a221d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.symbols.diff @@ -1,18 +1,6 @@ --- old.jsdocTemplateConstructorFunction.symbols +++ new.jsdocTemplateConstructorFunction.symbols -@@= skipped -3, +3 lines =@@ - /** - * @template U - * @typedef {(u: U) => U} Id -+>Id : Symbol(Id, Decl(templateTagOnConstructorFunctions.js, 2, 3)) -+>u : Symbol(u, Decl(templateTagOnConstructorFunctions.js, 2, 14)) -+>U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 1, 13)) -+>U : Symbol(U, Decl(templateTagOnConstructorFunctions.js, 1, 13)) -+ - */ - /** - * @param {T} t -@@= skipped -11, +16 lines =@@ +@@= skipped -14, +14 lines =@@ /** @type {T} */ this.u diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types index 2ade37b48f..e3e64c3c17 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction.types @@ -4,9 +4,6 @@ /** * @template U * @typedef {(u: U) => U} Id ->Id : Id ->u : U - */ /** * @param {T} t diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols index 37652f67ec..96c138e344 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols @@ -52,8 +52,6 @@ let answer = z.add(3, { nested: 4 }) /** * @typedef {Object} A * @property {T} value ->T : Symbol(T) - */ /** @type {A} */ const options = { value: null }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols.diff index 46273a26b7..8e6b8db528 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.symbols.diff @@ -69,11 +69,3 @@ >nested : Symbol(nested, Decl(templateTagWithNestedTypeLiteral.js, 22, 23)) // lookup in typedef should not crash the compiler, even when the type is unknown - /** - * @typedef {Object} A - * @property {T} value -+>T : Symbol(T) -+ - */ - /** @type {A} */ - const options = { value: null }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types index 244e78e0ac..6248d2cc34 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateConstructorFunction2.types @@ -89,11 +89,7 @@ let answer = z.add(3, { nested: 4 }) // lookup in typedef should not crash the compiler, even when the type is unknown /** * @typedef {Object} A ->A : any - * @property {T} value ->value : any - */ /** @type {A} */ const options = { value: null }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols index af62c28993..2d734a70fb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols @@ -4,8 +4,6 @@ /** * @template const T * @typedef {[T]} X ->T : Symbol(T, Decl(a.js, 6, 13)) - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff deleted file mode 100644 index 4ab7ad7f94..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsdocTemplateTag7.symbols -+++ new.jsdocTemplateTag7.symbols -@@= skipped -3, +3 lines =@@ - /** - * @template const T - * @typedef {[T]} X -+>T : Symbol(T, Decl(a.js, 6, 13)) -+ - */ - - /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.types index dba307f980..7a49d72b4a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag7.types @@ -4,8 +4,6 @@ /** * @template const T * @typedef {[T]} X ->X : any - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols index 534446e1ab..5b6d103ed0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols @@ -5,8 +5,6 @@ * @template out T * @typedef {Object} Covariant * @property {T} x ->T : Symbol(T) - */ /** @@ -35,9 +33,6 @@ sub_covariant = super_covariant; // Error * @template in T * @typedef {Object} Contravariant * @property {(x: T) => void} f ->x : Symbol(x, Decl(a.js, 22, 15)) ->T : Symbol(T) - */ /** @@ -68,10 +63,6 @@ sub_contravariant = super_contravariant; * @template in out T * @typedef {Object} Invariant * @property {(x: T) => T} f ->x : Symbol(x, Decl(a.js, 41, 15)) ->T : Symbol(T) ->T : Symbol(T) - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols.diff deleted file mode 100644 index 29b2b01e24..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.symbols.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.jsdocTemplateTag8.symbols -+++ new.jsdocTemplateTag8.symbols -@@= skipped -4, +4 lines =@@ - * @template out T - * @typedef {Object} Covariant - * @property {T} x -+>T : Symbol(T) -+ - */ - - /** -@@= skipped -28, +30 lines =@@ - * @template in T - * @typedef {Object} Contravariant - * @property {(x: T) => void} f -+>x : Symbol(x, Decl(a.js, 22, 15)) -+>T : Symbol(T) -+ - */ - - /** -@@= skipped -30, +33 lines =@@ - * @template in out T - * @typedef {Object} Invariant - * @property {(x: T) => T} f -+>x : Symbol(x, Decl(a.js, 41, 15)) -+>T : Symbol(T) -+>T : Symbol(T) -+ - */ - - /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.types index 638bed4f39..87dbc6fdee 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag8.types @@ -4,11 +4,7 @@ /** * @template out T * @typedef {Object} Covariant ->Covariant : any - * @property {T} x ->x : any - */ /** @@ -42,12 +38,7 @@ sub_covariant = super_covariant; // Error /** * @template in T * @typedef {Object} Contravariant ->Contravariant : any - * @property {(x: T) => void} f ->f : any ->x : T - */ /** @@ -83,12 +74,7 @@ sub_contravariant = super_contravariant; /** * @template in out T * @typedef {Object} Invariant ->Invariant : any - * @property {(x: T) => T} f ->f : any ->x : T - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols index 34cb3c6184..98d9cea415 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols @@ -4,8 +4,6 @@ /** * @template {string | number} [T=string] - ok: defaults are permitted * @typedef {[T]} A ->T : Symbol(T) - */ /** @type {A} */ // ok, default for `T` in `A` is `string` @@ -28,46 +26,28 @@ const aNumber = [0]; * @template T * @template [U=T] - ok: default can reference earlier type parameter * @typedef {[T, U]} B ->B : Symbol(B, Decl(file.js, 17, 3)) ->T : Symbol(T, Decl(file.js, 15, 13)) ->U : Symbol(U, Decl(file.js, 16, 13)) - */ /** * @template {string | number} [T] - error: default requires an `=type` * @typedef {[T]} C ->C : Symbol(C, Decl(file.js, 22, 3)) ->T : Symbol(T, Decl(file.js, 21, 31)) - */ /** * @template {string | number} [T=] - error: default requires a `type` * @typedef {[T]} D ->D : Symbol(D, Decl(file.js, 27, 3)) ->T : Symbol(T, Decl(file.js, 26, 31)) - */ /** * @template {string | number} [T=string] * @template U - error: Required type parameters cannot follow optional type parameters * @typedef {[T, U]} E ->E : Symbol(E, Decl(file.js, 33, 3)) ->T : Symbol(T, Decl(file.js, 31, 31)) ->U : Symbol(U, Decl(file.js, 32, 13)) - */ /** * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. * @template [U=T] * @typedef {[T, U]} G ->G : Symbol(G, Decl(file.js, 39, 3)) ->T : Symbol(T, Decl(file.js, 37, 13)) ->U : Symbol(U, Decl(file.js, 38, 13)) - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff deleted file mode 100644 index 8704cd6af0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.symbols.diff +++ /dev/null @@ -1,58 +0,0 @@ ---- old.jsdocTemplateTagDefault.symbols -+++ new.jsdocTemplateTagDefault.symbols -@@= skipped -3, +3 lines =@@ - /** - * @template {string | number} [T=string] - ok: defaults are permitted - * @typedef {[T]} A -+>T : Symbol(T) -+ - */ - - /** @type {A} */ // ok, default for `T` in `A` is `string` -@@= skipped -22, +24 lines =@@ - * @template T - * @template [U=T] - ok: default can reference earlier type parameter - * @typedef {[T, U]} B -+>B : Symbol(B, Decl(file.js, 17, 3)) -+>T : Symbol(T, Decl(file.js, 15, 13)) -+>U : Symbol(U, Decl(file.js, 16, 13)) -+ - */ - - /** - * @template {string | number} [T] - error: default requires an `=type` - * @typedef {[T]} C -+>C : Symbol(C, Decl(file.js, 22, 3)) -+>T : Symbol(T, Decl(file.js, 21, 31)) -+ - */ - - /** - * @template {string | number} [T=] - error: default requires a `type` - * @typedef {[T]} D -+>D : Symbol(D, Decl(file.js, 27, 3)) -+>T : Symbol(T, Decl(file.js, 26, 31)) -+ - */ - - /** - * @template {string | number} [T=string] - * @template U - error: Required type parameters cannot follow optional type parameters - * @typedef {[T, U]} E -+>E : Symbol(E, Decl(file.js, 33, 3)) -+>T : Symbol(T, Decl(file.js, 31, 31)) -+>U : Symbol(U, Decl(file.js, 32, 13)) -+ - */ - - /** - * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. - * @template [U=T] - * @typedef {[T, U]} G -+>G : Symbol(G, Decl(file.js, 39, 3)) -+>T : Symbol(T, Decl(file.js, 37, 13)) -+>U : Symbol(U, Decl(file.js, 38, 13)) -+ - */ - - /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.types index bfd0ce0999..c191b65f31 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.types @@ -4,8 +4,6 @@ /** * @template {string | number} [T=string] - ok: defaults are permitted * @typedef {[T]} A ->A : any - */ /** @type {A} */ // ok, default for `T` in `A` is `string` @@ -36,38 +34,28 @@ const aNumber = [0]; * @template T * @template [U=T] - ok: default can reference earlier type parameter * @typedef {[T, U]} B ->B : B - */ /** * @template {string | number} [T] - error: default requires an `=type` * @typedef {[T]} C ->C : C - */ /** * @template {string | number} [T=] - error: default requires a `type` * @typedef {[T]} D ->D : D - */ /** * @template {string | number} [T=string] * @template U - error: Required type parameters cannot follow optional type parameters * @typedef {[T, U]} E ->E : E - */ /** * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. * @template [U=T] * @typedef {[T, U]} G ->G : G - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols index 805f1eb548..e1f0a0b044 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols @@ -4,12 +4,7 @@ /** * @template T * @template {keyof T} K ->T : Symbol(T) - * @typedef {T[K]} Foo ->T : Symbol(T) ->K : Symbol(K) - */ const x = { a: 1 }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols.diff deleted file mode 100644 index ec4f6357fe..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.symbols.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.jsdocTemplateTagNameResolution.symbols -+++ new.jsdocTemplateTagNameResolution.symbols -@@= skipped -3, +3 lines =@@ - /** - * @template T - * @template {keyof T} K -+>T : Symbol(T) -+ - * @typedef {T[K]} Foo -+>T : Symbol(T) -+>K : Symbol(K) -+ - */ - - const x = { a: 1 }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.types b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.types index f7c72457bc..5d05ab34ac 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.types @@ -5,8 +5,6 @@ * @template T * @template {keyof T} K * @typedef {T[K]} Foo ->Foo : any - */ const x = { a: 1 }; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types index 8416315b49..e0b15c5774 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types @@ -8,7 +8,6 @@ const MW = require("./MW"); >"./MW" : "./MW" /** @typedef {number} Cictema */ ->Cictema : any module.exports = class MC { >module.exports = class MC { watch() { return new MW(this); }} : typeof MC diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types index fc8eeeecf5..1536a69a39 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types @@ -8,7 +8,6 @@ const MW = require("./MW"); >"./MW" : "./MW" /** @typedef {number} Meyerhauser */ ->Meyerhauser : any /** @class */ module.exports = function MC() { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols index 6fff15f1fa..ac5f84655a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols @@ -81,47 +81,38 @@ var someFakeClass = new SomeFakeClass(); someBase = /** @type {SomeBase} */(someDerived); >someBase : Symbol(someBase, Decl(b.js, 37, 3)) ->SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) someBase = /** @type {SomeBase} */(someBase); >someBase : Symbol(someBase, Decl(b.js, 37, 3)) ->SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) >someBase : Symbol(someBase, Decl(b.js, 37, 3)) someBase = /** @type {SomeBase} */(someOther); // Error >someBase : Symbol(someBase, Decl(b.js, 37, 3)) ->SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) >someOther : Symbol(someOther, Decl(b.js, 39, 3)) someDerived = /** @type {SomeDerived} */(someDerived); >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) ->SomeDerived : Symbol(SomeDerived, Decl(b.js, 18, 1)) >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) someDerived = /** @type {SomeDerived} */(someBase); >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) ->SomeDerived : Symbol(SomeDerived, Decl(b.js, 18, 1)) >someBase : Symbol(someBase, Decl(b.js, 37, 3)) someDerived = /** @type {SomeDerived} */(someOther); // Error >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) ->SomeDerived : Symbol(SomeDerived, Decl(b.js, 18, 1)) >someOther : Symbol(someOther, Decl(b.js, 39, 3)) someOther = /** @type {SomeOther} */(someDerived); // Error >someOther : Symbol(someOther, Decl(b.js, 39, 3)) ->SomeOther : Symbol(SomeOther, Decl(b.js, 24, 1)) >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) someOther = /** @type {SomeOther} */(someBase); // Error >someOther : Symbol(someOther, Decl(b.js, 39, 3)) ->SomeOther : Symbol(SomeOther, Decl(b.js, 24, 1)) >someBase : Symbol(someBase, Decl(b.js, 37, 3)) someOther = /** @type {SomeOther} */(someOther); >someOther : Symbol(someOther, Decl(b.js, 39, 3)) ->SomeOther : Symbol(SomeOther, Decl(b.js, 24, 1)) >someOther : Symbol(someOther, Decl(b.js, 39, 3)) someFakeClass = someBase; @@ -138,7 +129,6 @@ someBase = someFakeClass; // Error someBase = /** @type {SomeBase} */(someFakeClass); >someBase : Symbol(someBase, Decl(b.js, 37, 3)) ->SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) >someFakeClass : Symbol(someFakeClass, Decl(b.js, 40, 3)) // Type assertion cannot be a type-predicate type @@ -152,7 +142,6 @@ var str; if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error >numOrStr : Symbol(numOrStr, Decl(b.js, 62, 3)) ->numOrStr : Symbol(numOrStr, Decl(b.js, 62, 3)) >undefined : Symbol(undefined) str = numOrStr; // Error, no narrowing occurred @@ -163,11 +152,9 @@ if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error var asConst1 = /** @type {const} */(1); >asConst1 : Symbol(asConst1, Decl(b.js, 70, 3)) ->const : Symbol(const) var asConst2 = /** @type {const} */({ >asConst2 : Symbol(asConst2, Decl(b.js, 71, 3)) ->const : Symbol(const) x: 1 >x : Symbol(x, Decl(b.js, 71, 37)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols.diff index 5e1684c4c8..336a326137 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagCast.symbols.diff @@ -40,79 +40,3 @@ } // Type assertion should check for assignability in either direction -@@= skipped -24, +21 lines =@@ - - someBase = /** @type {SomeBase} */(someDerived); - >someBase : Symbol(someBase, Decl(b.js, 37, 3)) -+>SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) - >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) - - someBase = /** @type {SomeBase} */(someBase); - >someBase : Symbol(someBase, Decl(b.js, 37, 3)) -+>SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) - >someBase : Symbol(someBase, Decl(b.js, 37, 3)) - - someBase = /** @type {SomeBase} */(someOther); // Error - >someBase : Symbol(someBase, Decl(b.js, 37, 3)) -+>SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) - >someOther : Symbol(someOther, Decl(b.js, 39, 3)) - - someDerived = /** @type {SomeDerived} */(someDerived); - >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) -+>SomeDerived : Symbol(SomeDerived, Decl(b.js, 18, 1)) - >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) - - someDerived = /** @type {SomeDerived} */(someBase); - >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) -+>SomeDerived : Symbol(SomeDerived, Decl(b.js, 18, 1)) - >someBase : Symbol(someBase, Decl(b.js, 37, 3)) - - someDerived = /** @type {SomeDerived} */(someOther); // Error - >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) -+>SomeDerived : Symbol(SomeDerived, Decl(b.js, 18, 1)) - >someOther : Symbol(someOther, Decl(b.js, 39, 3)) - - someOther = /** @type {SomeOther} */(someDerived); // Error - >someOther : Symbol(someOther, Decl(b.js, 39, 3)) -+>SomeOther : Symbol(SomeOther, Decl(b.js, 24, 1)) - >someDerived : Symbol(someDerived, Decl(b.js, 38, 3)) - - someOther = /** @type {SomeOther} */(someBase); // Error - >someOther : Symbol(someOther, Decl(b.js, 39, 3)) -+>SomeOther : Symbol(SomeOther, Decl(b.js, 24, 1)) - >someBase : Symbol(someBase, Decl(b.js, 37, 3)) - - someOther = /** @type {SomeOther} */(someOther); - >someOther : Symbol(someOther, Decl(b.js, 39, 3)) -+>SomeOther : Symbol(SomeOther, Decl(b.js, 24, 1)) - >someOther : Symbol(someOther, Decl(b.js, 39, 3)) - - someFakeClass = someBase; -@@= skipped -48, +57 lines =@@ - - someBase = /** @type {SomeBase} */(someFakeClass); - >someBase : Symbol(someBase, Decl(b.js, 37, 3)) -+>SomeBase : Symbol(SomeBase, Decl(b.js, 12, 33)) - >someFakeClass : Symbol(someFakeClass, Decl(b.js, 40, 3)) - - // Type assertion cannot be a type-predicate type -@@= skipped -13, +14 lines =@@ - - if(/** @type {numOrStr is string} */(numOrStr === undefined)) { // Error - >numOrStr : Symbol(numOrStr, Decl(b.js, 62, 3)) -+>numOrStr : Symbol(numOrStr, Decl(b.js, 62, 3)) - >undefined : Symbol(undefined) - - str = numOrStr; // Error, no narrowing occurred -@@= skipped -10, +11 lines =@@ - - var asConst1 = /** @type {const} */(1); - >asConst1 : Symbol(asConst1, Decl(b.js, 70, 3)) -+>const : Symbol(const) - - var asConst2 = /** @type {const} */({ - >asConst2 : Symbol(asConst2, Decl(b.js, 71, 3)) -+>const : Symbol(const) - - x: 1 - >x : Symbol(x, Decl(b.js, 71, 37)) diff --git a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols index 789cb1695a..ce83e60743 100644 --- a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols +++ b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols @@ -9,22 +9,13 @@ declare namespace NS { } === linkTagEmit1.js === /** @typedef {number} N */ ->N : Symbol(N, Decl(linkTagEmit1.js, 0, 4)) - /** * @typedef {Object} D1 ->D1 : Symbol(D1, Decl(linkTagEmit1.js, 2, 3)) - * @property {1} e Just link to {@link NS.R} this time ->e : Symbol(e, Decl(linkTagEmit1.js, 3, 3)) - * @property {1} m Wyatt Earp loved {@link N integers} I bet. ->m : Symbol(m, Decl(linkTagEmit1.js, 4, 3)) - */ /** @typedef {number} Z @see N {@link N} */ ->Z : Symbol(Z, Decl(linkTagEmit1.js, 7, 4)) /** * @param {number} integer {@link Z} diff --git a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols.diff b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols.diff deleted file mode 100644 index ee2cf90c29..0000000000 --- a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.symbols.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.linkTagEmit1.symbols -+++ new.linkTagEmit1.symbols -@@= skipped -8, +8 lines =@@ - } - === linkTagEmit1.js === - /** @typedef {number} N */ -+>N : Symbol(N, Decl(linkTagEmit1.js, 0, 4)) -+ - /** - * @typedef {Object} D1 -+>D1 : Symbol(D1, Decl(linkTagEmit1.js, 2, 3)) -+ - * @property {1} e Just link to {@link NS.R} this time -+>e : Symbol(e, Decl(linkTagEmit1.js, 3, 3)) -+ - * @property {1} m Wyatt Earp loved {@link N integers} I bet. -+>m : Symbol(m, Decl(linkTagEmit1.js, 4, 3)) -+ - */ - - /** @typedef {number} Z @see N {@link N} */ -+>Z : Symbol(Z, Decl(linkTagEmit1.js, 7, 4)) - - /** - * @param {number} integer {@link Z} diff --git a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.types b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.types index 0f26e10682..567ff79cd7 100644 --- a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.types +++ b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.types @@ -7,22 +7,13 @@ declare namespace NS { } === linkTagEmit1.js === /** @typedef {number} N */ ->N : number - /** * @typedef {Object} D1 ->D1 : D1 - * @property {1} e Just link to {@link NS.R} this time ->e : any - * @property {1} m Wyatt Earp loved {@link N integers} I bet. ->m : any - */ /** @typedef {number} Z @see N {@link N} */ ->Z : number /** * @param {number} integer {@link Z} diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types index f44f63f114..fcde31ff62 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types @@ -20,8 +20,6 @@ function bar() { return 4 } >4 : 4 /** @typedef {() => number} buz */ ->buz : any - module.exports = { >module.exports = { Thing, AnotherThing, foo, qux: bar, baz() { return 5 }, literal: "",} : { Thing: typeof Thing; AnotherThing: typeof AnotherThing; foo: () => number; qux: () => number; baz: () => number; literal: string; } >module.exports : any diff --git a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols index 401d9b6dfd..9d67f80a46 100644 --- a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols +++ b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols @@ -2,8 +2,6 @@ === bug26693.js === /** @typedef {module:locale} hi */ ->module : Symbol(module) - import { nope } from 'nope'; >nope : Symbol(nope, Decl(bug26693.js, 1, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols.diff b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols.diff deleted file mode 100644 index c4024f08b9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.noAssertForUnparseableTypedefs.symbols -+++ new.noAssertForUnparseableTypedefs.symbols -@@= skipped -1, +1 lines =@@ - - === bug26693.js === - /** @typedef {module:locale} hi */ -+>module : Symbol(module) -+ - import { nope } from 'nope'; - >nope : Symbol(nope, Decl(bug26693.js, 1, 8)) - diff --git a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.types b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.types index a9cf0bfb34..1348f93ae0 100644 --- a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.types +++ b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.types @@ -2,8 +2,6 @@ === bug26693.js === /** @typedef {module:locale} hi */ -> : any - import { nope } from 'nope'; >nope : any diff --git a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols index 0b79027f14..bad0a065a3 100644 --- a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols +++ b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols @@ -3,11 +3,7 @@ === /a.js === /** * @typedef Foo ->Foo : Symbol(Foo, Decl(a.js, 1, 3)) - * @property {string} a ->a : Symbol(a, Decl(a.js, 2, 3)) - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols.diff b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols.diff deleted file mode 100644 index 51c8fc1ae6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.optionalBindingParameters3.symbols -+++ new.optionalBindingParameters3.symbols -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef Foo -+>Foo : Symbol(Foo, Decl(a.js, 1, 3)) -+ - * @property {string} a -+>a : Symbol(a, Decl(a.js, 2, 3)) -+ - */ - - /** diff --git a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.types b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.types index 68c1199f1e..bda26722ba 100644 --- a/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.types +++ b/testdata/baselines/reference/submodule/conformance/optionalBindingParameters3.types @@ -3,11 +3,7 @@ === /a.js === /** * @typedef Foo ->Foo : Foo - * @property {string} a ->a : any - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols index dfd24249e5..d95f892db4 100644 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols @@ -2,69 +2,25 @@ === bug39372.js === /** @typedef {ReadonlyArray} JsonArray */ ->ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --)) ->Json : Symbol(Json, Decl(bug39372.js, 2, 4)) - /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ ->key : Symbol(key, Decl(bug39372.js, 1, 26)) ->Json : Symbol(Json, Decl(bug39372.js, 2, 4)) - /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ ->JsonRecord : Symbol(JsonRecord, Decl(bug39372.js, 1, 4)) ->JsonArray : Symbol(JsonArray, Decl(bug39372.js, 0, 4)) /** * @template T * @typedef {{ $A: { ->$A : Symbol($A, Decl(bug39372.js, 6, 14)) - [K in keyof T]?: XMLObject[] ->K : Symbol(K, Decl(bug39372.js, 8, 5)) ->T : Symbol(T) ->XMLObject : Symbol(XMLObject, Decl(bug39372.js, 6, 3)) ->T : Symbol(T) ->K : Symbol(K, Decl(bug39372.js, 8, 5)) - }, $O: { ->$O : Symbol($O, Decl(bug39372.js, 9, 4)) - [K in keyof T]?: { ->K : Symbol(K, Decl(bug39372.js, 11, 5)) ->T : Symbol(T) - $$?: Record ->$$ : Symbol($$, Decl(bug39372.js, 11, 22)) ->Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) - } & (T[K] extends string ? {$:string} : XMLObject) ->T : Symbol(T) ->K : Symbol(K, Decl(bug39372.js, 11, 5)) ->$ : Symbol($, Decl(bug39372.js, 13, 32)) ->XMLObject : Symbol(XMLObject, Decl(bug39372.js, 6, 3)) ->T : Symbol(T) ->K : Symbol(K, Decl(bug39372.js, 11, 5)) - }, $$?: Record, ->$$ : Symbol($$, Decl(bug39372.js, 14, 4)) ->Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) - } & { [K in keyof T]?: ( ->K : Symbol(K, Decl(bug39372.js, 17, 3)) ->T : Symbol(T) - T[K] extends string ? string ->T : Symbol(T) ->K : Symbol(K, Decl(bug39372.js, 17, 3)) - : XMLObject ->XMLObject : Symbol(XMLObject, Decl(bug39372.js, 6, 3)) ->T : Symbol(T) ->K : Symbol(K, Decl(bug39372.js, 17, 3)) - ) }} XMLObject */ diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff deleted file mode 100644 index 583b8ecb8a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.symbols.diff +++ /dev/null @@ -1,72 +0,0 @@ ---- old.recursiveTypeReferences2.symbols -+++ new.recursiveTypeReferences2.symbols -@@= skipped -1, +1 lines =@@ - - === bug39372.js === - /** @typedef {ReadonlyArray} JsonArray */ -+>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --)) -+>Json : Symbol(Json, Decl(bug39372.js, 2, 4)) -+ - /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ -+>key : Symbol(key, Decl(bug39372.js, 1, 26)) -+>Json : Symbol(Json, Decl(bug39372.js, 2, 4)) -+ - /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ -+>JsonRecord : Symbol(JsonRecord, Decl(bug39372.js, 1, 4)) -+>JsonArray : Symbol(JsonArray, Decl(bug39372.js, 0, 4)) - - /** - * @template T - * @typedef {{ - $A: { -+>$A : Symbol($A, Decl(bug39372.js, 6, 14)) -+ - [K in keyof T]?: XMLObject[] -+>K : Symbol(K, Decl(bug39372.js, 8, 5)) -+>T : Symbol(T) -+>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 6, 3)) -+>T : Symbol(T) -+>K : Symbol(K, Decl(bug39372.js, 8, 5)) -+ - }, - $O: { -+>$O : Symbol($O, Decl(bug39372.js, 9, 4)) -+ - [K in keyof T]?: { -+>K : Symbol(K, Decl(bug39372.js, 11, 5)) -+>T : Symbol(T) -+ - $$?: Record -+>$$ : Symbol($$, Decl(bug39372.js, 11, 22)) -+>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) -+ - } & (T[K] extends string ? {$:string} : XMLObject) -+>T : Symbol(T) -+>K : Symbol(K, Decl(bug39372.js, 11, 5)) -+>$ : Symbol($, Decl(bug39372.js, 13, 32)) -+>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 6, 3)) -+>T : Symbol(T) -+>K : Symbol(K, Decl(bug39372.js, 11, 5)) -+ - }, - $$?: Record, -+>$$ : Symbol($$, Decl(bug39372.js, 14, 4)) -+>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) -+ - } & { - [K in keyof T]?: ( -+>K : Symbol(K, Decl(bug39372.js, 17, 3)) -+>T : Symbol(T) -+ - T[K] extends string ? string -+>T : Symbol(T) -+>K : Symbol(K, Decl(bug39372.js, 17, 3)) -+ - : XMLObject -+>XMLObject : Symbol(XMLObject, Decl(bug39372.js, 6, 3)) -+>T : Symbol(T) -+>K : Symbol(K, Decl(bug39372.js, 17, 3)) -+ - ) - }} XMLObject */ - diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.types b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.types index 36970d4b65..fd81757bb2 100644 --- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.types +++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.types @@ -2,14 +2,8 @@ === bug39372.js === /** @typedef {ReadonlyArray} JsonArray */ ->JsonArray : any - /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ ->JsonRecord : any ->key : string - /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ ->Json : any /** * @template T @@ -29,7 +23,6 @@ : XMLObject ) }} XMLObject */ ->XMLObject : any /** @type {XMLObject<{foo:string}>} */ const p = {}; diff --git a/testdata/baselines/reference/submodule/conformance/seeTag4.types b/testdata/baselines/reference/submodule/conformance/seeTag4.types index 3ca51fe2f0..3d11dc5b50 100644 --- a/testdata/baselines/reference/submodule/conformance/seeTag4.types +++ b/testdata/baselines/reference/submodule/conformance/seeTag4.types @@ -3,8 +3,6 @@ === seeTag4.js === /** * @typedef {any} A ->A : any - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols index 6e8e4c6176..15ac0e4570 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols @@ -24,11 +24,7 @@ const identity = x => x; /** * @typedef Nested ->Nested : Symbol(Nested, Decl(templateInsideCallback.js, 19, 3)) - * @property {Object} oh ->oh : Symbol(oh, Decl(templateInsideCallback.js, 20, 3)) - * @property {number} oh.no * @template T * @property {string} oh.noooooo diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff index 14c0dfa290..5e0b33b705 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.symbols.diff @@ -1,18 +1,6 @@ --- old.templateInsideCallback.symbols +++ new.templateInsideCallback.symbols -@@= skipped -23, +23 lines =@@ - - /** - * @typedef Nested -+>Nested : Symbol(Nested, Decl(templateInsideCallback.js, 19, 3)) -+ - * @property {Object} oh -+>oh : Symbol(oh, Decl(templateInsideCallback.js, 20, 3)) -+ - * @property {number} oh.no - * @template T - * @property {string} oh.noooooo -@@= skipped -39, +43 lines =@@ +@@= skipped -62, +62 lines =@@ for (let i = 0; i < array.length; i += 1) { >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) >i : Symbol(i, Decl(templateInsideCallback.js, 49, 10)) diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.types b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.types index 43abf90b75..cd3fad61e8 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.types +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.types @@ -25,22 +25,10 @@ const identity = x => x; /** * @typedef Nested ->Nested : Nested - * @property {Object} oh ->oh : any - * @property {number} oh.no ->property : any ->oh : any ->no : any - * @template T * @property {string} oh.noooooo ->property : any ->oh : any ->noooooo : any - */ diff --git a/testdata/baselines/reference/submodule/conformance/thisTag3.symbols b/testdata/baselines/reference/submodule/conformance/thisTag3.symbols index 32a1c15ff6..158935a1ac 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag3.symbols +++ b/testdata/baselines/reference/submodule/conformance/thisTag3.symbols @@ -3,9 +3,6 @@ === /a.js === /** * @typedef {{fn(a: string): void}} T ->fn : Symbol(fn, Decl(a.js, 1, 14)) ->a : Symbol(a, Decl(a.js, 1, 17)) - */ class C { diff --git a/testdata/baselines/reference/submodule/conformance/thisTag3.symbols.diff b/testdata/baselines/reference/submodule/conformance/thisTag3.symbols.diff index 9fced7444e..98e2feb073 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/thisTag3.symbols.diff @@ -1,16 +1,6 @@ --- old.thisTag3.symbols +++ new.thisTag3.symbols -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef {{fn(a: string): void}} T -+>fn : Symbol(fn, Decl(a.js, 1, 14)) -+>a : Symbol(a, Decl(a.js, 1, 17)) -+ - */ - - class C { -@@= skipped -10, +13 lines =@@ +@@= skipped -12, +12 lines =@@ * @param {string} a */ p = (a) => this.fn("" + a); diff --git a/testdata/baselines/reference/submodule/conformance/thisTag3.types b/testdata/baselines/reference/submodule/conformance/thisTag3.types index 3647527785..7a0779ce9c 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTag3.types +++ b/testdata/baselines/reference/submodule/conformance/thisTag3.types @@ -3,10 +3,6 @@ === /a.js === /** * @typedef {{fn(a: string): void}} T ->T : any ->fn : (a: string) => void ->a : string - */ class C { diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols index 4f2afd328c..dee3378ce7 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols @@ -2,11 +2,6 @@ === typeTagNoErasure.js === /** @template T @typedef {(data: T1) => T1} Test */ ->T1 : Symbol(T1, Decl(typeTagNoErasure.js, 0, 27)) ->T : Symbol(T) ->data : Symbol(data, Decl(typeTagNoErasure.js, 0, 41)) ->T1 : Symbol(T1, Decl(typeTagNoErasure.js, 0, 27)) ->T1 : Symbol(T1, Decl(typeTagNoErasure.js, 0, 27)) /** @type {Test} */ const test = dibbity => dibbity diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols.diff deleted file mode 100644 index f85d4106d4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.typeTagNoErasure.symbols -+++ new.typeTagNoErasure.symbols -@@= skipped -1, +1 lines =@@ - - === typeTagNoErasure.js === - /** @template T @typedef {(data: T1) => T1} Test */ -+>T1 : Symbol(T1, Decl(typeTagNoErasure.js, 0, 27)) -+>T : Symbol(T) -+>data : Symbol(data, Decl(typeTagNoErasure.js, 0, 41)) -+>T1 : Symbol(T1, Decl(typeTagNoErasure.js, 0, 27)) -+>T1 : Symbol(T1, Decl(typeTagNoErasure.js, 0, 27)) - - /** @type {Test} */ - const test = dibbity => dibbity diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.types b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.types index 26b0d0432d..ef248f206c 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.types +++ b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.types @@ -2,8 +2,6 @@ === typeTagNoErasure.js === /** @template T @typedef {(data: T1) => T1} Test */ ->Test : any ->data : T1 /** @type {Test} */ const test = dibbity => dibbity diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols index 1c91c05ffe..3aceee0202 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols @@ -3,12 +3,6 @@ === typeTagOnFunctionReferencesGeneric.js === /** * @typedef {(m : T) => T} IFn ->IFn : Symbol(IFn, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 3)) ->T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) ->m : Symbol(m, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 17)) ->T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) ->T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) - */ /**@type {IFn}*/ diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff deleted file mode 100644 index c8d1067a80..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.symbols.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.typeTagOnFunctionReferencesGeneric.symbols -+++ new.typeTagOnFunctionReferencesGeneric.symbols -@@= skipped -2, +2 lines =@@ - === typeTagOnFunctionReferencesGeneric.js === - /** - * @typedef {(m : T) => T} IFn -+>IFn : Symbol(IFn, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 3)) -+>T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) -+>m : Symbol(m, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 17)) -+>T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) -+>T : Symbol(T, Decl(typeTagOnFunctionReferencesGeneric.js, 1, 14)) -+ - */ - - /**@type {IFn}*/ diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types index afa5001ced..4b523d5efb 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types @@ -3,9 +3,6 @@ === typeTagOnFunctionReferencesGeneric.js === /** * @typedef {(m : T) => T} IFn ->IFn : IFn ->m : T - */ /**@type {IFn}*/ diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols index b6827b632e..5099a3d4b5 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols @@ -8,17 +8,8 @@ declare var module: { exports: any}; === mod1.js === /// /** @typedef {{ type: "a", x: 1 }} A */ ->type : Symbol(type, Decl(mod1.js, 1, 15)) ->x : Symbol(x, Decl(mod1.js, 1, 26)) - /** @typedef {{ type: "b", y: 1 }} B */ ->type : Symbol(type, Decl(mod1.js, 2, 15)) ->y : Symbol(y, Decl(mod1.js, 2, 26)) - /** @typedef {A | B} Both */ ->A : Symbol(A, Decl(mod1.js, 1, 4)) ->B : Symbol(B, Decl(mod1.js, 2, 4)) - module.exports = C >module.exports : Symbol(exports, Decl(commonjs.d.ts, 0, 21)) >module : Symbol(module, Decl(commonjs.d.ts, 0, 11)) @@ -34,19 +25,8 @@ function C() { === mod2.js === /// /** @typedef {{ type: "a", x: 1 }} A */ ->A : Symbol(A, Decl(mod2.js, 1, 4)) ->type : Symbol(type, Decl(mod2.js, 1, 15)) ->x : Symbol(x, Decl(mod2.js, 1, 26)) - /** @typedef {{ type: "b", y: 1 }} B */ ->B : Symbol(B, Decl(mod2.js, 2, 4)) ->type : Symbol(type, Decl(mod2.js, 2, 15)) ->y : Symbol(y, Decl(mod2.js, 2, 26)) - /** @typedef {A | B} Both */ ->Both : Symbol(Both, Decl(mod2.js, 3, 4)) ->A : Symbol(A, Decl(mod2.js, 1, 4)) ->B : Symbol(B, Decl(mod2.js, 2, 4)) export function C() { >C : Symbol(C, Decl(mod2.js, 0, 0)) @@ -55,18 +35,11 @@ export function C() { } === mod3.js === + /// /** @typedef {{ type: "a", x: 1 }} A */ ->type : Symbol(type, Decl(mod3.js, 1, 15)) ->x : Symbol(x, Decl(mod3.js, 1, 26)) - /** @typedef {{ type: "b", y: 1 }} B */ ->type : Symbol(type, Decl(mod3.js, 2, 15)) ->y : Symbol(y, Decl(mod3.js, 2, 26)) - /** @typedef {A | B} Both */ ->A : Symbol(A, Decl(mod3.js, 1, 4)) ->B : Symbol(B, Decl(mod3.js, 2, 4)) exports.C = function() { this.p = 1 diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff index 753887e3f3..991bda7cb7 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff @@ -1,20 +1,8 @@ --- old.typedefCrossModule.symbols +++ new.typedefCrossModule.symbols -@@= skipped -7, +7 lines =@@ - === mod1.js === - /// - /** @typedef {{ type: "a", x: 1 }} A */ -+>type : Symbol(type, Decl(mod1.js, 1, 15)) -+>x : Symbol(x, Decl(mod1.js, 1, 26)) -+ +@@= skipped -10, +10 lines =@@ /** @typedef {{ type: "b", y: 1 }} B */ -+>type : Symbol(type, Decl(mod1.js, 2, 15)) -+>y : Symbol(y, Decl(mod1.js, 2, 26)) -+ /** @typedef {A | B} Both */ -+>A : Symbol(A, Decl(mod1.js, 1, 4)) -+>B : Symbol(B, Decl(mod1.js, 2, 4)) -+ module.exports = C ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 0, 0)) @@ -34,23 +22,7 @@ } === mod2.js === - /// - /** @typedef {{ type: "a", x: 1 }} A */ -+>A : Symbol(A, Decl(mod2.js, 1, 4)) -+>type : Symbol(type, Decl(mod2.js, 1, 15)) -+>x : Symbol(x, Decl(mod2.js, 1, 26)) -+ - /** @typedef {{ type: "b", y: 1 }} B */ -+>B : Symbol(B, Decl(mod2.js, 2, 4)) -+>type : Symbol(type, Decl(mod2.js, 2, 15)) -+>y : Symbol(y, Decl(mod2.js, 2, 26)) -+ - /** @typedef {A | B} Both */ -+>Both : Symbol(Both, Decl(mod2.js, 3, 4)) -+>A : Symbol(A, Decl(mod2.js, 1, 4)) -+>B : Symbol(B, Decl(mod2.js, 2, 4)) - - export function C() { +@@= skipped -24, +21 lines =@@ >C : Symbol(C, Decl(mod2.js, 0, 0)) this.p = 1 @@ -60,18 +32,11 @@ } === mod3.js === ++ /// /** @typedef {{ type: "a", x: 1 }} A */ -+>type : Symbol(type, Decl(mod3.js, 1, 15)) -+>x : Symbol(x, Decl(mod3.js, 1, 26)) -+ /** @typedef {{ type: "b", y: 1 }} B */ -+>type : Symbol(type, Decl(mod3.js, 2, 15)) -+>y : Symbol(y, Decl(mod3.js, 2, 26)) -+ /** @typedef {A | B} Both */ -+>A : Symbol(A, Decl(mod3.js, 1, 4)) -+>B : Symbol(B, Decl(mod3.js, 2, 4)) exports.C = function() { ->exports.C : Symbol(C, Decl(mod3.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types index 6113ea2a09..46ee7c4072 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types @@ -8,18 +8,8 @@ declare var module: { exports: any}; === mod1.js === /// /** @typedef {{ type: "a", x: 1 }} A */ ->A : any ->type : "a" ->x : 1 - /** @typedef {{ type: "b", y: 1 }} B */ ->B : any ->type : "b" ->y : 1 - /** @typedef {A | B} Both */ ->Both : any - module.exports = C >module.exports = C : () => void >module.exports : any @@ -41,17 +31,8 @@ function C() { === mod2.js === /// /** @typedef {{ type: "a", x: 1 }} A */ ->A : A ->type : "a" ->x : 1 - /** @typedef {{ type: "b", y: 1 }} B */ ->B : B ->type : "b" ->y : 1 - /** @typedef {A | B} Both */ ->Both : Both export function C() { >C : () => void @@ -67,17 +48,8 @@ export function C() { === mod3.js === /// /** @typedef {{ type: "a", x: 1 }} A */ ->A : any ->type : "a" ->x : 1 - /** @typedef {{ type: "b", y: 1 }} B */ ->B : any ->type : "b" ->y : 1 - /** @typedef {A | B} Both */ ->Both : any exports.C = function() { >exports.C = function() { this.p = 1} : () => void diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types index 9255806d04..bf416ab331 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types @@ -2,8 +2,6 @@ === mod2.js === /** @typedef {number} Foo */ ->Foo : any - const ns = {}; >ns : {} >{} : {} diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.types index 8bbb10da7b..38aefb1251 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.types @@ -2,8 +2,6 @@ === mod3.js === /** @typedef {number} Foo */ ->Foo : any - class Bar { } >Bar : Bar diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.types index 40758a5176..918c2c7544 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule5.types @@ -2,8 +2,6 @@ === mod1.js === /** @typedef {number} Foo */ ->Foo : any - class Bar {} >Bar : Bar diff --git a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols index f8731a1ce0..91ac8e7070 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols @@ -6,8 +6,6 @@ class C { /** * @typedef {C~A} C~B ->C : Symbol(C, Decl(bug25104.js, 3, 7)) - * @typedef {object} C~A */ /** @param {C~A} o */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff deleted file mode 100644 index 23fd3af66a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.typedefInnerNamepaths.symbols -+++ new.typedefInnerNamepaths.symbols -@@= skipped -5, +5 lines =@@ - - /** - * @typedef {C~A} C~B -+>C : Symbol(C, Decl(bug25104.js, 3, 7)) -+ - * @typedef {object} C~A - */ - /** @param {C~A} o */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.types b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.types index d2254cb785..1f29af9dc3 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.types +++ b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.types @@ -6,11 +6,7 @@ class C { /** * @typedef {C~A} C~B -> : any - * @typedef {object} C~A ->C : any - */ /** @param {C~A} o */ constructor(o) { diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols index 84b375fd60..43cf894f0c 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols @@ -3,28 +3,10 @@ === a.js === /** * @template {{ a: number, b: string }} T,U A Comment ->a : Symbol(a, Decl(a.js, 1, 15)) ->b : Symbol(b, Decl(a.js, 1, 26)) ->a : Symbol(a, Decl(a.js, 1, 15)) ->b : Symbol(b, Decl(a.js, 1, 26)) - * @template {{ c: boolean }} V uh ... are comments even supported?? ->c : Symbol(c, Decl(a.js, 2, 15)) - * @template W * @template X That last one had no comment * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything ->t : Symbol(t, Decl(a.js, 5, 14)) ->T : Symbol(T) ->u : Symbol(u, Decl(a.js, 5, 20)) ->U : Symbol(U) ->v : Symbol(v, Decl(a.js, 5, 26)) ->V : Symbol(V) ->w : Symbol(w, Decl(a.js, 5, 32)) ->W : Symbol(W) ->x : Symbol(x, Decl(a.js, 5, 38)) ->X : Symbol(X) - */ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols.diff index fb33b2b1ca..5f8037ef21 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.symbols.diff @@ -1,35 +1,6 @@ --- old.typedefMultipleTypeParameters.symbols +++ new.typedefMultipleTypeParameters.symbols -@@= skipped -2, +2 lines =@@ - === a.js === - /** - * @template {{ a: number, b: string }} T,U A Comment -+>a : Symbol(a, Decl(a.js, 1, 15)) -+>b : Symbol(b, Decl(a.js, 1, 26)) -+>a : Symbol(a, Decl(a.js, 1, 15)) -+>b : Symbol(b, Decl(a.js, 1, 26)) -+ - * @template {{ c: boolean }} V uh ... are comments even supported?? -+>c : Symbol(c, Decl(a.js, 2, 15)) -+ - * @template W - * @template X That last one had no comment - * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything -+>t : Symbol(t, Decl(a.js, 5, 14)) -+>T : Symbol(T) -+>u : Symbol(u, Decl(a.js, 5, 20)) -+>U : Symbol(U) -+>v : Symbol(v, Decl(a.js, 5, 26)) -+>V : Symbol(V) -+>w : Symbol(w, Decl(a.js, 5, 32)) -+>W : Symbol(W) -+>x : Symbol(x, Decl(a.js, 5, 38)) -+>X : Symbol(X) -+ - */ - - /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ -@@= skipped -21, +39 lines =@@ +@@= skipped -23, +23 lines =@@ === test.ts === declare var actually: Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>; >actually : Symbol(actually, Decl(test.ts, 0, 11)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.types b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.types index 18ce1e7b27..34308527f8 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.types +++ b/testdata/baselines/reference/submodule/conformance/typedefMultipleTypeParameters.types @@ -7,13 +7,6 @@ * @template W * @template X That last one had no comment * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything ->Everything : any ->t : T ->u : U ->v : V ->w : W ->x : X - */ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.types b/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.types index ff0e1e7203..0b6bc42c13 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.types +++ b/testdata/baselines/reference/submodule/conformance/typedefOnSemicolonClassElement.types @@ -5,8 +5,6 @@ export class Preferences { >Preferences : Preferences /** @typedef {string} A */ ->A : any - ; /** @type {A} */ a = 'ok' diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols index 617395d058..064c38f2eb 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols @@ -2,89 +2,56 @@ === typedefOnStatements.js === /** @typedef {{a: string}} A */ ->a : Symbol(a, Decl(typedefOnStatements.js, 0, 15)) - ; /** @typedef {{ b: string }} B */ ->b : Symbol(b, Decl(typedefOnStatements.js, 2, 15)) - debugger; /** @typedef {{ c: string }} C */ ->c : Symbol(c, Decl(typedefOnStatements.js, 4, 15)) { } /** @typedef {{ d: string }} D */ ->d : Symbol(d, Decl(typedefOnStatements.js, 7, 15)) - 1 + 1; /** @typedef {{ e: string }} E */ ->e : Symbol(e, Decl(typedefOnStatements.js, 9, 15)) - if (false) { } /** @typedef {{ f: string }} F */ ->f : Symbol(f, Decl(typedefOnStatements.js, 12, 15)) - do { } while (false); /** @typedef {{ g: string }} G */ ->g : Symbol(g, Decl(typedefOnStatements.js, 15, 15)) - while (false) { } /** @typedef {{ h: string }} H */ ->h : Symbol(h, Decl(typedefOnStatements.js, 18, 15)) - for (;; false) { } /** @typedef {{ i: string }} I */ ->i : Symbol(i, Decl(typedefOnStatements.js, 21, 15)) - for (let i in []) { >i : Symbol(i, Decl(typedefOnStatements.js, 22, 8)) } /** @typedef {{ j: string }} J */ ->j : Symbol(j, Decl(typedefOnStatements.js, 24, 15)) - break; /** @typedef {{ k: string }} K */ ->k : Symbol(k, Decl(typedefOnStatements.js, 26, 15)) - for (let k of []) { >k : Symbol(k, Decl(typedefOnStatements.js, 27, 8)) } /** @typedef {{ l: string }} L */ ->l : Symbol(l, Decl(typedefOnStatements.js, 29, 15)) - continue; /** @typedef {{ m: string }} M */ ->m : Symbol(m, Decl(typedefOnStatements.js, 31, 15)) - with (name) { >name : Symbol(name, Decl(lib.dom.d.ts, --, --)) } /** @typedef {{ n: string }} N */ ->n : Symbol(n, Decl(typedefOnStatements.js, 34, 15)) - switch (name) { >name : Symbol(name, Decl(lib.dom.d.ts, --, --)) } /** @typedef {{ o: string }} O */ ->o : Symbol(o, Decl(typedefOnStatements.js, 38, 15)) - fork: while (false) { } /** @typedef {{ p: string }} P */ ->p : Symbol(p, Decl(typedefOnStatements.js, 42, 15)) - throw new Error('Unreachable') >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) /** @typedef {{ q: string }} Q */ ->q : Symbol(q, Decl(typedefOnStatements.js, 45, 15)) - try { } catch (e) { @@ -192,8 +159,6 @@ function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { >alpha : Symbol(alpha, Decl(typedefOnStatements.js, 73, 17)) /** @typedef {{ alpha: string }} Alpha */ ->alpha : Symbol(alpha, Decl(typedefOnStatements.js, 74, 19)) - return } diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols.diff index 88c3bc9a51..d1989f8de3 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.symbols.diff @@ -1,96 +1,6 @@ --- old.typedefOnStatements.symbols +++ new.typedefOnStatements.symbols -@@= skipped -1, +1 lines =@@ - - === typedefOnStatements.js === - /** @typedef {{a: string}} A */ -+>a : Symbol(a, Decl(typedefOnStatements.js, 0, 15)) -+ - ; - /** @typedef {{ b: string }} B */ -+>b : Symbol(b, Decl(typedefOnStatements.js, 2, 15)) -+ - debugger; - /** @typedef {{ c: string }} C */ -+>c : Symbol(c, Decl(typedefOnStatements.js, 4, 15)) - { - } - /** @typedef {{ d: string }} D */ -+>d : Symbol(d, Decl(typedefOnStatements.js, 7, 15)) -+ - 1 + 1; - /** @typedef {{ e: string }} E */ -+>e : Symbol(e, Decl(typedefOnStatements.js, 9, 15)) -+ - if (false) { - } - /** @typedef {{ f: string }} F */ -+>f : Symbol(f, Decl(typedefOnStatements.js, 12, 15)) -+ - do { - } while (false); - /** @typedef {{ g: string }} G */ -+>g : Symbol(g, Decl(typedefOnStatements.js, 15, 15)) -+ - while (false) { - } - /** @typedef {{ h: string }} H */ -+>h : Symbol(h, Decl(typedefOnStatements.js, 18, 15)) -+ - for (;; false) { - } - /** @typedef {{ i: string }} I */ -+>i : Symbol(i, Decl(typedefOnStatements.js, 21, 15)) -+ - for (let i in []) { - >i : Symbol(i, Decl(typedefOnStatements.js, 22, 8)) - } - /** @typedef {{ j: string }} J */ -+>j : Symbol(j, Decl(typedefOnStatements.js, 24, 15)) -+ - break; - /** @typedef {{ k: string }} K */ -+>k : Symbol(k, Decl(typedefOnStatements.js, 26, 15)) -+ - for (let k of []) { - >k : Symbol(k, Decl(typedefOnStatements.js, 27, 8)) - } - /** @typedef {{ l: string }} L */ -+>l : Symbol(l, Decl(typedefOnStatements.js, 29, 15)) -+ - continue; - /** @typedef {{ m: string }} M */ -+>m : Symbol(m, Decl(typedefOnStatements.js, 31, 15)) -+ - with (name) { - >name : Symbol(name, Decl(lib.dom.d.ts, --, --)) - } - /** @typedef {{ n: string }} N */ -+>n : Symbol(n, Decl(typedefOnStatements.js, 34, 15)) -+ - switch (name) { - >name : Symbol(name, Decl(lib.dom.d.ts, --, --)) - } - - /** @typedef {{ o: string }} O */ -+>o : Symbol(o, Decl(typedefOnStatements.js, 38, 15)) -+ - fork: while (false) { - } - - /** @typedef {{ p: string }} P */ -+>p : Symbol(p, Decl(typedefOnStatements.js, 42, 15)) -+ - throw new Error('Unreachable') - >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - - /** @typedef {{ q: string }} Q */ -+>q : Symbol(q, Decl(typedefOnStatements.js, 45, 15)) -+ - try { - } - catch (e) { -@@= skipped -96, +129 lines =@@ +@@= skipped -97, +97 lines =@@ >q : Symbol(q, Decl(typedefOnStatements.js, 70, 48)) console.log(a.a, b.b, c.c, d.d, e.e, f.f, g.g, h.h, i.i, j.j, k.k, l.l, m.m, n.n, o.o, p.p, q.q) @@ -102,12 +12,3 @@ >a.a : Symbol(a, Decl(typedefOnStatements.js, 0, 15)) >a : Symbol(a, Decl(typedefOnStatements.js, 70, 16)) >a : Symbol(a, Decl(typedefOnStatements.js, 0, 15)) -@@= skipped -61, +61 lines =@@ - >alpha : Symbol(alpha, Decl(typedefOnStatements.js, 73, 17)) - - /** @typedef {{ alpha: string }} Alpha */ -+>alpha : Symbol(alpha, Decl(typedefOnStatements.js, 74, 19)) -+ - return - } - diff --git a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.types b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.types index bb091bd092..bc0ab0707e 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefOnStatements.types +++ b/testdata/baselines/reference/submodule/conformance/typedefOnStatements.types @@ -2,121 +2,71 @@ === typedefOnStatements.js === /** @typedef {{a: string}} A */ ->A : any ->a : string - ; /** @typedef {{ b: string }} B */ ->B : any ->b : string - debugger; /** @typedef {{ c: string }} C */ ->C : any ->c : string { } /** @typedef {{ d: string }} D */ ->D : any ->d : string - 1 + 1; >1 + 1 : number >1 : 1 >1 : 1 /** @typedef {{ e: string }} E */ ->E : any ->e : string - if (false) { >false : false } /** @typedef {{ f: string }} F */ ->F : any ->f : string - do { } while (false); >false : false /** @typedef {{ g: string }} G */ ->G : any ->g : string - while (false) { >false : false } /** @typedef {{ h: string }} H */ ->H : any ->h : string - for (;; false) { >false : false } /** @typedef {{ i: string }} I */ ->I : any ->i : string - for (let i in []) { >i : string >[] : never[] } /** @typedef {{ j: string }} J */ ->J : any ->j : string - break; /** @typedef {{ k: string }} K */ ->K : any ->k : string - for (let k of []) { >k : never >[] : never[] } /** @typedef {{ l: string }} L */ ->L : any ->l : string - continue; /** @typedef {{ m: string }} M */ ->M : any ->m : string - with (name) { >name : void } /** @typedef {{ n: string }} N */ ->N : any ->n : string - switch (name) { >name : void } /** @typedef {{ o: string }} O */ ->O : any ->o : string - fork: while (false) { >fork : any >false : false } /** @typedef {{ p: string }} P */ ->P : any ->p : string - throw new Error('Unreachable') >new Error('Unreachable') : Error >Error : ErrorConstructor >'Unreachable' : "Unreachable" /** @typedef {{ q: string }} Q */ ->Q : any ->q : string - try { } catch (e) { @@ -227,9 +177,6 @@ function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { >"aleph" : "aleph" /** @typedef {{ alpha: string }} Alpha */ ->Alpha : any ->alpha : string - return } diff --git a/testdata/baselines/reference/submodule/conformance/typedefScope1.types b/testdata/baselines/reference/submodule/conformance/typedefScope1.types index d968b4d867..5e0dd42260 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefScope1.types +++ b/testdata/baselines/reference/submodule/conformance/typedefScope1.types @@ -5,8 +5,6 @@ function B1() { >B1 : () => void /** @typedef {number} B */ ->B : any - /** @type {B} */ var ok1 = 0; >ok1 : number @@ -17,8 +15,6 @@ function B2() { >B2 : () => void /** @typedef {string} B */ ->B : any - /** @type {B} */ var ok2 = 'hi'; >ok2 : string diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols index ce334edb68..4dd69bf6f0 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols @@ -2,8 +2,6 @@ === typedefTagExtraneousProperty.js === /** @typedef {Object.} Mmap ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - * @property {string} ignoreMe - should be ignored */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols.diff index 40e7e87727..c5a3901f5e 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.symbols.diff @@ -1,13 +1,6 @@ --- old.typedefTagExtraneousProperty.symbols +++ new.typedefTagExtraneousProperty.symbols -@@= skipped -1, +1 lines =@@ - - === typedefTagExtraneousProperty.js === - /** @typedef {Object.} Mmap -+>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -+ - * @property {string} ignoreMe - should be ignored - */ +@@= skipped -6, +6 lines =@@ /** @type {Mmap} */ var y = { bye: "no" }; diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.types b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.types index b835272b05..fc68b20720 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.types +++ b/testdata/baselines/reference/submodule/conformance/typedefTagExtraneousProperty.types @@ -2,8 +2,6 @@ === typedefTagExtraneousProperty.js === /** @typedef {Object.} Mmap ->Mmap : any - * @property {string} ignoreMe - should be ignored */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols index 5540ff6d2b..75da97d256 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols @@ -44,8 +44,6 @@ var mistake; /** @typedef {Object} Upp * @property {string} name * @property {Object} not ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - * @property {string} nested */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff deleted file mode 100644 index 24027037a7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.typedefTagNested.symbols -+++ new.typedefTagNested.symbols -@@= skipped -43, +43 lines =@@ - /** @typedef {Object} Upp - * @property {string} name - * @property {Object} not -+>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -+ - * @property {string} nested - */ - diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagNested.types b/testdata/baselines/reference/submodule/conformance/typedefTagNested.types index 0dc0a03ef3..7077cb580a 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagNested.types +++ b/testdata/baselines/reference/submodule/conformance/typedefTagNested.types @@ -2,24 +2,10 @@ === a.js === /** @typedef {Object} App ->App : any - * @property {string} name ->name : any - * @property {Object} icons ->icons : any - * @property {string} icons.image32 ->property : any ->icons : any ->image32 : any - * @property {string} icons.image64 ->property : any ->icons : any ->image64 : any - */ var ex; >ex : any @@ -48,8 +34,6 @@ const app = { } /** @typedef {Object} Opp ->Opp : any - * @property {string} name * @property {Object} oops * @property {string} horrible @@ -64,17 +48,9 @@ var mistake; >mistake : string /** @typedef {Object} Upp ->Upp : any - * @property {string} name ->name : any - * @property {Object} not ->not : any - * @property {string} nested ->nested : any - */ /** @type {Upp} */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols index c30683a460..9afcc1974f 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols @@ -3,9 +3,6 @@ === github20832.js === // #20832 /** @typedef {U} T - should be "error, can't find type named 'U' */ ->T : Symbol(T, Decl(github20832.js, 1, 4)) ->U : Symbol(U) - /** * @template U * @param {U} x diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff deleted file mode 100644 index 97ad80965f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.symbols.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.typedefTagTypeResolution.symbols -+++ new.typedefTagTypeResolution.symbols -@@= skipped -2, +2 lines =@@ - === github20832.js === - // #20832 - /** @typedef {U} T - should be "error, can't find type named 'U' */ -+>T : Symbol(T, Decl(github20832.js, 1, 4)) -+>U : Symbol(U) -+ - /** - * @template U - * @param {U} x diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.types b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.types index a4e28afe57..7261c71574 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.types +++ b/testdata/baselines/reference/submodule/conformance/typedefTagTypeResolution.types @@ -3,8 +3,6 @@ === github20832.js === // #20832 /** @typedef {U} T - should be "error, can't find type named 'U' */ ->T : U - /** * @template U * @param {U} x diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols index 9eaee970ec..87f704a013 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols @@ -3,9 +3,6 @@ === mod1.js === /** * @typedef {function(string): boolean} -> : Symbol(, Decl(mod1.js, 1, 3)) ->function : Symbol(function) - * Type1 */ @@ -33,8 +30,6 @@ function callIt(func, arg) { * str: string, * boo: boolean * }} Type2 ->Type2 : Symbol(Type2, Decl(mod2.js, 1, 3)) - */ /** @@ -63,9 +58,6 @@ function check(obj) { * A function whose signature is very long. * * @typedef {function(boolean, string, number): -> : Symbol(, Decl(mod3.js, 3, 3)) ->function : Symbol(function) - * (string|number)} StringOrNumber1 */ @@ -96,9 +88,6 @@ function use1(func, bool, str, num) { * A function whose signature is very long. * * @typedef {function(boolean, string, -> : Symbol(, Decl(mod4.js, 3, 3)) ->function : Symbol(function) - * number): * (string|number)} StringOrNumber2 */ @@ -135,8 +124,6 @@ function use2(func, bool, str, num) { * boo: * boolean * }} Type5 ->Type5 : Symbol(Type5, Decl(mod5.js, 1, 3)) - */ /** @@ -168,8 +155,6 @@ function check5(obj) { * bar: * * * }} Type6 ->Type6 : Symbol(Type6, Decl(mod6.js, 1, 3)) - */ /** diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff deleted file mode 100644 index 879893b7a7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.symbols.diff +++ /dev/null @@ -1,59 +0,0 @@ ---- old.typedefTagWrapping.symbols -+++ new.typedefTagWrapping.symbols -@@= skipped -2, +2 lines =@@ - === mod1.js === - /** - * @typedef {function(string): boolean} -+> : Symbol(, Decl(mod1.js, 1, 3)) -+>function : Symbol(function) -+ - * Type1 - */ - -@@= skipped -27, +30 lines =@@ - * str: string, - * boo: boolean - * }} Type2 -+>Type2 : Symbol(Type2, Decl(mod2.js, 1, 3)) -+ - */ - - /** -@@= skipped -28, +30 lines =@@ - * A function whose signature is very long. - * - * @typedef {function(boolean, string, number): -+> : Symbol(, Decl(mod3.js, 3, 3)) -+>function : Symbol(function) -+ - * (string|number)} StringOrNumber1 - */ - -@@= skipped -30, +33 lines =@@ - * A function whose signature is very long. - * - * @typedef {function(boolean, string, -+> : Symbol(, Decl(mod4.js, 3, 3)) -+>function : Symbol(function) -+ - * number): - * (string|number)} StringOrNumber2 - */ -@@= skipped -36, +39 lines =@@ - * boo: - * boolean - * }} Type5 -+>Type5 : Symbol(Type5, Decl(mod5.js, 1, 3)) -+ - */ - - /** -@@= skipped -31, +33 lines =@@ - * bar: - * * - * }} Type6 -+>Type6 : Symbol(Type6, Decl(mod6.js, 1, 3)) -+ - */ - - /** diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.types b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.types index 89baa116a0..ebd2541cad 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.types +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.types @@ -3,8 +3,6 @@ === mod1.js === /** * @typedef {function(string): boolean} -> : function - * Type1 */ @@ -33,8 +31,6 @@ function callIt(func, arg) { * str: string, * boo: boolean * }} Type2 ->Type2 : Type2 - */ /** @@ -64,8 +60,6 @@ function check(obj) { * A function whose signature is very long. * * @typedef {function(boolean, string, number): -> : function - * (string|number)} StringOrNumber1 */ @@ -97,8 +91,6 @@ function use1(func, bool, str, num) { * A function whose signature is very long. * * @typedef {function(boolean, string, -> : function - * number): * (string|number)} StringOrNumber2 */ @@ -136,8 +128,6 @@ function use2(func, bool, str, num) { * boo: * boolean * }} Type5 ->Type5 : Type5 - */ /** @@ -170,8 +160,6 @@ function check5(obj) { * bar: * * * }} Type6 ->Type6 : Type6 - */ /** diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff index f371d32ac5..bda57e861e 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.types.diff @@ -1,14 +1,7 @@ --- old.checkJsTypeDefNoUnusedLocalMarked.types +++ new.checkJsTypeDefNoUnusedLocalMarked.types -@@= skipped -19, +19 lines =@@ - - === something.js === - /** @typedef {typeof import("./file")} Foo */ -+>Foo : any - +@@= skipped -23, +23 lines =@@ /** @typedef {(foo: Foo) => string} FooFun */ -+>FooFun : any -+>foo : typeof Foo module.exports = /** @type {FooFun} */(void 0); ->module.exports = /** @type {FooFun} */(void 0) : (foo: Foo) => string diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment1.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment1.types.diff index 96d4b65aab..53c009ce94 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment1.types.diff @@ -1,18 +1,6 @@ --- old.checkJsdocTypeTagOnExportAssignment1.types +++ new.checkJsdocTypeTagOnExportAssignment1.types -@@= skipped -4, +4 lines =@@ - === a.js === - /** - * @typedef {Object} Foo -+>Foo : any -+ - * @property {boolean} a -+>a : any -+ - * @property {boolean} b -+>b : any -+ - */ +@@= skipped -10, +10 lines =@@ /** @type {Foo} */ export default { c: false }; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment3.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment3.types.diff index 1b32944a54..d4bf0180db 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment3.types.diff @@ -1,21 +1,6 @@ --- old.checkJsdocTypeTagOnExportAssignment3.types +++ new.checkJsdocTypeTagOnExportAssignment3.types -@@= skipped -4, +4 lines =@@ - === a.js === - /** - * @typedef {Object} Foo -+>Foo : any -+ - * @property {boolean} a -+>a : any -+ - * @property {boolean} b -+>b : any -+ - */ - - const bar = { c: 1 }; -@@= skipped -12, +18 lines =@@ +@@= skipped -16, +16 lines =@@ /** @type {Foo} */ export default bar; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment4.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment4.types.diff index 44f3fd6a7e..6616672785 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment4.types.diff @@ -7,8 +7,6 @@ - /** * @typedef {number} Foo -+>Foo : any -+ */ /** @type {Foo} */ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment5.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment5.types.diff index cf6d92f0f2..bcbd781d56 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment5.types.diff @@ -1,18 +1,6 @@ --- old.checkJsdocTypeTagOnExportAssignment5.types +++ new.checkJsdocTypeTagOnExportAssignment5.types -@@= skipped -4, +4 lines =@@ - === a.js === - /** - * @typedef {Object} Foo -+>Foo : any -+ - * @property {number} a -+>a : any -+ - * @property {number} b -+>b : any -+ - */ +@@= skipped -10, +10 lines =@@ /** @type {Foo} */ export default { a: 1, b: 1 }; @@ -20,7 +8,7 @@ >{ a: 1, b: 1 } : { a: number; b: number; } >a : number >1 : 1 -@@= skipped -14, +21 lines =@@ +@@= skipped -8, +9 lines =@@ === b.js === import a from "./a"; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment6.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment6.types.diff index 42631feb2b..9b7810a7ed 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment6.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment6.types.diff @@ -1,18 +1,6 @@ --- old.checkJsdocTypeTagOnExportAssignment6.types +++ new.checkJsdocTypeTagOnExportAssignment6.types -@@= skipped -4, +4 lines =@@ - === a.js === - /** - * @typedef {Object} Foo -+>Foo : any -+ - * @property {number} a -+>a : any -+ - * @property {number} b -+>b : any -+ - */ +@@= skipped -10, +10 lines =@@ /** @type {Foo} */ export default { a: 1, b: 1, c: 1 }; @@ -20,7 +8,7 @@ >{ a: 1, b: 1, c: 1 } : { a: number; b: number; c: number; } >a : number >1 : 1 -@@= skipped -16, +23 lines =@@ +@@= skipped -10, +11 lines =@@ === b.js === import a from "./a"; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment7.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment7.types.diff index e19af3bc16..f2ef24ccf6 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment7.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment7.types.diff @@ -1,21 +1,6 @@ --- old.checkJsdocTypeTagOnExportAssignment7.types +++ new.checkJsdocTypeTagOnExportAssignment7.types -@@= skipped -4, +4 lines =@@ - === a.js === - /** - * @typedef {Object} Foo -+>Foo : any -+ - * @property {number} a -+>a : any -+ - * @property {number} b -+>b : any -+ - */ - - const abc = { a: 1, b: 1, c: 1 }; -@@= skipped -16, +22 lines =@@ +@@= skipped -20, +20 lines =@@ /** @type {Foo} */ export default abc; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment8.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment8.types.diff index cadb646896..57c791389e 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment8.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment8.types.diff @@ -1,18 +1,6 @@ --- old.checkJsdocTypeTagOnExportAssignment8.types +++ new.checkJsdocTypeTagOnExportAssignment8.types -@@= skipped -4, +4 lines =@@ - === a.js === - /** - * @typedef Foo -+>Foo : any -+ - * @property {string} a -+>a : any -+ - * @property {'b'} b -+>b : any -+ - */ +@@= skipped -10, +10 lines =@@ /** @type {Foo} */ export default { diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.types.diff index 316969bdcb..957f82402c 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/contextuallyTypedParametersOptionalInJSDoc.types.diff @@ -1,14 +1,6 @@ --- old.contextuallyTypedParametersOptionalInJSDoc.types +++ new.contextuallyTypedParametersOptionalInJSDoc.types -@@= skipped -10, +10 lines =@@ - - /** - * @typedef {(a: string, b: number) => void} Fn -+>Fn : any -+>a : string -+>b : number -+ - */ +@@= skipped -14, +14 lines =@@ /** @type {Fn} */ const fn1 = @@ -17,7 +9,7 @@ /** * @param [b] -@@= skipped -35, +39 lines =@@ +@@= skipped -31, +31 lines =@@ /** @type {Fn} */ const fn2 = diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types.diff index 34ec02aa68..99fee27e27 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/contravariantOnlyInferenceFromAnnotatedFunctionJs.types.diff @@ -1,19 +1,6 @@ --- old.contravariantOnlyInferenceFromAnnotatedFunctionJs.types +++ new.contravariantOnlyInferenceFromAnnotatedFunctionJs.types -@@= skipped -2, +2 lines =@@ - === index.js === - /** - * @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs -+>Funcs : Funcs -+>fn : (a: A, b: B) => void -+>a : A -+>b : B -+>thing : B[K] -+ - * @template A - * @template {Record} B - */ -@@= skipped -16, +22 lines =@@ +@@= skipped -18, +18 lines =@@ return /** @type {any} */ (null); >(null) : any diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.types.diff index 097172a8b5..2601f4799d 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.types.diff @@ -1,19 +1,6 @@ --- old.expandoFunctionContextualTypesJs.types +++ new.expandoFunctionContextualTypesJs.types -@@= skipped -1, +1 lines =@@ - - === input.js === - /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ -+>MyComponentProps : any -+>color : "blue" | "red" - - /** - * @template P - * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ -+>StatelessComponent : any -+>defaultProps : P - - /** +@@= skipped -10, +10 lines =@@ * @type {StatelessComponent} */ const MyComponent = () => /* @type {any} */(null); @@ -69,7 +56,7 @@ >"red" : "red" } -@@= skipped -49, +53 lines =@@ +@@= skipped -40, +40 lines =@@ * @type {StatelessComponent} */ const check = MyComponent2; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc1.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc1.types.diff index eb9a50c806..03abd1d5db 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc1.types.diff @@ -1,11 +1,6 @@ --- old.exportDefaultWithJSDoc1.types +++ new.exportDefaultWithJSDoc1.types -@@= skipped -3, +3 lines =@@ - /** - * A number, or a string containing a number. - * @typedef {(number|string)} NumberLike -+>NumberLike : any -+ +@@= skipped -6, +6 lines =@@ */ /** @type {NumberLike[]} */export default ([ ]); diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff index 24ba584863..9697bd00c8 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/exportDefaultWithJSDoc2.types.diff @@ -1,11 +1,6 @@ --- old.exportDefaultWithJSDoc2.types +++ new.exportDefaultWithJSDoc2.types -@@= skipped -3, +3 lines =@@ - /** - * A number, or a string containing a number. - * @typedef {(number|string)} NumberLike -+>NumberLike : any -+ +@@= skipped -6, +6 lines =@@ */ export default /** @type {NumberLike[]} */([ ]); diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitDoesNotRenameImport.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitDoesNotRenameImport.types.diff index c4357f44ed..f99a8829f1 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitDoesNotRenameImport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitDoesNotRenameImport.types.diff @@ -1,19 +1,6 @@ --- old.jsDeclarationEmitDoesNotRenameImport.types +++ new.jsDeclarationEmitDoesNotRenameImport.types -@@= skipped -21, +21 lines =@@ - - /** - * @typedef {Object} Options -+>Options : any -+ - * @property {typeof import("./Test.js").default} [test] -+>test : any -+>default : any -+ - */ - - class X extends Test { -@@= skipped -18, +23 lines =@@ +@@= skipped -39, +39 lines =@@ >super : typeof Test if (options.test) { diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types.diff index 762444e866..b1319ae885 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types.diff @@ -1,17 +1,6 @@ --- old.jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types +++ new.jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.types -@@= skipped -2, +2 lines =@@ - === index.js === - /** - * @typedef Options -+>Options : any -+ - * @property {string} opt -+>opt : any -+ - */ - - /** +@@= skipped -9, +9 lines =@@ * @param {Options} options */ module.exports = function loader(options) {} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationsInheritedTypes.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationsInheritedTypes.types.diff deleted file mode 100644 index fefda54732..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationsInheritedTypes.types.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.jsDeclarationsInheritedTypes.types -+++ new.jsDeclarationsInheritedTypes.types -@@= skipped -2, +2 lines =@@ - === a.js === - /** - * @typedef A -+>A : any -+ - * @property {string} a -+>a : any -+ - */ - - /** - * @typedef B -+>B : any -+ - * @property {number} b -+>b : any -+ - */ - - class C1 { diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types.diff index aa2bf401f7..3ac8a33028 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.types.diff @@ -9,16 +9,7 @@ === node_modules/@lion/ajax/dist-types/types/types.d.ts === export interface LionRequestInit { -@@= skipped -10, +10 lines =@@ - === index.js === - /** - * @typedef {import('@lion/ajax').LionRequestInit} LionRequestInit -+>LionRequestInit : any -+ - */ - - export class NewAjax { -@@= skipped -9, +11 lines =@@ +@@= skipped -19, +19 lines =@@ * @param {LionRequestInit} [init] */ case5_unexpectedlyResolvesPathToNodeModules(init) {} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.types.diff index 018e32b22d..0b17abe7b9 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.types.diff @@ -35,18 +35,8 @@ >{ WindowDocked: 1, WindowUndocked: 2, ScriptsBreakpointSet: 3, TimelineStarted: 4,} : { WindowDocked: number; WindowUndocked: number; ScriptsBreakpointSet: number; TimelineStarted: number; } WindowDocked: 1, -@@= skipped -39, +39 lines =@@ - }; - /** - * @typedef {string} Host.UserMetrics.Bargh -+>Host : any -+ - */ - /** - * @typedef {string} +@@= skipped -45, +45 lines =@@ */ -+> : any -+ Host.UserMetrics.Blah = { >Host.UserMetrics.Blah = { x: 12} : { x: number; } ->Host.UserMetrics.Blah : { x: number; } @@ -62,7 +52,7 @@ >{ x: 12} : { x: number; } x: 12 -@@= skipped -19, +23 lines =@@ +@@= skipped -13, +13 lines =@@ } === index.js === var Other = {}; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff index dc944d4ab3..a408d5cc85 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff @@ -29,14 +29,7 @@ /** * @typedef {Object} LogEntry -+>LogEntry : any -+ - * @property {string} type -+>type : any -+ - * @property {number} time -+>time : any -+ +@@= skipped -21, +21 lines =@@ */ cbThing(type => { @@ -57,7 +50,7 @@ time: Date.now(), >time : number -@@= skipped -39, +45 lines =@@ +@@= skipped -18, +18 lines =@@ >now : () => number type, diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeResolution.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeResolution.types.diff deleted file mode 100644 index 264e7ad36f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocImportTypeResolution.types.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.jsdocImportTypeResolution.types -+++ new.jsdocImportTypeResolution.types -@@= skipped -7, +7 lines =@@ - === usage.js === - /** - * @typedef {Object} options -+>options : any -+ - * @property {import("./module").MyClass} option -+>option : any -+ - */ - /** @type {options} */ - let v; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocPropertyTagInvalid.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocPropertyTagInvalid.types.diff deleted file mode 100644 index 3aedcae965..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocPropertyTagInvalid.types.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.jsdocPropertyTagInvalid.types -+++ new.jsdocPropertyTagInvalid.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef MyType -+>MyType : MyType -+ - * @property {sting} [x] -+>x : any -+ - */ - - /** @param {MyType} p */ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefBeforeParenthesizedExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefBeforeParenthesizedExpression.types.diff deleted file mode 100644 index 140057ceff..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefBeforeParenthesizedExpression.types.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.jsdocTypedefBeforeParenthesizedExpression.types -+++ new.jsdocTypedefBeforeParenthesizedExpression.types -@@= skipped -2, +2 lines =@@ - === test.js === - // @ts-check - /** @typedef {number} NotADuplicateIdentifier */ -+>NotADuplicateIdentifier : any - - (2 * 2); - >(2 * 2) : number -@@= skipped -8, +9 lines =@@ - >2 : 2 - - /** @typedef {number} AlsoNotADuplicate */ -+>AlsoNotADuplicate : any - - (2 * 2) + 1; - >(2 * 2) + 1 : number diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefMissingType.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefMissingType.types.diff deleted file mode 100644 index d3ad238a8d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefMissingType.types.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.jsdocTypedefMissingType.types -+++ new.jsdocTypedefMissingType.types -@@= skipped -10, +10 lines =@@ - // OK: missing a type, but have property tags. - /** - * @typedef Person -+>Person : any -+ - * @property {string} name -+>name : any -+ - */ - - /** @type Person */ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash.types.diff deleted file mode 100644 index e61379de61..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsdocTypedefNoCrash.types -+++ new.jsdocTypedefNoCrash.types -@@= skipped -4, +4 lines =@@ - * @typedef {{ - * }} - */ -+> : any -+ - export const foo = 5; - >foo : 5 - >5 : 5 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash2.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash2.types.diff deleted file mode 100644 index 0ea5bb7fc4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedefNoCrash2.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsdocTypedefNoCrash2.types -+++ new.jsdocTypedefNoCrash2.types -@@= skipped -7, +7 lines =@@ - * @typedef {{ - * }} - */ -+> : any -+ - export const foo = 5; - >foo : 5 - >5 : 5 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedef_propertyWithNoType.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedef_propertyWithNoType.types.diff deleted file mode 100644 index f59dc72588..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocTypedef_propertyWithNoType.types.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.jsdocTypedef_propertyWithNoType.types -+++ new.jsdocTypedef_propertyWithNoType.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef Foo -+>Foo : any -+ - * @property foo -+>foo : any -+ - */ - - /** @type {Foo} */ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/misspelledJsDocTypedefTags.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/misspelledJsDocTypedefTags.types.diff index a187c3f88a..c2b65753b5 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/misspelledJsDocTypedefTags.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/misspelledJsDocTypedefTags.types.diff @@ -1,13 +1,8 @@ --- old.misspelledJsDocTypedefTags.types +++ new.misspelledJsDocTypedefTags.types -@@= skipped -1, +1 lines =@@ - +@@= skipped -2, +2 lines =@@ === a.js === /** @typedef {{ endTime: number, screenshots: number}} A.*/ -+>A : any -+>endTime : number -+>screenshots : number -+ Animation.AnimationModel.ScreenshotCapture.Request; ->Animation.AnimationModel.ScreenshotCapture.Request : error +>Animation.AnimationModel.ScreenshotCapture.Request : any @@ -20,10 +15,6 @@ >Request : any /** @typedef {{ endTime: number, screenshots: !B.}} */ -+> : any -+>endTime : number -+>screenshots : B -+ Animation.AnimationModel.ScreenshotCapture.Request; ->Animation.AnimationModel.ScreenshotCapture.Request : error +>Animation.AnimationModel.ScreenshotCapture.Request : any diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.types.diff index 8db95e955b..522a97b843 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties3.types.diff @@ -1,25 +1,6 @@ --- old.strictOptionalProperties3.types +++ new.strictOptionalProperties3.types -@@= skipped -2, +2 lines =@@ - === a.js === - /** - * @typedef {object} A -+>A : any -+ - * @property {number} [value] -+>value : any -+ - */ - - /** @type {A} */ -@@= skipped -12, +16 lines =@@ - - /** - * @typedef {{ value?: number }} B -+>B : any -+>value : number | undefined -+ - */ +@@= skipped -18, +18 lines =@@ /** @type {B} */ const b = { value: undefined }; // error diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.types.diff index 0a97dd1c78..54058c5524 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/strictOptionalProperties4.types.diff @@ -1,16 +1,6 @@ --- old.strictOptionalProperties4.types +++ new.strictOptionalProperties4.types -@@= skipped -2, +2 lines =@@ - === a.js === - /** - * @typedef Foo -+>Foo : any -+ - * @property {number} [foo] -+>foo : any -+ - */ - +@@= skipped -8, +8 lines =@@ const x = /** @type {Foo} */ ({}); >x : Foo >({}) : Foo diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/topLevelBlockExpando.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/topLevelBlockExpando.types.diff deleted file mode 100644 index 146dfb8992..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/topLevelBlockExpando.types.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.topLevelBlockExpando.types -+++ new.topLevelBlockExpando.types -@@= skipped -47, +47 lines =@@ - // Creates a type { first:string, last: string } - /** - * @typedef {Object} Human - creates a new type named 'SpecialType' -+>Human : Human -+ - * @property {string} first - a string property of SpecialType -+>first : any -+ - * @property {string} last - a number property of SpecialType -+>last : any -+ - */ - - /** diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.types.diff deleted file mode 100644 index 7efbcfb7cf..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/unmetTypeConstraintInJSDocImportCall.types.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.unmetTypeConstraintInJSDocImportCall.types -+++ new.unmetTypeConstraintInJSDocImportCall.types -@@= skipped -3, +3 lines =@@ - /** - * @template {string} T - * @typedef {{ foo: T }} Foo -+>Foo : any -+>foo : T -+ - */ - - export default {}; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff index 8b1768b31d..9fd7a1a7ab 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/assertionTypePredicates2.types.diff @@ -1,23 +1,6 @@ --- old.assertionTypePredicates2.types +++ new.assertionTypePredicates2.types -@@= skipped -2, +2 lines =@@ - === assertionTypePredicates2.js === - /** - * @typedef {{ x: number }} A -+>A : any -+>x : number -+ - */ - - /** - * @typedef { A & { y: number } } B -+>B : any -+>y : number -+ - */ - - /** -@@= skipped -11, +17 lines =@@ +@@= skipped -13, +13 lines =@@ * @returns { asserts a is B } */ const foo = (a) => { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.types.diff index b24ad2c44f..81d3e64add 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/assertionsAndNonReturningFunctions.types.diff @@ -1,11 +1,6 @@ --- old.assertionsAndNonReturningFunctions.types +++ new.assertionsAndNonReturningFunctions.types -@@= skipped -1, +1 lines =@@ - - === assertionsAndNonReturningFunctions.js === - /** @typedef {(check: boolean) => asserts check} AssertFunc */ -+>AssertFunc : any -+>check : boolean +@@= skipped -4, +4 lines =@@ /** @type {AssertFunc} */ const assert = check => { @@ -16,7 +11,7 @@ >check : boolean if (!check) throw new Error(); -@@= skipped -16, +18 lines =@@ +@@= skipped -13, +13 lines =@@ /** @type {(x: unknown) => asserts x is string } */ function assertIsString(x) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.types.diff index 038506abf4..22507e6d0f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag1.types.diff @@ -1,43 +1,6 @@ --- old.checkJsdocSatisfiesTag1.types +++ new.checkJsdocSatisfiesTag1.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef {Object} T1 -+>T1 : any -+ - * @property {number} a -+>a : any -+ - */ - - /** - * @typedef {Object} T2 -+>T2 : any -+ - * @property {"a" | "b"} a -+>a : any -+ - */ - - /** - * @typedef {(x: string) => string} T3 -+>T3 : any -+>x : string -+ - */ - - /** - * @typedef {Object} T4 -+>T4 : any -+ - * @property {string} a -+>a : any -+ - */ - - const t1 = /** @satisfies {T1} */ ({ a: 1 }); -@@= skipped -41, +56 lines =@@ +@@= skipped -43, +43 lines =@@ /** @type {T2} */ const t4 = /** @satisfies {T2} */ ({ a: "a" }); >t4 : T2 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag10.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag10.types.diff deleted file mode 100644 index f24887d31f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag10.types.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.checkJsdocSatisfiesTag10.types -+++ new.checkJsdocSatisfiesTag10.types -@@= skipped -1, +1 lines =@@ - - === /a.js === - /** @typedef {"a" | "b" | "c" | "d"} Keys */ -+>Keys : any - - const p = /** @satisfies {Partial>} */ ({ - >p : { a: number; b: string; x: number; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag11.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag11.types.diff deleted file mode 100644 index 1854b6a74f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag11.types.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.checkJsdocSatisfiesTag11.types -+++ new.checkJsdocSatisfiesTag11.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef {Object} T1 -+>T1 : any -+ - * @property {number} a -+>a : any -+ - */ - - /** - * @typedef {Object} T2 -+>T2 : any -+ - * @property {number} a -+>a : any -+ - */ - - /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag12.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag12.types.diff index 2b6d2bc619..c052f121c1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag12.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag12.types.diff @@ -1,36 +1,6 @@ --- old.checkJsdocSatisfiesTag12.types +++ new.checkJsdocSatisfiesTag12.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef {Object} T1 -+>T1 : any -+ - * @property {number} a -+>a : any -+ - */ - - /** - * @typedef {Object} T2 -+>T2 : any -+ - * @property {string} a -+>a : any -+ - */ - - /** - * @typedef {Object} T3 -+>T3 : any -+ - * @property {"a" | "b"} a -+>a : any -+ - */ - - /** -@@= skipped -73, +85 lines =@@ +@@= skipped -75, +75 lines =@@ * @satisfies {T3} */ const t7 = { a: "a" }; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.types.diff deleted file mode 100644 index 19ee23005b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.types.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.checkJsdocSatisfiesTag14.types -+++ new.checkJsdocSatisfiesTag14.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef {Object} T1 -+>T1 : any -+ - * @property {number} a -+>a : any -+ - */ - - /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.types.diff index 5782e62c1f..168b0f62f0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag2.types.diff @@ -1,11 +1,7 @@ --- old.checkJsdocSatisfiesTag2.types +++ new.checkJsdocSatisfiesTag2.types -@@= skipped -1, +1 lines =@@ - - === /a.js === +@@= skipped -3, +3 lines =@@ /** @typedef {Object. boolean>} Predicates */ -+>Predicates : any -+>n : number const p = /** @satisfies {Predicates} */ ({ ->p : { isEven: (n: number) => boolean; isOdd: (n: number) => boolean; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag4.types.diff deleted file mode 100644 index 22b606e490..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag4.types.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.checkJsdocSatisfiesTag4.types -+++ new.checkJsdocSatisfiesTag4.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef {Object} Foo -+>Foo : any -+ - * @property {number} a -+>a : any -+ - */ - export default /** @satisfies {Foo} */ ({}); - >({}) : {} -@@= skipped -9, +13 lines =@@ - === /b.js === - /** - * @typedef {Object} Foo -+>Foo : any -+ - * @property {number} a -+>a : any -+ - */ - - export default /** @satisfies {Foo} */ ({ a: 1 }); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag5.types.diff index 43e003cbc2..7980edabd7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag5.types.diff @@ -1,12 +1,7 @@ --- old.checkJsdocSatisfiesTag5.types +++ new.checkJsdocSatisfiesTag5.types -@@= skipped -1, +1 lines =@@ - - === /a.js === +@@= skipped -3, +3 lines =@@ /** @typedef {{ move(distance: number): void }} Movable */ -+>Movable : any -+>move : (distance: number) => void -+>distance : number const car = /** @satisfies {Movable & Record} */ ({ ->car : { start(): void; move(d: number): void; stop(): void; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag6.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag6.types.diff deleted file mode 100644 index bacdb3f5f7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag6.types.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.checkJsdocSatisfiesTag6.types -+++ new.checkJsdocSatisfiesTag6.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef {Object} Point2d -+>Point2d : any -+ - * @property {number} x -+>x : any -+ - * @property {number} y -+>y : any -+ - */ - - // Undesirable behavior today with type annotation diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag7.types.diff deleted file mode 100644 index bce34c2708..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag7.types.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.checkJsdocSatisfiesTag7.types -+++ new.checkJsdocSatisfiesTag7.types -@@= skipped -1, +1 lines =@@ - - === /a.js === - /** @typedef {"a" | "b" | "c" | "d"} Keys */ -+>Keys : any - - const p = /** @satisfies {Record} */ ({ - >p : { a: number; b: string; x: number; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.types.diff index d5d8580e57..8ddb8e5ad8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag8.types.diff @@ -1,10 +1,6 @@ --- old.checkJsdocSatisfiesTag8.types +++ new.checkJsdocSatisfiesTag8.types -@@= skipped -1, +1 lines =@@ - - === /a.js === - /** @typedef {Object.} Facts */ -+>Facts : any +@@= skipped -4, +4 lines =@@ // Should be able to detect a failure here const x = /** @satisfies {Facts} */ ({ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag9.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag9.types.diff deleted file mode 100644 index 5666b6b4b5..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag9.types.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.checkJsdocSatisfiesTag9.types -+++ new.checkJsdocSatisfiesTag9.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef {Object} Color -+>Color : any -+ - * @property {number} r -+>r : any -+ - * @property {number} g -+>g : any -+ - * @property {number} b -+>b : any -+ - */ - - // All of these should be Colors, but I only use some of them here. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.types.diff index 39887ce32e..eaeafa917c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag4.types.diff @@ -1,16 +1,6 @@ --- old.checkJsdocTypeTag4.types +++ new.checkJsdocTypeTag4.types -@@= skipped -8, +8 lines =@@ - /** Also should error for jsdoc typedefs - * @template {string} U - * @typedef {{ b: U }} B -+>B : any -+>b : U -+ - */ - /** @type {A} */ - var a; -@@= skipped -7, +10 lines =@@ +@@= skipped -15, +15 lines =@@ /** @type {B} */ var b; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff index f75cb8fa26..b7e2171439 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff @@ -52,11 +52,8 @@ >x : number >x : number - +@@= skipped -42, +42 lines =@@ /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ -+>Argle : Argle -+>x : "bye" | "hi" -+ /** @type {Argle} */ function blargle(s) { ->blargle : (x: "hi" | "bye") => 0 | 1 | 2 @@ -66,7 +63,7 @@ return 0; >0 : 0 -@@= skipped -52, +55 lines =@@ +@@= skipped -10, +10 lines =@@ /** @type {0 | 1 | 2} - assignment should not error */ var zeroonetwo = blargle('hi') >zeroonetwo : 0 | 1 | 2 @@ -77,9 +74,3 @@ >'hi' : "hi" /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ -+>Gioconda : Gioconda -+>s : string -+>b : boolean - - /** @type {Gioconda} */ - function monaLisa(sb) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff index 1eb62a2e6f..3224c0b361 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff @@ -1,17 +1,6 @@ --- old.checkJsdocTypeTag7.types +++ new.checkJsdocTypeTag7.types -@@= skipped -2, +2 lines =@@ - === test.js === - /** - * @typedef {(a: string, b: number) => void} Foo -+>Foo : any -+>a : string -+>b : number -+ - */ - - class C { -@@= skipped -7, +11 lines =@@ +@@= skipped -9, +9 lines =@@ /** @type {Foo} */ foo(a, b) {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.types.diff index f1d6e58395..3bc5d459e0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefInParamTag1.types.diff @@ -1,27 +1,6 @@ --- old.checkJsdocTypedefInParamTag1.types +++ new.checkJsdocTypedefInParamTag1.types -@@= skipped -3, +3 lines =@@ - // @ts-check - /** - * @typedef {Object} Opts -+>Opts : Opts -+ - * @property {string} x -+>x : any -+ - * @property {string=} y -+>y : any -+ - * @property {string} [z] -+>z : any -+ - * @property {string} [w="hi"] -+>w : any -+ - * - * @param {Opts} opts - */ -@@= skipped -12, +22 lines =@@ +@@= skipped -15, +15 lines =@@ >opts : Opts opts.x; @@ -33,22 +12,7 @@ } foo({x: 'abc'}); -@@= skipped -14, +14 lines =@@ - - /** - * @typedef {Object} AnotherOpts -+>AnotherOpts : AnotherOpts -+ - * @property anotherX {string} -+>anotherX : any -+ - * @property anotherY {string=} -+>anotherY : any -+ - * - * @param {AnotherOpts} opts - */ -@@= skipped -10, +16 lines =@@ +@@= skipped -24, +24 lines =@@ >opts : AnotherOpts opts.anotherX; @@ -60,28 +24,7 @@ } foo1({anotherX: "world"}); -@@= skipped -14, +14 lines =@@ - - /** - * @typedef {object} Opts1 -+>Opts1 : Opts1 -+ - * @property {string} x -+>x : any -+ - * @property {string=} y -+>y : any -+ - * @property {string} [z] -+>z : any -+ - * @property {string} [w="hi"] -+>w : any -+ - * - * @param {Opts1} opts - */ -@@= skipped -12, +22 lines =@@ +@@= skipped -26, +26 lines =@@ >opts : Opts1 opts.x; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.types.diff index 553db4021f..20dfc9c055 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.types.diff @@ -1,15 +1,6 @@ --- old.checkJsdocTypedefOnlySourceFile.types +++ new.checkJsdocTypedefOnlySourceFile.types -@@= skipped -9, +9 lines =@@ - /** - * @typedef {string} - */ -+> : any -+ - exports.SomeName; - >exports.SomeName : any - >exports : {} -@@= skipped -7, +9 lines =@@ +@@= skipped -16, +16 lines =@@ /** @type {exports.SomeName} */ const myString = 'str'; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.types.diff index 2cda304821..98fd6fec42 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/contextualTypedSpecialAssignment.types.diff @@ -1,10 +1,6 @@ --- old.contextualTypedSpecialAssignment.types +++ new.contextualTypedSpecialAssignment.types -@@= skipped -4, +4 lines =@@ - status: 'done' - m(n: number): void - }} DoneStatus */ -+>DoneStatus : any +@@= skipped -7, +7 lines =@@ // property assignment var ns = {} @@ -70,7 +66,7 @@ // this-property assignment -@@= skipped -51, +52 lines =@@ +@@= skipped -48, +48 lines =@@ constructor() { /** @type {DoneStatus} */ this.s = { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff index 47c3a9ae2d..005b72b658 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff @@ -1,11 +1,7 @@ --- old.enumTagImported.types +++ new.enumTagImported.types -@@= skipped -1, +1 lines =@@ - - === type.js === +@@= skipped -3, +3 lines =@@ /** @typedef {import("./mod1").TestEnum} TE */ -+>TE : any -+ /** @type {TE} */ const test = 'add' ->test : string @@ -19,7 +15,7 @@ >'remove' : "remove" === value.js === -@@= skipped -16, +18 lines =@@ +@@= skipped -14, +14 lines =@@ /** @type {TestEnum} */ const tist = TestEnum.ADD diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.types.diff index 778936d0bd..816f253a62 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.types.diff @@ -1,15 +1,6 @@ --- old.extendsTag5.types +++ new.extendsTag5.types -@@= skipped -5, +5 lines =@@ - * a: number | string; - * b: boolean | string[]; - * }} Foo -+>Foo : any -+ - */ - - /** -@@= skipped -27, +29 lines =@@ +@@= skipped -32, +32 lines =@@ */ class B extends A {} >B : B diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTypeInJSDoc.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTypeInJSDoc.types.diff index 73bc3119dd..547a186f41 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTypeInJSDoc.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTypeInJSDoc.types.diff @@ -9,12 +9,7 @@ >MyClass : any } declare global { -@@= skipped -16, +16 lines =@@ - === index.js === - /** - * @typedef {import("./externs")} Foo -+>Foo : any -+ +@@= skipped -19, +19 lines =@@ */ let a = /** @type {Foo} */(/** @type {*} */(undefined)); @@ -52,12 +47,11 @@ >{ doer: q => q } : { doer: (q: string) => string; } >doer : (q: string) => string >q => q : (q: string) => string -@@= skipped -31, +36 lines =@@ +@@= skipped -28, +31 lines =@@ const r = /** @type {typeof import("./externs").Bar} */(r => r); >r : (x: string, y?: number) => void >(r => r) : (x: string, y?: number) => void +>r => r : (x: string, y?: number) => void -+>Bar : any >r => r : (r: string) => string >r : string >r : string diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importingExportingTypes.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importingExportingTypes.types.diff deleted file mode 100644 index 401926d2f8..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importingExportingTypes.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.importingExportingTypes.types -+++ new.importingExportingTypes.types -@@= skipped -21, +21 lines =@@ - >OtherName : any - - /** @typedef {{ x: any }} JSDocType */ -+>JSDocType : any -+>x : any - - export { JSDocType }; - >JSDocType : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff index 3962100c2b..e0c212aa58 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff @@ -30,12 +30,7 @@ === hook.js === /** - * @typedef {(arg: import("./context")) => void} HookHandler -+>HookHandler : HookHandler -+>arg : any -+ - */ - /** +@@= skipped -25, +25 lines =@@ * @param {HookHandler} handle */ function Hook(handle) { @@ -65,49 +60,7 @@ === context.js === /** - * Imports - * - * @typedef {import("./timer")} Timer -+>Timer : any -+ - * @typedef {import("./hook")} Hook -+>Hook : any -+ - * @typedef {import("./hook").HookHandler} HookHandler -+>HookHandler : HookHandler -+ - */ - - /** - * Input type definition - * - * @typedef {Object} Input -+>Input : Input -+ - * @prop {Timer} timer -+>timer : any -+ - * @prop {Hook} hook -+>hook : any -+ - */ - - /** - * State type definition - * - * @typedef {Object} State -+>State : State -+ - * @prop {Timer} timer -+>timer : any -+ - * @prop {Hook} hook -+>hook : any -+ - */ - - /** -@@= skipped -75, +96 lines =@@ +@@= skipped -50, +50 lines =@@ */ function Context(input) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types.diff index c7f62d7a43..3d9e96f949 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.types.diff @@ -9,27 +9,8 @@ >{ // SOME PROPS HERE} : {} // SOME PROPS HERE - }; - - /** @typedef {string|RegExp|Array} myTypes.typeA */ -+>myTypes : any - - /** - * @typedef myTypes.typeB -+>myTypes : any -+ - * @property {myTypes.typeA} prop1 - Prop 1. -+>prop1 : any -+>myTypes : any -+ - * @property {string} prop2 - Prop 2. -+>prop2 : any -+ - */ - +@@= skipped -17, +17 lines =@@ /** @typedef {myTypes.typeB|Function} myTypes.typeC */ -+>myTypes : any -+>myTypes : any export {myTypes}; ->myTypes : { [x: string]: any; } @@ -42,7 +23,7 @@ /** * @namespace testFnTypes -@@= skipped -29, +39 lines =@@ +@@= skipped -12, +12 lines =@@ * @type {Object} */ const testFnTypes = { @@ -51,15 +32,7 @@ >{ // SOME PROPS HERE} : {} // SOME PROPS HERE - }; - - /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ -+>testFnTypes : any -+>myTypes : any - - /** - * @function testFn -@@= skipped -15, +17 lines =@@ +@@= skipped -15, +15 lines =@@ * @returns {number|null} Result. */ function testFn(input) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff index 52b96c1ca1..e4b4d3e25a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff @@ -20,15 +20,7 @@ >{ // SOME PROPS HERE} : {} // SOME PROPS HERE - }; - - /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ -+>testFnTypes : any -+>myTypes : any - - /** - * @function testFn -@@= skipped -15, +17 lines =@@ +@@= skipped -15, +15 lines =@@ * @returns {number|null} Result. */ function testFn(input) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportNamespacedType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportNamespacedType.types.diff index 4f16b15416..440918b5f4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportNamespacedType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportNamespacedType.types.diff @@ -9,8 +9,3 @@ === mod1.js === /** @typedef {number} Dotted.Name */ -+>Dotted : any -+ - export var dummy = 1 - >dummy : number - >1 : 1 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff index 9133dd122f..9f3ba05a86 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff @@ -1,14 +1,6 @@ --- old.jsDeclarationsImportTypeBundled.types +++ new.jsDeclarationsImportTypeBundled.types -@@= skipped -2, +2 lines =@@ - === folder/mod1.js === - /** - * @typedef {{x: number}} Item -+>Item : any -+>x : number -+ - */ - /** +@@= skipped -7, +7 lines =@@ * @type {Item}; */ const x = {x: 12}; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff index 599b276af8..2e1c6c6c7d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff @@ -13,13 +13,7 @@ >BaseFactory : { (): Base; Base: typeof Base; } === file.js === - /** @typedef {import('./base')} BaseFactory */ -+>BaseFactory : any -+ - /** - * @callback BaseFactoryFactory - * @param {import('./base')} factory -@@= skipped -22, +24 lines =@@ +@@= skipped -22, +22 lines =@@ * @returns {InstanceType} */ const test = (base) => { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff index 602bdbd740..0d97f79029 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff @@ -13,12 +13,7 @@ >BaseFactory : { (): Base; Base: typeof Base; } === file.js === - /** @typedef {typeof import('./base')} BaseFactory */ -+>BaseFactory : any - - /** - * -@@= skipped -14, +15 lines =@@ +@@= skipped -14, +14 lines =@@ * @returns {InstanceType} */ const test = (base) => { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeAliases.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeAliases.types.diff index ec82c484ed..294b6a424b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeAliases.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeAliases.types.diff @@ -1,16 +1,6 @@ --- old.jsDeclarationsTypeAliases.types +++ new.jsDeclarationsTypeAliases.types -@@= skipped -31, +31 lines =@@ - === mixed.js === - /** - * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType -+>SomeType : SomeType -+>x : string -+ - */ - /** - * @param {number} x -@@= skipped -24, +27 lines =@@ +@@= skipped -55, +55 lines =@@ >"ok" : "ok" } module.exports = { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff index 40b997814c..d0c2c9e3f5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff @@ -1,15 +1,6 @@ --- old.jsDeclarationsTypedefAndImportTypes.types +++ new.jsDeclarationsTypedefAndImportTypes.types -@@= skipped -2, +2 lines =@@ - === conn.js === - /** - * @typedef {string | number} Whatever -+>Whatever : any -+ - */ - - class Conn { -@@= skipped -16, +18 lines =@@ +@@= skipped -18, +18 lines =@@ module.exports = Conn; >module.exports = Conn : typeof Conn @@ -22,14 +13,7 @@ >Conn : typeof Conn === usage.js === - /** - * @typedef {import("./conn")} Conn -+>Conn : any -+ - */ - - class Wrap { -@@= skipped -17, +19 lines =@@ +@@= skipped -17, +17 lines =@@ * @param {Conn} c */ constructor(c) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff index a62032b2ab..fcb2ee58f9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff @@ -25,16 +25,7 @@ >stringSet : LazySet -@@= skipped -11, +11 lines =@@ - // Comment out this JSDoc, and note that the errors index.js go away. - /** - * @typedef {Object} SomeObject -+>SomeObject : any -+ - */ - class LazySet { - >LazySet : LazySet -@@= skipped -9, +11 lines =@@ +@@= skipped -20, +20 lines =@@ */ addAll(iterable) {} >addAll : (iterable: LazySet) => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefFunction.types.diff index df34b8e8ff..bbe48c29d3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefFunction.types.diff @@ -1,15 +1,6 @@ --- old.jsDeclarationsTypedefFunction.types +++ new.jsDeclarationsTypedefFunction.types -@@= skipped -4, +4 lines =@@ - * @typedef {{ - * [id: string]: [Function, Function]; - * }} ResolveRejectMap -+>ResolveRejectMap : any -+ - */ - - let id = 0 -@@= skipped -11, +13 lines =@@ +@@= skipped -15, +15 lines =@@ * @returns {Promise} */ const send = handlers => new Promise((resolve, reject) => { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff index 5f45d9a18f..73ec43650c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff @@ -13,32 +13,7 @@ >require : any >'./module.js' : "./module.js" - /** @typedef {import('./module.js').TaskGroup} TaskGroup */ -+>TaskGroup : any - - /** - * @typedef TaskNode -+>TaskNode : any -+ - * @prop {TaskNode[]} children -+>children : any -+ - * @prop {TaskNode|undefined} parent -+>parent : any -+ - * @prop {TaskGroup} group -+>group : any -+ - */ - - /** @typedef {{timers: Map}} PriorTaskData */ -+>PriorTaskData : any -+>timers : Map -+ - class MainThreadTasks { - >MainThreadTasks : MainThreadTasks - -@@= skipped -24, +36 lines =@@ +@@= skipped -24, +24 lines =@@ * @param {TaskNode} y */ constructor(x, y){} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.types.diff deleted file mode 100644 index e58f2bc33b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocCatchClauseWithTypeAnnotation.types.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.jsdocCatchClauseWithTypeAnnotation.types -+++ new.jsdocCatchClauseWithTypeAnnotation.types -@@= skipped -2, +2 lines =@@ - === foo.js === - /** - * @typedef {any} Any -+>Any : any -+ - */ - - /** - * @typedef {unknown} Unknown -+>Unknown : unknown -+ - */ - - function fn() { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff index 67c9e1d058..0080237768 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff @@ -1,11 +1,7 @@ --- old.jsdocImportType.types +++ new.jsdocImportType.types -@@= skipped -2, +2 lines =@@ - === use.js === - /// +@@= skipped -4, +4 lines =@@ /** @typedef {import("./mod1")} C -+>C : any -+ * @type {C} */ var c; ->c : D @@ -27,7 +23,7 @@ >require : (name: string) => any >"./mod1" : "./mod1" -@@= skipped -20, +22 lines =@@ +@@= skipped -18, +18 lines =@@ >d : D d.chunk; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff index a3f51400c3..a307c6c1c9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff @@ -1,11 +1,7 @@ --- old.jsdocImportType2.types +++ new.jsdocImportType2.types -@@= skipped -2, +2 lines =@@ - === use.js === - /// +@@= skipped -4, +4 lines =@@ /** @typedef {import("./mod1")} C -+>C : any -+ * @type {C} */ var c; ->c : D @@ -27,7 +23,7 @@ >require : (name: string) => any >"./mod1" : "./mod1" -@@= skipped -20, +22 lines =@@ +@@= skipped -18, +18 lines =@@ >d : D d.chunk; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToClassAlias.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToClassAlias.types.diff index a9f0c0a7c0..13ace9c048 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToClassAlias.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportTypeReferenceToClassAlias.types.diff @@ -18,8 +18,6 @@ === test.js === /** @typedef {import('./mod1').C} X */ -+>X : any -+ /** @param {X} c */ function demo(c) { ->demo : (c: X) => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.types.diff index 44f0e526c2..8037c04cb3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateClass.types.diff @@ -1,25 +1,6 @@ --- old.jsdocTemplateClass.types +++ new.jsdocTemplateClass.types -@@= skipped -3, +3 lines =@@ - /** - * @template T - * @typedef {(t: T) => T} Id -+>Id : any -+>t : T -+ - */ - /** @template T */ - class Foo { - >Foo : Foo - - /** @typedef {(t: T) => T} Id2 */ -+>Id2 : any -+>t : T -+ - /** @param {T} x */ - constructor (x) { - >x : T -@@= skipped -25, +31 lines =@@ +@@= skipped -28, +28 lines =@@ * @return {T} */ foo(x, y, alpha) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction.types.diff index 7b7f45443c..f340ec5d5a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction.types.diff @@ -1,15 +1,6 @@ --- old.jsdocTemplateConstructorFunction.types +++ new.jsdocTemplateConstructorFunction.types -@@= skipped -3, +3 lines =@@ - /** - * @template U - * @typedef {(u: U) => U} Id -+>Id : Id -+>u : U -+ - */ - /** - * @param {T} t +@@= skipped -9, +9 lines =@@ * @template T */ function Zet(t) { @@ -34,7 +25,7 @@ >t : any >t : T } -@@= skipped -27, +30 lines =@@ +@@= skipped -21, +21 lines =@@ * @param {Id} id */ Zet.prototype.add = function(v, id) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction2.types.diff index b5ba2cdada..674556f764 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateConstructorFunction2.types.diff @@ -115,15 +115,3 @@ >3 : 3 >{ nested: 4 } : { nested: number; } >nested : number -@@= skipped -61, +61 lines =@@ - // lookup in typedef should not crash the compiler, even when the type is unknown - /** - * @typedef {Object} A -+>A : any -+ - * @property {T} value -+>value : any -+ - */ - /** @type {A} */ - const options = { value: null }; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag7.types.diff deleted file mode 100644 index 0cdcf30892..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag7.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsdocTemplateTag7.types -+++ new.jsdocTemplateTag7.types -@@= skipped -3, +3 lines =@@ - /** - * @template const T - * @typedef {[T]} X -+>X : any -+ - */ - - /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.types.diff index 2fb37e9ea2..a1fa576958 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag8.types.diff @@ -1,31 +1,6 @@ --- old.jsdocTemplateTag8.types +++ new.jsdocTemplateTag8.types -@@= skipped -3, +3 lines =@@ - /** - * @template out T - * @typedef {Object} Covariant -+>Covariant : any -+ - * @property {T} x -+>x : any -+ - */ - - /** -@@= skipped -34, +38 lines =@@ - /** - * @template in T - * @typedef {Object} Contravariant -+>Contravariant : any -+ - * @property {(x: T) => void} f -+>f : any -+>x : T -+ - */ - - /** -@@= skipped -8, +13 lines =@@ +@@= skipped -45, +45 lines =@@ */ let super_contravariant = { f: (x) => {} }; >super_contravariant : Contravariant @@ -54,20 +29,7 @@ super_contravariant = sub_contravariant; // Error >super_contravariant = sub_contravariant : Contravariant -@@= skipped -28, +28 lines =@@ - /** - * @template in out T - * @typedef {Object} Invariant -+>Invariant : any -+ - * @property {(x: T) => T} f -+>f : any -+>x : T -+ - */ - - /** -@@= skipped -8, +13 lines =@@ +@@= skipped -36, +36 lines =@@ */ let super_invariant = { f: (x) => {} }; >super_invariant : Invariant diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.types.diff index de45178dc0..bac0af2dbc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.types.diff @@ -1,12 +1,6 @@ --- old.jsdocTemplateTagDefault.types +++ new.jsdocTemplateTagDefault.types -@@= skipped -3, +3 lines =@@ - /** - * @template {string | number} [T=string] - ok: defaults are permitted - * @typedef {[T]} A -+>A : any -+ - */ +@@= skipped -7, +7 lines =@@ /** @type {A} */ // ok, default for `T` in `A` is `string` const aDefault1 = [""]; @@ -36,46 +30,7 @@ >[0] : [number] >0 : 0 -@@= skipped -30, +32 lines =@@ - * @template T - * @template [U=T] - ok: default can reference earlier type parameter - * @typedef {[T, U]} B -+>B : B -+ - */ - - /** - * @template {string | number} [T] - error: default requires an `=type` - * @typedef {[T]} C -+>C : C -+ - */ - - /** - * @template {string | number} [T=] - error: default requires a `type` - * @typedef {[T]} D -+>D : D -+ - */ - - /** - * @template {string | number} [T=string] - * @template U - error: Required type parameters cannot follow optional type parameters - * @typedef {[T, U]} E -+>E : E -+ - */ - - /** - * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters. - * @template [U=T] - * @typedef {[T, U]} G -+>G : G -+ - */ - - /** -@@= skipped -31, +41 lines =@@ +@@= skipped -57, +57 lines =@@ * @param {U} b */ function f1(a, b) {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.types.diff index dd5017d6cc..10ad107341 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagNameResolution.types.diff @@ -1,15 +1,6 @@ --- old.jsdocTemplateTagNameResolution.types +++ new.jsdocTemplateTagNameResolution.types -@@= skipped -4, +4 lines =@@ - * @template T - * @template {keyof T} K - * @typedef {T[K]} Foo -+>Foo : any -+ - */ - - const x = { a: 1 }; -@@= skipped -10, +12 lines =@@ +@@= skipped -14, +14 lines =@@ /** @type {Foo} */ const y = "a"; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff index a1edfeb0e3..bb54742cd7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff @@ -12,7 +12,6 @@ >"./MW" : "./MW" /** @typedef {number} Cictema */ -+>Cictema : any module.exports = class MC { ->module.exports = class MC { watch() { return new MW(this); }} : typeof import("MC") diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff index 1c3bdfd70d..e72ddd96ef 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff @@ -11,8 +11,7 @@ >require : any >"./MW" : "./MW" - /** @typedef {number} Meyerhauser */ -+>Meyerhauser : any +@@= skipped -9, +9 lines =@@ /** @class */ module.exports = function MC() { @@ -31,7 +30,7 @@ /** @type {any} */ var x = {} -@@= skipped -22, +23 lines =@@ +@@= skipped -13, +13 lines =@@ >{} : {} return new MW(x); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/linkTagEmit1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/linkTagEmit1.types.diff deleted file mode 100644 index 867209700b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/linkTagEmit1.types.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.linkTagEmit1.types -+++ new.linkTagEmit1.types -@@= skipped -6, +6 lines =@@ - } - === linkTagEmit1.js === - /** @typedef {number} N */ -+>N : number -+ - /** - * @typedef {Object} D1 -+>D1 : D1 -+ - * @property {1} e Just link to {@link NS.R} this time -+>e : any -+ - * @property {1} m Wyatt Earp loved {@link N integers} I bet. -+>m : any -+ - */ - - /** @typedef {number} Z @see N {@link N} */ -+>Z : number - - /** - * @param {number} integer {@link Z} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.types.diff index 42e6715e24..29518b6bea 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.types.diff @@ -1,11 +1,8 @@ --- old.moduleExportAssignment7.types +++ new.moduleExportAssignment7.types -@@= skipped -19, +19 lines =@@ - >4 : 4 +@@= skipped -20, +20 lines =@@ /** @typedef {() => number} buz */ -+>buz : any -+ module.exports = { ->module.exports = { Thing, AnotherThing, foo, qux: bar, baz() { return 5 }, literal: "",} : { Thing: typeof Thing; AnotherThing: typeof AnotherThing; foo: () => number; qux: () => number; baz(): number; literal: string; } ->module.exports : { Thing: typeof Thing; AnotherThing: typeof AnotherThing; foo: () => number; qux: () => number; baz(): number; literal: string; } @@ -20,7 +17,7 @@ Thing, >Thing : typeof Thing -@@= skipped -39, +41 lines =@@ +@@= skipped -38, +38 lines =@@ * @param {import("./mod").literal} g */ function jstypes(a, b, c, d, e, f, g) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.types.diff deleted file mode 100644 index 67cf570ef4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.noAssertForUnparseableTypedefs.types -+++ new.noAssertForUnparseableTypedefs.types -@@= skipped -1, +1 lines =@@ - - === bug26693.js === - /** @typedef {module:locale} hi */ -+> : any -+ - import { nope } from 'nope'; - >nope : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/optionalBindingParameters3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/optionalBindingParameters3.types.diff index eae2af0876..8630bf2469 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/optionalBindingParameters3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/optionalBindingParameters3.types.diff @@ -1,17 +1,6 @@ --- old.optionalBindingParameters3.types +++ new.optionalBindingParameters3.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef Foo -+>Foo : Foo -+ - * @property {string} a -+>a : any -+ - */ - - /** +@@= skipped -9, +9 lines =@@ * @param {Foo} [options] */ function f({ a = "a" }) {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.types.diff index d9e6b787ba..20266d58f1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/recursiveTypeReferences2.types.diff @@ -1,25 +1,6 @@ --- old.recursiveTypeReferences2.types +++ new.recursiveTypeReferences2.types -@@= skipped -1, +1 lines =@@ - - === bug39372.js === - /** @typedef {ReadonlyArray} JsonArray */ -+>JsonArray : any -+ - /** @typedef {{ readonly [key: string]: Json }} JsonRecord */ -+>JsonRecord : any -+>key : string -+ - /** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */ -+>Json : any - - /** - * @template T -@@= skipped -21, +27 lines =@@ - : XMLObject - ) - }} XMLObject */ -+>XMLObject : any +@@= skipped -25, +25 lines =@@ /** @type {XMLObject<{foo:string}>} */ const p = {}; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/seeTag4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/seeTag4.types.diff deleted file mode 100644 index 62d58d7a9f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/seeTag4.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.seeTag4.types -+++ new.seeTag4.types -@@= skipped -2, +2 lines =@@ - === seeTag4.js === - /** - * @typedef {any} A -+>A : any -+ - */ - - /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.types.diff index 8b925683fb..e09c17d843 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.types.diff @@ -9,29 +9,7 @@ >x => x : (x: any) => any >x : any >x : any - - /** - * @typedef Nested -+>Nested : Nested -+ - * @property {Object} oh -+>oh : any -+ - * @property {number} oh.no -+>property : any -+>oh : any -+>no : any -+ - * @template T - * @property {string} oh.noooooo -+>property : any -+>oh : any -+>noooooo : any -+ - */ - - -@@= skipped -34, +46 lines =@@ +@@= skipped -34, +34 lines =@@ * @returns {unknown[]} */ function flatMap(array, iterable = identity) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.types.diff index 04caa8ef53..6dab6a5a93 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/thisTag3.types.diff @@ -1,17 +1,6 @@ --- old.thisTag3.types +++ new.thisTag3.types -@@= skipped -2, +2 lines =@@ - === /a.js === - /** - * @typedef {{fn(a: string): void}} T -+>T : any -+>fn : (a: string) => void -+>a : string -+ - */ - - class C { -@@= skipped -10, +14 lines =@@ +@@= skipped -12, +12 lines =@@ * @param {string} a */ p = (a) => this.fn("" + a); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.types.diff index 344349d7a9..75632d9228 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagNoErasure.types.diff @@ -1,11 +1,6 @@ --- old.typeTagNoErasure.types +++ new.typeTagNoErasure.types -@@= skipped -1, +1 lines =@@ - - === typeTagNoErasure.js === - /** @template T @typedef {(data: T1) => T1} Test */ -+>Test : any -+>data : T1 +@@= skipped -4, +4 lines =@@ /** @type {Test} */ const test = dibbity => dibbity diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff index 455957b016..4c9ada9f36 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff @@ -1,13 +1,6 @@ --- old.typeTagOnFunctionReferencesGeneric.types +++ new.typeTagOnFunctionReferencesGeneric.types -@@= skipped -2, +2 lines =@@ - === typeTagOnFunctionReferencesGeneric.js === - /** - * @typedef {(m : T) => T} IFn -+>IFn : IFn -+>m : T -+ - */ +@@= skipped -6, +6 lines =@@ /**@type {IFn}*/ export function inJs(l) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff index 37a90e7398..ea3fe19b73 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff @@ -1,21 +1,8 @@ --- old.typedefCrossModule.types +++ new.typedefCrossModule.types -@@= skipped -7, +7 lines =@@ - === mod1.js === - /// - /** @typedef {{ type: "a", x: 1 }} A */ -+>A : any -+>type : "a" -+>x : 1 -+ +@@= skipped -10, +10 lines =@@ /** @typedef {{ type: "b", y: 1 }} B */ -+>B : any -+>type : "b" -+>y : 1 -+ /** @typedef {A | B} Both */ -+>Both : any -+ module.exports = C ->module.exports = C : typeof C ->module.exports : typeof C @@ -40,21 +27,8 @@ >p : any >1 : 1 } -@@= skipped -23, +33 lines =@@ - === mod2.js === - /// - /** @typedef {{ type: "a", x: 1 }} A */ -+>A : A -+>type : "a" -+>x : 1 -+ - /** @typedef {{ type: "b", y: 1 }} B */ -+>B : B -+>type : "b" -+>y : 1 -+ +@@= skipped -24, +24 lines =@@ /** @typedef {A | B} Both */ -+>Both : Both export function C() { ->C : typeof C @@ -68,21 +42,8 @@ >p : any >1 : 1 } -@@= skipped -17, +26 lines =@@ - === mod3.js === - /// - /** @typedef {{ type: "a", x: 1 }} A */ -+>A : any -+>type : "a" -+>x : 1 -+ - /** @typedef {{ type: "b", y: 1 }} B */ -+>B : any -+>type : "b" -+>y : 1 -+ +@@= skipped -17, +17 lines =@@ /** @typedef {A | B} Both */ -+>Both : any exports.C = function() { ->exports.C = function() { this.p = 1} : typeof C @@ -104,7 +65,7 @@ >p : any >1 : 1 } -@@= skipped -21, +30 lines =@@ +@@= skipped -17, +17 lines =@@ === use.js === /** @type {import('./mod1').Both} */ var both1 = { type: 'a', x: 1 }; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff index 43095c5c77..aa5c941749 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff @@ -1,11 +1,8 @@ --- old.typedefCrossModule3.types +++ new.typedefCrossModule3.types -@@= skipped -1, +1 lines =@@ - +@@= skipped -2, +2 lines =@@ === mod2.js === /** @typedef {number} Foo */ -+>Foo : any -+ const ns = {}; ->ns : typeof ns +>ns : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.types.diff index b09cfd298f..ab8b6a5e92 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.types.diff @@ -1,13 +1,6 @@ --- old.typedefCrossModule4.types +++ new.typedefCrossModule4.types -@@= skipped -1, +1 lines =@@ - - === mod3.js === - /** @typedef {number} Foo */ -+>Foo : any -+ - class Bar { } - >Bar : Bar +@@= skipped -6, +6 lines =@@ module.exports = { Foo: Bar }; >module.exports = { Foo: Bar } : { Foo: typeof Bar; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule5.types.diff deleted file mode 100644 index beb1545e68..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule5.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.typedefCrossModule5.types -+++ new.typedefCrossModule5.types -@@= skipped -1, +1 lines =@@ - - === mod1.js === - /** @typedef {number} Foo */ -+>Foo : any -+ - class Bar {} - >Bar : Bar - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.types.diff deleted file mode 100644 index e8c96fdeac..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.types.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.typedefInnerNamepaths.types -+++ new.typedefInnerNamepaths.types -@@= skipped -5, +5 lines =@@ - - /** - * @typedef {C~A} C~B -+> : any -+ - * @typedef {object} C~A -+>C : any -+ - */ - /** @param {C~A} o */ - constructor(o) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.types.diff index fca5b5ec44..5daa7068b2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefMultipleTypeParameters.types.diff @@ -1,17 +1,6 @@ --- old.typedefMultipleTypeParameters.types +++ new.typedefMultipleTypeParameters.types -@@= skipped -6, +6 lines =@@ - * @template W - * @template X That last one had no comment - * @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything -+>Everything : any -+>t : T -+>u : U -+>v : V -+>w : W -+>x : X -+ - */ +@@= skipped -10, +10 lines =@@ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ var tuvwx; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnSemicolonClassElement.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnSemicolonClassElement.types.diff deleted file mode 100644 index 5ae33ec7c3..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnSemicolonClassElement.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.typedefOnSemicolonClassElement.types -+++ new.typedefOnSemicolonClassElement.types -@@= skipped -4, +4 lines =@@ - >Preferences : Preferences - - /** @typedef {string} A */ -+>A : any -+ - ; - /** @type {A} */ - a = 'ok' diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.types.diff index 42100359be..da23151f7e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefOnStatements.types.diff @@ -1,128 +1,6 @@ --- old.typedefOnStatements.types +++ new.typedefOnStatements.types -@@= skipped -1, +1 lines =@@ - - === typedefOnStatements.js === - /** @typedef {{a: string}} A */ -+>A : any -+>a : string -+ - ; - /** @typedef {{ b: string }} B */ -+>B : any -+>b : string -+ - debugger; - /** @typedef {{ c: string }} C */ -+>C : any -+>c : string - { - } - /** @typedef {{ d: string }} D */ -+>D : any -+>d : string -+ - 1 + 1; - >1 + 1 : number - >1 : 1 - >1 : 1 - - /** @typedef {{ e: string }} E */ -+>E : any -+>e : string -+ - if (false) { - >false : false - } - /** @typedef {{ f: string }} F */ -+>F : any -+>f : string -+ - do { - } while (false); - >false : false - - /** @typedef {{ g: string }} G */ -+>G : any -+>g : string -+ - while (false) { - >false : false - } - /** @typedef {{ h: string }} H */ -+>H : any -+>h : string -+ - for (;; false) { - >false : false - } - /** @typedef {{ i: string }} I */ -+>I : any -+>i : string -+ - for (let i in []) { - >i : string - >[] : never[] - } - /** @typedef {{ j: string }} J */ -+>J : any -+>j : string -+ - break; - /** @typedef {{ k: string }} K */ -+>K : any -+>k : string -+ - for (let k of []) { - >k : never - >[] : never[] - } - /** @typedef {{ l: string }} L */ -+>L : any -+>l : string -+ - continue; - /** @typedef {{ m: string }} M */ -+>M : any -+>m : string -+ - with (name) { - >name : void - } - /** @typedef {{ n: string }} N */ -+>N : any -+>n : string -+ - switch (name) { - >name : void - } - - /** @typedef {{ o: string }} O */ -+>O : any -+>o : string -+ - fork: while (false) { - >fork : any - >false : false - } - - /** @typedef {{ p: string }} P */ -+>P : any -+>p : string -+ - throw new Error('Unreachable') - >new Error('Unreachable') : Error - >Error : ErrorConstructor - >'Unreachable' : "Unreachable" - - /** @typedef {{ q: string }} Q */ -+>Q : any -+>q : string -+ - try { - } - catch (e) { -@@= skipped -91, +141 lines =@@ +@@= skipped -92, +92 lines =@@ * @param {Q} q */ function proof (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) { @@ -238,13 +116,3 @@ >q : string /** @type {Alpha} */ -@@= skipped -59, +59 lines =@@ - >"aleph" : "aleph" - - /** @typedef {{ alpha: string }} Alpha */ -+>Alpha : any -+>alpha : string -+ - return - } - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefScope1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefScope1.types.diff deleted file mode 100644 index 9cef73e704..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefScope1.types.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.typedefScope1.types -+++ new.typedefScope1.types -@@= skipped -4, +4 lines =@@ - >B1 : () => void - - /** @typedef {number} B */ -+>B : any -+ - /** @type {B} */ - var ok1 = 0; - >ok1 : number -@@= skipped -10, +12 lines =@@ - >B2 : () => void - - /** @typedef {string} B */ -+>B : any -+ - /** @type {B} */ - var ok2 = 'hi'; - >ok2 : string diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagExtraneousProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagExtraneousProperty.types.diff index 358fef1a19..21465fddfd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagExtraneousProperty.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagExtraneousProperty.types.diff @@ -1,13 +1,6 @@ --- old.typedefTagExtraneousProperty.types +++ new.typedefTagExtraneousProperty.types -@@= skipped -1, +1 lines =@@ - - === typedefTagExtraneousProperty.js === - /** @typedef {Object.} Mmap -+>Mmap : any -+ - * @property {string} ignoreMe - should be ignored - */ +@@= skipped -6, +6 lines =@@ /** @type {Mmap} */ var y = { bye: "no" }; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagNested.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagNested.types.diff index 8aa2fc151f..81d5a21222 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagNested.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagNested.types.diff @@ -1,58 +1,6 @@ --- old.typedefTagNested.types +++ new.typedefTagNested.types -@@= skipped -1, +1 lines =@@ - - === a.js === - /** @typedef {Object} App -+>App : any -+ - * @property {string} name -+>name : any -+ - * @property {Object} icons -+>icons : any -+ - * @property {string} icons.image32 -+>property : any -+>icons : any -+>image32 : any -+ - * @property {string} icons.image64 -+>property : any -+>icons : any -+>image64 : any -+ - */ - var ex; - >ex : any -@@= skipped -32, +46 lines =@@ - } - - /** @typedef {Object} Opp -+>Opp : any -+ - * @property {string} name - * @property {Object} oops - * @property {string} horrible -@@= skipped -14, +16 lines =@@ - >mistake : string - - /** @typedef {Object} Upp -+>Upp : any -+ - * @property {string} name -+>name : any -+ - * @property {Object} not -+>not : any -+ - * @property {string} nested -+>nested : any -+ - */ - - /** @type {Upp} */ -@@= skipped -17, +25 lines =@@ +@@= skipped -64, +64 lines =@@ >"ok" : "ok" sala.name diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagTypeResolution.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagTypeResolution.types.diff index 209e22f8df..f50bd4ca3f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagTypeResolution.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagTypeResolution.types.diff @@ -1,14 +1,6 @@ --- old.typedefTagTypeResolution.types +++ new.typedefTagTypeResolution.types -@@= skipped -2, +2 lines =@@ - === github20832.js === - // #20832 - /** @typedef {U} T - should be "error, can't find type named 'U' */ -+>T : U -+ - /** - * @template U - * @param {U} x +@@= skipped -8, +8 lines =@@ * @return {T} */ function f(x) { @@ -17,7 +9,7 @@ >x : U return x; -@@= skipped -34, +36 lines =@@ +@@= skipped -28, +28 lines =@@ /** @type {Cb} */ const cb = x => {} >cb : Cb diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.types.diff index 30a923d424..931b092ec9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.types.diff @@ -1,15 +1,6 @@ --- old.typedefTagWrapping.types +++ new.typedefTagWrapping.types -@@= skipped -2, +2 lines =@@ - === mod1.js === - /** - * @typedef {function(string): boolean} -+> : function -+ - * Type1 - */ - -@@= skipped -16, +18 lines =@@ +@@= skipped -18, +18 lines =@@ >arg : string return func(arg); @@ -18,25 +9,7 @@ >func : Type1 >arg : string } -@@= skipped -12, +12 lines =@@ - * str: string, - * boo: boolean - * }} Type2 -+>Type2 : Type2 -+ - */ - - /** -@@= skipped -29, +31 lines =@@ - * A function whose signature is very long. - * - * @typedef {function(boolean, string, number): -+> : function -+ - * (string|number)} StringOrNumber1 - */ - -@@= skipped -19, +21 lines =@@ +@@= skipped -60, +60 lines =@@ >num : number return func(bool, str, num) @@ -45,16 +18,7 @@ >func : StringOrNumber1 >bool : boolean >str : string -@@= skipped -12, +12 lines =@@ - * A function whose signature is very long. - * - * @typedef {function(boolean, string, -+> : function -+ - * number): - * (string|number)} StringOrNumber2 - */ -@@= skipped -20, +22 lines =@@ +@@= skipped -32, +32 lines =@@ >num : number return func(bool, str, num) @@ -63,21 +27,3 @@ >func : StringOrNumber2 >bool : boolean >str : string -@@= skipped -17, +17 lines =@@ - * boo: - * boolean - * }} Type5 -+>Type5 : Type5 -+ - */ - - /** -@@= skipped -32, +34 lines =@@ - * bar: - * * - * }} Type6 -+>Type6 : Type6 -+ - */ - - /**