_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/fourslash/recursiveInternalModuleImport.ts_0_161
/// <reference path="fourslash.ts" /> //// module M { //// import A = B; //// import /**/B = A; //// } //// goTo.marker(); verify.quickInfoExists();
{ "end_byte": 161, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/recursiveInternalModuleImport.ts" }
TypeScript/tests/cases/fourslash/findAllRefsInClassExpression.ts_0_179
/// <reference path='fourslash.ts'/> ////interface I { /*0*/boom(): void; } ////new class C implements I { //// /*1*/boom(){} ////} verify.baselineFindAllReferences('0', '1')
{ "end_byte": 179, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsInClassExpression.ts" }
TypeScript/tests/cases/fourslash/renameForDefaultExport03.ts_0_573
/// <reference path='fourslash.ts'/> ////[|function /*1*/[|{| "contextRangeIndex": 0 |}f|]() { //// return 100; ////}|] //// ////[|export default /*2*/[|{| "contextRangeIndex": 2 |}f|];|] //// ////var x: typeof /*3*/[|f|]; //// ////var y = /*4*/[|f|](); //// /////** //// * Commenting [|{| "inComment": true |}f|] //// */ ////[|namespace /*5*/[|{| "contextRangeIndex": 7 |}f|] { //// var local = 100; ////}|] const ranges = test.rangesByText().get("f"); verify.baselineRename(ranges.filter(r => !(r.marker && r.marker.data.inComment)), { findInComments: true, });
{ "end_byte": 573, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameForDefaultExport03.ts" }
TypeScript/tests/cases/fourslash/formatAfterObjectLiteral.ts_0_180
/// <reference path='fourslash.ts' /> /////**/module Default{var x= ( { } ) ;} format.document(); goTo.marker(); verify.currentLineContentIs('module Default { var x = ({}); }');
{ "end_byte": 180, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatAfterObjectLiteral.ts" }
TypeScript/tests/cases/fourslash/quickInfoOnArgumentsInsideFunction.ts_0_168
/// <reference path='fourslash.ts'/> ////function foo(x: string) { //// return /*1*/arguments; ////} verify.quickInfoAt("1", "(local var) arguments: IArguments");
{ "end_byte": 168, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnArgumentsInsideFunction.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType79.ts_0_423
/// <reference path='fourslash.ts' /> //// type B = string; //// type C = number; //// type A = { a: string } | /*1*/B | C/*2*/; goTo.select("1", "2"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `type B = string; type C = number; type /*RENAME*/NewType = B | C; type A = { a: string } | NewType;`, });
{ "end_byte": 423, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType79.ts" }
TypeScript/tests/cases/fourslash/breakpointValidationLabeled.ts_0_184
/// <reference path='fourslash.ts' /> // @BaselineFile: bpSpan_labeled.baseline // @Filename: bpSpan_labeled.ts ////x: ////var b = 10; verify.baselineCurrentFileBreakpointLocations();
{ "end_byte": 184, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationLabeled.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceSomePropertiesPresent.ts_0_536
/// <reference path='fourslash.ts' /> //// //// interface I { //// x: number; //// y: number; //// z: number & { __iBrand: any }; //// } //// //// class C implements I {[| //// |]constructor(public x: number) { } //// y: number; //// } verify.codeFix({ description: "Implement interface 'I'", newFileContent:` interface I { x: number; y: number; z: number & { __iBrand: any }; } class C implements I { constructor(public x: number) { } z: number & { __iBrand: any; }; y: number; }`, });
{ "end_byte": 536, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceSomePropertiesPresent.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFix_fileWithNoTrailingNewline.ts_0_309
/// <reference path="fourslash.ts" /> // @Filename: /a.ts ////export const foo = 0; // @Filename: /b.ts ////export const bar = 0; // @Filename: /c.ts ////foo; ////import { bar } from "./b"; goTo.file("/c.ts"); verify.importFixAtPosition([ `foo; import { foo } from "./a"; import { bar } from "./b";`, ]);
{ "end_byte": 309, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_fileWithNoTrailingNewline.ts" }
TypeScript/tests/cases/fourslash/getJavaScriptCompletions22.ts_0_241
/// <reference path="fourslash.ts" /> // Regresion test for GH#45436 // @allowNonTsExtensions: true // @Filename: file.js //// const abc = {}; //// ({./*1*/}); goTo.marker('1'); edit.insert('.'); verify.completions({ exact: undefined });
{ "end_byte": 241, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptCompletions22.ts" }
TypeScript/tests/cases/fourslash/jsdocDeprecated_suggestion14.ts_0_644
/// <reference path="fourslash.ts" /> // @module: esnext // @filename: /a.ts ////export const a = 1; ////export const b = 1; // @filename: /b.ts ////export { //// /** @deprecated a is deprecated */ //// a ////} from "./a"; // @filename: /c.ts ////import { [|a|] } from "./b"; ////[|a|] goTo.file("/c.ts") verify.getSuggestionDiagnostics([ { "code": 6385, "message": "'a' is deprecated.", "reportsDeprecated": true, "range": test.ranges()[0] }, { "code": 6385, "message": "'a' is deprecated.", "reportsDeprecated": true, "range": test.ranges()[1] }, ]);
{ "end_byte": 644, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocDeprecated_suggestion14.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingNew.ts_0_218
/// <reference path='fourslash.ts' /> ////class C { ////} ////var c = C(); verify.codeFix({ description: "Add missing 'new' operator to call", index: 0, newFileContent: `class C { } var c = new C();` });
{ "end_byte": 218, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingNew.ts" }
TypeScript/tests/cases/fourslash/completionImportModuleSpecifierEndingTsxPreserve.ts_0_448
/// <reference path='fourslash.ts'/> //@jsx:preserve //@Filename:test.tsx //// export class Test { } //@Filename:module.tsx ////import { Test } from ".//**/" verify.completions({ marker: "", includes:{name:"test.jsx"}, preferences: {importModuleSpecifierEnding: "js"}, isNewIdentifierLocation: true}); verify.completions({ marker: "", includes:{name:"test"}, preferences: {importModuleSpecifierEnding: "index" }, isNewIdentifierLocation: true});
{ "end_byte": 448, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionImportModuleSpecifierEndingTsxPreserve.ts" }
TypeScript/tests/cases/fourslash/referencesBloomFilters3.ts_0_289
/// <reference path='fourslash.ts'/> // Ensure BloomFilter building logic is correct, by having one reference per file // @Filename: declaration.ts ////enum Test { /*1*/"/*2*/42" = 1 }; // @Filename: expression.ts ////(Test[/*3*/42]); verify.baselineFindAllReferences('1', '2', '3');
{ "end_byte": 289, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesBloomFilters3.ts" }
TypeScript/tests/cases/fourslash/getOccurrencesSwitchCaseDefault4.ts_0_329
/// <reference path='fourslash.ts' /> ////foo: [|switch|] (10) { //// [|case|] 1: //// [|case|] 2: //// [|case|] 3: //// [|break|]; //// [|break|] foo; //// co/*1*/ntinue; //// contin/*2*/ue foo; ////} verify.baselineDocumentHighlights(); verify.baselineDocumentHighlights(test.markers());
{ "end_byte": 329, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesSwitchCaseDefault4.ts" }
TypeScript/tests/cases/fourslash/completionListInUnclosedFunction01.ts_3_186
/ <reference path="fourslash.ts" /> ////function foo(x: string, y: number, z: boolean) { //// /*1*/ //// verify.completions({ marker: "1", includes: ["foo", "x", "y", "z"] });
{ "end_byte": 186, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedFunction01.ts" }
TypeScript/tests/cases/fourslash/convertToEs6Class_emptyCatchClause.ts_0_396
/// <reference path='fourslash.ts' /> // @allowNonTsExtensions: true // @Filename: /a.js ////function /**/MyClass() {} ////MyClass.prototype.foo = function() { //// try {} catch() {} ////} verify.codeFix({ description: "Convert function to an ES2015 class", index: 0, newFileContent: `class MyClass { constructor() { } foo() { try { } catch () { } } } `, });
{ "end_byte": 396, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/convertToEs6Class_emptyCatchClause.ts" }
TypeScript/tests/cases/fourslash/extract-method44.ts_0_277
/// <reference path='fourslash.ts' /> ////function foo() { //// let x = [1, 2, 3]; //// let y = x.map(e => /*a*/e + e/*b*/); ////} goTo.select("a", "b"); verify.not.refactorAvailable("Extract Symbol", "function_scope_0", "Extract to inner function in arrow function");
{ "end_byte": 277, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method44.ts" }
TypeScript/tests/cases/fourslash/moveToFile_expandSelectionRange3.ts_0_486
/// <reference path='fourslash.ts' /> //@Filename: /bar.ts ////import { b } from './other'; ////const t = b; // @Filename: /a.ts ////[|const a = 1; ////const b = 1;|] ////function foo() { } // @Filename: /other.ts ////export const b = 2; verify.moveToFile({ newFileContents: { "/a.ts": `function foo() { }`, "/bar.ts": `import { b } from './other'; const t = b; const a = 1; const b = 1; `, }, interactiveRefactorArguments: { targetFile: "/bar.ts" } });
{ "end_byte": 486, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_expandSelectionRange3.ts" }
TypeScript/tests/cases/fourslash/inlayHintsInteractiveInferredTypePredicate1.ts_0_257
/// <reference path="fourslash.ts" /> // @strict: true //// function test(x: unknown) { //// return typeof x === 'number'; //// } verify.baselineInlayHints(undefined, { interactiveInlayHints: true, includeInlayFunctionLikeReturnTypeHints: true, });
{ "end_byte": 257, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlayHintsInteractiveInferredTypePredicate1.ts" }
TypeScript/tests/cases/fourslash/callHierarchyJsxElement.ts_0_269
/// <reference path="fourslash.ts" /> // @jsx: preserve // @filename: main.tsx //// function foo() { //// return <Bar/>; //// } //// //// function /**/Bar() { //// baz(); //// } //// //// function baz() { //// } goTo.marker(); verify.baselineCallHierarchy();
{ "end_byte": 269, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/callHierarchyJsxElement.ts" }
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_Single_Decl.ts_0_372
/// <reference path='fourslash.ts' /> //// const foo = /*x*/f/*y*/unction() { //// let bar; //// }; goTo.select("x", "y"); edit.applyRefactor({ refactorName: "Convert arrow function or function expression", actionName: "Convert to arrow function", actionDescription: "Convert to arrow function", newContent: `const foo = () => { let bar; };`, });
{ "end_byte": 372, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_Single_Decl.ts" }
TypeScript/tests/cases/fourslash/renameParameterPropertyDeclaration4.ts_3_294
/ <reference path='fourslash.ts'/> //// class Foo { //// constructor([|protected { [|{| "contextRangeIndex": 0 |}protectedParam|] }|]) { //// let myProtectedParam = [|protectedParam|]; //// } //// } const [r0Def, r0, r1] = test.ranges(); verify.baselineRename([r0, r1]);
{ "end_byte": 294, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameParameterPropertyDeclaration4.ts" }
TypeScript/tests/cases/fourslash/docCommentTemplateVariableStatements01.ts_0_789
/// <reference path='fourslash.ts' /> /////*a*/ ////var a = 10; //// /////*b*/ ////let b = ""; //// /////*c*/ ////const c = 30; //// /////*d*/ ////let d = { //// foo: 10, //// bar: "20" ////}; //// /////*e*/ ////let e = function e(x, y, z) { //// return +(x + y + z); ////}; //// /////*f*/ ////let f = class F { //// constructor(a, b, c) { //// this.a = a; //// this.b = b || (this.c = c); //// } ////} for (const varName of ["a", "b", "c", "d"]) { verify.docCommentTemplateAt(varName, /*newTextOffset*/ 3, "/** */"); } verify.docCommentTemplateAt("e", /*newTextOffset*/ 7, `/** * * @param x * @param y * @param z * @returns */`); verify.docCommentTemplateAt("f", /*newTextOffset*/ 7, `/** * * @param a * @param b * @param c */`);
{ "end_byte": 789, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateVariableStatements01.ts" }
TypeScript/tests/cases/fourslash/completionsImport_jsxOpeningTagImportDefault.ts_0_791
/// <reference path="fourslash.ts" /> // @module: commonjs // @jsx: react // @Filename: /component.tsx //// export default function (props: any) {} // @Filename: /index.tsx //// export function Index() { //// return <Component/**/ //// } goTo.marker(""); verify.completions({ marker: "", includes: { name: "Component", source: "/component", hasAction: true, sortText: completion.SortText.AutoImportSuggestions, }, excludes: "component", preferences: { includeCompletionsForModuleExports: true, }, }); verify.applyCodeActionFromCompletion("", { name: "Component", source: "/component", description: `Add import from "./component"`, newFileContent: `import Component from "./component"; export function Index() { return <Component }`, });
{ "end_byte": 791, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_jsxOpeningTagImportDefault.ts" }
TypeScript/tests/cases/fourslash/completionsDiscriminatedUnion.ts_0_216
/// <reference path="fourslash.ts" /> ////interface A { kind: "a"; a: number; } ////interface B { kind: "b"; b: number; } ////const c: A | B = { kind: "a", /**/ }; verify.completions({ marker: "", exact: ["a"] });
{ "end_byte": 216, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsDiscriminatedUnion.ts" }
TypeScript/tests/cases/fourslash/formatDocumentWithTrivia.ts_0_505
/// <reference path="fourslash.ts" /> //// ////// 1 below //// ////// 2 above //// ////let x; //// ////// abc //// ////let y; //// ////// 3 above //// ////while (true) { //// while (true) { //// } //// //// // 4 above ////} //// ////// 5 above //// //// format.document(); verify.currentFileContentIs(` // 1 below // 2 above let x; // abc let y; // 3 above while (true) { while (true) { } // 4 above } // 5 above `);
{ "end_byte": 505, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatDocumentWithTrivia.ts" }
TypeScript/tests/cases/fourslash/extract-method15.ts_0_588
/// <reference path='fourslash.ts' /> // Extracting an increment expression (not statement) should do the right thing, // including not generating extra destructuring unless needed //// function foo() { //// var i = 10; //// /*a*/i++/*b*/; //// } goTo.select('a', 'b'); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "function_scope_1", actionDescription: "Extract to function in global scope", newContent: `function foo() { var i = 10; i = /*RENAME*/newFunction(i); } function newFunction(i: number) { i++; return i; } ` });
{ "end_byte": 588, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method15.ts" }
TypeScript/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics16.ts_0_139
/// <reference path="fourslash.ts" /> // @allowJs: true // @Filename: a.js ////function F(p?) { } verify.baselineSyntacticDiagnostics();
{ "end_byte": 139, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics16.ts" }
TypeScript/tests/cases/fourslash/formatSelectionJsxWithBinaryExpression.ts_0_876
/// <reference path="fourslash.ts" /> //@Filename: file.tsx //// function TestWidget() { //// const test = true; //// return ( //// <div> //// {test && //// <div> //// /*1*/ <div>some text</div>/*2*/ //// <div>some text</div> //// <div>some text</div> //// </div> //// } //// <div>some text</div> //// </div> //// ); //// } format.selection("1", "2"); verify.currentFileContentIs( `function TestWidget() { const test = true; return ( <div> {test && <div> <div>some text</div> <div>some text</div> <div>some text</div> </div> } <div>some text</div> </div> ); }`)
{ "end_byte": 876, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatSelectionJsxWithBinaryExpression.ts" }
TypeScript/tests/cases/fourslash/completionAutoInsertQuestionDot.ts_0_620
/// <reference path="fourslash.ts" /> // @strict: true //// interface User { //// address?: { //// city: string; //// "postal code": string; //// } //// }; //// declare const user: User; //// user.address[|./**/|] verify.completions({ marker: "", exact: [ { name: "city", text: "(property) city: string", insertText: "?.city", replacementSpan: test.ranges()[0] }, { name: "postal code", text: "(property) \"postal code\": string", insertText: "?.[\"postal code\"]", replacementSpan: test.ranges()[0] } ], preferences: { includeInsertTextCompletions: true }, });
{ "end_byte": 620, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionAutoInsertQuestionDot.ts" }
TypeScript/tests/cases/fourslash/refactorConvertToEsModule_export_moduleDotExports_changesImports.ts_0_448
/// <reference path='fourslash.ts' /> // @allowJs: true // @target: esnext // @Filename: /a.js ////module.exports = 0; // @Filename: /b.ts ////import a = require("./a"); // @Filename: /c.js ////const a = require("./a"); verify.codeFix({ description: "Convert to ES module", newFileContent: { "/a.js": "export default 0;", "/b.ts": 'import a from "./a";', "/c.js": 'const a = require("./a").default;', } });
{ "end_byte": 448, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToEsModule_export_moduleDotExports_changesImports.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementClassFunctionVoidInferred.ts_0_324
/// <reference path='fourslash.ts' /> ////class A { //// f() {} ////} //// ////class B implements A {[| |]} verify.codeFix({ description: "Implement interface 'A'", newFileContent: `class A { f() {} } class B implements A { f(): void { throw new Error("Method not implemented."); } }`, });
{ "end_byte": 324, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementClassFunctionVoidInferred.ts" }
TypeScript/tests/cases/fourslash/convertFunctionToEs6Class-prototypeMethod.ts_0_506
// @allowNonTsExtensions: true // @Filename: test123.js /// <reference path="./fourslash.ts" /> //// // Comment //// function /*1*/fn() { //// this.baz = 10; //// } //// fn.prototype = { //// bar() { //// console.log('hello world'); //// } //// } verify.codeFix({ description: "Convert function to an ES2015 class", newFileContent: `// Comment class fn { constructor() { this.baz = 10; } bar() { console.log('hello world'); } } `, });
{ "end_byte": 506, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/convertFunctionToEs6Class-prototypeMethod.ts" }
TypeScript/tests/cases/fourslash/organizeImports3.ts_0_269
/// <reference path="fourslash.ts" /> // Regression test for bug #41417 //// import { //// Bar //// , Foo //// } from "foo" //// //// console.log(Foo, Bar); verify.organizeImports( `import { Bar, Foo } from "foo"; console.log(Foo, Bar);`);
{ "end_byte": 269, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImports3.ts" }
TypeScript/tests/cases/fourslash/signatureHelpCommentsCommentParsing.ts_0_6002
/// <reference path='fourslash.ts' /> /////// This is simple /// comments ////function simple() { ////} //// ////simple( /*1*/); //// /////// multiLine /// Comments /////// This is example of multiline /// comments /////// Another multiLine ////function multiLine() { ////} ////multiLine( /*2*/); //// /////** this is eg of single line jsdoc style comment */ ////function jsDocSingleLine() { ////} ////jsDocSingleLine(/*3*/); //// //// /////** this is multiple line jsdoc stule comment ////*New line1 ////*New Line2*/ ////function jsDocMultiLine() { ////} ////jsDocMultiLine(/*4*/); //// /////** multiple line jsdoc comments no longer merge ////*New line1 ////*New Line2*/ /////** Shoul mege this line as well ////* and this too*/ /** Another this one too*/ ////function jsDocMultiLineMerge() { ////} ////jsDocMultiLineMerge(/*5*/); //// //// /////// Triple slash comment /////** jsdoc comment */ ////function jsDocMixedComments1() { ////} ////jsDocMixedComments1(/*6*/); //// /////// Triple slash comment /////** jsdoc comment */ /** another jsDocComment*/ ////function jsDocMixedComments2() { ////} ////jsDocMixedComments2(/*7*/); //// /////** jsdoc comment */ /*** triplestar jsDocComment*/ /////// Triple slash comment ////function jsDocMixedComments3() { ////} ////jsDocMixedComments3(/*8*/); //// /////** jsdoc comment */ /** another jsDocComment*/ /////// Triple slash comment /////// Triple slash comment 2 ////function jsDocMixedComments4() { ////} ////jsDocMixedComments4(/*9*/); //// /////// Triple slash comment 1 /////** jsdoc comment */ /** another jsDocComment*/ /////// Triple slash comment /////// Triple slash comment 2 ////function jsDocMixedComments5() { ////} ////jsDocMixedComments5(/*10*/); //// /////** another jsDocComment*/ /////// Triple slash comment 1 /////// Triple slash comment /////// Triple slash comment 2 /////** jsdoc comment */ ////function jsDocMixedComments6() { ////} ////jsDocMixedComments6(/*11*/); //// ////// This shoulnot be help comment ////function noHelpComment1() { ////} ////noHelpComment1(/*12*/); //// /////* This shoulnot be help comment */ ////function noHelpComment2() { ////} ////noHelpComment2(/*13*/); //// ////function noHelpComment3() { ////} ////noHelpComment3(/*14*/); /////** Adds two integers and returns the result //// * @param {number} a first number //// * @param b second number //// */ ////function sum(a: number, b: number) { //// return a + b; ////} ////sum(/*16*/10, /*17*/20); /////** This is multiplication function //// * @param //// * @param a first number //// * @param b //// * @param c { //// @param d @anotherTag //// * @param e LastParam @anotherTag*/ ////function multiply(a: number, b: number, c?: number, d?, e?) { ////} ////multiply(/*19*/10,/*20*/ 20,/*21*/ 30, /*22*/40, /*23*/50); /////** fn f1 with number ////* @param { string} b about b ////*/ ////function f1(a: number); ////function f1(b: string); /////**@param opt optional parameter*/ ////function f1(aOrb, opt?) { //// return aOrb; ////} ////f1(/*25*/10); ////f1(/*26*/"hello"); //// /////** This is subtract function ////@param { a ////*@param { number | } b this is about b ////@param { { () => string; } } c this is optional param c ////@param { { () => string; } d this is optional param d ////@param { { () => string; } } e this is optional param e ////@param { { { () => string; } } f this is optional param f ////*/ ////function subtract(a: number, b: number, c?: () => string, d?: () => string, e?: () => string, f?: () => string) { ////} ////subtract(/*28*/10, /*29*/ 20, /*30*/ null, /*31*/ null, /*32*/ null, /*33*/null); /////** this is square function ////@paramTag { number } a this is input number of paramTag ////@param { number } a this is input number ////@returnType { number } it is return type ////*/ ////function square(a: number) { //// return a * a; ////} ////square(/*34*/10); /////** this is divide function ////@param { number} a this is a ////@paramTag { number } g this is optional param g ////@param { number} b this is b ////*/ ////function divide(a: number, b: number) { ////} ////divide(/*35*/10, /*36*/20); /////** ////Function returns string concat of foo and bar ////@param {string} foo is string ////@param {string} bar is second string ////*/ ////function fooBar(foo: string, bar: string) { //// return foo + bar; ////} ////fooBar(/*37*/"foo",/*38*/"bar"); /////** This is a comment */ ////var x; /////** //// * This is a comment //// */ ////var y; /////** this is jsdoc style function with param tag as well as inline parameter help ////*@param a it is first parameter ////*@param c it is third parameter ////*/ ////function jsDocParamTest(/** this is inline comment for a */a: number, /** this is inline comment for b*/ b: number, c: number, d: number) { //// return /*39*/a + b + c + d; ////} ////jsDocParamTest(/*40*/30, /*41*/40, /*42*/50, /*43*/60); /////** This is function comment //// * And properly aligned comment //// */ ////function jsDocCommentAlignmentTest1() { ////} ////jsDocCommentAlignmentTest1(/*45*/); /////** This is function comment //// * And aligned with 4 space char margin //// */ ////function jsDocCommentAlignmentTest2() { ////} ////jsDocCommentAlignmentTest2(/*46*/); /////** This is function comment //// * And aligned with 4 space char margin //// * @param {string} a this is info about a //// * spanning on two lines and aligned perfectly //// * @param b this is info about b //// * spanning on two lines and aligned perfectly //// * spanning one more line alined perfectly //// * spanning another line with more margin //// * @param c this is info about b //// * not aligned text about parameter will eat only one space //// */ ////function jsDocCommentAlignmentTest3(a: string, b, c) { ////} ////jsDocCommentAlignmentTest3(/*47*/"hello",/*48*/1, /*49*/2); /////**/ ////class NoQuickInfoClass { ////} verify.baselineSignatureHelp()
{ "end_byte": 6002, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpCommentsCommentParsing.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceMemberOrdering.ts_0_1060
/// <reference path='fourslash.ts' /> // @lib: es2017 /////** asdf */ ////interface I { //// 1; //// 2; //// 3; //// 4; //// 5; //// 6; //// 7; //// 8; //// 9; //// 10; //// 11; //// 12; //// 13; //// 14; //// 15; //// 16; //// 17; //// 18; //// 19; //// 20; //// 21; //// 22; //// /** a nice safe prime */ //// 23; ////} ////class C implements I {} verify.codeFix({ description: "Implement interface 'I'", newFileContent: `/** asdf */ interface I { 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; /** a nice safe prime */ 23; } class C implements I { 1: any; 2: any; 3: any; 4: any; 5: any; 6: any; 7: any; 8: any; 9: any; 10: any; 11: any; 12: any; 13: any; 14: any; 15: any; 16: any; 17: any; 18: any; 19: any; 20: any; 21: any; 22: any; 23: any; }`, });
{ "end_byte": 1060, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceMemberOrdering.ts" }
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_Availability_Anon_usedName.ts_0_1946
/// <reference path='fourslash.ts' /> //// /*z*/c/*y*/onst /*x*/f/*w*/oo = /*v*/f/*u*/unction isEven(n) /*t*/{/*s*/ /*r*/r/*q*/eturn n === 0 ? true : n === 1 ? false : isEven(n - 2);}; goTo.select("z", "y"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to named function"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function"); goTo.select("x", "w"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to named function"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function"); goTo.select("v", "u"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to named function"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function"); goTo.select("t", "s"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to named function"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function"); goTo.select("r", "q"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to named function"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function"); verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
{ "end_byte": 1946, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_Availability_Anon_usedName.ts" }
TypeScript/tests/cases/fourslash/completionListInTypedObjectLiteralsWithPartialPropertyNames.ts_0_445
/// <reference path="fourslash.ts" /> ////interface MyPoint { //// x1: number; //// y1: number; ////} ////var p15: MyPoint = { //// /**/ ////}; verify.completions({ marker: "", exact: ["x1", "y1"] }); // x| edit.insert("x"); verify.completions({ exact: ["x1", "y1"] }); // x1| edit.insert("1"); verify.completions({ exact: ["x1", "y1"] }) // x1: null,| edit.insert(": null,"); verify.completions({ exact: ["y1"] });
{ "end_byte": 445, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInTypedObjectLiteralsWithPartialPropertyNames.ts" }
TypeScript/tests/cases/fourslash/getJavaScriptCompletions16.ts_0_887
/// <reference path="fourslash.ts" /> // @allowNonTsExtensions: true // @Filename: file.js //// "use strict"; //// //// class Something { //// //// /** //// * @param {number} a //// */ //// constructor(a, b) { //// a/*body*/ //// } //// //// /** //// * @param {number} a //// */ //// method(a) { //// a/*method*/ //// } //// } //// let x = new Something(/*sig*/); goTo.marker('body'); edit.insert('.'); verify.completions({ includes: { name: "toFixed", kind: "method", kindModifiers: "declare" } }); edit.backspace(); verify.signatureHelp({ marker: "sig", text: "Something(a: number, b: any): Something", tags: [{ name: "param", text: [{ kind: "text", text: "a" }] }], }); goTo.marker('method'); edit.insert('.'); verify.completions({ includes: { name: "toFixed", kind: "method", kindModifiers: "declare" } });
{ "end_byte": 887, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptCompletions16.ts" }
TypeScript/tests/cases/fourslash/jsdocDeprecated_suggestion20.ts_0_742
///<reference path="fourslash.ts" /> // @module: esnext // @filename: /a.ts ////export default function a() {} // @filename: /b.ts ////import _a from "./a"; ////export { //// /** @deprecated a is deprecated */ //// _a as a, ////}; /////** @deprecated b is deprecated */ ////export const b = (): void => {}; // @filename: /c.ts ////import * as _ from "./b"; //// ////_.[|a|]() ////_.[|b|]() goTo.file("/c.ts") verify.getSuggestionDiagnostics([ { "code": 6385, "message": "'a' is deprecated.", "reportsDeprecated": true, "range": test.ranges()[0] }, { "code": 6385, "message": "'b' is deprecated.", "reportsDeprecated": true, "range": test.ranges()[1] }, ]);
{ "end_byte": 742, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocDeprecated_suggestion20.ts" }
TypeScript/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateParenthFromStr.ts_0_411
/// <reference path='fourslash.ts' /> //// const foo = "foobar is " + (/*x*/42/*y*/ + 6 + "str") + " years old" goTo.select("x", "y"); edit.applyRefactor({ refactorName: "Convert to template string", actionName: "Convert to template string", actionDescription: ts.Diagnostics.Convert_to_template_string.message, newContent: `const foo = "foobar is " + (\`\${42 + 6}str\`) + " years old"`, });
{ "end_byte": 411, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateParenthFromStr.ts" }
TypeScript/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts_0_1122
/// <reference path="fourslash.ts"/> ////export class Bar { //// public s: string; ////} verify.navigationTree({ "text": "\"navigationBarItemsItemsExternalModules\"", "kind": "module", "childItems": [ { "text": "Bar", "kind": "class", "kindModifiers": "export", "childItems": [ { "text": "s", "kind": "property", "kindModifiers": "public" } ] } ] }); verify.navigationBar([ { "text": "\"navigationBarItemsItemsExternalModules\"", "kind": "module", "childItems": [ { "text": "Bar", "kind": "class", "kindModifiers": "export" } ] }, { "text": "Bar", "kind": "class", "kindModifiers": "export", "childItems": [ { "text": "s", "kind": "property", "kindModifiers": "public" } ], "indent": 1 } ]);
{ "end_byte": 1122, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts" }
TypeScript/tests/cases/fourslash/codeFixOverrideModifier9.ts_0_365
/// <reference path='fourslash.ts' /> // @noImplicitOverride: true //// class B { //// a: string //// } //// class D extends B { //// constructor([|public a: string|], public b: string) { //// super(); //// } //// } verify.codeFix({ description: "Add 'override' modifier", newRangeContent: "public override a: string", index: 0 })
{ "end_byte": 365, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixOverrideModifier9.ts" }
TypeScript/tests/cases/fourslash/getEmitOutputExternalModule2.ts_0_498
/// <reference path="fourslash.ts" /> // @BaselineFile: getEmitOutputExternalModule2.baseline // @outFile: declSingleFile.js // @Filename: inputFile1.ts //// var x: number = 5; //// class Bar { //// x : string; //// y : number //// } // @Filename: inputFile2.ts // @emitThisFile: true //// var x: string = "world"; //// class Bar2 { //// x : string; //// y : number //// } // @Filename: inputFile3.ts //// export module M { //// class C {c} //// } verify.baselineGetEmitOutput();
{ "end_byte": 498, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEmitOutputExternalModule2.ts" }
TypeScript/tests/cases/fourslash/jsxAttributeCompletionStyleDefault.ts_0_1844
/// <reference path="fourslash.ts" /> // @Filename: foo.tsx //// declare namespace JSX { //// interface Element { } //// interface IntrinsicElements { //// foo: { //// prop_a: boolean; //// prop_b: string; //// prop_c: any; //// prop_d: { p1: string; } //// prop_e: string | undefined; //// prop_f: boolean | undefined | { p1: string; }; //// prop_g: { p1: string; } | undefined; //// prop_h?: string; //// prop_i?: boolean; //// prop_j?: { p1: string; }; //// } //// } //// } //// //// <foo [|prop_/**/|] /> verify.completions({ marker: "", exact: [ { name: "prop_a", isSnippet: undefined, }, { name: "prop_b", isSnippet: undefined, }, { name: "prop_c", isSnippet: undefined, }, { name: "prop_d", isSnippet: undefined, }, { name: "prop_e", isSnippet: undefined, }, { name: "prop_f", isSnippet: undefined, }, { name: "prop_g", isSnippet: undefined, }, { name: "prop_h", isSnippet: undefined, sortText: completion.SortText.OptionalMember, }, { name: "prop_i", isSnippet: undefined, sortText: completion.SortText.OptionalMember, }, { name: "prop_j", isSnippet: undefined, sortText: completion.SortText.OptionalMember, } ], preferences: { jsxAttributeCompletionStyle: undefined, includeCompletionsWithSnippetText: true } });
{ "end_byte": 1844, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsxAttributeCompletionStyleDefault.ts" }
TypeScript/tests/cases/fourslash/spaceAfterConstructor.ts_0_325
/// <reference path='fourslash.ts' /> ////export class myController { //// private _processId; //// constructor (processId: number) {/*1*/ //// this._processId = processId; //// }/*2*/ goTo.marker('2'); edit.insert('}'); goTo.marker('1'); verify.currentLineContentIs(' constructor(processId: number) {');
{ "end_byte": 325, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/spaceAfterConstructor.ts" }
TypeScript/tests/cases/fourslash/genericParameterHelpConstructorCalls.ts_0_1034
/// <reference path="fourslash.ts"/> ////interface IFoo { } //// ////class testClass<T extends IFoo, U, M extends IFoo> { //// constructor(a:T, b:U, c:M){ } ////} //// ////// Constructor calls ////new testClass</*constructor1*/ ////new testClass<IFoo, /*constructor2*/ ////new testClass</*constructor3*/>(null, null, null) ////new testClass<,,/*constructor4*/>(null, null, null) ////new testClass<IFoo,/*constructor5*/IFoo,IFoo>(null, null, null) verify.signatureHelp( { marker: "constructor1", text: "testClass<T extends IFoo, U, M extends IFoo>(a: T, b: U, c: M): testClass<T, U, M>", parameterName: "T", parameterSpan: "T extends IFoo", }, { marker: "constructor2", parameterName: "U", parameterSpan: "U", }, { marker: "constructor3", parameterName: "T", parameterSpan: "T extends IFoo" }, { marker: "constructor4", parameterName: "M", parameterSpan: "M extends IFoo" }, { marker: "constructor5", parameterName: "U", parameterSpan: "U" }, );
{ "end_byte": 1034, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/genericParameterHelpConstructorCalls.ts" }
TypeScript/tests/cases/fourslash/formatMultilineExtendsGeneric.ts_0_171
/// <reference path="fourslash.ts" /> //// class Favorite extends Array< //// string //// > { //// private foo = 2 //// } verify.formatDocumentChangesNothing();
{ "end_byte": 171, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatMultilineExtendsGeneric.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFix_order.ts_0_391
/// <reference path="fourslash.ts" /> // @Filename: /a.ts ////export const foo: number; // @Filename: /b.ts ////export const foo: number; ////export const bar: number; // @Filename: /c.ts ////[|import { bar } from "./b"; ////foo;|] goTo.file("/c.ts"); verify.importFixAtPosition([ `import { bar, foo } from "./b"; foo;`, `import { foo } from "./a"; import { bar } from "./b"; foo;`, ]);
{ "end_byte": 391, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_order.ts" }
TypeScript/tests/cases/fourslash/jsDocFunctionSignatures2.ts_0_288
///<reference path="fourslash.ts" /> // @allowNonTsExtensions: true // @Filename: Foo.js //// /** @type {function(string, boolean=): number} */ //// var f6; //// //// f6('', /**/false) verify.signatureHelp({ marker: "", text: "f6(arg0: string, arg1?: boolean | undefined): number" });
{ "end_byte": 288, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocFunctionSignatures2.ts" }
TypeScript/tests/cases/fourslash/formatObjectBindingPattern.ts_0_157
///<reference path="fourslash.ts"/> ////const { ////x, ////y, ////} = 0; format.document(); verify.currentFileContentIs( `const { x, y, } = 0;` );
{ "end_byte": 157, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatObjectBindingPattern.ts" }
TypeScript/tests/cases/fourslash/unusedVariableInForLoop1FS.ts_0_253
/// <reference path='fourslash.ts' /> // @noUnusedLocals: true //// function f1 () { //// [|for(var i = 0; ;) |]{ //// //// } //// } verify.codeFix({ description: "Remove unused declaration for: 'i'", newRangeContent: "for(; ;) ", });
{ "end_byte": 253, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedVariableInForLoop1FS.ts" }
TypeScript/tests/cases/fourslash/getOccurrencesIfElse3.ts_0_438
/// <reference path='fourslash.ts' /> ////if (true) { //// if (false) { //// } //// else { //// } //// [|if|] (true) { //// } //// [|else|] { //// if (false) //// if (true) //// var x = undefined; //// } ////} ////else if (null) { ////} ////else /* whar garbl */ if (undefined) { ////} ////else ////if (false) { ////} ////else { } verify.baselineDocumentHighlights();
{ "end_byte": 438, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesIfElse3.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingEnumMember12.ts_0_305
/// <reference path='fourslash.ts' /> ////const x; // this is x //// ////// this is E ////enum E { ////} ////E.a verify.codeFix({ index: 0, description: [ts.Diagnostics.Add_missing_enum_member_0.message, "a"], newFileContent: `const x; // this is x // this is E enum E { a } E.a` });
{ "end_byte": 305, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingEnumMember12.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties29.ts_0_563
/// <reference path="fourslash.ts" /> ////namespace Foo.Bar { //// export enum E { //// E1 = 0, //// E2 = 1, //// } //// export interface Baz { //// prop1: string; //// prop2: number; //// prop3: E.E1; //// prop4: Foo.Bar.E.E1; //// } ////} ////[|const foo: Foo.Bar.Baz = {}|] verify.codeFix({ index: 0, description: ts.Diagnostics.Add_missing_properties.message, newRangeContent: `const foo: Foo.Bar.Baz = { prop1: "", prop2: 0, prop3: Foo.Bar.E.E1, prop4: Foo.Bar.E.E1 }`, });
{ "end_byte": 563, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties29.ts" }
TypeScript/tests/cases/fourslash/completionListInClosedFunction01.ts_3_180
/ <reference path="fourslash.ts" /> ////function foo(x: string, y: number, z: boolean) { //// /*1*/ ////} verify.completions({ marker: "1", includes: ["x", "y", "z"] });
{ "end_byte": 180, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInClosedFunction01.ts" }
TypeScript/tests/cases/fourslash/completionsClassMembers3.ts_0_209
/// <reference path="fourslash.ts" /> ////interface I { //// method(): void; ////} //// ////export class C implements I { //// property = "foo" + "foo" //// /**/ ////} verify.baselineCompletions();
{ "end_byte": 209, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsClassMembers3.ts" }
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ExpressionStatementValidSpans.ts_0_620
/// <reference path='fourslash.ts' /> ////let a = { b: { c: 0 } }; /////*1a*/let x1 = a && a.b && a.b.c;/*1b*/ ////let x2 = /*2a*/a && a.b && a.b.c;/*2b*/ ////let x3 = /*3a*/a && a.b && a.b.c/*3b*/; ////let x4 = /*4a*/a.b ? a.b.c : "whenFalse"/*4b*/; goTo.select("1a", "1b"); verify.refactorAvailable("Convert to optional chain expression"); goTo.select("2a", "2b"); verify.refactorAvailable("Convert to optional chain expression"); goTo.select("3a", "3b"); verify.refactorAvailable("Convert to optional chain expression"); goTo.select("4a", "4b"); verify.refactorAvailable("Convert to optional chain expression");
{ "end_byte": 620, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ExpressionStatementValidSpans.ts" }
TypeScript/tests/cases/fourslash/completionsImport_filteredByPackageJson_nested.ts_0_1306
/// <reference path="fourslash.ts" /> //@noEmit: true //@Filename: /package.json ////{ //// "dependencies": { //// "react": "*" //// } ////} //@Filename: /node_modules/react/index.d.ts ////export declare var React: any; //@Filename: /node_modules/react/package.json ////{ //// "name": "react", //// "types": "./index.d.ts" ////} //@Filename: /dir/package.json ////{ //// "dependencies": { //// "redux": "*" //// } ////} //@Filename: /dir/node_modules/redux/package.json ////{ //// "name": "redux", //// "types": "./index.d.ts" ////} //@Filename: /dir/node_modules/redux/index.d.ts ////export declare var Redux: any; //@Filename: /dir/index.ts ////const x = Re/**/ verify.completions({ marker: test.marker(""), isNewIdentifierLocation: true, includes: { name: "React", hasAction: true, source: "/node_modules/react/index", sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true } }); verify.completions({ marker: test.marker(""), isNewIdentifierLocation: true, includes: { name: "Redux", hasAction: true, source: "/dir/node_modules/redux/index", sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true } });
{ "end_byte": 1306, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_filteredByPackageJson_nested.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionBuiltInValues.ts_0_267
/// <reference path='fourslash.ts'/> ////var u = /*undefined*/undefined; ////var n = /*null*/null; ////var a = function() { return /*arguments*/arguments; }; ////var t = /*true*/true; ////var f = /*false*/false; verify.baselineGoToDefinition(...test.markerNames());
{ "end_byte": 267, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionBuiltInValues.ts" }
TypeScript/tests/cases/fourslash/completionsPaths_pathMapping.ts_0_891
/// <reference path="fourslash.ts" /> // @Filename: /src/b.ts ////export const x = 0; // @Filename: /src/dir/x.ts /////export const x = 0; // @Filename: /src/a.ts ////import {} from "foo//*0*/"; ////import {} from "foo/dir//*1*/"; // @Filename: /tsconfig.json ////{ //// "compilerOptions": { //// "baseUrl": ".", //// "paths": { //// "foo/*": ["src/*"] //// } //// } ////} const [r0, r1] = test.ranges(); verify.completions( { marker: "0", exact: [ { name: "a", kind: "script", kindModifiers: ".ts" }, { name: "b", kind: "script", kindModifiers: ".ts" }, { name: "dir", kind: "directory" }, ], isNewIdentifierLocation: true, }, { marker: "1", exact: { name: "x", kind: "script", kindModifiers: ".ts" }, isNewIdentifierLocation: true, }, );
{ "end_byte": 891, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsPaths_pathMapping.ts" }
TypeScript/tests/cases/fourslash/completionListForDerivedType1.ts_0_614
/// <reference path='fourslash.ts'/> ////interface IFoo { //// bar(): IFoo; ////} ////interface IFoo2 extends IFoo { //// bar2(): IFoo2; ////} ////var f: IFoo; ////var f2: IFoo2; ////f./*1*/; // completion here shows bar with return type is any ////f2./*2*/ // here bar has return type any, but bar2 is Foo2 verify.completions( { marker: "1", exact: [{ name: "bar", text: "(method) IFoo.bar(): IFoo" }] }, { marker: "2", exact: [ { name: "bar", text: "(method) IFoo.bar(): IFoo" }, { name: "bar2", text: "(method) IFoo2.bar2(): IFoo2" }, ] }, );
{ "end_byte": 614, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListForDerivedType1.ts" }
TypeScript/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts_0_645
/// <reference path='fourslash.ts' /> ////declare var console: { //// log(msg: string): void; ////} ////type Robot = [number, string, string]; ////var robotA: Robot = [1, "mower", "mowing"]; ////var robotB: Robot = [2, "trimmer", "trimming"]; ////let [, nameA = "noName"] = robotA; ////let [numberB = -1] = robotB; ////let [numberA2 = -1, nameA2 = "noName", skillA2 = "noSkill"] = robotA; ////let [numberC2 = -1] = [3, "edging", "Trimming edges"]; ////let [numberC = -1, nameC = "noName", skillC = "noSkill"] = [3, "edging", "Trimming edges"]; ////let [numberA3 = -1, ...robotAInfo] = robotA; verify.baselineCurrentFileBreakpointLocations();
{ "end_byte": 645, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingAwait_propertyAccess2.ts_0_312
/// <reference path="fourslash.ts" /> ////async function fn(a: Promise<{ x: string }>) { //// console.log(3) //// a.x; ////} verify.codeFix({ description: ts.Diagnostics.Add_await.message, index: 0, newFileContent: `async function fn(a: Promise<{ x: string }>) { console.log(3) ;(await a).x; }` });
{ "end_byte": 312, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingAwait_propertyAccess2.ts" }
TypeScript/tests/cases/fourslash/findAllReferencesLinkTag2.ts_0_937
/// <reference path="fourslash.ts" /> //// namespace NPR/*5*/ { //// export class Consider/*4*/ { //// This/*3*/ = class { //// show/*2*/() { } //// } //// m/*1*/() { } //// } //// /** //// * @see {Consider.prototype.m} //// * {@link Consider#m} //// * @see {Consider#This#show} //// * {@link Consider.This.show} //// * @see {NPR.Consider#This#show} //// * {@link NPR.Consider.This#show} //// * @see {NPR.Consider#This.show} # doesn't parse trailing . //// * @see {NPR.Consider.This.show} //// */ //// export function ref() { } //// } //// /** //// * {@link NPR.Consider#This#show hello hello} //// * {@link NPR.Consider.This#show} //// * @see {NPR.Consider#This.show} # doesn't parse trailing . //// * @see {NPR.Consider.This.show} //// */ //// export function outerref() { } verify.baselineFindAllReferences('1', '2', '3', '4', '5')
{ "end_byte": 937, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllReferencesLinkTag2.ts" }
TypeScript/tests/cases/fourslash/codeFixClassExtendAbstractMethod.ts_0_1088
/// <reference path='fourslash.ts' /> // @noImplicitOverride: true ////abstract class A { //// abstract f(a: number, b: string): boolean; //// abstract f(a: number, b: string): this; //// abstract f(a: string, b: number): Function; //// abstract f(a: string): Function; //// abstract foo(): number; ////} //// ////class C extends A {} verify.codeFix({ description: "Implement inherited abstract class", newFileContent: `abstract class A { abstract f(a: number, b: string): boolean; abstract f(a: number, b: string): this; abstract f(a: string, b: number): Function; abstract f(a: string): Function; abstract foo(): number; } class C extends A { override f(a: number, b: string): boolean; override f(a: number, b: string): this; override f(a: string, b: number): Function; override f(a: string): Function; override f(a: unknown, b?: unknown): boolean | Function | this { throw new Error("Method not implemented."); } override foo(): number { throw new Error("Method not implemented."); } }` });
{ "end_byte": 1088, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassExtendAbstractMethod.ts" }
TypeScript/tests/cases/fourslash/codeFixConstructorForDerivedNeedSuperCall_all.ts_0_450
/// <reference path='fourslash.ts' /> ////class C extends Object { //// constructor() {} ////} ////class D extends Object { //// constructor() {} ////} verify.codeFixAll({ fixId: "constructorForDerivedNeedSuperCall", fixAllDescription: "Add all missing super calls", newFileContent: `class C extends Object { constructor() { super(); } } class D extends Object { constructor() { super(); } }`, });
{ "end_byte": 450, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixConstructorForDerivedNeedSuperCall_all.ts" }
TypeScript/tests/cases/fourslash/codeFixAmbientClassImplementClassMethodViaHeritage.ts_0_235
/// <reference path='fourslash.ts' /> //// class C1 { //// f1() {} //// } //// //// class C2 extends C1 { //// //// } //// //// declare class C3 implements C2 {[| //// |]f2(); //// } verify.rangeAfterCodeFix(`f1(): void; `);
{ "end_byte": 235, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAmbientClassImplementClassMethodViaHeritage.ts" }
TypeScript/tests/cases/fourslash/completionForStringLiteralNonrelativeImport14.ts_0_2258
/// <reference path='fourslash.ts' /> // Should give completions for modules referenced via baseUrl and paths compiler options with explicit name mappings // @Filename: tsconfig.json //// { //// "compilerOptions": { //// "baseUrl": "./modules", //// "paths": { //// "/module1": ["some/path/whatever.ts"], //// "/module2": ["some/other/path.ts"] //// } //// } //// } // @Filename: tests/test0.ts //// import * as foo1 from "//*import_as0*/ //// import foo2 = require("//*import_equals0*/ //// var foo3 = require("//*require0*/ // @Filename: some/path/whatever.ts //// export var x = 9; // @Filename: some/other/path.ts //// export var y = 10; verify.completions({ marker: ["import_as0",], exact: ["lib", "lib.decorators", "lib.decorators.legacy", "tests", { name: "/module1", replacementSpan: { fileName: "foo", pos: 23, end: 24 } }, { name: "/module2", replacementSpan: { fileName: "foo", pos: 23, end: 24 } }], isNewIdentifierLocation: true }); verify.completions({ marker: ["import_equals0",], exact: ["lib", "lib.decorators", "lib.decorators.legacy", "tests", { name: "/module1", replacementSpan: { fileName: "foo", pos: 48, end: 49 } }, { name: "/module2", replacementSpan: { fileName: "foo", pos: 48, end: 49 } }], isNewIdentifierLocation: true }); verify.completions({ marker: ["require0",], exact: ["lib", "lib.decorators", "lib.decorators.legacy", "tests", { name: "/module1", replacementSpan: { fileName: "foo", pos: 70, end: 71 } }, { name: "/module2", replacementSpan: { fileName: "foo", pos: 70, end: 71 } }], isNewIdentifierLocation: true });
{ "end_byte": 2258, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteralNonrelativeImport14.ts" }
TypeScript/tests/cases/fourslash/codeFixClassPropertyInitialization10.ts_0_242
/// <reference path='fourslash.ts' /> // @strict: true //// class T { //// a: "a" | 2; //// } verify.codeFix({ description: `Add initializer to property 'a'`, newFileContent: `class T { a: "a" | 2 = "a"; }`, index: 2 })
{ "end_byte": 242, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassPropertyInitialization10.ts" }
TypeScript/tests/cases/fourslash/memberListOfClass.ts_0_402
/// <reference path='fourslash.ts'/> ////class C1 { //// public pubMeth() { } //// private privMeth() { } //// public pubProp = 0; //// private privProp = 0; ////} ////var f = new C1(); ////f./**/ verify.completions({ marker: "", exact: [ { name: "pubMeth", text: "(method) C1.pubMeth(): void" }, { name: "pubProp", text: "(property) C1.pubProp: number" }, ], });
{ "end_byte": 402, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberListOfClass.ts" }
TypeScript/tests/cases/fourslash/javaScriptPrototype1.ts_0_1143
///<reference path="fourslash.ts" /> // Assignments to the 'prototype' property of a function create a class // @allowNonTsExtensions: true // @Filename: myMod.js //// function myCtor(x) { //// } //// myCtor.prototype.foo = function() { return 32 }; //// myCtor.prototype.bar = function() { return '' }; //// //// var m = new myCtor(10); //// m/*1*/ //// var a = m.foo; //// a/*2*/ //// var b = a(); //// b/*3*/ //// var c = m.bar(); //// c/*4*/ // Members of the class instance goTo.marker('1'); edit.insert('.'); verify.completions({ includes: ["foo", "bar"].map(name => ({ name, kind: "method" })) }); edit.backspace(); // Members of a class method (1) goTo.marker('2'); edit.insert('.'); verify.completions({ includes: { name: "length", kind: "property", kindModifiers: "declare" } }); edit.backspace(); // Members of the invocation of a class method (1) goTo.marker('3'); edit.insert('.'); verify.completions({ includes: "toFixed", excludes: "substring" }); edit.backspace(); // Members of the invocation of a class method (2) goTo.marker('4'); edit.insert('.'); verify.completions({ includes: "substring", excludes: "toFixed" });
{ "end_byte": 1143, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/javaScriptPrototype1.ts" }
TypeScript/tests/cases/fourslash/toggleMultilineComment2.ts_0_646
// If selection is outside of a multiline comment then insert comment // instead of removing. //// let var1/* = 1; //// let var2 [|= 2; //// let var3 */= 3;|] //// //// [|let var4/* = 1; //// let var5 |]= 2; //// let var6 */= 3; //// //// [|let var7/* = 1; //// let var8 = 2; //// let var9 */= 3;|] //// //// /*let va[|r10 = 1;*/ //// let var11 = 2; //// /*let var12|] = 3;*/ verify.toggleMultilineComment( `let var1/* = 1; let var2 *//*= 2; let var3 *//*= 3;*/ /*let var4*//* = 1; let var5 *//*= 2; let var6 */= 3; /*let var7*//* = 1; let var8 = 2; let var9 *//*= 3;*/ /*let va*//*r10 = 1;*//* let var11 = 2; *//*let var12*//* = 3;*/`);
{ "end_byte": 646, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/toggleMultilineComment2.ts" }
TypeScript/tests/cases/fourslash/navbar_exportDefault.ts_0_2706
/// <reference path="fourslash.ts" /> // @Filename: a.ts ////export default class { } // @Filename: b.ts ////export default class C { } // @Filename: c.ts ////export default function { } // @Filename: d.ts ////export default function Func { } goTo.file("a.ts"); verify.navigationTree({ "text": "\"a\"", "kind": "module", "childItems": [ { "text": "default", "kind": "class", "kindModifiers": "export" } ] }); verify.navigationBar([ { "text": "\"a\"", "kind": "module", "childItems": [ { "text": "default", "kind": "class", "kindModifiers": "export" } ] }, { "text": "default", "kind": "class", "kindModifiers": "export", "indent": 1 } ]); goTo.file("b.ts"); verify.navigationTree({ "text": "\"b\"", "kind": "module", "childItems": [ { "text": "C", "kind": "class", "kindModifiers": "export" } ] }); verify.navigationBar([ { "text": "\"b\"", "kind": "module", "childItems": [ { "text": "C", "kind": "class", "kindModifiers": "export" } ] }, { "text": "C", "kind": "class", "kindModifiers": "export", "indent": 1 } ]); goTo.file("c.ts"); verify.navigationTree({ "text": "\"c\"", "kind": "module", "childItems": [ { "text": "default", "kind": "function", "kindModifiers": "export" } ] }); verify.navigationBar([ { "text": "\"c\"", "kind": "module", "childItems": [ { "text": "default", "kind": "function", "kindModifiers": "export" } ] }, { "text": "default", "kind": "function", "kindModifiers": "export", "indent": 1 } ]); goTo.file("d.ts"); verify.navigationTree({ "text": "\"d\"", "kind": "module", "childItems": [ { "text": "Func", "kind": "function", "kindModifiers": "export" } ] }); verify.navigationBar([ { "text": "\"d\"", "kind": "module", "childItems": [ { "text": "Func", "kind": "function", "kindModifiers": "export" } ] }, { "text": "Func", "kind": "function", "kindModifiers": "export", "indent": 1 } ]);
{ "end_byte": 2706, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navbar_exportDefault.ts" }
TypeScript/tests/cases/fourslash/codeFixInferFromUsageJSDestructuring.ts_0_463
/// <reference path="fourslash.ts"/> // @allowJs: true // @checkJs: true // @noEmit: true // @filename:destruct.js //// function [|formatter|](message) { //// const { type } = false ? { type: message } : message; //// } verify.codeFix({ description: "Infer parameter types from usage", index: 0, newFileContent: `/** * @param {{ type: any; }} message */ function formatter(message) { const { type } = false ? { type: message } : message; }` });
{ "end_byte": 463, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageJSDestructuring.ts" }
TypeScript/tests/cases/fourslash/importJsNodeModule4.ts_0_492
///<reference path="fourslash.ts" /> // @allowJs: true // @Filename: node_modules/myMod/index.js //// module.exports = { n: 3, s: 'foo', b: true }; // @Filename: consumer.js //// import * as x from 'myMod'; //// x/**/; goTo.file('consumer.js'); goTo.marker(); edit.insert('.'); verify.completions({ includes: ["n", "s", "b"].map(name => ({ name, kind: "property" })) });; edit.insert('n.'); verify.completions({ includes: { name: "toFixed", kind: "method", kindModifiers: "declare" } });
{ "end_byte": 492, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importJsNodeModule4.ts" }
TypeScript/tests/cases/fourslash/inlayHintsInteractiveVariableTypes1.ts_0_694
/// <reference path="fourslash.ts" /> ////class C {} ////namespace N { export class Foo {} } ////interface Foo {} ////const a = "a"; ////const b = 1; ////const c = true; ////const d = {} as Foo; ////const e = <Foo>{}; ////const f = {} as const; ////const g = (({} as const)); ////const h = new C(); ////const i = new N.C(); ////const j = ((((new C())))); ////const k = { a: 1, b: 1 }; ////const l = ((({ a: 1, b: 1 }))); //// const m = () => 123; //// const n; //// const o = () => -1 as const; //// const p = ([a]: Foo[]) => a; //// const q = ({ a }: { a: Foo }) => a; verify.baselineInlayHints(undefined, { includeInlayVariableTypeHints: true, interactiveInlayHints: true });
{ "end_byte": 694, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlayHintsInteractiveVariableTypes1.ts" }
TypeScript/tests/cases/fourslash/formatInsertSpaceAfterTypeAssertion.ts_0_393
/// <reference path="fourslash.ts" /> ////let a = <string> ""; ////let b = <number> 1; ////let c = <any[]> []; ////let d = <string[]> []; ////let e = <string[]> ["e"]; format.setFormatOptions({ insertSpaceAfterTypeAssertion: true, }) format.document(); verify.currentFileContentIs( `let a=<string> ""; let b=<number> 1; let c=<any[]> []; let d=<string[]> []; let e=<string[]> ["e"];` );
{ "end_byte": 393, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatInsertSpaceAfterTypeAssertion.ts" }
TypeScript/tests/cases/fourslash/completionEntryForClassMembers.ts_0_8153
///<reference path="fourslash.ts" /> // @noLib: true ////abstract class B { //// private privateMethod() { } //// protected protectedMethod() { }; //// static staticMethod() { } //// abstract getValue(): number; //// /*abstractClass*/ ////} ////class C extends B { //// /*classThatIsEmptyAndExtendingAnotherClass*/ ////} ////class D extends B { //// /*classThatHasAlreadyImplementedAnotherClassMethod*/ //// getValue() { //// return 10; //// } //// /*classThatHasAlreadyImplementedAnotherClassMethodAfterMethod*/ ////} ////class D1 extends B { //// /*classThatHasDifferentMethodThanBase*/ //// getValue1() { //// return 10; //// } //// /*classThatHasDifferentMethodThanBaseAfterMethod*/ ////} ////class D2 extends B { //// /*classThatHasAlreadyImplementedAnotherClassProtectedMethod*/ //// protectedMethod() { //// } //// /*classThatHasDifferentMethodThanBaseAfterProtectedMethod*/ ////} ////class D3 extends D1 { //// /*classThatExtendsClassExtendingAnotherClass*/ ////} ////class D4 extends D1 { //// static /*classThatExtendsClassExtendingAnotherClassAndTypesStatic*/ ////} ////class D5 extends D2 { //// /*classThatExtendsClassExtendingAnotherClassWithOverridingMember*/ ////} ////class D6 extends D2 { //// static /*classThatExtendsClassExtendingAnotherClassWithOverridingMemberAndTypesStatic*/ ////} ////class E { //// /*classThatDoesNotExtendAnotherClass*/ ////} ////class F extends B { //// public /*classThatHasWrittenPublicKeyword*/ ////} ////class F2 extends B { //// private /*classThatHasWrittenPrivateKeyword*/ ////} ////class G extends B { //// static /*classElementContainingStatic*/ ////} ////class G2 extends B { //// private static /*classElementContainingPrivateStatic*/ ////} ////class H extends B { //// prop/*classThatStartedWritingIdentifier*/ ////} //////Class for location verification ////class I extends B { //// prop0: number //// /*propDeclarationWithoutSemicolon*/ //// prop: number; //// /*propDeclarationWithSemicolon*/ //// prop1 = 10; //// /*propAssignmentWithSemicolon*/ //// prop2 = 10 //// /*propAssignmentWithoutSemicolon*/ //// method(): number //// /*methodSignatureWithoutSemicolon*/ //// method2(): number; //// /*methodSignatureWithSemicolon*/ //// method3() { //// /*InsideMethod*/ //// } //// /*methodImplementation*/ //// get c() //// /*accessorSignatureWithoutSemicolon*/ //// set c() //// { //// } //// /*accessorSignatureImplementation*/ ////} ////class J extends B { //// get /*classThatHasWrittenGetKeyword*/ ////} ////class K extends B { //// set /*classThatHasWrittenSetKeyword*/ ////} ////class J extends B { //// get identi/*classThatStartedWritingIdentifierOfGetAccessor*/ ////} ////class K extends B { //// set identi/*classThatStartedWritingIdentifierOfSetAccessor*/ ////} ////class L extends B { //// public identi/*classThatStartedWritingIdentifierAfterModifier*/ ////} ////class L2 extends B { //// private identi/*classThatStartedWritingIdentifierAfterPrivateModifier*/ ////} ////class M extends B { //// static identi/*classThatStartedWritingIdentifierAfterStaticModifier*/ ////} ////class M extends B { //// private static identi/*classThatStartedWritingIdentifierAfterPrivateStaticModifier*/ ////} ////class N extends B { //// async /*classThatHasWrittenAsyncKeyword*/ ////} ////class O extends B { //// constructor(public a) { //// }, //// /*classElementAfterConstructorSeparatedByComma*/ ////} const getValue: FourSlashInterface.ExpectedCompletionEntry = { name: "getValue", text: "(method) B.getValue(): number" }; const protectedMethod: FourSlashInterface.ExpectedCompletionEntry = { name: "protectedMethod", text: "(method) B.protectedMethod(): void" }; const staticMethod: FourSlashInterface.ExpectedCompletionEntry = { name: "staticMethod", text: "(method) B.staticMethod(): void" }; verify.completions( { // Not a class element declaration location marker: "InsideMethod", unsorted: [ "arguments", completion.globalThisEntry, "B", "C", "D", "D1", "D2", "D3", "D4", "D5", "D6", "E", "F", "F2", "G", "G2", "H", "I", "J", "K", "L", "L2", "M", "N", "O", completion.undefinedVarEntry, ...completion.insideMethodKeywords, ], }, { // Only keywords allowed at this position since they dont extend the class or are private marker: [ "abstractClass", "classThatDoesNotExtendAnotherClass", "classThatHasWrittenPrivateKeyword", "classElementContainingPrivateStatic", "classThatStartedWritingIdentifierAfterPrivateModifier", "classThatStartedWritingIdentifierAfterPrivateStaticModifier", ], unsorted: completion.classElementKeywords, isNewIdentifierLocation: true, }, { // Instance base members and class member keywords allowed marker:[ "classThatIsEmptyAndExtendingAnotherClass", "classThatHasDifferentMethodThanBase", "classThatHasDifferentMethodThanBaseAfterMethod", "classThatHasWrittenPublicKeyword", "classThatStartedWritingIdentifier", "propDeclarationWithoutSemicolon", "propDeclarationWithSemicolon", "propAssignmentWithSemicolon", "propAssignmentWithoutSemicolon", "methodSignatureWithoutSemicolon", "methodSignatureWithSemicolon", "methodImplementation", "accessorSignatureWithoutSemicolon", "accessorSignatureImplementation", "classThatHasWrittenGetKeyword", "classThatHasWrittenSetKeyword", "classThatStartedWritingIdentifierOfGetAccessor", "classThatStartedWritingIdentifierOfSetAccessor", "classThatStartedWritingIdentifierAfterModifier", "classThatHasWrittenAsyncKeyword", "classElementAfterConstructorSeparatedByComma", ], unsorted: [protectedMethod, getValue, ...completion.classElementKeywords], isNewIdentifierLocation: true, }, { // Static Base members and class member keywords allowed marker: ["classElementContainingStatic", "classThatStartedWritingIdentifierAfterStaticModifier"], unsorted: [staticMethod, ...completion.classElementKeywords], isNewIdentifierLocation: true, }, { marker: [ "classThatHasAlreadyImplementedAnotherClassMethod", "classThatHasAlreadyImplementedAnotherClassMethodAfterMethod", ], unsorted: [protectedMethod, ...completion.classElementKeywords], isNewIdentifierLocation: true, }, { marker: [ "classThatHasAlreadyImplementedAnotherClassProtectedMethod", "classThatHasDifferentMethodThanBaseAfterProtectedMethod", ], unsorted: [getValue, ...completion.classElementKeywords], isNewIdentifierLocation: true, }, { // instance memebers in D1 and base class are shown marker: "classThatExtendsClassExtendingAnotherClass", unsorted: ["getValue1", "protectedMethod", "getValue", ...completion.classElementKeywords], isNewIdentifierLocation: true, }, { // instance memebers in D2 and base class are shown marker: "classThatExtendsClassExtendingAnotherClassWithOverridingMember", unsorted: [ { name: "protectedMethod", text: "(method) D2.protectedMethod(): void" }, getValue, ...completion.classElementKeywords, ], isNewIdentifierLocation: true, }, { // static base members and class member keywords allowed marker: [ "classThatExtendsClassExtendingAnotherClassAndTypesStatic", "classThatExtendsClassExtendingAnotherClassWithOverridingMemberAndTypesStatic" ], unsorted: [staticMethod, ...completion.classElementKeywords], isNewIdentifierLocation: true, }, );
{ "end_byte": 8153, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionEntryForClassMembers.ts" }
TypeScript/tests/cases/fourslash/goToImplementationInterface_09.ts_0_341
/// <reference path='fourslash.ts'/> // Should go to object literals within cast expressions when invoked on interface // @Filename: def.d.ts //// export interface Interface { P: number } // @Filename: ref.ts //// import { Interface } from "./def"; //// const c: I/*ref*/nterface = [|{ P: 2 }|]; verify.baselineGoToImplementation("ref");
{ "end_byte": 341, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationInterface_09.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionOverriddenMember12.ts_0_226
/// <reference path="./fourslash.ts"/> // @noImplicitOverride: true ////class Foo { //// static /*2*/p = ''; ////} ////class Bar extends Foo { //// static [|/*1*/override|] p = ''; ////} verify.baselineGoToDefinition("1");
{ "end_byte": 226, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionOverriddenMember12.ts" }
TypeScript/tests/cases/fourslash/signatureHelpAnonymousFunction.ts_0_581
/// <reference path='fourslash.ts' /> ////var anonymousFunctionTest = function(n: number, s: string): (a: number, b: string) => string { //// return null; ////} ////anonymousFunctionTest(5, "")(/*anonymousFunction1*/1, /*anonymousFunction2*/""); verify.signatureHelp( { marker: "anonymousFunction1", text: '(a: number, b: string): string', parameterCount: 2, parameterName: "a", parameterSpan: "a: number", }, { marker: "anonymousFunction2", parameterName: "b", parameterSpan: "b: string", }, );
{ "end_byte": 581, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpAnonymousFunction.ts" }
TypeScript/tests/cases/fourslash/signatureHelpIncompleteCalls.ts_0_774
/// <reference path='fourslash.ts' /> ////module IncompleteCalls { //// class Foo { //// public f1() { } //// public f2(n: number): number { return 0; } //// public f3(n: number, s: string) : string { return ""; } //// } //// var x = new Foo(); //// x.f1(); //// x.f2(5); //// x.f3(5, ""); //// x.f1(/*incompleteCalls1*/ //// x.f2(5,/*incompleteCalls2*/ //// x.f3(5,/*incompleteCalls3*/ ////} verify.signatureHelp( { marker: "incompleteCalls1", text: "f1(): void", parameterCount: 0 }, { marker: "incompleteCalls2", text: "f2(n: number): number", parameterCount: 1 }, { marker: "incompleteCalls3", text: "f3(n: number, s: string): string", parameterCount: 2, parameterName: "s", parameterSpan: "s: string" }, );
{ "end_byte": 774, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpIncompleteCalls.ts" }
TypeScript/tests/cases/fourslash/refactorConvertImport_namedToNamespace4.ts_0_653
/// <reference path='fourslash.ts' /> /////*a*/import { a, b, c as d } from "./foo"/*b*/; ////a; ////b; ////d; ////export default a; ////export { b }; ////export { d }; ////export { d as e }; ////export { b as f }; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Convert import", actionName: "Convert named imports to namespace import", actionDescription: "Convert named imports to namespace import", triggerReason: "invoked", newContent: `import * as foo from "./foo"; import { b, c as d } from "./foo"; foo.a; foo.b; foo.c; export default foo.a; export { b }; export { d }; export { d as e }; export { b as f };`, });
{ "end_byte": 653, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertImport_namedToNamespace4.ts" }
TypeScript/tests/cases/fourslash/signatureHelpForSuperCalls1.ts_0_488
/// <reference path='fourslash.ts'/> ////class A { } ////class B extends A { } ////class C extends B { //// constructor() { //// super(/*1*/ // sig help here? //// } ////} ////class A2 { } ////class B2 extends A2 { //// constructor(x:number) {} //// } ////class C2 extends B2 { //// constructor() { //// super(/*2*/ // sig help here? //// } ////} verify.signatureHelp( { marker: "1", text: "B(): B" }, { marker: "2", text: "B2(x: number): B2" }, );
{ "end_byte": 488, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpForSuperCalls1.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration18.ts_0_321
/// <reference path='fourslash.ts' /> /////** //// * comment //// */ ////foo(); verify.codeFix({ index: 0, description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], newFileContent: `/** * comment */ foo(); function foo() { throw new Error("Function not implemented."); } ` });
{ "end_byte": 321, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration18.ts" }
TypeScript/tests/cases/fourslash/jsDocAliasQuickInfo.ts_0_281
/// <reference path='fourslash.ts'/> // @Filename: /jsDocAliasQuickInfo.ts /////** //// * Comment //// * @type {number} //// */ ////export /*1*/default 10; // @Filename: /test.ts ////export { /*2*/default as /*3*/test } from "./jsDocAliasQuickInfo"; verify.baselineQuickInfo();
{ "end_byte": 281, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocAliasQuickInfo.ts" }
TypeScript/tests/cases/fourslash/getOccurrencesThis3.ts_0_2891
/// <reference path='fourslash.ts' /> ////this; ////this; //// ////function f() { //// this; //// this; //// () => this; //// () => { //// if (this) { //// this; //// } //// else { //// this.this; //// } //// } //// function inside() { //// [|t/**/his|]; //// (function (_) { //// this; //// })([|this|]); //// } ////} //// ////module m { //// function f() { //// this; //// this; //// () => this; //// () => { //// if (this) { //// this; //// } //// else { //// this.this; //// } //// } //// function inside() { //// this; //// (function (_) { //// this; //// })(this); //// } //// } ////} //// ////class A { //// public b = this.method1; //// //// public method1() { //// this; //// this; //// () => this; //// () => { //// if (this) { //// this; //// } //// else { //// this.this; //// } //// } //// function inside() { //// this; //// (function (_) { //// this; //// })(this); //// } //// } //// //// private method2() { //// this; //// this; //// () => this; //// () => { //// if (this) { //// this; //// } //// else { //// this.this; //// } //// } //// function inside() { //// this; //// (function (_) { //// this; //// })(this); //// } //// } //// //// public static staticB = this.staticMethod1; //// //// public static staticMethod1() { //// this; //// this; //// () => this; //// () => { //// if (this) { //// this; //// } //// else { //// this.this; //// } //// } //// function inside() { //// this; //// (function (_) { //// this; //// })(this); //// } //// } //// //// private static staticMethod2() { //// this; //// this; //// () => this; //// () => { //// if (this) { //// this; //// } //// else { //// this.this; //// } //// } //// function inside() { //// this; //// (function (_) { //// this; //// })(this); //// } //// } ////} //// ////var x = { //// f() { //// this; //// }, //// g() { //// this; //// } ////} verify.baselineDocumentHighlights();
{ "end_byte": 2891, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesThis3.ts" }
TypeScript/tests/cases/fourslash/breakpointValidationInComments.ts_0_336
/// <reference path='fourslash.ts' /> // @BaselineFile: bpSpan_inComments.baseline // @Filename: bpSpan_inComments.ts /////*comment here*/ var x = 10; /*comment here*/ ////// comment only line /////*multiline comment ////another line of multiline comment */ var y = 10; // comment here verify.baselineCurrentFileBreakpointLocations();
{ "end_byte": 336, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationInComments.ts" }
TypeScript/tests/cases/fourslash/extract-const7.ts_0_361
/// <reference path='fourslash.ts' /> // @filename: foo.ts ////const foo = /*a*/<number>1/*b*/; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "constant_scope_0", actionDescription: "Extract to constant in enclosing scope", newContent: `const newLocal = <number>1; const foo = /*RENAME*/newLocal;` });
{ "end_byte": 361, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const7.ts" }
TypeScript/tests/cases/fourslash/formattingArrayLiteral.ts_0_599
/// <reference path='fourslash.ts' /> /////*1*/x= []; ////y = [ /////*2*/ 1, /////*3*/ 2 /////*4*/ ]; //// ////z = [[ /////*5*/ 1, /////*6*/ 2 /////*7*/ ] ]; format.document(); goTo.marker('1'); verify.currentLineContentIs("x = [];"); goTo.marker('2'); verify.currentLineContentIs(" 1,"); goTo.marker('3'); verify.currentLineContentIs(" 2"); goTo.marker('4'); verify.currentLineContentIs("];"); goTo.marker('5'); verify.currentLineContentIs(" 1,"); goTo.marker('6'); verify.currentLineContentIs(" 2"); goTo.marker('7'); verify.currentLineContentIs("]];");
{ "end_byte": 599, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingArrayLiteral.ts" }
TypeScript/tests/cases/fourslash/formattingForLoopSemicolons.ts_0_672
/// <reference path='fourslash.ts' /> /////*1*/for (;;) { } /////*2*/for (var x;x<0;x++) { } /////*3*/for (var x ;x<0 ;x++) { } format.document(); goTo.marker('1'); verify.currentLineContentIs('for (; ;) { }'); goTo.marker('2'); verify.currentLineContentIs('for (var x; x < 0; x++) { }'); goTo.marker('3'); verify.currentLineContentIs('for (var x; x < 0; x++) { }'); format.setOption('InsertSpaceAfterSemicolonInForStatements', false); format.document(); goTo.marker('1'); verify.currentLineContentIs('for (;;) { }'); goTo.marker('2'); verify.currentLineContentIs('for (var x;x < 0;x++) { }'); goTo.marker('3'); verify.currentLineContentIs('for (var x;x < 0;x++) { }');
{ "end_byte": 672, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingForLoopSemicolons.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties1.ts_0_846
/// <reference path='fourslash.ts' /> ////interface Foo { //// a: number; //// b: string; //// c: 1; //// d: "d"; //// e: "e1" | "e2"; //// f(x: number, y: number): void; //// g: (x: number, y: number) => void; //// h: number[]; //// i: bigint; //// j: undefined | "special-string"; //// k: `--${string}`; ////} ////[|const foo: Foo = {}|]; verify.codeFix({ index: 0, description: ts.Diagnostics.Add_missing_properties.message, newRangeContent: `const foo: Foo = { a: 0, b: "", c: 1, d: "d", e: "e1", f: function(x: number, y: number): void { throw new Error("Function not implemented."); }, g: function(x: number, y: number): void { throw new Error("Function not implemented."); }, h: [], i: 0n, j: "special-string", k: "" }` });
{ "end_byte": 846, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties1.ts" }
TypeScript/tests/cases/fourslash/codeFixMissingCallParentheses7.ts_0_570
/// <reference path='fourslash.ts'/> // @strictNullChecks: true ////function foo() { //// function test() { return Math.random() > 0.5; } //// if (test/**/) { //// console.log('test') //// } ////} verify.codeFixAvailable([ { description: ts.Diagnostics.Add_missing_call_parentheses.message } ]); verify.codeFix({ description: ts.Diagnostics.Add_missing_call_parentheses.message, index: 0, newFileContent: `function foo() { function test() { return Math.random() > 0.5; } if (test()) { console.log('test') } }`, });
{ "end_byte": 570, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingCallParentheses7.ts" }
TypeScript/tests/cases/fourslash/linkedEditingJsxTag3.ts_0_650
/// <reference path='fourslash.ts' /> // @Filename: /selfClosing.tsx /////*0*/const jsx = /*1*/( //// <div> /*2*/ //// <p>/*3*/ //// No lin/*4*/ked cursors here! //// /*5*/</*6*/img/*7*/ /*8*///*9*/> //// /*10*/ </p>/*11*/ //// /*12*/</div> /////*13*/)/*14*/;/*15*/ verify.linkedEditing( { "0": undefined, "1": undefined, "2": undefined, "3": undefined, "4": undefined, "5": undefined, "6": undefined, "7": undefined, "8": undefined, "9": undefined, "10": undefined, "11": undefined, "12": undefined, "13": undefined, "14": undefined, "15": undefined, });
{ "end_byte": 650, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/linkedEditingJsxTag3.ts" }
TypeScript/tests/cases/fourslash/tsxFindAllReferences5.ts_0_812
/// <reference path='fourslash.ts' /> //@Filename: file.tsx // @jsx: preserve // @noLib: true //// declare module JSX { //// interface Element { } //// interface IntrinsicElements { //// } //// interface ElementAttributesProperty { props; } //// } //// interface OptionPropBag { //// propx: number //// propString: string //// optional?: boolean //// } //// /*1*/declare function /*2*/Opt(attributes: OptionPropBag): JSX.Element; //// let opt = /*3*/</*4*/Opt />; //// let opt1 = /*5*/</*6*/Opt propx={100} propString />; //// let opt2 = /*7*/</*8*/Opt propx={100} optional/>; //// let opt3 = /*9*/</*10*/Opt wrong />; //// let opt4 = /*11*/</*12*/Opt propx={100} propString="hi" />; verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12');
{ "end_byte": 812, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxFindAllReferences5.ts" }
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_EmptySpanCallArgument.ts_0_472
/// <reference path='fourslash.ts' /> ////let foo = { bar: { baz: 0 } }; ////f(foo && foo.ba/*a*//*b*/r && foo.bar.baz); // allow for call arguments goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Convert to optional chain expression", actionName: "Convert to optional chain expression", actionDescription: "Convert to optional chain expression", newContent: `let foo = { bar: { baz: 0 } }; f(foo?.bar?.baz);`, triggerReason: "invoked" });
{ "end_byte": 472, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_EmptySpanCallArgument.ts" }
TypeScript/tests/cases/fourslash/getOccurrencesNonStringImportAttributes.ts_0_178
/// <reference path="fourslash.ts" /> // @module: nodenext ////import * as react from "react" with { cache: /**/0 }; ////react.Children; verify.baselineDocumentHighlights("");
{ "end_byte": 178, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesNonStringImportAttributes.ts" }
TypeScript/tests/cases/fourslash/quickInfoForObjectBindingElementName03.ts_0_239
/// <reference path="fourslash.ts" /> ////interface Options { //// /** //// * A description of foo //// */ //// foo: string; ////} //// ////function f({ foo }: Options) { //// foo/*1*/; ////} verify.baselineQuickInfo();
{ "end_byte": 239, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForObjectBindingElementName03.ts" }