_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/fourslash/formattingConditionalTypes.ts_0_369 | /// <reference path='fourslash.ts'/>
/////*L1*/type Diff1<T, U> = T extends U?never:T;
/////*L2*/type Diff2<T, U> = T extends U ? never : T;
format.document();
goTo.marker("L1");
verify.currentLineContentIs("type Diff1<T, U> = T extends U ? never : T;");
goTo.marker("L2");
verify.currentLineContentIs("type Diff2<T, U> = T extends U ? never : T;"); | {
"end_byte": 369,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingConditionalTypes.ts"
} |
TypeScript/tests/cases/fourslash/jsdocLink3.ts_0_429 | ///<reference path="fourslash.ts" />
// @Filename: /jsdocLink3.ts
//// export class C {
//// }
// @Filename: /module1.ts
//// import { C } from './jsdocLink3'
//// /**
//// * {@link C}
//// * @wat Makes a {@link C}. A default one.
//// * {@link C()}
//// * {@link C|postfix text}
//// * {@link unformatted postfix text}
//// * @see {@link C} its great
//// */
//// function /**/CC() {
//// }
verify.baselineQuickInfo();
| {
"end_byte": 429,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocLink3.ts"
} |
TypeScript/tests/cases/fourslash/jsxTagNameCompletionUnderElementClosed.ts_0_1037 | /// <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": 1037,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsxTagNameCompletionUnderElementClosed.ts"
} |
TypeScript/tests/cases/fourslash/semanticModernClassificationMembers.ts_0_857 | //// class A {
//// static x = 9;
//// f = 9;
//// async m() { return A.x + await this.m(); };
//// get s() { return this.f;
//// static t() { return new A().f; };
//// constructor() {}
//// }
const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("class.declaration", "A"),
c2.semanticToken("property.declaration.static", "x"),
c2.semanticToken("property.declaration", "f"),
c2.semanticToken("member.declaration.async", "m"),
c2.semanticToken("class", "A"),
c2.semanticToken("property.static", "x"),
c2.semanticToken("member.async", "m"),
c2.semanticToken("property.declaration", "s"),
c2.semanticToken("property", "f"),
c2.semanticToken("member.declaration.static", "t"),
c2.semanticToken("class", "A"),
c2.semanticToken("property", "f"),
);; | {
"end_byte": 857,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/semanticModernClassificationMembers.ts"
} |
TypeScript/tests/cases/fourslash/completionsWithDeprecatedTag9.ts_0_580 | /// <reference path="fourslash.ts" />
// @lib: dom
// @allowJs: true
// @Filename: globals.d.ts
/////** @deprecated foo */
////declare var foo: string;
// @Filename: index.ts
////class Foo {
//// foo: number;
//// m() {
//// foo/**/
//// }
////}
verify.completions({
marker: "",
includes: [{
name: "foo",
kind: "var",
kindModifiers: "deprecated,declare",
sortText: completion.SortText.Deprecated(completion.SortText.GlobalsOrKeywords),
}]
}, {
preferences: {
includeInsertTextCompletions: true
}
});
| {
"end_byte": 580,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsWithDeprecatedTag9.ts"
} |
TypeScript/tests/cases/fourslash/pathCompletionsPackageJsonExportsWildcard7.ts_0_481 | /// <reference path="fourslash.ts" />
// @module: nodenext
// @Filename: /node_modules/foo/package.json
//// {
//// "name": "foo",
//// "exports": {
//// "./*": "./dist/*.js"
//// }
//// }
// @Filename: /node_modules/foo/dist/blah.d.ts
//// export const blah = 0;
// @Filename: /index.mts
//// import { } from "foo//**/";
verify.completions({
marker: "",
isNewIdentifierLocation: true,
exact: [
{ name: "blah", kind: "script", kindModifiers: "" },
]
});
| {
"end_byte": 481,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/pathCompletionsPackageJsonExportsWildcard7.ts"
} |
TypeScript/tests/cases/fourslash/completionListInObjectLiteral6.ts_0_510 | /// <reference path='fourslash.ts'/>
////const foo = {
//// a: "a",
//// b: "b"
////};
////function fn<T extends { [key: string]: any }>(obj: T, events: { [Key in `on_${string & keyof T}`]?: Key }) {}
////
////fn(foo, {
//// /*1*/
////})
////fn({ a: "a", b: "b" }, {
//// /*2*/
////})
verify.completions({
marker: ["1", "2"],
exact: [
{ name: "on_a", sortText: completion.SortText.OptionalMember },
{ name: "on_b", sortText: completion.SortText.OptionalMember }
]
});
| {
"end_byte": 510,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInObjectLiteral6.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAwaitInSyncFunction16.ts_0_338 | /// <reference path='fourslash.ts' />
////function foo() {
//// const foo = await(Promise.resolve(1));
//// return foo;
////}
verify.codeFix({
index: 0,
description: "Add async modifier to containing function",
newFileContent:
`async function foo() {
const foo = await(Promise.resolve(1));
return foo;
}`,
});
| {
"end_byte": 338,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAwaitInSyncFunction16.ts"
} |
TypeScript/tests/cases/fourslash/jsDocSee4.ts_0_411 | ///<reference path="fourslash.ts" />
//// class [|/*def1*/A|] {
//// foo () { }
//// }
//// declare const [|/*def2*/a|]: A;
//// /**
//// * @see {/*use1*/[|A|]#foo}
//// */
//// const t1 = 1
//// /**
//// * @see {/*use2*/[|a|].foo()}
//// */
//// const t2 = 1
//// /**
//// * @see {@link /*use3*/[|a|].foo()}
//// */
//// const t3 = 1
verify.baselineGetDefinitionAtPosition("use1", "use2", "use3");
| {
"end_byte": 411,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocSee4.ts"
} |
TypeScript/tests/cases/fourslash/completionListInObjectBindingPattern12.ts_0_257 | /// <reference path='fourslash.ts'/>
////interface I {
//// property1: number;
//// property2: string;
////}
////
////function f({ property1, /**/ }: I): void {
////}
verify.completions({ marker: "", includes: "property2", excludes: "property1" });
| {
"end_byte": 257,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInObjectBindingPattern12.ts"
} |
TypeScript/tests/cases/fourslash/memberListInsideObjectLiterals.ts_0_805 | /// <reference path='fourslash.ts'/>
////module ObjectLiterals {
//// interface MyPoint {
//// x1: number;
//// y1: number;
//// }
////
//// var p1: MyPoint = {
//// /*1*/
//// };
////
//// var p2: MyPoint = {
//// x1: 5,
//// /*2*/
//// };
////
//// var p3: MyPoint = {
//// x1/*3*/:
//// };
////
//// var p4: MyPoint = {
//// /*4*/y1
//// };
////}
const x1 = { name: "x1", text: "(property) MyPoint.x1: number" };
const y1 = { name: "y1", text: "(property) MyPoint.y1: number" };
verify.completions(
{ marker: ["1", "3", "4"], exact: [x1, y1] }, // Literal member completion inside empty literal or at existing member name location
{ marker: ["2"], exact: y1 }, // Literal member completion for 2nd member name
);
| {
"end_byte": 805,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberListInsideObjectLiterals.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts_0_235 | /// <reference path='fourslash.ts'/>
////interface I {
//// /*1*/property1: number;
//// property2: string;
////}
////
////var foo: I;
/////*2*/var { /*3*/property1: {} } = foo;
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 235,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts"
} |
TypeScript/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts_0_479 | /// <reference path='fourslash.ts'/>
//// export interface Configfiles {
//// jspm: string;
//// 'jspm:browser': string;
//// }
//// let files: Configfiles;
//// files = {
//// /*0*/: '',
//// '[|/*1*/|]': ''
//// }
const replacementSpan = test.ranges()[0]
verify.completions(
{ marker: "0", exact: ['"jspm:browser"', "jspm"] },
{ marker: "1", exact: [
{ name: "jspm", replacementSpan },
{ name: "jspm:browser", replacementSpan }
] },
);
| {
"end_byte": 479,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts"
} |
TypeScript/tests/cases/fourslash/jsdocParameterNameCompletion.ts_0_557 | ///<reference path="fourslash.ts" />
/////**
//// * @param /*0*/
//// */
////function f(foo, bar) {}
/////**
//// * @param foo
//// * @param /*1*/
//// */
////function g(foo, bar) {}
/////**
//// * @param can/*2*/
//// * @param cantaloupe
//// */
////function h(cat, canary, canoodle, cantaloupe, zebra) {}
/////**
//// * @param /*3*/ {string} /*4*/
//// */
////function i(foo, bar) {}
verify.completions(
{ marker: ["0", "3", "4"], exact: ["foo", "bar"] },
{ marker: "1", exact: "bar" },
{ marker: "2", exact: ["canary", "canoodle"] },
);
| {
"end_byte": 557,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocParameterNameCompletion.ts"
} |
TypeScript/tests/cases/fourslash/completionsObjectLiteralExpressions2.ts_0_1058 | /// <reference path="fourslash.ts" />
//// interface ColorPalette {
//// primary?: string;
//// secondary?: string;
//// }
//// interface I {
//// color: ColorPalette;
//// }
//// const a: I = {
//// color: {primary: "red" /**/}
//// }
verify.completions({
marker: "",
includes: [{
name: "secondary",
sortText: completion.SortText.OptionalMember,
hasAction: true,
source: completion.CompletionSource.ObjectLiteralMemberWithComma,
}],
preferences: {
allowIncompleteCompletions: true,
includeInsertTextCompletions: true,
}
});
verify.applyCodeActionFromCompletion("", {
name: "secondary",
description: `Add missing comma for object member completion 'secondary'.`,
source: completion.CompletionSource.ObjectLiteralMemberWithComma,
newFileContent:
`interface ColorPalette {
primary?: string;
secondary?: string;
}
interface I {
color: ColorPalette;
}
const a: I = {
color: {primary: "red", }
}`,
preferences: {
allowIncompleteCompletions: true,
includeInsertTextCompletions: true,
},
});
| {
"end_byte": 1058,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsObjectLiteralExpressions2.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpSkippedArgs1.ts_0_169 | /// <reference path="fourslash.ts" />
//// function fn(a: number, b: number, c: number) {}
//// fn(/*1*/, /*2*/, /*3*/, /*4*/, /*5*/);
verify.baselineSignatureHelp();
| {
"end_byte": 169,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpSkippedArgs1.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionImport1.ts_0_192 | /// <reference path='fourslash.ts'/>
// @Filename: /b.ts
/////*2*/export const foo = 1;
// @Filename: /a.ts
////import { foo } from [|"./b/*1*/"|];
verify.baselineGoToDefinition("1");
| {
"end_byte": 192,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionImport1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties16.ts_0_3379 | /// <reference path='fourslash.ts' />
////type A = 'a' | 'b' | 'c' | 'd' | 'e';
////type B = 1 | 2 | 3;
////type C = '@' | '!';
////type D = `${A}${Uppercase<A>}${B}${C}`;
////
////[|const names: { [K in D]: K } = {};|]
verify.codeFix({
index: 0,
description: ts.Diagnostics.Add_missing_properties.message,
newRangeContent:
`const names: { [K in D]: K } = {
"aA1@": "aA1@",
"aA1!": "aA1!",
"aA2@": "aA2@",
"aA2!": "aA2!",
"aA3@": "aA3@",
"aA3!": "aA3!",
"aB1@": "aB1@",
"aB1!": "aB1!",
"aB2@": "aB2@",
"aB2!": "aB2!",
"aB3@": "aB3@",
"aB3!": "aB3!",
"aC1@": "aC1@",
"aC1!": "aC1!",
"aC2@": "aC2@",
"aC2!": "aC2!",
"aC3@": "aC3@",
"aC3!": "aC3!",
"aD1@": "aD1@",
"aD1!": "aD1!",
"aD2@": "aD2@",
"aD2!": "aD2!",
"aD3@": "aD3@",
"aD3!": "aD3!",
"aE1@": "aE1@",
"aE1!": "aE1!",
"aE2@": "aE2@",
"aE2!": "aE2!",
"aE3@": "aE3@",
"aE3!": "aE3!",
"bA1@": "bA1@",
"bA1!": "bA1!",
"bA2@": "bA2@",
"bA2!": "bA2!",
"bA3@": "bA3@",
"bA3!": "bA3!",
"bB1@": "bB1@",
"bB1!": "bB1!",
"bB2@": "bB2@",
"bB2!": "bB2!",
"bB3@": "bB3@",
"bB3!": "bB3!",
"bC1@": "bC1@",
"bC1!": "bC1!",
"bC2@": "bC2@",
"bC2!": "bC2!",
"bC3@": "bC3@",
"bC3!": "bC3!",
"bD1@": "bD1@",
"bD1!": "bD1!",
"bD2@": "bD2@",
"bD2!": "bD2!",
"bD3@": "bD3@",
"bD3!": "bD3!",
"bE1@": "bE1@",
"bE1!": "bE1!",
"bE2@": "bE2@",
"bE2!": "bE2!",
"bE3@": "bE3@",
"bE3!": "bE3!",
"cA1@": "cA1@",
"cA1!": "cA1!",
"cA2@": "cA2@",
"cA2!": "cA2!",
"cA3@": "cA3@",
"cA3!": "cA3!",
"cB1@": "cB1@",
"cB1!": "cB1!",
"cB2@": "cB2@",
"cB2!": "cB2!",
"cB3@": "cB3@",
"cB3!": "cB3!",
"cC1@": "cC1@",
"cC1!": "cC1!",
"cC2@": "cC2@",
"cC2!": "cC2!",
"cC3@": "cC3@",
"cC3!": "cC3!",
"cD1@": "cD1@",
"cD1!": "cD1!",
"cD2@": "cD2@",
"cD2!": "cD2!",
"cD3@": "cD3@",
"cD3!": "cD3!",
"cE1@": "cE1@",
"cE1!": "cE1!",
"cE2@": "cE2@",
"cE2!": "cE2!",
"cE3@": "cE3@",
"cE3!": "cE3!",
"dA1@": "dA1@",
"dA1!": "dA1!",
"dA2@": "dA2@",
"dA2!": "dA2!",
"dA3@": "dA3@",
"dA3!": "dA3!",
"dB1@": "dB1@",
"dB1!": "dB1!",
"dB2@": "dB2@",
"dB2!": "dB2!",
"dB3@": "dB3@",
"dB3!": "dB3!",
"dC1@": "dC1@",
"dC1!": "dC1!",
"dC2@": "dC2@",
"dC2!": "dC2!",
"dC3@": "dC3@",
"dC3!": "dC3!",
"dD1@": "dD1@",
"dD1!": "dD1!",
"dD2@": "dD2@",
"dD2!": "dD2!",
"dD3@": "dD3@",
"dD3!": "dD3!",
"dE1@": "dE1@",
"dE1!": "dE1!",
"dE2@": "dE2@",
"dE2!": "dE2!",
"dE3@": "dE3@",
"dE3!": "dE3!",
"eA1@": "eA1@",
"eA1!": "eA1!",
"eA2@": "eA2@",
"eA2!": "eA2!",
"eA3@": "eA3@",
"eA3!": "eA3!",
"eB1@": "eB1@",
"eB1!": "eB1!",
"eB2@": "eB2@",
"eB2!": "eB2!",
"eB3@": "eB3@",
"eB3!": "eB3!",
"eC1@": "eC1@",
"eC1!": "eC1!",
"eC2@": "eC2@",
"eC2!": "eC2!",
"eC3@": "eC3@",
"eC3!": "eC3!",
"eD1@": "eD1@",
"eD1!": "eD1!",
"eD2@": "eD2@",
"eD2!": "eD2!",
"eD3@": "eD3@",
"eD3!": "eD3!",
"eE1@": "eE1@",
"eE1!": "eE1!",
"eE2@": "eE2@",
"eE2!": "eE2!",
"eE3@": "eE3@",
"eE3!": "eE3!"
};`
});
| {
"end_byte": 3379,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties16.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType23.ts_0_406 | /// <reference path='fourslash.ts' />
//// type A<T, U> = () => <T>(v: T) => (v: T) => <T>(v: T) => /*a*/U/*b*/;
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<U> = U;
type A<T, U> = () => <T>(v: T) => (v: T) => <T>(v: T) => NewType<U>;`,
});
| {
"end_byte": 406,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType23.ts"
} |
TypeScript/tests/cases/fourslash/jsDocPropertyDescription11.ts_0_427 | ///<reference path="fourslash.ts" />
//// type AliasExample = {
//// /** Something generic */
//// [p: string]: string;
//// /** Something else */
//// [key: `any${string}`]: string;
//// }
//// function aliasExample(e: AliasExample) {
//// console.log(e./*alias*/anything);
//// }
verify.quickInfoAt("alias", "(index) AliasExample[string | `any${string}`]: string", "Something generic\nSomething else");
| {
"end_byte": 427,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocPropertyDescription11.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_overloads2.ts_0_548 | /// <reference path='fourslash.ts' />
// @Filename: /add.ts
////
// @Filename: /a.ts
////function add(x: number, y: number): number;
////function add(x: string, y: string): string;
////[|function add(x: any, y: any) {
//// return x + y;
////}|]
verify.moveToFile({
newFileContents: {
"/a.ts": "",
"/add.ts":
`
function add(x: number, y: number): number;
function add(x: string, y: string): string;
function add(x: any, y: any) {
return x + y;
}
`
},
interactiveRefactorArguments: { targetFile: "/add.ts" }
});
| {
"end_byte": 548,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_overloads2.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpTaggedTemplates2.ts_0_560 | /// <reference path='fourslash.ts' />
//// function f(templateStrings, x, y, z) { return 10; }
//// function g(templateStrings, x, y, z) { return ""; }
////
//// f `/*1*/ qwe/*2*/rty /*3*/$/*4*/{ 123 }/*5*/ as/*6*/df /*7*/$/*8*/{ 41234 }/*9*/ zxc/*10*/vb /*11*/$/*12*/{ g ` ` }/*13*/ /*14*/ /*15*/
verify.signatureHelp({
marker: test.markers(),
text: "f(templateStrings: any, x: any, y: any, z: any): number",
argumentCount: 4,
parameterCount: 4,
parameterName: "templateStrings",
parameterSpan: "templateStrings: any",
});
| {
"end_byte": 560,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpTaggedTemplates2.ts"
} |
TypeScript/tests/cases/fourslash/circularGetTypeAtLocation.ts_0_966 | /// <reference path='fourslash.ts' />
// Issue #48313
// @strict: true
// @target: esnext
// @Filename: /file.tsx
//// export function working(baseVersion?: string): number[] {
//// const toRelease: number[] = [];
//// const baseRelease: number[] = [];
//// return baseRelease.map((_, index) => {
//// const toPart = toRelease[index] ?? 0;
//// [|toPart|]; // this is the "working" log
//// return 0;
//// });
//// }
////
//// export function broken(baseVersion?: string): number[] {
//// const toRelease: number[] = [];
//// const baseRelease: number[] = [];
//// return baseRelease.map((_, index) => {
//// const toPart = toRelease[index] ?? 0;
//// [|toPart|]; // this is the "broken" log
//// return toPart + (baseVersion === undefined ? 0 : 1);
//// });
//// }
const [r_ok, r_bad] = test.ranges();
verify.typeAtLocation(r_ok, "number");
verify.typeAtLocation(r_bad, "number");
| {
"end_byte": 966,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/circularGetTypeAtLocation.ts"
} |
TypeScript/tests/cases/fourslash/outliningSpansSwitchCases.ts_0_640 | /// <reference path="fourslash.ts" />
////switch (undefined)[| {
//// case 0:[|
//// console.log(1)
//// console.log(2)
//// break;
//// console.log(3);|]
//// case 1:[|
//// break;|]
//// case 2:[|
//// break;
//// console.log(3);|]
//// case 3:[|
//// console.log(4);|]
////
//// case 4:
//// case 5:
//// case 6:[|
////
////
//// console.log(5);|]
////
//// case 7:[| console.log(6);|]
////
//// case 8:[| [|{
//// console.log(8);
//// break;
//// }|]
//// console.log(8);|]
////
//// default:[|
//// console.log(7);
//// console.log(8);|]
////}|]
verify.outliningSpansInCurrentFile(test.ranges(), "code");
| {
"end_byte": 640,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/outliningSpansSwitchCases.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_TemplateString8.ts_0_643 | /// <reference path='fourslash.ts' />
////const a = 1;
////const b = 1;
////const c = 1;
////const d = 1;
////const d = `a${/* a */ a /* a */} ${b}` + /*start*/" other "/*end*/ + c + `${/* d */ d /* d */}`;
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 a = 1;",
"const b = 1;",
"const c = 1;",
"const d = 1;",
"const d = `a${/* a */ a /* a */} ${b} other ${c}${/* d */ d /* d */}`;"
].join("\n")
});
| {
"end_byte": 643,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_TemplateString8.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertExport_namedToDefault1.ts_0_889 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
/////*a*/export function f() {}/*b*/
// @Filename: /b.ts
////import { f } from "./a";
////import { f as g } from "./a";
////import { f, other } from "./a";
////
////export { f } from "./a";
////export { f as i } from "./a";
////export { f as default } from "./a";
////
////import * as a from "./a";
////a.f();
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert export",
actionName: "Convert named export to default export",
actionDescription: "Convert named export to default export",
newContent: {
"/a.ts":
`export default function f() {}`,
"/b.ts":
`import f from "./a";
import g from "./a";
import f, { other } from "./a";
export { default as f } from "./a";
export { default as i } from "./a";
export { default } from "./a";
import * as a from "./a";
a.default();`,
},
});
| {
"end_byte": 889,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertExport_namedToDefault1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingMember_classIsNotFirstDeclaration.ts_0_254 | /// <reference path='fourslash.ts' />
////interface C {}
////class C {
////}
////new C().x = 0;
verify.codeFix({
description: "Declare property 'x'",
index: 0,
newFileContent:
`interface C {}
class C {
x: number;
}
new C().x = 0;`,
});
| {
"end_byte": 254,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingMember_classIsNotFirstDeclaration.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationDestructuringForOfArrayBindingPatternDefaultValues.ts_0_3290 | /// <reference path='fourslash.ts' />
////declare var console: {
//// log(msg: any): void;
////}
////type Robot = [number, string, string];
////type MultiSkilledRobot = [string, [string, string]];
////let robotA: Robot = [1, "mower", "mowing"];
////let robotB: Robot = [2, "trimmer", "trimming"];
////let robots = [robotA, robotB];
////function getRobots() {
//// return robots;
////}
////let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
////let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
////let multiRobots = [multiRobotA, multiRobotB];
////function getMultiRobots() {
//// return multiRobots;
////}
////for (let [, nameA = "noName"] of robots) {
//// console.log(nameA);
////}
////for (let [, nameA = "noName"] of getRobots()) {
//// console.log(nameA);
////}
////for (let [, nameA = "noName"] of [robotA, robotB]) {
//// console.log(nameA);
////}
////for (let [, [
//// primarySkillA = "primary",
//// secondarySkillA = "secondary"
////] = ["skill1", "skill2"]] of multiRobots) {
//// console.log(primarySkillA);
////}
////for (let [, [
//// primarySkillA = "primary",
//// secondarySkillA = "secondary"
////] = ["skill1", "skill2"]] of getMultiRobots()) {
//// console.log(primarySkillA);
////}
////for (let [, [
//// primarySkillA = "primary",
//// secondarySkillA = "secondary"
////] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) {
//// console.log(primarySkillA);
////}
////for (let [numberB = -1] of robots) {
//// console.log(numberB);
////}
////for (let [numberB = -1] of getRobots()) {
//// console.log(numberB);
////}
////for (let [numberB = -1] of [robotA, robotB]) {
//// console.log(numberB);
////}
////for (let [nameB = "noName"] of multiRobots) {
//// console.log(nameB);
////}
////for (let [nameB = "noName"] of getMultiRobots()) {
//// console.log(nameB);
////}
////for (let [nameB = "noName"] of [multiRobotA, multiRobotB]) {
//// console.log(nameB);
////}
////for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) {
//// console.log(nameA2);
////}
////for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) {
//// console.log(nameA2);
////}
////for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) {
//// console.log(nameA2);
////}
////for (let [nameMA = "noName", [
//// primarySkillA = "primary",
//// secondarySkillA = "secondary"
////] = ["skill1", "skill2"]] of multiRobots) {
//// console.log(nameMA);
////}
////for (let [nameMA = "noName", [
//// primarySkillA = "primary",
//// secondarySkillA = "secondary"
////] = ["skill1", "skill2"]] of getMultiRobots()) {
//// console.log(nameMA);
////}
////for (let [nameMA = "noName", [
//// primarySkillA = "primary",
//// secondarySkillA = "secondary"
////] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) {
//// console.log(nameMA);
////}
////for (let [numberA3 = -1, ...robotAInfo] of robots) {
//// console.log(numberA3);
////}
////for (let [numberA3 = -1, ...robotAInfo] of getRobots()) {
//// console.log(numberA3);
////}
////for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) {
//// console.log(numberA3);
////}
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 3290,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationDestructuringForOfArrayBindingPatternDefaultValues.ts"
} |
TypeScript/tests/cases/fourslash/completionsImportYieldExpression.ts_0_342 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////export function a() {}
// @Filename: /b.ts
////function *f() {
//// yield a/**/
////}
verify.applyCodeActionFromCompletion("", {
name: "a",
source: "/a",
description: `Add import from "./a"`,
newFileContent: `import { a } from "./a";
function *f() {
yield a
}`
});
| {
"end_byte": 342,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImportYieldExpression.ts"
} |
TypeScript/tests/cases/fourslash/callHierarchyFunction.ts_0_288 | /// <reference path="fourslash.ts" />
//// function foo() {
//// bar();
//// }
////
//// function /**/bar() {
//// baz();
//// quxx();
//// baz();
//// }
////
//// function baz() {
//// }
////
//// function quxx() {
//// }
goTo.marker();
verify.baselineCallHierarchy();
| {
"end_byte": 288,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/callHierarchyFunction.ts"
} |
TypeScript/tests/cases/fourslash/genericFunctionSignatureHelp2.ts_0_148 | /// <reference path='fourslash.ts'/>
////var f = <T>(a: T) => a;
////f(/**/
verify.signatureHelp({ marker: "", text: "f(a: unknown): unknown" });
| {
"end_byte": 148,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/genericFunctionSignatureHelp2.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType72.ts_0_206 | /// <reference path='fourslash.ts' />
////export declare function foo<T extends { a?: /*a*/T/*b*/ }>(): void;
goTo.select("a", "b");
verify.not.refactorAvailable("Extract type", "Extract to type alias");
| {
"end_byte": 206,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType72.ts"
} |
TypeScript/tests/cases/fourslash/referencesForStringLiteralPropertyNames5.ts_0_177 | /// <reference path='fourslash.ts'/>
////var x = { "/*1*/someProperty": 0 }
////x["/*2*/someProperty"] = 3;
////x.someProperty = 5;
verify.baselineFindAllReferences('1', '2')
| {
"end_byte": 177,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForStringLiteralPropertyNames5.ts"
} |
TypeScript/tests/cases/fourslash/renameForDefaultExport08.ts_0_445 | /// <reference path='fourslash.ts'/>
// @Filename: foo.ts
////export default function DefaultExportedFunction() {
//// return /**/[|DefaultExportedFunction|]
////}
/////**
//// * Commenting DefaultExportedFunction
//// */
////
////var x: typeof DefaultExportedFunction;
////
////var y = DefaultExportedFunction();
goTo.marker();
verify.renameInfoSucceeded("DefaultExportedFunction", '"/tests/cases/fourslash/foo".DefaultExportedFunction'); | {
"end_byte": 445,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameForDefaultExport08.ts"
} |
TypeScript/tests/cases/fourslash/extract-const_jsxElement6.ts_0_571 | /// <reference path="fourslash.ts" />
// @jsx: preserve
// @filename: a.tsx
////function Foo() {
//// const foo = [
//// /*a*/<div>text' <span>text' </span>text ' text " </div>/*b*/
//// ];
////}
goTo.file("a.tsx");
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "constant_scope_1",
actionDescription: "Extract to constant in global scope",
newContent:
`const newLocal = <div>text' <span>text' </span>text ' text " </div>;
function Foo() {
const foo = [
/*RENAME*/newLocal
];
}`
});
| {
"end_byte": 571,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const_jsxElement6.ts"
} |
TypeScript/tests/cases/fourslash/codeFixWrapJsxInFragment3.ts_0_210 | /// <reference path='fourslash.ts' />
// @jsx: react-jsx
// @Filename: /a.tsx
////[|<a /><a />|]
verify.rangeAfterCodeFix(`<><a /><a /></>`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 0);
| {
"end_byte": 210,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixWrapJsxInFragment3.ts"
} |
TypeScript/tests/cases/fourslash/renameLabel4.ts_0_231 | /// <reference path="fourslash.ts" />
////loop:
////for (let i = 0; i <= 10; i++) {
//// if (i === 0) continue loop;
//// if (i === 1) continue /**/loop;
//// if (i === 10) break loop;
////}
verify.baselineRename("", {});
| {
"end_byte": 231,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameLabel4.ts"
} |
TypeScript/tests/cases/fourslash/getEmitOutputSingleFile2.ts_0_591 | /// <reference path="fourslash.ts" />
// @BaselineFile: getEmitOutputSingleFile2.baseline
// @module: CommonJS
// @declaration: true
// @outFile: declSingleFile.js
// @outDir: /tests/cases/fourslash/
// @Filename: inputFile1.ts
//// var x: number = 5;
//// class Bar {
//// x : string;
//// y : number
//// }
// @Filename: inputFile2.ts
//// var x1: string = "hello world";
//// class Foo{
//// x : string;
//// y : number;
//// }
// @Filename: inputFile3.ts
// @emitThisFile: true
////export var foo = 10;
////export var bar = "hello world"
verify.baselineGetEmitOutput();
| {
"end_byte": 591,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEmitOutputSingleFile2.ts"
} |
TypeScript/tests/cases/fourslash/completionsWithOverride2.ts_0_378 | /// <reference path='fourslash.ts'/>
//// interface I {
//// baz () {}
//// }
//// class A {
//// foo () {}
//// bar () {}
//// }
//// class B extends A implements I {
//// override /*1*/
//// }
verify.completions({
marker: "1",
includes: [
"foo",
"bar"
],
excludes: [
"baz"
],
isNewIdentifierLocation: true
})
| {
"end_byte": 378,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsWithOverride2.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType81.ts_0_397 | /// <reference path='fourslash.ts' />
//// type A = { a: string } & /*1*/{ b: string } & { c: string }/*2*/;
goTo.select("1", "2");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to interface",
actionDescription: "Extract to interface",
newContent:
`interface /*RENAME*/NewType {
b: string;
c: string;
}
type A = { a: string } & NewType;`,
});
| {
"end_byte": 397,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType81.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationLocal_06.ts_0_209 | /// <reference path='fourslash.ts'/>
// Should be able to go to ambient variable declarations
//// declare var [|someVar|]: string;
//// someVa/*reference*/r
verify.baselineGoToImplementation("reference");
| {
"end_byte": 209,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationLocal_06.ts"
} |
TypeScript/tests/cases/fourslash/tsxCompletion7.ts_0_580 | /// <reference path='fourslash.ts' />
//@Filename: file.tsx
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// div: { ONE: string; TWO: number; }
//// }
//// }
//// let y = { ONE: '' };
//// var x = <div {...y} /**/ />;
verify.completions({
marker: "",
exact: [
{ name: "TWO", kind: "property", kindModifiers: "declare", sortText: completion.SortText.LocationPriority },
{ name: "ONE", kind: "property", kindModifiers: "declare", sortText: completion.SortText.MemberDeclaredBySpreadAssignment },
]
});
| {
"end_byte": 580,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxCompletion7.ts"
} |
TypeScript/tests/cases/fourslash/completionsOverridingMethod6.ts_0_4682 | /// <reference path="fourslash.ts" />
// @Filename: a.ts
// @newline: LF
// Case: modifiers
//// class Base {
//// method() {}
//// protected prop = 1;
//// }
//// class A extends Base {
//// public abstract /*a*/
//// }
//// abstract class Ab extends Base {
//// public abstract /*b*/
//// }
//// class B extends Base {
//// public override m/*c*/
//// }
//// class C extends Base {
//// override /*d*/
//// }
//// class f extends Base {
//// protected /*f*/
//// }
verify.completions(
{
marker: "a",
isNewIdentifierLocation: true,
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: false,
includeCompletionsWithClassMemberSnippets: true,
},
excludes: ["method", "prop"],
},
{
marker: "b",
isNewIdentifierLocation: true,
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: false,
includeCompletionsWithClassMemberSnippets: true,
},
includes: [
{
name: "method",
sortText: completion.SortText.LocationPriority,
insertText: "public abstract method(): void;",
filterText: "method",
replacementSpan: undefined,
hasAction: true,
source: completion.CompletionSource.ClassMemberSnippet,
},
{
name: "prop",
sortText: completion.SortText.LocationPriority,
insertText: "public abstract prop: number;",
filterText: "prop",
replacementSpan: undefined,
hasAction: true,
source: completion.CompletionSource.ClassMemberSnippet,
},
],
},
{
marker: "c",
isNewIdentifierLocation: true,
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: false,
includeCompletionsWithClassMemberSnippets: true,
},
includes: [
{
name: "method",
sortText: completion.SortText.LocationPriority,
insertText: "public override method(): void {\n}",
filterText: "method",
replacementSpan: undefined,
hasAction: true,
source: completion.CompletionSource.ClassMemberSnippet,
},
{
name: "prop",
sortText: completion.SortText.LocationPriority,
insertText: "public override prop: number;",
filterText: "prop",
replacementSpan: undefined,
hasAction: true,
source: completion.CompletionSource.ClassMemberSnippet,
},
]
},
{
marker: "d",
isNewIdentifierLocation: true,
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: false,
includeCompletionsWithClassMemberSnippets: true,
},
includes: [
{
name: "method",
sortText: completion.SortText.LocationPriority,
insertText: "override method(): void {\n}",
filterText: "method",
replacementSpan: undefined,
hasAction: true,
source: completion.CompletionSource.ClassMemberSnippet,
},
{
name: "prop",
sortText: completion.SortText.LocationPriority,
insertText: "protected override prop: number;",
filterText: "prop",
replacementSpan: undefined,
hasAction: true,
source: completion.CompletionSource.ClassMemberSnippet,
},
]
},
{
marker: "f",
isNewIdentifierLocation: true,
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: false,
includeCompletionsWithClassMemberSnippets: true,
},
excludes: ["method"],
includes: [
{
name: "prop",
sortText: completion.SortText.LocationPriority,
insertText: "protected prop: number;",
filterText: "prop",
replacementSpan: undefined,
hasAction: true,
source: completion.CompletionSource.ClassMemberSnippet,
},
]
},
); | {
"end_byte": 4682,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsOverridingMethod6.ts"
} |
TypeScript/tests/cases/fourslash/tsxQuickInfo3.ts_3_615 | / <reference path='fourslash.ts' />
//@Filename: file.tsx
// @jsx: preserve
// @noLib: true
//// interface OptionProp {
//// propx: 2
//// }
//// class Opt extends React.Component<OptionProp, {}> {
//// render() {
//// return <div>Hello</div>;
//// }
//// }
//// const obj1: OptionProp = {
//// propx: 2
//// }
//// let y1 = <O/*1*/pt pro/*2*/px={2} />;
//// let y2 = <Opt {...ob/*3*/j1} />;
//// let y2 = <Opt {...obj1} pr/*4*/opx />;
verify.quickInfos({
1: "class Opt",
2: "(property) propx: number",
3: "const obj1: OptionProp",
4: "(property) propx: true"
});
| {
"end_byte": 615,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxQuickInfo3.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports36-conditional-releative.ts_0_1017 | /// <reference path='fourslash.ts'/>
// @isolatedDeclarations: true
// @declaration: true
// @Filename: /code.ts
////const A = "A"
////const B = "B"
////export const AB = Math.random()? A: B;
verify.codeFixAvailable([
{
"description": "Add annotation of type '\"A\" | \"B\"'"
},
{
"description": "Add annotation of type 'typeof A | typeof B'"
},
{
"description": "Add annotation of type 'string'"
},
{
"description": "Add satisfies and an inline type assertion with '\"A\" | \"B\"'"
},
{
"description": "Add satisfies and an inline type assertion with 'typeof A | typeof B'"
},
{
"description": "Add satisfies and an inline type assertion with 'string'"
}
])
verify.codeFix({
description: "Add satisfies and an inline type assertion with 'typeof A | typeof B'" ,
index: 4,
newFileContent:
`const A = "A"
const B = "B"
export const AB = (Math.random() ? A : B) satisfies typeof A | typeof B as typeof A | typeof B;`
});
| {
"end_byte": 1017,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports36-conditional-releative.ts"
} |
TypeScript/tests/cases/fourslash/getJavaScriptQuickInfo7.ts_0_487 | /// <reference path="fourslash.ts" />
// @allowNonTsExtensions: true
// @Filename: file.js
//// /**
//// * This is a very cool function that is very nice.
//// * @returns something
//// * @param p anotherthing
//// */
//// function a1(p) {
//// try {
//// throw new Error('x');
//// } catch (x) { x--; }
//// return 23;
//// }
////
//// x - /**/a1()
verify.quickInfoAt("", "function a1(p: any): number",
"This is a very cool function that is very nice.");
| {
"end_byte": 487,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptQuickInfo7.ts"
} |
TypeScript/tests/cases/fourslash/formattingForIn.ts_0_160 | ///<reference path="fourslash.ts"/>
/////**/for (var i in[] ) {}
format.document();
goTo.marker();
verify.currentLineContentIs("for (var i in []) { }"); | {
"end_byte": 160,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingForIn.ts"
} |
TypeScript/tests/cases/fourslash/completionDetailsOfContextSensitiveParameterNoCrash.ts_0_3556 | /// <reference path="fourslash.ts" />
// @strict: true
////type __ = never;
////
////interface CurriedFunction1<T1, R> {
//// (): CurriedFunction1<T1, R>;
//// (t1: T1): R;
////}
////interface CurriedFunction2<T1, T2, R> {
//// (): CurriedFunction2<T1, T2, R>;
//// (t1: T1): CurriedFunction1<T2, R>;
//// (t1: __, t2: T2): CurriedFunction1<T1, R>;
//// (t1: T1, t2: T2): R;
////}
////
////interface CurriedFunction3<T1, T2, T3, R> {
//// (): CurriedFunction3<T1, T2, T3, R>;
//// (t1: T1): CurriedFunction2<T2, T3, R>;
//// (t1: __, t2: T2): CurriedFunction2<T1, T3, R>;
//// (t1: T1, t2: T2): CurriedFunction1<T3, R>;
//// (t1: __, t2: __, t3: T3): CurriedFunction2<T1, T2, R>;
//// (t1: T1, t2: __, t3: T3): CurriedFunction1<T2, R>;
//// (t1: __, t2: T2, t3: T3): CurriedFunction1<T1, R>;
//// (t1: T1, t2: T2, t3: T3): R;
////}
////
////interface CurriedFunction4<T1, T2, T3, T4, R> {
//// (): CurriedFunction4<T1, T2, T3, T4, R>;
//// (t1: T1): CurriedFunction3<T2, T3, T4, R>;
//// (t1: __, t2: T2): CurriedFunction3<T1, T3, T4, R>;
//// (t1: T1, t2: T2): CurriedFunction2<T3, T4, R>;
//// (t1: __, t2: __, t3: T3): CurriedFunction3<T1, T2, T4, R>;
//// (t1: __, t2: __, t3: T3): CurriedFunction2<T2, T4, R>;
//// (t1: __, t2: T2, t3: T3): CurriedFunction2<T1, T4, R>;
//// (t1: T1, t2: T2, t3: T3): CurriedFunction1<T4, R>;
//// (t1: __, t2: __, t3: __, t4: T4): CurriedFunction3<T1, T2, T3, R>;
//// (t1: T1, t2: __, t3: __, t4: T4): CurriedFunction2<T2, T3, R>;
//// (t1: __, t2: T2, t3: __, t4: T4): CurriedFunction2<T1, T3, R>;
//// (t1: __, t2: __, t3: T3, t4: T4): CurriedFunction2<T1, T2, R>;
//// (t1: T1, t2: T2, t3: __, t4: T4): CurriedFunction1<T3, R>;
//// (t1: T1, t2: __, t3: T3, t4: T4): CurriedFunction1<T2, R>;
//// (t1: __, t2: T2, t3: T3, t4: T4): CurriedFunction1<T1, R>;
//// (t1: T1, t2: T2, t3: T3, t4: T4): R;
////}
////
////declare var curry: {
//// <T1, R>(func: (t1: T1) => R, arity?: number): CurriedFunction1<T1, R>;
//// <T1, T2, R>(func: (t1: T1, t2: T2) => R, arity?: number): CurriedFunction2<T1, T2, R>;
//// <T1, T2, T3, R>(func: (t1: T1, t2: T2, t3: T3) => R, arity?: number): CurriedFunction3<T1, T2, T3, R>;
//// <T1, T2, T3, T4, R>(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arity?: number): CurriedFunction4<T1, T2, T3, T4, R>;
//// (func: (...args: any[]) => any, arity?: number): (...args: any[]) => any;
//// placeholder: __;
////};
////
////export type StylingFunction = (
//// keys: (string | false | undefined) | (string | false | undefined)[],
//// ...rest: unknown[]
////) => object;
////
////declare const getStylingByKeys: (
//// mergedStyling: object,
//// keys: (string | false | undefined) | (string | false | undefined)[],
//// ...args: unknown[]
////) => object;
////
////declare var mergedStyling: object;
////
////export const createStyling: CurriedFunction3<
//// (base16Theme: object) => unknown,
//// object | undefined,
//// object | undefined,
//// StylingFunction
////> = curry<
//// (base16Theme: object) => unknown,
//// object | undefined,
//// object | undefined,
//// StylingFunction
////>(
//// (
//// getStylingFromBase16: (base16Theme: object) => unknown,
//// options: object = {},
//// themeOrStyling: object = {},
//// ...args
//// ): StylingFunction => {
//// return curry(getStylingByKeys, 2)(mergedStyling, .../**/args);
//// },
//// 3
////);
verify.baselineQuickInfo(); | {
"end_byte": 3556,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionDetailsOfContextSensitiveParameterNoCrash.ts"
} |
TypeScript/tests/cases/fourslash/completionsOverridingMethod10.ts_0_1166 | /// <reference path="fourslash.ts" />
// @Filename: a.ts
// @newline: LF
// Case: formatting: semicolons
////interface Base {
//// a: string;
//// b(a: string): void;
//// c(a: string): string;
//// c(a: number): number;
////}
////class Sub implements Base {
//// /*a*/
////}
verify.completions({
marker: "a",
isNewIdentifierLocation: true,
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: false,
includeCompletionsWithClassMemberSnippets: true,
},
includes: [
{
name: "a",
sortText: completion.SortText.LocationPriority,
insertText: "a: string;",
filterText: "a",
},
{
name: "b",
sortText: completion.SortText.LocationPriority,
insertText:
`b(a: string): void {
}`,
filterText: "b",
},
{
name: "c",
sortText: completion.SortText.LocationPriority,
insertText:
`c(a: string): string;
c(a: number): number;
c(a: unknown): string | number {
}`,
filterText: "c",
},
],
}); | {
"end_byte": 1166,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsOverridingMethod10.ts"
} |
TypeScript/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction30.ts_0_382 | /// <reference path='fourslash.ts' />
////const a = /*a*/()/*b*/ => {
//// return {} as object
////};
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 a = () => ({} as object);`,
});
| {
"end_byte": 382,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction30.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoAssignToExistingClass.ts_0_444 | /// <reference path="fourslash.ts" />
////module Test {
//// class Mocked {
//// myProp: string;
//// }
//// class Tester {
//// willThrowError() {
//// Mocked = Mocked || function () { // => Error: Invalid left-hand side of assignment expression.
//// return { /**/myProp: "test" };
//// };
//// }
//// }
////}
goTo.marker();
// Verify no crash
verify.quickInfoExists();
| {
"end_byte": 444,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoAssignToExistingClass.ts"
} |
TypeScript/tests/cases/fourslash/unusedVariableInNamespace2.ts_0_355 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
////namespace greeter {
//// [|let a = "dummy entry", b, c = 0;|]
//// export function function1() {
//// use(a, c);
//// }
////}
verify.codeFix({
description: "Remove unused declaration for: 'b'",
index: 0,
newRangeContent: 'let a = "dummy entry", c = 0;',
});
| {
"end_byte": 355,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedVariableInNamespace2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageNoTruncation.ts_0_3541 | /// <reference path='fourslash.ts' />
////function foo(param) {
//// const a: {
//// a: {
//// a_1: string;
//// a_2: {
//// a_2_1: string;
//// }
//// };
//// b: {
//// b_1: string;
//// b_2: string;
//// b_3: string;
//// };
//// c: {
//// c_1: string;
//// c_2: string;
//// c_3: string;
//// c_4: {
//// c_4_1: {
//// c_4_1_1: {
//// c_4_1_1_1: {
//// c_4_1_1_1_1: string;
//// c_4_1_1_1_2: string;
//// c_4_1_1_1_3: string;
//// }
//// }
//// }
//// }
//// };
//// d: {
//// d_1: {
//// d_1_1: {
//// d_1_1_1: string;
//// }
//// d_1_2: {
//// d_1_2_1: string;
//// }
//// d_1_3: {
//// d_1_3_1: string;
//// d_1_3_2: string;
//// }
//// }
//// d_2: string;
//// d_3: string;
//// }
//// } = param;
////}
verify.codeFix({
description: "Infer parameter types from usage",
index: 0,
newFileContent:
`function foo(param: {
a: {
a_1: string;
a_2: {
a_2_1: string;
};
}; b: {
b_1: string;
b_2: string;
b_3: string;
}; c: {
c_1: string;
c_2: string;
c_3: string;
c_4: {
c_4_1: {
c_4_1_1: {
c_4_1_1_1: {
c_4_1_1_1_1: string;
c_4_1_1_1_2: string;
c_4_1_1_1_3: string;
};
};
};
};
}; d: {
d_1: {
d_1_1: {
d_1_1_1: string;
};
d_1_2: {
d_1_2_1: string;
};
d_1_3: {
d_1_3_1: string;
d_1_3_2: string;
};
};
d_2: string;
d_3: string;
};
}) {
const a: {
a: {
a_1: string;
a_2: {
a_2_1: string;
}
};
b: {
b_1: string;
b_2: string;
b_3: string;
};
c: {
c_1: string;
c_2: string;
c_3: string;
c_4: {
c_4_1: {
c_4_1_1: {
c_4_1_1_1: {
c_4_1_1_1_1: string;
c_4_1_1_1_2: string;
c_4_1_1_1_3: string;
}
}
}
}
};
d: {
d_1: {
d_1_1: {
d_1_1_1: string;
}
d_1_2: {
d_1_2_1: string;
}
d_1_3: {
d_1_3_1: string;
d_1_3_2: string;
}
}
d_2: string;
d_3: string;
}
} = param;
}`,
});
| {
"end_byte": 3541,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageNoTruncation.ts"
} |
TypeScript/tests/cases/fourslash/renameImportNamespaceAndShorthand.ts_0_209 | /// <reference path='fourslash.ts' />
////[|import * as [|{| "contextRangeIndex": 0 |}foo|] from 'bar';|]
////const bar = { [|foo|] };
const [r0Def, r0, r1] = test.ranges();
verify.baselineRename([r0, r1]);
| {
"end_byte": 209,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameImportNamespaceAndShorthand.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_EmptySpanConditional.ts_0_610 | /// <reference path='fourslash.ts' />
////let a = { b: { c: 0 } };
////a.b ? /*a*//*b*/a.b.c : "whenFalse";
// verify that the refactor is offered for empty spans in expression 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 } };
a.b?.c ?? "whenFalse";`,
triggerReason: "invoked"
}); | {
"end_byte": 610,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_EmptySpanConditional.ts"
} |
TypeScript/tests/cases/fourslash/navigateItemsConst.ts_0_417 | /// <reference path="fourslash.ts" />
// @noLib: true
////const [|{| "name": "c", "kind": "const" |}c = 10|];
////function foo() {
//// const [|{| "name": "d", "kind": "const", "containerName": "foo", "containerKind": "function" |}d = 10|];
////}
for (const range of test.ranges()) {
verify.navigateTo({
pattern: range.marker.data.name,
expected: [{ ...range.marker.data, range }],
})
}
| {
"end_byte": 417,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigateItemsConst.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType5.ts_0_316 | /// <reference path='fourslash.ts' />
//// var x: /*a*/1 | 2/*b*/ = 1;
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType = 1 | 2;
var x: NewType = 1;`,
});
| {
"end_byte": 316,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType5.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationVariables.ts_0_415 | /// <reference path='fourslash.ts' />
// @BaselineFile: bpSpan_variables.baseline
// @Filename: bpSpan_variables.ts
////var a = 10;
////var b;
////var c = 10, d, e;
////var c2, d2 = 10;
////module m {
//// var x1;
//// var x2 = 10, x3 = 10;
//// var x4, x5;
//// export var xx1;
//// export var xx2 = 10, xx3 = 10;
//// export var xx4, xx5;
////}
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 415,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationVariables.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_importedFunction3.ts_0_633 | /// <reference path='fourslash.ts' />
// @Filename: f.ts
////function foo(/*a*/a: string, b: string/*b*/) { }
////export = foo;
// @Filename: a.ts
////import bar = require("./f");
////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: `function foo({ a, b }: { a: string; b: string; }) { }
export = foo;`
});
goTo.file("a.ts");
verify.currentFileContentIs(`import bar = require("./f");
bar({ a: "a", b: "b" });`) | {
"end_byte": 633,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_importedFunction3.ts"
} |
TypeScript/tests/cases/fourslash/completionListInObjectLiteralPropertyAssignment.ts_0_220 | /// <reference path='fourslash.ts' />
////var foo;
////interface I {
//// metadata: string;
//// wat: string;
////}
////var x: I = {
//// metadata: "/*1*/
////}
verify.completions({ marker: "1", exact: [] });
| {
"end_byte": 220,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInObjectLiteralPropertyAssignment.ts"
} |
TypeScript/tests/cases/fourslash/incompleteFunctionCallCodefixTypeParametersConstrained.ts_0_526 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
////function existing<T extends string, U extends T>(value: T, other: U) {
//// added/*1*/(value, other);
////}
goTo.marker("1");
verify.codeFix({
description: "Add missing function declaration 'added'",
index: 0,
newFileContent: `function existing<T extends string, U extends T>(value: T, other: U) {
added(value, other);
}
function added<T extends string, U extends T>(value: T, other: U) {
throw new Error("Function not implemented.");
}
`,
});
| {
"end_byte": 526,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/incompleteFunctionCallCodefixTypeParametersConstrained.ts"
} |
TypeScript/tests/cases/fourslash/globalCompletionListInsideObjectLiterals.ts_0_1094 | /// <reference path='fourslash.ts'/>
////module ObjectLiterals {
//// interface MyPoint {
//// x1: number;
//// y1: number;
//// }
////
//// // Negative cases (global completion)
//// var p1: MyPoint = /*1*/{
//// };
////
//// var p2: MyPoint = {
//// x1: /*2*/
//// /*3*/};
////
//// var p3: MyPoint = {
//// y1 /*4*/
//// };
////
//// var p4: MyPoint = {
//// x1: /*5*/ /*6*/,
//// };
////}
// 1: Completion on '{' location.
// 2: Literal member completion after member name with empty member expression and missing colon.
// 5, 6: Literal member completion after member name with empty member expression.
const exact = completion.globalsPlus(["p1", "p2", "p3", "p4", "ObjectLiterals"]);
verify.completions(
{ marker: ["1",], exact: exact.filter(name => name !== 'p1'), isNewIdentifierLocation: true },
{ marker: ["2", "3"], exact: exact.filter(name => name !== 'p2') },
{ marker: ["4"], exact: exact.filter(name => name !== 'p3' ) },
{ marker: ["5", "6"], exact: exact.filter(name => name !== 'p4') },
);
| {
"end_byte": 1094,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/globalCompletionListInsideObjectLiterals.ts"
} |
TypeScript/tests/cases/fourslash/organizeImports8.ts_0_148 | /// <reference path="fourslash.ts" />
////import { foo as foo } from "foo";
////foo;
verify.organizeImports(
`import { foo } from "foo";
foo;`
);
| {
"end_byte": 148,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImports8.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType46.ts_0_453 | /// <reference path='fourslash.ts' />
//// namespace A { export const b = 1; }
//// function a(b: string): /*a*/typeof A.b/*b*/ { return 1; }
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `namespace A { export const b = 1; }
type /*RENAME*/NewType = typeof A.b;
function a(b: string): NewType { return 1; }`,
});
| {
"end_byte": 453,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType46.ts"
} |
TypeScript/tests/cases/fourslash/completionListOnAliasedModule.ts_0_246 | /// <reference path='fourslash.ts'/>
////module M {
//// export module N {
//// export function foo() { }
//// function bar() { }
//// }
////}
////import p = M.N;
////p./**/
verify.completions({ marker: "", exact: "foo" });
| {
"end_byte": 246,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListOnAliasedModule.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess34.ts_0_460 | /// <reference path='fourslash.ts' />
//// const A = {
//// /*a*/a/*b*/: 1,
//// };
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Generate 'get' and 'set' accessors",
actionName: "Generate 'get' and 'set' accessors",
actionDescription: "Generate 'get' and 'set' accessors",
newContent: `const A = {
/*RENAME*/_a: 1,
get a() {
return this._a;
},
set a(value) {
this._a = value;
},
};`,
});
| {
"end_byte": 460,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess34.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingMember_non_generator_function.ts_0_382 | /// <reference path='fourslash.ts' />
////class C {
//// method() {
//// yield* this.y();
//// }
////}
verify.codeFix({
index: 0,
description: ignoreInterpolations(ts.Diagnostics.Declare_method_0),
newFileContent:
`class C {
method() {
yield* this.y();
}
y() {
throw new Error("Method not implemented.");
}
}`,
});
| {
"end_byte": 382,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingMember_non_generator_function.ts"
} |
TypeScript/tests/cases/fourslash/codeFixRequireInTs_allowSyntheticDefaultImports.ts_0_261 | /// <reference path='fourslash.ts' />
// @allowSyntheticDefaultImports: true
// @Filename: /a.ts
////const a = [|require("a")|];
verify.codeFix({
description: ts.Diagnostics.Convert_require_to_import.message,
newFileContent: 'import a from "a";',
});
| {
"end_byte": 261,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixRequireInTs_allowSyntheticDefaultImports.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageCallbackParameter5.ts_0_314 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @noImplicitAny: false
// @filename: /foo.js
////const foo = [x => x + 1];
verify.codeFix({
description: "Infer parameter types from usage",
index: 0,
newFileContent: `const foo = [(/** @type {number} */ x) => x + 1];`
});
| {
"end_byte": 314,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageCallbackParameter5.ts"
} |
TypeScript/tests/cases/fourslash/formattingOnInterfaces.ts_0_161 | /// <reference path='fourslash.ts' />
/////*1*/interface Blah
////{
////}
format.document();
goTo.marker("1");
verify.currentLineContentIs("interface Blah {"); | {
"end_byte": 161,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingOnInterfaces.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoJsDocTagsFunctionOverload06.ts_0_1267 | /// <reference path="fourslash.ts" />
// @target: esnext
// @Filename: /a.ts
/////**
//// * A function that gets the length of an array.
//// * @param testParam
//// * @deprecated Use the new method instead.
//// */
////export function getArrayLength(arr: string[]): number;
////export function getArrayLength(arr: boolean[]): number;
// @Filename: /b.ts
////import { getArrayLength } from "/a";
/////*1*/getArrayLength(["hello"]);
/////*2*/getArrayLength([true]);
/////*3*/getArrayLength(["hello"]);
goTo.file("/b.ts");
goTo.marker("1")
verify.quickInfoIs("(alias) getArrayLength(arr: string[]): number (+1 overload)\nimport getArrayLength", "A function that gets the length of an array.", [{name: "param", text: "testParam"}, {name: "deprecated", text: "Use the new method instead."}])
goTo.marker("2")
verify.quickInfoIs("(alias) getArrayLength(arr: boolean[]): number (+1 overload)\nimport getArrayLength", "A function that gets the length of an array.", [{name: "param", text: "testParam"}])
goTo.marker("3")
verify.quickInfoIs("(alias) getArrayLength(arr: string[]): number (+1 overload)\nimport getArrayLength", "A function that gets the length of an array.", [{name: "param", text: "testParam"}, {name: "deprecated", text: "Use the new method instead."}]) | {
"end_byte": 1267,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoJsDocTagsFunctionOverload06.ts"
} |
TypeScript/tests/cases/fourslash/completionListDefaultTypeArgumentPositionTypeOnly.ts_0_167 | /// <reference path='fourslash.ts'/>
//// const foo = "foo";
//// function test1<T = /*1*/>() {}
verify.completions({ marker: "1", exact: completion.globalTypes });
| {
"end_byte": 167,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListDefaultTypeArgumentPositionTypeOnly.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationDestructuringParameterObjectBindingPattern.ts_0_764 | /// <reference path='fourslash.ts' />
////interface Robot {
//// name: string;
//// skill: string;
////}
////declare var console: {
//// log(msg: string): void;
////}
////var hello = "hello";
////var robotA: Robot = { name: "mower", skill: "mowing" };
////function foo1({ name: nameA }: Robot) {
//// console.log(nameA);
////}
////function foo2({ name: nameB, skill: skillB }: Robot) {
//// console.log(nameB);
////}
////function foo3({ name }: Robot) {
//// console.log(name);
////}
////foo1(robotA);
////foo1({ name: "Edger", skill: "cutting edges" });
////foo2(robotA);
////foo2({ name: "Edger", skill: "cutting edges" });
////foo3(robotA);
////foo3({ name: "Edger", skill: "cutting edges" });
verify.baselineCurrentFileBreakpointLocations();
| {
"end_byte": 764,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationDestructuringParameterObjectBindingPattern.ts"
} |
TypeScript/tests/cases/fourslash/unusedImports11FS.ts_0_354 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @Filename: file2.ts
//// [| import f1, * as s from "./file1"; |]
//// s.f2('hello');
// @Filename: file1.ts
//// export var v1;
//// export function f1(n: number){}
//// export function f2(s: string){};
//// export default f1;
verify.rangeAfterCodeFix('import * as s from "./file1";'); | {
"end_byte": 354,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedImports11FS.ts"
} |
TypeScript/tests/cases/fourslash/formattingJsxTexts1.ts_0_2135 | /// <reference path='fourslash.ts' />
//@Filename: file.tsx
////<option>
//// homu ; homu
//// homu;homu
//// homu : homu
//// homu:homu
//// homu ? homu
//// homu . homu
////
//// homu [ homu ] homu
////
//// ! homu
//// -- Type
//// homu --
//// homu ++
//// ++ homu
////
//// homu , homu
////
//// var homu
//// throw homu
//// new homu
//// delete homu
//// return homu
//// typeof homu
//// await homu
////
//// abstract homu
//// class homu
//// declare homu
//// default homu
//// enum homu
//// export homu
//// homu extends homu
//// get homu
//// homu implements homu
//// interface homu
//// module homu
//// namespace homu
//// private homu
//// public homu
//// protected homu
//// set homu
//// static homu
//// type homu
////
//// homu => homu
//// homu=>homu
////
//// ... homu
////
//// homu @ homu
//// homu@homu
////
//// ( homu ) homu
////</option>;
format.document();
verify.currentFileContentIs(`<option>
homu ; homu
homu;homu
homu : homu
homu:homu
homu ? homu
homu . homu
homu [ homu ] homu
! homu
-- Type
homu --
homu ++
++ homu
homu , homu
var homu
throw homu
new homu
delete homu
return homu
typeof homu
await homu
abstract homu
class homu
declare homu
default homu
enum homu
export homu
homu extends homu
get homu
homu implements homu
interface homu
module homu
namespace homu
private homu
public homu
protected homu
set homu
static homu
type homu
homu => homu
homu=>homu
... homu
homu @ homu
homu@homu
( homu ) homu
</option>;`); | {
"end_byte": 2135,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingJsxTexts1.ts"
} |
TypeScript/tests/cases/fourslash/tsxIncremental.ts_0_218 | /// <reference path='fourslash.ts' />
//// /**/
goTo.marker();
edit.insert("<");
edit.insert("div");
edit.insert(" ");
edit.insert(" id");
edit.insert("=");
edit.insert("\"foo");
edit.insert("\"");
edit.insert(">");
| {
"end_byte": 218,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxIncremental.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionFunctionType.ts_0_501 | /// <reference path='fourslash.ts'/>
// Tests that goToDefinition does not go to a function type; it goes to the value.
////const /*constDefinition*/c: () => void;
/////*constReference*/c();
////function test(/*cbDefinition*/cb: () => void) {
//// /*cbReference*/cb();
////}
////class C {
//// /*propDefinition*/prop: () => void;
//// m() {
//// this./*propReference*/prop();
//// }
////}
verify.baselineGetDefinitionAtPosition("constReference", "cbReference", "propReference");
| {
"end_byte": 501,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionFunctionType.ts"
} |
TypeScript/tests/cases/fourslash/codeFixOverrideModifier2.ts_0_429 | /// <reference path='fourslash.ts' />
// @noImplicitOverride: true
//// class B {
//// foo (v: string) {}
//// fooo (v: string) {}
//// }
//// function f () {
//// return class extends B {
//// override foo (v: string) {}
//// [|fooo (v: string) {}|]
//// }
//// }
verify.codeFix({
description: "Add 'override' modifier",
newRangeContent: "override fooo (v: string) {}",
index: 0
})
| {
"end_byte": 429,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixOverrideModifier2.ts"
} |
TypeScript/tests/cases/fourslash/memberListInWithBlock.ts_0_450 | /// <reference path='fourslash.ts'/>
////class c {
//// static x: number;
//// public foo() {
//// with ({}) {
//// function f() { }
//// var d = this./*1*/foo;
//// /*2*/
//// }
//// }
////}
verify.completions(
{ marker: "1", exact: undefined },
// Only keywords should show in completion, no members or types
{ marker: "2", excludes: ["foo", "f", "c", "d", "x", "Object"] },
);
| {
"end_byte": 450,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberListInWithBlock.ts"
} |
TypeScript/tests/cases/fourslash/codeFixDisableJsDiagnosticsInFile6.ts_0_341 | /// <reference path='fourslash.ts' />
// @allowjs: true
// @noEmit: true
// @checkJs: true
// @Filename: a.js
////var x = 0;
////
////function f(_a) {[|
//// f(x());
////|]}
// Disable checking for next line
verify.rangeAfterCodeFix(` // @ts-ignore
f(x());`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
| {
"end_byte": 341,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixDisableJsDiagnosticsInFile6.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoForArgumentsPropertyNameInJsMode1.ts_0_254 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @filename: a.js
////const foo = {
//// f1: (params) => { }
////}
////
////function /*1*/f2(x) {
//// foo.f1({ x, arguments: [] });
////}
////
/////*2*/f2('');
verify.baselineQuickInfo();
| {
"end_byte": 254,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForArgumentsPropertyNameInJsMode1.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType17.ts_0_372 | /// <reference path='fourslash.ts' />
//// type A<T = boolean> = string | number | /*a*/T/*b*/;
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<T> = T;
type A<T = boolean> = string | number | NewType<T>;`,
});
| {
"end_byte": 372,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType17.ts"
} |
TypeScript/tests/cases/fourslash/jsDocFunctionSignatures9.ts_0_1107 | ///<reference path="fourslash.ts" />
// @allowJs: true
// @Filename: Foo.js
/////** first line of the comment
////
////third line */
////function foo() {}
////foo/**/();
goTo.marker();
verify.verifyQuickInfoDisplayParts('function',
'',
{ start: 63, length: 3 },
[{"text": "function", "kind": "keyword"},
{"text": " ", "kind": "space"},
{"text": "foo", "kind": "functionName"},
{"text": "(", "kind": "punctuation"},
{"text": ")", "kind": "punctuation"},
{"text": ":", "kind": "punctuation"},
{"text": " ", "kind": "space"},
{"text": "void", "kind": "keyword"}
],
[{"text": "first line of the comment\n\nthird line", "kind": "text"}],
undefined);
| {
"end_byte": 1107,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocFunctionSignatures9.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoDisplayPartsClassMethod.ts_0_738 | /// <reference path='fourslash.ts'/>
////class c {
//// public /*1*/publicMethod() { }
//// private /*2*/privateMethod() { }
//// protected /*21*/protectedMethod() { }
//// static /*3*/staticMethod() { }
//// private static /*4*/privateStaticMethod() { }
//// protected static /*41*/protectedStaticMethod() { }
//// method() {
//// this./*5*/publicMethod();
//// this./*6*/privateMethod();
//// this./*61*/protectedMethod();
//// c./*7*/staticMethod();
//// c./*8*/privateStaticMethod();
//// c./*81*/protectedStaticMethod();
//// }
////}
////var cInstance = new c();
/////*9*/cInstance./*10*/publicMethod();
/////*11*/c./*12*/staticMethod();
verify.baselineQuickInfo(); | {
"end_byte": 738,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoDisplayPartsClassMethod.ts"
} |
TypeScript/tests/cases/fourslash/goToTypeDefinition_Pick.ts_0_316 | /// <reference path='fourslash.ts' />
//// type User = { id: number; name: string; };
//// declare const user: Pick<User, "name">
//// /*reference*/user
////
//// type PickedUser = Pick<User, "name">
//// declare const user2: PickedUser
//// /*reference2*/user2
verify.baselineGoToType("reference", "reference2");
| {
"end_byte": 316,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToTypeDefinition_Pick.ts"
} |
TypeScript/tests/cases/fourslash/thisPredicateFunctionQuickInfo02.ts_0_1480 | /// <reference path="fourslash.ts" />
//// interface Sundries {
//// broken: boolean;
//// }
////
//// interface Supplies {
//// spoiled: boolean;
//// }
////
//// interface Crate<T> {
//// contents: T;
//// /*1*/isSundries(): this is Crate<Sundries>;
//// /*2*/isSupplies(): this is Crate<Supplies>;
//// /*3*/isPackedTight(): this is (this & {extraContents: T});
//// }
//// const crate: Crate<any>;
//// if (crate.isPackedTight/*4*/()) {
//// crate.;
//// }
//// if (crate.isSundries/*5*/()) {
//// crate.contents.;
//// if (crate.isPackedTight/*6*/()) {
//// crate.;
//// }
//// }
//// if (crate.isSupplies/*7*/()) {
//// crate.contents.;
//// if (crate.isPackedTight/*8*/()) {
//// crate.;
//// }
//// }
verify.quickInfos({
1: "(method) Crate<T>.isSundries(): this is Crate<Sundries>",
2: "(method) Crate<T>.isSupplies(): this is Crate<Supplies>",
3: `(method) Crate<T>.isPackedTight(): this is (this & {
extraContents: T;
})`,
4: `(method) Crate<any>.isPackedTight(): this is (Crate<any> & {
extraContents: any;
})`,
5: "(method) Crate<any>.isSundries(): this is Crate<Sundries>",
6: `(method) Crate<Sundries>.isPackedTight(): this is (Crate<Sundries> & {
extraContents: Sundries;
})`,
7: "(method) Crate<any>.isSupplies(): this is Crate<Supplies>",
8: `(method) Crate<Supplies>.isPackedTight(): this is (Crate<Supplies> & {
extraContents: Supplies;
})`
});
| {
"end_byte": 1480,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/thisPredicateFunctionQuickInfo02.ts"
} |
TypeScript/tests/cases/fourslash/incorrectJsDocObjectLiteralType.ts_0_486 | ///<reference path="fourslash.ts" />
// @Filename: /a.ts
////
verify.navigateTo({ pattern: "", fileName: "/a.ts", expected: [] });
edit.insert("/**\n * @typedef {Object} foo\n * @property {any} [obj]\n */\nexport default function foo() {\n}");
verify.navigateTo({
pattern: "foo",
expected: [
{
name: "foo",
kind: "function",
kindModifiers: "export",
range: { fileName: "/a.ts", pos: 58, end: 91 },
},
],
});
| {
"end_byte": 486,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/incorrectJsDocObjectLiteralType.ts"
} |
TypeScript/tests/cases/fourslash/mapCodeClassInvalidClassMember.ts_0_183 | ///<reference path="fourslash.ts"/>
// @Filename: /index.ts
//// class MyClass {[||]
//// }
////
verify.baselineMapCode([test.ranges()], [
`
if (false) {
return "hello";
}
`
]); | {
"end_byte": 183,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/mapCodeClassInvalidClassMember.ts"
} |
TypeScript/tests/cases/fourslash/genericAssignmentCompat.ts_0_292 | /// <reference path="fourslash.ts"/>
//// interface Int<T> {
////
//// val<U>(f: (t: T) => U): Int<U>;
////
//// }
////
//// declare var v1: Int<string>;
////
//// var /*1*/v2/*2*/: Int<number> = v1;
verify.errorExistsBetweenMarkers("1", "2");
verify.numberOfErrorsInCurrentFile(1); | {
"end_byte": 292,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/genericAssignmentCompat.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddVoidToPromiseJS.3.ts_0_480 | /// <reference path='fourslash.ts' />
// @target: esnext
// @lib: es2015
// @strict: true
// @allowJS: true
// @checkJS: true
// @filename: main.js
////const p3 = /** @type {Promise<number | string>} */(new Promise(resolve => resolve()));
verify.codeFix({
errorCode: 2810,
description: "Add 'void' to Promise resolved without a value",
index: 2,
newFileContent: `const p3 = /** @type {Promise<number | string | void>} */(new Promise(resolve => resolve()));`
});
| {
"end_byte": 480,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddVoidToPromiseJS.3.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_expandSelectionRange8.ts_0_446 | /// <reference path='fourslash.ts' />
//@Filename: /bar.ts
////import { b } from './other';
////const t = b;
// @Filename: /a.ts
////[|const a = 1;
//// |]const b = 2;
// @Filename: /other.ts
////export const b = 2;
verify.moveToFile({
newFileContents: {
"/a.ts":
` const b = 2;`,
"/bar.ts":
`import { b } from './other';
const t = b;
const a = 1;
`,
},
interactiveRefactorArguments: { targetFile: "/bar.ts" }
}); | {
"end_byte": 446,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_expandSelectionRange8.ts"
} |
TypeScript/tests/cases/fourslash/completionsJsxAttributeGeneric.ts_0_467 | /// <reference path="fourslash.ts" />
// @Filename: /a.tsx
////declare const React: any;
////declare function CustomComponent<T>(props: { name: string }): JSX.Element;
////const element1 = <CustomComponent<string> /*1*/></CustomComponent>;
////const element2 = <CustomComponent<string> /*2*/ />;
['1', '2'].forEach(marker =>
verify.completions({
marker,
exact: [{
name: 'name',
kind: 'property',
kindModifiers: 'declare'
}]
})
);
| {
"end_byte": 467,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsJsxAttributeGeneric.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports32-inline-short-hand.ts_0_535 | /// <reference path='fourslash.ts'/>
// @isolatedDeclarations: true
// @declaration: true
// @Filename: /code.ts
////const x = 1;
////export default {
//// x
////};
verify.codeFix({
description: "Add satisfies and an inline type assertion with 'number'",
index: 1,
newFileContent:
`const x = 1;
export default {
x: x as number
};`
});
verify.codeFix({
description: "Add satisfies and an inline type assertion with 'typeof x'",
index: 2,
newFileContent:
`const x = 1;
export default {
x: x as typeof x
};`
});
| {
"end_byte": 535,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports32-inline-short-hand.ts"
} |
TypeScript/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties2.ts_0_881 | /// <reference path='fourslash.ts'/>
////interface A {
//// a: number;
//// common: string;
////}
////
////interface B {
//// /*1*/b: number;
//// common: number;
////}
////
////// Assignment
////var v1: A | B = { a: 0, common: "" };
////var v2: A | B = { b: 0, common: 3 };
////
////// Function call
////function consumer(f: A | B) { }
////consumer({ a: 0, b: 0, common: 1 });
////
////// Type cast
////var c = <A | B> { common: 0, b: 0 };
////
////// Array literal
////var ar: Array<A|B> = [{ a: 0, common: "" }, { b: 0, common: 0 }];
////
////// Nested object literal
////var ob: { aorb: A|B } = { aorb: { b: 0, common: 0 } };
////
////// Widened type
////var w: A|B = { b:undefined, common: undefined };
////
////// Untped -- should not be included
////var u1 = { a: 0, b: 0, common: "" };
////var u2 = { b: 0, common: 0 };
verify.baselineFindAllReferences('1')
| {
"end_byte": 881,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties2.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsJsDocImportTag.ts_0_304 | /// <reference path='fourslash.ts' />
// @allowJS: true
// @checkJs: true
// @Filename: /b.ts
////export interface A { }
// @Filename: /a.js
/////**
//// * @import { A } from "./b";
//// */
////
/////**
//// * @param { [|A/**/|] } a
//// */
////function f(a) {}
verify.baselineFindAllReferences("");
| {
"end_byte": 304,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsJsDocImportTag.ts"
} |
TypeScript/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts_3_248 | / <reference path='fourslash.ts' />
//@Filename: file.tsx
//// var x = 'something'
//// var y = </**/;
verify.completions({ marker: "", unsorted: [completion.globalThisEntry, ...completion.globalsVars, "x", completion.undefinedVarEntry] });
| {
"end_byte": 248,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpAfterParameter.ts_0_298 | /// <reference path="fourslash.ts" />
////type Type = (a, b, c) => void
////const a: Type = (a/*1*/, b/*2*/) => {}
////const b: Type = function (a/*3*/, b/*4*/) {}
////const c: Type = ({ /*5*/a: { b/*6*/ }}/*7*/ = { }/*8*/, [b/*9*/]/*10*/, .../*11*/c/*12*/) => {}
verify.baselineSignatureHelp();
| {
"end_byte": 298,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpAfterParameter.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceDuplicateMember2.ts_0_229 | /// <reference path='fourslash.ts' />
//// interface I1 {
//// x: number;
//// }
//// interface I2 {
//// x: number;
//// }
////
//// class C implements I1,I2 {
//// x: number;
//// }
verify.not.codeFixAvailable();
| {
"end_byte": 229,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceDuplicateMember2.ts"
} |
TypeScript/tests/cases/fourslash/navigateToIIFE.ts_0_1070 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////(function () {
//// "use strict";
//// [|function onResume() {
//// }|];
////} )();
// @Filename: /b.ts
////class EventManager {
//// [|{| "containerName": "EventManager" |}public onResume(name: string) { }|]
////}
////class MyOtherEventManager {
//// [|{| "containerName": "MyOtherEventManager" |}public onResume(name: string) { }|]
////}
const [r0, r1, r2] = test.ranges();
const aTs: ReadonlyArray<FourSlashInterface.ExpectedNavigateToItem> = [{ name: "onResume", kind: "function", range: r0 }];
const bTs: ReadonlyArray<FourSlashInterface.ExpectedNavigateToItem> = [r1, r2].map((range): FourSlashInterface.ExpectedNavigateToItem =>
({ name: "onResume", kind: "method", kindModifiers: "public", range, containerName: range.marker.data.containerName, containerKind: "class" }));
verify.navigateTo(
{ pattern: "onResume", expected: [...aTs, ...bTs] },
{ pattern: "onResume", fileName: "/a.ts", expected: aTs },
{ pattern: "onResume", fileName: "/b.ts", expected: bTs },
);
| {
"end_byte": 1070,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigateToIIFE.ts"
} |
TypeScript/tests/cases/fourslash/codeFixSpelling10.ts_0_336 | /// <reference path='fourslash.ts' />
// @noImplicitOverride: true
////class A {
//// doSomething() {}
////}
////
////class B extends A {
//// override [|doSomethang|]() {}
////}
verify.codeFix({
index: 0,
description: [ts.Diagnostics.Change_spelling_to_0.message, "doSomething"],
newRangeContent: "doSomething"
});
| {
"end_byte": 336,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixSpelling10.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.