_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/fourslash/moveToNewFile_exportImport.ts_0_360 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////namespace N { export const x = 0; }
////[|import M = N;
////export import O = N;|]
////M;
verify.moveToNewFile({
newFileContents: {
"/a.ts":
`export namespace N { export const x = 0; }
import M = N;
M;`,
"/O.ts":
`import { N } from "./a";
export import O = N;
`,
},
});
| {
"end_byte": 360,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_exportImport.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarPrivateNameMethod.ts_0_1762 | /// <reference path="fourslash.ts"/>
//// class A {
//// #foo() {
//// class B {
//// #bar() {
//// function baz () {
//// }
//// }
//// }
//// }
//// }
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "A",
"kind": "class",
"childItems": [
{
"text": "#foo",
"kind": "method",
"childItems": [
{
"text": "B",
"kind": "class",
"childItems": [
{
"text": "#bar",
"kind": "method",
"childItems": [
{
"text": "baz",
"kind": "function"
}
]
}
]
}
]
}
]
},
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "A",
"kind": "class"
}
]
},
{
"text": "A",
"kind": "class",
"childItems": [
{
"text": "#foo",
"kind": "method"
}
],
"indent": 1
},
{
"text": "#foo",
"kind": "method",
"childItems": [
{
"text": "B",
"kind": "class"
}
],
"indent": 2
},
{
"text": "B",
"kind": "class",
"childItems": [
{
"text": "#bar",
"kind": "method"
}
],
"indent": 3
},
{
"text": "#bar",
"kind": "method",
"childItems": [
{
"text": "baz",
"kind": "function"
}
],
"indent": 4
},
{
"text": "baz",
"kind": "function",
"indent": 5
}
]);
| {
"end_byte": 1762,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarPrivateNameMethod.ts"
} |
TypeScript/tests/cases/fourslash/completionForStringLiteralNonrelativeImport9.ts_0_813 | /// <reference path='fourslash.ts' />
// Should give completions for modules referenced via baseUrl and paths compiler options with explicit name mappings
// @Filename: tsconfig.json
//// {
//// "compilerOptions": {
//// "baseUrl": "./modules",
//// "paths": {
//// "module1": ["some/path/whatever.ts"],
//// "module2": ["some/other/path.ts"]
//// }
//// }
//// }
// @Filename: tests/test0.ts
//// import * as foo1 from "m/*import_as0*/
//// import foo2 = require("m/*import_equals0*/
//// var foo3 = require("m/*require0*/
// @Filename: some/path/whatever.ts
//// export var x = 9;
// @Filename: some/other/path.ts
//// export var y = 10;
verify.completions({ marker: test.markers(), exact: ["module1", "module2"], isNewIdentifierLocation: true });
| {
"end_byte": 813,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteralNonrelativeImport9.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsClassExpression2.ts_0_225 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @Filename: /a.js
////exports./*0*/A = class {};
// @Filename: /b.js
////import { /*1*/A } from "./a";
/////*2*/A;
verify.baselineFindAllReferences('0', '1', '2')
| {
"end_byte": 225,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsClassExpression2.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarJsDoc.ts_0_926 | /// <reference path="fourslash.ts"/>
// @Filename: foo.js
/////** @typedef {(number|string)} NumberLike */
/////** @typedef {(string|number)} */
////const x = 0;
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "NumberLike",
"kind": "type"
},
{
"text": "x",
"kind": "const"
},
{
"text": "x",
"kind": "type"
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "NumberLike",
"kind": "type"
},
{
"text": "x",
"kind": "const"
},
{
"text": "x",
"kind": "type"
}
]
},
{
"text": "NumberLike",
"kind": "type",
"indent": 1,
},
{
"text": "x",
"kind": "type",
"indent": 1
}
]);
| {
"end_byte": 926,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarJsDoc.ts"
} |
TypeScript/tests/cases/fourslash/codeFixRemoveUnnecessaryAwait_notAvailableOnReturn.ts_0_161 | /// <reference path="fourslash.ts" />
// @target: esnext
////async function fn(): Promise<number> {
//// return 0;
////}
verify.getSuggestionDiagnostics([]);
| {
"end_byte": 161,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixRemoveUnnecessaryAwait_notAvailableOnReturn.ts"
} |
TypeScript/tests/cases/fourslash/codeFixSpelling5.ts_0_225 | /// <reference path='fourslash.ts' />
// @Filename: f1.ts
////export const fooooooooo = 1;
// @Filename: f2.ts
////import {[|fooooooooa|]} from "./f1"; fooooooooa;
goTo.file("f2.ts")
verify.rangeAfterCodeFix(`fooooooooo`); | {
"end_byte": 225,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixSpelling5.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageParameterLiteral.ts_0_289 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
//// function foo([|text |]) {
//// text.length;
//// text.indexOf("z");
//// text.charAt(0);
//// }
verify.rangeAfterCodeFix("text: string", /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, /*index*/0);
| {
"end_byte": 289,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageParameterLiteral.ts"
} |
TypeScript/tests/cases/fourslash/completionListInTypeParameterOfTypeAlias1.ts_0_305 | /// <reference path='fourslash.ts'/>
////type List1</*0*/
////type List2</*1*/T> = T[];
////type List4<T> = /*2*/T[];
////type List3<T1> = /*3*/;
verify.completions(
{ marker: ["0", "1"], exact: undefined },
{ marker: "2", includes: "T" },
{ marker: "3", includes: "T1", excludes: "T" },
);
| {
"end_byte": 305,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInTypeParameterOfTypeAlias1.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_expandSelectionRange14.ts_0_339 | /// <reference path='fourslash.ts' />
//@Filename: /bar.ts
////
// @Filename: /a.ts
////export [|default class {
//// run()|] {}
////}
verify.moveToFile({
newFileContents: {
"/a.ts":
``,
"/bar.ts":
`
export default class {
run() { }
}
`,
},
interactiveRefactorArguments: { targetFile: "/bar.ts" }
}); | {
"end_byte": 339,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_expandSelectionRange14.ts"
} |
TypeScript/tests/cases/fourslash/constEnumsEmitOutputInMultipleFiles.ts_0_413 | /// <reference path='fourslash.ts'/>
// @Filename: a.ts
// @newLine: lf
////const enum TestEnum {
//// Foo, Bar
////}
////var testFirstFile = TestEnum.Bar;
// @Filename: b.ts
/////// <reference path="a.ts" />
/////*1*/
////var testInOtherFile = TestEnum.Bar;
goTo.marker("1");
verify.verifyGetEmitOutputForCurrentFile(
"/// <reference path=\"a.ts\" />\n\
var testInOtherFile = 1 /* TestEnum.Bar */;\n"
) | {
"end_byte": 413,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/constEnumsEmitOutputInMultipleFiles.ts"
} |
TypeScript/tests/cases/fourslash/codeFixImplicitThis_ts_functionDeclarationInGlobalScope.ts_0_275 | /// <reference path='fourslash.ts' />
// @noImplicitThis: true
////function foo() {
//// let x: typeof /**/this;
////}
verify.codeFixAvailable([
{ description: "Infer 'this' type of 'foo' from usage" },
{ description: "Remove unused declaration for: 'x'" }
]);
| {
"end_byte": 275,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixImplicitThis_ts_functionDeclarationInGlobalScope.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsOfConstructor_withModifier.ts_0_156 | /// <reference path="fourslash.ts" />
////class X {
//// public /*0*/constructor() {}
////}
////var x = new X();
verify.baselineFindAllReferences('0')
| {
"end_byte": 156,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsOfConstructor_withModifier.ts"
} |
TypeScript/tests/cases/fourslash/codeFixGenerateDefinitions.ts_0_191 | /// <reference path='fourslash.ts' />
// @Filename: /node_modules/foo/index.d.ts
////module.exports = 0;
// @Filename: /a.ts
////import * as foo from "foo";
verify.not.codeFixAvailable();
| {
"end_byte": 191,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixGenerateDefinitions.ts"
} |
TypeScript/tests/cases/fourslash/codeFixImplicitThis_js_all.ts_0_602 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @noImplicitThis: true
// @Filename: /a.js
////class C {
//// q() {
//// function i() {
//// this;
//// }
//// }
//// m() {
//// function h() {
//// this;
//// }
//// }
////}
verify.codeFixAll({
fixId: "fixImplicitThis",
fixAllDescription: "Fix all implicit-'this' errors",
newFileContent:
`class C {
q() {
const i = () => {
this;
}
}
m() {
const h = () => {
this;
}
}
}`,
});
| {
"end_byte": 602,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixImplicitThis_js_all.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpWithTriggers01.ts_0_683 | /// <reference path="fourslash.ts" />
////declare function foo<T>(x: T, y: T): T;
////
////foo/*1*//*2*/;
////foo(/*3*/100/*4*/);
////foo/*5*//*6*/();
const charMap = {
1: "(",
2: "<",
3: ",",
4: ",",
5: "(",
6: "<",
}
for (const markerName of Object.keys(charMap)) {
const triggerCharacter = charMap[markerName];
goTo.marker(markerName);
edit.insert(triggerCharacter);
verify.signatureHelpPresentForTriggerReason({
kind: "characterTyped",
triggerCharacter,
});
verify.signatureHelpPresentForTriggerReason({
kind: "retrigger",
triggerCharacter,
});
edit.backspace(triggerCharacter.length);
}
| {
"end_byte": 683,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpWithTriggers01.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_EmptySpanVarKeyword.ts_0_624 | /// <reference path='fourslash.ts' />
////let a = { b: { c: 0 } };
////let/*a*//*b*/ x = a.b ? a.b.c : "whenFalse";
// verify that the refactor is offered for empty spans in variable statements.
goTo.select("a", "b");
verify.not.refactorAvailableForTriggerReason("implicit", "Convert to optional chain expression");
edit.applyRefactor({
refactorName: "Convert to optional chain expression",
actionName: "Convert to optional chain expression",
actionDescription: "Convert to optional chain expression",
newContent:
`let a = { b: { c: 0 } };
let x = a.b?.c ?? "whenFalse";`,
triggerReason: "invoked"
}); | {
"end_byte": 624,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_EmptySpanVarKeyword.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUndeclaredAcrossFiles2.ts_0_795 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @Filename: f2.ts
//// import * as X from "./f1";
//// X.C.m0(1, "", []);
//// X.C.x;
//// let c = new X.C;
//// c.m1();
//// c.y = {};
// @Filename: f1.js
//// [|export class C {
//// constructor() { }
//// }
////
//// |]
verify.getAndApplyCodeFix(/*errorCode*/undefined, 0);
verify.getAndApplyCodeFix(/*errorCode*/undefined, 0);
verify.getAndApplyCodeFix(/*errorCode*/undefined, 0);
verify.getAndApplyCodeFix(/*errorCode*/undefined, 0);
verify.rangeIs(`
export class C {
m1() {
throw new Error("Method not implemented.");
}
static m0(arg0, arg1, arg2) {
throw new Error("Method not implemented.");
}
constructor() {
this.y = undefined;
}
}
C.x = undefined;
`); | {
"end_byte": 795,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUndeclaredAcrossFiles2.ts"
} |
TypeScript/tests/cases/fourslash/renameBindingElementInitializerProperty.ts_0_474 | /// <reference path="fourslash.ts"/>
////function f([|{[|{| "contextRangeIndex": 0 |}required|], optional = [|required|]}: {[|[|{| "contextRangeIndex": 3 |}required|]: number,|] optional?: number}|]) {
//// console.log("required", [|required|]);
//// console.log("optional", optional);
////}
////
////f({[|[|{| "contextRangeIndex": 6 |}required|]: 10|]});
const [r0Def, r0, r1, r2Def, r2, r3, r4Def, r4] = test.ranges();
verify.baselineRename([r0, r1, r3, r2, r4]);
| {
"end_byte": 474,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameBindingElementInitializerProperty.ts"
} |
TypeScript/tests/cases/fourslash/allowLateBoundSymbolsOverwriteEarlyBoundSymbols.ts_0_246 | /// <reference path="fourslash.ts"/>
//// export {};
//// const prop = "abc";
//// function foo(): void {};
//// foo.abc = 10;
//// foo[prop] = 10;
//// interface T0 {
//// [prop]: number;
//// abc: number;
//// }
verify.noErrors();
| {
"end_byte": 246,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/allowLateBoundSymbolsOverwriteEarlyBoundSymbols.ts"
} |
TypeScript/tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts_0_1551 | /// <reference path='fourslash.ts' />
// @noImplicitOverride: true
//// class B {
//// foo (v: string) {}
//// fooo (v: string) {}
//// }
//// class D extends B {
//// override foo (v: string) {}
//// fooo (v: string) {}
//// override bar(v: string) {}
//// }
//// class C {
//// override foo(v: string) {}
//// }
//// function f () {
//// return class extends B {
//// override foo (v: string) {}
//// fooo (v: string) {}
//// override bar(v: string) {}
//// }
//// }
//// class E extends (class {
//// foo () { }
//// bar () { }
//// }) {
//// override foo () { }
//// bar () { }
//// baz() {}
//// override bazz () {}
//// }
//// function ff () {
//// return class {
//// override foo () {}
//// }
//// }
verify.codeFixAll({
fixId: "fixAddOverrideModifier",
fixAllDescription: "Add all missing 'override' modifiers",
newFileContent: `class B {
foo (v: string) {}
fooo (v: string) {}
}
class D extends B {
override foo (v: string) {}
override fooo (v: string) {}
override bar(v: string) {}
}
class C {
override foo(v: string) {}
}
function f () {
return class extends B {
override foo (v: string) {}
override fooo (v: string) {}
override bar(v: string) {}
}
}
class E extends (class {
foo () { }
bar () { }
}) {
override foo () { }
override bar () { }
baz() {}
override bazz () {}
}
function ff () {
return class {
override foo () {}
}
}`
})
| {
"end_byte": 1551,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts_0_253 | /// <reference path='fourslash.ts'/>
////interface Recursive {
//// /*1*/next?: Recursive;
//// value: any;
////}
////
////function f (/*2*/{ /*3*/next: { /*4*/next: x} }: Recursive) {
////}
verify.baselineFindAllReferences('1', '2', '3', '4');
| {
"end_byte": 253,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts"
} |
TypeScript/tests/cases/fourslash/codeFixOverrideModifier15.ts_0_464 | /// <reference path='fourslash.ts' />
// @experimentalDecorators: true
// @noImplicitOverride: true
////function decorator() {
//// return (target: any, key: any, descriptor: PropertyDescriptor) => descriptor;
////}
////class A {
//// foo() {}
////}
////class B extends A {
//// @decorator()
//// [|public foo() {}|]
////}
verify.codeFix({
description: "Add 'override' modifier",
newRangeContent: "public override foo() {}",
index: 0
})
| {
"end_byte": 464,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixOverrideModifier15.ts"
} |
TypeScript/tests/cases/fourslash/completionListInClosedObjectTypeLiteralInSignature01.ts_0_361 | /// <reference path="fourslash.ts" />
////interface I<TString, TNumber> {
//// [s: string]: TString;
//// [s: number]: TNumber;
////}
////
////declare function foo<TString, TNumber>(obj: I<TString, TNumber>): { str: T/*1*/ }
verify.completions({
marker: "1",
includes: ["I", "TString", "TNumber"],
excludes: ["foo", "obj"], // not types
});
| {
"end_byte": 361,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInClosedObjectTypeLiteralInSignature01.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToEsModule_export_namedClassExpression.ts_0_395 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @target: esnext
// @Filename: /a.js
////exports.C = class E { static instance = new E(); }
////exports.D = class D { static instance = new D(); }
verify.codeFix({
description: "Convert to ES module",
newFileContent:
`export const C = class E { static instance = new E(); }
export class D { static instance = new D(); }`,
});
| {
"end_byte": 395,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToEsModule_export_namedClassExpression.ts"
} |
TypeScript/tests/cases/fourslash/inlayHintsVariableTypes2.ts_0_428 | /// <reference path="fourslash.ts" />
//// const object = { foo: 1, bar: 2 }
//// const array = [1, 2]
//// const a = object;
//// const { foo, bar } = object;
//// const {} = object;
//// const b = array;
//// const [ first, second ] = array;
//// const [] = array;
//// declare function foo<T extends number>(t: T): T
//// const x = foo(1)
verify.baselineInlayHints(undefined, {
includeInlayVariableTypeHints: true
});
| {
"end_byte": 428,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlayHintsVariableTypes2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration_all.ts_0_1089 | /// <reference path='fourslash.ts' />
// @filename: /test1.ts
////export const x = 1;
// @filename: /test2.ts
////import * as test from "./test1";
////
////namespace Foo {
//// export const x = 0;
////}
////
////interface I {
//// a: (e: any) => void;
////}
////
////test.f();
////Foo.f();
////f();
////const t1: I = { a: fn }
goTo.file("/test2.ts");
verify.codeFixAll({
fixId: "fixMissingFunctionDeclaration",
fixAllDescription: ts.Diagnostics.Add_all_missing_function_declarations.message,
newFileContent: {
"/test1.ts":
`export const x = 1;
export function f() {
throw new Error("Function not implemented.");
}
`,
"/test2.ts":
`import * as test from "./test1";
namespace Foo {
export const x = 0;
export function f() {
throw new Error("Function not implemented.");
}
}
interface I {
a: (e: any) => void;
}
test.f();
Foo.f();
f();
const t1: I = { a: fn }
function f() {
throw new Error("Function not implemented.");
}
function fn(e: any): void {
throw new Error("Function not implemented.");
}
`
}
});
| {
"end_byte": 1089,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration_all.ts"
} |
TypeScript/tests/cases/fourslash/protoVarVisibleWithOuterScopeUnderscoreProto.ts_0_349 | /// <reference path='fourslash.ts' />
////// outer
////var ___proto__ = 10;
////function foo() {
//// var __proto__ = "hello";
//// /**/
////}
verify.completions({
marker: "",
includes: [
{ name: "__proto__", text: "(local var) __proto__: string" },
{ name: "___proto__", text: "var ___proto__: number" },
],
});
| {
"end_byte": 349,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/protoVarVisibleWithOuterScopeUnderscoreProto.ts"
} |
TypeScript/tests/cases/fourslash/completionInsideFunctionContainsArguments.ts_0_375 | /// <reference path='fourslash.ts'/>
////function testArguments() {/*1*/}
/////*2*/
////function testNestedArguments() {
//// function nestedfunction(){/*3*/}
////}
////function f() {
//// let g = () => /*4*/
////}
////let g = () => /*5*/
verify.completions(
{ marker: ["1", "3", "4"], includes: "arguments" },
{ marker: ["2", "5"], excludes: "arguments" },
);
| {
"end_byte": 375,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionInsideFunctionContainsArguments.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_Single_Return.ts_0_360 | /// <reference path='fourslash.ts' />
//// const foo = /*x*/f/*y*/unction() {
//// return 42;
//// };
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert arrow function or function expression",
actionName: "Convert to arrow function",
actionDescription: "Convert to arrow function",
newContent: `const foo = () => 42;`,
});
| {
"end_byte": 360,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_Single_Return.ts"
} |
TypeScript/tests/cases/fourslash/importTypeCompletions8.ts_0_635 | /// <reference path="fourslash.ts" />
// @target: esnext
// @filename: /foo.ts
////export interface Foo {}
// @filename: /bar.ts
////[|import { type F/**/ }|]
goTo.file("/bar.ts")
verify.completions({
marker: "",
exact: [{
name: "Foo",
sourceDisplay: "./foo",
source: "./foo",
insertText: "import { type Foo } from \"./foo\";",
replacementSpan: test.ranges()[0]
}],
isNewIdentifierLocation: true,
preferences: {
includeCompletionsForModuleExports: true,
includeCompletionsForImportStatements: true,
includeCompletionsWithInsertText: true
}
});
| {
"end_byte": 635,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importTypeCompletions8.ts"
} |
TypeScript/tests/cases/fourslash/codeFixImportNonExportedMember8.ts_0_413 | /// <reference path="fourslash.ts" />
// @module: esnext
// @filename: /a.ts
////const a = 1;
////type T = number;
////export { a };
// @filename: /b.ts
////import { T } from "./a";
goTo.file("/b.ts");
verify.codeFix({
description: [ts.Diagnostics.Export_0_from_module_1.message, "T", "./a"],
index: 0,
newFileContent: {
"/a.ts":
`const a = 1;
type T = number;
export { a, T };`,
}
});
| {
"end_byte": 413,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixImportNonExportedMember8.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixUMDGlobalReact2.ts_0_440 | /// <reference path="fourslash.ts" />
// https://github.com/Microsoft/TypeScript/issues/16065
// @jsx: react
// @jsxFactory: factory
// @Filename: /factory.ts
////export function factory() { return {}; }
////declare global {
//// namespace JSX {
//// interface Element {}
//// }
////}
// @Filename: /a.tsx
////[|<div/>|]
goTo.file("/a.tsx");
verify.importFixAtPosition([
`import { factory } from "./factory";
<div/>`
]);
| {
"end_byte": 440,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixUMDGlobalReact2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassExtendAbstractProperty.ts_0_477 | /// <reference path='fourslash.ts' />
// @noImplicitOverride: true
////abstract class A {
//// abstract x: number;
//// abstract y: this;
//// abstract z: A;
////}
////
////class C extends A {}
verify.codeFix({
description: "Implement inherited abstract class",
newFileContent:
`abstract class A {
abstract x: number;
abstract y: this;
abstract z: A;
}
class C extends A {
override x: number;
override y: this;
override z: A;
}`
});
| {
"end_byte": 477,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassExtendAbstractProperty.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentTemplateLiterals.ts_0_715 | /// <reference path="fourslash.ts"/>
////var x0 = `sadasdasdasdas/*1*/fegsfdrasdesgeryt35t35y35 e4 ergt er 35t 3535 `;
////var x1 = `sadasdasdasdas/*2*/fegsfdr${0}asdesgeryt35t35y35 e4 ergt er 35t 3535 `;
////var x2 = `sadasdasdasdasfegsfdra${0}sdesge/*3*/ryt35t35y35 e4 ergt er 35t 3535 `;
////var x3 = `sadasdasdasdasfegsfdra${0}sdesge/*4*/ryt35${1}t35y35 e4 ergt er 35t 3535 `;
////var x2 = `sadasdasdasdasfegsfdra${0}sdesge${1}sf/*5*/ryt35t35y35 e4 ergt er 35t 3535 `;
function verifyIndentation(marker: string): void {
goTo.marker(marker);
edit.insert("\n");
verify.indentationIs(0);
}
verifyIndentation("1");
verifyIndentation("2");
verifyIndentation("3");
verifyIndentation("4");
verifyIndentation("5");
| {
"end_byte": 715,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentTemplateLiterals.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationInterface_10.ts_0_323 | /// <reference path='fourslash.ts'/>
// @Filename: /a.ts
////interface /*def*/A {
//// foo: boolean;
////}
////interface [|B|] extends A {
//// bar: boolean;
////}
////export class [|C|] implements B {
//// foo = true;
//// bar = true;
////}
////export class [|D|] extends C { }
verify.baselineGoToImplementation("def");
| {
"end_byte": 323,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationInterface_10.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportFileAllComments.ts_0_762 | /// <reference path="fourslash.ts" />
//// [|/*!
//// * This is a license or something
//// */
//// /// <reference types="node" />
//// /// <reference path="./a.ts" />
//// /// <amd-dependency path="./b.ts" />
//// /**
//// * This is a comment intended to be attached to this interface
//// */
//// export interface SomeInterface {
//// }
//// f1/*0*/();|]
// @Filename: module.ts
//// export function f1() {}
//// export var v1 = 5;
verify.importFixAtPosition([
`/*!
* This is a license or something
*/
/// <reference types="node" />
/// <reference path="./a.ts" />
/// <amd-dependency path="./b.ts" />
import { f1 } from "./module";
/**
* This is a comment intended to be attached to this interface
*/
export interface SomeInterface {
}
f1();`
]); | {
"end_byte": 762,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportFileAllComments.ts"
} |
TypeScript/tests/cases/fourslash/formatRemoveSemicolons3.ts_0_670 | /// <reference path="fourslash.ts" />
////(<InterfaceTypeWithDeclaredMembers>type).declaredProperties = getNamedMembers(members);
////// Start with signatures at empty array in case of recursive types
////(<InterfaceTypeWithDeclaredMembers>type).declaredCallSignatures = emptyArray;
format.setFormatOptions({ ...format.copyFormatOptions(), semicolons: ts.SemicolonPreference.Remove });
format.document();
verify.currentFileContentIs(`(<InterfaceTypeWithDeclaredMembers>type).declaredProperties = getNamedMembers(members);
// Start with signatures at empty array in case of recursive types
(<InterfaceTypeWithDeclaredMembers>type).declaredCallSignatures = emptyArray`); | {
"end_byte": 670,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatRemoveSemicolons3.ts"
} |
TypeScript/tests/cases/fourslash/defaultParamsAndContextualTypes.ts_0_450 | /// <reference path="fourslash.ts"/>
////interface FooOptions {
//// text?: string;
////}
////interface Foo {
//// bar(xy: string, options?: FooOptions): void;
////}
////var o: Foo = {
//// bar: function (x/*1*/y, opt/*2*/ions = {}) {
//// // expect xy to have type string, and options to have type FooOptions in here
//// }
////}
verify.quickInfos({
1: "(parameter) xy: string",
2: "(parameter) options: FooOptions"
});
| {
"end_byte": 450,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/defaultParamsAndContextualTypes.ts"
} |
TypeScript/tests/cases/fourslash/smartSelection_function2.ts_0_112 | /// <reference path="fourslash.ts" />
////function f2() {
//// /**/
////}
verify.baselineSmartSelection();
| {
"end_byte": 112,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartSelection_function2.ts"
} |
TypeScript/tests/cases/fourslash/jsxTagNameCompletionUnderElementUnclosed.ts_0_1028 | /// <reference path="fourslash.ts" />
//@Filename: file.tsx
////declare namespace JSX {
//// interface IntrinsicElements {
//// button: any;
//// div: any;
//// }
////}
////function fn() {
//// return <>
//// <butto/*1*/
//// </>;
////}
////function fn2() {
//// return <>
//// preceding junk <butto/*2*/
//// </>;
////}
////function fn3() {
//// return <>
//// <butto/*3*/ style=""
//// </>;
////}
var preferences: FourSlashInterface.UserPreferences = {
jsxAttributeCompletionStyle: "braces",
includeCompletionsWithSnippetText: true,
includeCompletionsWithInsertText: true,
};
verify.completions(
{ marker: "1", preferences, includes: { name: "button", text: "(property) JSX.IntrinsicElements.button: any" } },
{ marker: "2", preferences, includes: { name: "button", text: "(property) JSX.IntrinsicElements.button: any" } },
{ marker: "3", preferences, includes: { name: "button", text: "(property) JSX.IntrinsicElements.button: any" } },
)
| {
"end_byte": 1028,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsxTagNameCompletionUnderElementUnclosed.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsThisKeyword.ts_0_651 | /// <reference path='fourslash.ts' />
// @noLib: true
/////*1*/this;
////function f(/*2*/this) {
//// return /*3*/this;
//// function g(/*4*/this) { return /*5*/this; }
////}
////class C {
//// static x() {
//// /*6*/this;
//// }
//// static y() {
//// () => /*7*/this;
//// }
//// constructor() {
//// /*8*/this;
//// }
//// method() {
//// () => /*9*/this;
//// }
////}
////// These are *not* real uses of the 'this' keyword, they are identifiers.
////const x = { /*10*/this: 0 }
////x./*11*/this;
verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11');
| {
"end_byte": 651,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsThisKeyword.ts"
} |
TypeScript/tests/cases/fourslash/completionListInTypedObjectLiterals2.ts_0_177 | /// <reference path="fourslash.ts" />
////interface Foo {
//// x: { a: number };
////}
////var aaa: Foo;
////aaa = { /*9*/
verify.completions({ marker: "9", exact: "x" });
| {
"end_byte": 177,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInTypedObjectLiterals2.ts"
} |
TypeScript/tests/cases/fourslash/completionListPrivateNamesAccessors.ts_0_983 | /// <reference path="fourslash.ts"/>
//// class Foo {
//// get #x() { return 1 };
//// set #x(value: number) { };
//// y() {};
//// }
//// class Bar extends Foo {
//// get #z() { return 1 };
//// set #z(value: number) { };
//// t() {};
//// l;
//// constructor() {
//// this./*1*/
//// class Baz {
//// get #z() { return 1 };
//// set #z(value: number) { };
//// get #u() { return 1 };
//// set #u(value: number) { };
//// v() {};
//// k;
//// constructor() {
//// this./*2*/
//// new Bar()./*3*/
//// }
//// }
//// }
//// }
////
//// new Foo()./*4*/
verify.completions({ marker: "1", unsorted: ["#z", "t", "l", "y"] });
verify.completions({ marker: "2", unsorted: ["#z", "#u", "v", "k"] });
verify.completions({ marker: "3", unsorted: ["#z", "t", "l", "y"] });
verify.completions({ marker: "4", exact: ["y"] });
| {
"end_byte": 983,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListPrivateNamesAccessors.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingEnumMember1.ts_0_197 | /// <reference path='fourslash.ts' />
////enum E {
//// a
////}
////E.b
verify.codeFix({
description: "Add missing enum member 'b'",
newFileContent: `enum E {
a,
b
}
E.b`
});
| {
"end_byte": 197,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingEnumMember1.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_SubexpressionWithPrefix1.ts_0_504 | /// <reference path='fourslash.ts' />
////let a = { b: { c: 0 } };
////let foo;
////let bar;
////foo && bar && /*a*/a && a.b && a.b.c;/*b*/
// verify that we stop at an invalid prefix sequence.
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: { c: 0 } };
let foo;
let bar;
foo && bar && a?.b?.c;`
}); | {
"end_byte": 504,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_SubexpressionWithPrefix1.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_require_addToExisting.ts_0_702 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: /a.js
////const x = 0;
////function f() {}
////module.exports = { x, f };
// @Filename: /b.js
////const { f } = require("./a");
////
////x/**/
verify.completions({
marker: "",
includes: {
name: "x",
source: "/a",
sourceDisplay: "./a",
text: "(alias) const x: 0\nimport x",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
preferences: { includeCompletionsForModuleExports: true },
});
verify.applyCodeActionFromCompletion("", {
name: "x",
source: "/a",
description: `Update import from "./a"`,
newFileContent: `const { f, x } = require("./a");
x`,
});
| {
"end_byte": 702,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_require_addToExisting.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpOnDeclaration.ts_0_94 | /// <reference path='fourslash.ts' />
////function f</**/
////x
verify.noSignatureHelp("");
| {
"end_byte": 94,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpOnDeclaration.ts"
} |
TypeScript/tests/cases/fourslash/formattingConditionals.ts_0_852 | /// <reference path='fourslash.ts' />
////var v =
/////*0*/a === b
/////*1*/? c
/////*2*/: d;
////var v = a === b
/////*3*/? c
/////*4*/: d;
////var x =
/////*5*/a
/////*6*/? function(){
/////*7*/var z = 1
/////*8*/}
/////*9*/: function(){
/////*10*/var z = 2
/////*11*/}
function verifyLine(marker: string, content: string) {
goTo.marker(marker);
verify.currentLineContentIs(content);
}
format.document();
verifyLine("0", " a === b");
verifyLine("1", " ? c");
verifyLine("2", " : d;");
verifyLine("3", " ? c");
verifyLine("4", " : d;");
verifyLine("5", " a");
verifyLine("6", " ? function() {");
verifyLine("7", " var z = 1");
verifyLine("8", " }");
verifyLine("9", " : function() {");
verifyLine("10", " var z = 2");
verifyLine("11", " }");
| {
"end_byte": 852,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingConditionals.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_exportEqualsNamespace_noDuplicate.ts_0_609 | /// <reference path='fourslash.ts'/>
// @Filename: /node_modules/a/index.d.ts
////declare namespace core {
//// const foo: number;
////}
////declare module "a" {
//// export = core;
////}
////declare module "a/alias" {
//// export = core;
////}
// @Filename: /user.ts
////import * as a from "a";
/////**/foo;
verify.completions({
marker: "",
// Tester will assert that it is only included once
includes: [{ name: "foo", source: "a", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }],
preferences: {
includeCompletionsForModuleExports: true,
}
});
| {
"end_byte": 609,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_exportEqualsNamespace_noDuplicate.ts"
} |
TypeScript/tests/cases/fourslash/codeFixOverrideModifier21.ts_0_344 | /// <reference path='fourslash.ts' />
// @noImplicitOverride: true
//// class B { }
//// class D extends B {
//// c = 10;
//// constructor([|public override a: string|]) {
//// super();
//// }
//// }
verify.codeFix({
description: "Remove 'override' modifier",
newRangeContent: "public a: string",
index: 0
})
| {
"end_byte": 344,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixOverrideModifier21.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports11.ts_0_635 | /// <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 Point3D extends mixin(Point2D) { z = 0; }
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 Point3DBase: typeof Point2D = mixin(Point2D);
export class Point3D extends Point3DBase { z = 0; }`
});
| {
"end_byte": 635,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports11.ts"
} |
TypeScript/tests/cases/fourslash/javaScriptModules19.ts_0_696 | ///<reference path="fourslash.ts" />
// Assignments to 'module.exports' create an external module
// @allowJs: true
// @Filename: myMod.js
//// var x = { a: 10 };
//// module.exports = x;
// @Filename: isGlobal.js
//// var y = 10;
// @Filename: consumer.js
//// var x = require('./myMod');
//// /**/;
goTo.file('consumer.js');
goTo.marker();
verify.completions({
marker: "",
includes: { name: "y", sortText: completion.SortText.GlobalsOrKeywords },
excludes: "invisible"
});
edit.insert('x.');
verify.completions({ includes: { name: "a", kind: "property" } });
edit.insert('a.');
verify.completions({ includes: { name: "toFixed", kind: "method", kindModifiers: "declare" } });
| {
"end_byte": 696,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/javaScriptModules19.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationNamespace_01.ts_0_250 | /// <reference path='fourslash.ts'/>
// Should handle property access expressions on namespaces
//// namespace Foo {
//// export function [|hello|]() {}
//// }
////
//// Foo.hell/*reference*/o();
verify.baselineGoToImplementation("reference"); | {
"end_byte": 250,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationNamespace_01.ts"
} |
TypeScript/tests/cases/fourslash/completionForStringLiteral8.ts_0_191 | /// <reference path='fourslash.ts'/>
////type As = 'arf' | 'abacus' | 'abaddon';
////let a: As;
////if (a === '/**/
verify.completions({ marker: "", exact: ["arf", "abacus", "abaddon"] });
| {
"end_byte": 191,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteral8.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_arrowFunctionWithSingleParameter.ts_0_416 | /// <reference path='fourslash.ts' />
////const foo = /*a*/(a: number)/*b*/ => { };
////foo(1);
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert parameters to destructured object",
actionName: "Convert parameters to destructured object",
actionDescription: "Convert parameters to destructured object",
newContent: `const foo = ({ a }: { a: number; }) => { };
foo({ a: 1 });`,
});
| {
"end_byte": 416,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_arrowFunctionWithSingleParameter.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties30.ts_0_331 | /// <reference path="fourslash.ts" />
////interface A {
//// a: number;
//// b: string;
////}
////function f(_obj: A[]): string {
//// return "";
////}
////[|f([{}])|]
verify.codeFix({
index: 0,
description: ts.Diagnostics.Add_missing_properties.message,
newRangeContent:
`f([{
a: 0,
b: ""
}])`,
});
| {
"end_byte": 331,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties30.ts"
} |
TypeScript/tests/cases/fourslash/autoCloseFragment.ts_0_1016 | /// <reference path='fourslash.ts' />
// Using separate files for each example to avoid unclosed JSX tags affecting other tests.
// @Filename: /0.tsx
////const x = <>/*0*/;
// @Filename: /1.tsx
////const x = <> foo/*1*/ </>;
// @Filename: /2.tsx
////const x = <></>/*2*/;
// @Filename: /3.tsx
////const x = </>/*3*/;
// @Filename: /4.tsx
////const x = <div>
//// <>/*4*/
//// </div>
////</>;
// @Filename: /5.tsx
////const x = <> text /*5*/;
// @Filename: /6.tsx
////const x = <>
//// <>/*6*/
////</>;
// @Filename: /7.tsx
////const x = <div>
//// <>/*7*/
////</div>;
// @Filename: /8.tsx
////const x = <div>
//// <>/*8*/</>
////</div>;
// @Filename: /9.tsx
////const x = <p>
//// <>
//// <>/*9*/
//// </>
////</p>
verify.jsxClosingTag({
0: { newText: "</>" },
1: undefined,
2: undefined,
3: undefined,
4: { newText: "</>" },
5: { newText: "</>" },
6: { newText: "</>" },
7: { newText: "</>" },
8: undefined,
9: { newText: "</>" },
});
| {
"end_byte": 1016,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoCloseFragment.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoOnProtectedConstructorCall.ts_0_148 | /// <reference path='fourslash.ts' />
////class A {
//// protected constructor() {}
////}
////var x = new A(/*1*/
verify.noSignatureHelp("1");
| {
"end_byte": 148,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnProtectedConstructorCall.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_MapArgument.ts_0_393 | /// <reference path='fourslash.ts' />
//// [4,5,6,7].map(function /*x*/is/*y*/Even(n) {
//// return n % 2 === 0;
//// });
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert arrow function or function expression",
actionName: "Convert to arrow function",
actionDescription: "Convert to arrow function",
newContent: `[4,5,6,7].map((n) => n % 2 === 0);`,
});
| {
"end_byte": 393,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_MapArgument.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingMember19_declarePrivateMethod.ts_0_671 | /// <reference path='fourslash.ts' />
////class A {
//// foo() {
//// this._bar();
//// }
////}
verify.codeFixAvailable([
{ description: "Declare private method '_bar'" },
{ description: "Declare method '_bar'" },
{ description: "Declare private property '_bar'" },
{ description: "Declare property '_bar'" },
{ description: "Add index signature for property '_bar'" }
])
verify.codeFix({
description: [ts.Diagnostics.Declare_private_method_0.message, "_bar"],
index: 0,
newFileContent:
`class A {
foo() {
this._bar();
}
private _bar() {
throw new Error("Method not implemented.");
}
}`
});
| {
"end_byte": 671,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingMember19_declarePrivateMethod.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInitializePrivatePropertyJS.ts_0_671 | /// <reference path='fourslash.ts' />
// @allowjs: true
// @checkJs: true
// @Filename: /a.js
////class Foo {
//// constructor(name) {
//// this.[|#name|] = name;
//// }
////}
verify.codeFixAvailable([
{ description: "Declare a private field named '#name'." },
{ description: "Ignore this error message" },
{ description: "Disable checking for this file" },
{ description: "Infer parameter types from usage" },
]);
verify.codeFix({
index: 0,
description: [ts.Diagnostics.Declare_a_private_field_named_0.message, '#name'],
newFileContent: `class Foo {
#name;
constructor(name) {
this.#name = name;
}
}`
});
| {
"end_byte": 671,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInitializePrivatePropertyJS.ts"
} |
TypeScript/tests/cases/fourslash/codeFixChangeJSDocSyntax2.ts_0_152 | /// <reference path='fourslash.ts' />
//// var x: [|*|] = 12;
verify.codeFix({
description: "Change '*' to 'any'",
newRangeContent: "any",
});
| {
"end_byte": 152,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixChangeJSDocSyntax2.ts"
} |
TypeScript/tests/cases/fourslash/extract-const-callback-function-this1.ts_0_603 | /// <reference path='fourslash.ts' />
////declare function fWithThis(fn: (this: { a: string }, a: string) => string): void;
////fWithThis(/*a*/function (a: string): string { return this.a; }/*b*/);
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "constant_scope_0",
actionDescription: "Extract to constant in enclosing scope",
newContent:
`declare function fWithThis(fn: (this: { a: string }, a: string) => string): void;
const newLocal = function(this: { a: string; }, a: string): string { return this.a; };
fWithThis(/*RENAME*/newLocal);`
});
| {
"end_byte": 603,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const-callback-function-this1.ts"
} |
TypeScript/tests/cases/fourslash/fixExactOptionalUnassignableProperties8.ts_0_707 | /// <reference path='fourslash.ts'/>
// @strictNullChecks: true
// @exactOptionalPropertyTypes: true
// @Filename: fixExactOptionalUnassignableProperties6.ts
// based on snapshotterInjected.ts in microsoft/playwright
//// type Data = {
//// x?: {
//// y?: number
//// }
//// }
//// declare var d: Data
//// d.x = { y: undefined }
verify.codeFixAvailable([
{ description: ts.Diagnostics.Add_undefined_to_optional_property_type.message }
]);
verify.codeFix({
description: ts.Diagnostics.Add_undefined_to_optional_property_type.message,
index: 0,
newFileContent:
`type Data = {
x?: {
y?: number | undefined
}
}
declare var d: Data
d.x = { y: undefined }`,
});
| {
"end_byte": 707,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/fixExactOptionalUnassignableProperties8.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts_0_150 | /// <reference path='fourslash.ts' />
/////*1*/type /*2*/Alias= number;
////let n: /*3*/Alias = 12;
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 150,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddParameterNames4.ts_0_266 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
////function fn(f: (...number[]) => unknown) {}
verify.codeFix({
description: ts.Diagnostics.Add_parameter_name.message,
newFileContent: `function fn(f: (...arg0: number[]) => unknown) {}`,
});
| {
"end_byte": 266,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddParameterNames4.ts"
} |
TypeScript/tests/cases/fourslash/insertArgumentBeforeOverloadedConstructor.ts_0_197 | /// <reference path="fourslash.ts" />
//// alert(/**/100);
////
//// class OverloadedMonster {
//// constructor();
//// constructor(name) { }
//// }
goTo.marker();
edit.insert("'1', ");
| {
"end_byte": 197,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/insertArgumentBeforeOverloadedConstructor.ts"
} |
TypeScript/tests/cases/fourslash/tsxCompletionNonTagLessThan.ts_0_474 | /// <reference path='fourslash.ts'/>
// @Filename: /a.tsx
////var x: Array<numb/*a*/;
////[].map<numb/*b*/;
////1 < Infini/*c*/;
verify.completions(
{
marker: ["a", "b"],
includes: {
name: "number",
sortText: completion.SortText.GlobalsOrKeywords
},
excludes: "SVGNumber"
},
{
marker: "c",
includes: {
name: "Infinity",
sortText: completion.SortText.GlobalsOrKeywords
}
},
);
| {
"end_byte": 474,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxCompletionNonTagLessThan.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageCallBodyBoth.ts_0_323 | /// <reference path='fourslash.ts' />
////class C {
//// p = 2
////}
////var c = new C()
////function f([|x, y |]) {
//// if (y) {
//// x = 1
//// }
//// return x
////}
////f(new C())
verify.rangeAfterCodeFix("x: number | C, y: undefined",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 1);
| {
"end_byte": 323,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageCallBodyBoth.ts"
} |
TypeScript/tests/cases/fourslash/convertFunctionToEs6ClassNoSemicolon.ts_0_274 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @Filename: /a.js
////var C = function() { this.x = 0; }
////0;
verify.codeFix({
description: "Convert function to an ES2015 class",
newFileContent:
`class C {
constructor() { this.x = 0; }
}
0;`,
});
| {
"end_byte": 274,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/convertFunctionToEs6ClassNoSemicolon.ts"
} |
TypeScript/tests/cases/fourslash/jsxQualifiedTagCompletion.ts_3_273 | / <reference path="fourslash.ts" />
//@Filename: file.tsx
//// declare var React: any;
//// namespace NS {
//// export var Foo: any = null;
//// }
//// const j = <NS.Foo>Hello!/**/
////
goTo.marker();
edit.insert("</");
verify.completions({ exact: "NS.Foo>" });
| {
"end_byte": 273,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsxQualifiedTagCompletion.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToEsModule_export_object.ts_0_476 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @target: esnext
// @Filename: /a.js
////module.exports = {
//// x: 0,
//// f: function() {},
//// g: () => {},
//// h() {},
//// C: class {},
////};
// @Filename: /b.js
////const a = require("./a.js");
verify.codeFix({
description: "Convert to ES module",
newFileContent:
`export const x = 0;
export function f() { }
export function g() { }
export function h() { }
export class C { }`,
});
| {
"end_byte": 476,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToEsModule_export_object.ts"
} |
TypeScript/tests/cases/fourslash/mapCodeMethodReplacement.ts_0_348 | ///<reference path="fourslash.ts"/>
// @Filename: /index.ts
//// class MyClass {
//// x = 1;
//// foo() {
//// return 1;
//// }
//// bar() {[||]
//// return 2;
//// }
//// baz() {
//// return 3;
//// }
//// }
////
verify.baselineMapCode([test.ranges()], [
`
bar() {
return 'hello';
}
`
]);
| {
"end_byte": 348,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/mapCodeMethodReplacement.ts"
} |
TypeScript/tests/cases/fourslash/duplicateClassModuleError0.ts_0_471 | /// <reference path="fourslash.ts" />
//// module A
//// {
//// class B
//// {
//// public Hello(): string
//// {
//// return "from private B";
//// }
//// }
//// }
////
//// module A
//// {
//// /*1*/
//// }
edit.disableFormatting();
goTo.marker("1");
edit.insert(" export class B\n {\n public Hello(): string\n {\n return \"from export B\";\n }\n }\n");
edit.insert("\n");
| {
"end_byte": 471,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/duplicateClassModuleError0.ts"
} |
TypeScript/tests/cases/fourslash/referencesForGlobals2.ts_0_292 | /// <reference path='fourslash.ts'/>
// Global class reference.
// @Filename: referencesForGlobals_1.ts
/////*1*/class /*2*/globalClass {
//// public f() { }
////}
// @Filename: referencesForGlobals_2.ts
////var c = /*3*/globalClass();
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 292,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForGlobals2.ts"
} |
TypeScript/tests/cases/fourslash/formattingGlobalAugmentation2.ts_0_212 | /// <reference path="fourslash.ts"/>
////declare module "A" {
/////*1*/ global {
//// }
////}
format.document();
goTo.marker("1");
verify.currentLineContentIs(" global {"); | {
"end_byte": 212,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingGlobalAugmentation2.ts"
} |
TypeScript/tests/cases/fourslash/renameForDefaultExport01.ts_0_473 | /// <reference path='fourslash.ts'/>
////[|export default class [|{| "contextRangeIndex": 0 |}DefaultExportedClass|] {
////}|]
/////*
//// * Commenting [|{| "inComment": true |}DefaultExportedClass|]
//// */
////
////var x: [|DefaultExportedClass|];
////
////var y = new [|DefaultExportedClass|];
const ranges = test.rangesByText().get("DefaultExportedClass");
verify.baselineRename(ranges.filter(r => !(r.marker && r.marker.data.inComment)), { findInComments: true });
| {
"end_byte": 473,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameForDefaultExport01.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentOnUnclosedArrowType01.ts_0_210 | /// <reference path='fourslash.ts' />
////var x: () => {
////{| "indent": 4 |}
test.markers().forEach(marker => {
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
});
| {
"end_byte": 210,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentOnUnclosedArrowType01.ts"
} |
TypeScript/tests/cases/fourslash/jsDocSee_rename1.ts_0_262 | /// <reference path='fourslash.ts'/>
//// [|interface [|{| "contextRangeIndex": 0 |}A|] {}|]
//// /**
//// * @see {[|A|]}
//// */
//// declare const a: [|A|]
const [rDef, ...ranges] = test.ranges();
verify.baselineRename(ranges, { findInComments: true });
| {
"end_byte": 262,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocSee_rename1.ts"
} |
TypeScript/tests/cases/fourslash/jsdocDeprecated_suggestion16.ts_0_579 | /// <reference path="fourslash.ts" />
// @module: esnext
// @filename: /a.ts
////const a = 1;
////const b = 1;
////export { a, /** @deprecated b is deprecated */ b }
// @filename: /b.ts
////import { [|b|] } from "./a";
////[|b|]
goTo.file("/b.ts")
verify.getSuggestionDiagnostics([
{
"code": 6385,
"message": "'b' is deprecated.",
"reportsDeprecated": true,
"range": test.ranges()[0]
},
{
"code": 6385,
"message": "'b' is deprecated.",
"reportsDeprecated": true,
"range": test.ranges()[1]
},
]);
| {
"end_byte": 579,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocDeprecated_suggestion16.ts"
} |
TypeScript/tests/cases/fourslash/getJavaScriptCompletions20.ts_0_793 | /// <reference path="fourslash.ts" />
// @allowNonTsExtensions: true
// @Filename: file.js
//// /**
//// * A person
//// * @constructor
//// * @param {string} name - The name of the person.
//// * @param {number} age - The age of the person.
//// */
//// function Person(name, age) {
//// this.name = name;
//// this.age = age;
//// }
////
////
//// Person.getName = 10;
//// Person.getNa/**/ = 10;
verify.completions({
marker: "",
exact: completion.functionMembersWithPrototypePlus([
"getName",
"getNa",
{ name: "Person", sortText: completion.SortText.JavascriptIdentifiers },
{ name: "name", sortText: completion.SortText.JavascriptIdentifiers },
{ name: "age", sortText: completion.SortText.JavascriptIdentifiers }
]),
});
| {
"end_byte": 793,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptCompletions20.ts"
} |
TypeScript/tests/cases/fourslash/formattingSpaceAfterCommaBeforeOpenParen.ts_0_252 | /// <reference path='fourslash.ts' />
////foo(a,(b))/*1*/
////foo(a,(<b>c).d)/*2*/
goTo.marker("1");
edit.insert(";");
verify.currentLineContentIs("foo(a, (b));");
goTo.marker("2");
edit.insert(";");
verify.currentLineContentIs("foo(a, (<b>c).d);"); | {
"end_byte": 252,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingSpaceAfterCommaBeforeOpenParen.ts"
} |
TypeScript/tests/cases/fourslash/completionAfterBrace.ts_0_123 | /// <reference path='fourslash.ts'/>
////
//// }/**/
////
verify.completions({ marker: "", exact: completion.globals });
| {
"end_byte": 123,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionAfterBrace.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportFileQuoteStyle1.ts_0_313 | /// <reference path="fourslash.ts" />
//// [|import { v2 } from "./module2";
////
//// f1/*0*/();|]
// @Filename: module1.ts
//// export function f1() {}
// @Filename: module2.ts
//// export var v2 = 6;
verify.importFixAtPosition([
`import { f1 } from "./module1";
import { v2 } from "./module2";
f1();`
]);
| {
"end_byte": 313,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportFileQuoteStyle1.ts"
} |
TypeScript/tests/cases/fourslash/completionsObjectLiteralUnionStringMappingType.ts_0_428 | /// <reference path="fourslash.ts" />
////type UnionType = {
//// key1: string;
////} | {
//// key2: number;
////} | Uppercase<string>;
////
////const obj1: UnionType = {
//// /*1*/
////};
////
////const obj2: UnionType = {
//// key1: "abc",
//// /*2*/
////};
verify.completions({
marker: '1',
exact: [{ name: 'key1' }, { name: 'key2' }]
})
verify.completions({
marker: '2',
exact: [{ name: 'key2' }]
})
| {
"end_byte": 428,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsObjectLiteralUnionStringMappingType.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoDisplayPartsFunction.ts_0_806 | /// <reference path='fourslash.ts'/>
////function /*1*/foo(param: string, optionalParam?: string, paramWithInitializer = "hello", ...restParam: string[]) {
////}
////function /*2*/foowithoverload(a: string): string;
////function /*3*/foowithoverload(a: number): number;
////function /*4*/foowithoverload(a: any): any {
//// return a;
////}
////function /*5*/foowith3overload(a: string): string;
////function /*6*/foowith3overload(a: number): number;
////function /*7*/foowith3overload(a: boolean): boolean;
////function /*8*/foowith3overload(a: any): any {
//// return a;
////}
/////*9*/foo("hello");
/////*10*/foowithoverload("hello");
/////*11*/foowithoverload(10);
/////*12*/foowith3overload("hello");
/////*13*/foowith3overload(10);
/////*14*/foowith3overload(true);
verify.baselineQuickInfo(); | {
"end_byte": 806,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoDisplayPartsFunction.ts"
} |
TypeScript/tests/cases/fourslash/smartSelection_JSDocTags7.ts_0_172 | /// <reference path="fourslash.ts" />
/////**
//// * @constructor
//// * @param {/**/number} data
//// */
////function Foo(data) {
////}
verify.baselineSmartSelection();
| {
"end_byte": 172,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartSelection_JSDocTags7.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpCommentsFunctionDeclaration.ts_0_547 | /// <reference path='fourslash.ts' />
/////** This comment should appear for foo*/
////function foo() {
////}
////foo(/*4*/);
/////** This is comment for function signature*/
////function fooWithParameters(/** this is comment about a*/a: string,
//// /** this is comment for b*/
//// b: number) {
//// var d = a;
////}
////fooWithParameters(/*10*/"a",/*11*/10);
// ambient declaration
/////**
////* Does something
////* @param a a string
////*/
////declare function fn(a: string);
////fn(/*12*/"hello");
verify.baselineSignatureHelp()
| {
"end_byte": 547,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpCommentsFunctionDeclaration.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_TemplateString1.ts_0_338 | /// <reference path='fourslash.ts' />
////const foo = /*start*/"" + ``/*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 = ``;",
});
| {
"end_byte": 338,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_TemplateString1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddOptionalParam7.ts_0_293 | /// <reference path="fourslash.ts" />
////class C {
//// [|m1() {}|]
//// m2(a: boolean) {
//// this.m1(a);
//// }
////}
verify.codeFix({
description: [ts.Diagnostics.Add_optional_parameter_to_0.message, "m1"],
index: 1,
newRangeContent: "m1(a?: boolean) {}"
});
| {
"end_byte": 293,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddOptionalParam7.ts"
} |
TypeScript/tests/cases/fourslash/tryCatchFinallyFormating.ts_0_835 | /// <reference path='fourslash.ts' />
////try {
/////*tryInTryCatchFinally*/ // comment
////}
////catch (e) {
/////*catchInTryCatchFinally*/ // comment
////}
////finally {
/////*finalyInTryCatchFinally*/ // comment
////}
////
////try {
/////*tryInTryFinally*/ // comment
////}
////finally {
/////*finalyInTryFinally*/ // comment
////}
////
////try {
/////*tryInTryCatch*/ // comment
////}
////catch (e) {
/////*catchInTryCatch*/ // comment
////}
format.document();
var markers = [
"tryInTryCatchFinally",
"catchInTryCatchFinally",
"finalyInTryCatchFinally",
"tryInTryFinally",
"finalyInTryFinally",
"tryInTryCatch",
"catchInTryCatch"
];
markers.forEach((marker) => {
// Comments should be indented
goTo.marker(marker);
verify.currentLineContentIs(' // comment');
});
| {
"end_byte": 835,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tryCatchFinallyFormating.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceInNamespace.ts_0_504 | /// <reference path='fourslash.ts' />
////namespace N1 {
//// export interface I1 {
//// f1():string;
//// }
////}
////interface I1 {
//// f1();
////}
////
////class C1 implements N1.I1 {}
verify.codeFix({
description: "Implement interface 'N1.I1'",
newFileContent:
`namespace N1 {
export interface I1 {
f1():string;
}
}
interface I1 {
f1();
}
class C1 implements N1.I1 {
f1(): string {
throw new Error("Method not implemented.");
}
}`,
});
| {
"end_byte": 504,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceInNamespace.ts"
} |
TypeScript/tests/cases/fourslash/lambdaThisMembers.ts_0_236 | /// <reference path="fourslash.ts"/>
//// class Foo {
//// a: number;
//// b() {
//// var x = () => {
//// this./**/;
//// }
//// }
//// }
verify.completions({ marker: "", exact: ["a", "b"] });
| {
"end_byte": 236,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/lambdaThisMembers.ts"
} |
TypeScript/tests/cases/fourslash/getOutliningSpansForImports.ts_0_436 | /// <reference path="fourslash.ts"/>
////[|import * as ns from "mod";
////
////import d from "mod";
////import { a, b, c } from "mod";
////
////import r = require("mod");|]
////
////// statement
////var x = 0;
////
////// another set of imports
////[|import * as ns from "mod";
////import d from "mod";
////import { a, b, c } from "mod";
////import r = require("mod");|]
verify.outliningSpansInCurrentFile(test.ranges(), "imports");
| {
"end_byte": 436,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOutliningSpansForImports.ts"
} |
TypeScript/tests/cases/fourslash/renameAliasExternalModule2.ts_0_429 | /// <reference path='fourslash.ts'/>
// @Filename: a.ts
////[|module [|{| "contextRangeIndex": 0 |}SomeModule|] { export class SomeClass { } }|]
////[|export = [|{| "contextRangeIndex": 2 |}SomeModule|];|]
// @Filename: b.ts
////[|import [|{| "contextRangeIndex": 4 |}M|] = require("./a");|]
////import C = [|M|].SomeClass;
const [r0Def, r0, r1Def, r1, r2Def, r2, r3] = test.ranges();
verify.baselineRename([r0, r1, r2, r3]);
| {
"end_byte": 429,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameAliasExternalModule2.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoFromEmptyBlockComment.ts_0_143 | /// <reference path='fourslash.ts' />
/////**/
////class Foo {
////}
////var f/*A*/ff = new Foo();
verify.quickInfoAt("A", "var fff: Foo");
| {
"end_byte": 143,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoFromEmptyBlockComment.ts"
} |
TypeScript/tests/cases/fourslash/codeFixPropertyAssignment1.ts_0_226 | /// <reference path='fourslash.ts'/>
////const a = {
//// x/**/= 1
////}
verify.codeFix({
description: [ts.Diagnostics.Change_0_to_1.message, "=", ":"],
index: 0,
newFileContent:
`const a = {
x: 1
}`,
});
| {
"end_byte": 226,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixPropertyAssignment1.ts"
} |
TypeScript/tests/cases/fourslash/getJSXOutliningSpans.tsx_0_992 | ////import React, { Component } from 'react';
////
////export class Home extends Component[| {
//// render()[| {
//// return [|(
//// [|<div>
//// [|<h1>Hello, world!</h1>|]
//// [|<ul>
//// [|<li>
//// [|<a [|href='https://get.asp.net/'|]>
//// ASP.NET Core
//// </a>|]
//// </li>|]
//// [|<li>[|<a [|href='https://facebook.github.io/react/'|]>React</a>|] for client-side code</li>|]
//// [|<li>[|<a [|href='http://getbootstrap.com/'|]>Bootstrap</a>|] for layout and styling</li>|]
//// </ul>|]
//// <div
//// [|accesskey="test"
//// class="active"
//// dir="auto"|] />
//// <PageHeader [|title="Log in"
//// {...[|{
//// item: true,
//// xs: 9,
//// md: 5
//// }|]}|]
//// />
//// [|<>
//// text
//// </>|]
//// </div>|]
//// )|];
//// }|]
////}|]
verify.outliningSpansInCurrentFile(test.ranges(), "code"); | {
"end_byte": 992,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJSXOutliningSpans.tsx"
} |
TypeScript/tests/cases/fourslash/issue57585-2.ts_0_2028 | /// <reference path="fourslash.ts" />
// @strict: true
// @target: esnext
// @lib: esnext
//// declare const EffectTypeId: unique symbol;
////
//// type Covariant<A> = (_: never) => A;
////
//// interface VarianceStruct<out A, out E, out R> {
//// readonly _V: string;
//// readonly _A: Covariant<A>;
//// readonly _E: Covariant<E>;
//// readonly _R: Covariant<R>;
//// }
////
//// interface Variance<out A, out E, out R> {
//// readonly [EffectTypeId]: VarianceStruct<A, E, R>;
//// }
////
//// type Success<T extends Effect<any, any, any>> = [T] extends [
//// Effect<infer _A, infer _E, infer _R>,
//// ]
//// ? _A
//// : never;
////
//// declare const YieldWrapTypeId: unique symbol;
////
//// class YieldWrap<T> {
//// readonly #value: T;
//// constructor(value: T) {
//// this.#value = value;
//// }
//// [YieldWrapTypeId](): T {
//// return this.#value;
//// }
//// }
////
//// interface EffectGenerator<T extends Effect<any, any, any>> {
//// next(...args: ReadonlyArray<any>): IteratorResult<YieldWrap<T>, Success<T>>;
//// }
////
//// interface Effect<out A, out E = never, out R = never>
//// extends Variance<A, E, R> {
//// [Symbol.iterator](): EffectGenerator<Effect<A, E, R>>;
//// }
////
//// declare const gen: {
//// <Eff extends YieldWrap<Effect<any, any, any>>, AEff>(
//// f: () => Generator<Eff, AEff, never>,
//// ): Effect<
//// AEff,
//// [Eff] extends [never]
//// ? never
//// : [Eff] extends [YieldWrap<Effect<infer _A, infer E, infer _R>>]
//// ? E
//// : never,
//// [Eff] extends [never]
//// ? never
//// : [Eff] extends [YieldWrap<Effect<infer _A, infer _E, infer R>>]
//// ? R
//// : never
//// >;
//// };
////
//// declare const succeed: <A>(value: A) => Effect<A>;
////
//// gen(function* () {
//// const a = yield* succeed(1);
//// const b/*1*/ = yield* succeed(2);
//// return a + b;
//// });
verify.quickInfoAt("1", "const b: number");
verify.getSemanticDiagnostics([]); | {
"end_byte": 2028,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/issue57585-2.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.