From 5b7df51f33ad9f88bd94ed2a4a8b91b16a128b7d Mon Sep 17 00:00:00 2001 From: Oleksandr Tarasiuk Date: Tue, 14 Oct 2025 13:40:43 +0300 Subject: [PATCH] fix(1880): report jsdoc diagnostics when checkjs is enabled --- internal/compiler/program.go | 6 ++ .../compiler/invalidJsdocType.errors.txt | 8 +++ .../compiler/invalidJsdocType.symbols | 7 +++ .../reference/compiler/invalidJsdocType.types | 7 +++ .../compiler/jsEnumCrossFileExport.errors.txt | 6 +- .../jsdocFunctionTypeFalsePositive.errors.txt | 5 +- ...docParameterParsingInfiniteLoop.errors.txt | 5 +- .../compiler/uniqueSymbolJs.errors.txt | 5 +- .../asyncArrowFunction_allowJs.errors.txt | 17 +++++- .../checkJsdocSatisfiesTag14.errors.txt | 20 +++++++ .../conformance/checkJsdocTypeTag1.errors.txt | 11 +++- .../conformance/checkJsdocTypeTag2.errors.txt | 14 ++++- ...ckJsdocTypeTagOnObjectProperty1.errors.txt | 8 ++- ...ckJsdocTypeTagOnObjectProperty2.errors.txt | 11 +++- ...checkJsdocTypedefOnlySourceFile.errors.txt | 6 +- .../conformance/importDeferJsdoc.errors.txt | 5 +- .../conformance/importTag10.errors.txt | 11 ++++ .../conformance/importTag11.errors.txt | 10 ++++ .../conformance/importTag12.errors.txt | 10 ++++ .../conformance/importTag13.errors.txt | 5 +- .../conformance/importTag14.errors.txt | 5 +- ...larationsModuleReferenceHasEmit.errors.txt | 5 +- ...ArgsWithThisTypeInJSDocFunction.errors.txt | 13 +++++ ...sExistingNodesMappingJSDocTypes.errors.txt | 11 +++- .../jsdocAugmentsMissingType.errors.txt | 5 +- .../conformance/jsdocFunctionType.errors.txt | 20 ++++++- .../jsdocFunction_missingReturn.errors.txt | 5 +- .../jsdocImplements_missingType.errors.txt | 11 ++++ .../jsdocImplements_missingType.js | 18 ------ .../jsdocImplements_missingType.js.diff | 20 +------ .../jsdocOuterTypeParameters1.errors.txt | 5 +- .../jsdocOuterTypeParameters3.errors.txt | 5 +- ...ocParseDotDotDotInJSDocFunction.errors.txt | 8 ++- .../jsdocParseHigherOrderFunction.errors.txt | 5 +- ...arseParenthesizedJSDocParameter.errors.txt | 5 +- .../jsdocParseStarEquals.errors.txt | 5 +- .../jsdocPrefixPostfixParsing.errors.txt | 11 +++- .../conformance/jsdocPrivateName2.errors.txt | 14 +++++ .../conformance/jsdocTemplateTag.errors.txt | 5 +- .../conformance/jsdocTemplateTag3.errors.txt | 5 +- .../jsdocTemplateTagDefault.errors.txt | 8 ++- .../conformance/jsdocThisType.errors.txt | 8 ++- .../jsdocTypeTagParameterType.errors.txt | 5 +- .../jsdocTypeTagRequiredParameters.errors.txt | 5 +- .../conformance/jsdocVariadicType.errors.txt | 5 +- .../noAssertForUnparseableTypedefs.errors.txt | 5 +- .../conformance/paramTagWrapping.errors.txt | 11 +++- .../templateInsideCallback.errors.txt | 14 ++++- ...typedefDuplicateTypeDeclaration.errors.txt | 13 +++++ .../typedefInnerNamepaths.errors.txt | 19 +++++++ .../conformance/typedefTagWrapping.errors.txt | 23 ++++++-- .../jsEnumCrossFileExport.errors.txt.diff | 6 +- ...cFunctionTypeFalsePositive.errors.txt.diff | 18 ------ ...rameterParsingInfiniteLoop.errors.txt.diff | 5 +- .../compiler/uniqueSymbolJs.errors.txt.diff | 13 +++-- ...asyncArrowFunction_allowJs.errors.txt.diff | 17 +++++- .../checkJsdocSatisfiesTag14.errors.txt.diff | 35 ++++++------ .../checkJsdocTypeTag1.errors.txt.diff | 22 +++++++- .../checkJsdocTypeTag2.errors.txt.diff | 16 +++++- ...ocTypeTagOnObjectProperty1.errors.txt.diff | 8 ++- ...ocTypeTagOnObjectProperty2.errors.txt.diff | 23 ++++---- ...JsdocTypedefOnlySourceFile.errors.txt.diff | 6 +- .../importDeferJsdoc.errors.txt.diff | 13 +++-- .../conformance/importTag10.errors.txt.diff | 15 ----- .../conformance/importTag11.errors.txt.diff | 19 +++---- .../conformance/importTag12.errors.txt.diff | 18 +++--- .../conformance/importTag13.errors.txt.diff | 15 +++-- .../conformance/importTag14.errors.txt.diff | 11 ++-- ...ionsModuleReferenceHasEmit.errors.txt.diff | 5 +- ...ithThisTypeInJSDocFunction.errors.txt.diff | 17 ++++++ ...tingNodesMappingJSDocTypes.errors.txt.diff | 11 +++- .../jsdocAugmentsMissingType.errors.txt.diff | 5 +- .../jsdocFunctionType.errors.txt.diff | 27 +++++++-- ...sdocFunction_missingReturn.errors.txt.diff | 5 +- ...sdocImplements_missingType.errors.txt.diff | 20 +++---- .../jsdocOuterTypeParameters1.errors.txt.diff | 12 ++-- .../jsdocOuterTypeParameters3.errors.txt.diff | 12 ++-- ...seDotDotDotInJSDocFunction.errors.txt.diff | 8 ++- ...ocParseHigherOrderFunction.errors.txt.diff | 5 +- ...arenthesizedJSDocParameter.errors.txt.diff | 5 +- .../jsdocParseStarEquals.errors.txt.diff | 5 +- .../jsdocPrefixPostfixParsing.errors.txt.diff | 24 ++++---- .../jsdocPrivateName2.errors.txt.diff | 23 +++----- .../jsdocTemplateTag.errors.txt.diff | 9 ++- .../jsdocTemplateTag3.errors.txt.diff | 21 +++---- .../jsdocTemplateTagDefault.errors.txt.diff | 33 ----------- .../conformance/jsdocThisType.errors.txt.diff | 10 +++- .../jsdocTypeTagParameterType.errors.txt.diff | 5 +- ...cTypeTagRequiredParameters.errors.txt.diff | 7 ++- .../jsdocVariadicType.errors.txt.diff | 5 +- ...sertForUnparseableTypedefs.errors.txt.diff | 5 +- .../paramTagWrapping.errors.txt.diff | 19 ++++--- .../templateInsideCallback.errors.txt.diff | 51 +++++++---------- ...efDuplicateTypeDeclaration.errors.txt.diff | 17 ------ .../typedefInnerNamepaths.errors.txt.diff | 35 ++++++------ .../typedefTagWrapping.errors.txt.diff | 55 +++++++------------ .../tests/cases/compiler/invalidJsdocType.ts | 6 ++ 97 files changed, 777 insertions(+), 419 deletions(-) create mode 100644 testdata/baselines/reference/compiler/invalidJsdocType.errors.txt create mode 100644 testdata/baselines/reference/compiler/invalidJsdocType.symbols create mode 100644 testdata/baselines/reference/compiler/invalidJsdocType.types create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag10.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag11.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag12.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocPrivateName2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typedefDuplicateTypeDeclaration.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.errors.txt delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag10.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typedefDuplicateTypeDeclaration.errors.txt.diff create mode 100644 testdata/tests/cases/compiler/invalidJsdocType.ts diff --git a/internal/compiler/program.go b/internal/compiler/program.go index b70a00197f..7238991f97 100644 --- a/internal/compiler/program.go +++ b/internal/compiler/program.go @@ -1056,6 +1056,12 @@ func (p *Program) getSemanticDiagnosticsForFileNotFilter(ctx context.Context, so }) } + isJS := sourceFile.ScriptKind == core.ScriptKindJS || sourceFile.ScriptKind == core.ScriptKindJSX + isCheckJS := isJS && ast.IsCheckJSEnabledForFile(sourceFile, compilerOptions) + if isCheckJS { + diags = append(diags, sourceFile.JSDocDiagnostics()...) + } + filtered, directivesByLine := p.getDiagnosticsWithPrecedingDirectives(sourceFile, diags) for _, directive := range directivesByLine { // Above we changed all used directive kinds to @ts-ignore, so any @ts-expect-error directives that diff --git a/testdata/baselines/reference/compiler/invalidJsdocType.errors.txt b/testdata/baselines/reference/compiler/invalidJsdocType.errors.txt new file mode 100644 index 0000000000..e122d03076 --- /dev/null +++ b/testdata/baselines/reference/compiler/invalidJsdocType.errors.txt @@ -0,0 +1,8 @@ +a.js(1,12): error TS1110: Type expected. + + +==== a.js (1 errors) ==== + /** @type {@import("a").Type} */ + ~ +!!! error TS1110: Type expected. + let x; \ No newline at end of file diff --git a/testdata/baselines/reference/compiler/invalidJsdocType.symbols b/testdata/baselines/reference/compiler/invalidJsdocType.symbols new file mode 100644 index 0000000000..0f8b4e2b0a --- /dev/null +++ b/testdata/baselines/reference/compiler/invalidJsdocType.symbols @@ -0,0 +1,7 @@ +//// [tests/cases/compiler/invalidJsdocType.ts] //// + +=== a.js === +/** @type {@import("a").Type} */ +let x; +>x : Symbol(x, Decl(a.js, 1, 3)) + diff --git a/testdata/baselines/reference/compiler/invalidJsdocType.types b/testdata/baselines/reference/compiler/invalidJsdocType.types new file mode 100644 index 0000000000..50b41486a2 --- /dev/null +++ b/testdata/baselines/reference/compiler/invalidJsdocType.types @@ -0,0 +1,7 @@ +//// [tests/cases/compiler/invalidJsdocType.ts] //// + +=== a.js === +/** @type {@import("a").Type} */ +let x; +>x : any + diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt index 3be4b9a200..8636c15447 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt @@ -1,3 +1,4 @@ +enumDef.js(14,21): error TS1003: Identifier expected. enumDef.js(16,18): error TS2339: Property 'Blah' does not exist on type '{ Action: { WindowDocked: number; WindowUndocked: number; ScriptsBreakpointSet: number; TimelineStarted: number; }; }'. index.js(4,17): error TS2503: Cannot find namespace 'Host'. index.js(8,21): error TS2304: Cannot find name 'Host'. @@ -5,7 +6,7 @@ index.js(13,11): error TS2503: Cannot find namespace 'Host'. index.js(18,11): error TS2503: Cannot find namespace 'Host'. -==== enumDef.js (1 errors) ==== +==== enumDef.js (2 errors) ==== var Host = {}; Host.UserMetrics = {}; /** @enum {number} */ @@ -20,7 +21,10 @@ index.js(18,11): error TS2503: Cannot find namespace 'Host'. */ /** * @typedef {string} + */ + +!!! error TS1003: Identifier expected. Host.UserMetrics.Blah = { ~~~~ !!! error TS2339: Property 'Blah' does not exist on type '{ Action: { WindowDocked: number; WindowUndocked: number; ScriptsBreakpointSet: number; TimelineStarted: number; }; }'. diff --git a/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt index 4147bce1d5..f3bf77a415 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt @@ -1,9 +1,12 @@ /a.js(1,13): error TS1098: Type parameter list cannot be empty. +/a.js(1,14): error TS1139: Type parameter declaration expected. -==== /a.js (1 errors) ==== +==== /a.js (2 errors) ==== /** @param {<} x */ ~~ !!! error TS1098: Type parameter list cannot be empty. + ~ +!!! error TS1139: Type parameter declaration expected. function f(x) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt index 1b0b2a8cd2..e7e5e429a5 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt @@ -1,12 +1,15 @@ example.js(3,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +example.js(3,19): error TS1005: '}' expected. -==== example.js (1 errors) ==== +==== example.js (2 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. + ~ +!!! error TS1005: '}' expected. */ let x; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/uniqueSymbolJs.errors.txt b/testdata/baselines/reference/submodule/compiler/uniqueSymbolJs.errors.txt index 162596d71b..9b3d5518d5 100644 --- a/testdata/baselines/reference/submodule/compiler/uniqueSymbolJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/uniqueSymbolJs.errors.txt @@ -1,8 +1,9 @@ a.js(5,18): error TS1268: An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type. a.js(5,23): error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? +a.js(5,28): error TS1005: ';' expected. -==== a.js (2 errors) ==== +==== a.js (3 errors) ==== /** @type {unique symbol} */ const foo = Symbol(); @@ -12,4 +13,6 @@ a.js(5,23): error TS2749: 'foo' refers to a value, but is being used as a type h !!! error TS1268: An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type. ~~~ !!! error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? + ~~~~~~~ +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt index 6dc5427f14..fcda802241 100644 --- a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt @@ -1,16 +1,23 @@ file.js(2,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(2,20): error TS1005: '}' expected. file.js(6,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(6,20): error TS1005: '}' expected. file.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(10,20): error TS1005: '}' expected. file.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(16,20): error TS1005: '}' expected. file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(21,20): error TS1005: '}' expected. -==== file.js (5 errors) ==== +==== file.js (10 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. + ~ +!!! error TS1005: '}' expected. const a = () => 0 // Error (good) @@ -18,6 +25,8 @@ file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Functio ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const b = async () => 0 // No error (bad) @@ -25,6 +34,8 @@ file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Functio ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const c = async () => { return 0 } @@ -34,6 +45,8 @@ file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Functio ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const d = async () => { return "" } @@ -42,6 +55,8 @@ file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Functio ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const f = (p) => {} // Error (good) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.errors.txt new file mode 100644 index 0000000000..81ef184a80 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.errors.txt @@ -0,0 +1,20 @@ +/a.js(7,15): error TS1005: '{' expected. +/a.js(10,27): error TS1005: '{' expected. + + +==== /a.js (2 errors) ==== + /** + * @typedef {Object} T1 + * @property {number} a + */ + + /** + * @satisfies T1 + ~~ +!!! error TS1005: '{' expected. + */ + const t1 = { a: 1 }; + const t2 = /** @satisfies T1 */ ({ a: 1 }); + ~~ +!!! error TS1005: '{' expected. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt index beeb1723a4..e65ef651bc 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt @@ -1,10 +1,13 @@ +0.js(12,13): error TS1110: Type expected. 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(24,21): error TS1005: '}' expected. 0.js(28,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(28,21): error TS1005: '}' expected. 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) ==== +==== 0.js (7 errors) ==== // @ts-check /** @type {String} */ var S = "hello world"; @@ -17,6 +20,8 @@ anyT = "hello"; /** @type {?} */ + ~ +!!! error TS1110: Type expected. var anyT1 = 2; anyT1 = "hi"; @@ -35,6 +40,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const x1 = (a) => a + 1; x1(0); @@ -42,6 +49,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const x2 = (a) => a + 1; x2(0); diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt index 76933dc06a..3fa558ce7e 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt @@ -1,12 +1,16 @@ 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(8,21): error TS1005: '}' expected. 0.js(12,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(12,21): error TS1005: '}' expected. 0.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(19,21): error TS1005: '}' expected. 0.js(23,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(23,21): error TS1005: '}' expected. -==== 0.js (6 errors) ==== +==== 0.js (10 errors) ==== // @ts-check /** @type {String} */ var S = true; @@ -22,6 +26,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const x1 = (a) => a + 1; x1("string"); @@ -29,6 +35,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const x2 = (a) => a + 1; /** @type {string} */ @@ -39,6 +47,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const x3 = (a) => a.concat("hi"); x3(0); @@ -46,5 +56,7 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const x4 = (a) => a + 1; x4(0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt index 0de428dba4..fdc2f09b11 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt @@ -1,9 +1,11 @@ 0.js(8,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? 0.js(8,14): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. +0.js(8,22): error TS1005: '}' expected. 0.js(16,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(16,22): error TS1005: '}' expected. -==== 0.js (3 errors) ==== +==== 0.js (5 errors) ==== // @ts-check var lol = "hello Lol" const obj = { @@ -17,6 +19,8 @@ !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ~~~~~~~~ !!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. + ~ +!!! error TS1005: '}' expected. method1(n1) { return n1 + 42; }, @@ -28,6 +32,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. arrowFunc: (num) => num + 42 } obj.foo = 'string' diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt index 42e3fc5e74..a57a956ce1 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt @@ -1,11 +1,14 @@ 0.js(5,3): error TS2322: Type 'number' is not assignable to type 'string'. 0.js(6,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? 0.js(6,14): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. +0.js(6,22): error TS1005: '}' expected. 0.js(10,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(10,22): error TS1005: '}' expected. 0.js(12,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(12,22): error TS1005: '}' expected. -==== 0.js (5 errors) ==== +==== 0.js (8 errors) ==== // @ts-check var lol; const obj = { @@ -19,6 +22,8 @@ !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ~~~~~~~~ !!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. + ~ +!!! error TS1005: '}' expected. method1(n1) { return "42"; }, @@ -26,11 +31,15 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. 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. + ~ +!!! error TS1005: '}' expected. arrowFunc: (num="0") => num + 42, /** @type {string} */ lol diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt index 7cb22b9170..02b45beef8 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt @@ -1,9 +1,10 @@ 0.js(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. +0.js(6,21): error TS1003: Identifier expected. 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 (4 errors) ==== // @ts-check var exports = {}; @@ -12,7 +13,10 @@ /** * @typedef {string} + */ + +!!! error TS1003: Identifier expected. exports.SomeName; ~~~~~~~~ !!! error TS2339: Property 'SomeName' does not exist on type '{}'. diff --git a/testdata/baselines/reference/submodule/conformance/importDeferJsdoc.errors.txt b/testdata/baselines/reference/submodule/conformance/importDeferJsdoc.errors.txt index ddbf644aaa..857db340b4 100644 --- a/testdata/baselines/reference/submodule/conformance/importDeferJsdoc.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/importDeferJsdoc.errors.txt @@ -1,3 +1,4 @@ +/foo.js(2,18): error TS1005: 'from' expected. /foo.js(2,18): error TS1141: String literal expected. /foo.js(6,12): error TS2503: Cannot find namespace 'ns'. @@ -5,9 +6,11 @@ ==== /types.ts (0 errors) ==== export type X = 1; -==== /foo.js (2 errors) ==== +==== /foo.js (3 errors) ==== /** * @import defer * as ns from "./types" + ~ +!!! error TS1005: 'from' expected. ~~~~ !!! error TS1141: String literal expected. */ diff --git a/testdata/baselines/reference/submodule/conformance/importTag10.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag10.errors.txt new file mode 100644 index 0000000000..496ce7f502 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag10.errors.txt @@ -0,0 +1,11 @@ +/foo.js(2,11): error TS1109: Expression expected. + + +==== /foo.js (1 errors) ==== + /** + * @import + + */ + +!!! error TS1109: Expression expected. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag11.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag11.errors.txt new file mode 100644 index 0000000000..6071e9e709 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag11.errors.txt @@ -0,0 +1,10 @@ +/foo.js(3,2): error TS1005: 'from' expected. + + +==== /foo.js (1 errors) ==== + /** + * @import foo + */ + +!!! error TS1005: 'from' expected. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag12.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag12.errors.txt new file mode 100644 index 0000000000..dc3d88ac50 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag12.errors.txt @@ -0,0 +1,10 @@ +/foo.js(3,2): error TS1109: Expression expected. + + +==== /foo.js (1 errors) ==== + /** + * @import foo from + */ + +!!! error TS1109: Expression expected. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag13.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag13.errors.txt index 958d6225ec..3427c0e358 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag13.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/importTag13.errors.txt @@ -1,8 +1,11 @@ +/foo.js(1,15): error TS1005: 'from' expected. /foo.js(1,15): error TS1141: String literal expected. -==== /foo.js (1 errors) ==== +==== /foo.js (2 errors) ==== /** @import x = require("types") */ + ~ +!!! error TS1005: 'from' expected. ~~~~~~~~~~~~~~~~~~ !!! error TS1141: String literal expected. diff --git a/testdata/baselines/reference/submodule/conformance/importTag14.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag14.errors.txt index d5fdf908c6..6109dd03ca 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag14.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/importTag14.errors.txt @@ -1,9 +1,10 @@ /foo.js(1,25): error TS2306: File '/foo.js' is not a module. /foo.js(1,33): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /foo.js(1,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +/foo.js(1,38): error TS1005: '{' expected. -==== /foo.js (3 errors) ==== +==== /foo.js (4 errors) ==== /** @import * as f from "./foo" with */ ~~~~~~~ !!! error TS2306: File '/foo.js' is not a module. @@ -11,4 +12,6 @@ !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. ~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + +!!! error TS1005: '{' expected. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt index 30a9f935a7..03ef528a8c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt @@ -1,7 +1,8 @@ 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(9,17): error TS1005: '}' expected. -==== index.js (1 errors) ==== +==== index.js (2 errors) ==== /** * @module A */ @@ -13,6 +14,8 @@ index.js(9,11): error TS2580: Cannot find name 'module'. Do you need to install * @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`. + ~ +!!! error TS1005: '}' expected. */ export let el = null; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt new file mode 100644 index 0000000000..9e85c38599 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt @@ -0,0 +1,13 @@ +bug38550.js(3,22): error TS1005: '}' expected. + + +==== bug38550.js (1 errors) ==== + export class Clazz { + /** + * @param {function(this:Object, ...*):*} functionDeclaration + ~ +!!! error TS1005: '}' expected. + */ + method(functionDeclaration) {} + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt index e15b2747c9..e6ea3ee553 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt @@ -1,10 +1,15 @@ +index.js(1,13): error TS1110: Type expected. index.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +index.js(16,20): error TS1005: '}' expected. index.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +index.js(19,20): error TS1005: '}' expected. index.js(22,12): error TS2315: Type 'Object' is not generic. -==== index.js (3 errors) ==== +==== index.js (6 errors) ==== /** @type {?} */ + ~ +!!! error TS1110: Type expected. export const a = null; /** @type {*} */ @@ -23,12 +28,16 @@ index.js(22,12): error TS2315: Type 'Object' is not generic. ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. 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. + ~ +!!! error TS1005: '}' expected. export const g = null; /** @type {Object.} */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocAugmentsMissingType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocAugmentsMissingType.errors.txt index f3a1da2292..64751af466 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocAugmentsMissingType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocAugmentsMissingType.errors.txt @@ -1,11 +1,14 @@ /a.js(2,14): error TS8023: JSDoc '@augments ' does not match the 'extends A' clause. +/a.js(2,14): error TS1003: Identifier expected. -==== /a.js (1 errors) ==== +==== /a.js (2 errors) ==== class A { constructor() { this.x = 0; } } /** @augments */ !!! error TS8023: JSDoc '@augments ' does not match the 'extends A' clause. + ~ +!!! error TS1003: Identifier expected. class B extends A { m() { this.x diff --git a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt index b1407448a2..bb3a047fb1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt @@ -1,22 +1,32 @@ +functions.js(2,20): error TS1005: '}' expected. functions.js(3,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(3,21): error TS1005: '}' expected. 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(12,20): error TS1005: '}' expected. functions.js(13,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(13,21): error TS1005: '}' expected. functions.js(15,14): error TS7006: Parameter 'c' implicitly has an 'any' type. functions.js(30,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(30,21): error TS1005: '}' expected. 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(48,20): error TS1005: '}' expected. 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 (10 errors) ==== +==== functions.js (16 errors) ==== /** * @param {function(this: string, number): number} c is just passing on through + ~ +!!! error TS1005: '}' expected. * @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. + ~ +!!! error TS1005: '}' expected. */ function id1(c) { ~ @@ -30,10 +40,14 @@ functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type /** * @param {function(new: { length: number }, number): number} c is just passing on through + ~ +!!! error TS1005: '}' expected. * @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. + ~ +!!! error TS1005: '}' expected. */ function id2(c) { ~ @@ -56,6 +70,8 @@ functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. var f = function (ab, onetwo) { return ab === "a" ? 3 : 4; } ~~ !!! error TS7006: Parameter 'ab' implicitly has an 'any' type. @@ -78,6 +94,8 @@ functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type /** * @param {function(new: D, number)} dref + ~ +!!! error TS1005: '}' expected. * @return {D} ~ !!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? diff --git a/testdata/baselines/reference/submodule/conformance/jsdocFunction_missingReturn.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocFunction_missingReturn.errors.txt index cf99dc4aac..f245054c91 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocFunction_missingReturn.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocFunction_missingReturn.errors.txt @@ -1,13 +1,16 @@ /a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? /a.js(1,12): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. +/a.js(1,20): error TS1005: '}' expected. -==== /a.js (2 errors) ==== +==== /a.js (3 errors) ==== /** @type {function(): number} */ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ~~~~~~~~ !!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. + ~ +!!! error TS1005: '}' expected. function f() {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.errors.txt new file mode 100644 index 0000000000..1b22f60035 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.errors.txt @@ -0,0 +1,11 @@ +/a.js(2,16): error TS1003: Identifier expected. + + +==== /a.js (1 errors) ==== + class A { constructor() { this.x = 0; } } + /** @implements */ + ~ +!!! error TS1003: Identifier expected. + class B { + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js b/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js index 0d5243e60c..222dea0291 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js @@ -16,21 +16,3 @@ declare class A { /** @implements */ declare class B implements { } - - -//// [DtsFileErrors] - - -out/a.d.ts(5,27): error TS1097: 'implements' list cannot be empty. - - -==== out/a.d.ts (1 errors) ==== - declare class A { - constructor(); - } - /** @implements */ - declare class B implements { - -!!! error TS1097: 'implements' list cannot be empty. - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js.diff b/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js.diff index 643e190e6e..0f948ec122 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js.diff @@ -10,22 +10,4 @@ /** @implements */ -declare class B { +declare class B implements { - } -+ -+ -+//// [DtsFileErrors] -+ -+ -+out/a.d.ts(5,27): error TS1097: 'implements' list cannot be empty. -+ -+ -+==== out/a.d.ts (1 errors) ==== -+ declare class A { -+ constructor(); -+ } -+ /** @implements */ -+ declare class B implements { -+ -+!!! error TS1097: 'implements' list cannot be empty. -+ } -+ \ No newline at end of file + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt index ab250f778b..7d683ab15b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt @@ -1,18 +1,21 @@ 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(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'. !!! 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 (3 errors) ==== /** @return {T} */ ~ !!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template {T} */ + ~ +!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. const PropertyAccessors = dedupingMixin(() => { class Bar { static bar() { this.prototype.foo(); } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters3.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters3.errors.txt index dbb9a05d5f..dec5ad00d7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters3.errors.txt @@ -1,12 +1,15 @@ error TS5055: Cannot write file 'jsdocOuterTypeParameters3.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. +jsdocOuterTypeParameters3.js(1,18): error TS1069: Unexpected token. A type parameter name was expected without curly braces. jsdocOuterTypeParameters3.js(5,43): error TS2339: Property 'foo' does not exist on type 'Bar'. !!! error TS5055: Cannot write file 'jsdocOuterTypeParameters3.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. -==== jsdocOuterTypeParameters3.js (1 errors) ==== +==== jsdocOuterTypeParameters3.js (2 errors) ==== /** @template {T} */ + ~ +!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. class Baz { m() { class Bar { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt index 4d4beab51f..eae095f502 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt @@ -1,10 +1,14 @@ +a.js(2,21): error TS1005: '}' expected. 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(8,20): error TS1005: '}' expected. -==== a.js (2 errors) ==== +==== a.js (4 errors) ==== // from bcryptjs /** @param {function(...[*])} callback */ + ~ +!!! error TS1005: '}' expected. function g(callback) { ~~~~~~~~ !!! error TS7006: Parameter 'callback' implicitly has an 'any' type. @@ -16,6 +20,8 @@ a.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. * @inner */ var stringFromCharCode = String.fromCharCode; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt index ff420a46d1..a5d5360268 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt @@ -1,13 +1,16 @@ paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +paren.js(1,20): error TS1005: '}' expected. 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 (4 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. + ~ +!!! error TS1005: '}' expected. 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..ebc7f44032 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt @@ -1,12 +1,15 @@ paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +paren.js(1,20): error TS1005: '}' expected. paren.js(2,9): error TS7006: Parameter 's' implicitly has an 'any' type. -==== paren.js (2 errors) ==== +==== paren.js (3 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. + ~ +!!! error TS1005: '}' expected. var x = s => s.toString() ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt index b4c0510f9b..a6b4acf204 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt @@ -1,9 +1,10 @@ a.js(1,5): error TS1047: A rest parameter cannot be optional. a.js(3,12): error TS2370: A rest parameter must be of an array type. +a.js(11,21): error TS1005: '}' expected. a.js(12,14): error TS7006: Parameter 'f' implicitly has an 'any' type. -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== /** @param {...*=} args ~~~~~~~~~~~~~~~~~~~ @return {*=} */ @@ -20,6 +21,8 @@ a.js(12,14): error TS7006: Parameter 'f' implicitly has an 'any' type. /** @param {function():*=} f */ + ~ +!!! error TS1005: '}' expected. function cbf(f) { ~ !!! error TS7006: Parameter 'f' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt index f6d00af955..4318cb0357 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt @@ -1,23 +1,32 @@ +prefixPostfix.js(5,18): error TS1005: '}' expected. +prefixPostfix.js(11,21): error TS1005: '}' expected. +prefixPostfix.js(14,21): error TS1005: '}' expected. prefixPostfix.js(18,21): error TS7006: Parameter 'a' implicitly has an 'any' type. prefixPostfix.js(18,39): error TS7006: Parameter 'h' implicitly has an 'any' type. prefixPostfix.js(18,48): error TS7006: Parameter 'k' implicitly has an 'any' type. -==== prefixPostfix.js (3 errors) ==== +==== prefixPostfix.js (6 errors) ==== /** * @param {number![]} x - number[] * @param {!number[]} y - number[] * @param {(number[])!} z - number[] * @param {number?[]} a - parse error without parentheses + ~ +!!! error TS1005: '}' expected. * @param {?number[]} b - number[] | null * @param {(number[])?} c - number[] | null * @param {...?number} e - (number | null)[] * @param {...number?} f - number[] | null * @param {...number!?} g - number[] | null * @param {...number?!} h - parse error without parentheses (also nonsensical) + ~ +!!! error TS1005: '}' expected. * @param {...number[]} i - number[][] * @param {...number![]?} j - number[][] | null * @param {...number?[]!} k - parse error without parentheses + ~ +!!! error TS1005: '}' expected. * @param {number extends number ? true : false} l - conditional types work * @param {[number, number?]} m - [number, (number | undefined)?] */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPrivateName2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName2.errors.txt new file mode 100644 index 0000000000..259a1dcf2f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName2.errors.txt @@ -0,0 +1,14 @@ +jsdocPrivateName1.js(6,23): error TS1003: Identifier expected. + + +==== jsdocPrivateName1.js (1 errors) ==== + // Expecting parse error for private field + + /** + * @typedef A + * @type {object} + * @property {string} #id + ~ +!!! error TS1003: Identifier expected. + */ + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt index b60487ba5b..c2c29e32e4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt @@ -1,9 +1,10 @@ forgot.js(13,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +forgot.js(13,22): error TS1005: '}' expected. 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 (3 errors) ==== /** * @param {T} a * @template T @@ -20,6 +21,8 @@ forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKey ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. */ function g(a) { return () => a diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt index acd63b1e17..13884500ea 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt @@ -1,9 +1,10 @@ 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 TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. +a.js(25,2): error TS1069: Unexpected token. A type parameter name was expected without curly braces. -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? @@ -36,6 +37,8 @@ a.js(21,3): error TS2741: Property 'b' is missing in type '{ a: number; }' but r /** * @template {NoLongerAllowed} * @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) { } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt index 6ad768a099..ef3db758ce 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(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(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 (5 errors) ==== +==== file.js (7 errors) ==== /** * @template {string | number} [T=string] - ok: defaults are permitted * @typedef {[T]} A @@ -30,11 +32,15 @@ file.js(60,17): error TS2744: Type parameter defaults can only reference previou /** * @template {string | number} [T] - error: default requires an `=type` + ~ +!!! error TS1005: '=' expected. * @typedef {[T]} C */ /** * @template {string | number} [T=] - error: default requires a `type` + ~ +!!! error TS1110: Type expected. * @typedef {[T]} D */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt index 1d0065669f..138dbe00f1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt @@ -3,8 +3,10 @@ /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(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +/a.js(21,20): error TS1005: '}' expected. /a.js(26,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? /a.js(26,12): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. +/a.js(26,20): error TS1005: '}' expected. ==== /types.d.ts (0 errors) ==== @@ -14,7 +16,7 @@ export type M = (this: Foo) => void; -==== /a.js (7 errors) ==== +==== /a.js (9 errors) ==== /** @type {import('./types').M} */ export const f1 = function() { this.test(); @@ -47,6 +49,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. export const f5 = function() { this.test(); } @@ -57,6 +61,8 @@ !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ~~~~~~~~ !!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. + ~ +!!! error TS1005: '}' expected. export function f6() { this.test(); } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt index c7dad2e526..0aab334433 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt @@ -1,13 +1,16 @@ a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +a.js(1,20): error TS1005: '}' expected. a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. a.js(7,5): error TS2322: Type 'number' is not assignable to type 'string'. -==== a.js (3 errors) ==== +==== a.js (4 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. + ~ +!!! error TS1005: '}' expected. 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 5b78db63ce..39e940dd64 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt @@ -1,14 +1,17 @@ a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +a.js(1,20): error TS1005: '}' expected. a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. 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 (4 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. + ~ +!!! error TS1005: '}' expected. 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 index 908bca4dda..45177af772 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt @@ -1,12 +1,15 @@ a.js(2,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +a.js(2,19): error TS1005: '}' expected. -==== a.js (1 errors) ==== +==== a.js (2 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. + ~ +!!! error TS1005: '}' expected. */ const foo = function (a, b, ...r) { }; diff --git a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.errors.txt b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.errors.txt index e71c8f9b2d..072f764cfa 100644 --- a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.errors.txt @@ -1,11 +1,14 @@ 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(1,21): error TS1005: '}' expected. bug26693.js(2,22): error TS2307: Cannot find module 'nope' or its corresponding type declarations. -==== bug26693.js (2 errors) ==== +==== bug26693.js (3 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`. + ~ +!!! error TS1005: '}' expected. import { nope } from 'nope'; ~~~~~~ !!! error TS2307: Cannot find module 'nope' or its corresponding type declarations. diff --git a/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt b/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt index bc43cc7750..c0d8d0c963 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt @@ -1,3 +1,6 @@ +bad.js(2,11): error TS1003: Identifier expected. +bad.js(5,4): error TS1003: Identifier expected. +bad.js(6,20): error TS1003: Identifier expected. 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. @@ -18,13 +21,19 @@ bad.js(9,20): error TS7006: Parameter 'z' implicitly has an 'any' type. good(1, 2, 3) -==== bad.js (3 errors) ==== +==== bad.js (6 errors) ==== /** * @param * + ~ +!!! error TS1003: Identifier expected. * {number} x Arg x. * @param {number} * * y Arg y. + ~ +!!! error TS1003: Identifier expected. * @param {number} * z + ~ +!!! error TS1003: Identifier expected. * Arg z. */ function bad(x, y, z) { diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt index 48940af384..7d0367dab1 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt @@ -1,11 +1,15 @@ +templateInsideCallback.js(9,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag templateInsideCallback.js(15,11): error TS2315: Type 'Call' is not generic. 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(29,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. +templateInsideCallback.js(30,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag templateInsideCallback.js(37,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. +templateInsideCallback.js(38,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -==== templateInsideCallback.js (5 errors) ==== +==== templateInsideCallback.js (9 errors) ==== /** * @typedef Oops * @template T @@ -15,6 +19,8 @@ templateInsideCallback.js(37,5): error TS7012: This overload implicitly returns /** * @callback Call * @template T + ~~~~~~~~ +!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @param {T} x * @returns {T} */ @@ -35,6 +41,8 @@ templateInsideCallback.js(37,5): error TS7012: This overload implicitly returns * @property {Object} oh * @property {number} oh.no * @template T + ~~~~~~~~ +!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @property {string} oh.noooooo */ @@ -44,6 +52,8 @@ templateInsideCallback.js(37,5): error TS7012: This overload implicitly returns ~~~~~~~~ !!! error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. * @template T + ~~~~~~~~ +!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @template U * @param {T[]} array * @param {(x: T) => U[]} iterable @@ -54,6 +64,8 @@ templateInsideCallback.js(37,5): error TS7012: This overload implicitly returns ~~~~~~~~ !!! error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. * @template T + ~~~~~~~~ +!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @param {T[][]} array * @returns {T[]} */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefDuplicateTypeDeclaration.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefDuplicateTypeDeclaration.errors.txt new file mode 100644 index 0000000000..9dd2576068 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefDuplicateTypeDeclaration.errors.txt @@ -0,0 +1,13 @@ +typedefDuplicateTypeDeclaration.js(4,16): error TS8033: A JSDoc '@typedef' comment may not contain multiple '@type' tags. + + +==== typedefDuplicateTypeDeclaration.js (1 errors) ==== + /** + * @typedef Name + * @type {string} + * @type {Oops} + + */ + +!!! error TS8033: A JSDoc '@typedef' comment may not contain multiple '@type' tags. +!!! related TS8034 typedefDuplicateTypeDeclaration.js:1:1: The tag was first specified here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.errors.txt new file mode 100644 index 0000000000..2aa319ce1c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.errors.txt @@ -0,0 +1,19 @@ +bug25104.js(3,19): error TS1005: '}' expected. +bug25104.js(6,18): error TS1005: '}' expected. + + +==== bug25104.js (2 errors) ==== + class C { + /** + * @typedef {C~A} C~B + ~ +!!! error TS1005: '}' expected. + * @typedef {object} C~A + */ + /** @param {C~A} o */ + ~ +!!! error TS1005: '}' expected. + constructor(o) { + } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt index 6b2506e05c..80e1108585 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt @@ -1,17 +1,24 @@ mod1.js(2,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +mod1.js(2,22): error TS1005: '}' expected. 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(4,22): error TS1005: '}' expected. 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(4,22): error TS1005: '}' expected. mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. +mod7.js(5,7): error TS1110: Type expected. +mod7.js(8,4): error TS1110: Type expected. -==== mod1.js (2 errors) ==== +==== mod1.js (3 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. + ~ +!!! error TS1005: '}' expected. * Type1 */ @@ -46,7 +53,7 @@ mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. return obj.boo ? obj.num : obj.str; } -==== mod3.js (2 errors) ==== +==== mod3.js (3 errors) ==== /** * A function whose signature is very long. * @@ -54,6 +61,8 @@ mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. * (string|number)} StringOrNumber1 */ @@ -71,7 +80,7 @@ mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. return func(bool, str, num) } -==== mod4.js (2 errors) ==== +==== mod4.js (3 errors) ==== /** * A function whose signature is very long. * @@ -79,6 +88,8 @@ mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. * number): * (string|number)} StringOrNumber2 */ @@ -138,14 +149,18 @@ mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. } -==== mod7.js (0 errors) ==== +==== mod7.js (2 errors) ==== /** Multiline type expressions in comments without leading * are not supported. @typedef {{ foo: *, + ~ +!!! error TS1110: Type expected. bar: * }} Type7 + ~ +!!! error TS1110: Type expected. */ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.errors.txt.diff index aa131e44ee..8c877aa4f3 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.errors.txt.diff @@ -2,6 +2,7 @@ +++ new.jsEnumCrossFileExport.errors.txt @@= skipped -0, +0 lines =@@ - ++enumDef.js(14,21): error TS1003: Identifier expected. +enumDef.js(16,18): error TS2339: Property 'Blah' does not exist on type '{ Action: { WindowDocked: number; WindowUndocked: number; ScriptsBreakpointSet: number; TimelineStarted: number; }; }'. +index.js(4,17): error TS2503: Cannot find namespace 'Host'. +index.js(8,21): error TS2304: Cannot find name 'Host'. @@ -9,7 +10,7 @@ +index.js(18,11): error TS2503: Cannot find namespace 'Host'. + + -+==== enumDef.js (1 errors) ==== ++==== enumDef.js (2 errors) ==== + var Host = {}; + Host.UserMetrics = {}; + /** @enum {number} */ @@ -24,7 +25,10 @@ + */ + /** + * @typedef {string} ++ + */ ++ ++!!! error TS1003: Identifier expected. + Host.UserMetrics.Blah = { + ~~~~ +!!! error TS2339: Property 'Blah' does not exist on type '{ Action: { WindowDocked: number; WindowUndocked: number; ScriptsBreakpointSet: number; TimelineStarted: number; }; }'. diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.errors.txt.diff deleted file mode 100644 index 240506dd0b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.jsdocFunctionTypeFalsePositive.errors.txt -+++ new.jsdocFunctionTypeFalsePositive.errors.txt -@@= 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) ==== -+ -+ -+==== /a.js (1 errors) ==== - /** @param {<} x */ - ~~ - !!! error TS1098: Type parameter list cannot be empty. -- ~ --!!! error TS1139: Type parameter declaration expected. - function f(x) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff index d1fab64b56..fbc195cf2e 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff @@ -8,9 +8,10 @@ - -==== example.js (3 errors) ==== +example.js(3,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++example.js(3,19): error TS1005: '}' expected. + + -+==== example.js (1 errors) ==== ++==== example.js (2 errors) ==== // @ts-check /** * @type {function(@foo)} @@ -23,5 +24,7 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. */ let x; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/uniqueSymbolJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/uniqueSymbolJs.errors.txt.diff index e97c2ce80f..9372405a69 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/uniqueSymbolJs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/uniqueSymbolJs.errors.txt.diff @@ -2,20 +2,23 @@ +++ new.uniqueSymbolJs.errors.txt @@= skipped -0, +0 lines =@@ -a.js(5,18): error TS1337: An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead. --a.js(5,28): error TS1005: ';' expected. +a.js(5,18): error TS1268: An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type. +a.js(5,23): error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? + a.js(5,28): error TS1005: ';' expected. - ==== a.js (2 errors) ==== -@@= skipped -8, +8 lines =@@ +-==== a.js (2 errors) ==== ++==== a.js (3 errors) ==== + /** @type {unique symbol} */ + const foo = Symbol(); + /** @typedef {{ [foo]: boolean }} A */ /** @typedef {{ [key: foo] boolean }} B */ ~~~ -!!! error TS1337: An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead. -- ~~~~~~~ --!!! error TS1005: ';' expected. +!!! error TS1268: An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type. + ~~~ +!!! error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? + ~~~~~~~ + !!! error TS1005: ';' expected. \ No newline at end of file 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 ec3ffa5a3a..49320a3a4a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.errors.txt.diff @@ -13,18 +13,25 @@ - -==== file.js (7 errors) ==== +file.js(2,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(2,20): error TS1005: '}' expected. +file.js(6,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(6,20): error TS1005: '}' expected. +file.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(10,20): error TS1005: '}' expected. +file.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(16,20): error TS1005: '}' expected. +file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(21,20): error TS1005: '}' expected. + + -+==== file.js (5 errors) ==== ++==== file.js (10 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. ++ ~ ++!!! error TS1005: '}' expected. const a = () => 0 - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. @@ -36,6 +43,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const b = async () => 0 - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. @@ -47,6 +56,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const c = async () => { return 0 - ~~~~~~ @@ -60,6 +71,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const d = async () => { return "" } @@ -68,6 +81,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const f = (p) => {} // Error (good) diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.errors.txt.diff index 85c8c13099..5bf5bbfd0b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.errors.txt.diff @@ -1,30 +1,29 @@ --- old.checkJsdocSatisfiesTag14.errors.txt +++ new.checkJsdocSatisfiesTag14.errors.txt @@= skipped -0, +0 lines =@@ --/a.js(7,15): error TS1005: '{' expected. + /a.js(7,15): error TS1005: '{' expected. -/a.js(8,2): error TS1005: '}' expected. --/a.js(10,27): error TS1005: '{' expected. + /a.js(10,27): error TS1005: '{' expected. -/a.js(10,30): error TS1005: '}' expected. - - -==== /a.js (4 errors) ==== -- /** -- * @typedef {Object} T1 -- * @property {number} a -- */ -- -- /** -- * @satisfies T1 -- ~~ --!!! error TS1005: '{' expected. -- */ ++ ++ ++==== /a.js (2 errors) ==== + /** + * @typedef {Object} T1 + * @property {number} a +@@= skipped -14, +12 lines =@@ + ~~ + !!! error TS1005: '{' expected. + */ - -!!! error TS1005: '}' expected. -- const t1 = { a: 1 }; -- const t2 = /** @satisfies T1 */ ({ a: 1 }); -- ~~ --!!! error TS1005: '{' expected. + const t1 = { a: 1 }; + const t2 = /** @satisfies T1 */ ({ a: 1 }); + ~~ + !!! error TS1005: '{' expected. - -!!! error TS1005: '}' expected. -- -+ \ No newline at end of file + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff index 886d602488..684c5b6009 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff @@ -5,17 +5,29 @@ - - -==== 0.js (1 errors) ==== ++0.js(12,13): error TS1110: Type expected. +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(24,21): error TS1005: '}' expected. +0.js(28,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(28,21): error TS1005: '}' expected. +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) ==== ++==== 0.js (7 errors) ==== // @ts-check /** @type {String} */ var S = "hello world"; -@@= skipped -21, +24 lines =@@ +@@= skipped -13, +19 lines =@@ + anyT = "hello"; + + /** @type {?} */ ++ ~ ++!!! error TS1110: Type expected. + var anyT1 = 2; + anyT1 = "hi"; + +@@= skipped -8, +10 lines =@@ x(1); /** @type {function} */ @@ -31,6 +43,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const x1 = (a) => a + 1; x1(0); @@ -38,10 +52,12 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const x2 = (a) => a + 1; x2(0); -@@= skipped -22, +29 lines =@@ +@@= skipped -22, +33 lines =@@ * @type {Object} */ var props = {}; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.errors.txt.diff index 6b72170b6d..6665582b86 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.errors.txt.diff @@ -13,12 +13,16 @@ - -==== 0.js (7 errors) ==== +0.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(8,21): error TS1005: '}' expected. +0.js(12,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(12,21): error TS1005: '}' expected. +0.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(19,21): error TS1005: '}' expected. +0.js(23,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(23,21): error TS1005: '}' expected. + + -+==== 0.js (6 errors) ==== ++==== 0.js (10 errors) ==== // @ts-check /** @type {String} */ var S = true; @@ -28,7 +32,7 @@ /** @type {number} */ var n = "hello"; -@@= skipped -19, +18 lines =@@ +@@= skipped -19, +22 lines =@@ !!! error TS2322: Type 'string' is not assignable to type 'number'. /** @type {function (number)} */ @@ -37,6 +41,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const x1 = (a) => a + 1; x1("string"); - ~~~~~~~~ @@ -46,6 +52,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const x2 = (a) => a + 1; /** @type {string} */ @@ -58,6 +66,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const x3 = (a) => a.concat("hi"); - ~~~~~~ -!!! error TS2339: Property 'concat' does not exist on type 'number'. @@ -67,6 +77,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const x4 = (a) => a + 1; - ~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff index 4df7dcb221..763732c109 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff @@ -4,10 +4,12 @@ - +0.js(8,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(8,14): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++0.js(8,22): error TS1005: '}' expected. +0.js(16,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(16,22): error TS1005: '}' expected. + + -+==== 0.js (3 errors) ==== ++==== 0.js (5 errors) ==== + // @ts-check + var lol = "hello Lol" + const obj = { @@ -21,6 +23,8 @@ +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~~~~~~~~ +!!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++ ~ ++!!! error TS1005: '}' expected. + method1(n1) { + return n1 + 42; + }, @@ -32,6 +36,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. + arrowFunc: (num) => num + 42 + } + obj.foo = 'string' diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff index e6472b5cf2..65a1df20cd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff @@ -9,20 +9,17 @@ -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 (8 errors) ==== +0.js(6,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(6,14): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++0.js(6,22): error TS1005: '}' expected. +0.js(10,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(10,22): error TS1005: '}' expected. +0.js(12,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+ -+ -+==== 0.js (5 errors) ==== - // @ts-check - var lol; - const obj = { -@@= skipped -16, +13 lines =@@ ++0.js(12,22): error TS1005: '}' expected. + + + ==== 0.js (8 errors) ==== +@@= skipped -16, +16 lines =@@ ~~~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. /** @type {function(number): number} */ @@ -31,6 +28,8 @@ +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~~~~~~~~ +!!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++ ~ ++!!! error TS1005: '}' expected. method1(n1) { return "42"; - ~~~~~~ @@ -40,6 +39,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. method2: (n1) => "lol", - ~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. @@ -47,6 +48,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. arrowFunc: (num="0") => num + 42, - ~~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff index cfb3d23d1b..60fa860711 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff @@ -6,11 +6,12 @@ - -==== 0.js (1 errors) ==== +0.js(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. ++0.js(6,21): error TS1003: Identifier expected. +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 (4 errors) ==== // @ts-check var exports = {}; @@ -19,7 +20,10 @@ /** * @typedef {string} ++ */ ++ ++!!! error TS1003: Identifier expected. exports.SomeName; + ~~~~~~~~ +!!! error TS2339: Property 'SomeName' does not exist on type '{}'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importDeferJsdoc.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importDeferJsdoc.errors.txt.diff index 36ba74556a..07493724d2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importDeferJsdoc.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importDeferJsdoc.errors.txt.diff @@ -1,17 +1,20 @@ --- old.importDeferJsdoc.errors.txt +++ new.importDeferJsdoc.errors.txt @@= skipped -0, +0 lines =@@ --/foo.js(2,18): error TS1005: 'from' expected. + /foo.js(2,18): error TS1005: 'from' expected. +/foo.js(2,18): error TS1141: String literal expected. /foo.js(6,12): error TS2503: Cannot find namespace 'ns'. -@@= skipped -7, +7 lines =@@ - ==== /foo.js (2 errors) ==== + ==== /types.ts (0 errors) ==== + export type X = 1; + +-==== /foo.js (2 errors) ==== ++==== /foo.js (3 errors) ==== /** * @import defer * as ns from "./types" -- ~ --!!! error TS1005: 'from' expected. + ~ + !!! error TS1005: 'from' expected. + ~~~~ +!!! error TS1141: String literal expected. */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag10.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag10.errors.txt.diff deleted file mode 100644 index c90b25d031..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag10.errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.importTag10.errors.txt -+++ new.importTag10.errors.txt -@@= skipped -0, +0 lines =@@ --/foo.js(2,11): error TS1109: Expression expected. -- -- --==== /foo.js (1 errors) ==== -- /** -- * @import -- -- */ -- --!!! error TS1109: Expression expected. -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag11.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag11.errors.txt.diff index 1d60c189e9..545f442e45 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag11.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag11.errors.txt.diff @@ -2,16 +2,15 @@ +++ new.importTag11.errors.txt @@= skipped -0, +0 lines =@@ -/foo.js(2,15): error TS1109: Expression expected. --/foo.js(3,2): error TS1005: 'from' expected. -- -- + /foo.js(3,2): error TS1005: 'from' expected. + + -==== /foo.js (2 errors) ==== -- /** -- * @import foo ++==== /foo.js (1 errors) ==== + /** + * @import foo - -!!! error TS1109: Expression expected. -- */ -- --!!! error TS1005: 'from' expected. -- -+ \ No newline at end of file + */ + + !!! error TS1005: 'from' expected. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag12.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag12.errors.txt.diff index 3bcbbcf079..afbde6e8d6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag12.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag12.errors.txt.diff @@ -2,13 +2,15 @@ +++ new.importTag12.errors.txt @@= skipped -0, +0 lines =@@ -/foo.js(2,20): error TS1109: Expression expected. -- -- --==== /foo.js (1 errors) ==== -- /** -- * @import foo from ++/foo.js(3,2): error TS1109: Expression expected. + + + ==== /foo.js (1 errors) ==== + /** + * @import foo from - -!!! error TS1109: Expression expected. -- */ -- -+ \ No newline at end of file + */ ++ ++!!! error TS1109: Expression expected. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag13.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag13.errors.txt.diff index a55a49f933..55cd457a99 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag13.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag13.errors.txt.diff @@ -1,14 +1,17 @@ --- old.importTag13.errors.txt +++ new.importTag13.errors.txt @@= skipped -0, +0 lines =@@ --/foo.js(1,15): error TS1005: 'from' expected. + /foo.js(1,15): error TS1005: 'from' expected. +- +- +-==== /foo.js (1 errors) ==== +/foo.js(1,15): error TS1141: String literal expected. - - - ==== /foo.js (1 errors) ==== ++ ++ ++==== /foo.js (2 errors) ==== /** @import x = require("types") */ -- ~ --!!! error TS1005: 'from' expected. + ~ + !!! error TS1005: 'from' expected. + ~~~~~~~~~~~~~~~~~~ +!!! error TS1141: String literal expected. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag14.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag14.errors.txt.diff index 06e93a4fb5..7f62149103 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag14.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag14.errors.txt.diff @@ -4,17 +4,14 @@ +/foo.js(1,25): error TS2306: File '/foo.js' is not a module. /foo.js(1,33): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /foo.js(1,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. --/foo.js(1,38): error TS1005: '{' expected. + /foo.js(1,38): error TS1005: '{' expected. - ==== /foo.js (3 errors) ==== +-==== /foo.js (3 errors) ==== ++==== /foo.js (4 errors) ==== /** @import * as f from "./foo" with */ + ~~~~~~~ +!!! error TS2306: File '/foo.js' is not a module. ~~~~ !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - ~~~~ - !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -- --!!! error TS1005: '{' expected. - \ No newline at end of file + ~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff index 6344763693..44818fe741 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff @@ -3,9 +3,10 @@ @@= skipped -0, +0 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(9,17): error TS1005: '}' expected. + + -+==== index.js (1 errors) ==== ++==== index.js (2 errors) ==== + /** + * @module A + */ @@ -17,6 +18,8 @@ + * @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`. ++ ~ ++!!! error TS1005: '}' expected. + */ + export let el = null; + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt.diff new file mode 100644 index 0000000000..77f79eb7c4 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt.diff @@ -0,0 +1,17 @@ +--- old.jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt ++++ new.jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt +@@= skipped -0, +0 lines =@@ +- ++bug38550.js(3,22): error TS1005: '}' expected. ++ ++ ++==== bug38550.js (1 errors) ==== ++ export class Clazz { ++ /** ++ * @param {function(this:Object, ...*):*} functionDeclaration ++ ~ ++!!! error TS1005: '}' expected. ++ */ ++ method(functionDeclaration) {} ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff index 23875f11d5..b84e9f3807 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff @@ -2,13 +2,18 @@ +++ new.jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt @@= skipped -0, +0 lines =@@ - ++index.js(1,13): error TS1110: Type expected. +index.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++index.js(16,20): error TS1005: '}' expected. +index.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++index.js(19,20): error TS1005: '}' expected. +index.js(22,12): error TS2315: Type 'Object' is not generic. + + -+==== index.js (3 errors) ==== ++==== index.js (6 errors) ==== + /** @type {?} */ ++ ~ ++!!! error TS1110: Type expected. + export const a = null; + + /** @type {*} */ @@ -27,12 +32,16 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. + 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. ++ ~ ++!!! error TS1005: '}' expected. + export const g = null; + + /** @type {Object.} */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugmentsMissingType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugmentsMissingType.errors.txt.diff index 0d8dfe2f9e..bc605dfad5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugmentsMissingType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugmentsMissingType.errors.txt.diff @@ -7,15 +7,18 @@ - - -==== /a.js (3 errors) ==== ++/a.js(2,14): error TS1003: Identifier expected. + + -+==== /a.js (1 errors) ==== ++==== /a.js (2 errors) ==== class A { constructor() { this.x = 0; } } /** @augments */ -!!! error TS1003: Identifier expected. - !!! error TS8023: JSDoc '@augments ' does not match the 'extends A' clause. ++ ~ ++!!! error TS1003: Identifier expected. class B extends A { m() { this.x diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.errors.txt.diff index 899510ffa9..aa905126e8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.errors.txt.diff @@ -6,25 +6,35 @@ - - -==== functions.js (1 errors) ==== ++functions.js(2,20): error TS1005: '}' expected. +functions.js(3,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++functions.js(3,21): error TS1005: '}' expected. +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(12,20): error TS1005: '}' expected. +functions.js(13,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++functions.js(13,21): error TS1005: '}' expected. +functions.js(15,14): error TS7006: Parameter 'c' implicitly has an 'any' type. +functions.js(30,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++functions.js(30,21): error TS1005: '}' expected. +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(48,20): error TS1005: '}' expected. +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 (10 errors) ==== ++==== functions.js (16 errors) ==== /** * @param {function(this: string, number): number} c is just passing on through ++ ~ ++!!! error TS1005: '}' expected. * @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. ++ ~ ++!!! error TS1005: '}' expected. */ function id1(c) { + ~ @@ -38,10 +48,14 @@ /** * @param {function(new: { length: number }, number): number} c is just passing on through ++ ~ ++!!! error TS1005: '}' expected. * @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. ++ ~ ++!!! error TS1005: '}' expected. */ function id2(c) { + ~ @@ -49,13 +63,15 @@ return c } -@@= skipped -32, +52 lines =@@ +@@= skipped -32, +66 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. ++ ~ ++!!! error TS1005: '}' expected. var f = function (ab, onetwo) { return ab === "a" ? 3 : 4; } + ~~ +!!! error TS7006: Parameter 'ab' implicitly has an 'any' type. @@ -64,9 +80,12 @@ /** -@@= skipped -19, +26 lines =@@ +@@= skipped -18, +27 lines =@@ + /** * @param {function(new: D, number)} dref ++ ~ ++!!! error TS1005: '}' expected. * @return {D} + ~ +!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? @@ -77,7 +96,7 @@ var z3 = construct(D); z3.length; -@@= skipped -16, +20 lines =@@ +@@= skipped -17, +23 lines =@@ var y3 = id2(E); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunction_missingReturn.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunction_missingReturn.errors.txt.diff index 2a4513ad36..4f926c210b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunction_missingReturn.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunction_missingReturn.errors.txt.diff @@ -7,9 +7,10 @@ -==== /a.js (1 errors) ==== +/a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +/a.js(1,12): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++/a.js(1,20): error TS1005: '}' expected. + + -+==== /a.js (2 errors) ==== ++==== /a.js (3 errors) ==== /** @type {function(): number} */ - ~~~~~~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. @@ -18,5 +19,7 @@ +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~~~~~~~~ +!!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++ ~ ++!!! error TS1005: '}' expected. function f() {} \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_missingType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_missingType.errors.txt.diff index 7a27f9d761..9ba145f7a0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_missingType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_missingType.errors.txt.diff @@ -1,15 +1,11 @@ --- old.jsdocImplements_missingType.errors.txt +++ new.jsdocImplements_missingType.errors.txt -@@= skipped -0, +0 lines =@@ --/a.js(2,16): error TS1003: Identifier expected. -- -- --==== /a.js (1 errors) ==== -- class A { constructor() { this.x = 0; } } -- /** @implements */ +@@= skipped -3, +3 lines =@@ + ==== /a.js (1 errors) ==== + class A { constructor() { this.x = 0; } } + /** @implements */ - --!!! error TS1003: Identifier expected. -- class B { -- } -- -+ \ No newline at end of file ++ ~ + !!! error TS1003: Identifier expected. + class B { + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.errors.txt.diff index 241ccbd587..3469144058 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.errors.txt.diff @@ -5,14 +5,14 @@ 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(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(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'. !!! 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 (3 errors) ==== /** @return {T} */ ~ !!! error TS2304: Cannot find name 'T'. @@ -21,8 +21,6 @@ /** @template {T} */ - ~ -!!! error TS2304: Cannot find name 'T'. -- ~ --!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. - const PropertyAccessors = dedupingMixin(() => { - class Bar { - static bar() { this.prototype.foo(); } \ No newline at end of file + ~ + !!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. + const PropertyAccessors = dedupingMixin(() => { \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters3.errors.txt.diff index 4622725904..7832110098 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters3.errors.txt.diff @@ -4,19 +4,17 @@ error TS5055: Cannot write file 'jsdocOuterTypeParameters3.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. -jsdocOuterTypeParameters3.js(1,16): error TS2304: Cannot find name 'T'. --jsdocOuterTypeParameters3.js(1,18): error TS1069: Unexpected token. A type parameter name was expected without curly braces. + jsdocOuterTypeParameters3.js(1,18): error TS1069: Unexpected token. A type parameter name was expected without curly braces. jsdocOuterTypeParameters3.js(5,43): error TS2339: Property 'foo' does not exist on type 'Bar'. !!! error TS5055: Cannot write file 'jsdocOuterTypeParameters3.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. -==== jsdocOuterTypeParameters3.js (3 errors) ==== -+==== jsdocOuterTypeParameters3.js (1 errors) ==== ++==== jsdocOuterTypeParameters3.js (2 errors) ==== /** @template {T} */ - ~ -!!! error TS2304: Cannot find name 'T'. -- ~ --!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. - class Baz { - m() { - class Bar { \ No newline at end of file + ~ + !!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. + class Baz { \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt.diff index 0bed525624..2f955bae63 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt.diff @@ -5,15 +5,19 @@ - - -==== a.js (1 errors) ==== ++a.js(2,21): error TS1005: '}' expected. +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(8,20): error TS1005: '}' expected. + + -+==== a.js (2 errors) ==== ++==== a.js (4 errors) ==== // from bcryptjs /** @param {function(...[*])} callback */ - ~~~~~~~~~~~~~~~~ -!!! error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. ++ ~ ++!!! error TS1005: '}' expected. function g(callback) { + ~~~~~~~~ +!!! error TS7006: Parameter 'callback' implicitly has an 'any' type. @@ -25,6 +29,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. * @inner */ var stringFromCharCode = String.fromCharCode; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.errors.txt.diff index 0b43e0d1a6..4017c73d0a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.errors.txt.diff @@ -3,15 +3,18 @@ @@= skipped -0, +0 lines =@@ - +paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++paren.js(1,20): error TS1005: '}' expected. +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 (4 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. ++ ~ ++!!! error TS1005: '}' expected. + var x = (s, id) => id(s) + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff index a6dd8192ea..51c92a19c6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff @@ -3,14 +3,17 @@ @@= skipped -0, +0 lines =@@ - +paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++paren.js(1,20): error TS1005: '}' expected. +paren.js(2,9): error TS7006: Parameter 's' implicitly has an 'any' type. + + -+==== paren.js (2 errors) ==== ++==== paren.js (3 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. ++ ~ ++!!! error TS1005: '}' expected. + var x = s => s.toString() + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.errors.txt.diff index 76fc71ede2..8f3df4dfb4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.errors.txt.diff @@ -4,10 +4,11 @@ - +a.js(1,5): error TS1047: A rest parameter cannot be optional. +a.js(3,12): error TS2370: A rest parameter must be of an array type. ++a.js(11,21): error TS1005: '}' expected. +a.js(12,14): error TS7006: Parameter 'f' implicitly has an 'any' type. + + -+==== a.js (3 errors) ==== ++==== a.js (4 errors) ==== + /** @param {...*=} args + ~~~~~~~~~~~~~~~~~~~ + @return {*=} */ @@ -24,6 +25,8 @@ + + + /** @param {function():*=} f */ ++ ~ ++!!! error TS1005: '}' expected. + function cbf(f) { + ~ +!!! error TS7006: Parameter 'f' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrefixPostfixParsing.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrefixPostfixParsing.errors.txt.diff index cd4ecc1839..309d3d89d4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrefixPostfixParsing.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrefixPostfixParsing.errors.txt.diff @@ -2,23 +2,23 @@ +++ new.jsdocPrefixPostfixParsing.errors.txt @@= skipped -0, +0 lines =@@ -prefixPostfix.js(5,18): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. --prefixPostfix.js(5,18): error TS1005: '}' expected. + prefixPostfix.js(5,18): error TS1005: '}' expected. -prefixPostfix.js(8,12): error TS1014: A rest parameter must be last in a parameter list. -prefixPostfix.js(9,12): error TS1014: A rest parameter must be last in a parameter list. -prefixPostfix.js(10,12): error TS1014: A rest parameter must be last in a parameter list. -prefixPostfix.js(11,21): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. --prefixPostfix.js(11,21): error TS1005: '}' expected. + prefixPostfix.js(11,21): error TS1005: '}' expected. -prefixPostfix.js(12,12): error TS1014: A rest parameter must be last in a parameter list. -prefixPostfix.js(13,12): error TS1014: A rest parameter must be last in a parameter list. -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(14,21): error TS1005: '}' expected. prefixPostfix.js(18,21): error TS7006: Parameter 'a' implicitly has an 'any' type. prefixPostfix.js(18,39): error TS7006: Parameter 'h' implicitly has an 'any' type. prefixPostfix.js(18,48): error TS7006: Parameter 'k' implicitly has an 'any' type. -==== prefixPostfix.js (14 errors) ==== -+==== prefixPostfix.js (3 errors) ==== ++==== prefixPostfix.js (6 errors) ==== /** * @param {number![]} x - number[] * @param {!number[]} y - number[] @@ -26,8 +26,8 @@ * @param {number?[]} a - parse error without parentheses - -!!! error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. -- ~ --!!! error TS1005: '}' expected. + ~ + !!! error TS1005: '}' expected. * @param {?number[]} b - number[] | null * @param {(number[])?} c - number[] | null * @param {...?number} e - (number | null)[] @@ -42,8 +42,8 @@ * @param {...number?!} h - parse error without parentheses (also nonsensical) - -!!! error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. -- ~ --!!! error TS1005: '}' expected. + ~ + !!! error TS1005: '}' expected. * @param {...number[]} i - number[][] - ~~~~~~~~~~~ -!!! error TS1014: A rest parameter must be last in a parameter list. @@ -53,8 +53,6 @@ * @param {...number?[]!} k - parse error without parentheses - -!!! error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. -- ~ --!!! error TS1005: '}' expected. - * @param {number extends number ? true : false} l - conditional types work - * @param {[number, number?]} m - [number, (number | undefined)?] - */ \ No newline at end of file + ~ + !!! error TS1005: '}' expected. + * @param {number extends number ? true : false} l - conditional types work \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName2.errors.txt.diff index 01d7e10957..feb3c736b8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName2.errors.txt.diff @@ -1,18 +1,11 @@ --- old.jsdocPrivateName2.errors.txt +++ new.jsdocPrivateName2.errors.txt -@@= skipped -0, +0 lines =@@ --jsdocPrivateName1.js(6,23): error TS1003: Identifier expected. -- -- --==== jsdocPrivateName1.js (1 errors) ==== -- // Expecting parse error for private field -- -- /** -- * @typedef A -- * @type {object} -- * @property {string} #id +@@= skipped -7, +7 lines =@@ + * @typedef A + * @type {object} + * @property {string} #id - --!!! error TS1003: Identifier expected. -- */ -- -+ \ No newline at end of file ++ ~ + !!! error TS1003: Identifier expected. + */ + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.errors.txt.diff index 716047469c..bd9d4ecccb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.errors.txt.diff @@ -3,26 +3,29 @@ @@= 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(13,22): error TS1005: '}' expected. +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 (3 errors) ==== /** * @param {T} a * @template T -@@= skipped -15, +16 lines =@@ +@@= skipped -15, +17 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. ++ ~ ++!!! error TS1005: '}' expected. */ function g(a) { return () => a -@@= skipped -11, +14 lines =@@ +@@= skipped -11, +16 lines =@@ */ Element.prototype.animate = function(keyframes) {}; ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.errors.txt.diff index a30dd9f14c..d7bb83cb38 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.errors.txt.diff @@ -6,18 +6,16 @@ -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 (5 errors) ==== +a.js(21,3): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -+ -+ -+==== a.js (3 errors) ==== + a.js(25,2): error TS1069: Unexpected token. A type parameter name was expected without curly braces. + + +-==== a.js (5 errors) ==== ++==== a.js (4 errors) ==== /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? -@@= skipped -32, +29 lines =@@ +@@= skipped -32, +30 lines =@@ f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); f({ a: 12 }, undefined, undefined, 101, 'nope'); ~~~~~~~~~~ @@ -31,8 +29,5 @@ - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'NoLongerAllowed'. * @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) { } \ No newline at end of file + ~ + !!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff deleted file mode 100644 index 31ea3f1da6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.jsdocTemplateTagDefault.errors.txt -+++ new.jsdocTemplateTagDefault.errors.txt -@@= skipped -0, +0 lines =@@ - file.js(9,20): error TS2322: Type 'number' is not assignable to type 'string'. --file.js(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(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 (7 errors) ==== -+==== file.js (5 errors) ==== - /** - * @template {string | number} [T=string] - ok: defaults are permitted - * @typedef {[T]} 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` -- ~ --!!! error TS1110: Type expected. - * @typedef {[T]} D - */ - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.errors.txt.diff index 9c0639589d..2543da1a5c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.errors.txt.diff @@ -7,17 +7,19 @@ -/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'? ++/a.js(21,20): error TS1005: '}' expected. +/a.js(26,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +/a.js(26,12): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++/a.js(26,20): error TS1005: '}' expected. ==== /types.d.ts (0 errors) ==== -@@= skipped -11, +12 lines =@@ +@@= skipped -11, +14 lines =@@ export type M = (this: Foo) => void; -==== /a.js (6 errors) ==== -+==== /a.js (7 errors) ==== ++==== /a.js (9 errors) ==== /** @type {import('./types').M} */ export const f1 = function() { this.test(); @@ -28,6 +30,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. export const f5 = function() { this.test(); - ~~~~ @@ -40,6 +44,8 @@ +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~~~~~~~~ +!!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++ ~ ++!!! error TS1005: '}' expected. export function f6() { this.test(); - ~~~~ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.errors.txt.diff index d787b3e33e..5af503e217 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.errors.txt.diff @@ -3,16 +3,19 @@ @@= skipped -0, +0 lines =@@ -a.js(3,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(1,20): error TS1005: '}' expected. +a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. a.js(7,5): error TS2322: Type 'number' is not assignable to type 'string'. -==== a.js (2 errors) ==== -+==== a.js (3 errors) ==== ++==== a.js (4 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. ++ ~ ++!!! error TS1005: '}' expected. const f = (value) => { + ~~~~~ +!!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff index 75b452f94e..efc34c532f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff @@ -3,24 +3,27 @@ @@= 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(1,20): error TS1005: '}' expected. +a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. 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 (3 errors) ==== -+==== a.js (4 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. ++ ~ ++!!! error TS1005: '}' expected. const f = (value) => { + ~~~~~ +!!! error TS7006: Parameter 'value' implicitly has an 'any' type. }; /** @type {(s: string) => void} */ function g(s) { -@@= skipped -14, +20 lines =@@ +@@= skipped -14, +23 lines =@@ } f() // should error diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.errors.txt.diff index a79f41e4ea..6ce480620b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.errors.txt.diff @@ -3,14 +3,17 @@ @@= skipped -0, +0 lines =@@ - +a.js(2,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++a.js(2,19): error TS1005: '}' expected. + + -+==== a.js (1 errors) ==== ++==== a.js (2 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. ++ ~ ++!!! error TS1005: '}' expected. + */ + const foo = function (a, b, ...r) { }; + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.errors.txt.diff index 5e9e331de6..b9fb76f3f4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.errors.txt.diff @@ -2,14 +2,17 @@ +++ 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(1,21): error TS1005: '}' expected. bug26693.js(2,22): error TS2307: Cannot find module 'nope' or its corresponding type declarations. -==== bug26693.js (1 errors) ==== -+==== bug26693.js (2 errors) ==== ++==== bug26693.js (3 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`. ++ ~ ++!!! error TS1005: '}' expected. import { nope } from 'nope'; ~~~~~~ !!! error TS2307: Cannot find module 'nope' or its corresponding type declarations. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagWrapping.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagWrapping.errors.txt.diff index c7b1b74daa..0e7b04a15c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagWrapping.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagWrapping.errors.txt.diff @@ -1,34 +1,37 @@ --- old.paramTagWrapping.errors.txt +++ new.paramTagWrapping.errors.txt @@= skipped -0, +0 lines =@@ --bad.js(2,11): error TS1003: Identifier expected. --bad.js(5,4): error TS1003: Identifier expected. + bad.js(2,11): error TS1003: Identifier expected. + bad.js(5,4): error TS1003: Identifier expected. -bad.js(5,4): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. --bad.js(6,20): error TS1003: Identifier expected. + bad.js(6,20): error TS1003: Identifier expected. -bad.js(6,20): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. 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. -@@= skipped -22, +17 lines =@@ +@@= skipped -22, +20 lines =@@ good(1, 2, 3) -==== bad.js (8 errors) ==== -+==== bad.js (3 errors) ==== ++==== bad.js (6 errors) ==== /** * @param * - --!!! error TS1003: Identifier expected. ++ ~ + !!! error TS1003: Identifier expected. * {number} x Arg x. * @param {number} * * y Arg y. - --!!! error TS1003: Identifier expected. ++ ~ + !!! error TS1003: Identifier expected. - -!!! error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. * @param {number} * z - --!!! error TS1003: Identifier expected. ++ ~ + !!! error TS1003: Identifier expected. - -!!! error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. * Arg z. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.errors.txt.diff index 2164c25069..c8db475455 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.errors.txt.diff @@ -3,16 +3,18 @@ @@= skipped -0, +0 lines =@@ -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! -templateInsideCallback.js(2,13): error TS8021: JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags. --templateInsideCallback.js(9,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag + 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,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 + templateInsideCallback.js(23,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag ++templateInsideCallback.js(29,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. + templateInsideCallback.js(30,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -templateInsideCallback.js(32,12): error TS2304: Cannot find name 'T'. -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(37,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. + 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'. - - @@ -21,11 +23,9 @@ -!!! 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(29,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. -+templateInsideCallback.js(37,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. + + -+==== templateInsideCallback.js (5 errors) ==== ++==== templateInsideCallback.js (9 errors) ==== /** * @typedef Oops - ~~~~ @@ -33,19 +33,16 @@ * @template T * @property {T} a * @property {T} b -@@= skipped -27, +14 lines =@@ - /** - * @callback Call - * @template T -- ~~~~~~~~ --!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag +@@= skipped -30, +21 lines =@@ + ~~~~~~~~ + !!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. * @returns {T} */ /** -@@= skipped -12, +8 lines =@@ +@@= skipped -9, +7 lines =@@ * @type {Call} ~~~~~~~ !!! error TS2315: Type 'Call' is not generic. @@ -54,23 +51,15 @@ */ const identity = x => x; ~ -@@= skipped -10, +12 lines =@@ - * @property {Object} oh - * @property {number} oh.no - * @template T -- ~~~~~~~~ --!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag - * @property {string} oh.noooooo - */ - +@@= skipped -18, +20 lines =@@ /** * @overload -- * @template T - ~~~~~~~~ --!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag ++ ~~~~~~~~ +!!! error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. -+ * @template T + * @template T + ~~~~~~~~ + !!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @template U * @param {T[]} array - ~ @@ -82,11 +71,11 @@ */ /** * @overload -- * @template T - ~~~~~~~~ --!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag ++ ~~~~~~~~ +!!! error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. -+ * @template T + * @template T + ~~~~~~~~ + !!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @param {T[][]} array - ~ -!!! error TS2304: Cannot find name 'T'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefDuplicateTypeDeclaration.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefDuplicateTypeDeclaration.errors.txt.diff deleted file mode 100644 index eb4c54bdd8..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefDuplicateTypeDeclaration.errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.typedefDuplicateTypeDeclaration.errors.txt -+++ new.typedefDuplicateTypeDeclaration.errors.txt -@@= skipped -0, +0 lines =@@ --typedefDuplicateTypeDeclaration.js(4,16): error TS8033: A JSDoc '@typedef' comment may not contain multiple '@type' tags. -- -- --==== typedefDuplicateTypeDeclaration.js (1 errors) ==== -- /** -- * @typedef Name -- * @type {string} -- * @type {Oops} -- -- */ -- --!!! error TS8033: A JSDoc '@typedef' comment may not contain multiple '@type' tags. --!!! related TS8034 typedefDuplicateTypeDeclaration.js:1:1: The tag was first specified here. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.errors.txt.diff index 0cbf38e973..668a3e4dd1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.errors.txt.diff @@ -2,31 +2,28 @@ +++ new.typedefInnerNamepaths.errors.txt @@= skipped -0, +0 lines =@@ -bug25104.js(1,7): error TS2300: Duplicate identifier 'C'. --bug25104.js(3,19): error TS1005: '}' expected. + bug25104.js(3,19): error TS1005: '}' expected. -bug25104.js(4,26): error TS2300: Duplicate identifier 'C'. -bug25104.js(6,18): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. --bug25104.js(6,18): error TS1005: '}' expected. -- -- + bug25104.js(6,18): error TS1005: '}' expected. + + -==== bug25104.js (5 errors) ==== -- class C { ++==== bug25104.js (2 errors) ==== + class C { - ~ -!!! error TS2300: Duplicate identifier 'C'. -- /** -- * @typedef {C~A} C~B -- ~ --!!! error TS1005: '}' expected. -- * @typedef {object} C~A + /** + * @typedef {C~A} C~B + ~ + !!! error TS1005: '}' expected. + * @typedef {object} C~A - ~ -!!! error TS2300: Duplicate identifier 'C'. -- */ -- /** @param {C~A} o */ + */ + /** @param {C~A} o */ - -!!! error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. -- ~ --!!! error TS1005: '}' expected. -- constructor(o) { -- } -- } -- -+ \ No newline at end of file + ~ + !!! error TS1005: '}' expected. + constructor(o) { \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.errors.txt.diff index eaa71cd329..42766d987e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.errors.txt.diff @@ -1,29 +1,32 @@ --- old.typedefTagWrapping.errors.txt +++ new.typedefTagWrapping.errors.txt @@= skipped -0, +0 lines =@@ --mod7.js(5,7): error TS1110: Type expected. --mod7.js(8,4): error TS1110: Type expected. -- -- --==== mod1.js (0 errors) ==== +mod1.js(2,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++mod1.js(2,22): error TS1005: '}' expected. +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(4,22): error TS1005: '}' expected. +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(4,22): error TS1005: '}' expected. +mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. -+ -+ -+==== mod1.js (2 errors) ==== + mod7.js(5,7): error TS1110: Type expected. + mod7.js(8,4): error TS1110: Type expected. + + +-==== mod1.js (0 errors) ==== ++==== mod1.js (3 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. ++ ~ ++!!! error TS1005: '}' expected. * Type1 */ -@@= skipped -11, +18 lines =@@ +@@= skipped -11, +25 lines =@@ * Tries to use a type whose name is on a different * line than the typedef tag. * @param {Type1} func The function to call. @@ -37,7 +40,7 @@ } -==== mod3.js (0 errors) ==== -+==== mod3.js (2 errors) ==== ++==== mod3.js (3 errors) ==== /** * A function whose signature is very long. * @@ -45,6 +48,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. * (string|number)} StringOrNumber1 */ @@ -56,12 +61,12 @@ * @param {boolean} bool The condition. * @param {string} str The string. * @param {number} num The number. -@@= skipped -20, +25 lines =@@ +@@= skipped -20, +27 lines =@@ return func(bool, str, num) } -==== mod4.js (0 errors) ==== -+==== mod4.js (2 errors) ==== ++==== mod4.js (3 errors) ==== /** * A function whose signature is very long. * @@ -69,10 +74,12 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. * number): * (string|number)} StringOrNumber2 */ -@@= skipped -12, +15 lines =@@ +@@= skipped -12, +17 lines =@@ /** * Makes use of a function type with a long signature. * @param {StringOrNumber2} func The function. @@ -80,24 +87,4 @@ +!!! 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) ==== -+==== mod7.js (0 errors) ==== - /** - Multiline type expressions in comments without leading * are not supported. - @typedef {{ - foo: - *, -- ~ --!!! error TS1110: Type expected. - bar: - * - }} Type7 -- ~ --!!! error TS1110: Type expected. - */ - \ No newline at end of file + * @param {number} num The number. \ No newline at end of file diff --git a/testdata/tests/cases/compiler/invalidJsdocType.ts b/testdata/tests/cases/compiler/invalidJsdocType.ts new file mode 100644 index 0000000000..9697abdb1b --- /dev/null +++ b/testdata/tests/cases/compiler/invalidJsdocType.ts @@ -0,0 +1,6 @@ +// @allowJs: true +// @checkJs: true +// @noEmit: true +// @filename: a.js +/** @type {@import("a").Type} */ +let x; \ No newline at end of file