_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/fourslash/fixNaNEquality1.ts_0_221 | /// <reference path="fourslash.ts" />
////declare const x: number;
////[|if (x === NaN) {}|]
verify.codeFix({
index: 0,
description: "Use `Number.isNaN(x)`.",
newRangeContent: "if (Number.isNaN(x)) {}",
});
| {
"end_byte": 221,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/fixNaNEquality1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceConstructorName1.ts_0_304 | /// <reference path='fourslash.ts' />
////interface I {
//// constructor: number;
////}
////class C implements I {}
verify.codeFix({
description: "Implement interface 'I'",
newFileContent:
`interface I {
constructor: number;
}
class C implements I {
["constructor"]: number;
}`,
});
| {
"end_byte": 304,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceConstructorName1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_parameterInCallback.ts_0_283 | /// <reference path='fourslash.ts' />
// @noUnusedParameters: true
////declare function f(cb: (x: number, y: string) => void): void;
////f((x, y) => { y; });
// No codefix to remove a non-last parameter
verify.codeFixAvailable([{ description: "Prefix 'x' with an underscore" }]);
| {
"end_byte": 283,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUnusedIdentifier_parameterInCallback.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_SubexpressionWithSuffix2.ts_0_494 | /// <reference path='fourslash.ts' />
////let a = { b: 0 };
////let x = { y: 0 };
/////*a*/a && a.b()/*b*/ && x && x.y();
// verify that we stop at a suffix sequence which is otherwise valid.
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert to optional chain expression",
actionName: "Convert to optional chain expression",
actionDescription: "Convert to optional chain expression",
newContent:
`let a = { b: 0 };
let x = { y: 0 };
a?.b() && x && x.y();`
}); | {
"end_byte": 494,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_SubexpressionWithSuffix2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAwaitInSyncFunction9.ts_0_351 | /// <reference path='fourslash.ts' />
////class Foo {
//// bar(): string {
//// await Promise.resolve('baz');
//// }
////}
verify.codeFix({
index: 1,
description: "Add async modifier to containing function",
newFileContent:
`class Foo {
async bar(): Promise<string> {
await Promise.resolve('baz');
}
}`,
});
| {
"end_byte": 351,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAwaitInSyncFunction9.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsDestructureGetter2.ts_0_761 | /// <reference path="fourslash.ts" />
// @noLib: true
// @Filename: /a.ts
////class C {
//// [|get /*g0*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}g|](): number { return 0; }|]
////
//// [|set /*s0*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}s|](value: number) {}|]
////}
////[|const { /*g1*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 4 |}g|], /*s1*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 4 |}s|] } = new C();|]
const [g0Def, g0, s0Def, s0, gs1Def, g1, s1] = test.ranges();
verify.quickInfoAt(g0, "(getter) C.g: number");
verify.quickInfoAt(s0, "(setter) C.s: number");
verify.baselineFindAllReferences('g0', 'g1', 's0', 's1')
| {
"end_byte": 761,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsDestructureGetter2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixChangeJSDocSyntax12.ts_0_217 | // @strict: true
/// <reference path='fourslash.ts' />
////class C {
//// p: [|*|]
////}
verify.codeFix({
description: "Change '*' to 'any'",
errorCode: 8020,
index: 0,
newRangeContent: "any",
});
| {
"end_byte": 217,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixChangeJSDocSyntax12.ts"
} |
TypeScript/tests/cases/fourslash/refactorInferFunctionReturnType15.ts_0_627 | /// <reference path='fourslash.ts' />
////interface Foo {
//// x: number;
////}
////function f(x: number): Foo;
////function f(x: string): number;
////function /*a*/f/*b*/(x: string | number) {
//// return x === 1 ? 1 : { x };
////}
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Infer function return type",
actionName: "Infer function return type",
actionDescription: "Infer function return type",
newContent:
`interface Foo {
x: number;
}
function f(x: number): Foo;
function f(x: string): number;
function f(x: string | number): number | Foo {
return x === 1 ? 1 : { x };
}`
});
| {
"end_byte": 627,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorInferFunctionReturnType15.ts"
} |
TypeScript/tests/cases/fourslash/unusedVariableWithTrivia2.ts_0_334 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
////[|namespace greeter {
//// // Do not remove
//// /**
//// * JSDoc Comment
//// */
//// let a = 0;
////}|]
verify.codeFix({
description: "Remove unused declaration for: 'a'",
newRangeContent: `namespace greeter {
// Do not remove
}`
});
| {
"end_byte": 334,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedVariableWithTrivia2.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentOnUnclosedFunctionDeclaration03.ts_0_280 | /// <reference path='fourslash.ts' />
////function f<A,B,C>/*1*/
function verifyIndentationAfterNewLine(marker: string, indentation: number): void {
goTo.marker(marker);
edit.insert("\n");
verify.indentationIs(indentation);
}
verifyIndentationAfterNewLine("1", 4); | {
"end_byte": 280,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentOnUnclosedFunctionDeclaration03.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassExprClassImplementClassFunctionVoidInferred.ts_0_324 | /// <reference path='fourslash.ts' />
////class A {
//// f() {}
////}
////let B = class implements A {}
verify.codeFix({
description: "Implement interface 'A'",
newFileContent:
`class A {
f() {}
}
let B = class implements A {
f(): void {
throw new Error("Method not implemented.");
}
}`
});
| {
"end_byte": 324,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassExprClassImplementClassFunctionVoidInferred.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports25-heritage-formatting-3.ts_0_770 | /// <reference path='fourslash.ts'/>
// @isolatedDeclarations: true
// @declaration: true
////function mixin<T extends new (...a: any) => any>(ctor: T): T {
//// return ctor;
////}
////class Point2D { x = 0; y = 0; }
////export class Point3D3 extends mixin(Point2D) /* DD*/ {
//// z = 0;
////}
verify.codeFixAvailable([
{ description: ts.Diagnostics.Extract_base_class_to_variable.message }
]);
verify.codeFix({
description: ts.Diagnostics.Extract_base_class_to_variable.message,
index: 0,
newFileContent:
`function mixin<T extends new (...a: any) => any>(ctor: T): T {
return ctor;
}
class Point2D { x = 0; y = 0; }
const Point3D3Base: typeof Point2D = mixin(Point2D) /* DD*/;
export class Point3D3 extends Point3D3Base {
z = 0;
}`
});
| {
"end_byte": 770,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports25-heritage-formatting-3.ts"
} |
TypeScript/tests/cases/fourslash/organizeImports14.ts_0_435 | /// <reference path="fourslash.ts" />
// @filename: /a.ts
////export const foo = 1;
// @filename: /b.ts
/////**
//// * Module doc comment
//// *
//// * @module
//// */
////
////// comment 1
////
////// comment 2
////
////import { foo } from "./a";
////import { foo } from "./a";
////import { foo } from "./a";
goTo.file("/b.ts");
verify.organizeImports(
`/**
* Module doc comment
*
* @module
*/
// comment 1
// comment 2
`);
| {
"end_byte": 435,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImports14.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentMissingBracketsWithKeyword.ts_0_116 | /// <reference path='fourslash.ts'/>
////with /*1*/
goTo.marker("1");
edit.insert("\n");
verify.indentationIs(0);
| {
"end_byte": 116,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentMissingBracketsWithKeyword.ts"
} |
TypeScript/tests/cases/fourslash/completionListOutsideOfClosedFunctionDeclaration01.ts_0_146 | /// <reference path='fourslash.ts' />
////// no a or b
/////*1*/function f (a, b) {}
verify.completions({ marker: "1", excludes: ["a", "b"] });
| {
"end_byte": 146,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListOutsideOfClosedFunctionDeclaration01.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_global3.ts_0_561 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////[|// this file extends the string prototype
////interface String {
//// reverse(): string;
////}
////String.prototype.reverse = function(): string {
//// return this.split("").reverse().join("");
////};|]
verify.moveToNewFile({
newFileContents: {
"/a.ts": "",
"/String.ts":
`// this file extends the string prototype
interface String {
reverse(): string;
}
String.prototype.reverse = function(): string {
return this.split("").reverse().join("");
};
`,
}
});
| {
"end_byte": 561,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_global3.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassImplementClassPropertyModifiers.ts_0_656 | /// <reference path='fourslash.ts' />
////abstract class A {
//// abstract x: number;
//// private y: number;
//// protected z: number;
//// public w: number;
//// public useY() { this.y; }
////}
////
////class C implements A {[| |]}
verify.codeFix({
description: "Implement interface 'A'",
newFileContent:
`abstract class A {
abstract x: number;
private y: number;
protected z: number;
public w: number;
public useY() { this.y; }
}
class C implements A {
x: number;
protected z: number;
public w: number;
public useY(): void {
throw new Error("Method not implemented.");
}
}`,
});
| {
"end_byte": 656,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementClassPropertyModifiers.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess29.ts_0_459 | /// <reference path='fourslash.ts' />
//// const A = {
//// /*a*/a/*b*/: 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: `const A = {
/*RENAME*/_a: 1,
get a() {
return this._a;
},
set a(value) {
this._a = value;
},
};`,
});
| {
"end_byte": 459,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess29.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_TemplateString11.ts_0_346 | /// <reference path='fourslash.ts' />
////const a = /*x*/`x` + `y` + text + "z"/*y*/;
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert to template string",
actionName: "Convert to template string",
actionDescription: ts.Diagnostics.Convert_to_template_string.message,
newContent: "const a = `xy${text}z`;"
});
| {
"end_byte": 346,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_TemplateString11.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_reExports2.ts_0_472 | /// <reference path='fourslash.ts' />
// @module: esnext
//@Filename: /a.ts
////export function foo() { }
////[|export function bar() {}|]
// @Filename: /b.ts
////export function baz() { }
////export {
//// bar,
////} from "./a";
verify.moveToFile({
newFileContents: {
"/a.ts":
`export function foo() { }
`,
"/b.ts":
`export function baz() { }
export function bar() { }
`,
},
interactiveRefactorArguments: { targetFile: "/b.ts" },
});
| {
"end_byte": 472,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_reExports2.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionYield1.ts_0_263 | /// <reference path="fourslash.ts" />
//// function* /*end1*/gen() {
//// [|/*start1*/yield|] 0;
//// }
////
//// const /*end2*/genFunction = function*() {
//// [|/*start2*/yield|] 0;
//// }
verify.baselineGoToDefinition(
"start1",
"start2",
);
| {
"end_byte": 263,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionYield1.ts"
} |
TypeScript/tests/cases/fourslash/renameCommentsAndStrings2.ts_0_345 | /// <reference path="fourslash.ts" />
///////<reference path="./Bar.ts" />
////[|function [|{| "contextRangeIndex": 0 |}Bar|]() {
//// // This is a reference to Bar in a comment.
//// "this is a reference to [|Bar|] in a string"
////}|]
const [rDef, ...ranges] = test.ranges();
verify.baselineRename(ranges[0], { findInStrings: true })
| {
"end_byte": 345,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameCommentsAndStrings2.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesClassExpressionThis.ts_0_998 | /// <reference path='fourslash.ts' />
////var x = class C {
//// public x;
//// public y;
//// public z;
//// constructor() {
//// [|this|];
//// [|this|].x;
//// [|this|].y;
//// [|this|].z;
//// }
//// foo() {
//// [|this|];
//// () => [|this|];
//// () => {
//// if ([|this|]) {
//// [|this|];
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
//// return [|this|].x;
//// }
////
//// static bar() {
//// this;
//// () => this;
//// () => {
//// if (this) {
//// this;
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
//// }
////}
verify.baselineDocumentHighlights();
| {
"end_byte": 998,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesClassExpressionThis.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingAttributes8.ts_0_444 | /// <reference path='fourslash.ts' />
// @jsx: preserve
// @filename: foo.tsx
////type A = 'a' | 'b';
////type B = 'd' | 'c';
////type C = `${A}${B}`;
////const A = (props: { [K in C]: K }) =>
//// <div {...props}></div>;
////
////const Bar = () =>
//// [|<A></A>|]
verify.codeFix({
index: 0,
description: ts.Diagnostics.Add_missing_attributes.message,
newRangeContent: `<A ad={"ad"} ac={"ac"} bd={"bd"} bc={"bc"}></A>`
});
| {
"end_byte": 444,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingAttributes8.ts"
} |
TypeScript/tests/cases/fourslash/getJavaScriptCompletions11.ts_0_361 | ///<reference path="fourslash.ts" />
// @allowNonTsExtensions: true
// @Filename: Foo.js
/////** @type {number|string} */
////var v;
////v./**/
verify.completions({
marker: "",
includes: [
{ name: "toExponential", kind: "method", kindModifiers: "declare" },
{ name: "charCodeAt", kind: "method", kindModifiers: "declare" },
],
});
| {
"end_byte": 361,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptCompletions11.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType9.ts_0_478 | /// <reference path='fourslash.ts' />
//// function foo(a: number, b?: number, ...c: /*a*/number[]/*b*/): boolean {
//// return false as boolean;
//// }
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType = number[];
function foo(a: number, b?: number, ...c: NewType): boolean {
return false as boolean;
}`,
});
| {
"end_byte": 478,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType9.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsForUMDModuleAlias1.ts_3_326 | / <reference path='fourslash.ts' />
// @Filename: 0.d.ts
//// export function doThing(): string;
//// export function doTheOtherThing(): void;
//// /*1*/export as namespace /*2*/myLib;
// @Filename: 1.ts
//// /// <reference path="0.d.ts" />
//// /*3*/myLib.doThing();
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 326,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsForUMDModuleAlias1.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpSimpleSuperCall.ts_0_397 | /// <reference path='fourslash.ts' />
////class SuperCallBase {
//// constructor(b: boolean) {
//// }
////}
////class SuperCall extends SuperCallBase {
//// constructor() {
//// super(/*superCall*/);
//// }
////}
verify.signatureHelp({
marker: "superCall",
text: "SuperCallBase(b: boolean): SuperCallBase",
parameterName: "b",
parameterSpan: "b: boolean",
});
| {
"end_byte": 397,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpSimpleSuperCall.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_noImportExport.ts_0_458 | /// <reference path='fourslash.ts' />
//@Filename: /bar.ts
////const q = "test";
// @Filename: /a.ts
////const z = 1;
////[|const y = z + 2;|]
////const t = y + 1;
verify.moveToFile({
newFileContents: {
"/a.ts":
`import { y } from "./bar";
export const z = 1;
const t = y + 1;`,
"/bar.ts":
`import { z } from "./a";
const q = "test";
export const y = z + 2;
`,
},
interactiveRefactorArguments: { targetFile: "/bar.ts" }
});
| {
"end_byte": 458,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_noImportExport.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoTypeArgumentInferenceWithMethodWithoutBody.ts_0_431 | /// <reference path='fourslash.ts' />
////interface ProxyHandler<T extends object> {
//// getPrototypeOf?(target: T): object | null;
////}
////interface ProxyConstructor {
//// new <T extends object>(target: T, handler: ProxyHandler<T>): T;
////}
////declare var Proxy: ProxyConstructor;
////let target = {}
////let proxy = new /**/Proxy(target, {
//// getPrototypeOf()
////})
goTo.marker("");
verify.quickInfoExists();
| {
"end_byte": 431,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoTypeArgumentInferenceWithMethodWithoutBody.ts"
} |
TypeScript/tests/cases/fourslash/organizeImports4.ts_0_409 | /// <reference path="fourslash.ts" />
// Regression test for GH#43107
//// import * as something from "path";/**
//// * some comment here
//// * and there
//// */
//// import * as somethingElse from "anotherpath";
//// import * as AnotherThing from "somepath";/**
//// * some comment here
//// * and there
//// */
//// import * as AnotherThingElse from "someotherpath";
verify.organizeImports(''); | {
"end_byte": 409,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImports4.ts"
} |
TypeScript/tests/cases/fourslash/autoImportTypeOnlyPreferred2.ts_0_1222 | /// <reference path="fourslash.ts" />
// @Filename: /node_modules/react/index.d.ts
//// export interface ComponentType {}
//// export interface ComponentProps {}
//// export declare function useState<T>(initialState: T): [T, (newState: T) => void];
//// export declare function useEffect(callback: () => void, deps: any[]): void;
// @Filename: /main.ts
//// import type { ComponentType } from "react";
//// import { useState } from "react";
////
//// export function Component({ prop } : { prop: ComponentType }) {
//// const codeIsUnimportant = useState(1);
//// useEffect/*1*/(() => {}, []);
//// }
// @Filename: /main2.ts
//// import { useState } from "react";
//// import type { ComponentType } from "react";
////
//// type _ = ComponentProps/*2*/;
goTo.marker("1");
verify.importFixAtPosition([
`import type { ComponentType } from "react";
import { useEffect, useState } from "react";
export function Component({ prop } : { prop: ComponentType }) {
const codeIsUnimportant = useState(1);
useEffect(() => {}, []);
}`,
]);
goTo.marker("2");
verify.importFixAtPosition([
`import { useState } from "react";
import type { ComponentProps, ComponentType } from "react";
type _ = ComponentProps;`,
]);
| {
"end_byte": 1222,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportTypeOnlyPreferred2.ts"
} |
TypeScript/tests/cases/fourslash/smartSelection_lastBlankLine.ts_0_96 | /// <reference path="fourslash.ts" />
////class C {}
/////**/
verify.baselineSmartSelection();
| {
"end_byte": 96,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartSelection_lastBlankLine.ts"
} |
TypeScript/tests/cases/fourslash/autoImportPackageJsonImportsPattern_ts.ts_0_339 | /// <reference path="fourslash.ts" />
// @module: nodenext
// @Filename: /package.json
//// {
//// "imports": {
//// "#*": "./src/*.ts"
//// }
//// }
// @Filename: /src/something.ts
//// export function something(name: string): any;
// @Filename: /a.ts
//// something/**/
verify.importFixModuleSpecifiers("", ["#something"]);
| {
"end_byte": 339,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportPackageJsonImportsPattern_ts.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionSourceUnit.ts_0_471 | /// <reference path='fourslash.ts'/>
// @Filename: a.ts
//// //MyFile Comments
//// //more comments
//// /// <reference path="so/*unknownFile*/mePath.ts" />
//// /// <reference path="[|b/*knownFile*/.ts|]" />
////
//// class clsInOverload {
//// static fnOverload();
//// static fnOverload(foo: string);
//// static fnOverload(foo: any) { }
//// }
////
// @Filename: b.ts
/////*fileB*/
verify.baselineGoToDefinition(
"unknownFile",
"knownFile",
);
| {
"end_byte": 471,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionSourceUnit.ts"
} |
TypeScript/tests/cases/fourslash/completionsGeneratorFunctions.ts_0_611 | /// <reference path="fourslash.ts" />
////function /*a*/ ;
////function* /*b*/ ;
////interface I {
//// abstract baseMethod(): Iterable<number>;
////}
////class C implements I {
//// */*c*/ ;
//// public */*d*/
////}
////const o: I = {
//// */*e*/
////};
////1 * /*f*/
verify.completions(
{ marker: ["a", "b"], exact: undefined, isNewIdentifierLocation: true },
{ marker: ["c", "d"], exact: ["baseMethod"], isNewIdentifierLocation: true },
{ marker: "e", exact: ["baseMethod"] },
{ marker: "f", includes: [{ name: "Number", sortText: completion.SortText.GlobalsOrKeywords }] },
);
| {
"end_byte": 611,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsGeneratorFunctions.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess38.ts_0_576 | /// <reference path='fourslash.ts' />
// @strict: true
////class A {
//// /*a*/foo?: string | undefined;/*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": 576,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess38.ts"
} |
TypeScript/tests/cases/fourslash/completionNoAutoInsertQuestionDotForTypeParameter.ts_0_562 | /// <reference path="fourslash.ts" />
// @strict: true
//// interface Address {
//// city: string = "";
//// "postal code": string = "";
//// }
//// function f<T extends Address>(x: T) {
//// x[|./**/|]
//// }
verify.completions({
marker: "",
exact: [
{ name: "city", text: "(property) Address.city: string" },
{ name: "postal code", text: "(property) Address[\"postal code\"]: string", insertText: "[\"postal code\"]", replacementSpan: test.ranges()[0] }
],
preferences: { includeInsertTextCompletions: true },
});
| {
"end_byte": 562,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionNoAutoInsertQuestionDotForTypeParameter.ts"
} |
TypeScript/tests/cases/fourslash/underscoreTypings02.ts_0_683 | /// <reference path="fourslash.ts" />
// @module: CommonJS
//// interface Dictionary<T> {
//// [x: string]: T;
//// }
//// export interface ChainedObject<T> {
//// functions: ChainedArray<string>;
//// omit(): ChainedObject<T>;
//// clone(): ChainedObject<T>;
//// }
//// interface ChainedDictionary<T> extends ChainedObject<Dictionary<>> {
//// foldl(): ChainedObject<T>;
//// clone(): ChainedDictionary<T>;
//// }
//// export interface ChainedArray<T> extends ChainedObject<Array<T>> {
//// groupBy(): ChainedDictionary<any[]>;
//// groupBy(propertyName): ChainedDictionary<any[]>;
//// }
goTo.position(0);
verify.numberOfErrorsInCurrentFile(2);
| {
"end_byte": 683,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/underscoreTypings02.ts"
} |
TypeScript/tests/cases/fourslash/mapCodeNestedIfInsertion.ts_0_398 | ///<reference path="fourslash.ts"/>
// @Filename: /index.ts
//// function foo() {
//// const x: number = 1;
//// const y: number = 2;
//// if (x === y) [||]{
//// console.log("hello");
//// console.log("you");
//// }
//// return 1;
//// }
////
verify.baselineMapCode([test.ranges()], [
`
if (y === x) {
console.log("goodbye");
console.log("world");
}
`
]); | {
"end_byte": 398,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/mapCodeNestedIfInsertion.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertImport_notAtDefaultName.ts_0_152 | /// <reference path='fourslash.ts' />
////import /*a*/d/*b*/, * as n from "m";
goTo.select("a", "b");
verify.not.refactorAvailable("Convert import");
| {
"end_byte": 152,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertImport_notAtDefaultName.ts"
} |
TypeScript/tests/cases/fourslash/getOutliningForBlockComments.ts_0_6053 | /// <reference path="fourslash.ts"/>
////[|/*
//// Block comment at the beginning of the file before module:
//// line one of the comment
//// line two of the comment
//// line three
//// line four
//// line five
////*/|]
////module Sayings[| {
//// [|/*
//// Comment before class:
//// line one of the comment
//// line two of the comment
//// line three
//// line four
//// line five
//// */|]
//// export class Greeter[| {
//// [|/*
//// Comment before a string identifier
//// line two of the comment
//// */|]
//// greeting: string;
//// [|/*
//// constructor
//// parameter message as a string
//// */|]
////
//// [|/*
//// Multiple comments should be collapsed individually
//// */|]
//// constructor(message: string /* do not collapse this */)[| {
//// this.greeting = message;
//// }|]
//// [|/*
//// method of a class
//// */|]
//// greet()[| {
//// return "Hello, " + this.greeting;
//// }|]
//// }|]
////}|]
////
////[|/*
//// Block comment for interface. The ending can be on the same line as the declaration.
////*/|]interface IFoo[| {
//// [|/*
//// Multiple block comments
//// */|]
////
//// [|/*
//// should be collapsed
//// */|]
////
//// [|/*
//// individually
//// */|]
////
//// [|/*
//// this comment has trailing space before /* and after *-/ signs
//// */|]
////
//// [|/**
//// *
//// *
//// *
//// */|]
////
//// [|/*
//// */|]
////
//// [|/*
//// */|]
//// // single line comments in the middle should not have an effect
//// [|/*
//// */|]
////
//// [|/*
//// */|]
////
//// [|/*
//// this block comment ends
//// on the same line */|] [|/* where the following comment starts
//// should be collapsed separately
//// */|]
////
//// getDist(): number;
////}|]
////
////var x =[|{
//// a:1,
//// b: 2,
//// [|/*
//// Over a function in an object literal
//// */|]
//// get foo()[| {
//// return 1;
//// }|]
////}|]
////
////// Over a function expression assigned to a variable
//// [|/**
//// * Return a sum
//// * @param {Number} y
//// * @param {Number} z
//// * @returns {Number} the sum of y and z
//// */|]
//// const sum2 = (y, z) =>[| {
//// return y + z;
//// }|];
////
////// Over a variable
////[|/**
//// * foo
//// */|]
////const foo = null;
////
////function Foo()[| {
//// [|/**
//// * Description
//// *
//// * @param {string} param
//// * @returns
//// */|]
//// this.method = function (param)[| {
//// }|]
////
//// [|/**
//// * Description
//// *
//// * @param {string} param
//// * @returns
//// */|]
//// function method(param)[| {
//// }|]
////}|]
////
////function fn1()[| {
//// [|/**
//// * comment
//// */|]
////}|]
////function fn2()[| {
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
////}|]
////function fn3()[| {
//// const x = 1;
////
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
////}|]
////function fn4()[| {
//// [|/**
//// * comment
//// */|]
//// const x = 1;
////
//// [|/**
//// * comment
//// */|]
////}|]
////function fn5()[| {
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
//// return 1;
////}|]
////function fn6()[| {
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
//// const x = 1;
////}|]
////
////[|/*
////comment
////*/|]
////
////f6();
////
////class C1[| {
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
////}|]
////class C2[| {
//// private prop = 1;
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
////}|]
////class C3[| {
//// [|/**
//// * comment
//// */|]
////
//// private prop = 1;
//// [|/**
//// * comment
//// */|]
////}|]
////class C4[| {
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
//// private prop = 1;
////}|]
////
////[|/*
////comment
////*/|]
////new C4();
////
////module M1[| {
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
////}|]
////module M2[| {
//// export const a = 1;
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
////}|]
////module M3[| {
//// [|/**
//// * comment
//// */|]
//// export const a = 1;
////
//// [|/**
//// * comment
//// */|]
////}|]
////module M4[| {
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
//// export const a = 1;
////}|]
////interface I1[| {
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
////}|]
////interface I2[| {
//// x: number;
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
////}|]
////interface I3[| {
//// [|/**
//// * comment
//// */|]
//// x: number;
////
//// [|/**
//// * comment
//// */|]
////}|]
////interface I4[| {
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
//// x: number;
////}|]
////[|{
//// [|/**
//// * comment
//// */|]
////
//// [|/**
//// * comment
//// */|]
////}|]
verify.outliningSpansInCurrentFile(test.ranges());
| {
"end_byte": 6053,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOutliningForBlockComments.ts"
} |
TypeScript/tests/cases/fourslash/codeFixPropertyOverrideAccess_all.ts_0_803 | /// <reference path='fourslash.ts' />
// @strict: true
//// class A {
//// get x() { return 1 }
//// }
//// class B extends A {
//// x = 2
//// }
//// class C {
//// get x() { return 3 }
//// }
//// class D extends C {
//// x = 4
//// }
verify.codeFixAll({
fixId: "fixPropertyOverrideAccessor",
fixAllDescription: "Generate 'get' and 'set' accessors for all overriding properties",
newFileContent: `class A {
get x() { return 1 }
}
class B extends A {
private _x = 2
public get x() {
return this._x
}
public set x(value) {
this._x = value
}
}
class C {
get x() { return 3 }
}
class D extends C {
private _x = 4
public get x() {
return this._x
}
public set x(value) {
this._x = value
}
}`,
})
| {
"end_byte": 803,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixPropertyOverrideAccess_all.ts"
} |
TypeScript/tests/cases/fourslash/formatMultipleFunctionArguments.ts_0_682 | /// <reference path="fourslash.ts"/>
////
//// someRandomFunction({
//// prop1: 1,
//// prop2: 2
//// }, {
//// prop3: 3,
//// prop4: 4
//// }, {
//// prop5: 5,
//// prop6: 6
//// });
////
//// someRandomFunction(
//// { prop7: 1, prop8: 2 },
//// { prop9: 3, prop10: 4 },
//// {
//// prop11: 5,
//// prop2: 6
//// }
//// );
format.document();
verify.currentFileContentIs(`
someRandomFunction({
prop1: 1,
prop2: 2
}, {
prop3: 3,
prop4: 4
}, {
prop5: 5,
prop6: 6
});
someRandomFunction(
{ prop7: 1, prop8: 2 },
{ prop9: 3, prop10: 4 },
{
prop11: 5,
prop2: 6
}
);`);
| {
"end_byte": 682,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatMultipleFunctionArguments.ts"
} |
TypeScript/tests/cases/fourslash/getMatchingBracesAdjacentBraces.ts_0_283 | ////function f[|<T>|][|(x: T)|][|{
//// return x;
////}|]
// If there is an adjacent opening and closing brace,
// then only the opening brace should get highlighted.
for (const range of test.ranges()) {
verify.matchingBracePositionInCurrentFile(range.pos, range.end - 1);
}
| {
"end_byte": 283,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getMatchingBracesAdjacentBraces.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesIfElse4.ts_0_459 | /// <reference path='fourslash.ts' />
////if (true) {
//// if (false) {
//// }
//// else {
//// }
//// if (true) {
//// }
//// else {
//// /*1*/if (false)
//// /*2*/i/*3*/f (true)
//// var x = undefined;
//// }
////}
////else if (null) {
////}
////else /* whar garbl */ if (undefined) {
////}
////else
////if (false) {
////}
////else { }
verify.baselineDocumentHighlights(test.markers()); | {
"end_byte": 459,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesIfElse4.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsReExportRightNameWrongSymbol.ts_0_1054 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////[|export const /*a*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|] = 0;|]
// @Filename: /b.ts
////[|export const /*b*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}x|] = 0;|]
//@Filename: /c.ts
////[|export { /*cFromB*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 4 |}x|] } from "./b";|]
////[|import { /*cFromA*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 6 |}x|] } from "./a";|]
/////*cUse*/[|x|];
// @Filename: /d.ts
////[|import { /*d*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 9 |}x|] } from "./c";|]
verify.noErrors();
const [aDef, a, bDef, b, cFromBDef, cFromB, cFromADef, cFromA, cUse, dDef, d] = test.ranges();
verify.baselineFindAllReferences('a', 'b', 'cFromB', 'cFromA', 'cUse', 'd');
verify.baselineRename(a);
verify.baselineRename([cFromA, cUse]);
verify.baselineRename(b);
verify.baselineRename(cFromB);
verify.baselineRename(d); | {
"end_byte": 1054,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsReExportRightNameWrongSymbol.ts"
} |
TypeScript/tests/cases/fourslash/completionPropertyShorthandForObjectLiteral.ts_0_2302 | /// <reference path="fourslash.ts"/>
//// declare const foo: number;
//// interface Empty {}
//// interface Typed { typed: number; }
//// declare function f1(obj): void;
//// declare function f2(obj: any): void;
//// declare function f3(obj: unknown): void;
//// declare function f4(obj: object): void;
//// declare function f5(obj: Record<string, any>): void;
//// declare function f6(obj: { [key: string]: number }): void;
//// declare function f7<T>(obj: T): void;
//// declare function f8<T extends object>(obj: T): void;
//// declare function f9<T extends {}>(obj: T): void;
//// declare function f10<T extends Empty>(obj: T): void;
//// declare function f11<T extends (Empty | Record<string, any> | {})>(obj: T): void;
//// declare function f12(obj: Typed): void;
//// declare function f13<T extends (Empty | Typed)>(obj: T): void;
//// declare function f14(obj: { [key: string]: number, prop: number }): void;
//// declare function f15(obj: Record<number, any>): void;
//// declare function f16(obj: { [key: number]: number }): void;
//// f1({f/*1*/});
//// f2({f/*2*/});
//// f3({f/*3*/});
//// f4({f/*4*/});
//// f5({f/*5*/});
//// f6({f/*6*/});
//// f7({f/*7*/});
//// f8({f/*8*/});
//// f9({f/*9*/});
//// f10({f/*10*/});
//// f11({f/*11*/});
//// f12({f/*12*/});
//// f13({f/*13*/});
//// f14({f/*14*/});
//// f15({f/*15*/});
//// f16({f/*16*/});
//// f1({ f1, /*17*/ });
const locals = [
...(() => {
const symbols = [];
for (let i = 1; i <= 16; i ++) {
symbols.push(`f${i}`);
}
return symbols;
})(),
"foo"
];
verify.completions(
// Non-contextual, any, unknown, object, Record<string, ..>, [key: string]: .., Type parameter, etc..
{ marker: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"], unsorted: completion.globalsPlus(locals), isNewIdentifierLocation: true },
// Has named property
{ marker: ["12", "13"], exact: "typed", isNewIdentifierLocation: false },
// Has both StringIndexType and named property
{ marker: ["14"], exact: "prop", isNewIdentifierLocation: true },
// NumberIndexType
{ marker: ["15", "16"], exact: [], isNewIdentifierLocation: true },
// After comma
{ marker: ["17"], unsorted: completion.globalsPlus(locals), isNewIdentifierLocation: true },
);
| {
"end_byte": 2302,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionPropertyShorthandForObjectLiteral.ts"
} |
TypeScript/tests/cases/fourslash/jsDocFunctionSignatures5.ts_0_676 | ///<reference path="fourslash.ts" />
// @allowJs: true
// @Filename: Foo.js
/////**
//// * Filters a path based on a regexp or glob pattern.
//// * @param {String} basePath The base path where the search will be performed.
//// * @param {String} pattern A string defining a regexp of a glob pattern.
//// * @param {String} type The search pattern type, can be a regexp or a glob.
//// * @param {Object} options A object containing options to the search.
//// * @return {Array} A list containing the filtered paths.
//// */
////function pathFilter(basePath, pattern, type, options){
//////...
////}
////pathFilter(/**/'foo', 'bar', 'baz', {});
verify.baselineSignatureHelp()
| {
"end_byte": 676,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocFunctionSignatures5.ts"
} |
TypeScript/tests/cases/fourslash/findAllReferencesDynamicImport2.ts_3_374 | / <reference path='fourslash.ts' />
// @Filename: foo.ts
//// [|export function /*1*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}bar|]() { return "bar"; }|]
//// var x = import("./foo");
//// x.then(foo => {
//// foo./*2*/[|bar|]();
//// })
verify.baselineFindAllReferences('1', '2');
verify.baselineRenameAtRangesWithText("bar");
| {
"end_byte": 374,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllReferencesDynamicImport2.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpObjectLiteral.ts_0_550 | /// <reference path='fourslash.ts' />
////var objectLiteral = { n: 5, s: "", f: (a: number, b: string) => "" };
////objectLiteral.f(/*objectLiteral1*/4, /*objectLiteral2*/"");
verify.signatureHelp(
{
marker: "objectLiteral1",
text: "f(a: number, b: string): string",
parameterCount: 2,
parameterName: "a",
parameterSpan: "a: number",
},
{
marker: "objectLiteral2",
text: "f(a: number, b: string): string",
parameterName: "b",
parameterSpan: "b: string",
},
);
| {
"end_byte": 550,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpObjectLiteral.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarComputedPropertyName.ts_0_1132 | /// <reference path="fourslash.ts"/>
////function F(key, value) {
//// return {
//// [key]: value,
//// "prop": true
//// }
////}
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "F",
"kind": "function",
"childItems": [
{
"text": "[key]",
"kind": "property"
},
{
"text": "\"prop\"",
"kind": "property"
}
]
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "F",
"kind": "function"
}
]
},
{
"text": "F",
"kind": "function",
"childItems": [
{
"text": "[key]",
"kind": "property"
},
{
"text": "\"prop\"",
"kind": "property"
}
],
"indent": 1
}
]);
| {
"end_byte": 1132,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarComputedPropertyName.ts"
} |
TypeScript/tests/cases/fourslash/renameJsSpecialAssignmentRhs2.ts_0_266 | /// <reference path="fourslash.ts"/>
// @allowJs: true
// @Filename: a.js
////const foo = {
//// set: function (x) {
//// this._x = x;
//// },
//// copy: function ([|x|]) {
//// this._x = [|x|].prop;
//// }
////};
verify.baselineRename();
| {
"end_byte": 266,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameJsSpecialAssignmentRhs2.ts"
} |
TypeScript/tests/cases/fourslash/jsxTagNameCompletionUnclosed.ts_0_1606 | /// <reference path="fourslash.ts" />
//@Filename: file.tsx
////interface NestedInterface {
//// Foo: NestedInterface;
//// (props: {}): any;
////}
////
////declare const Foo: NestedInterface;
////
////function fn1() {
//// return <Foo>
//// </*1*/
//// </Foo>
////}
////function fn2() {
//// return <Foo>
//// <Fo/*2*/
//// </Foo>
////}
////function fn3() {
//// return <Foo>
//// <Foo./*3*/
//// </Foo>
////}
////function fn4() {
//// return <Foo>
//// <Foo.F/*4*/
//// </Foo>
////}
////function fn5() {
//// return <Foo>
//// <Foo.Foo./*5*/
//// </Foo>
////}
////function fn6() {
//// return <Foo>
//// <Foo.Foo.F/*6*/
//// </Foo>
////}
var preferences: FourSlashInterface.UserPreferences = {
jsxAttributeCompletionStyle: "braces",
includeCompletionsWithSnippetText: true,
includeCompletionsWithInsertText: true,
};
verify.completions(
{ marker: "1", preferences, includes: { name: "Foo", text: "const Foo: NestedInterface" } },
{ marker: "2", preferences, includes: { name: "Foo", text: "const Foo: NestedInterface" } },
{ marker: "3", preferences, includes: { name: "Foo", text: "(property) NestedInterface.Foo: NestedInterface" } },
{ marker: "4", preferences, includes: { name: "Foo", text: "(property) NestedInterface.Foo: NestedInterface" } },
{ marker: "5", preferences, includes: { name: "Foo", text: "(property) NestedInterface.Foo: NestedInterface" } },
{ marker: "6", preferences, includes: { name: "Foo", text: "(property) NestedInterface.Foo: NestedInterface" } },
)
| {
"end_byte": 1606,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsxTagNameCompletionUnclosed.ts"
} |
TypeScript/tests/cases/fourslash/completionListInUnclosedFunction06.ts_3_255 | / <reference path="fourslash.ts" />
////function foo(x: string, y: number, z: boolean) {
//// function bar(a: number, b: string = /*1*/, c: typeof x = "hello"
////
verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a"]})
| {
"end_byte": 255,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedFunction06.ts"
} |
TypeScript/tests/cases/fourslash/extract-method43.ts_0_427 | /// <reference path='fourslash.ts' />
////function foo() {
//// const x = 10 * /*a*/((((((10 + 10))))))/*b*/;
////}
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to function in global scope",
newContent:
`function foo() {
const x = 10 * /*RENAME*/newFunction();
}
function newFunction() {
return 10 + 10;
}
`
});
| {
"end_byte": 427,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method43.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_expandSelectionRange4.ts_0_592 | /// <reference path='fourslash.ts' />
//@Filename: /bar.ts
////import { b } from './other';
////const t = b;
// @Filename: /a.ts
//// interface T {
//// a: number
//// }
//// const x: T={
//// a: 1
//// };
//// [|const b = x|].a;
// @Filename: /other.ts
////export const b = 2;
verify.moveToFile({
newFileContents: {
"/a.ts":
`interface T {
a: number
}
export const x: T={
a: 1
};
`,
"/bar.ts":
`import { x } from './a';
import { b } from './other';
const t = b;
const b = x.a;
`,
},
interactiveRefactorArguments: { targetFile: "/bar.ts" }
}); | {
"end_byte": 592,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_expandSelectionRange4.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesSwitchCaseDefault3.ts_0_427 | /// <reference path='fourslash.ts' />
////foo: [|switch|] (1) {
//// [|case|] 1:
//// [|case|] 2:
//// [|break|];
//// [|case|] 3:
//// switch (2) {
//// case 1:
//// [|break|] foo;
//// continue; // invalid
//// default:
//// break;
//// }
//// [|default|]:
//// [|break|];
////}
verify.baselineDocumentHighlights();
| {
"end_byte": 427,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesSwitchCaseDefault3.ts"
} |
TypeScript/tests/cases/fourslash/indentationInBlockCommentAfterFormatting.ts_0_1236 | /// <reference path='fourslash.ts' />
////// This is a test case of formatting.
////class TestClass {
////private foo: string;
////public bar: string;
////constructor(foo: string, bar: string) {
////this.foo = foo;
////this.bar = bar;
////}
/////** /*1*/
////* This document is to be formatted./*2*/
////* /*3*/
////* After formatting, each line of this comment block should have indent consistent with the method./*4*/
////*
//// */
/////*5*/public testMethod() {
////}
////}
////var cookieMonster: TestClass;
////cookieMonster = new TestClass("FOO", "BAR");
format.document();
goTo.marker("1");
verify.indentationIs(4);
goTo.marker("2");
verify.indentationIs(4);
goTo.marker("3");
verify.indentationIs(3);
goTo.marker("4");
verify.indentationIs(3);
// Putting a marker in line "*" would bring some error when parsing code in automation.
// So move right by 1 offset from marker 4 to locate the caret in this line.
edit.moveRight(1);
verify.indentationIs(3);
// Putting a marker in line " */" would bring some error when parsing code in automation.
// So move left by 1 offset from marker 5 to locate the caret in this line.
goTo.marker("5");
edit.moveLeft(1);
verify.indentationIs(4);
goTo.marker("5");
verify.indentationIs(4); | {
"end_byte": 1236,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/indentationInBlockCommentAfterFormatting.ts"
} |
TypeScript/tests/cases/fourslash/extract-method-formatting.ts_0_516 | /// <reference path='fourslash.ts' />
////function f(x: number): number {
//// /*start*/switch (x) {case 0:
////return 0;}/*end*/
////}
goTo.select('start', 'end')
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to function in global scope",
newContent: `function f(x: number): number {
return /*RENAME*/newFunction(x);
}
function newFunction(x: number) {
switch (x) {
case 0:
return 0;
}
}
`
});
| {
"end_byte": 516,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method-formatting.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesOfUndefinedSymbol.ts_0_354 | /// <reference path='fourslash.ts' />
////var obj1: {
//// (bar: any): any;
//// new (bar: any): any;
//// [bar: any]: any;
//// bar: any;
//// foob(bar: any): any;
////};
////
////class cls3 {
//// property zeFunc() {
//// super.ceFun/**/c();
////}
////}
// "any" should not be highlighted
verify.baselineDocumentHighlights("");
| {
"end_byte": 354,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesOfUndefinedSymbol.ts"
} |
TypeScript/tests/cases/fourslash/importTypeMemberCompletions.ts_0_1442 | /// <reference path="fourslash.ts" />
// @Filename: /ns.ts
////export namespace Foo {
//// export namespace Bar {
//// export class Baz {}
//// export interface Bat {}
//// export const a: number;
//// const b: string;
//// }
////}
// @Filename: /top.ts
////export interface Bat {}
////export const a: number;
// @Filename: /equals.ts
////class Foo {
//// public static bar: string;
//// private static baz: number;
////}
////export = Foo;
// @Filename: /usage1.ts
////type A = typeof import("./ns")./*1*/
// @Filename: /usage2.ts
////type B = typeof import("./ns").Foo./*2*/
// @Filename: /usage3.ts
////type C = typeof import("./ns").Foo.Bar./*3*/
// @Filename: /usage4.ts
////type D = import("./ns")./*4*/
// @Filename: /usage5.ts
////type E = import("./ns").Foo./*5*/
// @Filename: /usage6.ts
////type F = import("./ns").Foo.Bar./*6*/
// @Filename: /usage7.ts
////type G = typeof import("./top")./*7*/
// @Filename: /usage8.ts
////type H = import("./top")./*8*/
// @Filename: /usage9.ts
////type H = typeof import("./equals")./*9*/
verify.completions(
{ marker: "1", exact: "Foo" },
{ marker: "2", exact: "Bar" },
{ marker: "3", exact: ["a", "Baz"] },
{ marker: "4", exact: "Foo" },
{ marker: "5", exact: "Bar" },
{ marker: "6", exact: ["Bat", "Baz"] },
{ marker: "7", exact: "a" },
{ marker: "8", exact: "Bat" },
{ marker: "9", exact: ["bar", "prototype"] },
);
| {
"end_byte": 1442,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importTypeMemberCompletions.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesOfAnonymousFunction2.ts_0_307 | /// <reference path='fourslash.ts' />
//////global foo definition
////function foo() {}
////
////(function f/*local*/oo(): number {
//// return foo(); // local foo reference
////})
//////global foo references
////fo/*global*/o();
////var f = foo;
verify.baselineDocumentHighlights(["local", "global"]); | {
"end_byte": 307,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesOfAnonymousFunction2.ts"
} |
TypeScript/tests/cases/fourslash/renameParameterPropertyDeclaration3.ts_3_325 | / <reference path='fourslash.ts'/>
//// class Foo {
//// constructor([|protected [|{| "contextRangeIndex": 0 |}protectedParam|]: number|]) {
//// let protectedParam = [|protectedParam|];
//// this.[|protectedParam|] += 10;
//// }
//// }
verify.baselineRenameAtRangesWithText("protectedParam");
| {
"end_byte": 325,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameParameterPropertyDeclaration3.ts"
} |
TypeScript/tests/cases/fourslash/findAllReferencesTripleSlash.ts_0_423 | /// <reference path="fourslash.ts" />
// @checkJs: true
// @Filename: /node_modules/@types/globals/index.d.ts
//// declare const someAmbientGlobal: unknown;
// @Filename: /a.ts
//// /// <reference path="b.ts/*1*/" />
//// /// <reference types="globals/*2*/" />
// @Filename: /b.ts
//// console.log("b.ts");
// @Filename: /c.js
//// require("./b");
//// require("globals");
verify.baselineFindAllReferences("1", "2");
| {
"end_byte": 423,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllReferencesTripleSlash.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_interfaceMultipleSignatures.ts_0_489 | /// <reference path='fourslash.ts' />
////interface IFoo {
//// method(x: string, y: string): void;
//// method(x: number, y: string): void;
////}
////const x: IFoo = {
//// method(/*a*/x: string | number, y: string/*b*/): void {},
////};
// For multiple signatures, we don't have a reliable way to determine
// which signature to match to or if all signatures should be changed.
goTo.select("a", "b");
verify.not.refactorAvailable("Convert parameters to destructured object");
| {
"end_byte": 489,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_interfaceMultipleSignatures.ts"
} |
TypeScript/tests/cases/fourslash/invalidRestArgError.ts_0_118 | /// <reference path="fourslash.ts"/>
////function b(.../*1*/)/*2*/ {}
verify.errorExistsBetweenMarkers('1', '2');
| {
"end_byte": 118,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/invalidRestArgError.ts"
} |
TypeScript/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics11.ts_0_145 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: a.js
////function F(): number { }
verify.baselineSyntacticDiagnostics();
| {
"end_byte": 145,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics11.ts"
} |
TypeScript/tests/cases/fourslash/completionsGenericIndexedAccess2.ts_0_880 | /// <reference path="fourslash.ts" />
// #34825
////export type GetMethodsForType<T, G extends string> = { [K in keyof T]:
//// T[K] extends () => any ? { name: K, group: G, } : T[K] extends (s: infer U) => any ? { name: K, group: G, payload: U } : never }[keyof T];
////
////
////class Sample {
//// count = 0;
//// books: { name: string, year: number }[] = []
//// increment() {
//// this.count++
//// this.count++
//// }
////
//// addBook(book: Sample["books"][0]) {
//// this.books.push(book)
//// }
////}
////export declare function testIt<T, G extends string>(): (input: any, method: GetMethodsForType<T, G>) => any
////
////
////const t = testIt<Sample, "Sample">()
////
////const i = t(null, { name: "addBook", group: "Sample", payload: { /**/ } })
verify.completions({
marker: '',
exact: [
{ name: 'name' },
{ name: 'year' },
]
});
| {
"end_byte": 880,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsGenericIndexedAccess2.ts"
} |
TypeScript/tests/cases/fourslash/completionListAtNodeBoundary.ts_0_527 | /// <reference path="fourslash.ts"/>
////interface Iterator<T, U> {
//// (value: T, index: any, list: any): U;
////}
////
////interface WrappedArray<T> {
//// map<U>(iterator: Iterator<T, U>, context?: any): U[];
////}
////
////interface Underscore {
//// <T>(list: T[]): WrappedArray<T>;
//// map<T, U>(list: T[], iterator: Iterator<T, U>, context?: any): U[];
////}
////
////declare var _: Underscore;
////var a: string[];
////var e = a.map(x => x./**/);
verify.completions({ marker: "", includes: "charAt" });
| {
"end_byte": 527,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListAtNodeBoundary.ts"
} |
TypeScript/tests/cases/fourslash/smartSelection_JSDocTags2.ts_0_130 | /// <reference path="fourslash.ts" />
/////**
//// * @type {/**/string}
//// */
////const foo;
verify.baselineSmartSelection();
| {
"end_byte": 130,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartSelection_JSDocTags2.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_TemplateString4.ts_0_433 | /// <reference path='fourslash.ts' />
////const foo = 1;
////const bar = /*start*/`` + "1" + `` + `${foo}`/*end*/;
goTo.select("start", "end");
edit.applyRefactor({
refactorName: "Convert to template string",
actionName: "Convert to template string",
actionDescription: ts.Diagnostics.Convert_to_template_string.message,
newContent: [
"const foo = 1;",
"const bar = `1${foo}`;"
].join("\n")
});
| {
"end_byte": 433,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_TemplateString4.ts"
} |
TypeScript/tests/cases/fourslash/convertFunctionToEs6Class_asyncMethods.ts_0_586 | /// <reference path='fourslash.ts' />
// @allowNonTsExtensions: true
// @Filename: test123.js
// @lib: es5
////export function /**/MyClass() {
////}
////MyClass.prototype.foo = async function() {
//// await Promise.resolve();
////}
////MyClass.bar = async function() {
//// await Promise.resolve();
////}
verify.codeFix({
description: "Convert function to an ES2015 class",
newFileContent:
`export class MyClass {
constructor() {
}
static async bar() {
await Promise.resolve();
}
async foo() {
await Promise.resolve();
}
}
`,
});
| {
"end_byte": 586,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/convertFunctionToEs6Class_asyncMethods.ts"
} |
TypeScript/tests/cases/fourslash/memberListOnConstructorType.ts_0_163 | /// <reference path='fourslash.ts'/>
////var f: new () => void;
////f./*1*/
verify.completions({ marker: "1", exact: completion.functionMembersWithPrototype });
| {
"end_byte": 163,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberListOnConstructorType.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddOptionalParam2.ts_0_296 | /// <reference path="fourslash.ts" />
////[|function f(a: number) {}|]
////
////const a = 1;
////const b = 1;
////f(a, b);
verify.codeFix({
description: [ts.Diagnostics.Add_optional_parameter_to_0.message, "f"],
index: 1,
newRangeContent: "function f(a: number, b?: number) {}"
});
| {
"end_byte": 296,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddOptionalParam2.ts"
} |
TypeScript/tests/cases/fourslash/memberListOfModuleAfterInvalidCharater.ts_0_219 | /// <reference path='fourslash.ts'/>
////module testModule {
//// export var foo = 1;
////}
////@
////testModule./**/
verify.completions({ marker: "", exact: { name: "foo", text: "var testModule.foo: number" } });
| {
"end_byte": 219,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberListOfModuleAfterInvalidCharater.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_fromAmbientModule.ts_0_340 | /// <reference path="fourslash.ts" />
// @module: esnext
// @Filename: /a.ts
////declare module "m" {
//// export const x: number;
////}
// @Filename: /b.ts
/////**/
verify.applyCodeActionFromCompletion("", {
name: "x",
source: "m",
description: `Add import from "m"`,
newFileContent: `import { x } from "m";
`,
});
| {
"end_byte": 340,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_fromAmbientModule.ts"
} |
TypeScript/tests/cases/fourslash/referencesForEnums.ts_0_308 | /// <reference path='fourslash.ts'/>
////enum E {
//// /*1*/value1 = 1,
//// /*2*/"/*3*/value2" = /*4*/value1,
//// /*5*/111 = 11
////}
////
////E./*6*/value1;
////E["/*7*/value2"];
////E./*8*/value2;
////E[/*9*/111];
verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9');
| {
"end_byte": 308,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForEnums.ts"
} |
TypeScript/tests/cases/fourslash/codeFixPromoteTypeOnly1.ts_0_608 | /// <reference path="fourslash.ts" />
// @module: es2015
// https://github.com/microsoft/TypeScript/issues/55363
// @Filename: index.ts
//// import { TwistyAlgEditor, type TwistyPlayer } from "./other-file";
//// new TwistyPlayer();
// @Filename: other-file.ts
//// export class TwistyAlgEditor {}
//// export class TwistyPlayer {}
verify.codeFix({
index: 0,
description: [ts.Diagnostics.Remove_type_from_import_of_0_from_1.message, "TwistyPlayer", "./other-file"],
applyChanges: true,
newFileContent:
`import { TwistyAlgEditor, TwistyPlayer } from "./other-file";
new TwistyPlayer();`
}) | {
"end_byte": 608,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixPromoteTypeOnly1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports34-object-spread.ts_0_1183 | /// <reference path='fourslash.ts'/>
// @isolatedDeclarations: true
// @declaration: true
// @Filename: /code.ts
////const Start = {
//// A: 'A',
//// B: 'B',
////} as const;
////
////const End = {
//// Y: "Y",
//// Z: "Z"
////} as const;
////export const All_Part1 = {};
////function getPart() {
//// return { M: "Z"}
////}
////
////export const All = {
//// x: 1,
//// ...Start,
//// y: 1,
//// ...getPart(),
//// ...End,
//// z: 1,
////};
verify.codeFix({
description: "Add annotation of type 'typeof All_Part1_1 & typeof Start & typeof All_Part3 & typeof All_Part4 & typeof End & typeof All_Part6'" ,
index: 1,
newFileContent:
`const Start = {
A: 'A',
B: 'B',
} as const;
const End = {
Y: "Y",
Z: "Z"
} as const;
export const All_Part1 = {};
function getPart() {
return { M: "Z"}
}
const All_Part1_1 = {
x: 1
};
const All_Part3 = {
y: 1
};
const All_Part4 = getPart();
const All_Part6 = {
z: 1
};
export const All: typeof All_Part1_1 & typeof Start & typeof All_Part3 & typeof All_Part4 & typeof End & typeof All_Part6 = {
...All_Part1_1,
...Start,
...All_Part3,
...All_Part4,
...End,
...All_Part6
};`
});
| {
"end_byte": 1183,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports34-object-spread.ts"
} |
TypeScript/tests/cases/fourslash/mapCodeNestedWhileInsertion.ts_0_404 | ///<reference path="fourslash.ts"/>
// @Filename: /index.ts
//// function foo() {
//// const x: number = 1;
//// const y: number = 2;
//// while (x === y) [||]{
//// console.log("hello");
//// console.log("you");
//// }
//// return 1;
//// }
////
verify.baselineMapCode([test.ranges()], [
`
while (y === x) {
console.log("goodbye");
console.log("world");
}
`
]); | {
"end_byte": 404,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/mapCodeNestedWhileInsertion.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUseBigIntLiteral.ts_0_1404 | /// <reference path="fourslash.ts" />
////9007199254740991;
////-9007199254740991;
////9007199254740992;
////-9007199254740992;
////9007199254740993;
////-9007199254740993;
////9007199254740994;
////-9007199254740994;
////0x19999999999998;
////-0x19999999999998;
////0x19999999999999;
////-0x19999999999999;
////0x20000000000000;
////-0x20000000000000;
////0x20000000000001;
////-0x20000000000001;
////2e52;
////2e53;
////2e54;
////1e00000000010;
verify.codeFix({
description: ts.Diagnostics.Convert_to_a_bigint_numeric_literal.message,
index: 0,
newFileContent:
`9007199254740991;
-9007199254740991;
9007199254740992n;
-9007199254740992;
9007199254740993;
-9007199254740993;
9007199254740994;
-9007199254740994;
0x19999999999998;
-0x19999999999998;
0x19999999999999;
-0x19999999999999;
0x20000000000000;
-0x20000000000000;
0x20000000000001;
-0x20000000000001;
2e52;
2e53;
2e54;
1e00000000010;`
});
verify.codeFixAll({
fixAllDescription: ts.Diagnostics.Convert_all_to_bigint_numeric_literals.message,
fixId: "useBigintLiteral",
newFileContent:
`9007199254740991;
-9007199254740991;
9007199254740992n;
-9007199254740992n;
9007199254740993n;
-9007199254740993n;
9007199254740994n;
-9007199254740994n;
0x19999999999998;
-0x19999999999998;
0x19999999999999;
-0x19999999999999;
0x20000000000000n;
-0x20000000000000n;
0x20000000000001n;
-0x20000000000001n;
2e52;
2e53;
2e54;
1e00000000010;`
});
| {
"end_byte": 1404,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUseBigIntLiteral.ts"
} |
TypeScript/tests/cases/fourslash/renameForDefaultExport04.ts_0_377 | /// <reference path='fourslash.ts'/>
// @Filename: foo.ts
////export default class /**/[|DefaultExportedClass|] {
////}
/////*
//// * Commenting DefaultExportedClass
//// */
////
////var x: DefaultExportedClass;
////
////var y = new DefaultExportedClass;
goTo.marker();
verify.renameInfoSucceeded("DefaultExportedClass", '"/tests/cases/fourslash/foo".DefaultExportedClass'); | {
"end_byte": 377,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameForDefaultExport04.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFix_commonjs_allowSynthetic.ts_0_469 | /// <reference path="fourslash.ts" />
// @module: esnext
// @moduleResolution: node
// @allowJs: true
// @checkJs: true
// @allowSyntheticDefaultImports: true
// @Filename: /test_module.js
//// const MY_EXPORTS = {}
//// module.exports = MY_EXPORTS;
// @Filename: /index.js
//// const newVar = {
//// any: MY_EXPORTS/**/,
//// }
goTo.marker("");
verify.importFixAtPosition([`const MY_EXPORTS = require("./test_module");
const newVar = {
any: MY_EXPORTS,
}`]);
| {
"end_byte": 469,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_commonjs_allowSynthetic.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsImportEqualsJsonFile.ts_0_392 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @resolveJsonModule: true
// @Filename: /a.ts
////import /*0*/j = require("/*1*/./j.json");
/////*2*/j;
// @Filename: /b.js
////const /*3*/j = require("/*4*/./j.json");
/////*5*/j;
// @Filename: /j.json
/////*6*/{ "x": 0 }
verify.noErrors();
verify.baselineFindAllReferences('0', '2', '1', '4', '3', '5', '6')
| {
"end_byte": 392,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsImportEqualsJsonFile.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_refactorAvailable1.ts_0_383 | /// <reference path='fourslash.ts' />
////namespace ns {
//// /*a*/export function fn() {
//// }
//// fn();
//// /*b*/
////}
goTo.select("a", "b");
verify.not.refactorAvailable("Move to a new file",
/*actionName*/ undefined,
/*actionDescription*/ undefined,
/*kind*/ undefined,
{
allowTextChangesInNewFiles: true
},
/*includeInteractiveActions*/ true);
| {
"end_byte": 383,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_refactorAvailable1.ts"
} |
TypeScript/tests/cases/fourslash/jsdocDeprecated_suggestion13.ts_0_462 | ///<reference path="fourslash.ts" />
// @filename: foo.ts
/////**
//// * @deprecated
//// */
////function foo() {};
////
////class Foo {
//// constructor(fn: () => void) {
//// fn();
//// }
////}
////new Foo([|foo|]);
goTo.file('foo.ts');
const ranges = test.ranges();
verify.getSuggestionDiagnostics([
{
"code": 6385,
"message": "'foo' is deprecated.",
"reportsDeprecated": true,
"range": ranges[0]
},
]);
| {
"end_byte": 462,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocDeprecated_suggestion13.ts"
} |
TypeScript/tests/cases/fourslash/commentsOverloadsFourslash.ts_0_5451 | /// <reference path='fourslash.ts' />
/////** this is signature 1*/
////function /*1*/f1(/**param a*/a: number): number;
////function /*2*/f1(b: string): number;
////function /*3*/f1(aOrb: any) {
//// return 10;
////}
////f/*4q*/1(/*4*/"hello");
////f/*o4q*/1(/*o4*/10);
////function /*5*/f2(/**param a*/a: number): number;
/////** this is signature 2*/
////function /*6*/f2(b: string): number;
/////** this is f2 var comment*/
////function /*7*/f2(aOrb: any) {
//// return 10;
////}
////f/*8q*/2(/*8*/"hello");
////f/*o8q*/2(/*o8*/10);
////function /*9*/f3(a: number): number;
////function /*10*/f3(b: string): number;
////function /*11*/f3(aOrb: any) {
//// return 10;
////}
////f/*12q*/3(/*12*/"hello");
////f/*o12q*/3(/*o12*/10);
/////** this is signature 4 - with number parameter*/
////function /*13*/f4(/**param a*/a: number): number;
/////** this is signature 4 - with string parameter*/
////function /*14*/f4(b: string): number;
////function /*15*/f4(aOrb: any) {
//// return 10;
////}
////f/*16q*/4(/*16*/"hello");
////f/*o16q*/4(/*o16*/10);
/////*17*/
////interface i1 {
//// /**this signature 1*/
//// (/**param a*/ a: number): number;
//// /**this is signature 2*/
//// (b: string): number;
//// /** foo 1*/
//// foo(a: number): number;
//// /** foo 2*/
//// foo(b: string): number;
//// foo2(a: number): number;
//// /** foo2 2*/
//// foo2(b: string): number;
//// foo3(a: number): number;
//// foo3(b: string): number;
//// /** foo4 1*/
//// foo4(a: number): number;
//// foo4(b: string): number;
//// /** new 1*/
//// new (a: string);
//// new (b: number);
////}
////var i1_i: i1;
////interface i2 {
//// new (a: string);
//// /** new 2*/
//// new (b: number);
//// (a: number): number;
//// /**this is signature 2*/
//// (b: string): number;
////}
////var i2_i: i2;
////interface i3 {
//// /** new 1*/
//// new (a: string);
//// /** new 2*/
//// new (b: number);
//// /**this is signature 1*/
//// (a: number): number;
//// (b: string): number;
////}
////var i3_i: i3;
////interface i4 {
//// new (a: string);
//// new (b: number);
//// (a: number): number;
//// (b: string): number;
////}
////var i4_i: i4;
////new /*18*/i1/*19q*/_i(/*19*/10);
////new i/*20q*/1_i(/*20*/"Hello");
////i/*21q*/1_i(/*21*/10);
////i/*22q*/1_i(/*22*/"hello");
////i1_i./*23*/f/*24q*/oo(/*24*/10);
////i1_i.f/*25q*/oo(/*25*/"hello");
////i1_i.fo/*26q*/o2(/*26*/10);
////i1_i.fo/*27q*/o2(/*27*/"hello");
////i1_i.fo/*28q*/o3(/*28*/10);
////i1_i.fo/*29q*/o3(/*29*/"hello");
////i1_i.fo/*30q*/o4(/*30*/10);
////i1_i.fo/*31q*/o4(/*31*/"hello");
////new i2/*32q*/_i(/*32*/10);
////new i2/*33q*/_i(/*33*/"Hello");
////i/*34q*/2_i(/*34*/10);
////i2/*35q*/_i(/*35*/"hello");
////new i/*36q*/3_i(/*36*/10);
////new i3/*37q*/_i(/*37*/"Hello");
////i3/*38q*/_i(/*38*/10);
////i3/*39q*/_i(/*39*/"hello");
////new i4/*40q*/_i(/*40*/10);
////new i/*41q*/4_i(/*41*/"Hello");
////i4/*42q*/_i(/*42*/10);
////i4/*43q*/_i(/*43*/"hello");
////class c {
//// public /*93*/prop1(a: number): number;
//// public /*94*/prop1(b: string): number;
//// public /*95*/prop1(aorb: any) {
//// return 10;
//// }
//// /** prop2 1*/
//// public /*96*/prop2(a: number): number;
//// public /*97*/prop2(b: string): number;
//// public /*98*/prop2(aorb: any) {
//// return 10;
//// }
//// public /*99*/prop3(a: number): number;
//// /** prop3 2*/
//// public /*100*/prop3(b: string): number;
//// public /*101*/prop3(aorb: any) {
//// return 10;
//// }
//// /** prop4 1*/
//// public /*102*/prop4(a: number): number;
//// /** prop4 2*/
//// public /*103*/prop4(b: string): number;
//// public /*104*/prop4(aorb: any) {
//// return 10;
//// }
//// /** prop5 1*/
//// public /*105*/prop5(a: number): number;
//// /** prop5 2*/
//// public /*106*/prop5(b: string): number;
//// /** Prop5 implementaion*/
//// public /*107*/prop5(aorb: any) {
//// return 10;
//// }
////}
////class c1 {
//// /*78*/constructor(a: number);
//// /*79*/constructor(b: string);
//// /*80*/constructor(aorb: any) {
//// }
////}
////class c2 {
//// /** c2 1*/
//// /*81*/constructor(a: number);
//// /*82*/constructor(b: string);
//// /*83*/constructor(aorb: any) {
//// }
////}
////class c3 {
//// /*84*/constructor(a: number);
//// /** c3 2*/
//// /*85*/constructor(b: string);
//// /*86*/constructor(aorb: any) {
//// }
////}
////class c4 {
//// /** c4 1*/
//// /*87*/constructor(a: number);
//// /** c4 2*/
//// /*88*/constructor(b: string);
//// /*89*/constructor(aorb: any) {
//// }
////}
////class c5 {
//// /** c5 1*/
//// /*90*/constructor(a: number);
//// /** c5 2*/
//// /*91*/constructor(b: string);
//// /** c5 implementation*/
//// /*92*/constructor(aorb: any) {
//// }
////}
////var c_i = new c();
////c_i./*44*/pro/*45q*/p1(/*45*/10);
////c_i.pr/*46q*/op1(/*46*/"hello");
////c_i.pr/*47q*/op2(/*47*/10);
////c_i.pr/*48q*/op2(/*48*/"hello");
////c_i.pro/*49q*/p3(/*49*/10);
////c_i.pr/*50q*/op3(/*50*/"hello");
////c_i.pr/*51q*/op4(/*51*/10);
////c_i.pr/*52q*/op4(/*52*/"hello");
////c_i.pr/*53q*/op5(/*53*/10);
////c_i.pr/*54q*/op5(/*54*/"hello");
////var c1/*66*/_i_1 = new c/*55q*/1(/*55*/10);
////var c1_i_2 = new c/*56q*/1(/*56*/"hello");
////var c2_i_1 = new c/*57q*/2(/*57*/10); | {
"end_byte": 5451,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/commentsOverloadsFourslash.ts"
} |
TypeScript/tests/cases/fourslash/commentsOverloadsFourslash.ts_5452_11796 | ////var c/*67*/2_i_2 = new c/*58q*/2(/*58*/"hello");
////var c3_i_1 = new c/*59q*/3(/*59*/10);
////var c/*68*/3_i_2 = new c/*60q*/3(/*60*/"hello");
////var c4/*69*/_i_1 = new c/*61q*/4(/*61*/10);
////var c4_i_2 = new c/*62q*/4(/*62*/"hello");
////var c/*70*/5_i_1 = new c/*63q*/5(/*63*/10);
////var c5_i_2 = new c/*64q*/5(/*64*/"hello");
/////** This is multiOverload F1 1*/
////function multiOverload(a: number): string;
/////** This is multiOverload F1 2*/
////function multiOverload(b: string): string;
/////** This is multiOverload F1 3*/
////function multiOverload(c: boolean): string;
/////** This is multiOverload Implementation */
////function multiOverload(d): string {
//// return "Hello";
////}
////multiOverl/*71*/oad(10);
////multiOverl/*72*/oad("hello");
////multiOverl/*73*/oad(true);
/////** This is ambient F1 1*/
////declare function ambientF1(a: number): string;
/////** This is ambient F1 2*/
////declare function ambientF1(b: string): string;
/////** This is ambient F1 3*/
////declare function ambientF1(c: boolean): boolean;
/////*65*/
////ambient/*74*/F1(10);
////ambient/*75*/F1("hello");
////ambient/*76*/F1(true);
////function foo(a/*77*/a: i3) {
////}
////foo(null);
verify.quickInfos({
1: ["function f1(a: number): number (+1 overload)", "this is signature 1"],
2: ["function f1(b: string): number (+1 overload)", "this is signature 1"],
3: ["function f1(a: number): number (+1 overload)", "this is signature 1"],
"4q": ["function f1(b: string): number (+1 overload)", "this is signature 1"],
o4q: ["function f1(a: number): number (+1 overload)", "this is signature 1"]
});
verify.signatureHelp({ marker: "4", overloadsCount: 2 });
verify.signatureHelp({ marker: "o4", overloadsCount: 2, docComment: "this is signature 1", parameterDocComment: "param a" });
verify.quickInfos({
5: "function f2(a: number): number (+1 overload)",
6: ["function f2(b: string): number (+1 overload)", "this is signature 2"],
7: "function f2(a: number): number (+1 overload)",
"8q": ["function f2(b: string): number (+1 overload)", "this is signature 2"],
o8q: "function f2(a: number): number (+1 overload)",
});
verify.signatureHelp(
{ marker: "8", overloadsCount: 2, docComment: "this is signature 2" },
{ marker: "o8", overloadsCount: 2, parameterDocComment: "param a" },
);
verify.quickInfos({
9: "function f3(a: number): number (+1 overload)",
10: "function f3(b: string): number (+1 overload)",
11: "function f3(a: number): number (+1 overload)",
"12q": "function f3(b: string): number (+1 overload)",
o12q: "function f3(a: number): number (+1 overload)"
});
verify.signatureHelp({ marker: ["12", "o12"], overloadsCount: 2 });
verify.quickInfos({
13: ["function f4(a: number): number (+1 overload)", "this is signature 4 - with number parameter"],
14: ["function f4(b: string): number (+1 overload)", "this is signature 4 - with string parameter"],
15: ["function f4(a: number): number (+1 overload)", "this is signature 4 - with number parameter"],
"16q": ["function f4(b: string): number (+1 overload)", "this is signature 4 - with string parameter"],
o16q: ["function f4(a: number): number (+1 overload)", "this is signature 4 - with number parameter"]
});
verify.signatureHelp(
{ marker: "16", overloadsCount: 2, docComment: "this is signature 4 - with string parameter" },
{ marker: "o16", overloadsCount: 2, docComment: "this is signature 4 - with number parameter", parameterDocComment: "param a" },
);
verify.completions(
{
marker: "17",
includes: [
{ name: "f1", text: "function f1(a: number): number (+1 overload)", documentation: "this is signature 1" },
{ name: "f2", text: "function f2(a: number): number (+1 overload)" },
{ name: "f3", text: "function f3(a: number): number (+1 overload)" },
{ name: "f4", text: "function f4(a: number): number (+1 overload)", documentation: "this is signature 4 - with number parameter" },
],
},
{
marker: "18",
includes: [
{ name: "i1_i", text: "var i1_i: i1\nnew (b: number) => any (+1 overload)", documentation: "new 1" },
{ name: "i2_i", text: "var i2_i: i2\nnew (a: string) => any (+1 overload)" },
{ name: "i3_i", text: "var i3_i: i3\nnew (a: string) => any (+1 overload)", documentation: "new 1" },
{ name: "i4_i", text: "var i4_i: i4\nnew (a: string) => any (+1 overload)" },
],
excludes: ["i1", "i2", "i3", "i4"],
},
);
verify.signatureHelp({ marker: "19", overloadsCount: 2 });
verify.quickInfoAt("19q", "var i1_i: i1\nnew (b: number) => any (+1 overload)", "new 1");
verify.signatureHelp({ marker: "20", overloadsCount: 2, docComment: "new 1" });
verify.quickInfoAt("20q", "var i1_i: i1\nnew (a: string) => any (+1 overload)", "new 1");
verify.signatureHelp({ marker: "21", overloadsCount: 2, docComment: "this signature 1", parameterDocComment: "param a" });
verify.quickInfoAt("21q", "var i1_i: i1\n(a: number) => number (+1 overload)", "this signature 1");
verify.signatureHelp({ marker: "22", overloadsCount: 2, docComment: "this is signature 2" });
goTo.marker('22q');
verify.quickInfoAt("22q", "var i1_i: i1\n(b: string) => number (+1 overload)", "this is signature 2");
verify.completions({
marker: "23",
includes: [
{ name: "foo" , text: "(method) i1.foo(a: number): number (+1 overload)", documentation: "foo 1" },
{ name: "foo2", text: "(method) i1.foo2(a: number): number (+1 overload)" },
{ name: "foo3", text: "(method) i1.foo3(a: number): number (+1 overload)" },
{ name: "foo4", text: "(method) i1.foo4(a: number): number (+1 overload)", documentation: "foo4 1" },
],
});
verify.signatureHelp({ marker: "24", overloadsCount: 2, docComment: "foo 1" });
verify.quickInfoAt("24q", "(method) i1.foo(a: number): number (+1 overload)", "foo 1");
verify.signatureHelp({ marker: "25", overloadsCount: 2, docComment: "foo 2" });
verify.quickInfoAt("25q", "(method) i1.foo(b: string): number (+1 overload)", "foo 2");
verify.signatureHelp({ marker: "26", overloadsCount: 2 });
verify.quickInfoAt("26q", "(method) i1.foo2(a: number): number (+1 overload)");
verify.signatureHelp({ marker: "27", overloadsCount: 2, docComment: "foo2 2" }); | {
"end_byte": 11796,
"start_byte": 5452,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/commentsOverloadsFourslash.ts"
} |
TypeScript/tests/cases/fourslash/commentsOverloadsFourslash.ts_11797_18024 | verify.quickInfoAt("27q", "(method) i1.foo2(b: string): number (+1 overload)", "foo2 2");
verify.signatureHelp({ marker: "28", overloadsCount: 2 });
verify.quickInfoAt("28q", "(method) i1.foo3(a: number): number (+1 overload)");
verify.signatureHelp({ marker: "29", overloadsCount: 2 });
verify.quickInfoAt("29q", "(method) i1.foo3(b: string): number (+1 overload)");
verify.signatureHelp({ marker: "30", overloadsCount: 2, docComment: "foo4 1" });
verify.quickInfoAt("30q", "(method) i1.foo4(a: number): number (+1 overload)", "foo4 1");
verify.signatureHelp({ marker: "31", overloadsCount: 2 });
verify.quickInfoAt("31q", "(method) i1.foo4(b: string): number (+1 overload)", "foo4 1");
verify.signatureHelp({ marker: "32", overloadsCount: 2, docComment: "new 2" });
verify.quickInfoAt("32q", "var i2_i: i2\nnew (b: number) => any (+1 overload)", "new 2");
verify.signatureHelp({ marker: "33", overloadsCount: 2 });
verify.quickInfoAt("33q", "var i2_i: i2\nnew (a: string) => any (+1 overload)");
verify.signatureHelp({ marker: "34", overloadsCount: 2 });
verify.quickInfoAt("34q", "var i2_i: i2\n(a: number) => number (+1 overload)");
verify.signatureHelp({ marker: "35", overloadsCount: 2, docComment: "this is signature 2" });
verify.quickInfoAt("35q", "var i2_i: i2\n(b: string) => number (+1 overload)", "this is signature 2");
verify.signatureHelp({ marker: "36", overloadsCount: 2, docComment: "new 2" });
verify.quickInfoAt("36q", "var i3_i: i3\nnew (b: number) => any (+1 overload)", "new 2");
verify.signatureHelp({ marker: "37", overloadsCount: 2, docComment: "new 1" });
verify.quickInfoAt("37q", "var i3_i: i3\nnew (a: string) => any (+1 overload)", "new 1");
verify.signatureHelp({ marker: "38", overloadsCount: 2, docComment: "this is signature 1" });
verify.quickInfoAt("38q", "var i3_i: i3\n(a: number) => number (+1 overload)", "this is signature 1");
verify.signatureHelp({ marker: "39", overloadsCount: 2 });
verify.quickInfoAt("39q", "var i3_i: i3\n(b: string) => number (+1 overload)", "this is signature 1");
verify.signatureHelp({ marker: "40", overloadsCount: 2 });
verify.quickInfoAt("40q", "var i4_i: i4\nnew (b: number) => any (+1 overload)");
verify.signatureHelp({ marker: "41", overloadsCount: 2 });
verify.quickInfoAt("41q", "var i4_i: i4\nnew (a: string) => any (+1 overload)");
verify.signatureHelp({ marker: "42", overloadsCount: 2 });
verify.quickInfoAt("42q", "var i4_i: i4\n(a: number) => number (+1 overload)");
verify.signatureHelp({ marker: "43", overloadsCount: 2 });
verify.quickInfoAt("43q", "var i4_i: i4\n(b: string) => number (+1 overload)");
verify.completions({
marker: "44",
exact: [
{ name: "prop1", text: "(method) c.prop1(a: number): number (+1 overload)" },
{ name: "prop2", text: "(method) c.prop2(a: number): number (+1 overload)", documentation: "prop2 1" },
{ name: "prop3", text: "(method) c.prop3(a: number): number (+1 overload)" },
{ name: "prop4", text: "(method) c.prop4(a: number): number (+1 overload)", documentation: "prop4 1" },
{ name: "prop5", text: "(method) c.prop5(a: number): number (+1 overload)", documentation: "prop5 1" },
],
});
verify.signatureHelp({ marker: "45", overloadsCount: 2 });
verify.quickInfoAt("45q", "(method) c.prop1(a: number): number (+1 overload)");
verify.signatureHelp({ marker: "46", overloadsCount: 2 });
verify.quickInfoAt("46q", "(method) c.prop1(b: string): number (+1 overload)");
verify.signatureHelp({ marker: "47", overloadsCount: 2, docComment: "prop2 1" });
verify.quickInfoAt("47q", "(method) c.prop2(a: number): number (+1 overload)", "prop2 1");
verify.signatureHelp({ marker: "48", overloadsCount: 2 });
verify.quickInfoAt("48q", "(method) c.prop2(b: string): number (+1 overload)", "prop2 1");
verify.signatureHelp({ marker: "49", overloadsCount: 2 });
verify.quickInfoAt("49q", "(method) c.prop3(a: number): number (+1 overload)");
verify.signatureHelp({ marker: "50", overloadsCount: 2, docComment: "prop3 2" });
verify.quickInfoAt("50q", "(method) c.prop3(b: string): number (+1 overload)", "prop3 2");
verify.signatureHelp({ marker: "51", overloadsCount: 2, docComment: "prop4 1" });
verify.quickInfoAt("51q", "(method) c.prop4(a: number): number (+1 overload)", "prop4 1");
verify.signatureHelp({ marker: "52", overloadsCount: 2, docComment: "prop4 2" });
verify.quickInfoAt("52q", "(method) c.prop4(b: string): number (+1 overload)", "prop4 2");
verify.signatureHelp({ marker: "53", overloadsCount: 2, docComment: "prop5 1" });
verify.quickInfoAt("53q", "(method) c.prop5(a: number): number (+1 overload)", "prop5 1");
verify.signatureHelp({ marker: "54", overloadsCount: 2, docComment: "prop5 2" });
verify.quickInfoAt("54q", "(method) c.prop5(b: string): number (+1 overload)", "prop5 2");
verify.signatureHelp({ marker: "55", overloadsCount: 2 });
verify.quickInfoAt("55q", "constructor c1(a: number): c1 (+1 overload)");
verify.signatureHelp({ marker: "56", overloadsCount: 2 });
verify.quickInfoAt("56q", "constructor c1(b: string): c1 (+1 overload)");
verify.signatureHelp({ marker: "57", overloadsCount: 2, docComment: "c2 1" });
verify.quickInfoAt("57q", "constructor c2(a: number): c2 (+1 overload)", "c2 1");
verify.signatureHelp({ marker: "58", overloadsCount: 2 });
verify.quickInfoAt("58q", "constructor c2(b: string): c2 (+1 overload)", "c2 1");
verify.signatureHelp({ marker: "59", overloadsCount: 2 });
verify.quickInfoAt("59q", "constructor c3(a: number): c3 (+1 overload)");
verify.signatureHelp({ marker: "60", overloadsCount: 2, docComment: "c3 2" });
verify.quickInfoAt("60q", "constructor c3(b: string): c3 (+1 overload)", "c3 2");
verify.signatureHelp({ marker: "61", overloadsCount: 2, docComment: "c4 1" });
verify.quickInfoAt("61q", "constructor c4(a: number): c4 (+1 overload)", "c4 1");
verify.signatureHelp({ marker: "62", overloadsCount: 2, docComment: "c4 2" });
verify.quickInfoAt("62q", "constructor c4(b: string): c4 (+1 overload)", "c4 2");
verify.signatureHelp({ marker: "63", overloadsCount: 2, docComment: "c5 1" });
verify.quickInfoAt("63q", "constructor c5(a: number): c5 (+1 overload)", "c5 1");
verify.signatureHelp({ marker: "64", overloadsCount: 2, docComment: "c5 2" }); | {
"end_byte": 18024,
"start_byte": 11797,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/commentsOverloadsFourslash.ts"
} |
TypeScript/tests/cases/fourslash/commentsOverloadsFourslash.ts_18025_22001 | verify.quickInfoAt("64q", "constructor c5(b: string): c5 (+1 overload)", "c5 2");
verify.completions({
marker: "65",
includes: [
{ name: "c", text: "class c" },
{ name: "c1", text: "class c1" },
{ name: "c2", text: "class c2" },
{ name: "c3", text: "class c3" },
{ name: "c4", text: "class c4" },
{ name: "c5", text: "class c5" },
{ name: "c_i", text: "var c_i: c" },
{ name: "c1_i_1", text: "var c1_i_1: c1" },
{ name: "c2_i_1", text: "var c2_i_1: c2" },
{ name: "c3_i_1", text: "var c3_i_1: c3" },
{ name: "c4_i_1", text: "var c4_i_1: c4" },
{ name: "c5_i_1", text: "var c5_i_1: c5" },
{ name: "c1_i_2", text: "var c1_i_2: c1" },
{ name: "c2_i_2", text: "var c2_i_2: c2" },
{ name: "c3_i_2", text: "var c3_i_2: c3" },
{ name: "c4_i_2", text: "var c4_i_2: c4" },
{ name: "c5_i_2", text: "var c5_i_2: c5" },
{ name: "multiOverload", text: "function multiOverload(a: number): string (+2 overloads)", documentation: "This is multiOverload F1 1" },
{ name: "ambientF1", text: "function ambientF1(a: number): string (+2 overloads)", documentation: "This is ambient F1 1" },
],
});
verify.quickInfos({
66: "var c1_i_1: c1",
67: "var c2_i_2: c2",
68: "var c3_i_2: c3",
69: "var c4_i_1: c4",
70: "var c5_i_1: c5",
71: ["function multiOverload(a: number): string (+2 overloads)", "This is multiOverload F1 1"],
72: ["function multiOverload(b: string): string (+2 overloads)", "This is multiOverload F1 2"],
73: ["function multiOverload(c: boolean): string (+2 overloads)", "This is multiOverload F1 3"],
74: ["function ambientF1(a: number): string (+2 overloads)", "This is ambient F1 1"],
75: ["function ambientF1(b: string): string (+2 overloads)", "This is ambient F1 2"],
76: ["function ambientF1(c: boolean): boolean (+2 overloads)", "This is ambient F1 3"],
77: "(parameter) aa: i3",
78: "constructor c1(a: number): c1 (+1 overload)",
79: "constructor c1(b: string): c1 (+1 overload)",
80: "constructor c1(a: number): c1 (+1 overload)",
81: ["constructor c2(a: number): c2 (+1 overload)", "c2 1"],
82: ["constructor c2(b: string): c2 (+1 overload)", "c2 1"],
83: ["constructor c2(a: number): c2 (+1 overload)", "c2 1"],
84: "constructor c3(a: number): c3 (+1 overload)",
85: ["constructor c3(b: string): c3 (+1 overload)", "c3 2"],
86: "constructor c3(a: number): c3 (+1 overload)",
87: ["constructor c4(a: number): c4 (+1 overload)", "c4 1"],
88: ["constructor c4(b: string): c4 (+1 overload)", "c4 2"],
89: ["constructor c4(a: number): c4 (+1 overload)", "c4 1"],
90: ["constructor c5(a: number): c5 (+1 overload)", "c5 1"],
91: ["constructor c5(b: string): c5 (+1 overload)", "c5 2"],
92: ["constructor c5(a: number): c5 (+1 overload)", "c5 1"],
93: "(method) c.prop1(a: number): number (+1 overload)",
94: "(method) c.prop1(b: string): number (+1 overload)",
95: "(method) c.prop1(a: number): number (+1 overload)",
96: ["(method) c.prop2(a: number): number (+1 overload)", "prop2 1"],
97: ["(method) c.prop2(b: string): number (+1 overload)", "prop2 1"],
98: ["(method) c.prop2(a: number): number (+1 overload)", "prop2 1"],
99: "(method) c.prop3(a: number): number (+1 overload)",
100: ["(method) c.prop3(b: string): number (+1 overload)", "prop3 2"],
101: "(method) c.prop3(a: number): number (+1 overload)",
102: ["(method) c.prop4(a: number): number (+1 overload)", "prop4 1"],
103: ["(method) c.prop4(b: string): number (+1 overload)", "prop4 2"],
104: ["(method) c.prop4(a: number): number (+1 overload)", "prop4 1"],
105: ["(method) c.prop5(a: number): number (+1 overload)", "prop5 1"],
106: ["(method) c.prop5(b: string): number (+1 overload)", "prop5 2"],
107: ["(method) c.prop5(a: number): number (+1 overload)", "prop5 1"]
}); | {
"end_byte": 22001,
"start_byte": 18025,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/commentsOverloadsFourslash.ts"
} |
TypeScript/tests/cases/fourslash/unusedParameterInFunction1.ts_0_230 | /// <reference path='fourslash.ts' />
// @noUnusedParameters: true
////function [|greeter( x)|] {
////}
verify.codeFix({
description: "Remove unused declaration for: 'x'",
index: 0,
newRangeContent: "greeter()",
});
| {
"end_byte": 230,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedParameterInFunction1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceObjectLiteral.ts_0_451 | /// <reference path='fourslash.ts' />
//// interface IPerson {
//// coordinate: {
//// x: number;
//// y: number;
//// }
//// }
//// class Person implements IPerson { }
verify.codeFix({
description: "Implement interface 'IPerson'",
newFileContent:
`interface IPerson {
coordinate: {
x: number;
y: number;
}
}
class Person implements IPerson {
coordinate: { x: number; y: number; };
}`,
}); | {
"end_byte": 451,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceObjectLiteral.ts"
} |
TypeScript/tests/cases/fourslash/completionListInImportClause05.ts_0_550 | /// <reference path='fourslash.ts' />
// @Filename: app.ts
////import * as A from "/*1*/";
// @Filename: /node_modules/@types/a__b/index.d.ts
////declare module "@e/f" { function fun(): string; }
// @Filename: /node_modules/@types/c__d/index.d.ts
////export declare let x: number;
// NOTE: The node_modules folder is in "/", rather than ".", because it requires
// less scaffolding to mock. In particular, "/" is where we look for type roots.
verify.completions({ marker: "1", exact: ["@e/f", "@a/b", "@c/d"], isNewIdentifierLocation: true });
| {
"end_byte": 550,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInImportClause05.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_newFile.ts_0_305 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////[|interface ka {
//// name: string;
////}|]
verify.moveToFile({
newFileContents: {
"/a.ts":
``,
"/bar.ts":
`interface ka {
name: string;
}
`,
},
interactiveRefactorArguments: { targetFile: "/bar.ts" }
});
| {
"end_byte": 305,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_newFile.ts"
} |
TypeScript/tests/cases/fourslash/codeFixDeleteUnmatchedParameter_all.ts_0_801 | /// <reference path='fourslash.ts' />
// @filename: /a.ts
/////**
//// * @param {number} a
//// * @param {number} b
//// */
////function f1() {}
////
/////**
//// * @param {number} a
//// * @param {string} b
//// */
////function f2(a: number) {
//// a;
////}
////
/////**
//// * @param {number} a
//// * @param {string} b
//// * @param {number} c
//// */
////function f3(a: number, c: number) {
//// a;
//// c;
////}
goTo.file("/a.ts");
verify.codeFixAll({
fixId: "deleteUnmatchedParameter",
fixAllDescription: ts.Diagnostics.Delete_all_unused_param_tags.message,
newFileContent:
`/** */
function f1() {}
/**
* @param {number} a
*/
function f2(a: number) {
a;
}
/**
* @param {number} a
* @param {number} c
*/
function f3(a: number, c: number) {
a;
c;
}`,
});
| {
"end_byte": 801,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixDeleteUnmatchedParameter_all.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_interfaceNoUnion.ts_0_362 | /// <reference path='fourslash.ts' />
////interface IFoo {
//// method(x: string, y: string): void;
////}
////interface IBar {
//// method(x: number): void;
////}
////const x: IFoo | IBar = {
//// method(/*a*/x: string, y: string/*b*/): void {},
////};
goTo.select("a", "b");
verify.not.refactorAvailable("Convert parameters to destructured object");
| {
"end_byte": 362,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_interfaceNoUnion.ts"
} |
TypeScript/tests/cases/fourslash/doubleUnderscoreRenames.ts_0_310 | /// <reference path='fourslash.ts'/>
// @Filename: fileA.ts
//// [|export function [|{| "contextRangeIndex": 0 |}__foo|]() {
//// }|]
////
// @Filename: fileB.ts
//// [|import { [|{| "contextRangeIndex": 2 |}__foo|] as bar } from "./fileA";|]
////
//// bar();
verify.baselineRenameAtRangesWithText("__foo");
| {
"end_byte": 310,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/doubleUnderscoreRenames.ts"
} |
TypeScript/tests/cases/fourslash/jsDocTypeTagQuickInfo2.ts_3_709 | / <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: jsDocTypeTag2.js
//// /** @type {string} */
//// var /*1*/s;
//// /** @type {number} */
//// var /*2*/n;
//// /** @type {boolean} */
//// var /*3*/b;
//// /** @type {void} */
//// var /*4*/v;
//// /** @type {undefined} */
//// var /*5*/u;
//// /** @type {null} */
//// var /*6*/nl;
//// /** @type {array} */
//// var /*7*/a;
//// /** @type {promise} */
//// var /*8*/p;
//// /** @type {?number} */
//// var /*9*/nullable;
//// /** @type {function} */
//// var /*10*/func;
//// /** @type {function (number): number} */
//// var /*11*/func1;
//// /** @type {string | number} */
//// var /*12*/sOrn;
verify.baselineQuickInfo(); | {
"end_byte": 709,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocTypeTagQuickInfo2.ts"
} |
TypeScript/tests/cases/fourslash/unusedVariableInForLoop2FS.ts_0_273 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
//// function f1 () {
//// [|for(var i = 0, j= 0; ;i++)|] {
////
//// }
//// }
verify.codeFix({
description: "Remove unused declaration for: 'j'",
newRangeContent: "for(var i = 0; ;i++)",
});
| {
"end_byte": 273,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedVariableInForLoop2FS.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.