_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/fourslash/inlineVariableDestructuredVariableDeclaration3.ts_0_208 | /// <reference path="fourslash.ts" />
////function f() {
//// const a = { prop: 123 };
//// const { prop } = /*a*/a/*b*/;
////}
goTo.select("a", "b");
verify.not.refactorAvailable("Inline variable");
| {
"end_byte": 208,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlineVariableDestructuredVariableDeclaration3.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoJsDocTags15.ts_0_589 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @checkJs: true
// @filename: /a.js
/////**
//// * @callback Bar
//// * @param {string} name
//// * @returns {string}
//// */
////
/////**
//// * @typedef Foo
//// * @property {Bar} getName
//// */
////export const foo = 1;
// @filename: /b.js
////import * as _a from "./a.js";
/////**
//// * @implements {_a.Foo/*1*/}
//// */
////class C1 { }
////
/////**
//// * @extends {_a.Foo/*2*/}
//// */
////class C2 { }
////
/////**
//// * @augments {_a.Foo/*3*/}
//// */
////class C3 { }
goTo.file("/b.js")
verify.baselineQuickInfo();
| {
"end_byte": 589,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoJsDocTags15.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_refactorAvailableImplicit3.ts_0_480 | /// <reference path='fourslash.ts' />
////class ns /*a*//*b*/extends ap{
//// constructor() {}
////
//// export function fn() {
//// console.log("Hello");
//// }
//// fn();
////
////}
goTo.select("a", "b");
verify.refactorAvailableForTriggerReason("implicit", "Move to a new file",
/*actionName*/ undefined,
/*actionDescription*/ undefined,
/*kind*/ undefined,
{
allowTextChangesInNewFiles: true
},
/*includeInteractiveActions*/ true);
| {
"end_byte": 480,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_refactorAvailableImplicit3.ts"
} |
TypeScript/tests/cases/fourslash/completionForStringLiteral12.ts_0_262 | /// <reference path='fourslash.ts' />
////function foo(x: "bla"): void;
////function foo(x: "bla"): void;
////function foo(x: string) {}
////foo("[|/**/|]")
verify.completions({ marker: "", exact: {
name: "bla",
replacementSpan: test.ranges()[0]
} });
| {
"end_byte": 262,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteral12.ts"
} |
TypeScript/tests/cases/fourslash/completionsAssertKeyword.ts_0_1000 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: a.ts
//// const f = {
//// a: 1
////};
//// import * as thing from "thing" /*0*/
//// export { foo } from "foo" /*1*/
//// import "foo" as /*2*/
//// import "foo" a/*3*/
//// import * as that from "that"
//// /*4*/
//// import * /*5*/ as those from "those"
// @Filename: b.js
//// import * as thing from "thing" /*js*/;
const assertEntry = {
name: "assert",
kind: "keyword",
sortText: completion.SortText.GlobalsOrKeywords,
};
verify.completions(
{
marker: "0",
includes: [assertEntry],
},
{
marker: "1",
includes: [assertEntry],
},
{
marker: "2",
excludes: ["assert"],
},
{
marker: "3",
includes: [assertEntry],
},
{
marker: "4",
excludes: ["assert"],
},
{
marker: "5",
excludes: ["assert"],
},
{
marker: "js",
includes: [assertEntry],
},
);
| {
"end_byte": 1000,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsAssertKeyword.ts"
} |
TypeScript/tests/cases/fourslash/completionListInUnclosedTypeOfExpression01.ts_0_128 | /// <reference path='fourslash.ts' />
////var x;
////var y = typeof /*1*/
verify.completions({ marker: "1", includes: "x" });
| {
"end_byte": 128,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedTypeOfExpression01.ts"
} |
TypeScript/tests/cases/fourslash/tripleSlashRefPathCompletionContext.ts_0_507 | /// <reference path='fourslash.ts' />
// Exercises whether completions are supplied, conditional on the caret position in the ref comment.
// @Filename: f.ts
//// /*f*/
// @Filename: test.ts
//// /// <reference path/*0*/=/*1*/"/*8*/
//// /// <reference path/*2*/=/*3*/"/*9*/"/*4*/ /*5*///*6*/>/*7*/
verify.completions(
{ marker: ["0", "1", "2", "3", "4", "5", "6", "7"], exact: undefined, isNewIdentifierLocation: true },
{ marker: ["8", "9"], exact: "f.ts", isNewIdentifierLocation: true },
);
| {
"end_byte": 507,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tripleSlashRefPathCompletionContext.ts"
} |
TypeScript/tests/cases/fourslash/codeFixCorrectReturnValue5.ts_0_126 | /// <reference path='fourslash.ts' />
//// function Foo (): void {
//// undefined
//// }
verify.not.codeFixAvailable();
| {
"end_byte": 126,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCorrectReturnValue5.ts"
} |
TypeScript/tests/cases/fourslash/genericInterfacesWithConstraints1.ts_0_507 | /// <reference path='fourslash.ts'/>
////interface A { a: string; }
////interface B extends A { b: string; }
////interface C extends B { c: string; }
////interface G<T, U extends B> {
//// x: T;
//// y: U;
////}
////var v/*1*/1: G<A, C>; // Ok
////var v/*2*/2: G<{ a: string }, C>; // Ok, equivalent to G<A, C>
////var v/*3*/3: G<G<A, B>, C>; // Ok
verify.quickInfos({
1: "var v1: G<A, C>",
2: "var v2: G<{\n a: string;\n}, C>",
3: "var v3: G<G<A, B>, C>"
});
| {
"end_byte": 507,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/genericInterfacesWithConstraints1.ts"
} |
TypeScript/tests/cases/fourslash/renameInheritedProperties1.ts_3_243 | / <reference path='fourslash.ts'/>
//// class class1 extends class1 {
//// [|[|{| "contextRangeIndex": 0 |}propName|]: string;|]
//// }
////
//// var v: class1;
//// v.[|propName|];
verify.baselineRenameAtRangesWithText("propName");
| {
"end_byte": 243,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameInheritedProperties1.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_InnerAsyncFunction1.ts_0_373 | /// <reference path='fourslash.ts' />
/////*a*/const fn = () =>
//// async () => { };/*b*/
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert arrow function or function expression",
actionName: "Convert to named function",
actionDescription: "Convert to named function",
newContent:
`function fn() {
return async () => { };
}`,
});
| {
"end_byte": 373,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_InnerAsyncFunction1.ts"
} |
TypeScript/tests/cases/fourslash/formattingAfterMultiLineString.ts_0_247 | /// <reference path='fourslash.ts' />
////class foo {
//// stop() {
//// var s = "hello\/*1*/
////"/*2*/
//// }
////}
goTo.marker("2");
edit.insertLine('');
goTo.marker("1");
verify.currentLineContentIs(' var s = "hello\\'); | {
"end_byte": 247,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingAfterMultiLineString.ts"
} |
TypeScript/tests/cases/fourslash/completionsJsxAttribute.ts_0_844 | /// <reference path="fourslash.ts" />
// @jsx: preserve
// @Filename: /a.tsx
////declare namespace JSX {
//// interface Element {}
//// interface IntrinsicElements {
//// div: {
//// /** Doc */
//// foo: boolean;
//// bar: string;
//// }
//// }
////}
////
////<div /**/></div>;
const exact: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntry> = [
{ name: "bar", kind: "property", kindModifiers: "declare", text: "(property) bar: string" },
{ name: "foo", kind: "property", kindModifiers: "declare", text: "(property) foo: boolean", documentation: "Doc" },
];
verify.completions({ marker: "", exact });
edit.insert("f");
verify.completions({ exact });
edit.insert("oo ");
verify.completions({ exact: exact[0] });
edit.insert("b");
verify.completions({ exact: exact[0] });
| {
"end_byte": 844,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsJsxAttribute.ts"
} |
TypeScript/tests/cases/fourslash/formattingMultilineCommentsWithTabs2.ts_0_1219 | /// <reference path='fourslash.ts'/>
////var f = function (j) {
////
//// switch (j) {
//// case 1:
/////*1*/ /* when current checkbox has focus, Firefox has changed check state already
/////*2*/ on SPACE bar press only
/////*3*/ IE does not have issue, use the CSS class
/////*4*/ input:focus[type=checkbox] (z-index = 31290)
/////*5*/ to determine whether checkbox has focus or not
//// */
//// break;
//// case 2:
//// break;
//// }
////}
var options = format.copyFormatOptions();
options.ConvertTabsToSpaces = false;
var oldOptions = format.setFormatOptions(options);
try {
format.document();
goTo.marker("1");
verify.currentLineContentIs(" /* when current checkbox has focus, Firefox has changed check state already");
goTo.marker("2");
verify.currentLineContentIs(" on SPACE bar press only");
goTo.marker("3");
verify.currentLineContentIs(" IE does not have issue, use the CSS class");
goTo.marker("4");
verify.currentLineContentIs(" input:focus[type=checkbox] (z-index = 31290)");
goTo.marker("5");
verify.currentLineContentIs(" to determine whether checkbox has focus or not");
}
finally {
format.setFormatOptions(oldOptions);
}
| {
"end_byte": 1219,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingMultilineCommentsWithTabs2.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionDifferentFileIndirectly.ts_0_950 | /// <reference path='fourslash.ts' />
// @Filename: Remote2.ts
////var /*remoteVariableDefinition*/rem2Var;
////function /*remoteFunctionDefinition*/rem2Fn() { }
////class /*remoteClassDefinition*/rem2Cls { }
////interface /*remoteInterfaceDefinition*/rem2Int{}
////module /*remoteModuleDefinition*/rem2Mod { export var foo; }
// @Filename: Remote1.ts
////var remVar;
////function remFn() { }
////class remCls { }
////interface remInt{}
////module remMod { export var foo; }
// @Filename: Definition.ts
/////*remoteVariableReference*/rem2Var = 1;
/////*remoteFunctionReference*/rem2Fn();
////var rem2foo = new /*remoteClassReference*/rem2Cls();
////class rem2fooCls implements /*remoteInterfaceReference*/rem2Int { }
////var rem2fooVar = /*remoteModuleReference*/rem2Mod.foo;
verify.baselineGetDefinitionAtPosition("remoteVariableReference", "remoteFunctionReference", "remoteClassReference", "remoteInterfaceReference", "remoteModuleReference")
| {
"end_byte": 950,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionDifferentFileIndirectly.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_Availability_Anon_arguments.ts_0_460 | /// <reference path='fourslash.ts' />
////function foo() {
//// return /*a*/(/*b*/) => arguments;
////}
goTo.select("a", "b");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
| {
"end_byte": 460,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_Availability_Anon_arguments.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFix_importType6.ts_0_448 | /// <reference path="fourslash.ts" />
// @module: es2015
// @esModuleInterop: true
// @jsx: react
// @Filename: /types.d.ts
//// declare module "react" { var React: any; export = React; export as namespace React; }
// @Filename: /a.tsx
//// import type React from "react";
//// function Component() {}
//// (<Component/**/ />)
goTo.marker("");
verify.importFixAtPosition([
`import React from "react";
function Component() {}
(<Component />)`]); | {
"end_byte": 448,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_importType6.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess_js_2.ts_0_495 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @Filename: a.js
//// 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": 495,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess_js_2.ts"
} |
TypeScript/tests/cases/fourslash/hoverOverComment.ts_0_211 | /// <reference path="fourslash.ts" />
////export function f() {}
//////foo
/////**///moo
goTo.marker();
verify.quickInfoIs("");
verify.baselineFindAllReferences("");
verify.baselineGetDefinitionAtPosition(""); | {
"end_byte": 211,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/hoverOverComment.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoForTypeofParameter.ts_0_227 | /// <reference path='fourslash.ts'/>
////function foo() {
//// var y/*ref1*/1: string;
//// var x: typeof y/*ref2*/1;
////}
verify.quickInfos({
ref1: "(local var) y1: string",
ref2: "(local var) y1: string"
});
| {
"end_byte": 227,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForTypeofParameter.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageAlwaysInfer.ts_0_244 | /// <reference path='fourslash.ts' />
// @noImplicitAny: false
////function coll(callback) {
////}
verify.codeFix({
description: "Infer parameter types from usage",
index: 0,
newFileContent:
`function coll(callback: any) {
}`,
});
| {
"end_byte": 244,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageAlwaysInfer.ts"
} |
TypeScript/tests/cases/fourslash/renameJsOverloadedFunctionParameter.ts_0_393 | /// <reference path='fourslash.ts'/>
// @allowJs: true
// @checkJs: true
// @Filename: foo.js
/////**
//// * @overload
//// * @param {number} x
//// * @returns {number}
//// *
//// * @overload
//// * @param {string} x
//// * @returns {string}
//// *
//// * @param {unknown} x
//// * @returns {unknown}
//// */
////function foo(x/**/) {
//// return x;
////}
verify.baselineRename("", {});
| {
"end_byte": 393,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameJsOverloadedFunctionParameter.ts"
} |
TypeScript/tests/cases/fourslash/unusedVariableInForLoop3FS.ts_0_293 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
//// function f1 () {
//// [|for(var i = 0, j= 0, k=0; ;i++, k++)|] {
////
//// }
//// }
verify.codeFix({
description: "Remove unused declaration for: 'j'",
newRangeContent: "for(var i = 0, k=0; ;i++, k++)",
});
| {
"end_byte": 293,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedVariableInForLoop3FS.ts"
} |
TypeScript/tests/cases/fourslash/convertFunctionToEs6Class1.ts_0_1113 | /// <reference path='fourslash.ts' />
// @allowNonTsExtensions: true
// @Filename: test123.js
////function [|foo|]() { }
////foo.prototype.instanceMethod1 = function() { return "this is name"; };
////foo.prototype.instanceMethod2 = () => { return "this is name"; };
////foo.prototype.instanceProp1 = "hello";
////foo.prototype.instanceProp2 = undefined;
////foo.staticProp = "world";
////foo.staticMethod1 = function() { return "this is static name"; };
////foo.staticMethod2 = () => "this is static name";
verify.getSuggestionDiagnostics([{
message: "This constructor function may be converted to a class declaration.",
code: 80002,
}]);
verify.codeFix({
description: "Convert function to an ES2015 class",
newFileContent:
`class foo {
constructor() { }
static staticMethod1() { return "this is static name"; }
static staticMethod2() { return "this is static name"; }
instanceMethod1() { return "this is name"; }
instanceMethod2() { return "this is name"; }
}
foo.prototype.instanceProp1 = "hello";
foo.prototype.instanceProp2 = undefined;
foo.staticProp = "world";
`,
});
| {
"end_byte": 1113,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/convertFunctionToEs6Class1.ts"
} |
TypeScript/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunctionForTriggerReason2.ts_0_410 | /// <reference path='fourslash.ts' />
//// const a = (a: number) => { re/*a*/tur/*b*/n a; };
// Only offer refactor in body if explicity requested
goTo.select("a", "b");
verify.not.refactorAvailableForTriggerReason("implicit", "Add or remove braces in an arrow function");
verify.refactorAvailableForTriggerReason("invoked", "Add or remove braces in an arrow function", "Remove braces from arrow function");
| {
"end_byte": 410,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunctionForTriggerReason2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixSpellingPrivateNameInIn.ts_0_411 | /// <reference path='fourslash.ts' />
////class A {
//// #foo: number;
//// static isA(v: A) {
//// [|return #fo in v;|]
//// }
////}
verify.codeFixAvailable([
{ description: "Change spelling to '#foo'" },
{ description: "Remove unused declaration for: '#foo'" },
]);
verify.codeFix({
index: 0,
description: "Change spelling to '#foo'",
newRangeContent: "return #foo in v;"
});
| {
"end_byte": 411,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixSpellingPrivateNameInIn.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_classTypeParameters.ts_0_566 | /// <reference path='fourslash.ts' />
////class Foo<T> {
//// /*a*/bar/*b*/(t: T, s: T) {
//// return s;
//// }
////}
////var foo = new Foo();
////foo.bar("a", "b");
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: `class Foo<T> {
bar({ t, s }: { t: T; s: T; }) {
return s;
}
}
var foo = new Foo();
foo.bar({ t: "a", s: "b" });`
}); | {
"end_byte": 566,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_classTypeParameters.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddConvertToUnknownForNonOverlappingTypes5.ts_0_187 | /// <reference path='fourslash.ts' />
////<string>0
verify.codeFix({
description: "Add 'unknown' conversion for non-overlapping types",
newFileContent: `<string><unknown>0`
});
| {
"end_byte": 187,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddConvertToUnknownForNonOverlappingTypes5.ts"
} |
TypeScript/tests/cases/fourslash/asConstRefsNoErrors2.ts_0_149 | /// <reference path="fourslash.ts" />
////class Tex {
//// type = </**/const>'Text';
////}
verify.baselineGoToDefinition("");
verify.noErrors(); | {
"end_byte": 149,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/asConstRefsNoErrors2.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_notFromUnrelatedNodeModules.ts_0_299 | /// <reference path="fourslash.ts" />
// @module: esnext
// @Filename: /unrelated/node_modules/@types/foo/index.d.ts
////export function foo() {}
// @Filename: /src/b.ts
////fo/**/;
verify.completions({ marker: "", excludes: "foo", preferences: { includeCompletionsForModuleExports: true } });
| {
"end_byte": 299,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_notFromUnrelatedNodeModules.ts"
} |
TypeScript/tests/cases/fourslash/callHierarchyConstNamedArrowFunction.ts_0_223 | /// <reference path="fourslash.ts" />
//// function foo() {
//// bar();
//// }
////
//// const /**/bar = () => {
//// baz();
//// }
////
//// function baz() {
//// }
goTo.marker();
verify.baselineCallHierarchy();
| {
"end_byte": 223,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/callHierarchyConstNamedArrowFunction.ts"
} |
TypeScript/tests/cases/fourslash/jsTagAfterTypedef1.ts_0_482 | /// <reference path='fourslash.ts' />
// @Filename: foo.js
// @allowJs: true
// @checkJs: true
//// /** @typedef Lister @property p @yeturn {ListenerBlock} */
//// /**
//// * The function used
//// * /*1*/ settings
//// */
//// class /*2*/ListenerBlock {
//// }
// Force a syntax tree to be created.
verify.noMatchingBracePositionInCurrentFile(0);
goTo.marker('1');
edit.insert('fenster');
verify.quickInfoAt('2', 'class ListenerBlock', 'The function used\nfenster settings')
| {
"end_byte": 482,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsTagAfterTypedef1.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesPrivate1.ts_0_1498 | /// <reference path='fourslash.ts' />
////module m {
//// export class C1 {
//// public pub1;
//// public pub2;
//// [|private|] priv1;
//// [|private|] priv2;
//// protected prot1;
//// protected prot2;
////
//// public public;
//// [|private|] private;
//// protected protected;
////
//// public constructor(public a, [|private|] b, protected c, public d, [|private|] e, protected f) {
//// this.public = 10;
//// this.private = 10;
//// this.protected = 10;
//// }
////
//// public get x() { return 10; }
//// public set x(value) { }
////
//// public static statPub;
//// [|private|] static statPriv;
//// protected static statProt;
//// }
////
//// export interface I1 {
//// }
////
//// export declare module ma.m1.m2.m3 {
//// interface I2 {
//// }
//// }
////
//// export module mb.m1.m2.m3 {
//// declare var foo;
////
//// export class C2 {
//// public pub1;
//// private priv1;
//// protected prot1;
////
//// protected constructor(public public, protected protected, private private) {
//// public = private = protected;
//// }
//// }
//// }
////
//// declare var ambientThing: number;
//// export var exportedThing = 10;
//// declare function foo(): string;
////}
verify.baselineDocumentHighlights();
| {
"end_byte": 1498,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesPrivate1.ts"
} |
TypeScript/tests/cases/fourslash/formattingReplaceSpacesWithTabs.ts_0_977 | /// <reference path="fourslash.ts"/>
////module Foo {
/////*1*/class Test { }
/////*2*/ class Test { }
/////*3*/ class Test { }
/////*4*/ class Test { }
/////*5*/ class Test { }
/////*6*/ class Test { }
/////*7*/ class Test { }
////}
var options = format.copyFormatOptions();
options.ConvertTabsToSpaces = false;
var oldOptions = format.setFormatOptions(options);
try {
format.document();
goTo.marker("1");
verify.currentLineContentIs("\tclass Test { }")
goTo.marker("2");
verify.currentLineContentIs("\tclass Test { }")
goTo.marker("3");
verify.currentLineContentIs("\tclass Test { }")
goTo.marker("4");
verify.currentLineContentIs("\tclass Test { }")
goTo.marker("5");
verify.currentLineContentIs("\tclass Test { }")
goTo.marker("6");
verify.currentLineContentIs("\tclass Test { }")
goTo.marker("7");
verify.currentLineContentIs("\tclass Test { }")
}
finally {
format.setFormatOptions(oldOptions);
}
| {
"end_byte": 977,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingReplaceSpacesWithTabs.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFix_uriStyleNodeCoreModules1.ts_0_505 | /// <reference path="fourslash.ts" />
// @module: commonjs
// @Filename: /node_modules/@types/node/index.d.ts
//// declare module "fs" { function writeFile(): void }
//// declare module "fs/promises" { function writeFile(): Promise<void> }
//// declare module "node:fs" { export * from "fs"; }
//// declare module "node:fs/promises" { export * from "fs/promises"; }
// @Filename: /index.ts
//// writeFile/**/
verify.importFixModuleSpecifiers("", ["fs", "fs/promises", "node:fs", "node:fs/promises"]);
| {
"end_byte": 505,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_uriStyleNodeCoreModules1.ts"
} |
TypeScript/tests/cases/fourslash/convertFunctionToEs6Class_objectLiteralInArrowFunction.ts_0_394 | /// <reference path='fourslash.ts' />
// @allowNonTsExtensions: true
// @Filename: /a.js
////function /**/MyClass() {
////}
////MyClass.prototype.foo = function() {
//// ({ bar: () => { } })
////}
verify.codeFix({
description: "Convert function to an ES2015 class",
newFileContent:
`class MyClass {
constructor() {
}
foo() {
({ bar: () => { } })
}
}
`,
});
| {
"end_byte": 394,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/convertFunctionToEs6Class_objectLiteralInArrowFunction.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesThisNegatives2.ts_0_2923 | /// <reference path='fourslash.ts' />
////this;
////this;
////
////function f() {
//// this;
//// this;
//// () => this;
//// () => {
//// if (this) {
//// this;
//// }
//// else {
//// this.t/*1*/his;
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
////}
////
////module m {
//// function f() {
//// this;
//// this;
//// () => this;
//// () => {
//// if (this) {
//// this;
//// }
//// else {
//// this./*2*/this;
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
//// }
////}
////
////class A {
//// public b = this.method1;
////
//// public method1() {
//// this;
//// this;
//// () => this;
//// () => {
//// if (this) {
//// this;
//// }
//// else {
//// this.thi/*3*/s;
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
//// }
////
//// private method2() {
//// this;
//// this;
//// () => this;
//// () => {
//// if (this) {
//// this;
//// }
//// else {
//// this.t/*4*/his;
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
//// }
////
//// public static staticB = this.staticMethod1;
////
//// public static staticMethod1() {
//// this;
//// this;
//// () => this;
//// () => {
//// if (this) {
//// this;
//// }
//// else {
//// this.th/*5*/is;
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
//// }
////
//// private static staticMethod2() {
//// this;
//// this;
//// () => this;
//// () => {
//// if (this) {
//// this;
//// }
//// else {
//// this.th/*6*/is;
//// }
//// }
//// function inside() {
//// this;
//// (function (_) {
//// this;
//// })(this);
//// }
//// }
////}
////
////var x = {
//// f() {
//// this;
//// },
//// g() {
//// this;
//// }
////}
verify.baselineDocumentHighlights(test.markers());
| {
"end_byte": 2923,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesThisNegatives2.ts"
} |
TypeScript/tests/cases/fourslash/getFileReferences1.ts_0_352 | /// <reference path="fourslash.ts" />
// @Filename: /project/a.ts
//// export const a = 0;
// @Filename: /project/b.ts
//// import "./a";
// @Filename: /project/c.ts
//// import {} from "./a";
// @Filename: /project/d.ts
//// import { a } from "/project/a";
//// type T = typeof import("./a").a;
verify.baselineGetFileReferences("/project/a.ts");
| {
"end_byte": 352,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getFileReferences1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateDeeply.ts_0_346 | /// <reference path='fourslash.ts' />
////interface I<T> {
//// x: { y: T, z: T[] };
////}
////class C implements I<number> {[| |]}
verify.codeFix({
description: "Implement interface 'I<number>'",
newFileContent:
`interface I<T> {
x: { y: T, z: T[] };
}
class C implements I<number> {
x: { y: number; z: number[]; };
}`,
});
| {
"end_byte": 346,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateDeeply.ts"
} |
TypeScript/tests/cases/fourslash/extract-method37.ts_0_1043 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////export interface A {
//// x: number;
////}
// @Filename: /b.ts
////export interface B<T> {
//// payload: T;
////}
// @Filename: /c.ts
////import { A } from "./a";
////import { B } from "./b";
////export interface C<T> {
//// payload: T;
////}
////
////export const c: C<B<A>> = {
//// payload: {
//// payload: { x: 1 }
//// }
////}
// @Filename: /d.ts
////import { c } from "./c";
////
////class Foo {
//// foo() {
//// const arg = c;
//// /*a*/console.log(arg);/*b*/
//// }
////}
goTo.file("/d.ts");
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to method in class 'Foo'",
newContent:
`import { A } from "./a";
import { B } from "./b";
import { C, c } from "./c";
class Foo {
foo() {
const arg = c;
this./*RENAME*/newMethod(arg);
}
private newMethod(arg: C<B<A>>) {
console.log(arg);
}
}`
});
| {
"end_byte": 1043,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method37.ts"
} |
TypeScript/tests/cases/fourslash/codeFixImplicitThis_ts_functionDeclaration.ts_0_464 | /// <reference path='fourslash.ts' />
// @noImplicitThis: true
////class C {
//// m() {
//// function f() {
//// this;
//// f(); // self-reference OK
//// }
//// }
////}
verify.codeFix({
description: "Convert function declaration 'f' to arrow function",
index: 0,
newFileContent:
`class C {
m() {
const f = () => {
this;
f(); // self-reference OK
}
}
}`,
});
| {
"end_byte": 464,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixImplicitThis_ts_functionDeclaration.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportNodeModules4.ts_0_585 | /// <reference path="fourslash.ts" />
//// [|f1/*0*/('');|]
// @Filename: package.json
//// { "dependencies": { "package-name": "latest" } }
// @Filename: node_modules/package-name/bin/lib/libfile.d.ts
//// export function f1(text: string): string;
// @Filename: node_modules/package-name/bin/lib/libfile.js
//// function f1(text) { }
//// exports.f1 = f1;
// @Filename: node_modules/package-name/package.json
//// {
//// "main": "bin/lib/libfile.js",
//// "types": "bin/lib/libfile.d.ts"
//// }
verify.importFixAtPosition([
`import { f1 } from "package-name";
f1('');`
]);
| {
"end_byte": 585,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportNodeModules4.ts"
} |
TypeScript/tests/cases/fourslash/jsDocIndentationPreservation2.ts_0_292 | ///<reference path="fourslash.ts" />
// @allowJs: true
// @Filename: Foo.js
/////**
//// Does some stuff.
//// Second line.
//// Third line.
////*/
////function foo/**/(){}
goTo.marker();
verify.quickInfoIs("function foo(): void", "Does some stuff.\n Second line.\n\tThird line.");
| {
"end_byte": 292,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocIndentationPreservation2.ts"
} |
TypeScript/tests/cases/fourslash/refactorOverloadListToSingleSignature3.ts_0_650 | /// <reference path='fourslash.ts' />
/////*a*/function foo(): void;
////function foo(a: string): void;
////function foo(a: number, b: number): void;
////function foo(...rest: symbol[]): void;/*b*/
////function foo(...args: any[]): void {
//// // body
////}
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert overload list to single signature",
actionName: "Convert overload list to single signature",
actionDescription: ts.Diagnostics.Convert_overload_list_to_single_signature.message,
newContent: `function foo(...args: [] | [a: string] | [a: number, b: number] | [...rest: symbol[]]): void {
// body
}`,
});
| {
"end_byte": 650,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorOverloadListToSingleSignature3.ts"
} |
TypeScript/tests/cases/fourslash/findAllReferencesJsRequireDestructuring1.ts_0_251 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @noEmit: true
// @checkJs: true
// @Filename: /X.js
////module.exports = { x: 1 };
// @Filename: /Y.js
////const { /*1*/x: { y } } = require("./X");
verify.baselineFindAllReferences("1");
| {
"end_byte": 251,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllReferencesJsRequireDestructuring1.ts"
} |
TypeScript/tests/cases/fourslash/completionListInStringLiterals2.ts_0_161 | /// <reference path="fourslash.ts" />
////"/*1*/ /*2*/\/*3*/
//// /*4*/ \\\/*5*/
//// /*6*/
verify.completions({ marker: test.markers(), exact: [] });
| {
"end_byte": 161,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInStringLiterals2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageCall.ts_0_152 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
////function wat([|b |]) {
//// b();
////}
verify.rangeAfterCodeFix("b: () => void"); | {
"end_byte": 152,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageCall.ts"
} |
TypeScript/tests/cases/fourslash/referencesIsAvailableThroughGlobalNoCrash.ts_0_730 | /// <reference path="fourslash.ts" />
// @Filename: /packages/playwright-core/bundles/utils/node_modules/@types/debug/index.d.ts
//// declare var debug: debug.Debug & { debug: debug.Debug; default: debug.Debug };
//// export = debug;
//// export as namespace debug;
//// declare namespace debug {
//// interface Debug {
//// coerce: (val: any) => any;
//// }
//// }
// @Filename: /packages/playwright-core/bundles/utils/node_modules/@types/debug/package.json
//// { "types": "index.d.ts" }
// @Filename: /packages/playwright-core/src/index.ts
//// export const debug: typeof import('../bundles/utils/node_modules//*1*/@types/debug') = require('./utilsBundleImpl').debug;
verify.baselineFindAllReferences('1');
| {
"end_byte": 730,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesIsAvailableThroughGlobalNoCrash.ts"
} |
TypeScript/tests/cases/fourslash/codeFixCorrectReturnValue28.ts_0_479 | /// <reference path='fourslash.ts' />
// @strict: true
// @Filename: test.ts
//// (function() {
//// const config = {
//// values: [],
//// value: {},
//// };
////
//// config.values.push(config.value);
//// }());
goTo.file('test.ts');
verify.getSemanticDiagnostics([{
code: 2345,
message: "Argument of type '{}' is not assignable to parameter of type 'never'.",
range: { pos: 91, end: 103,fileName: "test.ts" }
}]);
verify.not.codeFixAvailable();
| {
"end_byte": 479,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCorrectReturnValue28.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToNamed_Modifier_Comment.ts_0_482 | /// <reference path='fourslash.ts' />
//// // Do not add me second time
//// export let foo = /*x*/a/*y*/ => {
//// let b = 1;
//// return a + b;
//// };
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert arrow function or function expression",
actionName: "Convert to named function",
actionDescription: "Convert to named function",
newContent: `// Do not add me second time
export function foo(a) {
let b = 1;
return a + b;
}`,
});
| {
"end_byte": 482,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToNamed_Modifier_Comment.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_duplicatePackages_types.ts_0_1586 | /// <reference path="fourslash.ts" />
// @module: commonjs
// @esModuleInterop: true
// @Filename: /node_modules/@types/react-dom/package.json
//// { "name": "react-dom", "version": "1.0.0", "types": "./index.d.ts" }
// @Filename: /node_modules/@types/react-dom/index.d.ts
//// import * as React from "react";
//// export function render(): void;
// @Filename: /node_modules/@types/react/package.json
//// { "name": "react", "version": "1.0.0", "types": "./index.d.ts" }
// @Filename: /node_modules/@types/react/index.d.ts
//// import "./other";
//// export declare function useState(): void;
// @Filename: /node_modules/@types/react/other.d.ts
//// export declare function useRef(): void;
// @Filename: /packages/a/node_modules/@types/react/package.json
//// { "name": "react", "version": "1.0.1", "types": "./index.d.ts" }
// @Filename: /packages/a/node_modules/@types/react/index.d.ts
//// export declare function useState(): void;
// @Filename: /packages/a/index.ts
//// import "react-dom";
//// import "react";
// @Filename: /packages/a/foo.ts
//// /**/
goTo.marker("");
verify.completions({
marker: "",
exact: completion.globalsPlus([{
name: "render",
source: "react-dom",
sourceDisplay: "react-dom",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions,
}, {
name: "useState",
source: "react",
sourceDisplay: "react",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions,
}]),
preferences: {
includeCompletionsForModuleExports: true,
allowIncompleteCompletions: true,
},
});
| {
"end_byte": 1586,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_duplicatePackages_types.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingSuperCall2.ts_0_409 | /// <reference path='fourslash.ts' />
////class A {}
////class B extends A {
//// public [|constructor|]() {}
////}
verify.codeFixAvailable([
{ description: ts.Diagnostics.Add_missing_super_call.message }
])
verify.codeFix({
description: ts.Diagnostics.Add_missing_super_call.message,
newFileContent:
`class A {}
class B extends A {
public constructor() {
super();
}
}`
});
| {
"end_byte": 409,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingSuperCall2.ts"
} |
TypeScript/tests/cases/fourslash/constQuickInfoAndCompletionList.ts_0_822 | /// <reference path='fourslash.ts' />
////const /*1*/a = 10;
////var x = /*2*/a;
/////*3*/
////function foo() {
//// const /*4*/b = 20;
//// var y = /*5*/b;
//// var z = /*6*/a;
//// /*7*/
////}
const a = "const a: 10";
const b = "const b: 20";
const completeA: FourSlashInterface.ExpectedCompletionEntry = { name: "a", text: a };
const completeB: FourSlashInterface.ExpectedCompletionEntry = { name: "b", text: b };
verify.completions(
{ marker: "2", includes: completeA, excludes: "b", isNewIdentifierLocation: true },
{ marker: "3", includes: completeA, excludes: "b" },
{ marker: ["5", "6"], includes: [completeA, completeB], isNewIdentifierLocation: true },
{ marker: "7", includes: [completeA, completeB] },
);
verify.quickInfos({
1: a,
2: a,
4: b,
5: b,
6: a,
});
| {
"end_byte": 822,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/constQuickInfoAndCompletionList.ts"
} |
TypeScript/tests/cases/fourslash/codeFixReturnTypeInAsyncFunction10.ts_0_315 | /// <reference path='fourslash.ts' />
// @target: es2015
////type Foo = "a" | "b";
////async function fn(): Foo {}
verify.codeFix({
index: 0,
description: [ts.Diagnostics.Replace_0_with_Promise_1.message, "Foo", "Foo"],
newFileContent:
`type Foo = "a" | "b";
async function fn(): Promise<Foo> {}`
});
| {
"end_byte": 315,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixReturnTypeInAsyncFunction10.ts"
} |
TypeScript/tests/cases/fourslash/fixExactOptionalUnassignableProperties12.ts_0_721 | /// <reference path='fourslash.ts'/>
// @strictNullChecks: true
// @exactOptionalPropertyTypes: true
//// interface IC2 {
//// a?: number
//// }
//// interface J {
//// a?: number | undefined
//// }
//// declare var j: J
//// class C {
//// ic2: IC2
//// }
//// var c = new C()
//// c.ic2/**/ = j
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:
`interface IC2 {
a?: number | undefined
}
interface J {
a?: number | undefined
}
declare var j: J
class C {
ic2: IC2
}
var c = new C()
c.ic2 = j`,
});
| {
"end_byte": 721,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/fixExactOptionalUnassignableProperties12.ts"
} |
TypeScript/tests/cases/fourslash/renameDestructuringAssignmentInForOf.ts_0_596 | /// <reference path='fourslash.ts' />
////interface I {
//// [|[|{| "contextRangeIndex": 0 |}property1|]: number;|]
//// property2: string;
////}
////var elems: I[];
////
////var [|[|{| "contextRangeIndex": 2 |}property1|]: number|], p2: number;
////for ([|{ [|{| "contextRangeIndex": 4 |}property1|] } of elems|]) {
//// [|property1|]++;
////}
////for ([|{ [|{| "contextRangeIndex": 7 |}property1|]: p2 } of elems|]) {
////}
verify.noErrors();
const ranges = test.ranges();
const [r0Def, r0, r1Def, r1, r2Def, r2, r3, r4Def, r4] = ranges;
verify.baselineRename([r0, r4, r1, r2, r3]);
| {
"end_byte": 596,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameDestructuringAssignmentInForOf.ts"
} |
TypeScript/tests/cases/fourslash/organizeImports20.ts_0_182 | /// <reference path="fourslash.ts" />
////const a = 1;
////const b = 1;
////export { a };
////export { b };
verify.organizeImports(
`const a = 1;
const b = 1;
export { a, b };
`);
| {
"end_byte": 182,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImports20.ts"
} |
TypeScript/tests/cases/fourslash/referencesForInheritedProperties8.ts_3_282 | / <reference path='fourslash.ts'/>
//// interface C extends D {
//// /*d*/propD: number;
//// }
//// interface D extends C {
//// propD: string;
//// /*c*/propC: number;
//// }
//// var d: D;
//// d.propD;
//// d.propC;
verify.baselineFindAllReferences('d', 'c')
| {
"end_byte": 282,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForInheritedProperties8.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_functionExpression.ts_0_458 | /// <reference path='fourslash.ts' />
////const foo = /*a*/function/*b*/(a: number, b: number) { };
////foo(1, 2);
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert parameters to destructured object",
actionName: "Convert parameters to destructured object",
actionDescription: "Convert parameters to destructured object",
newContent: `const foo = function({ a, b }: { a: number; b: number; }) { };
foo({ a: 1, b: 2 });`
}); | {
"end_byte": 458,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_functionExpression.ts"
} |
TypeScript/tests/cases/fourslash/completionListInUnclosedDeleteExpression01.ts_0_127 | /// <reference path='fourslash.ts' />
////var x;
////var y = delete /*1*/
verify.completions({marker: "1", includes: "x" });
| {
"end_byte": 127,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedDeleteExpression01.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoForTypeParameterInTypeAlias1.ts_3_624 | /<reference path="fourslash.ts" />
//// type Ctor<AA> = new () => A/*1*/A;
//// type MixinCtor<AA> = new () => AA & { constructor: MixinCtor<A/*2*/A> };
//// type NestedCtor<AA> = new() => AA & (new () => AA & { constructor: NestedCtor<A/*3*/A> });
//// type Method<AA> = { method(): A/*4*/A };
//// type Construct<AA> = { new(): A/*5*/A };
verify.quickInfos({
1: "(type parameter) AA in type Ctor<AA>",
2: "(type parameter) AA in type MixinCtor<AA>",
3: "(type parameter) AA in type NestedCtor<AA>",
4: "(type parameter) AA in type Method<AA>",
5: "(type parameter) AA in type Construct<AA>"
});
| {
"end_byte": 624,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForTypeParameterInTypeAlias1.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoForJSDocUnknownTag.ts_0_726 | /// <reference path='fourslash.ts' />
/////**
//// * @example
//// * if (true) {
//// * foo()
//// * }
//// */
////function fo/*1*/o() {
//// return '2';
////}
/////**
//// @example
//// {
//// foo()
//// }
//// */
////function fo/*2*/o2() {
//// return '2';
////}
/////**
//// * @example
//// * x y
//// * 12345
//// * b
//// */
////function m/*3*/oo() {
//// return '2';
////}
/////**
//// * @func
//// * @example
//// * x y
//// * 12345
//// * b
//// */
////function b/*4*/oo() {
//// return '2';
////}
/////**
//// * @func
//// * @example x y
//// * 12345
//// * b
//// */
////function go/*5*/o() {
//// return '2';
////}
verify.baselineQuickInfo();
| {
"end_byte": 726,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForJSDocUnknownTag.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers1.ts_1_3543 | ////declare module "Multiline\r\nMadness" {
////}
////
////declare module "Multiline\
////Madness" {
////}
////declare module "MultilineMadness" {}
////
////declare module "Multiline\
////Madness2" {
////}
////
////interface Foo {
//// "a1\\\r\nb";
//// "a2\
//// \
//// b"(): Foo;
////}
////
////class Bar implements Foo {
//// 'a1\\\r\nb': Foo;
////
//// 'a2\
//// \
//// b'(): Foo {
//// return this;
//// }
////}
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "\"MultilineMadness\"",
"kind": "module",
"kindModifiers": "declare"
},
{
"text": "\"MultilineMadness2\"",
"kind": "module",
"kindModifiers": "declare"
},
{
"text": "\"Multiline\\r\\nMadness\"",
"kind": "module",
"kindModifiers": "declare"
},
{
"text": "Bar",
"kind": "class",
"childItems": [
{
"text": "'a1\\\\\\r\\nb'",
"kind": "property"
},
{
"text": "'a2 b'",
"kind": "method"
}
]
},
{
"text": "Foo",
"kind": "interface",
"childItems": [
{
"text": "\"a1\\\\\\r\\nb\"",
"kind": "property"
},
{
"text": "\"a2 b\"",
"kind": "method"
}
]
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "\"MultilineMadness\"",
"kind": "module",
"kindModifiers": "declare"
},
{
"text": "\"MultilineMadness2\"",
"kind": "module",
"kindModifiers": "declare"
},
{
"text": "\"Multiline\\r\\nMadness\"",
"kind": "module",
"kindModifiers": "declare"
},
{
"text": "Bar",
"kind": "class"
},
{
"text": "Foo",
"kind": "interface"
}
]
},
{
"text": "\"MultilineMadness\"",
"kind": "module",
"kindModifiers": "declare",
"indent": 1
},
{
"text": "\"MultilineMadness2\"",
"kind": "module",
"kindModifiers": "declare",
"indent": 1
},
{
"text": "\"Multiline\\r\\nMadness\"",
"kind": "module",
"kindModifiers": "declare",
"indent": 1
},
{
"text": "Bar",
"kind": "class",
"childItems": [
{
"text": "'a1\\\\\\r\\nb'",
"kind": "property"
},
{
"text": "'a2 b'",
"kind": "method"
}
],
"indent": 1
},
{
"text": "Foo",
"kind": "interface",
"childItems": [
{
"text": "\"a1\\\\\\r\\nb\"",
"kind": "property"
},
{
"text": "\"a2 b\"",
"kind": "method"
}
],
"indent": 1
}
]);
| {
"end_byte": 3543,
"start_byte": 1,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers1.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_existingImports1.ts_0_483 | /// <reference path='fourslash.ts' />
// @filename: /common.ts
////export const x = 1;
// @filename: /a.ts
////import { x } from "./common";
////[|export const bar = x;|]
// @filename: /b.ts
////import { x } from "./common";
////export const foo = x;
verify.moveToFile({
newFileContents: {
"/a.ts": "",
"/b.ts":
`import { x } from "./common";
export const foo = x;
export const bar = x;
`,
},
interactiveRefactorArguments: { targetFile: "/b.ts" },
}); | {
"end_byte": 483,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_existingImports1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingConstPreservingIndentation2.ts_0_356 | /// <reference path='fourslash.ts' />
////a = () => {
//// for (x in []) {
//// y = 0;
//// }
////};
////b = 3;
verify.codeFixAll({
fixId: "addMissingConst",
fixAllDescription: "Add 'const' to all unresolved variables",
newFileContent: `const a = () => {
for (const x in []) {
const y = 0;
}
};
const b = 3;`
});
| {
"end_byte": 356,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingConstPreservingIndentation2.ts"
} |
TypeScript/tests/cases/fourslash/contextualTypingFromTypeAssertion1.ts_0_171 | /// <reference path='fourslash.ts'/>
////var f3 = <(x: string) => string> function (/**/x) { return x.toLowerCase(); };
verify.quickInfoAt("", "(parameter) x: string");
| {
"end_byte": 171,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/contextualTypingFromTypeAssertion1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixChangeJSDocSyntax26.ts_0_171 | /// <reference path='fourslash.ts' />
////class C {
//// p: [|*|] = 12;
////}
verify.codeFix({
description: "Change '*' to 'any'",
newRangeContent: "any",
});
| {
"end_byte": 171,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixChangeJSDocSyntax26.ts"
} |
TypeScript/tests/cases/fourslash/refactorInferFunctionReturnType8.ts_0_406 | /// <reference path='fourslash.ts' />
////function /*a*/foo/*b*/() {
//// const bar = 1 as any;
//// return bar;
////}
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Infer function return type",
actionName: "Infer function return type",
actionDescription: "Infer function return type",
newContent:
`function foo(): any {
const bar = 1 as any;
return bar;
}`
});
| {
"end_byte": 406,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorInferFunctionReturnType8.ts"
} |
TypeScript/tests/cases/fourslash/getEmitOutputWithSyntacticErrorsForMultipleFiles.ts_0_488 | /// <reference path="fourslash.ts" />
// @BaselineFile: getEmitOutputWithSyntacticErrorsForMultipleFiles.baseline
// @Filename: inputFile1.ts
// @emitThisFile: true
//// // File to emit, does not contain syntactic errors
//// // expected to be emitted correctelly regardless of the syntactic errors in the other file
//// var noErrors = true;
// @Filename: inputFile2.ts
//// // File not emitted, and contains syntactic errors
//// var syntactic Error;
verify.baselineGetEmitOutput(); | {
"end_byte": 488,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEmitOutputWithSyntacticErrorsForMultipleFiles.ts"
} |
TypeScript/tests/cases/fourslash/refactorInferFunctionReturnType21.ts_0_540 | /// <reference path='fourslash.ts' />
////const f1 = /*a*//*b*/(x: number) => x;
////const f2 = (x: number) /*c*//*d*/=> x;
////const f3 = (x: number) => /*e*//*f*/x
////const f4= (x: number) => x/*g*//*h*/
goTo.select("a", "b");
verify.refactorAvailable("Infer function return type");
goTo.select("c", "d");
verify.not.refactorAvailable("Infer function return type");
goTo.select("e", "f");
verify.not.refactorAvailable("Infer function return type");
goTo.select("g", "h");
verify.not.refactorAvailable("Infer function return type");
| {
"end_byte": 540,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorInferFunctionReturnType21.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_updateNamespaceImport.ts_0_381 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////[|export const x = 0;|]
// @Filename: /x.ts
//// import * as a from "./a";
//// a.x;
// @Filename: /x.1.ts
////
verify.moveToNewFile({
newFileContents: {
"/a.ts":
``,
"/x.ts":
`import * as a from "./a";
import * as x2 from "./x.2";
x2.x;`,
"/x.2.ts":
`export const x = 0;
`,
},
}); | {
"end_byte": 381,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_updateNamespaceImport.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression1.ts_0_657 | /// <reference path="fourslash.ts" />
////function tempTag1<T>(templateStrs: TemplateStringsArray, f: (x: T) => T, x: T): T;
////function tempTag1<T>(templateStrs: TemplateStringsArray, f: (x: T) => T, h: (y: T) => T, x: T): T;
////function tempTag1<T>(...rest: any[]): T {
//// return undefined;
////}
////
////tempTag1 `${ x => /*0*/x }${ 10 }`;
////tempTag1 `${ x => /*1*/x }${ x => /*2*/x }${ 10 }`;
////tempTag1 `${ x => /*3*/x }${ (x: number) => /*4*/x }${ undefined }`;
////tempTag1 `${ (x: number) => /*5*/x }${ x => /*6*/x }${ undefined }`;
for (const marker of test.markerNames()) {
verify.quickInfoAt(marker, "(parameter) x: number");
}
| {
"end_byte": 657,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression1.ts"
} |
TypeScript/tests/cases/fourslash/completionsObjectLiteralMethod6.ts_0_331 | /// <reference path="fourslash.ts" />
// @Filename: a.ts
////type T = {
//// foo: () => Promise<void>;
////}
////const foo: T = {
//// async f/**/
////}
verify.completions({
marker: "",
includes: [
{
name: "foo",
sortText: completion.SortText.LocationPriority,
},
],
});
| {
"end_byte": 331,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsObjectLiteralMethod6.ts"
} |
TypeScript/tests/cases/fourslash/getJavaScriptCompletions9.ts_0_286 | ///<reference path="fourslash.ts" />
// @allowNonTsExtensions: true
// @Filename: Foo.js
/////**
//// * @type {function(new:number)}
//// */
////var v;
////new v()./**/
verify.completions({ marker: "", includes: { name: "toExponential", kind: "method", kindModifiers: "declare" } });
| {
"end_byte": 286,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptCompletions9.ts"
} |
TypeScript/tests/cases/fourslash/completionListAfterPropertyName.ts_0_2136 | ///<reference path="fourslash.ts" />
// @Filename: a.ts
////class Test1 {
//// public some /*afterPropertyName*/
////}
// @Filename: b.ts
////class Test2 {
//// public some(/*inMethodParameter*/
////}
// @Filename: c.ts
////class Test3 {
//// public some(a/*atMethodParameter*/
////}
// @Filename: d.ts
////class Test4 {
//// public some(a /*afterMethodParameter*/
////}
// @Filename: e.ts
////class Test5 {
//// public some(a /*afterMethodParameterBeforeComma*/,
////}
// @Filename: f.ts
////class Test6 {
//// public some(a, /*afterMethodParameterComma*/
////}
// @Filename: g.ts
////class Test7 {
//// constructor(/*inConstructorParameter*/
////}
// @Filename: h.ts
////class Test8 {
//// constructor(public /*inConstructorParameterAfterModifier*/
////}
// @Filename: i.ts
////class Test9 {
//// constructor(a/*atConstructorParameter*/
////}
// @Filename: j.ts
////class Test10 {
//// constructor(public/*atConstructorParameterModifier*/
////}
// @Filename: k.ts
////class Test11 {
//// constructor(public a/*atConstructorParameterAfterModifier*/
////}
// @Filename: l.ts
////class Test12 {
//// constructor(a /*afterConstructorParameter*/
////}
// @Filename: m.ts
////class Test13 {
//// constructor(a /*afterConstructorParameterBeforeComma*/,
////}
// @Filename: n.ts
////class Test14 {
//// constructor(public a, /*afterConstructorParameterComma*/
////}
verify.completions(
{
marker:[
"afterPropertyName",
"inMethodParameter",
"atMethodParameter",
"afterMethodParameter",
"afterMethodParameterBeforeComma",
"afterMethodParameterComma",
"afterConstructorParameter",
],
exact: undefined,
},
{
marker: [
"inConstructorParameter",
"inConstructorParameterAfterModifier",
"atConstructorParameter",
"atConstructorParameterModifier",
"atConstructorParameterAfterModifier",
"afterConstructorParameterComma",
],
exact: completion.constructorParameterKeywords,
isNewIdentifierLocation: true,
},
);
| {
"end_byte": 2136,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListAfterPropertyName.ts"
} |
TypeScript/tests/cases/fourslash/syntacticClassificationsTripleSlash7.ts_0_256 | /// <reference path="fourslash.ts"/>
//// /// <reference path=
const c = classification("original");
verify.syntacticClassificationsAre(
c.comment("/// "),
c.punctuation("<"),
c.jsxSelfClosingTagName("reference"),
c.comment(" path="));
| {
"end_byte": 256,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/syntacticClassificationsTripleSlash7.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesPublic2.ts_0_1482 | /// <reference path='fourslash.ts' />
////module m {
//// export class C1 {
//// public pub1;
//// public pub2;
//// private priv1;
//// private priv2;
//// protected prot1;
//// protected prot2;
////
//// public public;
//// private private;
//// protected protected;
////
//// public constructor(public a, private b, protected c, public d, private e, protected f) {
//// this.public = 10;
//// this.private = 10;
//// this.protected = 10;
//// }
////
//// public get x() { return 10; }
//// public set x(value) { }
////
//// public static statPub;
//// private static statPriv;
//// protected static statProt;
//// }
////
//// export interface I1 {
//// }
////
//// export declare module ma.m1.m2.m3 {
//// interface I2 {
//// }
//// }
////
//// export module mb.m1.m2.m3 {
//// declare var foo;
////
//// export class C2 {
//// [|public|] pub1;
//// private priv1;
//// protected prot1;
////
//// protected constructor([|public|] public, protected protected, private private) {
//// public = private = protected;
//// }
//// }
//// }
////
//// declare var ambientThing: number;
//// export var exportedThing = 10;
//// declare function foo(): string;
////}
verify.baselineDocumentHighlights();
| {
"end_byte": 1482,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesPublic2.ts"
} |
TypeScript/tests/cases/fourslash/documentHighlightDefaultInSwitch.ts_3_270 | / <reference path='fourslash.ts'/>
////const foo = 'foo';
////[|switch|] (foo) {
//// [|case|] 'foo':
//// [|break|];
//// [|default|]:
//// [|break|];
////}
const [r0, r1, r2, r3, r4] = test.ranges();
verify.baselineDocumentHighlights([r1, r4]);
| {
"end_byte": 270,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/documentHighlightDefaultInSwitch.ts"
} |
TypeScript/tests/cases/fourslash/autoImportPackageRootPath.ts_0_488 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: /node_modules/pkg/package.json
//// {
//// "name": "pkg",
//// "version": "1.0.0",
//// "main": "lib",
//// "module": "lib"
//// }
// @Filename: /node_modules/pkg/lib/index.js
//// export function foo() {};
// @Filename: /package.json
//// {
//// "dependencies": {
//// "pkg": "*"
//// }
//// }
// @Filename: /index.ts
//// foo/**/
verify.importFixModuleSpecifiers("", ["pkg"]);
| {
"end_byte": 488,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportPackageRootPath.ts"
} |
TypeScript/tests/cases/fourslash/annotateWithTypeFromJSDoc4.ts_0_948 | /// <reference path='fourslash.ts' />
// @strict: true
/////**
//// * @param {*} x
//// * @param {?} y
//// * @param {number=} z
//// * @param {...number} alpha
//// * @param {function(this:{ a: string}, string, number): boolean} beta
//// * @param {number?} gamma
//// * @param {number!} delta
//// */
////function [|f|](x, y, z, alpha, beta, gamma, delta) {
//// x; y; z; alpha; beta; gamma; delta;
////}
verify.codeFix({
description: "Annotate with type from JSDoc",
index: 7,
newFileContent:
`/**
* @param {*} x
* @param {?} y
* @param {number=} z
* @param {...number} alpha
* @param {function(this:{ a: string}, string, number): boolean} beta
* @param {number?} gamma
* @param {number!} delta
*/
function f(x: any, y: any, z: number | undefined, alpha: number[], beta: (this: { a: string; }, arg1: string, arg2: number) => boolean, gamma: number | null, delta: number) {
x; y; z; alpha; beta; gamma; delta;
}`,
});
| {
"end_byte": 948,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/annotateWithTypeFromJSDoc4.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoOnPropDeclaredUsingIndexSignatureOnInterfaceWithBase.ts_0_283 | /// <reference path="fourslash.ts" />
// https://github.com/microsoft/TypeScript/issues/55251
//// interface P {}
//// interface B extends P {
//// [k: string]: number;
//// }
//// declare const b: B;
//// b.t/*1*/est = 10;
verify.quickInfoAt("1", "(index) B[string]: number");
| {
"end_byte": 283,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnPropDeclaredUsingIndexSignatureOnInterfaceWithBase.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports52-generics-oversimplification.ts_0_707 | /// <reference path='fourslash.ts'/>
// In the abstract, we might prefer the inferred return type annotation to
// be identical to the parameter type (with 2 type parameters).
// Our current heuristic to avoid overly complex types in this case creates
// "overly simple" types, but this tradeoff seems reasonable.
// @isolatedDeclarations: true
// @declaration: true
////export interface Foo<T, U = T[]> {}
////export function foo(x: Foo<string, string[]>) {
//// return x;
////}
verify.codeFix({
description: "Add return type 'Foo<string>'",
index: 0,
newFileContent:
`export interface Foo<T, U = T[]> {}
export function foo(x: Foo<string, string[]>): Foo<string> {
return x;
}`,
});
| {
"end_byte": 707,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports52-generics-oversimplification.ts"
} |
TypeScript/tests/cases/fourslash/getImportsTslib.ts_0_473 | ///<reference path="fourslash.ts"/>
// @importHelpers: true
// @target: es2015
// @lib: es2015
// @module: commonjs
// @Filename: /node_modules/tslib/index.d.ts
//// export function __awaiter(...args: any): any;
// @Filename: /first.ts
//// export function foo() {
//// return 2
//// }
// @Filename: /index.ts
//// export async function importer() {
//// const mod = await import("./first");
//// }
verify.noErrors()
verify.getImports('/index.ts', ['/first.ts'])
| {
"end_byte": 473,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getImportsTslib.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoDisplayPartsClassAccessors.ts_0_1658 | /// <reference path='fourslash.ts'/>
////class c {
//// public get /*1*/publicProperty() { return ""; }
//// public set /*1s*/publicProperty(x: string) { }
//// private get /*2*/privateProperty() { return ""; }
//// private set /*2s*/privateProperty(x: string) { }
//// protected get /*21*/protectedProperty() { return ""; }
//// protected set /*21s*/protectedProperty(x: string) { }
//// static get /*3*/staticProperty() { return ""; }
//// static set /*3s*/staticProperty(x: string) { }
//// private static get /*4*/privateStaticProperty() { return ""; }
//// private static set /*4s*/privateStaticProperty(x: string) { }
//// protected static get /*41*/protectedStaticProperty() { return ""; }
//// protected static set /*41s*/protectedStaticProperty(x: string) { }
//// method() {
//// var x : string;
//// x = this./*5*/publicProperty;
//// x = this./*6*/privateProperty;
//// x = this./*61*/protectedProperty;
//// x = c./*7*/staticProperty;
//// x = c./*8*/privateStaticProperty;
//// x = c./*81*/protectedStaticProperty;
//// this./*5s*/publicProperty = "";
//// this./*6s*/privateProperty = "";
//// this./*61s*/protectedProperty = "";
//// c./*7s*/staticProperty = "";
//// c./*8s*/privateStaticProperty = "";
//// c./*81s*/protectedStaticProperty = "";
//// }
////}
////var cInstance = new c();
////var y: string;
////y = /*9*/cInstance./*10*/publicProperty;
////y = /*11*/c./*12*/staticProperty;
/////*9s*/cInstance./*10s*/publicProperty = y;
/////*11s*/c./*12s*/staticProperty = y;
verify.baselineQuickInfo(); | {
"end_byte": 1658,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoDisplayPartsClassAccessors.ts"
} |
TypeScript/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction19.ts_0_350 | /// <reference path='fourslash.ts' />
//// const foo = /*a*/a/*b*/ => { return a; };
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Add or remove braces in an arrow function",
actionName: "Remove braces from arrow function",
actionDescription: "Remove braces from arrow function",
newContent: `const foo = a => a;`,
});
| {
"end_byte": 350,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction19.ts"
} |
TypeScript/tests/cases/fourslash/completionImportCallAssertion.ts_0_243 | /// <reference path='fourslash.ts' />
// @target: esnext
// @module: esnext
// @filename: main.ts
////import("./other.json", {/*0*/});
////import("./other.json", { asse/*1*/});
// @filename: other.json
////{}
verify.baselineCompletions();
| {
"end_byte": 243,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionImportCallAssertion.ts"
} |
TypeScript/tests/cases/fourslash/completionListInUnclosedTemplate02.ts_0_183 | /// <reference path='fourslash.ts' />
////var x;
////var y = (p) => `abc ${ 123 } ${ /*1*/
verify.completions({ marker: "1", includes: ["p", "x"], isNewIdentifierLocation: true });
| {
"end_byte": 183,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedTemplate02.ts"
} |
TypeScript/tests/cases/fourslash/formatArrayLiteralExpression.ts_0_1220 | ///<reference path='fourslash.ts' />
////export let Things = [{
//// Hat: 'hat', /*1*/
//// Glove: 'glove',
//// Umbrella: 'umbrella'
////},{/*2*/
//// Salad: 'salad', /*3*/
//// Burrito: 'burrito',
//// Pie: 'pie'
//// }];/*4*/
////
////export let Things2 = [
////{
//// Hat: 'hat', /*5*/
//// Glove: 'glove',
//// Umbrella: 'umbrella'
////}/*6*/,
//// {
//// Salad: 'salad', /*7*/
//// Burrito: ['burrito', 'carne asada', 'tinga de res', 'tinga de pollo'], /*8*/
//// Pie: 'pie'
//// }];/*9*/
format.document();
goTo.marker("1");
verify.currentLineContentIs(" Hat: 'hat',");
goTo.marker("2");
verify.currentLineContentIs("}, {");
goTo.marker("3");
verify.currentLineContentIs(" Salad: 'salad',");
goTo.marker("4");
verify.currentLineContentIs("}];");
goTo.marker("5");
verify.currentLineContentIs(" Hat: 'hat',");
goTo.marker("6");
verify.currentLineContentIs(" },");
goTo.marker("7");
verify.currentLineContentIs(" Salad: 'salad',");
goTo.marker("8");
verify.currentLineContentIs(" Burrito: ['burrito', 'carne asada', 'tinga de res', 'tinga de pollo'],");
goTo.marker("9");
verify.currentLineContentIs(" }];");
| {
"end_byte": 1220,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatArrayLiteralExpression.ts"
} |
TypeScript/tests/cases/fourslash/getEmitOutputTsxFile_Preserve.ts_0_457 | /// <reference path="fourslash.ts" />
// @BaselineFile: getEmitOutputTsxFile_Preserve.baseline
// @declaration: true
// @sourceMap: true
// @jsx: preserve
// @Filename: inputFile1.ts
// @emitThisFile: true
////// regular ts file
//// var t: number = 5;
//// class Bar {
//// x : string;
//// y : number
//// }
// @Filename: inputFile2.tsx
// @emitThisFile: true
//// var y = "my div";
//// var x = <div name= {y} />
verify.baselineGetEmitOutput(); | {
"end_byte": 457,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEmitOutputTsxFile_Preserve.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiation.ts_0_149 | /// <reference path='fourslash.ts' />
//// interface I<T> {
//// x: T;
//// }
////
//// class C implements I { }
verify.not.codeFixAvailable();
| {
"end_byte": 149,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiation.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingNew4.ts_0_276 | /// <reference path='fourslash.ts' />
////class C {
////}
////class D {
////}
////let x = (true ? C : D)();
verify.codeFix({
description: "Add missing 'new' operator to call",
index: 0,
newFileContent:
`class C {
}
class D {
}
let x = new (true ? C : D)();`
});
| {
"end_byte": 276,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingNew4.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateComment.ts_0_516 | /// <reference path='fourslash.ts' />
//// const foo = /* C0 */ /*x*/"/*y*/foo" /* C1 */ + " is" /* C2 */ + 42 /* C3 */ + " and bar" /* C4 */ + " is" /* C5 */ + 52/* C6 */
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert to template string",
actionName: "Convert to template string",
actionDescription: ts.Diagnostics.Convert_to_template_string.message,
newContent:
"const foo = /* C0 */ `foo is\${ /* C1 */ /* C2 */42 /* C3 */} and bar is\${ /* C4 */ /* C5 */52 /* C6 */}`",
});
| {
"end_byte": 516,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateComment.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsCatchClause.ts_0_143 | /// <reference path="fourslash.ts" />
////try { }
////catch (/*1*/err) {
//// /*2*/err;
////}
verify.baselineFindAllReferences('1', '2');
| {
"end_byte": 143,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsCatchClause.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInvalidJsxCharacters9.ts_0_332 | /// <reference path='fourslash.ts' />
// @jsx: react
// @filename: main.tsx
//// let foo = <div>></div>;
verify.codeFix({
index: 0,
description: ts.Diagnostics.Wrap_invalid_character_in_an_expression_container.message,
newFileContent: `let foo = <div>{'>'}</div>;`,
preferences: { quotePreference: "single" }
});
| {
"end_byte": 332,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInvalidJsxCharacters9.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_super2.ts_0_462 | /// <reference path='fourslash.ts' />
// @noUnusedParameters: true
//// class Base {
//// constructor(x: number) {} // Remove unused parameter
//// }
////
//// class Derived extends Base {
//// constructor() {
//// super();
//// }
//// }
// No codefix to remove a non-last parameter in a callback
verify.codeFixAvailable([
{ description: "Remove unused declaration for: 'x'" },
{ description: "Prefix 'x' with an underscore" }
]);
| {
"end_byte": 462,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUnusedIdentifier_super2.ts"
} |
TypeScript/tests/cases/fourslash/consistenceOnIndentionsOfObjectsInAListAfterFormatting.ts_0_205 | /// <reference path='fourslash.ts' />
////foo({
////}, {/*1*/
////});/*2*/
format.document();
goTo.marker("1");
verify.currentLineContentIs("}, {");
goTo.marker("2");
verify.currentLineContentIs("});");
| {
"end_byte": 205,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/consistenceOnIndentionsOfObjectsInAListAfterFormatting.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration5.ts_0_309 | /// <reference path='fourslash.ts' />
////foo<string, number>();
verify.codeFix({
index: 0,
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"],
newFileContent:
`foo<string, number>();
function foo<T, U>() {
throw new Error("Function not implemented.");
}
`
});
| {
"end_byte": 309,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration5.ts"
} |
TypeScript/tests/cases/fourslash/completionsForStringDependingOnContexSensitiveSignature.ts_0_1077 | /// <reference path="fourslash.ts" />
// @strict: true
////
//// type ActorRef<TEvent extends { type: string }> = {
//// send: (ev: TEvent) => void
//// }
////
//// type Action<TContext> = {
//// (ctx: TContext): void
//// }
////
//// type Config<TContext> = {
//// entry: Action<TContext>
//// }
////
//// declare function createMachine<TContext>(config: Config<TContext>): void
////
//// type EventFrom<T> = T extends ActorRef<infer TEvent> ? TEvent : never
////
//// declare function sendTo<
//// TContext,
//// TActor extends ActorRef<any>
//// >(
//// actor: ((ctx: TContext) => TActor),
//// event: EventFrom<TActor>
//// ): Action<TContext>
////
//// createMachine<{
//// child: ActorRef<{ type: "EVENT" }>;
//// }>({
//// entry: sendTo((ctx) => ctx.child, { type: /*1*/ }),
//// });
////
//// createMachine<{
//// child: ActorRef<{ type: "EVENT" }>;
//// }>({
//// entry: sendTo((ctx) => ctx.child, { type: "/*2*/" }),
//// });
verify.completions({ marker: "1", includes: [`"EVENT"`] })
verify.completions({ marker: "2", exact: [`EVENT`] }) | {
"end_byte": 1077,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsForStringDependingOnContexSensitiveSignature.ts"
} |
TypeScript/tests/cases/fourslash/completionListInUnclosedFunction17.ts_3_356 | / <reference path="fourslash.ts" />
////interface MyType {
////}
////
////function foo(x: string, y: number, z: boolean) {
//// function bar(a: number, b: string = "hello", c: typeof x = "hello") {
//// var v = (p: MyType) => y + /*1*/
verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] });
| {
"end_byte": 356,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedFunction17.ts"
} |
TypeScript/tests/cases/fourslash/completionListBeforeNewScope01.ts_0_197 | /// <reference path='fourslash.ts' />
////p/*1*/
////
////function fun(param) {
//// let party = Math.random() < 0.99;
////}
verify.completions({ marker: "1", excludes: ["param", "party"] });
| {
"end_byte": 197,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListBeforeNewScope01.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.