_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/fourslash/codeFixInferFromUsageUnifyAnonymousType.ts_0_733
/// <reference path='fourslash.ts' /> // @strict: true // based on acorn, translated to TS ////function kw([|name, options |]) { //// if ( options === void 0 ) options = {}; //// //// options.keyword = name; //// return keywords$1[name] = new TokenType(name, options) ////} ////kw("1") ////kw("2", { startsExpr: true }) ////kw("3", { beforeExpr: false }) ////kw("4", { isLoop: false }) ////kw("5", { beforeExpr: true, startsExpr: true }) ////kw("6", { beforeExpr: true, prefix: true, startsExpr: true }) verify.rangeAfterCodeFix("name: string, options: { startsExpr?: boolean; beforeExpr?: boolean; isLoop?: boolean; prefix?: boolean; keyword?: any; } | undefined",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0);
{ "end_byte": 733, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageUnifyAnonymousType.ts" }
TypeScript/tests/cases/fourslash/referencesForLabel.ts_0_323
/// <reference path='fourslash.ts'/> // Valid References for a label /////*1*/label: while (true) { //// if (false) /*2*/break /*3*/label; //// if (true) /*4*/continue /*5*/label; ////} //// /////*6*/label: while (false) { } ////var label = "label"; verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6');
{ "end_byte": 323, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForLabel.ts" }
TypeScript/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInReturnStatement.ts_0_462
/// <reference path='fourslash.ts' /> ////interface Accumulator { //// clear(): void; //// add(x: number): void; //// result(): number; ////} //// ////function makeAccumulator(): Accumulator { //// var sum = 0; //// return { //// clear: function () { sum = 0; }, //// add: function (val/**/ue) { sum += value; }, //// result: function () { return sum; } //// }; ////} verify.quickInfoAt("", "(parameter) value: number");
{ "end_byte": 462, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInReturnStatement.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType16.ts_0_362
/// <reference path='fourslash.ts' /> //// var x: { a?: /*a*/number/*b*/, b?: string } = { }; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = number; var x: { a?: NewType, b?: string } = { };`, });
{ "end_byte": 362, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType16.ts" }
TypeScript/tests/cases/fourslash/getMatchingBracesNegativeCases.ts_0_429
/// <reference path="fourslash.ts"/> ////// less than and greater than tests //// public bar(a, b) { //// return a [|< b || a >|] b; //// } //// ////// in comments //// // [|{ }|] //// // [|( )|] //// // [|[ ]|] //// // [|< >|] test.ranges().forEach((range) => { verify.noMatchingBracePositionInCurrentFile(range.start); verify.noMatchingBracePositionInCurrentFile(range.end); });
{ "end_byte": 429, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getMatchingBracesNegativeCases.ts" }
TypeScript/tests/cases/fourslash/autoImportCompletionExportEqualsWithDefault1.ts_0_1966
/// <reference path="fourslash.ts" /> // @strict: true // @module: commonjs // @filename: node.ts //// import Container from "./container.js"; //// import Document from "./document.js"; //// //// declare namespace Node { //// class Node extends Node_ {} //// //// export { Node as default }; //// } //// //// declare abstract class Node_ { //// parent: Container | Document | undefined; //// } //// //// declare class Node extends Node_ {} //// //// export = Node; // @filename: document.ts //// import Container from "./container.js"; //// //// declare namespace Document { //// export { Document_ as default }; //// } //// //// declare class Document_ extends Container {} //// //// declare class Document extends Document_ {} //// //// export = Document; // @filename: container.ts //// import Node from "./node.js"; //// //// declare namespace Container { //// export { Container_ as default }; //// } //// //// declare abstract class Container_ extends Node { //// p/*1*/ //// } //// //// declare class Container extends Container_ {} //// //// export = Container; const preferences = { includeCompletionsWithInsertText: true, includeCompletionsWithClassMemberSnippets: true, }; verify.completions({ marker: "1", includes: [ { name: "parent", insertText: "parent: Container_ | Document_ | undefined;", filterText: "parent", hasAction: true, source: "ClassMemberSnippet/", }, ], preferences, isNewIdentifierLocation: true, }); verify.applyCodeActionFromCompletion("1", { name: "parent", source: "ClassMemberSnippet/", description: `Includes imports of types referenced by 'parent'`, newFileContent: `import Document_ from "./document.js"; import Node from "./node.js"; declare namespace Container { export { Container_ as default }; } declare abstract class Container_ extends Node { p } declare class Container extends Container_ {} export = Container;`, preferences, });
{ "end_byte": 1966, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportCompletionExportEqualsWithDefault1.ts" }
TypeScript/tests/cases/fourslash/jsDocFunctionSignatures8.ts_0_519
///<reference path="fourslash.ts" /> // @allowJs: true // @Filename: Foo.js /////** //// * Represents a person //// * a b multiline test //// * @constructor //// * @param {string} name The name of the person //// * @param {number} age The age of the person //// */ ////function Person(name, age) { //// this.name = name; //// this.age = age; ////} ////var p = new Pers/**/on(); goTo.marker(); verify.quickInfoIs("constructor Person(name: string, age: number): Person", "Represents a person\na b multiline test");
{ "end_byte": 519, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocFunctionSignatures8.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingTypeof2.ts_0_288
/// <reference path='fourslash.ts' /> // @Filename: a.ts //// export = 1; // @Filename: b.ts //// const a: import("./a") = import("./a") goTo.file("b.ts") verify.codeFix({ description: "Add missing 'typeof'", newFileContent: `const a: typeof import("./a") = import("./a")` });
{ "end_byte": 288, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingTypeof2.ts" }
TypeScript/tests/cases/fourslash/codeFixTopLevelForAwait_module_targetES2017CompilerOptionsInTsConfig.ts_0_346
/// <reference path="fourslash.ts" /> // @filename: /dir/a.ts ////declare const p: number[]; ////for await (const _ of p); ////export {}; // @filename: /dir/tsconfig.json ////{ //// "compilerOptions": { //// "target": "es2017" //// } ////} verify.not.codeFixAvailable("fixTargetOption"); verify.codeFixAvailable("fixModuleOption");
{ "end_byte": 346, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixTopLevelForAwait_module_targetES2017CompilerOptionsInTsConfig.ts" }
TypeScript/tests/cases/fourslash/completionsSelfDeclaring1.ts_0_398
/// <reference path="fourslash.ts" /> ////interface Test { //// keyPath?: string; //// autoIncrement?: boolean; ////} //// ////function test<T extends Record<string, Test>>(opt: T) { } //// ////test({ //// a: { //// keyPath: '', //// a/**/ //// } ////}) verify.completions({ marker: "", exact: [{ name: "autoIncrement", sortText: completion.SortText.OptionalMember }] });
{ "end_byte": 398, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsSelfDeclaring1.ts" }
TypeScript/tests/cases/fourslash/moveToFile_expandSelectionRange9.ts_0_445
/// <reference path='fourslash.ts' /> //@Filename: /bar.ts ////import { b } from './other'; ////const t = b; // @Filename: /a.ts ////const a = 1;[| ////const c = 2;|] // @Filename: /other.ts ////export const b = 2; verify.moveToFile({ newFileContents: { "/a.ts": `const a = 1; `, "/bar.ts": `import { b } from './other'; const t = b; const c = 2; `, }, interactiveRefactorArguments: { targetFile: "/bar.ts" } });
{ "end_byte": 445, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_expandSelectionRange9.ts" }
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ElementAccessExpression1.ts_0_412
/// <reference path='fourslash.ts' /> ////const a = { //// b: { c: 1 } ////} /////*a*/a && a['b'] && a['b']['c']/*b*/ 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: `const a = { b: { c: 1 } } a?.['b']?.['c']` });
{ "end_byte": 412, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ElementAccessExpression1.ts" }
TypeScript/tests/cases/fourslash/codeFixAddVoidToPromiseJS.2.ts_0_462
/// <reference path='fourslash.ts' /> // @target: esnext // @lib: es2015 // @strict: true // @allowJS: true // @checkJS: true // @filename: main.js ////const p2 = /** @type {Promise<number>} */(new Promise(resolve => resolve())); verify.codeFix({ errorCode: 2810, description: "Add 'void' to Promise resolved without a value", index: 2, newFileContent: `const p2 = /** @type {Promise<number | void>} */(new Promise(resolve => resolve()));` });
{ "end_byte": 462, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddVoidToPromiseJS.2.ts" }
TypeScript/tests/cases/fourslash/unusedEnumInNamespace1.ts_0_201
/// <reference path='fourslash.ts' /> // @noUnusedLocals: true //// [| namespace greeter { //// enum enum1 { //// Monday //// } //// } |] verify.rangeAfterCodeFix(`namespace greeter { }`);
{ "end_byte": 201, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedEnumInNamespace1.ts" }
TypeScript/tests/cases/fourslash/genericInterfaceWithInheritanceEdit1.ts_0_442
/// <reference path='fourslash.ts'/> ////interface ChainedObject<T> { //// values(): ChainedArray<any>; //// pairs(): ChainedArray<any[]>; //// extend(...sources: any[]): ChainedObject<T>; //// //// value(): T; ////} ////interface ChainedArray<T> extends ChainedObject<Array<T>> { //// //// extend(...sources: any[]): ChainedArray<T>; ////} //// /*1*/ verify.noErrors(); goTo.marker('1'); edit.insert(' '); verify.noErrors();
{ "end_byte": 442, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/genericInterfaceWithInheritanceEdit1.ts" }
TypeScript/tests/cases/fourslash/completionListsStringLiteralTypeAsIndexedAccessTypeObject.ts_0_1016
/// <reference path="fourslash.ts" /> //// let firstCase: "a/*case_1*/"["foo"] //// let secondCase: "b/*case_2*/"["bar"] //// let thirdCase: "c/*case_3*/"["baz"] //// let fourthCase: "en/*case_4*/"["qux"] //// interface Foo { //// bar: string; //// qux: string; //// } //// let fifthCase: Foo["b/*case_5*/"] //// let sixthCase: Foo["qu/*case_6*/"] // fourslash tests for issue 40322 verify.completions({ marker: ["case_1", "case_2", "case_3", "case_4"], exact: undefined, isNewIdentifierLocation: true, }); // regression tests const test5 = test.marker("case_5"); const test6 = test.marker("case_6"); verify.completions({ marker: "case_5", includes: { name: "bar", replacementSpan: { fileName: test5.fileName, pos: test5.position - 1, end: test5.position, }, }, }); verify.completions({ marker: "case_6", includes: { name: "qux", replacementSpan: { fileName: test6.fileName, pos: test6.position - 2, end: test6.position, }, }, });
{ "end_byte": 1016, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListsStringLiteralTypeAsIndexedAccessTypeObject.ts" }
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_restParamInference.ts_0_572
/// <reference path='fourslash.ts' /> ////function log(/*a*/a: number, b: number, ...args/*b*/) { } ////let l = log(-1, -2, 3, 4, 5); ////let k = log(1, 2); goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Convert parameters to destructured object", actionName: "Convert parameters to destructured object", actionDescription: "Convert parameters to destructured object", newContent: `function log({ a, b, args = [] }: { a: number; b: number; args?: any[]; }) { } let l = log({ a: -1, b: -2, args: [3, 4, 5] }); let k = log({ a: 1, b: 2 });` });
{ "end_byte": 572, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_restParamInference.ts" }
TypeScript/tests/cases/fourslash/completionsDestructuring.ts_0_256
/// <reference path="fourslash.ts" /> ////const points = [{ x: 1, y: 2 }]; ////points.forEach(({ /*a*/ }) => { }); ////const { /*b*/ } = points[0]; ////for (const { /*c*/ } of points) {} verify.completions({ marker: test.markers(), exact: ["x", "y"] });
{ "end_byte": 256, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsDestructuring.ts" }
TypeScript/tests/cases/fourslash/typeOfAFundule.ts_0_228
/// <reference path='fourslash.ts'/> ////function m1() { return 1; } ////module m1 { export var y = 2; } ////function foo13() { //// return m1; ////} ////var /**/r13 = foo13(); verify.quickInfoAt("", "var r13: typeof m1");
{ "end_byte": 228, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/typeOfAFundule.ts" }
TypeScript/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion4.ts_0_222
/// <reference path="fourslash.ts" /> // @allowJs: true // @filename: /a.js ////const foo = { //// bar: { //// baz: 42, //// } ////} /////** @typedef { typeof foo./**/ } Foo */ verify.baselineCompletions();
{ "end_byte": 222, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion4.ts" }
TypeScript/tests/cases/fourslash/unusedVariableInModule4.ts_0_326
/// <reference path='fourslash.ts' /> // @noUnusedLocals: true // @noUnusedParameters: true //// export {} //// [|var x = function f1(m: number) {}|] //// x; //// export var y: string; verify.codeFix({ description: "Remove unused declaration for: 'm'", index: 0, newRangeContent: `var x = function f1() {}`, });
{ "end_byte": 326, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedVariableInModule4.ts" }
TypeScript/tests/cases/fourslash/completionListAfterFunction3.ts_0_255
/// <reference path='fourslash.ts' /> ////// Outside the function expression ////var x1 = (a: number) => { }/*1*/; //// ////var x2 = (b: number) => {/*2*/ }; verify.completions( { marker: "1", excludes: "a" }, { marker: "2", includes: "b" }, );
{ "end_byte": 255, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListAfterFunction3.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType_js6.ts_0_634
/// <reference path='fourslash.ts' /> // @allowJs: true // @Filename: a.js //// /** //// * @template {number} T, U //// * @param {T} b //// * @param {U} c //// * @returns {/*a*/T | U/*b*/} //// */ //// function a(b, c) {} goTo.file('a.js') goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to typedef", actionDescription: "Extract to typedef", newContent: `/** * @template {number} T * @template U * @typedef {T | U} /*RENAME*/NewType */ /** * @template {number} T, U * @param {T} b * @param {U} c * @returns {NewType<T, U>} */ function a(b, c) {}`, });
{ "end_byte": 634, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType_js6.ts" }
TypeScript/tests/cases/fourslash/codeFixSpelling11.ts_0_377
/// <reference path='fourslash.ts' /> // @noImplicitOverride: true ////abstract class A { //// abstract doSomething(): void; ////} ////abstract class B extends A { //// abstract override [|doSomethang|](): number; ////} verify.codeFix({ index: 0, description: [ts.Diagnostics.Change_spelling_to_0.message, "doSomething"], newRangeContent: "doSomething" });
{ "end_byte": 377, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixSpelling11.ts" }
TypeScript/tests/cases/fourslash/extract-unterminated3.ts_0_412
/// <reference path="fourslash.ts" /> // Unterminated template literal: //// /*1*/const foo = `head${middle}tail/*2*/ goTo.select("1", "2"); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "function_scope_0", actionDescription: "Extract to function in global scope", newContent: `const foo = /*RENAME*/newFunction() function newFunction() { return \`head\${middle}tail\`; } ` });
{ "end_byte": 412, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-unterminated3.ts" }
TypeScript/tests/cases/fourslash/inlayHintsFunctionParameterTypes1.ts_0_728
/// <reference path="fourslash.ts" /> //// type F1 = (a: string, b: number) => void //// const f1: F1 = (a, b) => { } //// const f2: F1 = (a, b: number) => { } //// function foo1 (cb: (a: string) => void) {} //// foo1((a) => { }) //// function foo2 (cb: (a: Exclude<1 | 2 | 3, 1>) => void) {} //// foo2((a) => { }) //// function foo3 (a: (b: (c: (d: Exclude<1 | 2 | 3, 1>) => void) => void) => void) {} //// foo3(a => { //// a(d => {}) //// }) //// function foo4<T>(v: T, a: (v: T) => void) {} //// foo4(1, a => { }) //// type F2 = (a: { //// a: number //// b: string //// }) => void //// const foo5: F2 = (a) => { } verify.baselineInlayHints(undefined, { includeInlayFunctionParameterTypeHints: true });
{ "end_byte": 728, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlayHintsFunctionParameterTypes1.ts" }
TypeScript/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts_3_584
/ <reference path='fourslash.ts'/> ////class C { //// /*1*/get /*2*/#foo(){ return 1; } //// /*3*/set /*4*/#foo(value: number){ } //// constructor() { //// this./*5*/#foo(); //// } ////} ////class D extends C { //// constructor() { //// super() //// this.#foo = 20; //// } ////} ////class E { //// /*6*/get /*7*/#foo(){ return 1; } //// /*8*/set /*9*/#foo(value: number){ } //// constructor() { //// this./*10*/#foo(); //// } ////} verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10');
{ "end_byte": 584, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts" }
TypeScript/tests/cases/fourslash/smartIndentMissingBracketsIfKeyword.ts_0_114
/// <reference path='fourslash.ts'/> ////if /*1*/ goTo.marker("1"); edit.insert("\n"); verify.indentationIs(4);
{ "end_byte": 114, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentMissingBracketsIfKeyword.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionExpandoClass2.ts_0_307
/// <reference path="fourslash.ts" /> // @strict: true // @allowJs: true // @checkJs: true // @filename: index.js //// const Core = {} //// //// Core.Test = class { //// constructor() { } //// } //// //// Core.Test.prototype.foo = 10 //// //// new Core.Tes/*1*/t() verify.baselineGoToDefinition("1");
{ "end_byte": 307, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionExpandoClass2.ts" }
TypeScript/tests/cases/fourslash/inlineVariableMultipleDeclarations.ts_0_278
/// <reference path="fourslash.ts" /> ////const /*a1*/foo/*b1*/ = "foo"; ////type /*a2*/foo/*b2*/ = string; ////type bar = foo; goTo.select("a1", "b1"); verify.not.refactorAvailable("Inline variable"); goTo.select("a2", "b2"); verify.not.refactorAvailable("Inline variable");
{ "end_byte": 278, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlineVariableMultipleDeclarations.ts" }
TypeScript/tests/cases/fourslash/breakpointValidationDestructuringForObjectBindingPattern.ts_0_2411
/// <reference path='fourslash.ts' /> ////declare var console: { //// log(msg: any): void; ////} ////interface Robot { //// name: string; //// skill: string; ////} ////interface MultiRobot { //// name: string; //// skills: { //// primary: string; //// secondary: string; //// }; ////} ////let robot: Robot = { name: "mower", skill: "mowing" }; ////let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; ////function getRobot() { //// return robot; ////} ////function getMultiRobot() { //// return multiRobot; ////} ////for (let {name: nameA } = robot, i = 0; i < 1; i++) { //// console.log(nameA); ////} ////for (let {name: nameA } = getRobot(), i = 0; i < 1; i++) { //// console.log(nameA); ////} ////for (let {name: nameA } = <Robot>{ name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { //// console.log(nameA); ////} ////for (let { skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { //// console.log(primaryA); ////} ////for (let { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { //// console.log(primaryA); ////} ////for (let { skills: { primary: primaryA, secondary: secondaryA } } = //// <MultiRobot>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, //// i = 0; i < 1; i++) { //// console.log(primaryA); ////} ////for (let {name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { //// console.log(nameA); ////} ////for (let {name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { //// console.log(nameA); ////} ////for (let {name: nameA, skill: skillA } = <Robot>{ name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { //// console.log(nameA); ////} ////for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { //// console.log(primaryA); ////} ////for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { //// console.log(primaryA); ////} ////for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = //// <MultiRobot>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, //// i = 0; i < 1; i++) { //// console.log(primaryA); ////} verify.baselineCurrentFileBreakpointLocations();
{ "end_byte": 2411, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationDestructuringForObjectBindingPattern.ts" }
TypeScript/tests/cases/fourslash/mapCodeNestedForReplacement.ts_0_370
///<reference path="fourslash.ts"/> // @Filename: /index.ts //// function foo() { //// for (let x = 0; x < 10; x++) [||]{ //// console.log("hello"); //// console.log("you"); //// } //// return 1; //// } //// verify.baselineMapCode([test.ranges()], [ ` for (let x = 0; x < 10; x++) { console.log("goodbye"); console.log("world"); } ` ]);
{ "end_byte": 370, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/mapCodeNestedForReplacement.ts" }
TypeScript/tests/cases/fourslash/argumentsAreAvailableAfterEditsAtEndOfFunction.ts_0_392
/// <reference path='fourslash.ts'/> ////module Test1 { //// class Person { //// children: string[]; //// constructor(public name: string, children: string[]) { //// /**/ //// } //// } ////} goTo.marker(); var text = "this.children = ch"; edit.insert(text); verify.completions({ includes: { name: "children", text: "(parameter) children: string[]" }, isNewIdentifierLocation: true });
{ "end_byte": 392, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/argumentsAreAvailableAfterEditsAtEndOfFunction.ts" }
TypeScript/tests/cases/fourslash/jsdocPropTagCompletion.ts_0_155
///<reference path="fourslash.ts" /> /////** //// * @typedef Foo //// * @pr/**/ //// */ verify.completions({ marker: "", includes: ["prop"], });
{ "end_byte": 155, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocPropTagCompletion.ts" }
TypeScript/tests/cases/fourslash/codeFixImportNonExportedMember_all7.ts_0_538
/// <reference path="fourslash.ts" /> // @module: esnext // @filename: /a.ts ////type T1 = {}; ////type T2 = {}; ////type T3 = {}; ////const a = 1; ////export { a, type T1 }; // @filename: /b.ts ////import { T2, T3 } from "./a"; goTo.file("/b.ts"); verify.codeFixAll({ fixId: "fixImportNonExportedMember", fixAllDescription: ts.Diagnostics.Export_all_referenced_locals.message, newFileContent: { "/a.ts": `type T1 = {}; type T2 = {}; type T3 = {}; const a = 1; export { a, type T1, type T2, type T3 };`, }, });
{ "end_byte": 538, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixImportNonExportedMember_all7.ts" }
TypeScript/tests/cases/fourslash/quickInfoForObjectBindingElementPropertyName03.ts_0_306
/// <reference path='fourslash.ts'/> ////interface Recursive { //// next?: Recursive; //// value: any; ////} //// ////function f ({ /*1*/next: { /*2*/next: x} }: Recursive) { ////} for (const marker of test.markerNames()) { verify.quickInfoAt(marker, "(property) Recursive.next?: Recursive"); }
{ "end_byte": 306, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForObjectBindingElementPropertyName03.ts" }
TypeScript/tests/cases/fourslash/signatureHelpSimpleConstructorCall.ts_0_621
/// <reference path='fourslash.ts' /> ////class ConstructorCall { //// constructor(str: string, num: number) { //// } ////} ////var x = new ConstructorCall(/*constructorCall1*/1,/*constructorCall2*/2); verify.signatureHelp( { marker: "constructorCall1", text: "ConstructorCall(str: string, num: number): ConstructorCall", parameterName: "str", parameterSpan: "str: string", }, { marker: "constructorCall2", text: "ConstructorCall(str: string, num: number): ConstructorCall", parameterName: "num", parameterSpan: "num: number", }, );
{ "end_byte": 621, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpSimpleConstructorCall.ts" }
TypeScript/tests/cases/fourslash/completionForStringLiteralRelativeImport5.ts_0_1354
/// <reference path='fourslash.ts' /> // Should give correct completions for directories when invoked from within nested folders // @rootDirs: /repo/src1,/repo/src2/,/repo/generated1,/repo/generated2/ // @Filename: /dir/secret_file.ts //// /*secret_file*/ // @Filename: /repo/src1/dir/test1.ts //// import * as foo1 from ".//*import_as1*/ //// import foo2 = require(".//*import_equals1*/ //// var foo3 = require(".//*require1*/ // @Filename: /repo/src2/dir/test2.ts //// import * as foo1 from "..//*import_as2*/ //// import foo2 = require("..//*import_equals2*/ //// var foo3 = require("..//*require2*/ // @Filename: /repo/src2/index.ts //// import * as foo1 from ".//*import_as3*/ //// import foo2 = require(".//*import_equals3*/ //// var foo3 = require(".//*require3*/ // @Filename: /repo/generated1/dir/f1.ts //// /*f1*/ // @Filename: /repo/generated2/dir/f2.ts //// /*f2*/ verify.completions( { marker: ["import_as1", "import_equals1", "require1"], unsorted: ["f1", "f2", "test2"], isNewIdentifierLocation: true, }, { marker: ["import_as2", "import_equals2", "require2"], unsorted: ["dir", "index"], isNewIdentifierLocation: true, }, { marker: ["import_as3", "import_equals3", "require3"], unsorted: ["dir"], isNewIdentifierLocation: true, } );
{ "end_byte": 1354, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteralRelativeImport5.ts" }
TypeScript/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts_0_187
/// <reference path='fourslash.ts' /> /////*1*/namespace /*2*/Numbers { //// export var n = 12; ////} ////let x = /*3*/Numbers.n + 1; verify.baselineFindAllReferences('1', '2', '3');
{ "end_byte": 187, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingMember22.ts_0_264
/// <reference path='fourslash.ts' /> ////[|type Foo = {};|] ////function f(foo: Foo) { //// foo.y; ////} verify.codeFix({ description: [ts.Diagnostics.Declare_property_0.message, "y"], index: 0, newRangeContent: `type Foo = { y: any; };` });
{ "end_byte": 264, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingMember22.ts" }
TypeScript/tests/cases/fourslash/augmentedTypesModule6.ts_0_691
/// <reference path='fourslash.ts'/> ////declare class m3f { foo(x: number): void } ////module m3f { export interface I { foo(): void } } ////var x: m3f./*1*/ ////var /*4*/r = new /*2*/m3f(/*3*/); ////r./*5*/ ////var r2: m3f.I = r; ////r2./*6*/ verify.completions({ marker: "1", includes: "I", excludes: "foo" }); edit.insert('I;'); verify.completions({ marker: "2", includes: "m3f" }); verify.signatureHelp({ marker: "3", text: "m3f(): m3f" }); verify.quickInfoAt("4", "var r: m3f"); verify.completions({ marker: "5", includes: "foo" }); edit.insert('foo(1)'); verify.completions({ marker: "6", includes: "foo" }); edit.insert('foo('); verify.signatureHelp({ text: "foo(): void" });
{ "end_byte": 691, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/augmentedTypesModule6.ts" }
TypeScript/tests/cases/fourslash/todoComments1.ts_0_61
//// // [|TODO|] verify.todoCommentsInCurrentFile(["TODO"]);
{ "end_byte": 61, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/todoComments1.ts" }
TypeScript/tests/cases/fourslash/annotateWithTypeFromJSDoc8.ts_0_368
/// <reference path='fourslash.ts' /> /////** //// * @param {number} x //// * @returns {number} //// */ ////var f = function (x) { //// return x ////} verify.codeFix({ description: "Annotate with type from JSDoc", index: 0, newFileContent: `/** * @param {number} x * @returns {number} */ var f = function (x: number): number { return x }`, });
{ "end_byte": 368, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/annotateWithTypeFromJSDoc8.ts" }
TypeScript/tests/cases/fourslash/validBraceCompletionPosition.ts_0_500
/// <reference path="fourslash.ts" /> //// function parseInt(/*1*/){} //// class aa/*2*/{ //// public b/*3*/(){} //// } //// interface I/*4*/{} //// var x = /*5*/{ a:true } goTo.marker('1'); verify.isValidBraceCompletionAtPosition('('); goTo.marker('2'); verify.isValidBraceCompletionAtPosition('('); goTo.marker('3'); verify.isValidBraceCompletionAtPosition('('); goTo.marker('4'); verify.isValidBraceCompletionAtPosition('('); goTo.marker('5'); verify.isValidBraceCompletionAtPosition('(');
{ "end_byte": 500, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/validBraceCompletionPosition.ts" }
TypeScript/tests/cases/fourslash/completionsDefaultExport.ts_0_250
/// <reference path="fourslash.ts" /> // @Filename: /a.ts ////export default function f() {} // @Filename: /b.ts ////import * as a from "./a"; ////a./**/; verify.completions({ marker: "", exact: { name: "default", text: "function f(): void" } });
{ "end_byte": 250, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsDefaultExport.ts" }
TypeScript/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction15.ts_0_360
/// <reference path='fourslash.ts' /> //// const foo = /*a*/a/*b*/ => { return void 0; }; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Add or remove braces in an arrow function", actionName: "Remove braces from arrow function", actionDescription: "Remove braces from arrow function", newContent: `const foo = a => void 0;`, });
{ "end_byte": 360, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction15.ts" }
TypeScript/tests/cases/fourslash/signatureHelpOptionalCall.ts_0_320
/// <reference path='fourslash.ts'/> ////function fnTest(str: string, num: number) { } ////fnTest?.(/*1*/); verify.signatureHelp( { marker: "1", text: 'fnTest(str: string, num: number): void', parameterCount: 2, parameterName: "str", parameterSpan: "str: string", }, );
{ "end_byte": 320, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpOptionalCall.ts" }
TypeScript/tests/cases/fourslash/sideEffectImportsSuggestion1.ts_0_351
/// <reference path="fourslash.ts" /> // @allowJs: true // @noEmit: true // @module: commonjs // @noUncheckedSideEffectImports: true // @filename: moduleA/a.js //// import "b"; //// import "c"; // @filename: node_modules/b.ts //// var a = 10; // @filename: node_modules/c.js //// exports.a = 10; //// c = 10; verify.getSuggestionDiagnostics([]);
{ "end_byte": 351, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/sideEffectImportsSuggestion1.ts" }
TypeScript/tests/cases/fourslash/unusedImports3FS.ts_0_450
/// <reference path='fourslash.ts' /> // @noUnusedLocals: true // @Filename: file2.ts ////[| import {Calculator, /*some comments*/ test, test2} from "./file1" |] //// test(); //// test2(); // @Filename: file1.ts //// export class Calculator { //// handleChar() {} //// } //// export function test() { //// //// } //// export function test2() { //// //// } verify.rangeAfterCodeFix(`import {/*some comments*/ test, test2} from "./file1"`);
{ "end_byte": 450, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedImports3FS.ts" }
TypeScript/tests/cases/fourslash/codeFixUndeclaredMethodFunctionArgs_importArgumentType2.ts_0_903
/// <reference path='fourslash.ts' /> // @Filename: a.ts ////export interface A { //// x: number; ////} // @Filename: b.ts ////export interface B<T> { //// payload: T; ////} // @Filename: c.ts ////import { A } from "./a"; ////import { B } from "./b"; ////export interface C<T> { //// payload: T; ////} ////export function create(fn: (args: C<B<A>>) => void) {} // @Filename: d.ts ////import { create } from "./c"; ////class D { //// bar() { //// create(args => this.foo(args)); //// } ////} goTo.file("d.ts"); verify.codeFix({ description: [ts.Diagnostics.Declare_method_0.message, "foo"], index: 0, newFileContent: `import { A } from "./a"; import { B } from "./b"; import { C, create } from "./c"; class D { bar() { create(args => this.foo(args)); } foo(args: C<B<A>>): void { throw new Error("Method not implemented."); } }` });
{ "end_byte": 903, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUndeclaredMethodFunctionArgs_importArgumentType2.ts" }
TypeScript/tests/cases/fourslash/importValueUsedAsType.ts_0_195
/// <reference path="fourslash.ts" /> //// /**/ //// module A { //// export var X; //// import Z = A.X; //// var v: Z; //// } goTo.marker(); // Used to crash here edit.insert(' ');
{ "end_byte": 195, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importValueUsedAsType.ts" }
TypeScript/tests/cases/fourslash/distinctTypesInCallbacksWithSameNames.ts_0_901
/// <reference path='fourslash.ts'/> ////interface Collection<T> { //// length: number; //// add(x: T): void; //// remove(x: T): boolean; ////} ////interface Combinators { //// forEach<T>(c: Collection<T>, f: (x: T) => any): void; //// forEach<T, U>(c: Collection<T>, f: (x: T) => U): void; ////} ////var c2: Collection<number>; ////var c3: Collection<Collection<number>>; ////var _: Combinators; ////var r = _.forEach(c2, (x) => { return x./*1*/toFixed() }); ////var r2 = _.forEach(c3, (x) => { return x./*2*/toFixed() }); /////*3*/ const verifyCompletions = () => verify.completions( { marker: "1", includes: "toFixed" }, { marker: "2", exact: ["add", "length", "remove"] }, ); verifyCompletions(); goTo.marker('3'); edit.insert(`class A { foo() { } } var c4: Collection<A>; var r3 = _.forEach(c4, (x) => { return x.foo() }); `); verifyCompletions();
{ "end_byte": 901, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/distinctTypesInCallbacksWithSameNames.ts" }
TypeScript/tests/cases/fourslash/tripleSlashRefPathCompletionHiddenFile.ts_0_559
/// <reference path='fourslash.ts' /> // Exercises completions for hidden files (ie: those beginning with '.') // @Filename: f.ts //// /*f*/ // @Filename: .hidden.ts //// /*hidden*/ // @Filename: test.ts //// /// <reference path="/*0*/ //// /// <reference path="[|./*1*/|] //// /// <reference path=".//*2*/ //// /// <reference path=".\/*3*/ verify.completions( { marker: ["0", "2", "3"], exact: "f.ts", isNewIdentifierLocation: true }, { marker: "1", exact: { name: "f.ts", replacementSpan: test.ranges()[0] }, isNewIdentifierLocation: true }, );
{ "end_byte": 559, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tripleSlashRefPathCompletionHiddenFile.ts" }
TypeScript/tests/cases/fourslash/unusedTypeParametersInMethod1.ts_0_223
/// <reference path='fourslash.ts' /> // @noUnusedParameters: true //// class C1 { //// [|f1<T extends number>()|] {} //// } verify.codeFix({ description: "Remove type parameters", newRangeContent: "f1()", });
{ "end_byte": 223, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedTypeParametersInMethod1.ts" }
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports44-default-export.ts_0_332
/// <reference path='fourslash.ts'/> // @isolatedDeclarations: true // @declaration: true // @lib: es2019 // @Filename: /code.ts //// export default 1 + 1; verify.codeFix({ description: "Extract default export to variable", index: 0, newFileContent: `const _default_1: number = 1 + 1; export default _default_1;` });
{ "end_byte": 332, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports44-default-export.ts" }
TypeScript/tests/cases/fourslash/incrementalParsingDynamicImport2.ts_0_300
/// <reference path="fourslash.ts"/> // @lib: es2015 // @Filename: ./foo.ts //// export function bar() { return 1; } // @Filename: ./0.ts //// /*1*/ import { bar } from "./foo" verify.numberOfErrorsInCurrentFile(0); goTo.marker("1"); edit.insert("var x = "); verify.numberOfErrorsInCurrentFile(1);
{ "end_byte": 300, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/incrementalParsingDynamicImport2.ts" }
TypeScript/tests/cases/fourslash/codeFixInvalidJsxCharacters5.ts_0_487
/// <reference path='fourslash.ts' /> // @jsx: react // @filename: main.tsx //// let foo = <div>}{"foo"}</div>; verify.codeFix({ description: ts.Diagnostics.Wrap_invalid_character_in_an_expression_container.message, newFileContent: `let foo = <div>{"}"}{"foo"}</div>;`, index: 0, }); verify.codeFix({ description: ts.Diagnostics.Convert_invalid_character_to_its_html_entity_code.message, newFileContent: `let foo = <div>&rbrace;{"foo"}</div>;`, index: 1, });
{ "end_byte": 487, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInvalidJsxCharacters5.ts" }
TypeScript/tests/cases/fourslash/codeFixUseDefaultImport.ts_0_949
/// <reference path='fourslash.ts' /> // @allowSyntheticDefaultImports: true // @Filename: /a.d.ts ////declare const x: number; ////export = x; // @Filename: /b.ts /////*com ment*/import * as [|a|] from "./a";/*tnem moc*/ ////a; // @Filename: /c.ts /////*com ment*/import [|a|] = require("./a");/*tnem moc*/ ////a; // @Filename: /d.ts ////import "./a"; // @Filename: /e.ts ////import * as n from "./non-existant"; ////n; for (const file of ["/b.ts", "/c.ts"]) { goTo.file(file); verify.getSuggestionDiagnostics([{ message: "Import may be converted to a default import.", range: test.ranges().find(r => r.fileName === file), code: 80003, }]); verify.codeFix({ description: "Convert to default import", newFileContent: `/*com ment*/import a from "./a";/*tnem moc*/ a;`, }); } for (const file of ["/d.ts", "/e.ts"]) { goTo.file(file); verify.getSuggestionDiagnostics([]); }
{ "end_byte": 949, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUseDefaultImport.ts" }
TypeScript/tests/cases/fourslash/navigationBarFunctionPrototype4.ts_0_1616
/// <reference path="fourslash.ts"/> // @Filename: foo.js ////var A; ////A.prototype = { }; ////A.prototype = { m() {} }; ////A.prototype.a = function() { }; ////A.b = function() { }; //// ////var B; ////B["prototype"] = { }; ////B["prototype"] = { m() {} }; ////B["prototype"]["a"] = function() { }; ////B["b"] = function() { }; verify.navigationTree({ "text": "<global>", "kind": "script", "childItems": [{ name: "A", quoted: false }, { name: "B", quoted: true }].map(({ name, quoted }) => ( { "text": name, "kind": "class", "childItems": [ { "text": "constructor", "kind": "constructor" }, { "text": "m", "kind": "method" }, { "text": quoted ? `"a"` : "a", "kind": "function" }, { "text": quoted ? `"b"` : "b", "kind": "function" } ] } )) }); verify.navigationBar([ { "text": "<global>", "kind": "script", "childItems": ["A", "B"].map(name => ( { "text": name, "kind": "class" } )) }, ...[{ name: "A", quoted: false }, { name: "B", quoted: true }].map(({ name, quoted }) => ({ "text": name, "kind": "class", "childItems": [ { "text": "constructor", "kind": "constructor" }, { "text": "m", "kind": "method" }, { "text": quoted ? `"a"` : "a", "kind": "function" }, { "text": quoted ? `"b"` : "b", "kind": "function" } ], "indent": 1 })) ]);
{ "end_byte": 1616, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarFunctionPrototype4.ts" }
TypeScript/tests/cases/fourslash/moveToNewFile_format.ts_0_342
/// <reference path='fourslash.ts' /> // @Filename: /a.ts ////[|function f() { //// const x = 0; ////}|] var copy = format.copyFormatOptions(); copy.ConvertTabsToSpaces = false; format.setFormatOptions(copy); verify.moveToNewFile({ newFileContents: { "/a.ts": ``, "/f.ts": `function f() { const x = 0; } `, }, });
{ "end_byte": 342, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_format.ts" }
TypeScript/tests/cases/fourslash/formatSelectionWithTrivia7.ts_0_279
/// <reference path="fourslash.ts" /> // Tests comment indentation with range ending before next token (same line) ////if (true) { /////*begin*/// test comment/*end*/ ////} format.selection('begin', 'end'); verify.currentFileContentIs("if (true) {\n // test comment\n}");
{ "end_byte": 279, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatSelectionWithTrivia7.ts" }
TypeScript/tests/cases/fourslash/textChangesPreserveNewlines6.ts_0_690
/// <reference path="fourslash.ts" /> //// /*1*/f // call expression //// (arg)( //// /** @type {number} */ //// blah, /* another param */ blah // TODO: name variable not 'blah' //// //// );/*2*/ goTo.select("1", "2"); // Note: the loss of `// TODO: name variable not 'blah'` // is not desirable, but not related to this test. edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "function_scope_0", actionDescription: "Extract to function in global scope", newContent: `/*RENAME*/newFunction(); function newFunction() { f // call expression (arg)( /** @type {number} */ blah, /* another param */ blah ); } ` });
{ "end_byte": 690, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/textChangesPreserveNewlines6.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration9.ts_0_453
/// <reference path='fourslash.ts' /> ////namespace Foo { //// export const x = 0; ////} //// ////const test: string = Foo.test(); verify.codeFix({ index: 0, description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "test"], newFileContent: `namespace Foo { export const x = 0; export function test(): string { throw new Error("Function not implemented."); } } const test: string = Foo.test();` });
{ "end_byte": 453, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration9.ts" }
TypeScript/tests/cases/fourslash/quickInfoLink10.ts_0_158
/// <reference path="fourslash.ts" /> /////** //// * start {@link https://vscode.dev/ | end} //// */ ////const /**/a = () => 1; verify.baselineQuickInfo();
{ "end_byte": 158, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoLink10.ts" }
TypeScript/tests/cases/fourslash/breakpointValidationInBlankLine.ts_0_207
/// <reference path='fourslash.ts' /> // @BaselineFile: bpSpan_inBlankLine.baseline // @Filename: bpSpan_inBlankLine.ts ////var x = 10; //// ////var y = 10; verify.baselineCurrentFileBreakpointLocations();
{ "end_byte": 207, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationInBlankLine.ts" }
TypeScript/tests/cases/fourslash/codeFixClassPropertyInitialization3.ts_0_244
/// <reference path='fourslash.ts' /> // @strict: true //// class T { //// a: boolean; //// } verify.codeFix({ description: `Add initializer to property 'a'`, newFileContent: `class T { a: boolean = false; }`, index: 2 })
{ "end_byte": 244, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassPropertyInitialization3.ts" }
TypeScript/tests/cases/fourslash/findAllRefsExportEquals.ts_0_232
/// <reference path='fourslash.ts' /> // @Filename: /a.ts ////type /*0*/T = number; /////*1*/export = /*2*/T; // @Filename: /b.ts ////import /*3*/T = require("/*4*/./a"); verify.baselineFindAllReferences('0', '1', '2', '3', '4')
{ "end_byte": 232, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsExportEquals.ts" }
TypeScript/tests/cases/fourslash/gotoDefinitionConstructorFunction.ts_0_347
/// <reference path="fourslash.ts" /> // @allowJs: true // @checkJs: true // @noEmit: true // @filename: gotoDefinitionConstructorFunction.js //// function /*end*/StringStreamm() { //// } //// StringStreamm.prototype = { //// }; //// //// function runMode () { //// new [|/*start*/StringStreamm|]() //// }; verify.baselineGoToDefinition('start')
{ "end_byte": 347, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/gotoDefinitionConstructorFunction.ts" }
TypeScript/tests/cases/fourslash/codeFixAwaitInSyncFunction5.ts_0_302
/// <reference path='fourslash.ts' /> ////class Foo { //// bar() { //// await Promise.resolve(); //// } ////} verify.codeFix({ description: "Add async modifier to containing function", newFileContent: `class Foo { async bar() { await Promise.resolve(); } }`, });
{ "end_byte": 302, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAwaitInSyncFunction5.ts" }
TypeScript/tests/cases/fourslash/formattingSpaceBetweenOptionalChaining.ts_0_261
/// <reference path='fourslash.ts' /> /////*1*/a ?. b ?. c . d; /////*2*/o . m() ?. length; format.document(); goTo.marker("1"); verify.currentLineContentIs("a?.b?.c.d;"); goTo.marker("2"); verify.currentLineContentIs("o.m()?.length;");
{ "end_byte": 261, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingSpaceBetweenOptionalChaining.ts" }
TypeScript/tests/cases/fourslash/documentHighlightAtInheritedProperties3.ts_3_287
/ <reference path='fourslash.ts'/> // @Filename: file1.ts //// interface interface1 extends interface1 { //// [|doStuff|](): void; //// [|propName|]: string; //// } //// //// var v: interface1; //// v.[|propName|]; //// v.[|doStuff|](); verify.baselineDocumentHighlights();
{ "end_byte": 287, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/documentHighlightAtInheritedProperties3.ts" }
TypeScript/tests/cases/fourslash/refactorInferFunctionReturnType19.ts_0_800
/// <reference path='fourslash.ts' /> ////const f1 = /*a*//*b*/() =>{ //// return { x: 1, y: 1 }; ////} ////const f2 = (/*c*//*d*/) => { //// return { x: 1, y: 1 }; ////} ////const f3 = () => /*e*//*f*/{ //// return { x: 1, y: 1 }; ////} ////const f4 = () => {/*g*//*h*/ //// return { x: 1, y: 1 }; ////} ////const f5 = () => { //// return { x: 1, y: 1/*i*//*j*/ }; ////} goTo.select("a", "b"); verify.refactorAvailable("Infer function return type"); goTo.select("c", "d"); verify.refactorAvailable("Infer function return type"); goTo.select("e", "f"); verify.not.refactorAvailable("Infer function return type"); goTo.select("g", "h"); verify.not.refactorAvailable("Infer function return type"); goTo.select("i", "j"); verify.not.refactorAvailable("Infer function return type");
{ "end_byte": 800, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorInferFunctionReturnType19.ts" }
TypeScript/tests/cases/fourslash/unusedImports10FS.ts_0_265
/// <reference path='fourslash.ts' /> // @noUnusedLocals: true //// module A { //// export class Calculator { //// public handelChar() { //// } //// } //// } //// module B { //// [|import a = A;|] //// } verify.rangeAfterCodeFix("");
{ "end_byte": 265, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedImports10FS.ts" }
TypeScript/tests/cases/fourslash/moveToNewFile_overloads1.ts_0_462
/// <reference path='fourslash.ts' /> // @Filename: /a.ts ////[|function add(x: number, y: number): number;|] ////function add(x: string, y: string): string; ////function add(x: any, y: any) { //// return x + y; ////} verify.moveToNewFile({ newFileContents: { "/a.ts": "", "/add.ts": `function add(x: number, y: number): number; function add(x: string, y: string): string; function add(x: any, y: any) { return x + y; } ` }, });
{ "end_byte": 462, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_overloads1.ts" }
TypeScript/tests/cases/fourslash/navigationItemsExactMatch.ts_0_1019
/// <reference path="fourslash.ts"/> // @noLib: true ////[|{| "name": "Shapes", "kind": "module" |}module Shapes { //// [|{| "name": "Point", "kind": "class", "kindModifiers": "export", "containerName": "Shapes", "containerKind": "module" |}export class Point { //// [|{| "name": "origin", "kind": "property", "kindModifiers": "private", "containerName": "Point", "containerKind": "class" |}private origin = 0.0;|] //// //// [|{| "name": "distFromZero", "kind": "property", "kindModifiers": "private", "containerName": "Point", "containerKind": "class" |}private distFromZero = 0.0;|] //// //// [|{| "name": "distance", "kind": "getter", "containerName": "Point", "containerKind": "class" |}get distance(): number { return 0; }|] //// }|] ////}|] //// ////var [|{| "name": "xyz", "kind": "var" |}xyz = new Shapes.Point()|]; for (const range of test.ranges()) { verify.navigateTo({ pattern: range.marker.data.name, expected: [{ ...range.marker.data, range }], }); }
{ "end_byte": 1019, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationItemsExactMatch.ts" }
TypeScript/tests/cases/fourslash/completionTypeAssertion.ts_0_164
/// <reference path="fourslash.ts" /> //// var x = 'something' //// var y = this as/*1*/ verify.completions({marker: "1", exact: completion.globalsPlus(["x"]) })
{ "end_byte": 164, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionTypeAssertion.ts" }
TypeScript/tests/cases/fourslash/organizeImports18.ts_0_724
/// <reference path="fourslash.ts" /> // @filename: /A.ts ////export interface A {} ////export function bFuncA(a: A) {} // @filename: /B.ts ////export interface B {} ////export function bFuncB(b: B) {} // @filename: /C.ts ////export interface C {} ////export function bFuncC(c: C) {} // @filename: /test.ts ////export { C } from "./C"; ////export { B } from "./B"; ////export { A } from "./A"; //// ////export { bFuncC } from "./C"; ////export { bFuncB } from "./B"; ////export { bFuncA } from "./A"; goTo.file("/test.ts"); verify.organizeImports( `export { A } from "./A"; export { B } from "./B"; export { C } from "./C"; export { bFuncA } from "./A"; export { bFuncB } from "./B"; export { bFuncC } from "./C"; `);
{ "end_byte": 724, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImports18.ts" }
TypeScript/tests/cases/fourslash/codeFixChangeExtendsToImplementsWithTrivia.ts_0_535
/// <reference path='fourslash.ts' /> //// interface I1 { } //// interface I2 { } //// interface I3 { } //// [|class MyClass /*A !*/ //B ! //// /*C !*/ extends /*D !*/ I1 /*E !*/ //F ! //// /*G !*/ implements /*H !*/ I2 /*I !*/, /*J !*/ I3 /*K !*/ //L !|] //// { //// } verify.codeFix({ description: "Change 'extends' to 'implements'", // TODO: GH#18794 newRangeContent: `class MyClass /*A !*/ //B ! /*C !*/ implements /*D !*/ I1, /*E !*/ //F ! /*G !*/ /*H !*/ I2 /*I !*/, /*J !*/ I3 /*K !*/ //L !`, });
{ "end_byte": 535, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixChangeExtendsToImplementsWithTrivia.ts" }
TypeScript/tests/cases/fourslash/extendArrayInterface.ts_0_920
/// <reference path="fourslash.ts"/> ////var x = [1, 2, 3]; ////x./*1*/concat([4]); ////x./*2*/foo/*3*/()./*6*/toExponential/*7*/(2); ////x./*4*/foo/*5*/()./*8*/charAt/*9*/(0); //// verify.completions({ marker: "1", includes: "concat" }); // foo doesn't exist, so both references should be in error verify.errorExistsBetweenMarkers("2", "3"); verify.errorExistsBetweenMarkers("4", "5"); // Extend interface to contain foo returning type T goTo.eof(); edit.insertLine("interface Array<T> { foo(): T; }"); // References to foo should now not be in error verify.not.errorExistsBetweenMarkers("2", "3"); verify.not.errorExistsBetweenMarkers("4", "5"); // Resulting type should be a number, so toExponential should be valid, charAt should not verify.not.errorExistsBetweenMarkers("6", "7"); verify.errorExistsBetweenMarkers("8", "9"); // Should only be the one error in the file verify.numberOfErrorsInCurrentFile(1);
{ "end_byte": 920, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extendArrayInterface.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportAmbient3.ts_0_947
/// <reference path="fourslash.ts" /> //// let a = "I am a non-trivial statement that appears before imports"; //// import d from "other-ambient-module" //// import * as ns from "yet-another-ambient-module" //// var x = v1/*0*/ + 5; // @Filename: ambientModule.ts //// declare module "ambient-module" { //// export function f1(); //// export var v1; //// } // @Filename: otherAmbientModule.ts //// declare module "other-ambient-module" { //// export default function f2(); //// } // @Filename: yetAnotherAmbientModule.ts //// declare module "yet-another-ambient-module" { //// export function f3(); //// export var v3; //// } // test cases when there are no semicolons at the line end verify.importFixAtPosition([ `let a = "I am a non-trivial statement that appears before imports"; import { v1 } from "ambient-module"; import d from "other-ambient-module" import * as ns from "yet-another-ambient-module" var x = v1 + 5;` ]);
{ "end_byte": 947, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportAmbient3.ts" }
TypeScript/tests/cases/fourslash/declarationExpressions.ts_0_1056
/// <reference path="fourslash.ts"/> // @noLib: true ////[|{| "name": "A", "kind": "class" |}class A {}|] ////const [|{| "name": "B", "kind": "const" |}B = [|{| "name": "Cz", "kind": "class" |}class Cz { //// public x; ////}|]|]; ////[|{| "name": "D", "kind": "function" |}function D() {}|] ////const [|{| "name": "E", "kind": "const" |}E = [|{| "name": "F", "kind": "function" |}function F() {}|]|] ////console.log(function() {}, class {}); // Expression with no name should have no effect. ////console.log([|{| "name": "inner", "kind": "function" |}function inner() {}|]); ////String([|{| "name": "nn", "kind": "function" |}function nn() { //// [|{| "name": "cls", "kind": "class", "containerName": "nn", "containerKind": "function" |}class cls { //// [|{| "name": "prop", "kind": "property", "kindModifiers": "public", "containerName": "cls", "containerKind": "class" |}public prop;|] //// }|] ////}|])); for (const range of test.ranges()) { verify.navigateTo({ pattern: range.marker.data.name, expected: [{ ...range.marker.data, range }] }); }
{ "end_byte": 1056, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/declarationExpressions.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType57.ts_0_695
/// <reference path='fourslash.ts' /> // Where do lines get inserted? // The exact structure here doesn't matter, // just want to see something within a block body // to have the behavior defined in tests. //// function id<T>(x: T): T { //// return (() => { //// const s: /*a*/typeof x/*b*/ = x; //// return s; //// })(); //// } goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `function id<T>(x: T): T { return (() => { type /*RENAME*/NewType = typeof x; const s: NewType = x; return s; })(); }`, });
{ "end_byte": 695, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType57.ts" }
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess25.ts_0_529
/// <reference path='fourslash.ts' /> //// class A { //// public /*a*/"a"/*b*/: number = 1; //// } goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Generate 'get' and 'set' accessors", actionName: "Generate 'get' and 'set' accessors", actionDescription: "Generate 'get' and 'set' accessors", newContent: `class A { private /*RENAME*/"_a": number = 1; public get "a"(): number { return this["_a"]; } public set "a"(value: number) { this["_a"] = value; } }`, });
{ "end_byte": 529, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess25.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceWithAmbientSignatures3.ts_0_387
/// <reference path='fourslash.ts' /> ////declare abstract class A { //// abstract method(): void; ////} ////class B implements A {} verify.codeFix({ description: "Implement interface 'A'", newFileContent: `declare abstract class A { abstract method(): void; } class B implements A { method(): void { throw new Error("Method not implemented."); } }` });
{ "end_byte": 387, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceWithAmbientSignatures3.ts" }
TypeScript/tests/cases/fourslash/extract-method7.ts_0_542
/// <reference path='fourslash.ts' /> // You cannot extract a function initializer into the function's body. // The innermost scope (function_scope_0) is the sibling of the function, not the function itself. //// function fn(x = /*a*/3/*b*/) { //// } goTo.select('a', 'b'); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "function_scope_0", actionDescription: "Extract to function in global scope", newContent: `function fn(x = /*RENAME*/newFunction()) { } function newFunction() { return 3; } ` });
{ "end_byte": 542, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method7.ts" }
TypeScript/tests/cases/fourslash/getOccurrencesStatic1.ts_0_1486
/// <reference path='fourslash.ts' /> ////module m { //// export class C1 { //// public pub1; //// public pub2; //// private priv1; //// private priv2; //// protected prot1; //// protected prot2; //// //// public public; //// private private; //// protected protected; //// //// public constructor(public a, private b, protected c, public d, private e, protected f) { //// this.public = 10; //// this.private = 10; //// this.protected = 10; //// } //// //// public get x() { return 10; } //// public set x(value) { } //// //// public [|static|] statPub; //// private [|static|] statPriv; //// protected [|static|] statProt; //// } //// //// export interface I1 { //// } //// //// export declare module ma.m1.m2.m3 { //// interface I2 { //// } //// } //// //// export module mb.m1.m2.m3 { //// declare var foo; //// //// export class C2 { //// public pub1; //// private priv1; //// protected prot1; //// //// protected constructor(public public, protected protected, private private) { //// public = private = protected; //// } //// } //// } //// //// declare var ambientThing: number; //// export var exportedThing = 10; //// declare function foo(): string; ////} verify.baselineDocumentHighlights();
{ "end_byte": 1486, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesStatic1.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFix_require_UMD.ts_0_418
/// <reference path="fourslash.ts" /> // @allowJs: true // @checkJs: true // @Filename: umd.d.ts ////namespace Foo { function f() {} } ////export = Foo; ////export as namespace Foo; // @Filename: index.js ////Foo; ////module.exports = {}; goTo.file("index.js"); verify.codeFix({ index: 0, description: `Add import from "./umd"`, newFileContent: `const Foo = require("./umd"); Foo; module.exports = {};` });
{ "end_byte": 418, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_require_UMD.ts" }
TypeScript/tests/cases/fourslash/completionListErrorRecovery.ts_0_278
/// <reference path="fourslash.ts" /> ////class Foo { static fun() { }; } ////Foo./**/; /////*1*/var bar; verify.completions({ marker: "", includes: [{ name: "fun", sortText: completion.SortText.LocalDeclarationPriority }] }); verify.not.errorExistsAfterMarker("1");
{ "end_byte": 278, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListErrorRecovery.ts" }
TypeScript/tests/cases/fourslash/codeFixCorrectReturnValue10.ts_0_286
/// <reference path='fourslash.ts' /> //// const a: ((() => number) | (() => undefined)) = () => { 1 } verify.codeFixAvailable([ { description: ts.Diagnostics.Add_a_return_statement.message }, { description: ts.Diagnostics.Remove_braces_from_arrow_function_body.message } ]);
{ "end_byte": 286, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCorrectReturnValue10.ts" }
TypeScript/tests/cases/fourslash/noSmartIndentInsideMultilineString.ts_0_255
/// <reference path='fourslash.ts' /> ////window.onload = () => { //// var el = document.getElementById('content\/*1*/'); //// var greeter = new Greeter(el); ////greeter.start(); ////}; goTo.marker("1"); edit.insert("\n"); verify.indentationIs(0);
{ "end_byte": 255, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/noSmartIndentInsideMultilineString.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportFile0.ts_0_217
/// <reference path="fourslash.ts" /> //// [|f1/*0*/();|] // @Filename: jalapeño.ts //// export function f1() {} //// export var v1 = 5; verify.importFixAtPosition([ `import { f1 } from "./jalapeño"; f1();` ]);
{ "end_byte": 217, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportFile0.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingAttributes4.ts_0_510
/// <reference path='fourslash.ts' /> // @jsx: preserve // @filename: foo.tsx ////interface P { //// a: number; //// b: string; //// c: number[]; //// d: any; ////} //// ////const A = ({ a, b, c, d }: P) => //// <div>{a}{b}{c}{d}</div>; //// ////const props = { a: 1, c: [] }; ////const Bar = () => //// [|<A {...props}></A>|] verify.codeFix({ index: 0, description: ts.Diagnostics.Add_missing_attributes.message, newRangeContent: `<A b={""} d={undefined} {...props}></A>` });
{ "end_byte": 510, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingAttributes4.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionSwitchCase5.ts_0_115
/// <reference path="fourslash.ts" /> ////export [|/*start*/default|] {} verify.baselineGoToDefinition("start");
{ "end_byte": 115, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionSwitchCase5.ts" }
TypeScript/tests/cases/fourslash/completionsQuotedObjectLiteralUnion.ts_0_272
/// <reference path="fourslash.ts" /> //// interface A { //// "a-prop": string; //// } //// //// interface B { //// "b-prop": string; //// } //// //// const obj: A | B = { //// "/*1*/" //// } verify.completions({ marker: "1", exact: ["a-prop", "b-prop"] });
{ "end_byte": 272, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsQuotedObjectLiteralUnion.ts" }
TypeScript/tests/cases/fourslash/renameBindingElementInitializerExternal.ts_0_433
/// <reference path="fourslash.ts"/> ////[|const [|{| "contextRangeIndex": 0 |}external|] = true;|] //// ////function f({ //// lvl1 = [|external|], //// nested: { lvl2 = [|external|]}, //// oldName: newName = [|external|] ////}) {} //// ////const { //// lvl1 = [|external|], //// nested: { lvl2 = [|external|]}, //// oldName: newName = [|external|] ////} = obj; verify.baselineRenameAtRangesWithText("external");
{ "end_byte": 433, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameBindingElementInitializerExternal.ts" }
TypeScript/tests/cases/fourslash/memberListAfterDoubleDot.ts_0_104
/// <reference path='fourslash.ts'/> ////../**/ verify.completions({ marker: "", exact: undefined });
{ "end_byte": 104, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberListAfterDoubleDot.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateError.ts_0_353
/// <reference path='fourslash.ts' /> //// interface I<T extends string> { //// x: T; //// } //// //// class C implements I<number> { } // TODO: (arozga) Don't know how to instantiate in codeFix // if instantiation is invalid. // Should be verify.codeFixAvailable([]); verify.codeFixAvailable([{ description: "Implement interface 'I<number>'" }]);
{ "end_byte": 353, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateError.ts" }
TypeScript/tests/cases/fourslash/codeFixAddConvertToUnknownForNonOverlappingTypes9.ts_0_238
/// <reference path='fourslash.ts' /> // @checkJs: true // @allowJs: true // @filename: a.js ////let x = /** @type {string} */ (100); verify.not.codeFixAvailable(ts.Diagnostics.Add_unknown_conversion_for_non_overlapping_types.message);
{ "end_byte": 238, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddConvertToUnknownForNonOverlappingTypes9.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceEmptyTypeLiteral.ts_0_326
/// <reference path='fourslash.ts' /> //// //// interface I { //// x: {}; //// } //// //// class C implements I {[| //// |]constructor() { } //// } verify.codeFix({ description: "Implement interface 'I'", newFileContent:` interface I { x: {}; } class C implements I { constructor() { } x: {}; }`, });
{ "end_byte": 326, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceEmptyTypeLiteral.ts" }
TypeScript/tests/cases/fourslash/extract-const-callback-function-no-context3.ts_0_524
/// <reference path='fourslash.ts' /> ////declare function fnUnion(fn: ((a: number) => number) | ((a: string) => string)): void ////fnUnion(/*a*/(a: string) => a/*b*/); goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "constant_scope_0", actionDescription: "Extract to constant in enclosing scope", newContent: `declare function fnUnion(fn: ((a: number) => number) | ((a: string) => string)): void const newLocal = (a: string) => a; fnUnion(/*RENAME*/newLocal);` });
{ "end_byte": 524, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const-callback-function-no-context3.ts" }