mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Clean up error messages for using TypeScript syntax in JavaScr… (#35254)
* 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.
This commit is contained in:
committed by
GitHub
parent
3e329469c1
commit
3da85df511
@@ -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));
|
||||
|
||||
@@ -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
|
||||
},
|
||||
|
||||
+19
-16
@@ -1797,7 +1797,7 @@ namespace ts {
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
if ((<ParameterDeclaration | PropertyDeclaration | MethodDeclaration>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 ((<FunctionLikeDeclaration | VariableDeclaration | ParameterDeclaration | PropertyDeclaration>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 ((<ExportAssignment>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 = <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 === (<DeclarationWithTypeParameterChildren>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 === (<PropertyDeclaration>parent).modifiers) {
|
||||
for (const modifier of <NodeArray<Modifier>>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 === (<ParameterDeclaration>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 === (<NodeWithTypeArguments>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.
|
||||
|
||||
@@ -374,12 +374,14 @@ namespace ts.server {
|
||||
private getDiagnostics(file: string, command: CommandNames): DiagnosticWithLocation[] {
|
||||
const request = this.processRequest<protocol.SyntacticDiagnosticsSyncRequest | protocol.SemanticDiagnosticsSyncRequest | protocol.SuggestionDiagnosticsSyncRequest>(command, { file, includeLinePosition: true });
|
||||
const response = this.processResponse<protocol.SyntacticDiagnosticsSyncResponse | protocol.SemanticDiagnosticsSyncResponse | protocol.SuggestionDiagnosticsSyncResponse>(request);
|
||||
const sourceText = getSnapshotText(this.host.getScriptSnapshot(file)!);
|
||||
const fakeSourceFile = { fileName: file, text: sourceText } as SourceFile; // Warning! This is a huge lie!
|
||||
|
||||
return (<protocol.DiagnosticWithLinePosition[]>response.body).map((entry): DiagnosticWithLocation => {
|
||||
const category = firstDefined(Object.keys(DiagnosticCategory), id =>
|
||||
isString(id) && entry.category === id.toLowerCase() ? (<any>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<protocol.SignatureHelpRequest>(CommandNames.SignatureHelp, args);
|
||||
const response = this.processResponse<protocol.SignatureHelpResponse>(request);
|
||||
|
||||
if (!response.body) {
|
||||
return undefined!; // TODO: GH#18217
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const { items, applicableSpan: encodedApplicableSpan, selectedItemIndex, argumentIndex, argumentCount } = response.body;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<T: BaseA> {
|
||||
~~~~~~~~
|
||||
!!! 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<T>;
|
||||
~~~~~
|
||||
!!! 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<T>) {
|
||||
~~~~~
|
||||
!!! 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<SubA> {
|
||||
~~~~
|
||||
!!! 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);
|
||||
}
|
||||
|
||||
@@ -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 ===;
|
||||
@@ -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";
|
||||
@@ -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.
|
||||
@@ -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<T>() { }
|
||||
~
|
||||
!!! error TS8004: Type parameter declarations can only be used in TypeScript files.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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<number>();
|
||||
~~~~~~
|
||||
!!! error TS8011: Type arguments can only be used in TypeScript files.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
}
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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<T> { }
|
||||
~
|
||||
!!! error TS8004: Type parameter declarations can only be used in TypeScript files.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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<T> {
|
||||
~
|
||||
!!! 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<U> extends M<U> {
|
||||
~
|
||||
!!! 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.
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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<T, U> {
|
||||
~
|
||||
!!! 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<T> {
|
||||
~
|
||||
!!! 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<U> extends M<U> {
|
||||
~
|
||||
!!! 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};
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
}
|
||||
@@ -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.
|
||||
!!! error TS8009: The 'declare' modifier can only be used in TypeScript files.
|
||||
@@ -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.
|
||||
!!! error TS8006: 'enum' declarations can only be used in TypeScript files.
|
||||
@@ -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.
|
||||
!!! error TS8003: 'export =' can only be used in TypeScript files.
|
||||
@@ -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.
|
||||
!!! error TS8005: 'implements' clauses can only be used in TypeScript files.
|
||||
@@ -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.
|
||||
!!! error TS8002: 'import ... =' can only be used in TypeScript files.
|
||||
@@ -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.
|
||||
!!! error TS1176: Interface declaration cannot have 'implements' clause.
|
||||
@@ -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.
|
||||
!!! error TS8006: 'module' declarations can only be used in TypeScript files.
|
||||
@@ -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.
|
||||
|
||||
+4
-4
@@ -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.
|
||||
}
|
||||
@@ -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.
|
||||
!!! error TS8009: The '?' modifier can only be used in TypeScript files.
|
||||
@@ -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.
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
!!! error TS8012: Parameter modifiers can only be used in TypeScript files.
|
||||
@@ -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.
|
||||
!!! error TS8010: Type annotations can only be used in TypeScript files.
|
||||
@@ -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.
|
||||
!!! error TS8008: Type aliases can only be used in TypeScript files.
|
||||
@@ -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<number>();
|
||||
~~~~~~
|
||||
!!! error TS8011: 'type arguments' can only be used in a .ts file.
|
||||
!!! error TS8011: Type arguments can only be used in TypeScript files.
|
||||
Foo<number>``;
|
||||
~~~~~~
|
||||
!!! error TS8011: 'type arguments' can only be used in a .ts file.
|
||||
!!! error TS8011: Type arguments can only be used in TypeScript files.
|
||||
<Foo<number>></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<number>/>;
|
||||
~~~~~~
|
||||
!!! error TS8011: 'type arguments' can only be used in a .ts file.
|
||||
!!! error TS8011: Type arguments can only be used in TypeScript files.
|
||||
@@ -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: '</' expected.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
==== /src/a.js (3 errors) ====
|
||||
0 as number;
|
||||
~~~~~~
|
||||
!!! error TS8016: 'type assertion expressions' can only be used in a .ts file.
|
||||
!!! error TS8016: Type assertion expressions can only be used in TypeScript files.
|
||||
var v = <string>undefined;
|
||||
~~~~~~
|
||||
!!! error TS17008: JSX element 'string' has no corresponding closing tag.
|
||||
|
||||
@@ -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.
|
||||
!!! error TS8010: Type annotations can only be used in TypeScript files.
|
||||
@@ -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<T> { }
|
||||
~
|
||||
!!! 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.
|
||||
+2
-2
@@ -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<T> {};
|
||||
~
|
||||
!!! 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.
|
||||
|
||||
@@ -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<T>() { }
|
||||
~
|
||||
!!! 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.
|
||||
@@ -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.
|
||||
!!! error TS8010: Type annotations can only be used in TypeScript files.
|
||||
@@ -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 {{
|
||||
* }}
|
||||
|
||||
@@ -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 = <MyComp<Prop> 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.
|
||||
|
||||
@@ -310,6 +310,8 @@ declare namespace FourSlashInterface {
|
||||
baselineCurrentFileBreakpointLocations(): void;
|
||||
baselineCurrentFileNameOrDottedNameSpans(): void;
|
||||
baselineGetEmitOutput(insertResultsIntoVfs?: boolean): void;
|
||||
baselineSyntacticDiagnostics(): void;
|
||||
baselineSyntacticAndSemanticDiagnostics(): void;
|
||||
getEmitOutput(expectedOutputFiles: ReadonlyArray<string>): void;
|
||||
baselineQuickInfo(): void;
|
||||
baselineSmartSelection(): void;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
////function F<[|T|]>() { }
|
||||
////function F<T>() { }
|
||||
|
||||
verify.getSyntacticDiagnostics([{
|
||||
message: "'type parameter declarations' can only be used in a .ts file.",
|
||||
code: 8004
|
||||
}]);
|
||||
verify.baselineSyntacticDiagnostics();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
}]);
|
||||
verify.baselineSyntacticDiagnostics();
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
////Foo<[|number|]>();
|
||||
////Foo<number>();
|
||||
|
||||
verify.getSyntacticDiagnostics([{
|
||||
message: "'type arguments' can only be used in a .ts file.",
|
||||
code: 8011
|
||||
}]);
|
||||
verify.baselineSyntacticDiagnostics();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
////class C<[|T|]> { }
|
||||
////class C<T> { }
|
||||
|
||||
verify.getSyntacticDiagnostics([{
|
||||
message: "'type parameter declarations' can only be used in a .ts file.",
|
||||
code: 8004
|
||||
}]);
|
||||
verify.baselineSyntacticDiagnostics();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()
|
||||
@@ -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()
|
||||
Reference in New Issue
Block a user