From 3da85df51130c0e1706a42398da7dc60ade58757 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 22 Nov 2019 14:51:22 -0800 Subject: [PATCH] =?UTF-8?q?Clean=20up=20error=20messages=20for=20using=20T?= =?UTF-8?q?ypeScript=20syntax=20in=20JavaScr=E2=80=A6=20(#35254)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix up quotation marks in error messages in JavaScript files. * Accepted baselines. * Typescript -> TypeScript * Accepted baselines. * Migrate syntactic diagnostics tests to baselining tests. * Accepted baselines. * Update diagnosticMessages.json * Removed markers. * Add ability to baseline both semantic and syntactic diagnostics. * Fix up broken diagnostics when using a server LS. * Accepted baselines. * Lints. * Fake up sourcefile objects in the tsserver session client instead. * Fewer allocations. --- src/compiler/commandLineParser.ts | 2 +- src/compiler/diagnosticMessages.json | 32 ++---- src/compiler/program.ts | 35 +++--- src/harness/client.ts | 8 +- src/harness/fourslash.ts | 65 ++++++++++- .../reference/decoratorInJsFile.errors.txt | 4 +- .../reference/decoratorInJsFile1.errors.txt | 4 +- ...ssingTypeArgsOnJSConstructCalls.errors.txt | 16 +-- ...tJavaScriptSyntacticDiagnostics01.baseline | 17 +++ ...tJavaScriptSyntacticDiagnostics02.baseline | 32 ++++++ ...etJavaScriptSyntacticDiagnostics1.baseline | 8 ++ ...tJavaScriptSyntacticDiagnostics10.baseline | 8 ++ ...tJavaScriptSyntacticDiagnostics11.baseline | 8 ++ ...tJavaScriptSyntacticDiagnostics12.baseline | 8 ++ ...tJavaScriptSyntacticDiagnostics13.baseline | 8 ++ ...tJavaScriptSyntacticDiagnostics14.baseline | 8 ++ ...tJavaScriptSyntacticDiagnostics15.baseline | 8 ++ ...tJavaScriptSyntacticDiagnostics16.baseline | 8 ++ ...tJavaScriptSyntacticDiagnostics17.baseline | 8 ++ ...tJavaScriptSyntacticDiagnostics18.baseline | 19 ++++ ...tJavaScriptSyntacticDiagnostics19.baseline | 8 ++ ...etJavaScriptSyntacticDiagnostics2.baseline | 8 ++ ...etJavaScriptSyntacticDiagnostics3.baseline | 8 ++ ...etJavaScriptSyntacticDiagnostics4.baseline | 8 ++ ...etJavaScriptSyntacticDiagnostics5.baseline | 8 ++ ...etJavaScriptSyntacticDiagnostics6.baseline | 8 ++ ...etJavaScriptSyntacticDiagnostics7.baseline | 8 ++ ...etJavaScriptSyntacticDiagnostics8.baseline | 8 ++ ...etJavaScriptSyntacticDiagnostics9.baseline | 8 ++ .../jsDeclarationsClassesErr.errors.txt | 84 +++++++------- .../reference/jsDeclarationsEnums.errors.txt | 48 ++++---- .../jsDeclarationsExportFormsErr.errors.txt | 8 +- .../jsDeclarationsInterfaces.errors.txt | 104 +++++++++--------- ...FileCompilationAbstractModifier.errors.txt | 8 +- ...tionAmbientVarDeclarationSyntax.errors.txt | 4 +- .../jsFileCompilationEnumSyntax.errors.txt | 4 +- ...mpilationExportAssignmentSyntax.errors.txt | 4 +- ...tionHeritageClauseSyntaxOfClass.errors.txt | 4 +- ...leCompilationImportEqualsSyntax.errors.txt | 4 +- ...sFileCompilationInterfaceSyntax.errors.txt | 4 +- .../jsFileCompilationModuleSyntax.errors.txt | 4 +- ...FileCompilationNonNullAssertion.errors.txt | 4 +- ...tionalClassElementSyntaxOfClass.errors.txt | 8 +- ...ileCompilationOptionalParameter.errors.txt | 4 +- ...lationPublicMethodSyntaxOfClass.errors.txt | 4 +- ...pilationPublicParameterModifier.errors.txt | 4 +- ...ationReturnTypeSyntaxOfFunction.errors.txt | 4 +- ...sFileCompilationTypeAliasSyntax.errors.txt | 4 +- ...ilationTypeArgumentSyntaxOfCall.errors.txt | 16 +-- ...jsFileCompilationTypeAssertions.errors.txt | 4 +- ...sFileCompilationTypeOfParameter.errors.txt | 4 +- ...ationTypeParameterSyntaxOfClass.errors.txt | 4 +- ...arameterSyntaxOfClassExpression.errors.txt | 4 +- ...onTypeParameterSyntaxOfFunction.errors.txt | 4 +- ...sFileCompilationTypeSyntaxOfVar.errors.txt | 4 +- .../reference/jsdocTypedefNoCrash2.errors.txt | 4 +- ...xCheckJsxNoTypeArgumentsAllowed.errors.txt | 4 +- tests/cases/fourslash/fourslash.ts | 2 + .../getJavaScriptSyntacticDiagnostics1.ts | 7 +- .../getJavaScriptSyntacticDiagnostics10.ts | 7 +- .../getJavaScriptSyntacticDiagnostics11.ts | 7 +- .../getJavaScriptSyntacticDiagnostics12.ts | 7 +- .../getJavaScriptSyntacticDiagnostics13.ts | 7 +- .../getJavaScriptSyntacticDiagnostics14.ts | 7 +- .../getJavaScriptSyntacticDiagnostics15.ts | 7 +- .../getJavaScriptSyntacticDiagnostics16.ts | 7 +- .../getJavaScriptSyntacticDiagnostics17.ts | 7 +- .../getJavaScriptSyntacticDiagnostics18.ts | 17 +-- .../getJavaScriptSyntacticDiagnostics19.ts | 7 +- .../getJavaScriptSyntacticDiagnostics2.ts | 7 +- .../getJavaScriptSyntacticDiagnostics3.ts | 7 +- .../getJavaScriptSyntacticDiagnostics4.ts | 7 +- .../getJavaScriptSyntacticDiagnostics5.ts | 7 +- .../getJavaScriptSyntacticDiagnostics6.ts | 7 +- .../getJavaScriptSyntacticDiagnostics7.ts | 7 +- .../getJavaScriptSyntacticDiagnostics8.ts | 7 +- .../getJavaScriptSyntacticDiagnostics9.ts | 7 +- .../getJavaScriptSyntacticDiagnostics01.ts | 16 +-- .../getJavaScriptSyntacticDiagnostics02.ts | 35 +----- 79 files changed, 547 insertions(+), 387 deletions(-) create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics01.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics02.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics1.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics10.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics11.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics12.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics13.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics14.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics15.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics16.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics17.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics18.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics19.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics2.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics3.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics4.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics5.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics6.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics7.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics8.baseline create mode 100644 tests/baselines/reference/getJavaScriptSyntacticDiagnostics9.baseline diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 4bcc1e48c8f..0f799c0af61 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1539,7 +1539,7 @@ namespace ts { } if (element.questionToken) { - errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.questionToken, Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); + errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.questionToken, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); } if (!isDoubleQuotedString(element.name)) { errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, Diagnostics.String_literal_with_double_quotes_expected)); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index fedf796769b..4fb13c564bc 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4543,59 +4543,51 @@ "category": "Error", "code": 8001 }, - "'import ... =' can only be used in a .ts file.": { + "'import ... =' can only be used in TypeScript files.": { "category": "Error", "code": 8002 }, - "'export=' can only be used in a .ts file.": { + "'export =' can only be used in TypeScript files.": { "category": "Error", "code": 8003 }, - "'type parameter declarations' can only be used in a .ts file.": { + "Type parameter declarations can only be used in TypeScript files.": { "category": "Error", "code": 8004 }, - "'implements clauses' can only be used in a .ts file.": { + "'implements' clauses can only be used in TypeScript files.": { "category": "Error", "code": 8005 }, - "'interface declarations' can only be used in a .ts file.": { + "'{0}' declarations can only be used in TypeScript files.": { "category": "Error", "code": 8006 }, - "'module declarations' can only be used in a .ts file.": { - "category": "Error", - "code": 8007 - }, - "'type aliases' can only be used in a .ts file.": { + "Type aliases can only be used in TypeScript files.": { "category": "Error", "code": 8008 }, - "'{0}' can only be used in a .ts file.": { + "The '{0}' modifier can only be used in TypeScript files.": { "category": "Error", "code": 8009 }, - "'types' can only be used in a .ts file.": { + "Type annotations can only be used in TypeScript files.": { "category": "Error", "code": 8010 }, - "'type arguments' can only be used in a .ts file.": { + "Type arguments can only be used in TypeScript files.": { "category": "Error", "code": 8011 }, - "'parameter modifiers' can only be used in a .ts file.": { + "Parameter modifiers can only be used in TypeScript files.": { "category": "Error", "code": 8012 }, - "'non-null assertions' can only be used in a .ts file.": { + "Non-null assertions can only be used in TypeScript files.": { "category": "Error", "code": 8013 }, - "'enum declarations' can only be used in a .ts file.": { - "category": "Error", - "code": 8015 - }, - "'type assertion expressions' can only be used in a .ts file.": { + "Type assertion expressions can only be used in TypeScript files.": { "category": "Error", "code": 8016 }, diff --git a/src/compiler/program.ts b/src/compiler/program.ts index cba0cd748b2..2af18fb6bbb 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1797,7 +1797,7 @@ namespace ts { case SyntaxKind.PropertyDeclaration: case SyntaxKind.MethodDeclaration: if ((parent).questionToken === node) { - diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); + diagnostics.push(createDiagnosticForNode(node, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return; } // falls through @@ -1811,45 +1811,48 @@ namespace ts { case SyntaxKind.VariableDeclaration: // type annotation if ((parent).type === node) { - diagnostics.push(createDiagnosticForNode(node, Diagnostics.types_can_only_be_used_in_a_ts_file)); + diagnostics.push(createDiagnosticForNode(node, Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); return; } } switch (node.kind) { case SyntaxKind.ImportEqualsDeclaration: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.import_can_only_be_used_in_a_ts_file)); + diagnostics.push(createDiagnosticForNode(node, Diagnostics.import_can_only_be_used_in_TypeScript_files)); return; case SyntaxKind.ExportAssignment: if ((node).isExportEquals) { - diagnostics.push(createDiagnosticForNode(node, Diagnostics.export_can_only_be_used_in_a_ts_file)); + diagnostics.push(createDiagnosticForNode(node, Diagnostics.export_can_only_be_used_in_TypeScript_files)); return; } break; case SyntaxKind.HeritageClause: const heritageClause = node; if (heritageClause.token === SyntaxKind.ImplementsKeyword) { - diagnostics.push(createDiagnosticForNode(node, Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); + diagnostics.push(createDiagnosticForNode(node, Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return; } break; case SyntaxKind.InterfaceDeclaration: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); + diagnostics.push(createDiagnosticForNode(node, Diagnostics.Interface_declaration_cannot_have_implements_clause)); return; case SyntaxKind.ModuleDeclaration: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); + const moduleKeyword = node.flags & NodeFlags.Namespace ? tokenToString(SyntaxKind.NamespaceKeyword) : tokenToString(SyntaxKind.ModuleKeyword); + Debug.assertDefined(moduleKeyword); + diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return; case SyntaxKind.TypeAliasDeclaration: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); + diagnostics.push(createDiagnosticForNode(node, Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return; case SyntaxKind.EnumDeclaration: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); + const enumKeyword = Debug.assertDefined(tokenToString(SyntaxKind.EnumKeyword)); + diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return; case SyntaxKind.NonNullExpression: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file)); + diagnostics.push(createDiagnosticForNode(node, Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return; case SyntaxKind.AsExpression: - diagnostics.push(createDiagnosticForNode((node as AsExpression).type, Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); + diagnostics.push(createDiagnosticForNode((node as AsExpression).type, Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return; case SyntaxKind.TypeAssertionExpression: Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. @@ -1878,7 +1881,7 @@ namespace ts { case SyntaxKind.ArrowFunction: // Check type parameters if (nodes === (parent).typeParameters) { - diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); + diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return; } // falls through @@ -1894,7 +1897,7 @@ namespace ts { if (nodes === (parent).modifiers) { for (const modifier of >nodes) { if (modifier.kind !== SyntaxKind.StaticKeyword) { - diagnostics.push(createDiagnosticForNode(modifier, Diagnostics._0_can_only_be_used_in_a_ts_file, tokenToString(modifier.kind))); + diagnostics.push(createDiagnosticForNode(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind))); } } return; @@ -1903,7 +1906,7 @@ namespace ts { case SyntaxKind.Parameter: // Check modifiers of parameter declaration if (nodes === (parent).modifiers) { - diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); + diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return; } break; @@ -1915,7 +1918,7 @@ namespace ts { case SyntaxKind.TaggedTemplateExpression: // Check type arguments if (nodes === (parent).typeArguments) { - diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); + diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); return; } break; @@ -1941,7 +1944,7 @@ namespace ts { case SyntaxKind.ReadonlyKeyword: case SyntaxKind.DeclareKeyword: case SyntaxKind.AbstractKeyword: - diagnostics.push(createDiagnosticForNode(modifier, Diagnostics._0_can_only_be_used_in_a_ts_file, tokenToString(modifier.kind))); + diagnostics.push(createDiagnosticForNode(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind))); break; // These are all legal modifiers. diff --git a/src/harness/client.ts b/src/harness/client.ts index 046a5303040..78b454b565b 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -374,12 +374,14 @@ namespace ts.server { private getDiagnostics(file: string, command: CommandNames): DiagnosticWithLocation[] { const request = this.processRequest(command, { file, includeLinePosition: true }); const response = this.processResponse(request); + const sourceText = getSnapshotText(this.host.getScriptSnapshot(file)!); + const fakeSourceFile = { fileName: file, text: sourceText } as SourceFile; // Warning! This is a huge lie! return (response.body).map((entry): DiagnosticWithLocation => { const category = firstDefined(Object.keys(DiagnosticCategory), id => isString(id) && entry.category === id.toLowerCase() ? (DiagnosticCategory)[id] : undefined); return { - file: undefined!, // TODO: GH#18217 + file: fakeSourceFile, start: entry.start, length: entry.length, messageText: entry.message, @@ -518,14 +520,14 @@ namespace ts.server { return notImplemented(); } - getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems { + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems | undefined { const args: protocol.SignatureHelpRequestArgs = this.createFileLocationRequestArgs(fileName, position); const request = this.processRequest(CommandNames.SignatureHelp, args); const response = this.processResponse(request); if (!response.body) { - return undefined!; // TODO: GH#18217 + return undefined; } const { items, applicableSpan: encodedApplicableSpan, selectedItemIndex, argumentIndex, argumentCount } = response.body; diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 62545e54bc7..68a0387f376 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -221,7 +221,7 @@ namespace FourSlash { } } - constructor(private basePath: string, private testType: FourSlashTestType, public testData: FourSlashData) { + constructor(private originalInputFileName: string, private basePath: string, private testType: FourSlashTestType, public testData: FourSlashData) { // Create a new Services Adapter this.cancellationToken = new TestCancellationToken(); let compilationOptions = convertGlobalOptionsToCompilerOptions(this.testData.globalOptions); @@ -1475,7 +1475,7 @@ namespace FourSlash { } public baselineCurrentFileBreakpointLocations() { - const baselineFile = this.getBaselineFileName().replace("breakpointValidation", "bpSpan"); + const baselineFile = this.getBaselineFileNameForInternalFourslashFile().replace("breakpointValidation", "bpSpan"); Harness.Baseline.runBaseline(baselineFile, this.baselineCurrentFileLocations(pos => this.getBreakpointStatementLocation(pos)!)); } @@ -1554,8 +1554,49 @@ namespace FourSlash { return result; } + public baselineSyntacticDiagnostics() { + const files = this.getCompilerTestFiles(); + const result = this.getSyntacticDiagnosticBaselineText(files); + Harness.Baseline.runBaseline(this.getBaselineFileNameForContainingTestFile(), result); + } + + private getCompilerTestFiles() { + return ts.map(this.testData.files, ({ content, fileName }) => ({ + content, unitName: fileName + })); + } + + public baselineSyntacticAndSemanticDiagnostics() { + const files = this.getCompilerTestFiles(); + const result = this.getSyntacticDiagnosticBaselineText(files) + + Harness.IO.newLine() + + Harness.IO.newLine() + + this.getSemanticDiagnosticBaselineText(files); + Harness.Baseline.runBaseline(this.getBaselineFileNameForContainingTestFile(), result); + } + + private getSyntacticDiagnosticBaselineText(files: Harness.Compiler.TestFile[]) { + const diagnostics = ts.flatMap(files, + file => this.languageService.getSyntacticDiagnostics(file.unitName) + ); + const result = `Syntactic Diagnostics for file '${this.originalInputFileName}':` + + Harness.IO.newLine() + + Harness.Compiler.getErrorBaseline(files, diagnostics, /*pretty*/ false); + return result; + } + + private getSemanticDiagnosticBaselineText(files: Harness.Compiler.TestFile[]) { + const diagnostics = ts.flatMap(files, + file => this.languageService.getSemanticDiagnostics(file.unitName) + ); + const result = `Semantic Diagnostics for file '${this.originalInputFileName}':` + + Harness.IO.newLine() + + Harness.Compiler.getErrorBaseline(files, diagnostics, /*pretty*/ false); + return result; + } + public baselineQuickInfo() { - const baselineFile = this.getBaselineFileName(); + const baselineFile = this.getBaselineFileNameForInternalFourslashFile(); Harness.Baseline.runBaseline( baselineFile, stringify( @@ -1567,7 +1608,7 @@ namespace FourSlash { public baselineSmartSelection() { const n = "\n"; - const baselineFile = this.getBaselineFileName(); + const baselineFile = this.getBaselineFileNameForInternalFourslashFile(); const markers = this.getMarkers(); const fileContent = this.activeFile.content; const text = markers.map(marker => { @@ -1652,11 +1693,15 @@ namespace FourSlash { Harness.IO.log(stringify(help.items[help.selectedItemIndex])); } - private getBaselineFileName() { + private getBaselineFileNameForInternalFourslashFile() { return this.testData.globalOptions[MetadataOptionNames.baselineFile] || ts.getBaseFileName(this.activeFile.fileName).replace(ts.Extension.Ts, ".baseline"); } + private getBaselineFileNameForContainingTestFile() { + return ts.getBaseFileName(this.originalInputFileName).replace(ts.Extension.Ts, ".baseline"); + } + private getSignatureHelp({ triggerReason }: FourSlashInterface.VerifySignatureHelpOptions): ts.SignatureHelpItems | undefined { return this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition, { triggerReason @@ -3263,7 +3308,7 @@ namespace FourSlash { // Parse out the files and their metadata const testData = parseTestData(absoluteBasePath, content, absoluteFileName); - const state = new TestState(absoluteBasePath, testType, testData); + const state = new TestState(absoluteFileName, absoluteBasePath, testType, testData); const output = ts.transpileModule(content, { reportDiagnostics: true, compilerOptions: { target: ts.ScriptTarget.ES2015 } }); if (output.diagnostics!.length > 0) { throw new Error(`Syntax error in ${absoluteBasePath}: ${output.diagnostics![0].messageText}`); @@ -4122,6 +4167,14 @@ namespace FourSlashInterface { this.state.baselineSmartSelection(); } + public baselineSyntacticDiagnostics() { + this.state.baselineSyntacticDiagnostics(); + } + + public baselineSyntacticAndSemanticDiagnostics() { + this.state.baselineSyntacticAndSemanticDiagnostics(); + } + public nameOrDottedNameSpanTextIs(text: string) { this.state.verifyCurrentNameOrDottedNameSpanText(text); } diff --git a/tests/baselines/reference/decoratorInJsFile.errors.txt b/tests/baselines/reference/decoratorInJsFile.errors.txt index 521c67d4e23..3524eb863e5 100644 --- a/tests/baselines/reference/decoratorInJsFile.errors.txt +++ b/tests/baselines/reference/decoratorInJsFile.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/a.js(3,12): error TS8010: 'types' can only be used in a .ts file. +tests/cases/compiler/a.js(3,12): error TS8010: Type annotations can only be used in TypeScript files. ==== tests/cases/compiler/a.js (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/compiler/a.js(3,12): error TS8010: 'types' can only be used in a .ts class SomeClass { foo(x: number) { ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorInJsFile1.errors.txt b/tests/baselines/reference/decoratorInJsFile1.errors.txt index 9cb55bd2016..e436dfca859 100644 --- a/tests/baselines/reference/decoratorInJsFile1.errors.txt +++ b/tests/baselines/reference/decoratorInJsFile1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/a.js(2,7): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. -tests/cases/compiler/a.js(3,12): error TS8010: 'types' can only be used in a .ts file. +tests/cases/compiler/a.js(3,12): error TS8010: Type annotations can only be used in TypeScript files. ==== tests/cases/compiler/a.js (2 errors) ==== @@ -9,7 +9,7 @@ tests/cases/compiler/a.js(3,12): error TS8010: 'types' can only be used in a .ts !!! error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. foo(x: number) { ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } } \ No newline at end of file diff --git a/tests/baselines/reference/fillInMissingTypeArgsOnJSConstructCalls.errors.txt b/tests/baselines/reference/fillInMissingTypeArgsOnJSConstructCalls.errors.txt index 966e3e35613..f40ed6fa996 100644 --- a/tests/baselines/reference/fillInMissingTypeArgsOnJSConstructCalls.errors.txt +++ b/tests/baselines/reference/fillInMissingTypeArgsOnJSConstructCalls.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/BaseB.js(2,24): error TS8004: 'type parameter declarations' can only be used in a .ts file. +tests/cases/compiler/BaseB.js(2,24): error TS8004: Type parameter declarations can only be used in TypeScript files. tests/cases/compiler/BaseB.js(2,25): error TS1005: ',' expected. tests/cases/compiler/BaseB.js(3,14): error TS2304: Cannot find name 'Class'. -tests/cases/compiler/BaseB.js(3,14): error TS8010: 'types' can only be used in a .ts file. +tests/cases/compiler/BaseB.js(3,14): error TS8010: Type annotations can only be used in TypeScript files. tests/cases/compiler/BaseB.js(4,25): error TS2304: Cannot find name 'Class'. -tests/cases/compiler/BaseB.js(4,25): error TS8010: 'types' can only be used in a .ts file. -tests/cases/compiler/SubB.js(3,41): error TS8011: 'type arguments' can only be used in a .ts file. +tests/cases/compiler/BaseB.js(4,25): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/compiler/SubB.js(3,41): error TS8011: Type arguments can only be used in TypeScript files. ==== tests/cases/compiler/BaseA.js (0 errors) ==== @@ -19,19 +19,19 @@ tests/cases/compiler/SubB.js(3,41): error TS8011: 'type arguments' can only be u import BaseA from './BaseA'; export default class B { ~~~~~~~~ -!!! error TS8004: 'type parameter declarations' can only be used in a .ts file. +!!! error TS8004: Type parameter declarations can only be used in TypeScript files. ~ !!! error TS1005: ',' expected. _AClass: Class; ~~~~~ !!! error TS2304: Cannot find name 'Class'. ~~~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. constructor(AClass: Class) { ~~~~~ !!! error TS2304: Cannot find name 'Class'. ~~~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. this._AClass = AClass; } } @@ -40,7 +40,7 @@ tests/cases/compiler/SubB.js(3,41): error TS8011: 'type arguments' can only be u import BaseB from './BaseB'; export default class SubB extends BaseB { ~~~~ -!!! error TS8011: 'type arguments' can only be used in a .ts file. +!!! error TS8011: Type arguments can only be used in TypeScript files. constructor() { super(SubA); } diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics01.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics01.baseline new file mode 100644 index 00000000000..934bc31c831 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics01.baseline @@ -0,0 +1,17 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics01.ts': +/tests/cases/fourslash/server/a.js(1,5): error TS1134: Variable declaration expected. +/tests/cases/fourslash/server/a.js(1,8): error TS1109: Expression expected. + + +==== /tests/cases/fourslash/server/a.js (2 errors) ==== + var ===; + ~~~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1109: Expression expected. + +Semantic Diagnostics for file '/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics01.ts': + + +==== /tests/cases/fourslash/server/a.js (0 errors) ==== + var ===; \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics02.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics02.baseline new file mode 100644 index 00000000000..fae50364167 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics02.baseline @@ -0,0 +1,32 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics02.ts': +/tests/cases/fourslash/server/b.js(2,8): error TS8010: Type annotations can only be used in TypeScript files. +/tests/cases/fourslash/server/b.js(3,17): error TS8010: Type annotations can only be used in TypeScript files. +/tests/cases/fourslash/server/b.js(4,5): error TS1134: Variable declaration expected. +/tests/cases/fourslash/server/b.js(4,9): error TS1134: Variable declaration expected. +/tests/cases/fourslash/server/b.js(4,11): error TS1134: Variable declaration expected. + + +==== /tests/cases/fourslash/server/b.js (5 errors) ==== + var a = "a"; + var b: boolean = true; + ~~~~~~~ +!!! error TS8010: Type annotations can only be used in TypeScript files. + function foo(): string { } + ~~~~~~ +!!! error TS8010: Type annotations can only be used in TypeScript files. + var var = "c"; + ~~~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1134: Variable declaration expected. + ~~~ +!!! error TS1134: Variable declaration expected. + +Semantic Diagnostics for file '/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics02.ts': + + +==== /tests/cases/fourslash/server/b.js (0 errors) ==== + var a = "a"; + var b: boolean = true; + function foo(): string { } + var var = "c"; \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics1.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics1.baseline new file mode 100644 index 00000000000..780c5a15082 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics1.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics1.ts': +/tests/cases/fourslash/a.js(1,1): error TS8002: 'import ... =' can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + import a = b; + ~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics10.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics10.baseline new file mode 100644 index 00000000000..ca184aa5aad --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics10.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics10.ts': +/tests/cases/fourslash/a.js(1,12): error TS8004: Type parameter declarations can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + function F() { } + ~ +!!! error TS8004: Type parameter declarations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics11.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics11.baseline new file mode 100644 index 00000000000..c23fbe8672f --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics11.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics11.ts': +/tests/cases/fourslash/a.js(1,15): error TS8010: Type annotations can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + function F(): number { } + ~~~~~~ +!!! error TS8010: Type annotations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics12.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics12.baseline new file mode 100644 index 00000000000..73ca590b32a --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics12.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics12.ts': +/tests/cases/fourslash/a.js(1,1): error TS8009: The 'declare' modifier can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + declare var v; + ~~~~~~~ +!!! error TS8009: The 'declare' modifier can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics13.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics13.baseline new file mode 100644 index 00000000000..a2dcecb6a40 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics13.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics13.ts': +/tests/cases/fourslash/a.js(1,8): error TS8010: Type annotations can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + var v: () => number; + ~~~~~~~~~~~~ +!!! error TS8010: Type annotations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics14.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics14.baseline new file mode 100644 index 00000000000..89eed8663ec --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics14.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics14.ts': +/tests/cases/fourslash/a.js(1,5): error TS8011: Type arguments can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + Foo(); + ~~~~~~ +!!! error TS8011: Type arguments can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics15.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics15.baseline new file mode 100644 index 00000000000..f30956f93c4 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics15.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics15.ts': +/tests/cases/fourslash/a.js(1,12): error TS8012: Parameter modifiers can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + function F(public p) { } + ~~~~~~ +!!! error TS8012: Parameter modifiers can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics16.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics16.baseline new file mode 100644 index 00000000000..c72e41a2d04 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics16.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics16.ts': +/tests/cases/fourslash/a.js(1,13): error TS8009: The '?' modifier can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + function F(p?) { } + ~ +!!! error TS8009: The '?' modifier can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics17.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics17.baseline new file mode 100644 index 00000000000..199c3cbfd80 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics17.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics17.ts': +/tests/cases/fourslash/a.js(1,15): error TS8010: Type annotations can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + function F(a: number) { } + ~~~~~~ +!!! error TS8010: Type annotations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics18.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics18.baseline new file mode 100644 index 00000000000..c493a7f97c8 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics18.baseline @@ -0,0 +1,19 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics18.ts': +/tests/cases/fourslash/a.js(4,5): error TS8009: The 'public' modifier can only be used in TypeScript files. +/tests/cases/fourslash/b.js(2,8): error TS8010: Type annotations can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + class C { + x; // Regular property declaration allowed + static y; // static allowed + public z; // public not allowed + ~~~~~~ +!!! error TS8009: The 'public' modifier can only be used in TypeScript files. + } +==== /tests/cases/fourslash/b.js (1 errors) ==== + class C { + x: number; // Types not allowed + ~~~~~~ +!!! error TS8010: Type annotations can only be used in TypeScript files. + } \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics19.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics19.baseline new file mode 100644 index 00000000000..28d89307f19 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics19.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics19.ts': +/tests/cases/fourslash/a.js(1,6): error TS8006: 'enum' declarations can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + enum E { } + ~ +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics2.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics2.baseline new file mode 100644 index 00000000000..f786f88c988 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics2.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics2.ts': +/tests/cases/fourslash/a.js(1,1): error TS8003: 'export =' can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + export = b; + ~~~~~~~~~~~ +!!! error TS8003: 'export =' can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics3.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics3.baseline new file mode 100644 index 00000000000..de3624928b0 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics3.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics3.ts': +/tests/cases/fourslash/a.js(1,9): error TS8004: Type parameter declarations can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + class C { } + ~ +!!! error TS8004: Type parameter declarations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics4.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics4.baseline new file mode 100644 index 00000000000..59e80b81dd2 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics4.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics4.ts': +/tests/cases/fourslash/a.js(1,1): error TS8009: The 'public' modifier can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + public class C { } + ~~~~~~ +!!! error TS8009: The 'public' modifier can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics5.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics5.baseline new file mode 100644 index 00000000000..06f705ebe79 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics5.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics5.ts': +/tests/cases/fourslash/a.js(1,9): error TS8005: 'implements' clauses can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + class C implements D { } + ~~~~~~~~~~~~ +!!! error TS8005: 'implements' clauses can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics6.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics6.baseline new file mode 100644 index 00000000000..a129f7ca8c5 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics6.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics6.ts': +/tests/cases/fourslash/a.js(1,11): error TS1176: Interface declaration cannot have 'implements' clause. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + interface I { } + ~ +!!! error TS1176: Interface declaration cannot have 'implements' clause. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics7.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics7.baseline new file mode 100644 index 00000000000..86420e6a056 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics7.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics7.ts': +/tests/cases/fourslash/a.js(1,8): error TS8006: 'module' declarations can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + module M { } + ~ +!!! error TS8006: 'module' declarations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics8.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics8.baseline new file mode 100644 index 00000000000..27ea265b073 --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics8.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics8.ts': +/tests/cases/fourslash/a.js(1,6): error TS8008: Type aliases can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + type a = b; + ~ +!!! error TS8008: Type aliases can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/getJavaScriptSyntacticDiagnostics9.baseline b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics9.baseline new file mode 100644 index 00000000000..64193706ccc --- /dev/null +++ b/tests/baselines/reference/getJavaScriptSyntacticDiagnostics9.baseline @@ -0,0 +1,8 @@ +Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics9.ts': +/tests/cases/fourslash/a.js(1,1): error TS8009: The 'public' modifier can only be used in TypeScript files. + + +==== /tests/cases/fourslash/a.js (1 errors) ==== + public function F() { } + ~~~~~~ +!!! error TS8009: The 'public' modifier can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsDeclarationsClassesErr.errors.txt b/tests/baselines/reference/jsDeclarationsClassesErr.errors.txt index ef78bf109c8..0f2fd791aab 100644 --- a/tests/baselines/reference/jsDeclarationsClassesErr.errors.txt +++ b/tests/baselines/reference/jsDeclarationsClassesErr.errors.txt @@ -1,24 +1,24 @@ -tests/cases/conformance/jsdoc/declarations/index.js(4,16): error TS8004: 'type parameter declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(5,12): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(8,16): error TS8004: 'type parameter declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(8,29): error TS8011: 'type arguments' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(9,12): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(13,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(19,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(23,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(27,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(28,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(32,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(39,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(43,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(47,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(48,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(52,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(53,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(59,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(63,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(67,11): error TS8010: 'types' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(68,11): error TS8010: 'types' can only be used in a .ts file. +tests/cases/conformance/jsdoc/declarations/index.js(4,16): error TS8004: Type parameter declarations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(5,12): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(8,16): error TS8004: Type parameter declarations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(8,29): error TS8011: Type arguments can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(9,12): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(13,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(19,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(23,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(27,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(28,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(32,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(39,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(43,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(47,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(48,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(52,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(53,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(59,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(63,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(67,11): error TS8010: Type annotations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(68,11): error TS8010: Type annotations can only be used in TypeScript files. ==== tests/cases/conformance/jsdoc/declarations/index.js (21 errors) ==== @@ -27,26 +27,26 @@ tests/cases/conformance/jsdoc/declarations/index.js(68,11): error TS8010: 'types export class M { ~ -!!! error TS8004: 'type parameter declarations' can only be used in a .ts file. +!!! error TS8004: Type parameter declarations can only be used in TypeScript files. field: T; ~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } export class N extends M { ~ -!!! error TS8004: 'type parameter declarations' can only be used in a .ts file. +!!! error TS8004: Type parameter declarations can only be used in TypeScript files. ~ -!!! error TS8011: 'type arguments' can only be used in a .ts file. +!!! error TS8011: Type arguments can only be used in TypeScript files. other: U; ~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } export class O { [idx: string]: string; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } export class P extends O {} @@ -54,28 +54,28 @@ tests/cases/conformance/jsdoc/declarations/index.js(68,11): error TS8010: 'types export class Q extends O { [idx: string]: "ok"; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } export class R extends O { [idx: number]: "ok"; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } export class S extends O { [idx: string]: "ok"; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. [idx: number]: never; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } export class T { [idx: number]: string; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } export class U extends T {} @@ -84,31 +84,31 @@ tests/cases/conformance/jsdoc/declarations/index.js(68,11): error TS8010: 'types export class V extends T { [idx: string]: string; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } export class W extends T { [idx: number]: "ok"; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } export class X extends T { [idx: string]: string; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. [idx: number]: "ok"; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } export class Y { [idx: string]: {x: number}; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. [idx: number]: {x: number, y: number}; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } export class Z extends Y {} @@ -116,21 +116,21 @@ tests/cases/conformance/jsdoc/declarations/index.js(68,11): error TS8010: 'types export class AA extends Y { [idx: string]: {x: number, y: number}; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } export class BB extends Y { [idx: number]: {x: 0, y: 0}; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } export class CC extends Y { [idx: string]: {x: number, y: number}; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. [idx: number]: {x: 0, y: 0}; ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. +!!! error TS8010: Type annotations can only be used in TypeScript files. } \ No newline at end of file diff --git a/tests/baselines/reference/jsDeclarationsEnums.errors.txt b/tests/baselines/reference/jsDeclarationsEnums.errors.txt index 630d4aab7e9..d11d246f978 100644 --- a/tests/baselines/reference/jsDeclarationsEnums.errors.txt +++ b/tests/baselines/reference/jsDeclarationsEnums.errors.txt @@ -1,15 +1,15 @@ -tests/cases/conformance/jsdoc/declarations/index.js(4,13): error TS8015: 'enum declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(6,13): error TS8015: 'enum declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(10,6): error TS8015: 'enum declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(14,6): error TS8015: 'enum declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(18,13): error TS8015: 'enum declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(22,13): error TS8015: 'enum declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(24,13): error TS8015: 'enum declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(30,13): error TS8015: 'enum declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(35,13): error TS8015: 'enum declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(41,19): error TS8015: 'enum declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(47,13): error TS8015: 'enum declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(55,19): error TS8015: 'enum declarations' can only be used in a .ts file. +tests/cases/conformance/jsdoc/declarations/index.js(4,13): error TS8006: 'enum' declarations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(6,13): error TS8006: 'enum' declarations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(10,6): error TS8006: 'enum' declarations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(14,6): error TS8006: 'enum' declarations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(18,13): error TS8006: 'enum' declarations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(22,13): error TS8006: 'enum' declarations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(24,13): error TS8006: 'enum' declarations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(30,13): error TS8006: 'enum' declarations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(35,13): error TS8006: 'enum' declarations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(41,19): error TS8006: 'enum' declarations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(47,13): error TS8006: 'enum' declarations can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/index.js(55,19): error TS8006: 'enum' declarations can only be used in TypeScript files. ==== tests/cases/conformance/jsdoc/declarations/index.js (12 errors) ==== @@ -18,39 +18,39 @@ tests/cases/conformance/jsdoc/declarations/index.js(55,19): error TS8015: 'enum export enum A {} ~ -!!! error TS8015: 'enum declarations' can only be used in a .ts file. +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. export enum B { ~ -!!! error TS8015: 'enum declarations' can only be used in a .ts file. +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. Member } enum C {} ~ -!!! error TS8015: 'enum declarations' can only be used in a .ts file. +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. export { C }; enum DD {} ~~ -!!! error TS8015: 'enum declarations' can only be used in a .ts file. +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. export { DD as D }; export enum E {} ~ -!!! error TS8015: 'enum declarations' can only be used in a .ts file. +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. export { E as EE }; export { F as FF }; export enum F {} ~ -!!! error TS8015: 'enum declarations' can only be used in a .ts file. +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. export enum G { ~ -!!! error TS8015: 'enum declarations' can only be used in a .ts file. +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. A = 1, B, C @@ -58,14 +58,14 @@ tests/cases/conformance/jsdoc/declarations/index.js(55,19): error TS8015: 'enum export enum H { ~ -!!! error TS8015: 'enum declarations' can only be used in a .ts file. +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. A = "a", B = "b" } export enum I { ~ -!!! error TS8015: 'enum declarations' can only be used in a .ts file. +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. A = "a", B = 0, C @@ -73,7 +73,7 @@ tests/cases/conformance/jsdoc/declarations/index.js(55,19): error TS8015: 'enum export const enum J { ~ -!!! error TS8015: 'enum declarations' can only be used in a .ts file. +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. A = 1, B, C @@ -81,7 +81,7 @@ tests/cases/conformance/jsdoc/declarations/index.js(55,19): error TS8015: 'enum export enum K { ~ -!!! error TS8015: 'enum declarations' can only be used in a .ts file. +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. None = 0, A = 1 << 0, B = 1 << 1, @@ -91,7 +91,7 @@ tests/cases/conformance/jsdoc/declarations/index.js(55,19): error TS8015: 'enum export const enum L { ~ -!!! error TS8015: 'enum declarations' can only be used in a .ts file. +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. None = 0, A = 1 << 0, B = 1 << 1, diff --git a/tests/baselines/reference/jsDeclarationsExportFormsErr.errors.txt b/tests/baselines/reference/jsDeclarationsExportFormsErr.errors.txt index d0d5c78f0d1..0a71049f2fc 100644 --- a/tests/baselines/reference/jsDeclarationsExportFormsErr.errors.txt +++ b/tests/baselines/reference/jsDeclarationsExportFormsErr.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/jsdoc/declarations/bar.js(1,1): error TS8002: 'import ... =' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/bar.js(2,1): error TS8003: 'export=' can only be used in a .ts file. +tests/cases/conformance/jsdoc/declarations/bar.js(1,1): error TS8002: 'import ... =' can only be used in TypeScript files. +tests/cases/conformance/jsdoc/declarations/bar.js(2,1): error TS8003: 'export =' can only be used in TypeScript files. tests/cases/conformance/jsdoc/declarations/bin.js(2,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node`. tests/cases/conformance/jsdoc/declarations/globalNs.js(2,1): error TS1315: Global module exports may only appear in declaration files. @@ -10,10 +10,10 @@ tests/cases/conformance/jsdoc/declarations/globalNs.js(2,1): error TS1315: Globa ==== tests/cases/conformance/jsdoc/declarations/bar.js (2 errors) ==== import ns = require("./cls"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in a .ts file. +!!! error TS8002: 'import ... =' can only be used in TypeScript files. export = ns; // TS Only ~~~~~~~~~~~~ -!!! error TS8003: 'export=' can only be used in a .ts file. +!!! error TS8003: 'export =' can only be used in TypeScript files. ==== tests/cases/conformance/jsdoc/declarations/bin.js (1 errors) ==== import * as ns from "./cls"; diff --git a/tests/baselines/reference/jsDeclarationsInterfaces.errors.txt b/tests/baselines/reference/jsDeclarationsInterfaces.errors.txt index 24ed71af908..50efca43598 100644 --- a/tests/baselines/reference/jsDeclarationsInterfaces.errors.txt +++ b/tests/baselines/reference/jsDeclarationsInterfaces.errors.txt @@ -1,29 +1,29 @@ -tests/cases/conformance/jsdoc/declarations/index.js(4,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(6,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(10,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(31,11): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(35,11): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(39,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(43,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(45,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(49,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(53,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(57,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(61,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(65,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(67,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(71,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(75,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(80,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(84,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(87,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(91,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(95,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(100,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(105,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(107,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(111,18): error TS8006: 'interface declarations' can only be used in a .ts file. -tests/cases/conformance/jsdoc/declarations/index.js(115,18): error TS8006: 'interface declarations' can only be used in a .ts file. +tests/cases/conformance/jsdoc/declarations/index.js(4,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(6,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(10,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(31,11): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(35,11): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(39,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(43,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(45,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(49,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(53,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(57,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(61,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(65,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(67,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(71,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(75,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(80,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(84,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(87,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(91,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(95,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(100,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(105,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(107,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(111,18): error TS1176: Interface declaration cannot have 'implements' clause. +tests/cases/conformance/jsdoc/declarations/index.js(115,18): error TS1176: Interface declaration cannot have 'implements' clause. ==== tests/cases/conformance/jsdoc/declarations/index.js (26 errors) ==== @@ -32,17 +32,17 @@ tests/cases/conformance/jsdoc/declarations/index.js(115,18): error TS8006: 'inte export interface A {} ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. export interface B { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. cat: string; } export interface C { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. field: T & U; optionalField?: T; readonly readonlyField: T & U; @@ -65,135 +65,135 @@ tests/cases/conformance/jsdoc/declarations/index.js(115,18): error TS8006: 'inte interface G {} ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. export { G }; interface HH {} ~~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. export { HH as H }; export interface I {} ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. export { I as II }; export { J as JJ }; export interface J {} ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. export interface K extends I,J { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. x: string; } export interface L extends K { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. y: string; } export interface M { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. field: T; } export interface N extends M { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. other: U; } export interface O { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. [idx: string]: string; } export interface P extends O {} ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. export interface Q extends O { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. [idx: string]: "ok"; } export interface R extends O { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. [idx: number]: "ok"; } export interface S extends O { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. [idx: string]: "ok"; [idx: number]: never; } export interface T { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. [idx: number]: string; } export interface U extends T {} ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. export interface V extends T { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. [idx: string]: string; } export interface W extends T { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. [idx: number]: "ok"; } export interface X extends T { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. [idx: string]: string; [idx: number]: "ok"; } export interface Y { ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. [idx: string]: {x: number}; [idx: number]: {x: number, y: number}; } export interface Z extends Y {} ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. export interface AA extends Y { ~~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. [idx: string]: {x: number, y: number}; } export interface BB extends Y { ~~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. [idx: number]: {x: 0, y: 0}; } export interface CC extends Y { ~~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. +!!! error TS1176: Interface declaration cannot have 'implements' clause. [idx: string]: {x: number, y: number}; [idx: number]: {x: 0, y: 0}; } diff --git a/tests/baselines/reference/jsFileCompilationAbstractModifier.errors.txt b/tests/baselines/reference/jsFileCompilationAbstractModifier.errors.txt index 48bf64ac109..59e6dff6903 100644 --- a/tests/baselines/reference/jsFileCompilationAbstractModifier.errors.txt +++ b/tests/baselines/reference/jsFileCompilationAbstractModifier.errors.txt @@ -1,7 +1,7 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,1): error TS8009: 'abstract' can only be used in a .ts file. -tests/cases/compiler/a.js(2,5): error TS8009: 'abstract' can only be used in a .ts file. +tests/cases/compiler/a.js(1,1): error TS8009: The 'abstract' modifier can only be used in TypeScript files. +tests/cases/compiler/a.js(2,5): error TS8009: The 'abstract' modifier can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -9,8 +9,8 @@ tests/cases/compiler/a.js(2,5): error TS8009: 'abstract' can only be used in a . ==== tests/cases/compiler/a.js (2 errors) ==== abstract class c { ~~~~~~~~ -!!! error TS8009: 'abstract' can only be used in a .ts file. +!!! error TS8009: The 'abstract' modifier can only be used in TypeScript files. abstract x; ~~~~~~~~ -!!! error TS8009: 'abstract' can only be used in a .ts file. +!!! error TS8009: The 'abstract' modifier can only be used in TypeScript files. } \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationAmbientVarDeclarationSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationAmbientVarDeclarationSyntax.errors.txt index 75451b15389..b7082bc2674 100644 --- a/tests/baselines/reference/jsFileCompilationAmbientVarDeclarationSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationAmbientVarDeclarationSyntax.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,1): error TS8009: 'declare' can only be used in a .ts file. +tests/cases/compiler/a.js(1,1): error TS8009: The 'declare' modifier can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,1): error TS8009: 'declare' can only be used in a .t ==== tests/cases/compiler/a.js (1 errors) ==== declare var v; ~~~~~~~ -!!! error TS8009: 'declare' can only be used in a .ts file. \ No newline at end of file +!!! error TS8009: The 'declare' modifier can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationEnumSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationEnumSyntax.errors.txt index 85d3b5ef798..b87ee7f666c 100644 --- a/tests/baselines/reference/jsFileCompilationEnumSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationEnumSyntax.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,6): error TS8015: 'enum declarations' can only be used in a .ts file. +tests/cases/compiler/a.js(1,6): error TS8006: 'enum' declarations can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,6): error TS8015: 'enum declarations' can only be us ==== tests/cases/compiler/a.js (1 errors) ==== enum E { } ~ -!!! error TS8015: 'enum declarations' can only be used in a .ts file. \ No newline at end of file +!!! error TS8006: 'enum' declarations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt index e3df8cf5d94..2542c7a35fd 100644 --- a/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,1): error TS8003: 'export=' can only be used in a .ts file. +tests/cases/compiler/a.js(1,1): error TS8003: 'export =' can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,1): error TS8003: 'export=' can only be used in a .t ==== tests/cases/compiler/a.js (1 errors) ==== export = b; ~~~~~~~~~~~ -!!! error TS8003: 'export=' can only be used in a .ts file. \ No newline at end of file +!!! error TS8003: 'export =' can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationHeritageClauseSyntaxOfClass.errors.txt b/tests/baselines/reference/jsFileCompilationHeritageClauseSyntaxOfClass.errors.txt index 95e967401a8..9e94fa4c532 100644 --- a/tests/baselines/reference/jsFileCompilationHeritageClauseSyntaxOfClass.errors.txt +++ b/tests/baselines/reference/jsFileCompilationHeritageClauseSyntaxOfClass.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,9): error TS8005: 'implements clauses' can only be used in a .ts file. +tests/cases/compiler/a.js(1,9): error TS8005: 'implements' clauses can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,9): error TS8005: 'implements clauses' can only be u ==== tests/cases/compiler/a.js (1 errors) ==== class C implements D { } ~~~~~~~~~~~~ -!!! error TS8005: 'implements clauses' can only be used in a .ts file. \ No newline at end of file +!!! error TS8005: 'implements' clauses can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationImportEqualsSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationImportEqualsSyntax.errors.txt index d6d0ce64d44..d3a932d234e 100644 --- a/tests/baselines/reference/jsFileCompilationImportEqualsSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationImportEqualsSyntax.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,1): error TS8002: 'import ... =' can only be used in a .ts file. +tests/cases/compiler/a.js(1,1): error TS8002: 'import ... =' can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,1): error TS8002: 'import ... =' can only be used in ==== tests/cases/compiler/a.js (1 errors) ==== import a = b; ~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in a .ts file. \ No newline at end of file +!!! error TS8002: 'import ... =' can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationInterfaceSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationInterfaceSyntax.errors.txt index be051cafc86..0f2923f1094 100644 --- a/tests/baselines/reference/jsFileCompilationInterfaceSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationInterfaceSyntax.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,11): error TS8006: 'interface declarations' can only be used in a .ts file. +tests/cases/compiler/a.js(1,11): error TS1176: Interface declaration cannot have 'implements' clause. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,11): error TS8006: 'interface declarations' can only ==== tests/cases/compiler/a.js (1 errors) ==== interface I { } ~ -!!! error TS8006: 'interface declarations' can only be used in a .ts file. \ No newline at end of file +!!! error TS1176: Interface declaration cannot have 'implements' clause. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationModuleSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationModuleSyntax.errors.txt index cd0bd8ef91a..040a95d60cc 100644 --- a/tests/baselines/reference/jsFileCompilationModuleSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationModuleSyntax.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,8): error TS8007: 'module declarations' can only be used in a .ts file. +tests/cases/compiler/a.js(1,8): error TS8006: 'module' declarations can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,8): error TS8007: 'module declarations' can only be ==== tests/cases/compiler/a.js (1 errors) ==== module M { } ~ -!!! error TS8007: 'module declarations' can only be used in a .ts file. \ No newline at end of file +!!! error TS8006: 'module' declarations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationNonNullAssertion.errors.txt b/tests/baselines/reference/jsFileCompilationNonNullAssertion.errors.txt index 13670601f70..68250662d89 100644 --- a/tests/baselines/reference/jsFileCompilationNonNullAssertion.errors.txt +++ b/tests/baselines/reference/jsFileCompilationNonNullAssertion.errors.txt @@ -1,8 +1,8 @@ -/src/a.js(1,1): error TS8013: 'non-null assertions' can only be used in a .ts file. +/src/a.js(1,1): error TS8013: Non-null assertions can only be used in TypeScript files. ==== /src/a.js (1 errors) ==== 0! ~~ -!!! error TS8013: 'non-null assertions' can only be used in a .ts file. +!!! error TS8013: Non-null assertions can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationOptionalClassElementSyntaxOfClass.errors.txt b/tests/baselines/reference/jsFileCompilationOptionalClassElementSyntaxOfClass.errors.txt index b4ebcf41983..41280531679 100644 --- a/tests/baselines/reference/jsFileCompilationOptionalClassElementSyntaxOfClass.errors.txt +++ b/tests/baselines/reference/jsFileCompilationOptionalClassElementSyntaxOfClass.errors.txt @@ -1,7 +1,7 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(2,8): error TS8009: '?' can only be used in a .ts file. -tests/cases/compiler/a.js(4,8): error TS8009: '?' can only be used in a .ts file. +tests/cases/compiler/a.js(2,8): error TS8009: The '?' modifier can only be used in TypeScript files. +tests/cases/compiler/a.js(4,8): error TS8009: The '?' modifier can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -10,9 +10,9 @@ tests/cases/compiler/a.js(4,8): error TS8009: '?' can only be used in a .ts file class C { foo?() { ~ -!!! error TS8009: '?' can only be used in a .ts file. +!!! error TS8009: The '?' modifier can only be used in TypeScript files. } bar? = 1; ~ -!!! error TS8009: '?' can only be used in a .ts file. +!!! error TS8009: The '?' modifier can only be used in TypeScript files. } \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationOptionalParameter.errors.txt b/tests/baselines/reference/jsFileCompilationOptionalParameter.errors.txt index a340f3d6d1b..55352d8ad3c 100644 --- a/tests/baselines/reference/jsFileCompilationOptionalParameter.errors.txt +++ b/tests/baselines/reference/jsFileCompilationOptionalParameter.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,13): error TS8009: '?' can only be used in a .ts file. +tests/cases/compiler/a.js(1,13): error TS8009: The '?' modifier can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,13): error TS8009: '?' can only be used in a .ts fil ==== tests/cases/compiler/a.js (1 errors) ==== function F(p?) { } ~ -!!! error TS8009: '?' can only be used in a .ts file. \ No newline at end of file +!!! error TS8009: The '?' modifier can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationPublicMethodSyntaxOfClass.errors.txt b/tests/baselines/reference/jsFileCompilationPublicMethodSyntaxOfClass.errors.txt index 2f2cccf83d8..98f4329a180 100644 --- a/tests/baselines/reference/jsFileCompilationPublicMethodSyntaxOfClass.errors.txt +++ b/tests/baselines/reference/jsFileCompilationPublicMethodSyntaxOfClass.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(2,5): error TS8009: 'public' can only be used in a .ts file. +tests/cases/compiler/a.js(2,5): error TS8009: The 'public' modifier can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -9,6 +9,6 @@ tests/cases/compiler/a.js(2,5): error TS8009: 'public' can only be used in a .ts class C { public foo() { ~~~~~~ -!!! error TS8009: 'public' can only be used in a .ts file. +!!! error TS8009: The 'public' modifier can only be used in TypeScript files. } } \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationPublicParameterModifier.errors.txt b/tests/baselines/reference/jsFileCompilationPublicParameterModifier.errors.txt index 6f266b7df31..61030f4384d 100644 --- a/tests/baselines/reference/jsFileCompilationPublicParameterModifier.errors.txt +++ b/tests/baselines/reference/jsFileCompilationPublicParameterModifier.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,23): error TS8012: 'parameter modifiers' can only be used in a .ts file. +tests/cases/compiler/a.js(1,23): error TS8012: Parameter modifiers can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,23): error TS8012: 'parameter modifiers' can only be ==== tests/cases/compiler/a.js (1 errors) ==== class C { constructor(public x) { }} ~~~~~~ -!!! error TS8012: 'parameter modifiers' can only be used in a .ts file. \ No newline at end of file +!!! error TS8012: Parameter modifiers can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationReturnTypeSyntaxOfFunction.errors.txt b/tests/baselines/reference/jsFileCompilationReturnTypeSyntaxOfFunction.errors.txt index f43d221d6a9..ad28a6a7bec 100644 --- a/tests/baselines/reference/jsFileCompilationReturnTypeSyntaxOfFunction.errors.txt +++ b/tests/baselines/reference/jsFileCompilationReturnTypeSyntaxOfFunction.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,15): error TS8010: 'types' can only be used in a .ts file. +tests/cases/compiler/a.js(1,15): error TS8010: Type annotations can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,15): error TS8010: 'types' can only be used in a .ts ==== tests/cases/compiler/a.js (1 errors) ==== function F(): number { } ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. \ No newline at end of file +!!! error TS8010: Type annotations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationTypeAliasSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationTypeAliasSyntax.errors.txt index dd7c1d858e6..f78ddcb964c 100644 --- a/tests/baselines/reference/jsFileCompilationTypeAliasSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeAliasSyntax.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,6): error TS8008: 'type aliases' can only be used in a .ts file. +tests/cases/compiler/a.js(1,6): error TS8008: Type aliases can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,6): error TS8008: 'type aliases' can only be used in ==== tests/cases/compiler/a.js (1 errors) ==== type a = b; ~ -!!! error TS8008: 'type aliases' can only be used in a .ts file. \ No newline at end of file +!!! error TS8008: Type aliases can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.errors.txt b/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.errors.txt index 5b47b12c534..91732ec1b11 100644 --- a/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.errors.txt @@ -1,19 +1,19 @@ -tests/cases/compiler/a.jsx(1,5): error TS8011: 'type arguments' can only be used in a .ts file. -tests/cases/compiler/a.jsx(2,5): error TS8011: 'type arguments' can only be used in a .ts file. -tests/cases/compiler/a.jsx(3,6): error TS8011: 'type arguments' can only be used in a .ts file. -tests/cases/compiler/a.jsx(4,6): error TS8011: 'type arguments' can only be used in a .ts file. +tests/cases/compiler/a.jsx(1,5): error TS8011: Type arguments can only be used in TypeScript files. +tests/cases/compiler/a.jsx(2,5): error TS8011: Type arguments can only be used in TypeScript files. +tests/cases/compiler/a.jsx(3,6): error TS8011: Type arguments can only be used in TypeScript files. +tests/cases/compiler/a.jsx(4,6): error TS8011: Type arguments can only be used in TypeScript files. ==== tests/cases/compiler/a.jsx (4 errors) ==== Foo(); ~~~~~~ -!!! error TS8011: 'type arguments' can only be used in a .ts file. +!!! error TS8011: Type arguments can only be used in TypeScript files. Foo``; ~~~~~~ -!!! error TS8011: 'type arguments' can only be used in a .ts file. +!!! error TS8011: Type arguments can only be used in TypeScript files. >; ~~~~~~ -!!! error TS8011: 'type arguments' can only be used in a .ts file. +!!! error TS8011: Type arguments can only be used in TypeScript files. />; ~~~~~~ -!!! error TS8011: 'type arguments' can only be used in a .ts file. \ No newline at end of file +!!! error TS8011: Type arguments can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationTypeAssertions.errors.txt b/tests/baselines/reference/jsFileCompilationTypeAssertions.errors.txt index 13fbe712dba..c120f1de953 100644 --- a/tests/baselines/reference/jsFileCompilationTypeAssertions.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeAssertions.errors.txt @@ -1,4 +1,4 @@ -/src/a.js(1,6): error TS8016: 'type assertion expressions' can only be used in a .ts file. +/src/a.js(1,6): error TS8016: Type assertion expressions can only be used in TypeScript files. /src/a.js(2,10): error TS17008: JSX element 'string' has no corresponding closing tag. /src/a.js(3,1): error TS1005: 'undefined; ~~~~~~ !!! error TS17008: JSX element 'string' has no corresponding closing tag. diff --git a/tests/baselines/reference/jsFileCompilationTypeOfParameter.errors.txt b/tests/baselines/reference/jsFileCompilationTypeOfParameter.errors.txt index 754d83cff0c..c8978dbbc26 100644 --- a/tests/baselines/reference/jsFileCompilationTypeOfParameter.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeOfParameter.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,15): error TS8010: 'types' can only be used in a .ts file. +tests/cases/compiler/a.js(1,15): error TS8010: Type annotations can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,15): error TS8010: 'types' can only be used in a .ts ==== tests/cases/compiler/a.js (1 errors) ==== function F(a: number) { } ~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. \ No newline at end of file +!!! error TS8010: Type annotations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfClass.errors.txt b/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfClass.errors.txt index 7f27e1e8211..35761630f47 100644 --- a/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfClass.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfClass.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,9): error TS8004: 'type parameter declarations' can only be used in a .ts file. +tests/cases/compiler/a.js(1,9): error TS8004: Type parameter declarations can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,9): error TS8004: 'type parameter declarations' can ==== tests/cases/compiler/a.js (1 errors) ==== class C { } ~ -!!! error TS8004: 'type parameter declarations' can only be used in a .ts file. \ No newline at end of file +!!! error TS8004: Type parameter declarations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfClassExpression.errors.txt b/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfClassExpression.errors.txt index 61bf225dddc..4d60376d051 100644 --- a/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfClassExpression.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfClassExpression.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/a.js(1,19): error TS8004: 'type parameter declarations' can only be used in a .ts file. +tests/cases/compiler/a.js(1,19): error TS8004: Type parameter declarations can only be used in TypeScript files. ==== tests/cases/compiler/a.js (1 errors) ==== const Bar = class {}; ~ -!!! error TS8004: 'type parameter declarations' can only be used in a .ts file. +!!! error TS8004: Type parameter declarations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfFunction.errors.txt b/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfFunction.errors.txt index 12b53c41b97..4fc9d7709e6 100644 --- a/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfFunction.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfFunction.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,12): error TS8004: 'type parameter declarations' can only be used in a .ts file. +tests/cases/compiler/a.js(1,12): error TS8004: Type parameter declarations can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,12): error TS8004: 'type parameter declarations' can ==== tests/cases/compiler/a.js (1 errors) ==== function F() { } ~ -!!! error TS8004: 'type parameter declarations' can only be used in a .ts file. \ No newline at end of file +!!! error TS8004: Type parameter declarations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationTypeSyntaxOfVar.errors.txt b/tests/baselines/reference/jsFileCompilationTypeSyntaxOfVar.errors.txt index 9c7dd647ca7..7eebf3580ff 100644 --- a/tests/baselines/reference/jsFileCompilationTypeSyntaxOfVar.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeSyntaxOfVar.errors.txt @@ -1,6 +1,6 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.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. -tests/cases/compiler/a.js(1,8): error TS8010: 'types' can only be used in a .ts file. +tests/cases/compiler/a.js(1,8): error TS8010: Type annotations can only be used in TypeScript files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. @@ -8,4 +8,4 @@ tests/cases/compiler/a.js(1,8): error TS8010: 'types' can only be used in a .ts ==== tests/cases/compiler/a.js (1 errors) ==== var v: () => number; ~~~~~~~~~~~~ -!!! error TS8010: 'types' can only be used in a .ts file. \ No newline at end of file +!!! error TS8010: Type annotations can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/baselines/reference/jsdocTypedefNoCrash2.errors.txt b/tests/baselines/reference/jsdocTypedefNoCrash2.errors.txt index 6c4a15e5947..9448bf84a2a 100644 --- a/tests/baselines/reference/jsdocTypedefNoCrash2.errors.txt +++ b/tests/baselines/reference/jsdocTypedefNoCrash2.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/export.js(1,13): error TS8008: 'type aliases' can only be used in a .ts file. +tests/cases/compiler/export.js(1,13): error TS8008: Type aliases can only be used in TypeScript files. ==== tests/cases/compiler/export.js (1 errors) ==== export type foo = 5; ~~~ -!!! error TS8008: 'type aliases' can only be used in a .ts file. +!!! error TS8008: Type aliases can only be used in TypeScript files. /** * @typedef {{ * }} diff --git a/tests/baselines/reference/jsxCheckJsxNoTypeArgumentsAllowed.errors.txt b/tests/baselines/reference/jsxCheckJsxNoTypeArgumentsAllowed.errors.txt index 90b3719161e..30e0a50c70d 100644 --- a/tests/baselines/reference/jsxCheckJsxNoTypeArgumentsAllowed.errors.txt +++ b/tests/baselines/reference/jsxCheckJsxNoTypeArgumentsAllowed.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.jsx(4,17): error TS8011: 'type arguments' can only be used in a .ts file. +tests/cases/conformance/jsx/file.jsx(4,17): error TS8011: Type arguments can only be used in TypeScript files. ==== tests/cases/conformance/jsx/component.d.ts (0 errors) ==== @@ -18,5 +18,5 @@ tests/cases/conformance/jsx/file.jsx(4,17): error TS8011: 'type arguments' can o let x = a={10} b="hi" />; // error, no type arguments in js ~~~~ -!!! error TS8011: 'type arguments' can only be used in a .ts file. +!!! error TS8011: Type arguments can only be used in TypeScript files. \ No newline at end of file diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index d93ad08ed07..e2626774a99 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -310,6 +310,8 @@ declare namespace FourSlashInterface { baselineCurrentFileBreakpointLocations(): void; baselineCurrentFileNameOrDottedNameSpans(): void; baselineGetEmitOutput(insertResultsIntoVfs?: boolean): void; + baselineSyntacticDiagnostics(): void; + baselineSyntacticAndSemanticDiagnostics(): void; getEmitOutput(expectedOutputFiles: ReadonlyArray): void; baselineQuickInfo(): void; baselineSmartSelection(): void; diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics1.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics1.ts index 46d9062c468..d1712d4aaeb 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics1.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics1.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////[|import a = b;|] +////import a = b; -verify.getSyntacticDiagnostics([{ - message: "'import ... =' can only be used in a .ts file.", - code: 8002 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics10.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics10.ts index 9f859c527d1..f7245a8ba3f 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics10.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics10.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////function F<[|T|]>() { } +////function F() { } -verify.getSyntacticDiagnostics([{ - message: "'type parameter declarations' can only be used in a .ts file.", - code: 8004 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics11.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics11.ts index f3928bf997d..508a85e4b04 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics11.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics11.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////function F(): [|number|] { } +////function F(): number { } -verify.getSyntacticDiagnostics([{ - message: "'types' can only be used in a .ts file.", - code: 8010 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics12.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics12.ts index e9494017d5d..b06e680bd5c 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics12.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics12.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////[|declare|] var v; +////declare var v; -verify.getSyntacticDiagnostics([{ - message: "'declare' can only be used in a .ts file.", - code: 8009 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics13.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics13.ts index 98b0471b256..19cf4fda7a5 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics13.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics13.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////var v: [|() => number|]; +////var v: () => number; -verify.getSyntacticDiagnostics([{ - message: "'types' can only be used in a .ts file.", - code: 8010 -}]); \ No newline at end of file +verify.baselineSyntacticDiagnostics(); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics14.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics14.ts index ed694fc4e5b..c662735e1f4 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics14.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics14.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////Foo<[|number|]>(); +////Foo(); -verify.getSyntacticDiagnostics([{ - message: "'type arguments' can only be used in a .ts file.", - code: 8011 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics15.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics15.ts index 5e3955a658b..030ba0e8df1 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics15.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics15.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////function F([|public|] p) { } +////function F(public p) { } -verify.getSyntacticDiagnostics([{ - message: "'parameter modifiers' can only be used in a .ts file.", - code: 8012 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics16.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics16.ts index 826c4157036..b3cfed1c98e 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics16.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics16.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////function F(p[|?|]) { } +////function F(p?) { } -verify.getSyntacticDiagnostics([{ - message: "'?' can only be used in a .ts file.", - code: 8009 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics17.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics17.ts index 2bda62590d7..f9d25c2c5cd 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics17.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics17.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////function F(a: [|number|]) { } +////function F(a: number) { } -verify.getSyntacticDiagnostics([{ - message: "'types' can only be used in a .ts file.", - code: 8010 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics18.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics18.ts index 3344a630ca6..0a9eb486e14 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics18.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics18.ts @@ -5,23 +5,12 @@ ////class C { //// x; // Regular property declaration allowed //// static y; // static allowed -//// [|public|] z; // public not allowed +//// public z; // public not allowed ////} -goTo.file("a.js"); -verify.getSyntacticDiagnostics([{ - message: "\'public\' can only be used in a .ts file.", - code: 8009 -}]); - // @Filename: b.js ////class C { -//// x: [|number|]; // Types not allowed +//// x: number; // Types not allowed ////} -goTo.file("b.js"); -verify.getSyntacticDiagnostics([{ - message: "'types' can only be used in a .ts file.", - range: test.ranges()[1], - code: 8010 -}]); +verify.baselineSyntacticDiagnostics() diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics19.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics19.ts index 3198615d8b4..ca6872d6a6a 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics19.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics19.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////enum [|E|] { } +////enum E { } -verify.getSyntacticDiagnostics([{ - message: "'enum declarations' can only be used in a .ts file.", - code: 8015 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics2.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics2.ts index 1ad538071dd..6791673255c 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics2.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics2.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////[|export = b;|] +////export = b; -verify.getSyntacticDiagnostics([{ - message: "'export=' can only be used in a .ts file.", - code: 8003 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics3.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics3.ts index 709e466bcf1..f5c5a0ad0b6 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics3.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics3.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////class C<[|T|]> { } +////class C { } -verify.getSyntacticDiagnostics([{ - message: "'type parameter declarations' can only be used in a .ts file.", - code: 8004 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics4.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics4.ts index 936d6ede996..ceb2e71193e 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics4.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics4.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////[|public|] class C { } +////public class C { } -verify.getSyntacticDiagnostics([{ - message: "'public' can only be used in a .ts file.", - code: 8009 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics5.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics5.ts index f0b765e0ce9..4f75ca35a4e 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics5.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics5.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////class C [|implements D|] { } +////class C implements D { } -verify.getSyntacticDiagnostics([{ - message: "'implements clauses' can only be used in a .ts file.", - code: 8005 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics6.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics6.ts index 565513d8c07..afc06795baa 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics6.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics6.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////interface [|I|] { } +////interface I { } -verify.getSyntacticDiagnostics([{ - message: "'interface declarations' can only be used in a .ts file.", - code: 8006 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics7.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics7.ts index 66985164936..f9f42bf3a1c 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics7.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics7.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////module [|M|] { } +////module M { } -verify.getSyntacticDiagnostics([{ - message: "'module declarations' can only be used in a .ts file.", - code: 8007 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics8.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics8.ts index 6655f923022..03c80ae5317 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics8.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics8.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////type [|a|] = b; +////type a = b; -verify.getSyntacticDiagnostics([{ - message: "'type aliases' can only be used in a .ts file.", - code: 8008 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics9.ts b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics9.ts index fe83ad8488e..51234ba40ed 100644 --- a/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics9.ts +++ b/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics9.ts @@ -2,9 +2,6 @@ // @allowJs: true // @Filename: a.js -////[|public|] function F() { } +////public function F() { } -verify.getSyntacticDiagnostics([{ - message: "'public' can only be used in a .ts file.", - code: 8009 -}]); +verify.baselineSyntacticDiagnostics(); diff --git a/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics01.ts b/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics01.ts index 9b3153b13ac..1a888cb8b8f 100644 --- a/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics01.ts +++ b/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics01.ts @@ -2,18 +2,6 @@ // @allowJs: true // @Filename: a.js -////var [|===|][|;|] +////var ===; -verify.getSyntacticDiagnostics([ - { - message: "Variable declaration expected.", - range: test.ranges()[0], - code: 1134 - }, - { - message: "Expression expected.", - range: test.ranges()[1], - code: 1109 - }, -]); -verify.getSemanticDiagnostics([]); +verify.baselineSyntacticAndSemanticDiagnostics() \ No newline at end of file diff --git a/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics02.ts b/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics02.ts index 4d2b3d5d989..8b182bd98eb 100644 --- a/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics02.ts +++ b/tests/cases/fourslash/server/getJavaScriptSyntacticDiagnostics02.ts @@ -3,35 +3,8 @@ // @allowJs: true // @Filename: b.js ////var a = "a"; -////var b: [|boolean|] = true; -////function foo(): [|string|] { } -////var [|var|] [|=|] [|"c"|]; +////var b: boolean = true; +////function foo(): string { } +////var var = "c"; -verify.getSyntacticDiagnostics([ - { - message: "'types' can only be used in a .ts file.", - range: test.ranges()[0], - code: 8010 - }, - { - message: "\'types\' can only be used in a .ts file.", - range: test.ranges()[1], - code: 8010 - }, - { - message: "Variable declaration expected.", - range: test.ranges()[2], - code: 1134 - }, - { - message: "Variable declaration expected.", - range: test.ranges()[3], - code: 1134 - }, - { - message: "Variable declaration expected.", - range: test.ranges()[4], - code: 1134 - }, -]); -verify.getSemanticDiagnostics([]); +verify.baselineSyntacticAndSemanticDiagnostics() \ No newline at end of file