_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/fourslash/breakpointValidationFunctionExpressions.ts_0_695
/// <reference path='fourslash.ts' /> // @BaselineFile: bpSpan_functionExpressions.baseline // @Filename: bpSpan_functionExpressions.ts ////var greetings = 0; ////var greet = (greeting: string): number => { //// greetings++; //// return greetings; ////} ////greet("Hello"); ////var incrGreetings = () => greetings++; ////var greetNewMsg = msg => greet(msg); ////greetNewMsg = function (msg: string) { //// return greet(msg); ////}; ////function bar(a = function foo() { //// return greetings; ////}) { //// if (!a()) { //// return a; //// } //// return function bar() { //// return -greetings; //// }; ////} verify.baselineCurrentFileBreakpointLocations();
{ "end_byte": 695, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationFunctionExpressions.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType45.ts_0_312
/// <reference path='fourslash.ts' /> //// type A = /*a*/B.C.D/*b*/; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = B.C.D; type A = NewType;`, });
{ "end_byte": 312, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType45.ts" }
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess37.ts_0_564
/// <reference path='fourslash.ts' /> // @strict: true ////class A { //// /*a*/foo?: string;/*b*/ ////} 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*/_foo?: string | undefined; public get foo(): string | undefined { return this._foo; } public set foo(value: string | undefined) { this._foo = value; } }` });
{ "end_byte": 564, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess37.ts" }
TypeScript/tests/cases/fourslash/indentationWithBaseIndent.ts_0_6380
/// <reference path="fourslash.ts"/> //// ////{| "indent": 10 , "baseIndentSize": 10 |} //// module classes { ////{| "indent": 14 , "baseIndentSize": 10 |} //// class Bar { ////{| "indent": 18 , "baseIndentSize": 10 |} //// //// constructor() { ////{| "indent": 22, "baseIndentSize": 10 |} //// } //// //// private foo: string = ""; ////{| "indent": 18, "baseIndentSize": 10 |} //// //// private f() { //// var a: any[] = [[1, 2], [3, 4], 5]; ////{| "indent": 22, "baseIndentSize": 10 |} //// return ((1 + 1)); //// } //// ////{| "indent": 18, "baseIndentSize": 10 |} //// private f2() { //// if (true) { } { }; //// } //// } //// } //// //// //// module interfaces { ////{| "indent": 14 , "baseIndentSize": 10 |} //// interface Foo { ////{| "indent": 18 , "baseIndentSize": 10 |} //// //// x: number; ////{| "indent": 18 , "baseIndentSize": 10 |} //// //// foo(): number; ////{| "indent": 18 , "baseIndentSize": 10 |} //// } //// } //// //// //// module nestedModules { //// module Foo2 { ////{| "indent": 18 , "baseIndentSize": 10 |} //// function f() { //// } ////{| "indent": 18 , "baseIndentSize": 10 |} //// var x: number; ////{| "indent": 18 , "baseIndentSize": 10 |} //// } //// } //// //// //// module Enums { //// enum Foo3 { ////{| "indent": 18 , "baseIndentSize": 10 |} //// val1, ////{| "indent": 18 , "baseIndentSize": 10 |} //// val2, ////{| "indent": 18 , "baseIndentSize": 10 |} //// } ////{| "indent": 14 , "baseIndentSize": 10 |} //// } //// //// //// function controlStatements() { //// for (var i = 0; i < 10; i++) { ////{| "indent": 18 , "baseIndentSize": 10 |} //// } //// //// for (var e in foo.bar) { ////{| "indent": 18 , "baseIndentSize": 10 |} //// } //// //// with (foo.bar) { ////{| "indent": 18 , "baseIndentSize": 10 |} //// } //// //// while (false) { ////{| "indent": 18 , "baseIndentSize": 10 |} //// } //// //// do { ////{| "indent": 18 , "baseIndentSize": 10 |} //// } while (false); //// //// switch (foo.bar) { ////{| "indent": 18 , "baseIndentSize": 10 |} //// } //// //// switch (foo.bar) { ////{| "indent": 18 , "baseIndentSize": 10 |} //// case 1: ////{| "indent": 22 , "baseIndentSize": 10 |} //// break; //// default: ////{| "indent": 22 , "baseIndentSize": 10 |} //// break; //// } //// } //// //// //// function tryCatch() { ////{| "indent": 14 , "baseIndentSize": 10 |} //// try { ////{| "indent": 18 , "baseIndentSize": 10 |} //// } ////{| "indent": 14 , "baseIndentSize": 10 |} //// catch (err) { ////{| "indent": 18, "baseIndentSize": 10 |} //// } ////{| "indent": 14, "baseIndentSize": 10 |} //// } //// //// //// function tryFinally() { ////{| "indent": 14 , "baseIndentSize": 10 |} //// try { ////{| "indent": 18 , "baseIndentSize": 10 |} //// } ////{| "indent": 14 , "baseIndentSize": 10 |} //// finally { ////{| "indent": 18 , "baseIndentSize": 10 |} //// } ////{| "indent": 14 , "baseIndentSize": 10 |} //// } //// //// //// function tryCatchFinally() { ////{| "indent": 14 , "baseIndentSize": 10 |} //// try { ////{| "indent": 18 , "baseIndentSize": 10 |} //// } ////{| "indent": 14 , "baseIndentSize": 10 |} //// catch (err) { ////{| "indent": 18 , "baseIndentSize": 10 |} //// } ////{| "indent": 14 , "baseIndentSize": 10 |} //// finally { ////{| "indent": 18 , "baseIndentSize": 10 |} //// } ////{| "indent": 14 , "baseIndentSize": 10 |} //// } //// //// //// class indentBeforeCurly ////{| "indent": 10 , "baseIndentSize": 10 |} ////{| "indent": 10 , "baseIndentSize": 10 |} //// { ////{| "indent": 14 , "baseIndentSize": 10 |} //// } ////{| "indent": 10 , "baseIndentSize": 10 |} //// //// //// function argumentsListIndentation(bar, //// blah, //// {| "indent": 14 , "baseIndentSize": 10 |} //// ); //// //// //// function blockIndentAfterIndentedParameter1(bar, //// blah) { ////{| "indent": 14 , "baseIndentSize": 10 |} //// } //// //// //// function blockIndentAfterIndentedParameter2(bar, //// blah) { //// if (foo) { ////{| "indent": 18 , "baseIndentSize": 10 |} //// } ////} ////{| "indent": 10 , "baseIndentSize": 10 |} //// //// var templateLiterals = `abcdefghi ////{| "indent": 0 , "baseIndentSize": 10 |} ////jklmnop ////{| "indent": 0 , "baseIndentSize": 10 |} ////qrstuvwxyz`; ////{| "indent": 10 , "baseIndentSize": 10 |} //// //// //// module changeBaseIndentSizeInSameFile { ////{| "indent": 21 , "baseIndentSize": 17 |} //// interface Foo { ////{| "indent": 25 , "baseIndentSize": 17 |} //// //// x: number; ////{| "indent": 25 , "baseIndentSize": 10 |} //// //// foo(): number; ////{| "indent": 25 , "baseIndentSize": 10 |} //// } ////{| "indent": 21 , "baseIndentSize": 10 |} //// } ////{| "indent": 17 , "baseIndentSize": 17 |} //// //// ////// Note: Do not add more tests at the end of this file, as ////// the purpose of this test is to verify smart indent ////// works for unterminated function arguments at the end of a file. //// function unterminatedListIndentation(a, ////{| "indent": 14 , "baseIndentSize": 10 |} test.markers().forEach(marker => { verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent, ts.IndentStyle.Smart, marker.data.baseIndentSize); });
{ "end_byte": 6380, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/indentationWithBaseIndent.ts" }
TypeScript/tests/cases/fourslash/codeFixInferFromUsageCallbackParameter6.ts_0_209
/// <reference path='fourslash.ts' /> // @allowJs: true // @checkJs: true // @noImplicitAny: false // @filename: /foo.js ////const foo = [(/** @type {number} */ x) => x + 1]; verify.not.codeFixAvailable();
{ "end_byte": 209, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageCallbackParameter6.ts" }
TypeScript/tests/cases/fourslash/extract-method_jsxPreceedingWhitespace.ts_0_860
/// <reference path='fourslash.ts' /> // Repro https://github.com/Microsoft/TypeScript/issues/42829 // @jsx: preserve // @filename: a.tsx ////export default function ComponentThatExhibitsIssue() { //// return <div> //// /*a*/ <div className="some-nested-data"> //// hello from my nested component //// </div> //// //// /*b*/ //// </div> goTo.file("a.tsx"); goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "function_scope_1", actionDescription: "Extract to function in module scope", newContent: `export default function ComponentThatExhibitsIssue() { return <div> {newFunction()} </div> function /*RENAME*/newFunction() { return <div className="some-nested-data"> hello from my nested component </div>; } ` });
{ "end_byte": 860, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method_jsxPreceedingWhitespace.ts" }
TypeScript/tests/cases/fourslash/quickInfoJsDocTagsFunctionOverload05.ts_0_248
/// <reference path='fourslash.ts'/> // @Filename: quickInfoJsDocTagsFunctionOverload05.ts ////declare function /*1*/foo(): void; //// /////** //// * @tag Tag text //// */ ////declare function /*2*/foo(x: number): void verify.baselineQuickInfo()
{ "end_byte": 248, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoJsDocTagsFunctionOverload05.ts" }
TypeScript/tests/cases/fourslash/formattingJsxTexts2.ts_0_987
/// <reference path='fourslash.ts' /> //@Filename: file.tsx //// const a = ( //// <div> //// foo //// </div> //// ); //// //// const b = ( //// <div> //// { foo } //// </div> //// ); //// //// const c = ( //// <div> //// foo //// { foobar } //// bar //// </div> //// ); //// //// const d = //// <div> //// foo //// </div>; //// //// const e = //// <div> //// { foo } //// </div> //// //// const f = //// <div> //// foo //// { foobar } //// bar //// </div> format.document(); verify.currentFileContentIs( `const a = ( <div> foo </div> ); const b = ( <div> {foo} </div> ); const c = ( <div> foo {foobar} bar </div> ); const d = <div> foo </div>; const e = <div> {foo} </div> const f = <div> foo {foobar} bar </div>`);
{ "end_byte": 987, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingJsxTexts2.ts" }
TypeScript/tests/cases/fourslash/incrementalParsingInsertIntoMethod1.ts_0_211
/// <reference path='fourslash.ts' /> ////class C { //// public foo1() { } //// public foo2() { //// return 1/*1*/; //// } //// public foo3() { } ////} goTo.marker("1"); edit.insert(" + 1");
{ "end_byte": 211, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/incrementalParsingInsertIntoMethod1.ts" }
TypeScript/tests/cases/fourslash/extract-method5.ts_0_627
/// <reference path='fourslash.ts' /> // Extraction in the context of a contextual // type needs to produce an explicit return type // annotation in the extracted function //// function f() { //// var x: 1 | 2 | 3 = /*start*/1 + 1 === 2 ? 1 : 2/*end*/; //// } goTo.select('start', 'end'); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "function_scope_0", actionDescription: "Extract to inner function in function 'f'", newContent: `function f() { var x: 1 | 2 | 3 = /*RENAME*/newFunction(); function newFunction(): 1 | 2 | 3 { return 1 + 1 === 2 ? 1 : 2; } }` });
{ "end_byte": 627, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method5.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportAmbient1.ts_0_751
/// <reference path="fourslash.ts" /> //// 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; //// } verify.importFixAtPosition([ `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": 751, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportAmbient1.ts" }
TypeScript/tests/cases/fourslash/mapCodeNestedLabeledInsertion.ts_0_467
///<reference path="fourslash.ts"/> // @Filename: /index.ts //// function foo() { //// const x: number = 1; //// const y: number = 2; //// myLabel: if (x === y) [||]{ //// console.log("hello"); //// console.log("you"); //// break myLabel; //// } //// return 1; //// } //// verify.baselineMapCode([test.ranges()], [ ` otherLabel: if (y === x) { console.log("goodbye"); console.log("world"); break otherLabel; } ` ]);
{ "end_byte": 467, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/mapCodeNestedLabeledInsertion.ts" }
TypeScript/tests/cases/fourslash/completionsPaths.ts_0_829
/// <reference path="fourslash.ts" /> // @moduleResolution: node // @Filename: /node_modules/x/foo.d.ts ////not read // @Filename: /node_modules/x/bar.d.ts ////not read // @Filename: /src/node_modules/y/index.d.ts ////not read // @Filename: /src/a.ts ////import {} from "/*1*/"; // @Filename: /src/folder/b.ts ////import {} from "x//*2*/"; // @Filename: /src/folder/c.ts ////const foo = require("x//*3*/"); // @Filename: /src/folder/4.ts ////const foo = require(`x//*4*/`); verify.completions( { marker: "1", exact: ["y", "x"].map(name => ({ name, kind: "directory" })), isNewIdentifierLocation: true, }, { marker: ["2", "3", "4"], exact: ["bar", "foo"].map(name => ({ name, kind: "script", kindModifiers: ".d.ts" })), isNewIdentifierLocation: true, }, );
{ "end_byte": 829, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsPaths.ts" }
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess27.ts_0_541
/// <reference path='fourslash.ts' /> //// class A { //// /*a*/public "a-b": number = 1;/*b*/ //// } 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-b": number = 1; public get "a-b"(): number { return this["_a-b"]; } public set "a-b"(value: number) { this["_a-b"] = value; } }`, });
{ "end_byte": 541, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess27.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceWithAmbientSignatures1.ts_0_736
/// <reference path='fourslash.ts' /> // @lib: esnext // @target: esnext // @Filename: /node_modules/@types/node/globals.d.ts ////export {}; ////declare global { //// interface SymbolConstructor { //// readonly dispose: unique symbol; //// } //// interface Disposable { //// [Symbol.dispose](): void; //// } ////} // @Filename: /node_modules/@types/node/index.d.ts /////// <reference path="globals.d.ts" /> // @Filename: a.ts ////class Foo implements Disposable {} goTo.file("a.ts"); verify.codeFix({ description: "Implement interface 'Disposable'", newFileContent: `class Foo implements Disposable { [Symbol.dispose](): void { throw new Error("Method not implemented."); } }` });
{ "end_byte": 736, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceWithAmbientSignatures1.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType55.ts_0_402
/// <reference path='fourslash.ts' /> //// interface I { f: /*a*/(this: O, b: number) => typeof this["a"]/*b*/ }; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = (this: O, b: number) => typeof this["a"]; interface I { f: NewType };`, });
{ "end_byte": 402, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType55.ts" }
TypeScript/tests/cases/fourslash/quickInfoForConstTypeReference.ts_0_90
/// <reference path="fourslash.ts" /> ////"" as /**/const; verify.not.quickInfoExists();
{ "end_byte": 90, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForConstTypeReference.ts" }
TypeScript/tests/cases/fourslash/jsxAriaLikeCompletions.ts_0_511
/// <reference path="fourslash.ts" /> //@Filename: file.tsx ////declare var React: any; ////declare module JSX { //// interface Element { } //// interface IntrinsicElements { //// div: { "aria-whatever"?: string } //// } //// interface ElementAttributesProperty { props: any } ////} ////const a = <div {...{}} /*1*/></div>; verify.completions( { marker: "1", exact: [ {name: "aria-whatever", sortText: completion.SortText.OptionalMember} ] } );
{ "end_byte": 511, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsxAriaLikeCompletions.ts" }
TypeScript/tests/cases/fourslash/moveToNewFile_updateUses_js.ts_0_467
/// <reference path='fourslash.ts' /> // @allowJs: true // @Filename: /a.js ////exports.x = 0; ////[|exports.y = 0;|] // @Filename: /user.js ////const { x, y } = require("./a"); //// // TODO: GH#23728 Shouldn't need `////` above verify.moveToNewFile({ newFileContents: { "/a.js": `exports.x = 0; `, "/y.js": `exports.y = 0; `, "/user.js": // TODO: GH#22330 `const { x } = require("./a"); const { y } = require("./y"); `, }, });
{ "end_byte": 467, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_updateUses_js.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionObjectLiteralProperties1.ts_0_356
/// <reference path='fourslash.ts' /> //// interface PropsBag { //// /*first*/propx: number //// } //// function foo(arg: PropsBag) {} //// foo({ //// [|pr/*p1*/opx|]: 10 //// }) //// function bar(firstarg: boolean, secondarg: PropsBag) {} //// bar(true, { //// [|pr/*p2*/opx|]: 10 //// }) verify.baselineGoToDefinition( "p1", "p2", );
{ "end_byte": 356, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionObjectLiteralProperties1.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingAttributes6.ts_0_422
/// <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, b: "", c: [], d: undefined }; ////const Bar = () => //// [|<A {...props}></A>|] verify.not.codeFixAvailable("fixMissingAttributes");
{ "end_byte": 422, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingAttributes6.ts" }
TypeScript/tests/cases/fourslash/completionAfterAtChar.ts_0_113
/// <reference path='fourslash.ts'/> ////@a/**/ verify.completions({ marker: "", exact: completion.globals });
{ "end_byte": 113, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionAfterAtChar.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportFile2.ts_0_239
/// <reference path="fourslash.ts" /> //// [|f1/*0*/();|] // @Filename: ../../other_dir/module.ts //// export var v1 = 5; //// export function f1(); verify.importFixAtPosition([ `import { f1 } from "../../other_dir/module"; f1();` ]);
{ "end_byte": 239, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportFile2.ts" }
TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete_paramInFunction.ts_0_252
/// <reference path='fourslash.ts' /> ////export {}; ////function f(x) {} verify.codeFixAll({ fixId: "unusedIdentifier_delete", fixAllDescription: ts.Diagnostics.Delete_all_unused_declarations.message, newFileContent: "export {};\n", });
{ "end_byte": 252, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete_paramInFunction.ts" }
TypeScript/tests/cases/fourslash/findAllRefsInsideTemplates2.ts_0_180
/// <reference path='fourslash.ts'/> /////*1*/function /*2*/f(...rest: any[]) { } /////*3*/f `${ /*4*/f } ${ /*5*/f }` verify.baselineFindAllReferences('1', '2', '3', '4', '5');
{ "end_byte": 180, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsInsideTemplates2.ts" }
TypeScript/tests/cases/fourslash/enumUpdate1.ts_0_542
/// <reference path="fourslash.ts" /> //// module M { //// export enum E { //// A = 1, //// B = 2, //// C = 3, //// /*1*/ //// } //// } //// module M { //// function foo(): M.E { //// return M.E.A; //// } //// } // The point here is to make sure that we clean any // decls for the enum instance type after an edit // If we do not, an error will be raised claiming // that foo's return type is not assignable with // it's signature return type verify.noErrors(); goTo.marker('1'); edit.insert('D = C << 1,'); verify.noErrors();
{ "end_byte": 542, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/enumUpdate1.ts" }
TypeScript/tests/cases/fourslash/codeFixCorrectReturnValue12.ts_0_428
/// <reference path='fourslash.ts' /> //// interface A { //// bar: string //// } //// //// function Foo (a: () => A) { a() } //// Foo(() => { //// { bar: '123' } //// }) verify.codeFixAvailable([ { description: ts.Diagnostics.Add_a_return_statement.message }, { description: ts.Diagnostics.Remove_braces_from_arrow_function_body.message }, { description: ts.Diagnostics.Remove_unused_label.message } ]);
{ "end_byte": 428, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCorrectReturnValue12.ts" }
TypeScript/tests/cases/fourslash/completionsPaths_pathMapping_relativePath.ts_0_519
/// <reference path="fourslash.ts" /> // @Filename: /foo.ts ////not read // @Filename: /x/b.ts ////export const x = 0; // @Filename: /x/a.ts ////import { } from "foo//**/"; // @Filename: /x/tsconfig.json ////{ //// "compilerOptions": { //// "baseUrl": ".", //// "paths": { //// "foo/*": ["./*"] //// } //// } ////} verify.completions({ marker: "", exact: ["a", "b"].map(name => ({ name, kind: "script", kindModifiers: ".ts" })), isNewIdentifierLocation: true, });
{ "end_byte": 519, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsPaths_pathMapping_relativePath.ts" }
TypeScript/tests/cases/fourslash/formatImplicitModule.ts_0_213
/// <reference path='fourslash.ts' /> //// export class A { //// //// } format.document(); goTo.bof(); verify.currentLineContentIs("export class A {"); goTo.eof(); verify.currentLineContentIs("}");
{ "end_byte": 213, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatImplicitModule.ts" }
TypeScript/tests/cases/fourslash/referencesForIndexProperty2.ts_0_152
/// <reference path='fourslash.ts'/> // References to a unknown index property ////var a; ////a["/*1*/blah"]; verify.baselineFindAllReferences('1');
{ "end_byte": 152, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForIndexProperty2.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesNoFix.ts_0_181
/// <reference path='fourslash.ts' /> //// interface I4 { //// [x: string, y: number]: number; //// } //// //// class C implements I {[| |]} verify.not.codeFixAvailable();
{ "end_byte": 181, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesNoFix.ts" }
TypeScript/tests/cases/fourslash/codeFixClassPropertyInitialization1.ts_0_251
/// <reference path='fourslash.ts' /> // @strict: true //// class T { //// a: string; //// } verify.codeFix({ description: `Add 'undefined' type to property 'a'`, newFileContent: `class T { a: string | undefined; }`, index: 0 })
{ "end_byte": 251, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassPropertyInitialization1.ts" }
TypeScript/tests/cases/fourslash/moveToNewFile_overloads3.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_overloads3.ts" }
TypeScript/tests/cases/fourslash/findAllRefsJsDocImportTag3.ts_0_685
/// <reference path="fourslash.ts" /> // @checkJs: true // @Filename: /component.js //// export class Component { //// constructor() { //// this.id_ = Math.random(); //// } //// id() { //// return this.id_; //// } //// } // @Filename: /spatial-navigation.js //// /** @import { Component } from './component.js' */ //// //// export class SpatialNavigation { //// /** //// * @param {Component} component //// */ //// add(component) {} //// } // @Filename: /player.js //// import { Component } from './component.js'; //// //// /** //// * @extends Component/*1*/ //// */ //// export class Player extends Component {} verify.baselineFindAllReferences("1");
{ "end_byte": 685, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsJsDocImportTag3.ts" }
TypeScript/tests/cases/fourslash/goToTypeDefinition2.ts_0_357
/// <reference path='fourslash.ts' /> // @Filename: goToTypeDefinition2_Definition.ts ////interface /*definition*/I1 { //// p; ////} ////type propertyType = I1; ////interface I2 { //// property: propertyType; ////} // @Filename: goToTypeDefinition2_Consumption.ts ////var i2: I2; ////i2.prop/*reference*/erty; verify.baselineGoToType("reference");
{ "end_byte": 357, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToTypeDefinition2.ts" }
TypeScript/tests/cases/fourslash/incompleteFunctionCallCodefixTypeParameterArgumentDifferent.ts_0_445
/// <reference path='fourslash.ts' /> // @noImplicitAny: true ////function existing<T>(value: T) { //// added/*1*/<T, string>(value, ""); ////} goTo.marker("1"); verify.codeFix({ description: "Add missing function declaration 'added'", index: 0, newFileContent: `function existing<T>(value: T) { added<T, string>(value, ""); } function added<T, U>(value: T, arg1: string) { throw new Error("Function not implemented."); } `, });
{ "end_byte": 445, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/incompleteFunctionCallCodefixTypeParameterArgumentDifferent.ts" }
TypeScript/tests/cases/fourslash/todoComments20.ts_0_142
/// <reference path='fourslash.ts' /> // @Filename: dir1/node_modules/todoTest0.ts //// // TODO verify.todoCommentsInCurrentFile(["TODO"]);
{ "end_byte": 142, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/todoComments20.ts" }
TypeScript/tests/cases/fourslash/codeFixAwaitInSyncFunction7.ts_0_346
/// <reference path='fourslash.ts' /> ////function f() { //// for await (const x of g()) { //// console.log(x); //// } ////} verify.codeFix({ index: 0, description: "Add async modifier to containing function", newFileContent: `async function f() { for await (const x of g()) { console.log(x); } }`, });
{ "end_byte": 346, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAwaitInSyncFunction7.ts" }
TypeScript/tests/cases/fourslash/extract-const_jsxFragment2.ts_0_554
/// <reference path='fourslash.ts' /> // @jsx: preserve // @filename: a.tsx ////function Foo() { //// return ( //// <div> //// /*a*/<></>/*b*/ //// </div> //// ); ////} goTo.file("a.tsx"); goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "constant_scope_0", actionDescription: "Extract to constant in enclosing scope", newContent: `function Foo() { const /*RENAME*/newLocal = <></>; return ( <div> {newLocal} </div> ); }` });
{ "end_byte": 554, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const_jsxFragment2.ts" }
TypeScript/tests/cases/fourslash/documentHighlightAtInheritedProperties1.ts_3_215
/ <reference path='fourslash.ts'/> // @Filename: file1.ts //// interface interface1 extends interface1 { //// [|doStuff|](): void; //// [|propName|]: string; //// } verify.baselineDocumentHighlights();
{ "end_byte": 215, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/documentHighlightAtInheritedProperties1.ts" }
TypeScript/tests/cases/fourslash/unclosedCommentsInConstructor.ts_0_180
/// <reference path="fourslash.ts" /> ////class Foo { //// constructor(/* /**/) { } ////} verify.completions({ marker: "", exact: undefined, isNewIdentifierLocation: true });
{ "end_byte": 180, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unclosedCommentsInConstructor.ts" }
TypeScript/tests/cases/fourslash/findAllRefsForDefaultExport_anonymous.ts_0_171
/// <reference path='fourslash.ts' /> // @Filename: /a.ts ////export /*1*/default 1; // @Filename: /b.ts ////import a from "./a"; verify.baselineFindAllReferences('1')
{ "end_byte": 171, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsForDefaultExport_anonymous.ts" }
TypeScript/tests/cases/fourslash/codeFixRequireInTs4.ts_0_233
/// <reference path='fourslash.ts' /> // @Filename: /a.ts ////const foo = require(`foo`); verify.codeFix({ description: ts.Diagnostics.Convert_require_to_import.message, newFileContent: 'import foo = require("foo");', });
{ "end_byte": 233, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixRequireInTs4.ts" }
TypeScript/tests/cases/fourslash/removeDeclareParamTypeAnnotation.ts_0_177
/// <reference path="fourslash.ts" /> //// declare class T { } //// declare function parseInt(/**/s:T):T; //// parseInt('2'); goTo.marker(); edit.deleteAtCaret('s:T'.length);
{ "end_byte": 177, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/removeDeclareParamTypeAnnotation.ts" }
TypeScript/tests/cases/fourslash/completionsImport_preferUpdatingExistingImport.ts_0_787
/// <reference path="fourslash.ts" /> // @module: commonjs // @Filename: /deep/module/why/you/want/this/path.ts //// export const x = 0; //// export const y = 1; // @Filename: /nice/reexport.ts //// import { x, y } from "../deep/module/why/you/want/this/path"; //// export { x, y }; // @Filename: /index.ts //// import { x } from "./deep/module/why/you/want/this/path"; //// //// y/**/ verify.completions({ marker: "", exact: completion.globalsPlus(["x", { name: "y", source: "./deep/module/why/you/want/this/path", sourceDisplay: "./deep/module/why/you/want/this/path", sortText: completion.SortText.AutoImportSuggestions, hasAction: true, }]), preferences: { includeCompletionsForModuleExports: true, allowIncompleteCompletions: true, }, });
{ "end_byte": 787, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_preferUpdatingExistingImport.ts" }
TypeScript/tests/cases/fourslash/formatAddSemicolons1.ts_0_1088
/// <reference path="fourslash.ts" /> ////console.log(1) ////console.log(2) ////const x = function() { } ////for (let i = 0; i < 1; i++) { //// 1 //// 2 ////} ////do { } while (false) console.log(3) ////function f() { } ////class C { //// ["one"] = {} //// ["two"] //// three: string //// m() { } //// ;["three"] = {} //// ;["four"] ////} ////enum E { //// C ////} ////type M<T> = { [K in keyof T]: any } ////declare module 'foo' { } ////declare module 'bar' ////type T = { x: string, y: number } format.setFormatOptions({ ...format.copyFormatOptions(), semicolons: ts.SemicolonPreference.Insert }); format.document(); verify.currentFileContentIs(`console.log(1); console.log(2); const x = function() { }; for (let i = 0; i < 1; i++) { 1; 2; } do { } while (false); console.log(3); function f() { } class C { ["one"] = {} ["two"]; three: string; m() { } ;["three"] = {} ;["four"]; } enum E { C } type M<T> = { [K in keyof T]: any }; declare module 'foo' { } declare module 'bar'; type T = { x: string, y: number; };`);
{ "end_byte": 1088, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatAddSemicolons1.ts" }
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_classExpression.ts_0_529
/// <reference path='fourslash.ts' /> ////const c = class { //// constructor(/*a*/a: number, b = { x: 1 }/*b*/) { } ////} ////var x = new c(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: `const c = class { constructor({ a, b = { x: 1 } }: { a: number; b?: { x: number; }; }) { } } var x = new c({ a: 2 });` });
{ "end_byte": 529, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_classExpression.ts" }
TypeScript/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction17.ts_0_366
/// <reference path='fourslash.ts' /> //// const foo = /*a*/a/*b*/ => { return `abc{a}`; }; 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 => \`abc{a}\`;`, });
{ "end_byte": 366, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction17.ts" }
TypeScript/tests/cases/fourslash/completionListInUnclosedElementAccessExpression02.ts_0_137
/// <reference path='fourslash.ts' /> ////var x; ////var y = (p) => x[/*1*/ verify.completions({ marker: "1", includes: ["p", "x"] });
{ "end_byte": 137, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedElementAccessExpression02.ts" }
TypeScript/tests/cases/fourslash/extractMethod_forAwait.ts_0_556
/// <reference path='fourslash.ts' /> ////async function f(xs: AsyncIterable<number>) { //// /*a*/for await (const x of xs) { //// x * 2; //// }/*b*/ ////} goTo.select('a', 'b') edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "function_scope_1", actionDescription: "Extract to function in global scope", newContent: `async function f(xs: AsyncIterable<number>) { /*RENAME*/newFunction(xs); } function newFunction(xs: AsyncIterable<number>) { for await (const x of xs) { x * 2; } } ` });
{ "end_byte": 556, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extractMethod_forAwait.ts" }
TypeScript/tests/cases/fourslash/completionListInUnclosedFunction19.ts_3_365
/ <reference path="fourslash.ts" /> ////interface MyType { ////} //// ////function foo(x: string, y: number, z: boolean) { //// function bar(a: number, b: string = "hello", c: typeof x = "hello") { //// var v = (p: MyType) => { return y + /*1*/ verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] });
{ "end_byte": 365, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedFunction19.ts" }
TypeScript/tests/cases/fourslash/formatSelectionWithTrivia5.ts_0_346
/// <reference path="fourslash.ts" /> // Tests comment indentation with range ending before next token (statement w/ preceding whitespace) ////if (true) { /////*begin*/// test comment /////*end*/ console.log(); ////} format.selection('begin', 'end'); verify.currentFileContentIs("if (true) {\n // test comment\n console.log();\n}");
{ "end_byte": 346, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatSelectionWithTrivia5.ts" }
TypeScript/tests/cases/fourslash/textChangesPreserveNewlines4.ts_0_435
/// <reference path="fourslash.ts" /> //// const x = /*1*/function f() //// { //// //// console.log(); //// }/*2*/; goTo.select("1", "2"); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "function_scope_0", actionDescription: "Extract to function in global scope", newContent: `const x = /*RENAME*/newFunction(); function newFunction() { return function f() { console.log(); }; } ` });
{ "end_byte": 435, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/textChangesPreserveNewlines4.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionReturn2.ts_0_183
/// <reference path="fourslash.ts" /> ////function foo() { //// return /*end*/() => { //// [|/*start*/return|] 10; //// } ////} verify.baselineGoToDefinition("start");
{ "end_byte": 183, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionReturn2.ts" }
TypeScript/tests/cases/fourslash/codeFixInvalidJsxCharacters7.ts_0_467
/// <reference path='fourslash.ts' /> // @jsx: react // @filename: main.tsx ////let a = <div>>{"foo"}</div>; ////let b = <div>>{"foo"}</div>; ////let c = <div>>{"foo"}</div>; verify.codeFixAll({ fixId: "fixInvalidJsxCharacters_htmlEntity", fixAllDescription: ts.Diagnostics.Convert_all_invalid_characters_to_HTML_entity_code.message, newFileContent: `let a = <div>&gt;{"foo"}</div>; let b = <div>&gt;{"foo"}</div>; let c = <div>&gt;{"foo"}</div>;` });
{ "end_byte": 467, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInvalidJsxCharacters7.ts" }
TypeScript/tests/cases/fourslash/getEditsForFileRename_tsconfig_include_add.ts_0_351
/// <reference path='fourslash.ts' /> // @Filename: /src/tsconfig.json ////{ //// "include": ["dir"], ////} // @Filename: /src/dir/a.ts //// verify.getEditsForFileRename({ oldPath: "/src/dir/a.ts", newPath: "/src/newDir/b.ts", newFileContents: { "/src/tsconfig.json": `{ "include": ["dir", "newDir/b.ts"], }`, }, });
{ "end_byte": 351, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEditsForFileRename_tsconfig_include_add.ts" }
TypeScript/tests/cases/fourslash/quickInfoExtendArray.ts_0_289
/// <reference path='fourslash.ts'/> ////interface Foo<T> extends Array<T> { } ////var x: Foo<string>; ////var /*1*/r = x[0]; ////interface Foo2 extends Array<string> { } ////var x2: Foo2; ////var /*2*/r2 = x2[0]; verify.quickInfos({ 1: "var r: string", 2: "var r2: string" });
{ "end_byte": 289, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoExtendArray.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementDefaultClass.ts_0_285
/// <reference path='fourslash.ts' /> ////interface I { x: number; } ////export default class implements I {[| |]} verify.codeFix({ description: "Implement interface 'I'", newFileContent: `interface I { x: number; } export default class implements I { x: number; }`, });
{ "end_byte": 285, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementDefaultClass.ts" }
TypeScript/tests/cases/fourslash/syntacticClassificationsTripleSlash9.ts_0_281
/// <reference path="fourslash.ts"/> //// /// <reference path="./module.ts const c = classification("original"); verify.syntacticClassificationsAre( c.comment("/// "), c.punctuation("<"), c.jsxSelfClosingTagName("reference"), c.comment(" path=\"./module.ts"));
{ "end_byte": 281, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/syntacticClassificationsTripleSlash9.ts" }
TypeScript/tests/cases/fourslash/getEmitOutputSingleFile.ts_0_400
/// <reference path="fourslash.ts" /> // @BaselineFile: getEmitOutputSingleFile.baseline // @outFile: outputDir/singleFile.js // @Filename: inputFile1.ts //// var x: any; //// class Bar { //// x : string; //// y : number //// } // @Filename: inputFile2.ts // @emitThisFile: true //// var x: any; //// class Foo{ //// x : string; //// y : number //// } verify.baselineGetEmitOutput();
{ "end_byte": 400, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEmitOutputSingleFile.ts" }
TypeScript/tests/cases/fourslash/goToImplementationEnum_01.ts_0_257
/// <reference path='fourslash.ts'/> // Should handle calls made on enum name //// enum [|Foo|] { //// Foo1 = function initializer() { return 5 } (), //// Foo2 = 6 //// } //// //// Fo/*reference*/o; verify.baselineGoToImplementation("reference");
{ "end_byte": 257, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationEnum_01.ts" }
TypeScript/tests/cases/fourslash/quickInfoForObjectBindingElementPropertyName01.ts_0_235
/// <reference path='fourslash.ts'/> ////interface I { //// property1: number; //// property2: string; ////} //// ////var foo: I; ////var { /**/property1: prop1 } = foo; verify.quickInfoAt("", "(property) I.property1: number");
{ "end_byte": 235, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForObjectBindingElementPropertyName01.ts" }
TypeScript/tests/cases/fourslash/codeFixImportNonExportedMember_all5.ts_0_1381
/// <reference path="fourslash.ts" /> // @module: esnext // @filename: /a.ts ////let a = 1, b = 1, c = 1; ////export { b }; //// ////type T2 = number; ////type T1 = number; ////export type { T2 }; // @filename: /b.ts ////let a = 1, b = 1, c = 1; //// ////type T3 = number; ////type T4 = number; ////export type { T4 }; // @filename: /c.ts ////let a = 1, b = 1, c = 1; //// ////type T5 = number; ////type T6 = number; ////export { a }; // @filename: /d.ts ////export const a = 1; ////let b = 1, c = 1, d = 1; //// ////type T7 = number; ////type T8 = number; // @filename: /e.ts ////import { T1, a } from "./a"; ////import { T3, b } from "./b"; ////import { T5, c } from "./c"; ////import { T7, d } from "./d"; goTo.file("/e.ts"); verify.codeFixAll({ fixId: "fixImportNonExportedMember", fixAllDescription: ts.Diagnostics.Export_all_referenced_locals.message, newFileContent: { "/a.ts": `let a = 1, b = 1, c = 1; export { b, a }; type T2 = number; type T1 = number; export type { T2, T1 };`, "/b.ts": `let a = 1, b = 1, c = 1; type T3 = number; type T4 = number; export type { T4, T3 }; export { b }; `, "/c.ts": `let a = 1, b = 1, c = 1; type T5 = number; type T6 = number; export { a, c, T5 };`, "/d.ts": `export const a = 1; let b = 1, c = 1, d = 1; export type T7 = number; type T8 = number; export { d }; `, }, });
{ "end_byte": 1381, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixImportNonExportedMember_all5.ts" }
TypeScript/tests/cases/fourslash/unusedTypeParametersWithTrivia2.ts_0_281
/// <reference path="fourslash.ts" /> // @noUnusedParameters: true ////export type Foo< T1 extends any, T2 extends any > = () => void; verify.codeFix({ description: ts.Diagnostics.Remove_type_parameters.message, newFileContent: "export type Foo = () => void;" });
{ "end_byte": 281, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedTypeParametersWithTrivia2.ts" }
TypeScript/tests/cases/fourslash/findReferencesJSXTagName.ts_0_539
/// <reference path='fourslash.ts'/> // @Filename: index.tsx ////import { /*1*/SubmissionComp } from "./RedditSubmission" ////function displaySubreddit(subreddit: string) { //// let components = submissions //// .map((value, index) => <SubmissionComp key={ index } elementPosition= { index } {...value.data} />); ////} // @Filename: RedditSubmission.ts ////export const /*2*/SubmissionComp = (submission: SubmissionProps) => //// <div style={{ fontFamily: "sans-serif" }}></div>; verify.baselineFindAllReferences('1', '2')
{ "end_byte": 539, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findReferencesJSXTagName.ts" }
TypeScript/tests/cases/fourslash/todoComments3.ts_0_72
//// // [|TODO with stuff|] verify.todoCommentsInCurrentFile(["TODO"]);
{ "end_byte": 72, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/todoComments3.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingMember20.ts_0_1572
/// <reference path='fourslash.ts' /> ////class C { //// method() { //// const { //// many01, //// many02, //// many03, //// many04, //// many05, //// many06, //// many07, //// many08, //// many09, //// many10, //// many11, //// many12, //// many13, //// many14, //// many15, //// many16, //// many17, //// many18, //// many19, //// many20, //// many21, //// many22 //// } = this.foo; //// } ////} verify.codeFix({ description: "Declare property 'foo'", index: 0, newFileContent: `class C { foo: { many01: any; many02: any; many03: any; many04: any; many05: any; many06: any; many07: any; many08: any; many09: any; many10: any; many11: any; many12: any; many13: any; many14: any; many15: any; many16: any; many17: any; many18: any; many19: any; many20: any; many21: any; many22: any; }; method() { const { many01, many02, many03, many04, many05, many06, many07, many08, many09, many10, many11, many12, many13, many14, many15, many16, many17, many18, many19, many20, many21, many22 } = this.foo; } }` });
{ "end_byte": 1572, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingMember20.ts" }
TypeScript/tests/cases/fourslash/augmentedTypesModule4.ts_0_412
/// <reference path='fourslash.ts'/> ////module m3d { export var y = 2; } ////declare class m3d { foo(): void } ////var /*1*/r = new m3d(); ////r./*2*/ ////var /*4*/r2 = m3d./*3*/ verify.quickInfoAt("1", "var r: m3d"); verify.completions({ marker: "2", exact: "foo" }); edit.insert('foo();'); verify.completions({ marker: "3", includes: "y" }); edit.insert('y;'); verify.quickInfoAt("4", "var r2: number");
{ "end_byte": 412, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/augmentedTypesModule4.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfacePropertySignatures.ts_0_2048
/// <reference path='fourslash.ts' /> ////interface I { //// a0: {}; //// a1: { (b1: number, c1: string): number; }; //// a2: (b2: number, c2: string) => number; //// a3: { (b3: number, c3: string): number, x: number }; //// //// a4: { new (b1: number, c1: string): number; }; //// a5: new (b2: number, c2: string) => number; //// a6: { new (b3: number, c3: string): number, x: number }; //// //// a7: { foo(b7: number, c7: string): number }; //// //// a8: { (b81: number, c81: string): number, new (b82: number, c82: string): number; }; //// //// a9: { (b9: number, c9: string): number; [d9: number]: I }; //// a10: { (b10: number, c10: string): number; [d10: string]: I }; ////} ////class C implements I {} verify.codeFix({ description: "Implement interface 'I'", newFileContent: `interface I { a0: {}; a1: { (b1: number, c1: string): number; }; a2: (b2: number, c2: string) => number; a3: { (b3: number, c3: string): number, x: number }; a4: { new (b1: number, c1: string): number; }; a5: new (b2: number, c2: string) => number; a6: { new (b3: number, c3: string): number, x: number }; a7: { foo(b7: number, c7: string): number }; a8: { (b81: number, c81: string): number, new (b82: number, c82: string): number; }; a9: { (b9: number, c9: string): number; [d9: number]: I }; a10: { (b10: number, c10: string): number; [d10: string]: I }; } class C implements I { a0: {}; a1: (b1: number, c1: string) => number; a2: (b2: number, c2: string) => number; a3: { (b3: number, c3: string): number; x: number; }; a4: new (b1: number, c1: string) => number; a5: new (b2: number, c2: string) => number; a6: { new(b3: number, c3: string): number; x: number; }; a7: { foo(b7: number, c7: string): number; }; a8: { (b81: number, c81: string): number; new(b82: number, c82: string): number; }; a9: { (b9: number, c9: string): number;[d9: number]: I; }; a10: { (b10: number, c10: string): number;[d10: string]: I; }; }`, });
{ "end_byte": 2048, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfacePropertySignatures.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFix_barrelExport2.ts_0_909
/// <reference path="fourslash.ts" /> // @module: commonjs // @baseUrl: / // @Filename: /proj/foo/a.ts //// export const A = 0; // @Filename: /proj/foo/b.ts //// export {}; //// A/*sibling*/ // @Filename: /proj/foo/index.ts //// export * from "./a"; //// export * from "./b"; // @Filename: /proj/index.ts //// export * from "./foo"; //// export * from "./src"; // @Filename: /proj/src/a.ts //// export {}; //// A/*parent*/ // @Filename: /proj/src/utils.ts //// export function util() { return "util"; } //// export { A } from "../foo/a"; // @Filename: /proj/src/index.ts //// export * from "./a"; verify.importFixModuleSpecifiers("sibling", ["proj/foo/a", "proj/src/utils", "proj", "proj/foo"], { importModuleSpecifierPreference: "non-relative" }); verify.importFixModuleSpecifiers("parent", ["proj/foo", "proj/foo/a", "proj/src/utils", "proj"], { importModuleSpecifierPreference: "non-relative" });
{ "end_byte": 909, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_barrelExport2.ts" }
TypeScript/tests/cases/fourslash/completionListForTransitivelyExportedMembers04.ts_3_739
/<reference path="fourslash.ts" /> // @ModuleResolution: classic // @Filename: A.ts ////export interface I1 { one: number } ////export interface I2 { two: string } ////export type I1_OR_I2 = I1 | I2; //// ////export class C1 { //// one: string; ////} //// ////export module Inner { //// export interface I3 { //// three: boolean //// } //// //// export var varVar = 100; //// export let letVar = 200; //// export const constVar = 300; ////} // @Filename: B.ts ////export var bVar = "bee!"; // @Filename: C.ts ////export var cVar = "see!"; ////export * from "A"; ////export * from "B" // @Filename: D.ts ////import * as c from "C"; ////var x: c.Inner./**/ verify.completions({ marker: "", exact: "I3" });
{ "end_byte": 739, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListForTransitivelyExportedMembers04.ts" }
TypeScript/tests/cases/fourslash/todoComments14.ts_0_65
//// BAR // [|TODO|] verify.todoCommentsInCurrentFile(["TODO"]);
{ "end_byte": 65, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/todoComments14.ts" }
TypeScript/tests/cases/fourslash/refactorInferFunctionReturnType6.ts_0_351
/// <reference path='fourslash.ts' /> ////function /*a*/foo/*b*/() { //// return ""; ////} goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Infer function return type", actionName: "Infer function return type", actionDescription: "Infer function return type", newContent: `function foo(): string { return ""; }` });
{ "end_byte": 351, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorInferFunctionReturnType6.ts" }
TypeScript/tests/cases/fourslash/codeFixChangeJSDocSyntax28.ts_0_226
// @strict: true /// <reference path='fourslash.ts' /> //// function f(x: [|void?|]) { //// } verify.codeFix({ description: "Change 'void?' to 'void'", errorCode: 17019, index: 0, newRangeContent: "void", });
{ "end_byte": 226, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixChangeJSDocSyntax28.ts" }
TypeScript/tests/cases/fourslash/completionListInUnclosedForLoop02.ts_0_131
/// <reference path='fourslash.ts' /> ////for (let i = 0; i < 10; i++) /*1*/ verify.completions({ marker: "1", includes: "i" });
{ "end_byte": 131, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedForLoop02.ts" }
TypeScript/tests/cases/fourslash/getOccurrencesSuper3.ts_0_319
/// <reference path='fourslash.ts' /> ////let x = { //// a() { //// return [|s/**/uper|].b(); //// }, //// b() { //// return [|super|].a(); //// }, //// c: function () { //// return [|super|].a(); //// } //// d: () => [|super|].b(); ////} verify.baselineDocumentHighlights();
{ "end_byte": 319, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesSuper3.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFixDefaultExport3.ts_0_227
/// <reference path="fourslash.ts" /> // @Filename: /foo-bar/index.ts ////export default 0; // @Filename: /b.ts ////[|foo/**/Bar|] goTo.file("/b.ts"); verify.importFixAtPosition([`import fooBar from "./foo-bar"; fooBar`]);
{ "end_byte": 227, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixDefaultExport3.ts" }
TypeScript/tests/cases/fourslash/semanticClassificationClassExpression.ts_3_721
/ <reference path="fourslash.ts"/> //// var x = class /*0*/C {} //// class /*1*/C {} //// class /*2*/D extends class /*3*/B{} { } const c = classification("original"); verify.semanticClassificationsAre("original", c.className("C", test.marker("0").position), c.className("C", test.marker("1").position), c.className("D", test.marker("2").position), c.className("B", test.marker("3").position) ); const c2 = classification("2020"); verify.semanticClassificationsAre("2020", c2.semanticToken("class.declaration", "x"), c2.semanticToken("class", "C"), c2.semanticToken("class.declaration", "C"), c2.semanticToken("class.declaration", "D"), c2.semanticToken("class", "B"), );
{ "end_byte": 721, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/semanticClassificationClassExpression.ts" }
TypeScript/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts_0_170
/// <reference path="fourslash.ts" /> ////class C { //// /*1*/constructor(n: number); //// /*2*/constructor(){} ////} verify.baselineFindAllReferences('1', '2');
{ "end_byte": 170, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts" }
TypeScript/tests/cases/fourslash/documentHighlightJSDocTypedef.ts_0_339
/// <reference path="fourslash.ts" /> // @allowJs: true // @checkJs: true // @Filename: index.js //// /** //// * @typedef {{ //// * [|foo|]: string; //// * [|bar|]: number; //// * }} Foo //// */ //// //// /** @type {Foo} */ //// const x = { //// [|foo|]: "", //// [|bar|]: 42, //// }; verify.baselineDocumentHighlights();
{ "end_byte": 339, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/documentHighlightJSDocTypedef.ts" }
TypeScript/tests/cases/fourslash/renameContextuallyTypedProperties.ts_0_1477
/// <reference path='fourslash.ts' /> ////interface I { //// [|[|{| "contextRangeIndex": 0 |}prop1|]: () => void;|] //// prop2(): void; ////} //// ////var o1: I = { //// [|[|{| "contextRangeIndex": 2 |}prop1|]() { }|], //// prop2() { } ////}; //// ////var o2: I = { //// [|[|{| "contextRangeIndex": 4 |}prop1|]: () => { }|], //// prop2: () => { } ////}; //// ////var o3: I = { //// [|get [|{| "contextRangeIndex": 6 |}prop1|]() { return () => { }; }|], //// get prop2() { return () => { }; } ////}; //// ////var o4: I = { //// [|set [|{| "contextRangeIndex": 8 |}prop1|](v) { }|], //// set prop2(v) { } ////}; //// ////var o5: I = { //// [|"[|{| "contextRangeIndex": 10 |}prop1|]"() { }|], //// "prop2"() { } ////}; //// ////var o6: I = { //// [|"[|{| "contextRangeIndex": 12 |}prop1|]": function () { }|], //// "prop2": function () { } ////}; //// ////var o7: I = { //// [|["[|{| "contextRangeIndex": 14 |}prop1|]"]: function () { }|], //// ["prop2"]: function () { } ////}; //// ////var o8: I = { //// [|["[|{| "contextRangeIndex": 16 |}prop1|]"]() { }|], //// ["prop2"]() { } ////}; //// ////var o9: I = { //// [|get ["[|{| "contextRangeIndex": 18 |}prop1|]"]() { return () => { }; }|], //// get ["prop2"]() { return () => { }; } ////}; //// ////var o10: I = { //// [|set ["[|{| "contextRangeIndex": 20 |}prop1|]"](v) { }|], //// set ["prop2"](v) { } ////}; verify.baselineRenameAtRangesWithText("prop1");
{ "end_byte": 1477, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameContextuallyTypedProperties.ts" }
TypeScript/tests/cases/fourslash/unusedFunctionInNamespace5.ts_0_508
/// <reference path='fourslash.ts' /> // @noUnusedLocals: true // @noUnusedParameters:true ////namespace Validation { //// var function1 = function() { //// } //// //// export function function2() { //// //// } //// //// [| function function3() { //// function1(); //// } //// //// function function4() { //// //// } //// //// export let a = function3; |] ////} verify.rangeAfterCodeFix(`function function3() { function1(); } export let a = function3;`);
{ "end_byte": 508, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedFunctionInNamespace5.ts" }
TypeScript/tests/cases/fourslash/codeFixConvertTypedefToType3.ts_0_470
/// <reference path='fourslash.ts' /> //// //// /** //// * @typedef Foo //// * type {object} //// * @property {string} id - person's ID //// * @property name {string} // person's name //// * @property {number|undefined} age - person's age //// */ //// verify.codeFix({ description: ts.Diagnostics.Convert_typedef_to_TypeScript_type.message, index: 0, newFileContent: ` interface Foo { id: string; name: string; age: number | undefined; } `, });
{ "end_byte": 470, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixConvertTypedefToType3.ts" }
TypeScript/tests/cases/fourslash/outlineSpansBlockCommentsWithoutStatements.ts_0_143
/// <reference path="fourslash.ts"/> // #22732 ////[|/* ///// * Some text //// */|] verify.outliningHintSpansInCurrentFile(test.ranges());
{ "end_byte": 143, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/outlineSpansBlockCommentsWithoutStatements.ts" }
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess42.ts_0_541
/// <reference path='fourslash.ts' /> // @strict: true ////class A { //// /*a*/"\tfoo": "";/*b*/ ////} 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*/"_\\tfoo": ""; public get "\\tfoo"(): "" { return this["_\\tfoo"]; } public set "\\tfoo"(value: "") { this["_\\tfoo"] = value; } }` });
{ "end_byte": 541, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess42.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType30.ts_0_380
/// <reference path='fourslash.ts' /> //// type Item<T> = T extends (infer P)[] ? P : /*a*/never/*b*/; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = never; type Item<T> = T extends (infer P)[] ? P : NewType;`, });
{ "end_byte": 380, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType30.ts" }
TypeScript/tests/cases/fourslash/codeFixCorrectReturnValue26.ts_0_398
/// <reference path='fourslash.ts' /> //// interface A { //// bar: string; //// } //// //// function Foo (a: () => A) { a(); } //// Foo(() => { //// { bar: '123'; } //// }) verify.codeFix({ description: "Add a return statement", index: 0, newFileContent: `interface A { bar: string; } function Foo (a: () => A) { a(); } Foo(() => { return { bar: '123' }; })` })
{ "end_byte": 398, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCorrectReturnValue26.ts" }
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess13.ts_0_545
/// <reference path='fourslash.ts' /> //// class A { //// /*a*/public static a: string = "foo";/*b*/ //// } 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 static /*RENAME*/_a: string = "foo"; public static get a(): string { return A._a; } public static set a(value: string) { A._a = value; } }`, });
{ "end_byte": 545, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess13.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType61.ts_0_463
/// <reference path='fourslash.ts' /> //// function foo(a: /*a*/{ a: number | string, b: string } & { c: string } & { d: boolean }/*b*/) { } goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to interface", actionDescription: "Extract to interface", newContent: `interface /*RENAME*/NewType { a: number | string; b: string; c: string; d: boolean; } function foo(a: NewType) { }`, });
{ "end_byte": 463, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType61.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFix_require_importVsRequire_importWins.ts_0_1237
/// <reference path="fourslash.ts" /> // @allowJs: true // @checkJs: true // @Filename: blah.js ////export default class Blah {} ////export const Named1 = 0; ////export const Named2 = 1; // @Filename: addToExisting.js ////const { Named2 } = require('./blah') ////import { Named1 } from './blah' //// ////new Blah // @Filename: newImport.js ////import fs from 'fs'; ////const path = require('path'); //// ////new Blah // If an "add to existing" fix could be applied both to an `import` // and to a `require` declaration, prefer the `import`. goTo.file("addToExisting.js"); verify.codeFix({ index: 0, errorCode: ts.Diagnostics.Cannot_find_name_0.code, description: `Update import from "./blah"`, newFileContent: `const { Named2 } = require('./blah') import Blah, { Named1 } from './blah' new Blah` }); // If a file contains `import` and `require` declarations but none // can be used for an "add to existing" fix, prefer `import` for the // new declaration. goTo.file("newImport.js"); verify.codeFix({ index: 0, errorCode: ts.Diagnostics.Cannot_find_name_0.code, description: `Add import from "./blah"`, newFileContent: `import fs from 'fs'; import Blah from './blah'; const path = require('path'); new Blah` });
{ "end_byte": 1237, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_require_importVsRequire_importWins.ts" }
TypeScript/tests/cases/fourslash/referencesForInheritedProperties6.ts_3_250
/ <reference path='fourslash.ts'/> ////class class1 extends class1 { //// /*1*/doStuff() { } ////} ////class class2 extends class1 { //// doStuff() { } ////} //// ////var v: class2; ////v.doStuff(); verify.baselineFindAllReferences('1')
{ "end_byte": 250, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForInheritedProperties6.ts" }
TypeScript/tests/cases/fourslash/codeFixAwaitInSyncFunction6.5.ts_0_266
/// <reference path='fourslash.ts' /> ////const f = promise => { //// await promise; ////} verify.codeFix({ index: 0, description: "Add async modifier to containing function", newFileContent: `const f = async promise => { await promise; }`, });
{ "end_byte": 266, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAwaitInSyncFunction6.5.ts" }
TypeScript/tests/cases/fourslash/inlineVariableParensFunctions.ts_0_711
/// <reference path="fourslash.ts" /> ////const /*a1*/foo/*b1*/ = () => { }; ////foo(); ////const /*a2*/bar/*b2*/ = function() { }; ////bar.call(null); goTo.select("a1", "b1"); verify.refactorAvailable("Inline variable"); edit.applyRefactor({ refactorName: "Inline variable", actionName: "Inline variable", actionDescription: "Inline variable", newContent: `(() => { })(); const bar = function() { }; bar.call(null);` }); goTo.select("a2", "b2"); verify.refactorAvailable("Inline variable"); edit.applyRefactor({ refactorName: "Inline variable", actionName: "Inline variable", actionDescription: "Inline variable", newContent: `(() => { })(); (function() { }).call(null);` });
{ "end_byte": 711, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlineVariableParensFunctions.ts" }
TypeScript/tests/cases/fourslash/importStatementCompletions_noSnippet.ts_0_694
/// <reference path="fourslash.ts" /> // @Filename: /mod.ts //// export const foo = 0; // @Filename: /index0.ts //// [|import f/**/|] verify.completions({ isNewIdentifierLocation: true, marker: "", exact: [{ name: "foo", source: "./mod", insertText: `import { foo } from "./mod";`, // <-- no `$1` tab stop isSnippet: undefined, // <-- undefined replacementSpan: test.ranges()[0], sourceDisplay: "./mod", }, { name: "type", sortText: completion.SortText.GlobalsOrKeywords, }], preferences: { includeCompletionsForImportStatements: true, includeInsertTextCompletions: true, includeCompletionsWithSnippetText: false, // <-- false } });
{ "end_byte": 694, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importStatementCompletions_noSnippet.ts" }
TypeScript/tests/cases/fourslash/jsDocFunctionSignatures10.ts_0_328
///<reference path="fourslash.ts" /> // @allowJs: true // @Filename: Foo.js /////** //// * Do some foo things //// * @template T A Foolish template //// * @param {T} x a parameter //// */ ////function foo(x) { ////} //// ////fo/**/o() goTo.marker(); verify.quickInfoIs("function foo<any>(x: any): void", "Do some foo things");
{ "end_byte": 328, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocFunctionSignatures10.ts" }
TypeScript/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts_0_236
/// <reference path='fourslash.ts' /> ////interface I { //// /*1*/0: number; //// /*2*/s: string; ////} ////interface J { //// a: I[/*3*/0], //// b: I["/*4*/s"], ////} verify.baselineFindAllReferences('1', '2', '3', '4');
{ "end_byte": 236, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts" }
TypeScript/tests/cases/fourslash/extract-method39.ts_0_348
/// <reference path='fourslash.ts' /> ////function bar(fn: () => void) {} //// ////class Foo { //// x: number; //// foo() { //// /*start*/bar(() => {});/*end*/ //// } ////} goTo.select("start", "end"); verify.refactorAvailable("Extract Symbol", "function_scope_1"); verify.refactorAvailable("Extract Symbol", "function_scope_2");
{ "end_byte": 348, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method39.ts" }
TypeScript/tests/cases/fourslash/findAllReferencesFromLinkTagReference4.ts_0_146
/// <reference path="fourslash.ts" /> ////enum E { //// /** {@link /**/B} */ //// A, //// B ////} verify.baselineFindAllReferences("");
{ "end_byte": 146, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllReferencesFromLinkTagReference4.ts" }
TypeScript/tests/cases/fourslash/codeFixInferFromFunctionThisUsageJsDocNewDocsInaccessible.ts_0_916
/// <reference path='fourslash.ts' /> // @allowJs: true // @checkJs: true // @noImplicitThis: true // @Filename: /consumesType.js ////function [|returnThisMember|]() { //// return this.member; ////} //// /////** //// * @type {import("/providesType").Container} //// */ ////const container = { //// member: "sample", //// returnThisMember: returnThisMember, ////}; //// ////container.returnThisMember(); // @Filename: /providesType.ts ////interface Container { //// member: string; //// returnThisMember(): string; ////} verify.codeFix({ description: "Infer 'this' type of 'returnThisMember' from usage", index: 0, newFileContent: `/** * @this {any} */ function returnThisMember() { return this.member; } /** * @type {import("/providesType").Container} */ const container = { member: "sample", returnThisMember: returnThisMember, }; container.returnThisMember();` });
{ "end_byte": 916, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromFunctionThisUsageJsDocNewDocsInaccessible.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingMember14.ts_0_351
/// <reference path='fourslash.ts' /> ////interface Foo {} ////class Foo {} ////Foo.test(); verify.codeFix({ description: ignoreInterpolations(ts.Diagnostics.Declare_static_method_0), index: 0, newFileContent: `interface Foo {} class Foo { static test() { throw new Error("Method not implemented."); } } Foo.test();` });
{ "end_byte": 351, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingMember14.ts" }