_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/fourslash/referencesForGlobals3.ts_0_296 | /// <reference path='fourslash.ts'/>
// Global interface reference.
// @Filename: referencesForGlobals_1.ts
/////*1*/interface /*2*/globalInterface {
//// f();
////}
// @Filename: referencesForGlobals_2.ts
////var i: /*3*/globalInterface;
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 296,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForGlobals3.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_getter.ts_0_541 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////class C {
//// get g() { return 0; }
//// get h() { return 1; }
////}
////[|export const { g, h: i } = new C();|]
// @Filename: /b.ts
////import { g, i } from "./a";
verify.noErrors();
verify.moveToNewFile({
newFileContents: {
"/a.ts":
`export class C {
get g() { return 0; }
get h() { return 1; }
}
`,
"/g.ts":
`import { C } from "./a";
export const { g, h: i } = new C();
`,
"/b.ts":
`
import { g, i } from "./g";
`,
},
});
| {
"end_byte": 541,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_getter.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingInvocationForDecorator_all.ts_0_445 | /// <reference path='fourslash.ts' />
////declare function foo(): (...args: any[]) => void;
////class C {
//// @foo
//// bar() {}
////
//// @foo
//// baz() {}
////}
verify.codeFixAll({
fixId: "addMissingInvocationForDecorator",
fixAllDescription: "Add '()' to all uncalled decorators",
newFileContent:
`declare function foo(): (...args: any[]) => void;
class C {
@foo()
bar() {}
@foo()
baz() {}
}`
});
| {
"end_byte": 445,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingInvocationForDecorator_all.ts"
} |
TypeScript/tests/cases/fourslash/getJavaScriptCompletions21.ts_0_330 | /// <reference path="fourslash.ts" />
// @allowNonTsExtensions: true
// @Filename: file.js
////class Prv {
//// #privatething = 1;
//// notSoPrivate = 1;
////}
////new Prv()['[|/**/|]'];
verify.completions({
marker: "",
exact: [{
name: "notSoPrivate",
replacementSpan: test.ranges()[0]
}]
});
| {
"end_byte": 330,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptCompletions21.ts"
} |
TypeScript/tests/cases/fourslash/jsdocDeprecated_suggestion17.ts_0_663 | ///<reference path="fourslash.ts" />
// @filename: foo.ts
////interface Foo {
//// /** @deprecated */
//// [k: string]: any;
//// /** @deprecated please use `.y` instead */
//// x: number;
//// y: number;
////}
////function f(foo: Foo) {
//// foo.[|x|];
//// foo.[|y|];
//// foo.[|z|];
////}
const ranges = test.ranges();
verify.getSuggestionDiagnostics([
{
"code": 6385,
"message": "'x' is deprecated.",
"reportsDeprecated": true,
"range": ranges[0]
},
{
"code": 6385,
"message": "'z' is deprecated.",
"reportsDeprecated": true,
"range": ranges[2]
},
]);
| {
"end_byte": 663,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocDeprecated_suggestion17.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUndeclaredIndexSignatureNumericLiteral.ts_0_310 | /// <reference path='fourslash.ts' />
//// [|class A {
//// constructor() {
//// this.x = 10;
//// }
//// }|]
verify.rangeAfterCodeFix(`
class A {
[x: string]: number;
constructor() {
this.x = 10;
}
}
`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 1); | {
"end_byte": 310,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUndeclaredIndexSignatureNumericLiteral.ts"
} |
TypeScript/tests/cases/fourslash/smartSelection_JSDocTags6.ts_0_197 | /// <reference path="fourslash.ts" />
/////**
//// * @template T
//// * @param {/**/T} x
//// * @return {T}
//// */
////function foo(x) {
//// return x;
////}
verify.baselineSmartSelection();
| {
"end_byte": 197,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartSelection_JSDocTags6.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageJSXElement.ts_0_836 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
// @jsx: react
// @module: es2015
// @moduleResolution: node
////declare namespace React {
//// export class Component { render(): JSX.Element | null; }
////}
////declare global {
//// namespace JSX {
//// interface Element {}
//// }
////}
////
//// export default function Component([|props |]) {
//// if (props.isLoading) {
//// return <div>...Loading < /div>;
//// }
//// else {
//// return <AnotherComponent
//// update={
//// (rec) => {
//// return props.update(rec);
//// }
//// }
//// />;
//// }
//// }
verify.rangeAfterCodeFix("props: { isLoading: any; update: (arg0: any) => any; }",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0);
| {
"end_byte": 836,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageJSXElement.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportFileQuoteStyle0.ts_0_313 | /// <reference path="fourslash.ts" />
//// [|import { v2 } from './module2';
////
//// f1/*0*/();|]
// @Filename: module1.ts
//// export function f1() {}
// @Filename: module2.ts
//// export var v2 = 6;
verify.importFixAtPosition([
`import { f1 } from './module1';
import { v2 } from './module2';
f1();`
]);
| {
"end_byte": 313,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportFileQuoteStyle0.ts"
} |
TypeScript/tests/cases/fourslash/completionsGenericIndexedAccess6.ts_0_594 | /// <reference path="fourslash.ts" />
// @Filename: component.tsx
////interface CustomElements {
//// 'component-one': {
//// foo?: string;
//// },
//// 'component-two': {
//// bar?: string;
//// }
////}
////
////type Options<T extends keyof CustomElements> = { kind: T } & Required<{ x: CustomElements[(T extends string ? T : never) & string] }['x']>;
////
////declare function Component<T extends keyof CustomElements>(props: Options<T>): void;
////
////const c = <Component /**/ kind="component-one" />
verify.completions({
marker: "",
exact: [{
name: "foo"
}]
})
| {
"end_byte": 594,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsGenericIndexedAccess6.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefs_importType_js.4.ts_0_319 | /// <reference path="fourslash.ts" />
// @module: commonjs
// @allowJs: true
// @checkJs: true
// @Filename: /a.js
/////**
//// * @callback /**/A
//// * @param {unknown} response
//// */
////
////module.exports = {};
// @Filename: /b.js
/////** @typedef {import("./a").A} A */
verify.baselineFindAllReferences("");
| {
"end_byte": 319,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefs_importType_js.4.ts"
} |
TypeScript/tests/cases/fourslash/objectLiteralCallSignatures.ts_0_908 | /// <reference path='fourslash.ts'/>
////var /*1*/x: {
//// func1(x: number): number; // Method signature
//// func2: (x: number) => number; // Function type literal
//// func3: { (x: number): number }; // Object type literal
////};
////
////x.func1 = x.func2 = x.func3;
////
////var /*2*/y: {
//// func4(x: number): number;
//// func4(s: string): string;
//// func5: {
//// (x: number): number;
//// (s: string): string;
//// };
////};
////
////y.func4 = y.func5;
////y.func5 = y.func4;
verify.not.errorExistsAfterMarker('1');
verify.quickInfos({
1: "var x: {\n func1(x: number): number;\n func2: (x: number) => number;\n func3: {\n (x: number): number;\n };\n}",
2: "var y: {\n func4(x: number): number;\n func4(s: string): string;\n func5: {\n (x: number): number;\n (s: string): string;\n };\n}"
});
| {
"end_byte": 908,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/objectLiteralCallSignatures.ts"
} |
TypeScript/tests/cases/fourslash/renameAliasExternalModule3.ts_0_307 | /// <reference path='fourslash.ts'/>
// @Filename: a.ts
////module SomeModule { [|export class [|{| "contextRangeIndex": 0 |}SomeClass|] { }|] }
////export = SomeModule;
// @Filename: b.ts
////import M = require("./a");
////import C = M.[|SomeClass|];
verify.baselineRenameAtRangesWithText("SomeClass");
| {
"end_byte": 307,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameAliasExternalModule3.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionDynamicImport4.ts_3_221 | / <reference path='fourslash.ts' />
// @Filename: foo.ts
//// export function /*Destination*/bar() { return "bar"; }
//// import('./foo').then(({ [|ba/*1*/r|] }) => undefined);
verify.baselineGoToDefinition("1");
| {
"end_byte": 221,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionDynamicImport4.ts"
} |
TypeScript/tests/cases/fourslash/referencesForStatementKeywords.ts_0_5558 | /// <reference path='fourslash.ts'/>
// @filename: /main.ts
////// import ... = ...
////[|{| "id": "importEqualsDecl1" |}/*importEqualsDecl1_importKeyword*/[|import|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importEqualsDecl1" |}A|] = /*importEqualsDecl1_requireKeyword*/[|require|]("[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "importEqualsDecl1" |}./a|]");|]
////[|{| "id": "namespaceDecl1" |}namespace [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "namespaceDecl1" |}N|] { }|]
////[|{| "id": "importEqualsDecl2" |}/*importEqualsDecl2_importKeyword*/[|import|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importEqualsDecl2" |}N2|] = [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importEqualsDecl2" |}N|];|]
////
////// import ... from ...
////[|{| "id": "importDecl1" |}/*importDecl1_importKeyword*/[|import|] /*importDecl1_typeKeyword*/[|type|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importDecl1" |}B|] /*importDecl1_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "importDecl1" |}./b|]";|]
////[|{| "id": "importDecl2" |}/*importDecl2_importKeyword*/[|import|] /*importDecl2_typeKeyword*/[|type|] * /*importDecl2_asKeyword*/[|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importDecl2" |}C|] /*importDecl2_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "importDecl2" |}./c|]";|]
////[|{| "id": "importDecl3" |}/*importDecl3_importKeyword*/[|import|] /*importDecl3_typeKeyword*/[|type|] { [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importDecl3" |}D|] } /*importDecl3_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "importDecl3" |}./d|]";|]
////[|{| "id": "importDecl4" |}/*importDecl4_importKeyword*/[|import|] /*importDecl4_typeKeyword*/[|type|] { e1, e2 /*importDecl4_asKeyword*/[|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importDecl4" |}e3|] } /*importDecl4_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "importDecl4" |}./e|]";|]
////
////// import "module"
////[|{| "id": "importDecl5" |}/*importDecl5_importKeyword*/[|import|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "importDecl5" |}./f|]";|]
////
////// export ... from ...
////[|{| "id": "exportDecl1" |}/*exportDecl1_exportKeyword*/[|export|] /*exportDecl1_typeKeyword*/[|type|] * /*exportDecl1_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl1" |}./g|]";|]
////[|{| "id": "exportDecl2" |}/*exportDecl2_exportKeyword*/[|export|] /*exportDecl2_typeKeyword*/[|type|] [|{| "id": "exportDecl2_namespaceExport" |}* /*exportDecl2_asKeyword*/[|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl2" |}H|]|] /*exportDecl2_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl2" |}./h|]";|]
////[|{| "id": "exportDecl3" |}/*exportDecl3_exportKeyword*/[|export|] /*exportDecl3_typeKeyword*/[|type|] { [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl3" |}I|] } /*exportDecl3_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl3" |}./i|]";|]
////[|{| "id": "exportDecl4" |}/*exportDecl4_exportKeyword*/[|export|] /*exportDecl4_typeKeyword*/[|type|] { j1, j2 /*exportDecl4_asKeyword*/[|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl4" |}j3|] } /*exportDecl4_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl4" |}./j|]";|]
////[|{| "id": "typeDecl1" |}type [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "typeDecl1" |}Z1|] = 1;|]
////[|{| "id": "exportDecl5" |}/*exportDecl5_exportKeyword*/[|export|] /*exportDecl5_typeKeyword*/[|type|] { [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl5" |}Z1|] };|]
////type Z2 = 2;
////type Z3 = 3;
////[|{| "id": "exportDecl6" |}/*exportDecl6_exportKeyword*/[|export|] /*exportDecl6_typeKeyword*/[|type|] { z2, z3 /*exportDecl6_asKeyword*/[|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl6" |}z4|] };|]
// @filename: /main2.ts
////[|{| "id": "varDecl1" |}const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "varDecl1" |}x|] = {};|]
////[|{| "id": "exportAssignment1" |}/*exportAssignment1_exportKeyword*/[|export|] = [|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportAssignment1"|}x|];|]
// @filename: /main3.ts
////[|{| "id": "varDecl3" |}const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "varDecl3" |}y|] = {};|]
////[|{| "id": "exportAssignment2" |}/*exportAssignment2_exportKeyword*/[|export|] [|default|] [|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportAssignment2"|}y|];|]
// @filename: /a.ts
////export const a = 1;
// @filename: /b.ts
////[|{| "id": "classDecl1" |}export default class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "classDecl1" |}B|] {}|]
// @filename: /c.ts
////export const c = 1;
// @filename: /d.ts
////[|{| "id": "classDecl2" |}export class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "classDecl2" |}D|] {}|]
// @filename: /e.ts | {
"end_byte": 5558,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForStatementKeywords.ts"
} |
TypeScript/tests/cases/fourslash/referencesForStatementKeywords.ts_5559_7269 | ////export const e1 = 1;
////export const e2 = 2;
// @filename: /f.ts
////export const f = 1;
// @filename: /g.ts
////export const g = 1;
// @filename: /h.ts
////export const h = 1;
// @filename: /i.ts
////[|{| "id": "classDecl3" |}export class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "classDecl3" |}I|] {}|]
// @filename: /j.ts
////export const j1 = 1;
////export const j2 = 2;
verify.baselineFindAllReferences(
'importEqualsDecl1_importKeyword',
'importEqualsDecl1_requireKeyword',
'importEqualsDecl2_importKeyword',
'importDecl1_importKeyword',
'importDecl1_typeKeyword',
'importDecl1_fromKeyword',
'importDecl2_importKeyword',
'importDecl2_typeKeyword',
'importDecl2_asKeyword',
'importDecl2_fromKeyword',
'importDecl3_importKeyword',
'importDecl3_typeKeyword',
'importDecl3_fromKeyword',
'importDecl4_importKeyword',
'importDecl4_typeKeyword',
'importDecl4_fromKeyword',
'importDecl4_asKeyword',
'importDecl5_importKeyword',
'exportDecl1_exportKeyword',
'exportDecl1_typeKeyword',
'exportDecl1_fromKeyword',
'exportDecl2_exportKeyword',
'exportDecl2_typeKeyword',
'exportDecl2_asKeyword',
'exportDecl2_fromKeyword',
'exportDecl3_exportKeyword',
'exportDecl3_typeKeyword',
'exportDecl3_fromKeyword',
'exportDecl4_exportKeyword',
'exportDecl4_typeKeyword',
'exportDecl4_fromKeyword',
'exportDecl4_asKeyword',
'exportDecl5_exportKeyword',
'exportDecl5_typeKeyword',
'exportDecl6_exportKeyword',
'exportDecl6_typeKeyword',
'exportDecl6_asKeyword',
'exportAssignment1_exportKeyword',
'exportAssignment2_exportKeyword',
) | {
"end_byte": 7269,
"start_byte": 5559,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForStatementKeywords.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddOptionalParam6.ts_0_247 | /// <reference path="fourslash.ts" />
////[|const f = () => {}|]
////
////f("");
verify.codeFix({
description: [ts.Diagnostics.Add_optional_parameter_to_0.message, "f"],
index: 1,
newRangeContent: "const f = (p0?: string) => {}"
});
| {
"end_byte": 247,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddOptionalParam6.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToNamed_SingleLine.ts_0_346 | /// <reference path='fourslash.ts' />
//// let foo = /*x*/(/*y*/) => 1 + 1;
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert arrow function or function expression",
actionName: "Convert to named function",
actionDescription: "Convert to named function",
newContent: `function foo() {
return 1 + 1;
}`,
});
| {
"end_byte": 346,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToNamed_SingleLine.ts"
} |
TypeScript/tests/cases/fourslash/extract-method-not-for-import.ts_0_210 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////i/**/mport _ from "./b";
// @Filename: /b.ts
////export default function f() {}
goTo.marker("");
verify.not.refactorAvailable('Extract Symbol');
| {
"end_byte": 210,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method-not-for-import.ts"
} |
TypeScript/tests/cases/fourslash/extractFunctionContainingThis4.ts_0_929 | /// <reference path='fourslash.ts' />
////class Foo {
//// bar() {
//// function test(this: string, foo: string) {
//// /*start*/console.log(this);
//// console.log(foo); /*end*/
//// }
//// }
////}
goTo.select("start", "end");
verify.refactorAvailable("Extract Symbol", "function_scope_1");
verify.not.refactorAvailable("Extract Symbol", "function_scope_2");
verify.refactorAvailable("Extract Symbol", "function_scope_3");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_0",
actionDescription: "Extract to inner function in function 'test'",
newContent:
`class Foo {
bar() {
function test(this: string, foo: string) {
/*RENAME*/newFunction.call(this);
function newFunction(this: string) {
console.log(this);
console.log(foo);
}
}
}
}`
}); | {
"end_byte": 929,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extractFunctionContainingThis4.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingAwait_binaryExpressions.ts_0_976 | /// <reference path="fourslash.ts" />
////async function fn(a: Promise<number>, b: number) {
//// a | b;
//// b + a;
//// a + a;
////}
verify.codeFix({
description: ts.Diagnostics.Add_await.message,
index: 0,
newFileContent:
`async function fn(a: Promise<number>, b: number) {
await a | b;
b + a;
a + a;
}`
});
verify.codeFix({
description: ts.Diagnostics.Add_await.message,
index: 1,
newFileContent:
`async function fn(a: Promise<number>, b: number) {
a | b;
b + await a;
a + a;
}`
});
verify.codeFix({
description: ts.Diagnostics.Add_await.message,
index: 2,
newFileContent:
`async function fn(a: Promise<number>, b: number) {
a | b;
b + a;
await a + await a;
}`
});
verify.codeFixAll({
fixAllDescription: ts.Diagnostics.Fix_all_expressions_possibly_missing_await.message,
fixId: "addMissingAwait",
newFileContent:
`async function fn(a: Promise<number>, b: number) {
await a | b;
b + await a;
await a + await a;
}`
});
| {
"end_byte": 976,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingAwait_binaryExpressions.ts"
} |
TypeScript/tests/cases/fourslash/exportEqualTypes.ts_0_781 | /// <reference path='./fourslash.ts'/>
// @Filename: exportEqualTypes_file0.ts
////interface x {
//// (): Date;
//// foo: string;
////}
////export = x;
// @Filename: exportEqualTypes_file1.ts
///////<reference path='exportEqualTypes_file0.ts'/>
////import test = require('./exportEqualTypes_file0');
////var t: /*1*/test; // var 't' should be of type 'test'
////var /*2*/r1 = t(); // Should return a Date
////var /*3*/r2 = t./*4*/foo; // t should have 'foo' in dropdown list and be of type 'string'
verify.quickInfos({
1: "(alias) interface test\nimport test = require('./exportEqualTypes_file0')",
2: "var r1: Date",
3: "var r2: string"
});
verify.completions({ marker: "4", exact: completion.functionMembersWithPrototypePlus(["foo"]) });
verify.noErrors();
| {
"end_byte": 781,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/exportEqualTypes.ts"
} |
TypeScript/tests/cases/fourslash/completionListInTypeParameterOfClassExpression1.ts_3_356 | / <reference path='fourslash.ts'/>
////var C0 = class D</*0*/
////var C1 = class D</*1*/T> {}
////var C2 = class D<T, /*2*/
////var C3 = class D<T, /*3*/U>{}
////var C4 = class D<T extends /*4*/>{}
verify.completions({ marker: ["0", "1", "2", "3"], exact: undefined });
verify.completions({ marker: "4", exact: completion.globalTypesPlus(["D"]) });
| {
"end_byte": 356,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInTypeParameterOfClassExpression1.ts"
} |
TypeScript/tests/cases/fourslash/completionForStringLiteral_mappedTypeMembers.ts_0_340 | /// <reference path='fourslash.ts'/>
////type Foo = {
//// a: string;
//// b: string;
////};
////
////type A = Readonly<Foo>;
////type B = A["[|/**/|]"]
const replacementSpan = test.ranges()[0];
verify.completions({
marker: "",
exact: [
{ name: "a", replacementSpan },
{ name: "b", replacementSpan }
]
});
| {
"end_byte": 340,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteral_mappedTypeMembers.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoLink2.ts_0_335 | ///<reference path="fourslash.ts" />
// @checkJs: true
// @Filename: quickInfoLink2.js
//// /**
//// * @typedef AdditionalWallabyConfig/**/ Additional valid Wallaby config properties
//// * that aren't defined in {@link IWallabyConfig}.
//// * @property {boolean} autoDetect
//// */
verify.noErrors()
verify.baselineQuickInfo();
| {
"end_byte": 335,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoLink2.ts"
} |
TypeScript/tests/cases/fourslash/smartSelection_bindingPatterns.ts_0_127 | /// <reference path="fourslash.ts" />
////const { /*1*/x, y: /*2*/a, .../*3*/zs = {} } = {};
verify.baselineSmartSelection(); | {
"end_byte": 127,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartSelection_bindingPatterns.ts"
} |
TypeScript/tests/cases/fourslash/getOutliningSpansForRegions.ts_0_1020 | /// <reference path="fourslash.ts"/>
////// region without label
////[|// #region
////
////// #endregion|]
////
////// region without label with trailing spaces
////[|// #region
////
////// #endregion|]
////
////// region with label
////[|// #region label1
////
////// #endregion|]
////
////// region with extra whitespace in all valid locations
//// [|// #region label2 label3
////
//// // #endregion|]
////
////// No space before directive
////[|//#region label4
////
//////#endregion|]
////
////// Nested regions
////[|// #region outer
////
////[|// #region inner
////
////// #endregion inner|]
////
////// #endregion outer|]
////
////// region delimiters not valid when there is preceding text on line
//// test // #region invalid1
////
////test // #endregion
////
////// region delimiters not valid when in multiline comment
/////*
////// #region invalid2
////*/
////
/////*
////// #endregion
////*/
verify.outliningSpansInCurrentFile(test.ranges(), "region"); | {
"end_byte": 1020,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOutliningSpansForRegions.ts"
} |
TypeScript/tests/cases/fourslash/getRenameInfoTests1.ts_0_121 | /// <reference path="fourslash.ts"/>
////class [|/**/C|] {
////
////}
goTo.marker("");
verify.renameInfoSucceeded("C"); | {
"end_byte": 121,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getRenameInfoTests1.ts"
} |
TypeScript/tests/cases/fourslash/inlineVariableTemplateString8.ts_0_376 | /// <reference path="fourslash.ts" />
////const /*a*/message/*b*/ = "Hello, World!";
////await $`echo ${message}`;
goTo.select("a", "b");
verify.refactorAvailable("Inline variable");
edit.applyRefactor({
refactorName: "Inline variable",
actionName: "Inline variable",
actionDescription: "Inline variable",
newContent: 'await $`echo ${"Hello, World!"}`;',
}); | {
"end_byte": 376,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlineVariableTemplateString8.ts"
} |
TypeScript/tests/cases/fourslash/multipleExportAssignmentsErrorList0.ts_0_562 | /// <reference path="fourslash.ts" />
//// interface connectModule {
//// (res, req, next): void;
//// }
//// interface connectExport {
//// use: (mod: connectModule) => connectExport;
//// listen: (port: number) => void;
//// }
//// var server: {
//// (): connectExport;
//// test1: connectModule;
//// test2(): connectModule;
//// };
//// export = server;
//// /*1*/export = connectExport;
////
////
edit.disableFormatting();
goTo.marker('1');
edit.deleteAtCaret(24);
goTo.marker('1');
edit.insert("export = connectExport;\n");
| {
"end_byte": 562,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/multipleExportAssignmentsErrorList0.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_umdModules1_globalAccess.ts_0_905 | /// <reference path="./fourslash.ts" />
// @filename: /package.json
//// { "dependencies": { "@types/classnames": "*" } }
// @filename: /tsconfig.json
//// { "compilerOptions": { "allowUmdGlobalAccess": true } }
// @filename: /node_modules/@types/classnames/package.json
//// { "name": "@types/classnames", "types": "index.d.ts" }
// @filename: /node_modules/@types/classnames/index.d.ts
//// declare const classNames: () => string;
//// export = classNames;
//// export as namespace classNames;
// @filename: /SomeReactComponent.tsx
//// import * as React from 'react';
////
//// const el1 = <div className={class/*1*/}>foo</div>;
goTo.marker("1");
verify.completions({
includes: [{
name: "classNames",
hasAction: undefined, // Asserts to have no actions
sortText: completion.SortText.GlobalsOrKeywords,
}],
preferences: {
includeCompletionsForModuleExports: true,
}
});
| {
"end_byte": 905,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_umdModules1_globalAccess.ts"
} |
TypeScript/tests/cases/fourslash/formattingOnTabAfterCloseCurly.ts_0_874 | /// <reference path='fourslash.ts' />
////module Tools {/*1*/
//// export enum NodeType {/*2*/
//// Error,/*3*/
//// Comment,/*4*/
//// } /*5*/
//// export enum foob/*6*/
//// {
//// Blah=1, Bleah=2/*7*/
//// }/*8*/
////}/*9*/
format.document();
goTo.marker("1");
verify.currentLineContentIs("module Tools {");
goTo.marker("2");
verify.currentLineContentIs(" export enum NodeType {");
goTo.marker("3");
verify.currentLineContentIs(" Error,");
goTo.marker("4");
verify.currentLineContentIs(" Comment,");
goTo.marker("5");
verify.currentLineContentIs(" }");
goTo.marker("6");
verify.currentLineContentIs(" export enum foob {");
goTo.marker("7");
verify.currentLineContentIs(" Blah = 1, Bleah = 2");
goTo.marker("8");
verify.currentLineContentIs(" }");
goTo.marker("9");
verify.currentLineContentIs("}"); | {
"end_byte": 874,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingOnTabAfterCloseCurly.ts"
} |
TypeScript/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics21.ts_0_171 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @experimentalDecorators: true
// @Filename: a.js
//// @internal class C {}
verify.getSemanticDiagnostics([]);
| {
"end_byte": 171,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics21.ts"
} |
TypeScript/tests/cases/fourslash/stringLiteralCompletionsInPositionTypedUsingRest.ts_0_863 | /// <reference path="fourslash.ts" />
// repro from https://github.com/microsoft/TypeScript/issues/49680#issuecomment-1249191842
//// declare function pick<T extends object, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K>;
//// declare function pick2<T extends object, K extends (keyof T)[]>(obj: T, ...keys: K): Pick<T, K[number]>;
////
//// const obj = { aaa: 1, bbb: '2', ccc: true };
////
//// pick(obj, 'aaa', '/*ts1*/');
//// pick2(obj, 'aaa', '/*ts2*/');
// repro from https://github.com/microsoft/TypeScript/issues/49680#issuecomment-1273677941
//// class Q<T> {
//// public select<Keys extends keyof T>(...args: Keys[]) {}
//// }
//// new Q<{ id: string; name: string }>().select("name", "/*ts3*/");
verify.completions({ marker: ["ts1", "ts2"], exact: ["aaa", "bbb", "ccc"] });
verify.completions({ marker: ["ts3"], exact: ["name", "id"] });
| {
"end_byte": 863,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/stringLiteralCompletionsInPositionTypedUsingRest.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType89.ts_0_1482 | /// <reference path='fourslash.ts' />
//// interface Yadda<T> { x: T }
////
//// export let blah: Yadda/*a*/<string>/*b*/;
////
//// interface YaddaWithDefault<T = boolean/*c*/> { x: T/*d*/ }
goTo.marker("a");
verify.refactorAvailableForTriggerReason("invoked", "Extract type", "Extract to type alias")
goTo.marker("b");
edit.applyRefactor({
triggerReason: "invoked",
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `interface Yadda<T> { x: T }
type /*RENAME*/NewType = Yadda<string>;
export let blah: NewType;
interface YaddaWithDefault<T = boolean> { x: T }`,
});
goTo.marker("c");
edit.applyRefactor({
triggerReason: "invoked",
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `interface Yadda<T> { x: T }
type NewType = Yadda<string>;
export let blah: NewType;
type /*RENAME*/NewType_1 = boolean;
interface YaddaWithDefault<T = NewType_1> { x: T }`
});
goTo.marker("d");
edit.applyRefactor({
triggerReason: "invoked",
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `interface Yadda<T> { x: T }
type NewType = Yadda<string>;
export let blah: NewType;
type NewType_1 = boolean;
type /*RENAME*/NewType_2<T> = T;
interface YaddaWithDefault<T = NewType_1> { x: NewType_2<T> }`
});
| {
"end_byte": 1482,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType89.ts"
} |
TypeScript/tests/cases/fourslash/codeFixCalledES2015Import2.ts_0_510 | /// <reference path='fourslash.ts' />
// @esModuleInterop: true
// @Filename: foo.d.ts
////declare function foo(): void;
////declare namespace foo {}
////export = foo;
// @Filename: index.ts
////import * as foo from "./foo";
////function invoke(f: () => void) { f(); }
////invoke([|foo|]);
goTo.file(1);
verify.codeFix({
description: `Replace import with 'import foo from "./foo";'.`,
newFileContent: `import foo from "./foo";
function invoke(f: () => void) { f(); }
invoke(foo);`,
index: 0,
});
| {
"end_byte": 510,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCalledES2015Import2.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts_0_177 | /// <reference path='fourslash.ts' />
/////*1*/enum /*2*/E {
//// First,
//// Second
////}
////let first = /*3*/E.First;
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 177,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts"
} |
TypeScript/tests/cases/fourslash/completionListInImportClause01.ts_0_954 | /// <reference path='fourslash.ts'/>
// @ModuleResolution: classic
// @Filename: m1.ts
////export var foo: number = 1;
////export function bar() { return 10; }
////export function baz() { return 10; }
// @Filename: m2.ts
////import {/*1*/, /*2*/ from "m1"
////import {/*3*/} from "m1"
////import {foo,/*4*/ from "m1"
////import {bar as /*5*/, /*6*/ from "m1"
////import {foo, bar, baz as b,/*7*/} from "m1"
////import { type /*8*/ } from "m1";
////import { type b/*9*/ } from "m1";
const type = { name: "type", sortText: completion.SortText.GlobalsOrKeywords };
verify.completions(
// { marker: ["1", "2", "3"], exact: ["bar", "baz", "foo", type] },
// { marker: "4", exact: ["bar", "baz", type] },
// { marker: "5", exact: undefined, isNewIdentifierLocation: true },
// { marker: "6", exact: ["baz", "foo", type] },
// { marker: "7", exact: undefined },
{ marker: ["8", "9"], exact: ["bar", "baz", "foo"] }, // No 'type'
);
| {
"end_byte": 954,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInImportClause01.ts"
} |
TypeScript/tests/cases/fourslash/augmentedTypesClass1.ts_0_402 | /// <reference path='fourslash.ts'/>
////class c5b { public foo() { } }
////module c5b { export var y = 2; } // should be ok
////c5b./*1*/
////var r = new c5b();
////r./*2*/
verify.completions({ marker: "1", includes: { name: "prototype", text: '(property) c5b.prototype: c5b' } });
edit.insert('y;');
verify.completions({ marker: "2", includes: { name: "foo", text: '(method) c5b.foo(): void' } });
| {
"end_byte": 402,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/augmentedTypesClass1.ts"
} |
TypeScript/tests/cases/fourslash/completionsOverridingMethod18.ts_0_1723 | /// <reference path="fourslash.ts" />
// @Filename: a.ts
// @newline: LF
//// declare function decorator(...args: any[]): any;
//// class DecoratorBase {
//// protected foo(a: string): string;
//// protected foo(a: number): number;
//// protected foo(a: any): any {
//// return a;
//// }
//// }
//// class DecoratorSub extends DecoratorBase {
//// @decorator protected /**/
//// }
verify.completions({
marker: "",
isNewIdentifierLocation: true,
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: false,
includeCompletionsWithClassMemberSnippets: true,
},
includes: [
{
name: "foo",
sortText: completion.SortText.LocationPriority,
insertText:
`protected foo(a: string): string;
protected foo(a: number): number;
@decorator
protected foo(a: any) {
}`,
filterText: "foo",
replacementSpan: undefined,
hasAction: true,
source: completion.CompletionSource.ClassMemberSnippet,
},
]
});
verify.applyCodeActionFromCompletion("", {
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: false,
includeCompletionsWithClassMemberSnippets: true,
},
name: "foo",
source: completion.CompletionSource.ClassMemberSnippet,
description: "Update modifiers of 'foo'",
newFileContent:
`declare function decorator(...args: any[]): any;
class DecoratorBase {
protected foo(a: string): string;
protected foo(a: number): number;
protected foo(a: any): any {
return a;
}
}
class DecoratorSub extends DecoratorBase {
}`
});
| {
"end_byte": 1723,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsOverridingMethod18.ts"
} |
TypeScript/tests/cases/fourslash/completionListPrivateMembers2.ts_0_285 | /// <reference path="fourslash.ts"/>
////class Foo {
//// private y;
//// constructor(private x) {}
//// method() { this./*1*/; }
////}
////var f:Foo;
////f./*2*/
verify.completions(
{ marker: "1", exact: ["method", "x", "y"] },
{ marker: "2", exact: "method" },
);
| {
"end_byte": 285,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListPrivateMembers2.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsForDefaultKeyword.ts_0_323 | /// <reference path="fourslash.ts" />
// @noLib: true
////function f(value: string, /*1*/default: string) {}
////
////const /*2*/default = 1;
////
////function /*3*/default() {}
////
////class /*4*/default {}
////
////const foo = {
//// /*5*/default: 1
////}
verify.baselineFindAllReferences("1", "2", "3", "4", "5");
| {
"end_byte": 323,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsForDefaultKeyword.ts"
} |
TypeScript/tests/cases/fourslash/extract-method22.ts_0_266 | /// <reference path='fourslash.ts' />
// You may not extract variable declarations with the export modifier
//// namespace NS {
//// /*start*/export var x = 10, y = 15;/*end*/
//// }
goTo.select('start', 'end')
verify.not.refactorAvailable('Extract Symbol');
| {
"end_byte": 266,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method22.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingParam7.ts_0_291 | /// <reference path="fourslash.ts" />
////class C {
//// [|m1() {}|]
//// m2(a: boolean) {
//// this.m1(a);
//// }
////}
verify.codeFix({
description: [ts.Diagnostics.Add_missing_parameter_to_0.message, "m1"],
index: 0,
newRangeContent: "m1(a: boolean) {}"
});
| {
"end_byte": 291,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingParam7.ts"
} |
TypeScript/tests/cases/fourslash/formatAnyTypeLiteral.ts_0_233 | /// <reference path="fourslash.ts"/>
//// function foo(x: { } /*objLit*/){
//// /**/
goTo.marker();
edit.insert("}");
goTo.marker("objLit");
verify.currentLineContentIs("function foo(x: {}) {"); // Space within type literal removed
| {
"end_byte": 233,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatAnyTypeLiteral.ts"
} |
TypeScript/tests/cases/fourslash/codeFixCannotFindModuleJsxRuntime01.ts_0_443 | /// <reference path='fourslash.ts' />
// @module: preserve
// @target: esnext
// @moduleResolution: bundler
// @jsx: react-jsx
// @Filename: /file.tsx
////
////export let jsxExpr = <div />;
test.setTypesRegistry({
"react": undefined,
});
verify.codeFixAvailable([{
description: "Install '@types/react'",
commands: [{
file: "/file.tsx",
type: "install package",
packageName: "@types/react",
}],
}]);
| {
"end_byte": 443,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCannotFindModuleJsxRuntime01.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports35-variable-releative.ts_0_350 | /// <reference path='fourslash.ts'/>
// @isolatedDeclarations: true
// @declaration: true
// @Filename: /code.ts
////const foo = { a: 1 }
////export const exported = foo;
verify.codeFix({
description: "Add annotation of type 'typeof foo'" ,
index: 1,
newFileContent:
`const foo = { a: 1 }
export const exported: typeof foo = foo;`
});
| {
"end_byte": 350,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports35-variable-releative.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportIndex_notForClassicResolution.ts_0_599 | /// <reference path="fourslash.ts" />
// @moduleResolution: classic
// @Filename: /a/index.ts
////export const foo = 0;
// @Filename: /node_modules/x/index.d.ts
////export const bar = 0;
// @Filename: /b.ts
////[|foo;|]
// @Filename: /c.ts
////[|bar;|]
goTo.file("/a/index.ts");
goTo.file("/b.ts");
// Explicitly imports from "./a/index" and not just from "./a"
verify.importFixAtPosition([
`import { foo } from "./a/index";
foo;`
]);
goTo.file("/c.ts");
// Does not use a global import for node_modules
verify.importFixAtPosition([
`import { bar } from "./node_modules/x/index";
bar;`]);
| {
"end_byte": 599,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportIndex_notForClassicResolution.ts"
} |
TypeScript/tests/cases/fourslash/importTypesDeclarationDiagnosticsNoServerError.ts_0_303 | /// <reference path="fourslash.ts" />
// @declaration: true
// @Filename: node_modules/foo/index.d.ts
////export function f(): I;
////export interface I {
//// x: number;
////}
// @Filename: a.ts
////import { f } from "foo";
////export const x = f();
goTo.file(1);
verify.getSemanticDiagnostics([]);
| {
"end_byte": 303,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importTypesDeclarationDiagnosticsNoServerError.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_classDeclarationGoodUsages.ts_0_798 | /// <reference path='fourslash.ts' />
////class C {
//// static a: number = 2;
//// /*a*/constructor/*b*/(a: number, b: number) { }
////}
////const newC = new C(1, 2);
////const b = C.a;
////C["a"] = 3;
////let c: C;
////function f(c: C) { }
////class B extends C { }
////class A implements C { }
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 C {
static a: number = 2;
constructor({ a, b }: { a: number; b: number; }) { }
}
const newC = new C({ a: 1, b: 2 });
const b = C.a;
C["a"] = 3;
let c: C;
function f(c: C) { }
class B extends C { }
class A implements C { }`
}); | {
"end_byte": 798,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_classDeclarationGoodUsages.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoInObjectLiteral.ts_0_520 | /// <reference path='fourslash.ts' />
////interface Foo {
//// doStuff(x: string, callback: (a: string) => string);
////}
////var x1: Foo = {
//// y/*1*/1: () => {
//// return "";
//// } ,
//// doStuff: (z, callback) => { return callback(this.y); }
////}
////var value = 3;
////class Foo {
//// static getRandomPosition() {
//// return {
//// "row": v/*2*/alue
//// }
//// }
////}
verify.quickInfos({
1: "(property) y1: () => string",
2: "var value: number"
});
| {
"end_byte": 520,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoInObjectLiteral.ts"
} |
TypeScript/tests/cases/fourslash/toggleLineComment11.ts_0_717 | // When textRange contain multiple lines and ends on a beginning of a line, don't comment/uncomment the last line.
//@Filename: file.tsx
//// [|const a = 0;
//// const b = 1;
//// |]const c = 2;
////
//// const d = <div>
//// [|<div>
//// SomeText
//// |] </div>
//// </div>;
////
//// [|//const e = 0;
//// //const f = 1;
//// |]//const g = 2;
////
//// const h = <div>
//// [|{/*<div>*/}
//// {/* SomeText*/}
//// |]{/*</div>*/}
//// </div>;
verify.toggleLineComment(
`//const a = 0;
//const b = 1;
const c = 2;
const d = <div>
{/*<div>*/}
{/* SomeText*/}
</div>
</div>;
const e = 0;
const f = 1;
//const g = 2;
const h = <div>
<div>
SomeText
{/*</div>*/}
</div>;`); | {
"end_byte": 717,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/toggleLineComment11.ts"
} |
TypeScript/tests/cases/fourslash/asOperatorCompletion.ts_0_149 | /// <reference path="fourslash.ts" />
//// type T = number;
//// var x;
//// var y = x as /**/
verify.completions({ marker: "", includes: "T" });
| {
"end_byte": 149,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/asOperatorCompletion.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageCallBodyPriority.ts_0_587 | /// <reference path='fourslash.ts' />
// based on acorn
////function isIdentifierStart([|code, astral |]) {
//// if (code < 65) { return code === 36 }
//// if (code < 91) { return true }
//// if (code < 97) { return code === 95 }
//// if (code < 123) { return true }
//// if (code <= 0xffff) { return code >= 0xaa }
//// if (astral === false) { return false }
////}
////
////function isLet(nextCh: any) {
//// return isIdentifierStart(nextCh, true)
////};
verify.rangeAfterCodeFix("code: number, astral: boolean",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0);
| {
"end_byte": 587,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageCallBodyPriority.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports43-expando-functions-4.ts_0_574 | /// <reference path='fourslash.ts'/>
// @isolatedDeclarations: true
// @declaration: true
// @lib: es2019
// @Filename: /code.ts
////function foo(): void {}
////// cannot name this property because it's an invalid variable name.
////foo["@bar"] = 42;
////foo.x = 1;
verify.codeFix({
description: "Annotate types of properties expando function in a namespace",
index: 0,
newFileContent:
`function foo(): void {}
declare namespace foo {
export var x: number;
}
// cannot name this property because it's an invalid variable name.
foo["@bar"] = 42;
foo.x = 1;`
});
| {
"end_byte": 574,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports43-expando-functions-4.ts"
} |
TypeScript/tests/cases/fourslash/getJavaScriptCompletions15.ts_0_1097 | /// <reference path="fourslash.ts" />
// @allowNonTsExtensions: true
// @Filename: refFile1.ts
//// export var V = 1;
// @Filename: refFile2.ts
//// export var V = "123"
// @Filename: refFile3.ts
//// export var V = "123"
// @Filename: main.js
//// import ref1 = require("./refFile1");
//// var ref2 = require("./refFile2");
//// ref1.V./*1*/;
//// ref2.V./*2*/;
//// var v = { x: require("./refFile3") };
//// v.x./*3*/;
//// v.x.V./*4*/;
verify.completions(
{ marker: "1", includes: "toExponential" },
{ marker: "2", includes: "toLowerCase" },
{
marker: "3",
exact: [
"V",
{ name: "ref1", sortText: completion.SortText.JavascriptIdentifiers },
{ name: "ref2", sortText: completion.SortText.JavascriptIdentifiers },
{ name: "require", sortText: completion.SortText.JavascriptIdentifiers },
{ name: "v", sortText: completion.SortText.JavascriptIdentifiers },
{ name: "x", sortText: completion.SortText.JavascriptIdentifiers }
]
},
{ marker: "4", includes: "toLowerCase" },
);
| {
"end_byte": 1097,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptCompletions15.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_tsconfig.ts_0_374 | /// <reference path='fourslash.ts' />
// @Filename: /src/a.ts
////0;
////[|1;|]
// @Filename: /src/tsconfig.json
////{
//// "files": ["./a.ts"]
////}
verify.noErrors();
verify.moveToNewFile({
newFileContents: {
"/src/a.ts":
`0;
`,
"/src/newFile.ts":
`1;
`,
"/src/tsconfig.json":
`{
"files": ["./a.ts", "./newFile.ts"]
}`,
},
});
| {
"end_byte": 374,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_tsconfig.ts"
} |
TypeScript/tests/cases/fourslash/formattingObjectLiteralOpenCurlyNewlineTyping.ts_0_375 | /// <reference path='fourslash.ts' />
////
//// var varName =/**/
////
goTo.marker();
edit.insert("\n{");
verify.currentFileContentIs(
`
var varName =
{
`
);
edit.insert("\na: 1");
format.document();
verify.currentFileContentIs(
`
var varName =
{
a: 1
`
);
edit.insert("\n};");
format.document();
verify.currentFileContentIs(
`
var varName =
{
a: 1
};
`
); | {
"end_byte": 375,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingObjectLiteralOpenCurlyNewlineTyping.ts"
} |
TypeScript/tests/cases/fourslash/memberCompletionOnTypeParameters2.ts_0_351 | /// <reference path='fourslash.ts'/>
////class A {
//// foo(): string { return ''; }
////}
////
////class B extends A {
//// bar(): string {
//// return '';
//// }
////}
////
////class C<U extends A, T extends A> {
//// x: U;
//// y = this.x./**/ // completion list here
////}
verify.completions({ marker: "", exact: "foo" });
| {
"end_byte": 351,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberCompletionOnTypeParameters2.ts"
} |
TypeScript/tests/cases/fourslash/completionsStringMethods.ts_0_94 | /// <reference path='fourslash.ts' />
//// var s = "foo"./*1*/
verify.baselineCompletions()
| {
"end_byte": 94,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsStringMethods.ts"
} |
TypeScript/tests/cases/fourslash/formatTypeParameters.ts_0_188 | /// <reference path="fourslash.ts"/>
/////**/type Bar<T extends any[]= any[]> = T
format.document();
goTo.marker();
verify.currentLineContentIs('type Bar<T extends any[] = any[]> = T'); | {
"end_byte": 188,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatTypeParameters.ts"
} |
TypeScript/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts_0_299 | /// <reference path='fourslash.ts' />
////module M {
//// export class C { public pub = 0; private priv = 1; }
//// export var V = 0;
////}
////
////
////var c = new M.C();
////
////c. // test on c.
////
//////Test for comment
//////c. /**/
verify.completions({ marker: "", exact: undefined });
| {
"end_byte": 299,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoOnValueSymbolWithoutExportWithSameNameExportSymbol.ts_0_527 | /// <reference path='fourslash.ts' />
// @strict: true
////
//// declare function num(): number
//// const /*1*/Unit = num()
//// export type Unit = number
//// const value = /*2*/Unit
////
//// function Fn() {}
//// export type Fn = () => void
//// /*3*/Fn()
////
//// // repro from #41897
//// const /*4*/X = 1;
//// export interface X {}
verify.quickInfoAt("1", "const Unit: number");
verify.quickInfoAt("2", "const Unit: number");
verify.quickInfoAt("3", "function Fn(): void");
verify.quickInfoAt("4", "const X: 1");
| {
"end_byte": 527,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnValueSymbolWithoutExportWithSameNameExportSymbol.ts"
} |
TypeScript/tests/cases/fourslash/docCommentTemplateVariableStatements02.ts_0_645 | /// <reference path='fourslash.ts' />
/////*a*/
////var a1 = 10, a2 = 20;
////
/////*b*/
////let b1 = "", b2 = true;
////
/////*c*/
////const c1 = 30, c2 = 40;
////
/////*d*/
////let d1 = function d(x, y, z) {
//// return +(x + y + z);
////}, d2 = 50;
////
/////*e*/
////let e1 = class E {
//// constructor(a, b, c) {
//// this.a = a;
//// this.b = b || (this.c = c);
//// }
////}, e2 = () => 100;
////
/////*f*/
////let f1 = {
//// foo: 10,
//// bar: "20"
////}, f2 = null;
for (const varName of ["a", "b", "c", "d", "e", "f"]) {
verify.docCommentTemplateAt(varName, /*newTextOffset*/ 3,
"/** */");
}
| {
"end_byte": 645,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateVariableStatements02.ts"
} |
TypeScript/tests/cases/fourslash/renamePropertyAccessExpressionHeritageClause.ts_0_263 | /// <reference path="fourslash.ts" />
//// class B {}
//// function foo() {
//// return {[|[|{| "contextRangeIndex": 0 |}B|]: B|]};
//// }
//// class C extends (foo()).[|B|] {}
//// class C1 extends foo().[|B|] {}
verify.baselineRenameAtRangesWithText("B"); | {
"end_byte": 263,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renamePropertyAccessExpressionHeritageClause.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpOnOverloads.ts_0_460 | /// <reference path='fourslash.ts'/>
////declare function fn(x: string);
////declare function fn(x: string, y: number);
////fn(/*1*/
verify.signatureHelp({
marker: "1",
overloadsCount: 2,
text: "fn(x: string): any",
parameterName: "x",
parameterSpan: "x: string",
});
edit.insert("'',");
verify.signatureHelp({
overloadsCount: 2,
text: "fn(x: string, y: number): any",
parameterName: "y",
parameterSpan: "y: number",
});
| {
"end_byte": 460,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpOnOverloads.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentStatementForOf.ts_0_403 | /// <reference path='fourslash.ts'/>
////function Foo() {
//// for (var i of [])
//// {
//// /*insideStatement*/
//// }
//// /*afterStatement*/
//// for (var i of [])
//// /*insideStatement2*/
////}
goTo.marker('insideStatement');
verify.indentationIs(8);
goTo.marker('afterStatement');
verify.indentationIs(4);
goTo.marker('insideStatement2');
verify.indentationIs(8);
| {
"end_byte": 403,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentStatementForOf.ts"
} |
TypeScript/tests/cases/fourslash/formattingOnEnter.ts_0_215 | /// <reference path='fourslash.ts' />
////class foo { }
////class bar {/**/ }
////// new line here
goTo.marker();
edit.insertLine("");
verify.currentFileContentIs(
`class foo { }
class bar {
}
// new line here`);
| {
"end_byte": 215,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingOnEnter.ts"
} |
TypeScript/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics15.ts_0_145 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: a.js
////function F(public p) { }
verify.baselineSyntacticDiagnostics();
| {
"end_byte": 145,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics15.ts"
} |
TypeScript/tests/cases/fourslash/contextualTypingGenericFunction1.ts_0_441 | /// <reference path='fourslash.ts'/>
// should not contextually type the RHS because it introduces type parameters
////var obj: { f<T>(x: T): T } = { f: <S>(/*1*/x) => x };
////var obj2: <T>(x: T) => T = <S>(/*2*/x) => x;
////
////class C<T> {
//// obj: <T>(x: T) => T
////}
////var c = new C();
////c.obj = <S>(/*3*/x) => x;
verify.quickInfos({
1: "(parameter) x: any",
2: "(parameter) x: any",
3: "(parameter) x: any"
});
| {
"end_byte": 441,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/contextualTypingGenericFunction1.ts"
} |
TypeScript/tests/cases/fourslash/completionListErrorRecovery2.ts_0_210 | /// <reference path="fourslash.ts" />
////class Foo { static bar() { return "x"; } }
////var baz = Foo/**/;
/////*1*/baz.concat("y");
goTo.marker();
edit.insert(".b");
verify.not.errorExistsAfterMarker("1");
| {
"end_byte": 210,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListErrorRecovery2.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionTypeofThis.ts_0_383 | /// <reference path='fourslash.ts'/>
////function f(/*fnDecl*/this: number) {
//// type X = typeof [|/*fnUse*/this|];
////}
////class /*cls*/C {
//// constructor() { type X = typeof [|/*clsUse*/this|]; }
//// get self(/*getterDecl*/this: number) { type X = typeof [|/*getterUse*/this|]; }
////}
verify.baselineGoToDefinition(
"fnUse",
"clsUse",
"getterUse",
); | {
"end_byte": 383,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionTypeofThis.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionTypeReferenceDirective.ts_0_255 | /// <reference path="fourslash.ts"/>
// @typeRoots: src/types
// @Filename: src/types/lib/index.d.ts
/////*0*/declare let $: {x: number};
// @Filename: src/app.ts
//// /// <reference types="[|lib/*1*/|]"/>
//// $.x;
verify.baselineGoToDefinition("1");
| {
"end_byte": 255,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionTypeReferenceDirective.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromPrimitiveUsage.ts_0_253 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
//// function wrap( [| s |] ) {
//// return s.length + s.indexOf('hi')
//// }
// https://github.com/Microsoft/TypeScript/issues/29330
verify.rangeAfterCodeFix("s: string | string[]");
| {
"end_byte": 253,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromPrimitiveUsage.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_tupleRestParam.ts_0_2064 | /// <reference path='fourslash.ts' />
// @Filename: a.ts
////function /*a*/fn1/*b*/(a: number, b: number, ...args: [number, number]) { }
////fn1(1, 2, 3, 4);
// @Filename: b.ts
////function /*c*/fn2/*d*/(a: number, b: number, ...args: [number, number, ...string[]]) { }
////fn2(1, 2, 3, 4);
////fn2(1, 2, 3, 4, "a");
// @Filename: c.ts
////function /*e*/fn3/*f*/(b: boolean, c: []) { }
////fn3(true, []);
// @Filename: d.ts
////function /*g*/fn4/*h*/(a: number, ...args: [...string[]] ) { }
////fn4(2);
////fn4(1, "two", "three");
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 fn1({ a, b, args }: { a: number; b: number; args: [number, number]; }) { }
fn1({ a: 1, b: 2, args: [3, 4] });`
});
goTo.select("c", "d");
edit.applyRefactor({
refactorName: "Convert parameters to destructured object",
actionName: "Convert parameters to destructured object",
actionDescription: "Convert parameters to destructured object",
newContent: `function fn2({ a, b, args }: { a: number; b: number; args: [number, number, ...string[]]; }) { }
fn2({ a: 1, b: 2, args: [3, 4] });
fn2({ a: 1, b: 2, args: [3, 4, "a"] });`
});
goTo.select("e", "f");
edit.applyRefactor({
refactorName: "Convert parameters to destructured object",
actionName: "Convert parameters to destructured object",
actionDescription: "Convert parameters to destructured object",
newContent: `function fn3({ b, c }: { b: boolean; c: []; }) { }
fn3({ b: true, c: [] });`
});
goTo.select("g", "h");
edit.applyRefactor({
refactorName: "Convert parameters to destructured object",
actionName: "Convert parameters to destructured object",
actionDescription: "Convert parameters to destructured object",
newContent: `function fn4({ a, args = [] }: { a: number; args?: [...string[]]; }) { }
fn4({ a: 2 });
fn4({ a: 1, args: ["two", "three"] });`
}); | {
"end_byte": 2064,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_tupleRestParam.ts"
} |
TypeScript/tests/cases/fourslash/cloduleAsBaseClass.ts_0_1005 | /// <reference path='fourslash.ts'/>
////class A {
//// constructor(x: number) { }
//// foo() { }
//// static bar() { }
////}
////
////module A {
//// export var x = 1;
//// export function baz() { }
////}
////
////class D extends A {
//// constructor() {
//// super(1);
//// }
//// foo2() { }
//// static bar2() { }
////}
////
////var d: D;
////d./*1*/
////D./*2*/
verify.completions({ marker: "1", exact: ["foo", "foo2"] });
edit.insert('foo()');
verify.completions({
marker: "2",
exact: completion.functionMembersPlus([
{ name: "bar", sortText: completion.SortText.LocalDeclarationPriority },
{ name: "bar2", sortText: completion.SortText.LocalDeclarationPriority },
{ name: "baz", sortText: completion.SortText.LocationPriority },
{ name: "prototype", sortText: completion.SortText.LocationPriority },
{ name: "x", sortText: completion.SortText.LocationPriority },
])
});
edit.insert('bar()');
verify.noErrors();
| {
"end_byte": 1005,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/cloduleAsBaseClass.ts"
} |
TypeScript/tests/cases/fourslash/codeFixSpellingAddSpaces3.ts_0_708 | /// <reference path='fourslash.ts' />
// Repro for https://github.com/microsoft/TypeScript/issues/49557
////enum NamesWithSpaces {
//// "NoSpace",
//// "One Space",
//// "Has Two Spaces",
//// "This Has Three Spaces",
//// "And This Has Four Spaces",
////
//// "Block One",
//// "Block Two",
//// "Block Three",
////
//// "This Has Three Spaces_________________________________________________________",
//// "And This Has Four Spaces_________________________________________________________",
////}
////
//// NamesWithSpaces.[|BlockThree|];
verify.codeFixAvailable([
{ description: "Change spelling to 'Block Three'" },
{ description: "Add missing enum member 'BlockThree'" },
]);
| {
"end_byte": 708,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixSpellingAddSpaces3.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentMissingBracketsDoKeyword.ts_0_115 | /// <reference path='fourslash.ts'/>
////do {/*1*/
goTo.marker("1");
edit.insert("\n");
verify.indentationIs(4);
| {
"end_byte": 115,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentMissingBracketsDoKeyword.ts"
} |
TypeScript/tests/cases/fourslash/completionListInUnclosedFunction02.ts_3_241 | / <reference path="fourslash.ts" />
////function foo(x: string, y: number, z: boolean) {
//// function bar(a: number, b: string, c: typeof /*1*/
verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b"]})
| {
"end_byte": 241,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedFunction02.ts"
} |
TypeScript/tests/cases/fourslash/extract-method47.ts_0_1422 | /// <reference path="fourslash.ts" />
////export function fn(m: number, n: number) {
//// const mode = m >= 0 ? "a" : "b";
//// let result: number = 0;
////
//// if (mode === "a") {
//// /*a*/for (let i = 0; i < n; i++) {
//// const rand = Math.random();
//// switch (rand) {
//// case 0.5:
//// result = rand;
//// break;
//// default:
//// result = 1;
//// break;
//// }
//// }/*b*/
//// }
//// else {
//// result = 0;
//// }
//// return result;
////}
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to function in module scope",
newContent:
`export function fn(m: number, n: number) {
const mode = m >= 0 ? "a" : "b";
let result: number = 0;
if (mode === "a") {
result = /*RENAME*/newFunction(n, result);
}
else {
result = 0;
}
return result;
}
function newFunction(n: number, result: number) {
for (let i = 0; i < n; i++) {
const rand = Math.random();
switch (rand) {
case 0.5:
result = rand;
break;
default:
result = 1;
break;
}
}
return result;
}
`
});
| {
"end_byte": 1422,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method47.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationStatements.ts_0_1724 | /// <reference path='fourslash.ts' />
// @BaselineFile: bpSpan_stmts.baseline
// @Filename: bpSpan_stmts.ts
////function f() {
//// var y;
//// var x = 0;
//// for (var i = 0; i < 10; i++) {
//// x += i;
//// x *= 0;
//// }
//// if (x > 17) {
//// x /= 9;
//// } else {
//// x += 10;
//// x++;
//// }
//// var a = [
//// 1,
//// 2,
//// 3
//// ];
//// var obj = {
//// z: 1,
//// q: "hello"
//// };
//// for (var j in a) {
//// obj.z = a[j];
//// var v = 10;
//// }
//// try {
//// obj.q = "ohhh";
//// } catch (e) {
//// if (obj.z < 10) {
//// obj.z = 12;
//// } else {
//// obj.q = "hmm";
//// }
//// }
//// try {
//// throw new Error();
//// } catch (e1) {
//// var b = e1;
//// } finally {
//// y = 70;
//// }
//// with (obj) {
//// i = 2;
//// z = 10;
//// }
//// switch (obj.z) {
//// case 0: {
//// x++;
//// break;
////
//// }
//// case 1: {
//// x--;
//// break;
////
//// }
//// default: {
//// x *= 2;
//// x = 50;
//// break;
////
//// }
//// }
//// while (x < 10) {
//// x++;
//// }
//// do {
//// x--;
//// } while (x > 4)
//// x = y;
//// var z = (x == 1) ? x + 1 : x - 1;
//// (x == 1) ? x + 1 : x - 1;
//// x === 1;
//// x = z = 40;
//// eval("y");
//// return;
////}
////var b = function () {
//// var x = 10;
//// x = x + 1;
////};
////f();
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 1724,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationStatements.ts"
} |
TypeScript/tests/cases/fourslash/arrayCallAndConstructTypings.ts_0_665 | /// <reference path='fourslash.ts' />
////var a/*1*/1 = new Array();
////var a/*2*/2 = new Array(1);
////var a/*3*/3 = new Array<boolean>();
////var a/*4*/4 = new Array<boolean>(1);
////var a/*5*/5 = new Array("s");
////var a/*6*/6 = Array();
////var a/*7*/7 = Array(1);
////var a/*8*/8 = Array<boolean>();
////var a/*9*/9 = Array<boolean>(1);
////var a/*10*/10 = Array("s");
verify.quickInfos({
1: "var a1: any[]",
2: "var a2: any[]",
3: "var a3: boolean[]",
4: "var a4: boolean[]",
5: "var a5: string[]",
6: "var a6: any[]",
7: "var a7: any[]",
8: "var a8: boolean[]",
9: "var a9: boolean[]",
10: "var a10: string[]"
});
| {
"end_byte": 665,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/arrayCallAndConstructTypings.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertImport_namedToNamespace7.ts_0_398 | /// <reference path='fourslash.ts' />
/////*a*/import { join } from "path";
////
/////*b*/
////join('a', 'b');
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert import",
actionName: "Convert named imports to namespace import",
actionDescription: "Convert named imports to namespace import",
newContent:
`import * as path from "path";
path.join('a', 'b');`,
});
| {
"end_byte": 398,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertImport_namedToNamespace7.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsMissingModulesOverlappingSpecifiers.ts_0_251 | /// <reference path="fourslash.ts" />
//// // https://github.com/microsoft/TypeScript/issues/5551
//// import { resolve/*0*/ as resolveUrl } from "idontcare";
//// import { resolve/*1*/ } from "whatever";
verify.baselineFindAllReferences("0", "1");
| {
"end_byte": 251,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsMissingModulesOverlappingSpecifiers.ts"
} |
TypeScript/tests/cases/fourslash/formattingOnClosingBracket.ts_0_2752 | /// <reference path='fourslash.ts'/>
////function f( ) {/*1*/
////var x = 3;/*2*/
//// var z = 2 ;/*3*/
//// a = z ++ - 2 * x ;/*4*/
//// for ( ; ; ) {/*5*/
//// a+=(g +g)*a%t;/*6*/
//// b -- ;/*7*/
////}/*8*/
////
//// switch ( a )/*9*/
//// {
//// case 1 : {/*10*/
//// a ++ ;/*11*/
//// b--;/*12*/
//// if(a===a)/*13*/
//// return;/*14*/
//// else/*15*/
//// {
//// for(a in b)/*16*/
//// if(a!=a)/*17*/
//// {
//// for(a in b)/*18*/
//// {
////a++;/*19*/
//// }/*20*/
//// }/*21*/
//// }/*22*/
//// }/*23*/
//// default:/*24*/
//// break;/*25*/
//// }/*26*/
////}/*27*/
format.setOption("InsertSpaceAfterSemicolonInForStatements", true);
format.document();
goTo.marker("1");
verify.currentLineContentIs("function f() {");
goTo.marker("2");
verify.currentLineContentIs(" var x = 3;");
goTo.marker("3");
verify.currentLineContentIs(" var z = 2;");
goTo.marker("4");
verify.currentLineContentIs(" a = z++ - 2 * x;");
goTo.marker("5");
verify.currentLineContentIs(" for (; ;) {");
goTo.marker("6");
verify.currentLineContentIs(" a += (g + g) * a % t;");
goTo.marker("7");
verify.currentLineContentIs(" b--;");
goTo.marker("8");
verify.currentLineContentIs(" }");
goTo.marker("9");
verify.currentLineContentIs(" switch (a) {");
goTo.marker("10");
verify.currentLineContentIs(" case 1: {");
goTo.marker("11");
verify.currentLineContentIs(" a++;");
goTo.marker("12");
verify.currentLineContentIs(" b--;");
goTo.marker("13");
verify.currentLineContentIs(" if (a === a)");
goTo.marker("14");
verify.currentLineContentIs(" return;");
goTo.marker("15");
verify.currentLineContentIs(" else {");
goTo.marker("16");
verify.currentLineContentIs(" for (a in b)");
goTo.marker("17");
verify.currentLineContentIs(" if (a != a) {");
goTo.marker("18");
verify.currentLineContentIs(" for (a in b) {");
goTo.marker("19");
verify.currentLineContentIs(" a++;");
goTo.marker("20");
verify.currentLineContentIs(" }");
goTo.marker("21");
verify.currentLineContentIs(" }");
goTo.marker("22");
verify.currentLineContentIs(" }");
goTo.marker("23");
verify.currentLineContentIs(" }");
goTo.marker("24");
verify.currentLineContentIs(" default:");
goTo.marker("25");
verify.currentLineContentIs(" break;");
goTo.marker("26");
verify.currentLineContentIs(" }");
goTo.marker("27");
verify.currentLineContentIs("}"); | {
"end_byte": 2752,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingOnClosingBracket.ts"
} |
TypeScript/tests/cases/fourslash/extract-const4.ts_0_484 | /// <reference path='fourslash.ts' />
// GH#35372
// @jsx: preserve
// @filename: main.tsx
////function foo() {
//// return <div>/*a*/<a>content</a>/*b*/</div>;
////}
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "constant_scope_0",
actionDescription: "Extract to constant in enclosing scope",
newContent:
`function foo() {
const /*RENAME*/newLocal = <a>content</a>;
return <div>{newLocal}</div>;
}`
});
| {
"end_byte": 484,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const4.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties2.ts_0_385 | /// <reference path='fourslash.ts' />
////interface Foo {
//// a: number;
//// b: string;
//// c: any;
////}
////[|class C {
//// public c: Foo = {};
////}|]
verify.codeFix({
index: 0,
description: ts.Diagnostics.Add_missing_properties.message,
newRangeContent:
`class C {
public c: Foo = {
a: 0,
b: "",
c: undefined
};
}`
});
| {
"end_byte": 385,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties2.ts"
} |
TypeScript/tests/cases/fourslash/importFixes_quotePreferenceSingle_importHelpers.ts_0_301 | /// <reference path='fourslash.ts'/>
// @importHelpers: true
// @filename: /a.ts
////export default () => {};
// @filename: /b.ts
////export default () => {};
// @filename: /test.ts
////import a from './a';
////[|b|];
goTo.file("/test.ts");
verify.importFixAtPosition([`import b from './b';
b`]);
| {
"end_byte": 301,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importFixes_quotePreferenceSingle_importHelpers.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingCallParentheses4.ts_0_587 | /// <reference path='fourslash.ts'/>
// @strictNullChecks: true
////class Foo {
//// test() {
//// return true;
//// }
//// run() {
//// this.test/**/ ? console.log('test') : undefined;
//// }
////}
verify.codeFixAvailable([
{ description: ts.Diagnostics.Add_missing_call_parentheses.message }
]);
verify.codeFix({
description: ts.Diagnostics.Add_missing_call_parentheses.message,
index: 0,
newFileContent:
`class Foo {
test() {
return true;
}
run() {
this.test() ? console.log('test') : undefined;
}
}`,
});
| {
"end_byte": 587,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingCallParentheses4.ts"
} |
TypeScript/tests/cases/fourslash/completionsImportOrExportSpecifier.ts_0_4041 | ///<reference path="fourslash.ts" />
// @Filename: exports.ts
//// export let foo = 1;
//// let someValue = 2;
//// let someType = 3;
//// type someType2 = 4;
//// export {
//// someValue as "__some value",
//// someType as "__some type",
//// type someType2 as "__some type2",
//// };
// @Filename: values.ts
//// import { /*valueImport0*/ } from "./exports";
//// import { /*valueImport1*/ as valueImport1 } from "./exports";
//// import { foo as /*valueImport2*/ } from "./exports";
//// import { foo, /*valueImport3*/ as valueImport3 } from "./exports";
//// import * as _a from "./exports";
//// _a./*namespaceImport1*/;
////
//// export { /*valueExport0*/ } from "./exports";
//// export { /*valueExport1*/ as valueExport1 } from "./exports";
//// export { foo as /*valueExport2*/ } from "./exports";
//// export { foo, /*valueExport3*/ } from "./exports";
// @Filename: types.ts
//// import { type /*typeImport0*/ } from "./exports";
//// import { type /*typeImport1*/ as typeImport1 } from "./exports";
//// import { type foo as /*typeImport2*/ } from "./exports";
//// import { type foo, type /*typeImport3*/ as typeImport3 } from "./exports";
//// import * as _a from "./exports";
////
//// export { type /*typeExport0*/ } from "./exports";
//// export { type /*typeExport1*/ as typeExport1 } from "./exports";
//// export { type foo as /*typeExport2*/ } from "./exports";
//// export { type foo, type /*typeExport3*/ } from "./exports";
const __some_type = { name: "__some type", insertText: '"__some type"' }
const __some_type2 = { name: "__some type2", insertText: '"__some type2"' }
const __some_value = { name: "__some value", insertText: '"__some value"' }
const __some_type_as = { name: "__some type", insertText: '"__some type" as __some_type' }
const __some_type_squared = { name: "__some type", insertText: '["__some type"]' }
const __some_type2_as = { name: "__some type2", insertText: '"__some type2" as __some_type2' }
const __some_type2_squared = { name: "__some type2", insertText: '["__some type2"]' }
const __some_value_as = { name: "__some value", insertText: '"__some value" as __some_value' }
const __some_value_squared = { name: "__some value", insertText: '["__some value"]' }
const typeKeyword = { name: "type", sortText: completion.SortText.GlobalsOrKeywords }
verify.completions({ marker: "valueImport0", exact: [__some_type_as, __some_type2_as, __some_value_as, "foo", typeKeyword] });
verify.completions({ marker: "valueImport1", exact: [__some_type, __some_type2, __some_value, "foo", typeKeyword] });
verify.completions({ marker: "valueImport2", exact: [] });
verify.completions({ marker: "valueImport3", exact: [__some_type, __some_type2, __some_value, typeKeyword] });
// see https://github.com/microsoft/TypeScript/issues/58815
verify.completions({ marker: 'namespaceImport1', exact: [/* __some_type_squared, __some_value_squared, */ 'foo'] })
verify.completions({ marker: "valueExport0", exact: [__some_type, __some_type2, __some_value, "foo", typeKeyword] });
verify.completions({ marker: "valueExport1", exact: [__some_type, __some_type2, __some_value, "foo", typeKeyword] });
verify.completions({ marker: "valueExport2", exact: [] });
verify.completions({ marker: "valueExport3", exact: [__some_type, __some_type2, __some_value, typeKeyword] });
verify.completions({ marker: "typeImport0", exact: [__some_type_as, __some_type2_as, __some_value_as, "foo"] });
verify.completions({ marker: "typeImport1", exact: [__some_type, __some_type2, __some_value, "foo"] });
verify.completions({ marker: "typeImport2", exact: [] });
verify.completions({ marker: "typeImport3", exact: [__some_type, __some_type2, __some_value] });
verify.completions({ marker: "typeExport0", exact: [__some_type, __some_type2, __some_value, "foo"] });
verify.completions({ marker: "typeExport1", exact: [__some_type, __some_type2, __some_value, "foo"] });
verify.completions({ marker: "typeExport2", exact: [] });
verify.completions({ marker: "typeExport3", exact: [__some_type, __some_type2, __some_value] });
| {
"end_byte": 4041,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImportOrExportSpecifier.ts"
} |
TypeScript/tests/cases/fourslash/findAllReferencesOfConstructor.ts_0_987 | /// <reference path="fourslash.ts" />
// @Filename: a.ts
////export class C {
//// /*0*/constructor(n: number);
//// /*1*/constructor();
//// /*2*/constructor(n?: number){}
//// static f() {
//// this.f();
//// new this();
//// }
////}
////new C();
// Does not handle alias.
////const D = C;
////new D();
// @Filename: b.ts
////import { C } from "./a";
////new C();
// @Filename: c.ts
////import { C } from "./a";
////class D extends C {
//// constructor() {
//// super();
//// super.method();
//// }
//// method() { super(); }
////}
// Does not find 'super()' calls for a class that merely implements 'C',
// since those must be calling a different constructor.
////class E implements C {
//// constructor() { super(); }
////}
// Works with qualified names too
// @Filename: d.ts
////import * as a from "./a";
////new a.C();
////class d extends a.C { constructor() { super(); }
verify.baselineFindAllReferences('0', '1', '2')
| {
"end_byte": 987,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllReferencesOfConstructor.ts"
} |
TypeScript/tests/cases/fourslash/tsxFindAllReferences6.ts_0_563 | /// <reference path='fourslash.ts' />
/// <reference path='fourslash.ts' />
//@Filename: file.tsx
// @jsx: preserve
// @noLib: true
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// }
//// interface ElementAttributesProperty { props; }
//// }
//// interface OptionPropBag {
//// propx: number
//// propString: string
//// optional?: boolean
//// }
//// declare function Opt(attributes: OptionPropBag): JSX.Element;
//// let opt = <Opt /*1*/wrong />;
verify.baselineFindAllReferences('1');
| {
"end_byte": 563,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxFindAllReferences6.ts"
} |
TypeScript/tests/cases/fourslash/addSignaturePartial.ts_0_106 | /// <reference path="fourslash.ts"/>
////
edit.insert('interface Number { toFixed');
edit.insert('(');
| {
"end_byte": 106,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/addSignaturePartial.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfArrayBindingPattern.ts_0_3162 | /// <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;
////}
////let nameA: string, primarySkillA: string, secondarySkillA: string;
////let numberB: number, nameB: string;
////let numberA2: number, nameA2: string, skillA2: string, nameMA: string;
////let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[];
////for ([, nameA] of robots) {
//// console.log(nameA);
////}
////for ([, nameA] of getRobots()) {
//// console.log(nameA);
////}
////for ([, nameA] of [robotA, robotB]) {
//// console.log(nameA);
////}
////for ([, [primarySkillA, secondarySkillA]] of multiRobots) {
//// console.log(primarySkillA);
////}
////for ([, [primarySkillA, secondarySkillA]] of getMultiRobots()) {
//// console.log(primarySkillA);
////}
////for ([, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) {
//// console.log(primarySkillA);
////}
////for ([numberB] of robots) {
//// console.log(numberB);
////}
////for ([numberB] of getRobots()) {
//// console.log(numberB);
////}
////for ([numberB] of [robotA, robotB]) {
//// console.log(numberB);
////}
////for ([nameB] of multiRobots) {
//// console.log(nameB);
////}
////for ([nameB] of getMultiRobots()) {
//// console.log(nameB);
////}
////for ([nameB] of [multiRobotA, multiRobotB]) {
//// console.log(nameB);
////}
////for ([numberA2, nameA2, skillA2] of robots) {
//// console.log(nameA2);
////}
////for ([numberA2, nameA2, skillA2] of getRobots()) {
//// console.log(nameA2);
////}
////for ([numberA2, nameA2, skillA2] of [robotA, robotB]) {
//// console.log(nameA2);
////}
////for ([nameMA, [primarySkillA, secondarySkillA]] of multiRobots) {
//// console.log(nameMA);
////}
////for ([nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) {
//// console.log(nameMA);
////}
////for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) {
//// console.log(nameMA);
////}
////for ([numberA3, ...robotAInfo] of robots) {
//// console.log(numberA3);
////}
////for ([numberA3, ...robotAInfo] of getRobots()) {
//// console.log(numberA3);
////}
////for ([numberA3, ...robotAInfo] of [robotA, robotB]) {
//// console.log(numberA3);
////}
////for ([...multiRobotAInfo] of multiRobots) {
//// console.log(multiRobotAInfo);
////}
////for ([...multiRobotAInfo] of getMultiRobots()) {
//// console.log(multiRobotAInfo);
////}
////for ([...multiRobotAInfo] of [multiRobotA, multiRobotB]) {
//// console.log(multiRobotAInfo);
////}
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 3162,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfArrayBindingPattern.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionImportedNames3.ts_0_589 | /// <reference path='fourslash.ts' />
// @Filename: e.ts
//// import {M, [|/*classAliasDefinition*/C|], I} from "./d";
//// var c = new [|/*classReference*/C|]();
// @Filename: d.ts
////export * from "./c";
// @Filename: c.ts
////export {Module as M, Class as C, Interface as I} from "./b";
// @Filename: b.ts
////export * from "./a";
// @Filename: a.ts
////export module Module {
////}
////export class /*classDefinition*/Class {
//// private f;
////}
////export interface Interface {
//// x;
////}
verify.baselineGoToDefinition("classReference", "classAliasDefinition");
| {
"end_byte": 589,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionImportedNames3.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesThrow8.ts_0_325 | /// <reference path='fourslash.ts' />
////try {
//// throw 10;
////
//// try {
//// [|throw|] 10;
//// }
//// catch (x) {
//// throw 10;
//// }
//// finally {
//// throw 10;
//// }
////}
////finally {
//// throw 10;
////}
////
////throw 10;
verify.baselineDocumentHighlights();
| {
"end_byte": 325,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesThrow8.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesDeclare3.ts_0_1584 | /// <reference path='fourslash.ts' />
////
////[|declare|] var x;
////export [|declare|] var y, z;
////
////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) {
//// }
//// }
//// }
////
//// declare var ambientThing: number;
//// export var exportedThing = 10;
//// declare function foo(): string;
////}
////
////[|declare|] export var v1, v2;
////[|declare|] module dm { }
////export class EC { }
verify.baselineDocumentHighlights();
| {
"end_byte": 1584,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesDeclare3.ts"
} |
TypeScript/tests/cases/fourslash/inlayHintsInteractiveVariableTypes2.ts_0_461 | /// <reference path="fourslash.ts" />
//// const object = { foo: 1, bar: 2 }
//// const array = [1, 2]
//// const a = object;
//// const { foo, bar } = object;
//// const {} = object;
//// const b = array;
//// const [ first, second ] = array;
//// const [] = array;
//// declare function foo<T extends number>(t: T): T
//// const x = foo(1)
verify.baselineInlayHints(undefined, {
includeInlayVariableTypeHints: true,
interactiveInlayHints: true
});
| {
"end_byte": 461,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlayHintsInteractiveVariableTypes2.ts"
} |
TypeScript/tests/cases/fourslash/unusedLocalsInFunction3.ts_0_250 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
////function greeter() {
//// [| var x, y = 0,z = 1; |]
//// x+1;
//// z+1;
////}
verify.rangeAfterCodeFix("var x,z = 1;", /*includeWhiteSpace*/ undefined, /*errorCode*/ 6133);
| {
"end_byte": 250,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedLocalsInFunction3.ts"
} |
TypeScript/tests/cases/fourslash/findReferencesAfterEdit.ts_0_342 | /// <reference path='fourslash.ts'/>
// @Filename: a.ts
////interface A {
//// /*1*/foo: string;
////}
// @Filename: b.ts
///////<reference path='a.ts'/>
/////**/
////function foo(x: A) {
//// x./*2*/foo
////}
verify.baselineFindAllReferences("1", "2");
goTo.marker("");
edit.insert("\n");
verify.baselineFindAllReferences("1", "2"); | {
"end_byte": 342,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findReferencesAfterEdit.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.