_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/fourslash/documentHighlightAtParameterPropertyDeclaration1.ts_3_594
/ <reference path='fourslash.ts'/> // @Filename: file1.ts //// class Foo { //// constructor(private [|privateParam|]: number, //// public [|publicParam|]: string, //// protected [|protectedParam|]: boolean) { //// //// let localPrivate = [|privateParam|]; //// this.[|privateParam|] += 10; //// //// let localPublic = [|publicParam|]; //// this.[|publicParam|] += " Hello!"; //// //// let localProtected = [|protectedParam|]; //// this.[|protectedParam|] = false; //// } //// } verify.baselineDocumentHighlights();
{ "end_byte": 594, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/documentHighlightAtParameterPropertyDeclaration1.ts" }
TypeScript/tests/cases/fourslash/inlineVariableTemplateString9.ts_0_380
/// <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": 380, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlineVariableTemplateString9.ts" }
TypeScript/tests/cases/fourslash/quickInfoLink3.ts_0_320
///<reference path="fourslash.ts" /> //// class Foo<T> { //// /** //// * {@link Foo} //// * {@link Foo<T>} //// * {@link Foo<Array<X>>} //// * {@link Foo<>} //// * {@link Foo>} //// * {@link Foo<} //// */ //// bar/**/(){} //// } verify.noErrors() verify.baselineQuickInfo();
{ "end_byte": 320, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoLink3.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingAwait_topLevel.ts_0_320
/// <reference path="fourslash.ts" /> ////declare function getPromise(): Promise<string>; ////const p = getPromise(); ////while (true) { //// p/*0*/.toLowerCase(); //// getPromise()/*1*/.toLowerCase(); ////} verify.not.codeFixAvailable("addMissingAwait"); verify.not.codeFixAvailable("addMissingAwaitToInitializer");
{ "end_byte": 320, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingAwait_topLevel.ts" }
TypeScript/tests/cases/fourslash/codeFixAddConvertToUnknownForNonOverlappingTypes_all.ts_0_493
/// <reference path='fourslash.ts' /> ////const s1 = 1 as string; ////const o1 = s + " word" as object; //// ////const s2 = <string>2; ////const o2 = <object>s2; verify.codeFixAll({ fixId: "addConvertToUnknownForNonOverlappingTypes", fixAllDescription: "Add 'unknown' to all conversions of non-overlapping types", newFileContent: `const s1 = 1 as unknown as string; const o1 = s + " word" as unknown as object; const s2 = <string><unknown>2; const o2 = <object><unknown>s2;` });
{ "end_byte": 493, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddConvertToUnknownForNonOverlappingTypes_all.ts" }
TypeScript/tests/cases/fourslash/completionsAfterPropertyNameInClass.ts_0_238
/// <reference path="fourslash.ts" /> // @allowJs: true // @filename: /a.js ////class C1 { //// async #fo/*a*/ ////} ////class C2 { //// async fo/*b*/ ////} verify.baselineCompletions({ includeInsertTextCompletions: true, });
{ "end_byte": 238, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsAfterPropertyNameInClass.ts" }
TypeScript/tests/cases/fourslash/codeFixCalledES2015Import3.ts_0_526
/// <reference path='fourslash.ts' /> // @esModuleInterop: true // @module: amd // @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": 526, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCalledES2015Import3.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType88.ts_0_564
/// <reference path='fourslash.ts' /> //// type B = { b: string }; //// type C = { c: number }; //// //// interface X<T extends { prop: /*1*/T | /*3*/B /*2*/| C/*4*/ }> {} goTo.select("1", "2"); verify.not.refactorAvailable("Extract type"); goTo.select("3", "4"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `type B = { b: string }; type C = { c: number }; type /*RENAME*/NewType = B | C; interface X<T extends { prop: T | NewType }> {}`, });
{ "end_byte": 564, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType88.ts" }
TypeScript/tests/cases/fourslash/completionForStringLiteralRelativeImportAllowJSTrue.ts_0_779
/// <reference path='fourslash.ts' /> // Should give completions for ts and js files when allowJs is true. // @allowJs: true // @Filename: test0.ts //// import * as foo1 from ".//*import_as0*/ //// import * as foo2 from "./f/*import_as1*/ //// import foo3 = require(".//*import_equals0*/ //// import foo4 = require("./f/*import_equals1*/ //// var foo5 = require(".//*require0*/ //// var foo6 = require("./f/*require1*/ // @Filename: f1.ts //// // @Filename: f2.js //// // @Filename: f3.d.ts //// // @Filename: f4.tsx //// // @Filename: f5.js //// // @Filename: f6.jsx //// // @Filename: g1.ts //// // @Filename: g2.js //// verify.completions({ marker: test.markers(), exact: ["f1", "f2", "f3", "f4", "f5", "f6", "g1", "g2"], isNewIdentifierLocation: true, });
{ "end_byte": 779, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteralRelativeImportAllowJSTrue.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionSimple.ts_0_222
/// <reference path='fourslash.ts' /> // @Filename: Definition.ts ////class /*2*/c { } // @Filename: Consumption.ts //// var n = new [|/*1*/c|](); //// var n = new [|c/*3*/|](); verify.baselineGoToDefinition("1", "3");
{ "end_byte": 222, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionSimple.ts" }
TypeScript/tests/cases/fourslash/memberListErrorRecovery.ts_0_234
/// <reference path="fourslash.ts" /> ////class Foo { static fun() { }; } //// ////Foo./**/; /////*1*/var bar; verify.completions({ marker: "", includes: [{ name: "fun", sortText: completion.SortText.LocalDeclarationPriority }] });
{ "end_byte": 234, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberListErrorRecovery.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingParam6.ts_0_245
/// <reference path="fourslash.ts" /> ////[|const f = () => {}|] //// ////f(""); verify.codeFix({ description: [ts.Diagnostics.Add_missing_parameter_to_0.message, "f"], index: 0, newRangeContent: "const f = (p0: string) => {}" });
{ "end_byte": 245, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingParam6.ts" }
TypeScript/tests/cases/fourslash/navigationBarImports.ts_0_1038
/// <reference path="fourslash.ts"/> ////import a, {b} from "m"; ////import c = require("m"); ////import * as d from "m"; verify.navigationTree({ "text": "\"navigationBarImports\"", "kind": "module", "childItems": [ { "text": "a", "kind": "alias" }, { "text": "b", "kind": "alias" }, { "text": "c", "kind": "alias" }, { "text": "d", "kind": "alias" } ] }); verify.navigationBar([ { "text": "\"navigationBarImports\"", "kind": "module", "childItems": [ { "text": "a", "kind": "alias" }, { "text": "b", "kind": "alias" }, { "text": "c", "kind": "alias" }, { "text": "d", "kind": "alias" } ] } ]);
{ "end_byte": 1038, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarImports.ts" }
TypeScript/tests/cases/fourslash/extract-method23.ts_0_190
/// <reference path='fourslash.ts' /> //// declare namespace Foo { //// const x = /*start*/3/*end*/; //// } goTo.select('start', 'end') verify.not.refactorAvailable('Extract Symbol');
{ "end_byte": 190, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method23.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionJsxCall.ts_0_281
/// <reference path='fourslash.ts' /> // @filename: ./test.tsx //// interface FC<P = {}> { //// (props: P, context?: any): string; //// } //// //// const Thing: FC = (props) => <div></div>; //// const HelloWorld = () => <[|/**/Thing|] />; verify.baselineGoToDefinition("");
{ "end_byte": 281, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionJsxCall.ts" }
TypeScript/tests/cases/fourslash/renameImportSpecifierPropertyName.ts_0_198
/// <reference path="fourslash.ts" /> // @Filename: canada.ts ////export interface /**/Ginger {} // @Filename: dry.ts ////import { Ginger as Ale } from './canada'; verify.baselineRename("", {});
{ "end_byte": 198, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameImportSpecifierPropertyName.ts" }
TypeScript/tests/cases/fourslash/completionsOverridingMethod19.ts_0_1665
/// <reference path="fourslash.ts" /> // @Filename: a.ts // @newline: LF //// class Base { //// method() {} //// protected prop = 1; //// } //// class E extends Base { //// protected notamodifier override /**/ //// } verify.completions({ marker: "", 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, }, ] },); verify.applyCodeActionFromCompletion("", { preferences: { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: false, includeCompletionsWithClassMemberSnippets: true, }, name: "method", source: completion.CompletionSource.ClassMemberSnippet, description: "Update modifiers of 'method'", newFileContent: `class Base { method() {} protected prop = 1; } class E extends Base { protected notamodifier }` });
{ "end_byte": 1665, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsOverridingMethod19.ts" }
TypeScript/tests/cases/fourslash/codeFixSpellingShortName1.ts_0_111
/// <reference path='fourslash.ts' /> ////export let ab = 1; ////[|aB|] = 1; verify.rangeAfterCodeFix('ab');
{ "end_byte": 111, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixSpellingShortName1.ts" }
TypeScript/tests/cases/fourslash/completionListPrivateMembers3.ts_0_388
/// <reference path="fourslash.ts"/> ////class Other { //// public p; //// protected p2 //// private p3; ////} //// ////class Self { //// private other: Other; //// //// method() { //// this.other./*1*/; //// //// this.other.p/*2*/; //// //// this.other.p/*3*/.toString(); //// } ////} verify.completions({ marker: ["1", "2", "3"], exact: "p" });
{ "end_byte": 388, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListPrivateMembers3.ts" }
TypeScript/tests/cases/fourslash/indentNewExpressionNoBraces.ts_0_117
/// <reference path='fourslash.ts'/> ////new Foo/*1*/ goTo.marker("1"); edit.insert("\n"); verify.indentationIs(0);
{ "end_byte": 117, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/indentNewExpressionNoBraces.ts" }
TypeScript/tests/cases/fourslash/unusedParameterInFunction1AddUnderscore.ts_0_228
/// <reference path='fourslash.ts' /> // @noUnusedParameters: true ////function greeter(x) {} verify.codeFix({ description: "Prefix 'x' with an underscore", index: 1, newFileContent: "function greeter(_x) {}", });
{ "end_byte": 228, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedParameterInFunction1AddUnderscore.ts" }
TypeScript/tests/cases/fourslash/quickInfoCommentsClass.ts_0_1384
/// <reference path='fourslash.ts' /> /////** This is class c2 without constructor*/ ////class c/*1*/2 { ////} ////var i/*2*/2 = new c/*28*/2(); ////var i2/*4*/_c = c/*5*/2; ////class c/*6*/3 { //// /** Constructor comment*/ //// constructor() { //// } ////} ////var i/*7*/3 = new c/*29*/3(); ////var i3/*9*/_c = c/*10*/3; /////** Class comment*/ ////class c/*11*/4 { //// /** Constructor comment*/ //// constructor() { //// } ////} ////var i/*12*/4 = new c/*30*/4(); ////var i4/*14*/_c = c/*15*/4; /////** Class with statics*/ ////class c/*16*/5 { //// static s1: number; ////} ////var i/*17*/5 = new c/*31*/5(); ////var i5_/*19*/c = c/*20*/5; /////** class with statics and constructor*/ ////class c/*21*/6 { //// /** s1 comment*/ //// static s1: number; //// /** constructor comment*/ //// constructor() { //// } ////} ////var i/*22*/6 = new c/*32*/6(); ////var i6/*24*/_c = c/*25*/6; //// ////class a { //// /** //// constructor for a //// @param a this is my a //// */ //// constructor(a: string) { //// } ////} ////new a("Hello"); ////module m { //// export module m2 { //// /** class comment */ //// export class c1 { //// /** constructor comment*/ //// constructor() { //// } //// } //// } ////} ////var myVar = new m.m2.c/*33*/1(); verify.baselineQuickInfo()
{ "end_byte": 1384, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoCommentsClass.ts" }
TypeScript/tests/cases/fourslash/findAllRefsOnDefinition2.ts_0_440
/// <reference path="fourslash.ts" /> //@Filename: findAllRefsOnDefinition2-import.ts ////export module Test{ //// //// /*1*/export interface /*2*/start { } //// //// export interface stop { } ////} //@Filename: findAllRefsOnDefinition2.ts ////import Second = require("./findAllRefsOnDefinition2-import"); //// ////var start: Second.Test./*3*/start; ////var stop: Second.Test.stop; verify.baselineFindAllReferences('1', '2', '3');
{ "end_byte": 440, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsOnDefinition2.ts" }
TypeScript/tests/cases/fourslash/quickInfoForGenericConstraints1.ts_0_217
/// <reference path='fourslash.ts'/> ////function foo4<T extends Date>(te/**/st: T): T; ////function foo4<T extends Date>(test: any): any { return null; } verify.quickInfoAt("", "(parameter) test: T extends Date");
{ "end_byte": 217, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForGenericConstraints1.ts" }
TypeScript/tests/cases/fourslash/completionsImport_weirdDefaultSynthesis.ts_0_575
/// <reference path="fourslash.ts" /> // @Filename: /collection.ts //// class Collection { //// public static readonly default: typeof Collection = Collection; //// } //// export = Collection as typeof Collection & { default: typeof Collection }; // @Filename: /index.ts //// Colle/**/ verify.applyCodeActionFromCompletion("", { name: "Collection", source: "/collection", description: `Add import from "./collection"`, preferences: { includeCompletionsForModuleExports: true }, newFileContent: `import Collection = require("./collection");\n\nColle` });
{ "end_byte": 575, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_weirdDefaultSynthesis.ts" }
TypeScript/tests/cases/fourslash/completionListOutsideOfClosedArrowFunction01.ts_0_139
/// <reference path='fourslash.ts' /> ////// no a or b /////*1*/(a, b) => { } verify.completions({ marker: "1", excludes: ["a", "b"] });
{ "end_byte": 139, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListOutsideOfClosedArrowFunction01.ts" }
TypeScript/tests/cases/fourslash/jsdocDeprecated_suggestion22.ts_0_303
/// <reference path="fourslash.ts" /> // @filename: /a.ts ////const foo: { //// /** //// * @deprecated //// */ //// (a: string, b: string): string; //// (a: string, b: number): string; ////} = (a: string, b: string | number) => a + b; //// ////[|foo|](1, 1); verify.getSuggestionDiagnostics([]);
{ "end_byte": 303, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocDeprecated_suggestion22.ts" }
TypeScript/tests/cases/fourslash/codeFixInferFromCallInAssignment.ts_0_235
/// <reference path='fourslash.ts' /> // @noImplicitAny: true //// function inferAny( [| app |] ) { //// const result = app.use('hi') //// return result //// } verify.rangeAfterCodeFix("app: { use: (arg0: string) => any }");
{ "end_byte": 235, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromCallInAssignment.ts" }
TypeScript/tests/cases/fourslash/getJavaScriptCompletions14.ts_0_339
/// <reference path="fourslash.ts" /> // @allowNonTsExtensions: true // @Filename: file1.js /////// <reference no-default-lib="true"/> ////interface Number { //// toExponential(fractionDigits?: number): string; ////} ////var x = 1; ////x./*1*/ verify.completions({ marker: "1", includes: { name: "toExponential", kind: "method" } });
{ "end_byte": 339, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptCompletions14.ts" }
TypeScript/tests/cases/fourslash/completionAsKeyword.ts_0_250
/// <reference path="fourslash.ts" /> ////const x = this /*1*/ ////function foo() { //// const x = this /*2*/ ////} verify.completions({ marker: ["1", "2"], includes: [{ name: "as", sortText: completion.SortText.GlobalsOrKeywords }] });
{ "end_byte": 250, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionAsKeyword.ts" }
TypeScript/tests/cases/fourslash/codeFixInferFromUsageNumberIndexSignature.ts_0_221
/// <reference path='fourslash.ts' /> // @noImplicitAny: true ////function f([|a |]) { //// return a[0] + 1; ////} verify.rangeAfterCodeFix("a: number[]",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0);
{ "end_byte": 221, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageNumberIndexSignature.ts" }
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports43-expando-functions-5.ts_0_620
/// <reference path='fourslash.ts'/> // @isolatedDeclarations: true // @declaration: true // @lib: es2019 // @Filename: /code.ts ////function foo(): void {} ////// x already exists, so do not generate code for 'x' ////foo.x = 1; ////foo.y = 1; ////namespace foo { //// export let x = 42; ////} verify.codeFix({ description: "Annotate types of properties expando function in a namespace", index: 0, newFileContent: `function foo(): void {} declare namespace foo { export var y: number; } // x already exists, so do not generate code for 'x' foo.x = 1; foo.y = 1; namespace foo { export let x = 42; }` });
{ "end_byte": 620, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports43-expando-functions-5.ts" }
TypeScript/tests/cases/fourslash/completionOfAwaitPromiseNoRedundant.ts_0_576
/// <reference path='fourslash.ts'/> //// interface Foo { foo: string } //// async function foo(x: (a: number) => Promise<Foo>) { //// [|await x(1)./*1*/|] //// ;([|await x(1)./*2*/|]) //// ;(await ([|x(1)./*3*/|])) //// } for (const marker of [1, 2, 3]) { verify.completions({ marker: marker.toString(), includes: [ "then", { name: "foo", insertText: '(await x(1)).foo', replacementSpan: test.ranges()[marker - 1] }, ], preferences: { includeInsertTextCompletions: true, }, }); }
{ "end_byte": 576, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionOfAwaitPromiseNoRedundant.ts" }
TypeScript/tests/cases/fourslash/toggleLineComment10.ts_0_259
// Close and open multiline comments if the line already contains more comments. //@Filename: file.tsx //// const a = <div> //// Som[||]e{/* T */}ext //// </div>; verify.toggleLineComment( `const a = <div> {/*Some*/}{/* T */}{/*ext*/} </div>;`);
{ "end_byte": 259, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/toggleLineComment10.ts" }
TypeScript/tests/cases/fourslash/organizeImports1.ts_0_977
/// <reference path="fourslash.ts" /> // Regression test for bug #41417 //// import { //// d, d as D, //// c, //// c as C, b, //// b as B, a //// } from './foo'; //// import { //// h, h as H, //// g, //// g as G, f, //// f as F, e //// } from './foo'; //// //// console.log(a, B, b, c, C, d, D); //// console.log(e, f, F, g, G, H, h); verify.organizeImports( `import { a, b, b as B, c, c as C, d, d as D, e, f, f as F, g, g as G, h, h as H } from './foo'; console.log(a, B, b, c, C, d, D); console.log(e, f, F, g, G, H, h);`, /*mode*/ undefined, { organizeImportsIgnoreCase: true }); verify.organizeImports( `import { b as B, c as C, d as D, f as F, g as G, h as H, a, b, c, d, e, f, g, h } from './foo'; console.log(a, B, b, c, C, d, D); console.log(e, f, F, g, G, H, h);`, /*mode*/ undefined, { organizeImportsIgnoreCase: false });
{ "end_byte": 977, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImports1.ts" }
TypeScript/tests/cases/fourslash/formatVariableAssignments.ts_3_844
/ <reference path="fourslash.ts"/> ////let t: number; ////t /////*nextlineWithEqual*/=2+2; ////t= /////*nextlineWithoutEqual*/2 /////*nextline2*/+2; ////t /////*addition*/+= 22 /////*nextlineSemicolon*/; ////t ////=t /////*chained*/=t+ 4; format.document(); goTo.marker("nextlineWithEqual"); verify.indentationIs(4); verify.currentLineContentIs(" = 2 + 2;"); goTo.marker("nextlineWithoutEqual"); verify.indentationIs(4); verify.currentLineContentIs(" 2"); goTo.marker("nextline2"); verify.indentationIs(4); verify.currentLineContentIs(" + 2;"); goTo.marker("addition"); verify.indentationIs(4); verify.currentLineContentIs(" += 22"); goTo.marker("nextlineSemicolon"); verify.indentationIs(4); verify.currentLineContentIs(" ;"); goTo.marker("chained"); verify.indentationIs(4); verify.currentLineContentIs(" = t + 4;");
{ "end_byte": 844, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatVariableAssignments.ts" }
TypeScript/tests/cases/fourslash/quickInfoOnNewKeyword01.ts_0_506
/// <reference path='fourslash.ts' /> ////class Cat { //// /** //// * NOTE: this constructor is private! Please use the factory function //// */ //// private constructor() { } //// //// static makeCat() { new Cat(); } ////} //// ////ne/*1*/w Ca/*2*/t(); verify.quickInfoAt('1', 'constructor Cat(): Cat', 'NOTE: this constructor is private! Please use the factory function'); verify.quickInfoAt('2', 'constructor Cat(): Cat', 'NOTE: this constructor is private! Please use the factory function');
{ "end_byte": 506, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnNewKeyword01.ts" }
TypeScript/tests/cases/fourslash/extract-method17.ts_0_292
/// <reference path='fourslash.ts' /> //// function foo () { //// var x = 3; //// var y = /*start*/x++ + 5/*end*/; //// } goTo.select('start', 'end') verify.refactorAvailable('Extract Symbol', 'function_scope_0'); verify.not.refactorAvailable('Extract Symbol', 'function_scope_1');
{ "end_byte": 292, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method17.ts" }
TypeScript/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts_0_139
/// <reference path='fourslash.ts'/> /////** @template /*1*/T */ ////function f</*2*/T>() {} verify.baselineFindAllReferences('1', '2');
{ "end_byte": 139, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts" }
TypeScript/tests/cases/fourslash/completionEntryForConst.ts_0_420
///<reference path="fourslash.ts" /> ////const c = "s"; /////*1*/ ////const d = 1 ////d/*2*/ ////const e = 1 /////*3*/ verify.completions({ marker: ["1"], includes: { name: "c", text: 'const c: "s"', kind: "const" } }); verify.completions({ marker: ["2"], includes: { name: "d", text: 'const d: 1', kind: "const" } }); verify.completions({ marker: ["3"], includes: { name: "e", text: 'const e: 1', kind: "const" } });
{ "end_byte": 420, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionEntryForConst.ts" }
TypeScript/tests/cases/fourslash/docCommentTemplateVariableStatements03.ts_0_1115
/// <reference path='fourslash.ts' /> /////*a*/ ////var a = x => x //// /////*b*/ ////let b = (x,y,z) => x + y + z; //// /////*c*/ ////const c = ((x => +x)) //// /////*d*/ ////let d = (function () { }) //// /////*e*/ ////let e = function e([a,b,c]) { //// return "hello" ////}; //// /////*f*/ ////let f = class { ////} //// /////*g*/ ////const g = ((class G { //// constructor(private x); //// constructor(x,y,z); //// constructor(x,y,z, ...okayThatsEnough) { //// } ////})) verify.docCommentTemplateAt("a", /*newTextOffset*/ 7, `/** * * @param x * @returns */`); verify.docCommentTemplateAt("b", /*newTextOffset*/ 7, `/** * * @param x * @param y * @param z * @returns */`); verify.docCommentTemplateAt("c", /*newTextOffset*/ 7, `/** * * @param x * @returns */`); verify.docCommentTemplateAt("d", /*newTextOffset*/ 3, "/** */"); verify.docCommentTemplateAt("e", /*newTextOffset*/ 7, `/** * * @param param0 * @returns */`); verify.docCommentTemplateAt("f", /*newTextOffset*/ 3, "/** */"); verify.docCommentTemplateAt("g", /*newTextOffset*/ 7, `/** * * @param x */`);
{ "end_byte": 1115, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateVariableStatements03.ts" }
TypeScript/tests/cases/fourslash/navigationBarItemsComputedNames.ts_0_1257
/// <reference path="fourslash.ts" /> ////const enum E { //// A = 'A', ////} ////const a = ''; //// ////class C { //// [a]() { //// return 1; //// } //// //// [E.A]() { //// return 1; //// } //// //// [1]() { //// return 1; //// }, //// //// ["foo"]() { //// return 1; //// }, ////} verify.navigationTree({ text: "<global>", kind: "script", childItems: [ { text: "a", kind: "const" }, { text: "C", kind: "class", childItems: [ { text: "[a]", kind: "method" }, { text: "[E.A]", kind: "method" }, { text: "[1]", kind: "method" }, { text: "[\"foo\"]", kind: "method" } ], }, { text: "E", kind: "enum", childItems: [ { text: "A", kind: "enum member" }, ] } ] });
{ "end_byte": 1257, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsComputedNames.ts" }
TypeScript/tests/cases/fourslash/navigationBarItemsNamedArrowFunctions.ts_0_1653
/// <reference path="fourslash.ts" /> ////export const value = 2; ////export const func = () => 2; ////export const func2 = function() { }; ////export function exportedFunction() { } verify.navigationBar([ { "text": "\"navigationBarItemsNamedArrowFunctions\"", "kind": "module", "childItems": [ { "text": "exportedFunction", "kind": "function", "kindModifiers": "export" }, { "text": "func", "kind": "const", "kindModifiers": "export", }, { "text": "func2", "kind": "const", "kindModifiers": "export", }, { "text": "value", "kind": "const", "kindModifiers": "export" } ] }, { "text": "exportedFunction", "kind": "function", "kindModifiers": "export", "indent": 1 } ]); verify.navigationTree({ "text": "\"navigationBarItemsNamedArrowFunctions\"", "kind": "module", "childItems": [ { "text": "exportedFunction", "kind": "function", "kindModifiers": "export" }, { "text": "func", "kind": "const", "kindModifiers": "export" }, { "text": "func2", "kind": "const", "kindModifiers": "export" }, { "text": "value", "kind": "const", "kindModifiers": "export" } ] });
{ "end_byte": 1653, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsNamedArrowFunctions.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionCSSPatternAmbientModule.ts_0_353
/// <reference path="fourslash.ts" /> // @esModuleInterop: true // @Filename: index.css //// /*2a*/html { font-size: 16px; } // @Filename: types.ts //// declare module /*2b*/"*.css" { //// const styles: any; //// export = styles; //// } // @Filename: index.ts //// import styles from [|/*1*/"./index.css"|]; verify.baselineGoToDefinition("1");
{ "end_byte": 353, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionCSSPatternAmbientModule.ts" }
TypeScript/tests/cases/fourslash/navigateItemsExports.ts_0_603
/// <reference path="fourslash.ts" /> // @noLib: true ////export { [|{| "name": "a", "kind": "alias" |}a|] } from "a"; //// ////export { [|{| "name": "B", "kind": "alias" |}b as B|] } from "a"; //// ////export { [|{| "name": "c", "kind": "alias" |}c|], //// [|{| "name": "D", "kind": "alias" |}d as D|] } from "a"; //// ////[|{| "name": "f", "kind": "alias", "kindModifiers": "export" |}export import f = require("a");|] for (const range of test.ranges()) { verify.navigateTo({ pattern: range.marker.data.name, expected: [{ ...range.marker.data, range }], }); }
{ "end_byte": 603, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigateItemsExports.ts" }
TypeScript/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics14.ts_0_135
/// <reference path="fourslash.ts" /> // @allowJs: true // @Filename: a.js ////Foo<number>(); verify.baselineSyntacticDiagnostics();
{ "end_byte": 135, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics14.ts" }
TypeScript/tests/cases/fourslash/syntacticClassificationsMergeConflictMarker1.ts_0_433
/// <reference path="fourslash.ts"/> //// <<<<<<< HEAD //// "AAAA" //// ======= //// "BBBB" //// >>>>>>> Feature const c = classification("original"); verify.syntacticClassificationsAre( c.comment("<<<<<<< HEAD"), c.stringLiteral("\"AAAA\""), c.comment("======="), c.stringLiteral("\"BBBB\""), c.comment(">>>>>>> Feature")); const c2 = classification("2020"); verify.semanticClassificationsAre("2020", );
{ "end_byte": 433, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/syntacticClassificationsMergeConflictMarker1.ts" }
TypeScript/tests/cases/fourslash/breakpointValidationDecorators.ts_0_1931
/// <reference path='fourslash.ts' /> // @BaselineFile: bpSpan_decorators.baseline // @Filename: bpSpan_decorators.ts ////declare function ClassDecorator1(target: Function): void; ////declare function ClassDecorator2(x: number): (target: Function) => void; ////declare function PropertyDecorator1(target: Object, key: string | symbol, descriptor?: PropertyDescriptor): void; ////declare function PropertyDecorator2(x: number): (target: Object, key: string | symbol, descriptor?: PropertyDescriptor) => void; ////declare function ParameterDecorator1(target: Object, key: string | symbol, paramIndex: number): void; ////declare function ParameterDecorator2(x: number): (target: Object, key: string | symbol, paramIndex: number) => void; //// ////@ClassDecorator1 ////@ClassDecorator2(10) ////class Greeter { //// constructor( //// @ParameterDecorator1 //// @ParameterDecorator2(20) //// public greeting: string, //// //// @ParameterDecorator1 //// @ParameterDecorator2(30) //// ...b: string[]) { //// } //// //// @PropertyDecorator1 //// @PropertyDecorator2(40) //// greet() { //// return "<h1>" + this.greeting + "</h1>"; //// } //// //// @PropertyDecorator1 //// @PropertyDecorator2(50) //// private x: string; //// //// @PropertyDecorator1 //// @PropertyDecorator2(60) //// private static x1: number = 10; //// //// private fn( //// @ParameterDecorator1 //// @ParameterDecorator2(70) //// x: number) { //// return this.greeting; //// } //// //// @PropertyDecorator1 //// @PropertyDecorator2(80) //// get greetings() { //// return this.greeting; //// } //// //// set greetings( //// @ParameterDecorator1 //// @ParameterDecorator2(90) //// greetings: string) { //// this.greeting = greetings; //// } ////} verify.baselineCurrentFileBreakpointLocations();
{ "end_byte": 1931, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationDecorators.ts" }
TypeScript/tests/cases/fourslash/completionListInUnclosedFunction03.ts_3_247
/ <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": 247, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedFunction03.ts" }
TypeScript/tests/cases/fourslash/gotoDefinitionInObjectBindingPattern1.ts_0_275
/// <reference path='fourslash.ts' /> //// function bar<T>(onfulfilled: (value: T) => void) { //// return undefined; //// } //// interface Test { //// /*destination*/prop2: number //// } //// bar<Test>(({[|pr/*goto*/op2|]})=>{}); verify.baselineGoToDefinition("goto");
{ "end_byte": 275, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/gotoDefinitionInObjectBindingPattern1.ts" }
TypeScript/tests/cases/fourslash/moveToFile_expandSelectionRange1.ts_0_325
/// <reference path='fourslash.ts' /> //@Filename: /bar.ts //// // @Filename: /a.ts ////co[|nst a = 1|]23; ////function foo() { } verify.moveToFile({ newFileContents: { "/a.ts": `function foo() { }`, "/bar.ts": ` const a = 123; `, }, interactiveRefactorArguments: { targetFile: "/bar.ts" } });
{ "end_byte": 325, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_expandSelectionRange1.ts" }
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_chainedCall.ts_0_542
/// <reference path='fourslash.ts' /> ////function foo(/*a*/a: number, b: number/*b*/) { //// return { bar: () => a + b }; ////} ////var x = foo(1, 2).bar(); 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: number; b: number; }) { return { bar: () => a + b }; } var x = foo({ a: 1, b: 2 }).bar();` });
{ "end_byte": 542, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_chainedCall.ts" }
TypeScript/tests/cases/fourslash/extract-method46.ts_0_1190
/// <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(); //// if (rand > 0.5) { //// result = rand; //// 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(); if (rand > 0.5) { result = rand; break; } } return result; } ` });
{ "end_byte": 1190, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method46.ts" }
TypeScript/tests/cases/fourslash/codeFixSpellingAddSpaces2.ts_0_739
/// <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.[|AndThisHasFourSpaces|]; verify.codeFixAvailable([ { description: "Change spelling to 'And This Has Four Spaces'" }, { description: "Add missing enum member 'AndThisHasFourSpaces'" }, ]);
{ "end_byte": 739, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixSpellingAddSpaces2.ts" }
TypeScript/tests/cases/fourslash/formattingWithEnterAfterMultilineString.ts_0_399
/// <reference path='fourslash.ts' /> ////class Greeter3 { //// stop() { //// /*2*/var s = "hello\ ////"/*1*/ //// } ////} goTo.marker("1"); edit.insert("\n"); // We actually need to verify smart (virtual) identation here rather than actual identation. Fourslash support is required. verify.indentationIs(8); goTo.marker("2"); verify.currentLineContentIs(" var s = \"hello\\");
{ "end_byte": 399, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingWithEnterAfterMultilineString.ts" }
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_function.ts_0_488
/// <reference path='fourslash.ts' /> ////function f(/*a*/a: number, b: string/*b*/): string { //// return b; ////} ////f(4, "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 f({ a, b }: { a: number; b: string; }): string { return b; } f({ a: 4, b: "b" });` });
{ "end_byte": 488, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_function.ts" }
TypeScript/tests/cases/fourslash/signatureHelpObjectCreationExpressionNoArgs_NotAvailable.ts_0_164
/// <reference path='fourslash.ts'/> ////class sampleCls { constructor(str: string, num: number) { } } ////var x = new sampleCls/**/; verify.noSignatureHelp("");
{ "end_byte": 164, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpObjectCreationExpressionNoArgs_NotAvailable.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties3.ts_0_321
/// <reference path='fourslash.ts' /> ////interface Foo { //// a: number; //// b: string; ////} ////[|function fn(foo: Foo = {}) { ////}|] verify.codeFix({ index: 0, description: ts.Diagnostics.Add_missing_properties.message, newRangeContent: `function fn(foo: Foo = { a: 0, b: "" }) { }` });
{ "end_byte": 321, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties3.ts" }
TypeScript/tests/cases/fourslash/extract-const5.ts_0_347
/// <reference path='fourslash.ts' /> // @filename: foo.ts ////const foo = /*a*/1!/*b*/; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "constant_scope_0", actionDescription: "Extract to constant in enclosing scope", newContent: `const newLocal = 1!; const foo = /*RENAME*/newLocal;` });
{ "end_byte": 347, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const5.ts" }
TypeScript/tests/cases/fourslash/stringTemplateBraceCompletionPosition.ts_3_416
/ <reference path="fourslash.ts" /> //// var x = `/*1*/`; //// var y = `hello /*2*/world, ${100}how /*3*/are you{ 200 } to/*4*/day!?` goTo.marker('1'); verify.not.isValidBraceCompletionAtPosition('('); goTo.marker('2'); verify.not.isValidBraceCompletionAtPosition('('); goTo.marker('3'); verify.not.isValidBraceCompletionAtPosition('('); goTo.marker('4'); verify.not.isValidBraceCompletionAtPosition('(');
{ "end_byte": 416, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/stringTemplateBraceCompletionPosition.ts" }
TypeScript/tests/cases/fourslash/noTypeParameterInLHS.ts_0_197
/// <reference path='fourslash.ts'/> ////interface I<T> { } ////class C<T> {} ////var /*1*/i: I<any>; ////var /*2*/c: C<I>; verify.quickInfos({ 1: "var i: I<any>", 2: "var c: C<any>" });
{ "end_byte": 197, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/noTypeParameterInLHS.ts" }
TypeScript/tests/cases/fourslash/functionTypePredicateFormatting.ts_0_195
/// <reference path='fourslash.ts' /> //// /**/function bar(a: A): a is B {} goTo.marker(); format.document(); verify.currentLineContentIs("function bar(a: A): a is B { }");
{ "end_byte": 195, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/functionTypePredicateFormatting.ts" }
TypeScript/tests/cases/fourslash/completionsPathsRelativeJsonModule.ts_0_355
/// <reference path="fourslash.ts" /> // @moduleResolution: node // @resolveJsonModule: true // @Filename: /project/test.json ////not read // @Filename: /project/index.ts ////import { } from ".//**/"; verify.completions({ marker: "", exact: { name: "test.json", kind: "script", kindModifiers: ".json" }, isNewIdentifierLocation: true, });
{ "end_byte": 355, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsPathsRelativeJsonModule.ts" }
TypeScript/tests/cases/fourslash/syntacticClassificationsTripleSlash18.ts_0_201
/// <reference path="fourslash.ts"/> //// /// <reference>Text</reference> const c = classification("original"); verify.syntacticClassificationsAre( c.comment("/// <reference>Text</reference>"));
{ "end_byte": 201, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/syntacticClassificationsTripleSlash18.ts" }
TypeScript/tests/cases/fourslash/refactorConvertImport_namedToNamespace6.ts_0_482
/// <reference path='fourslash.ts' /> /////*a*/import { join } from "path"; /////*b*/import * as fs from "fs"; //// ////fs.readFileSync(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"; import * as fs from "fs"; fs.readFileSync(path.join('a', 'b'));`, });
{ "end_byte": 482, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertImport_namedToNamespace6.ts" }
TypeScript/tests/cases/fourslash/quickInfoForObjectBindingElementName01.ts_0_234
/// <reference path='fourslash.ts'/> ////interface I { //// property1: number; //// property2: string; ////} //// ////var foo: I; ////var { /**/property1 } = foo; goTo.marker(); verify.quickInfoAt("", "var property1: number");
{ "end_byte": 234, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForObjectBindingElementName01.ts" }
TypeScript/tests/cases/fourslash/tsxGoToDefinitionIntrinsics.ts_0_506
/// <reference path='fourslash.ts' /> //@Filename: file.tsx //// declare module JSX { //// interface Element { } //// interface IntrinsicElements { //// /*dt*/div: { //// /*pt*/name?: string; //// isOpen?: boolean; //// }; //// /*st*/span: { n: string; }; //// } //// } //// var x = <[|di/*ds*/v|] />; //// var y = <[|s/*ss*/pan|] />; //// var z = <div [|na/*ps*/me|]='hello' />; verify.baselineGoToDefinition( "ds", "ss", "ps", );
{ "end_byte": 506, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxGoToDefinitionIntrinsics.ts" }
TypeScript/tests/cases/fourslash/findAllRefsDestructureGeneric.ts_0_193
/// <reference path='fourslash.ts' /> ////interface I<T> { //// /*0*/x: boolean; ////} ////declare const i: I<number>; ////const { /*1*/x } = i; verify.baselineFindAllReferences('0', '1')
{ "end_byte": 193, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsDestructureGeneric.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionImportedNames2.ts_0_346
/// <reference path='fourslash.ts' /> // @Filename: b.ts ////import {[|/*classAliasDefinition*/Class|]} from "./a"; // @Filename: a.ts ////export module Module { ////} ////export class /*classDefinition*/Class { //// private f; ////} ////export interface Interface { //// x; ////} verify.baselineGoToDefinition("classAliasDefinition");
{ "end_byte": 346, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionImportedNames2.ts" }
TypeScript/tests/cases/fourslash/linkedEditingJsxTag1.ts_0_1678
/// <reference path='fourslash.ts' /> // the content of basic.tsx //const jsx = ( // <div> // </div> //); // @Filename: /basic.tsx /////*a*/const j/*b*/sx = ( //// /*c*/</*0*/d/*1*/iv/*2*/>/*3*/ //// </*4*///*5*/di/*6*/v/*7*/>/*8*/ ////); ////const jsx2 = ( //// <d/*9*/iv> //// <d/*10*/iv> //// <p/*11*/> //// <//*12*/p> //// </d/*13*/iv> //// </d/*14*/iv> ////);/*d*/ // goTo.marker("a"); const wordPattern = "[a-zA-Z0-9:\\-\\._$]*"; const linkedCursors1 = { ranges: [{ start: test.markerByName("0").position, length: 3 }, { start: test.markerByName("5").position, length: 3 }], wordPattern, }; const linkedCursors2 = { ranges: [{ start: test.markerByName("9").position - 1, length: 3 }, { start: test.markerByName("14").position - 1, length: 3 }], wordPattern, }; const linkedCursors3 = { ranges: [{ start: test.markerByName("10").position - 1, length: 3 }, { start: test.markerByName("13").position - 1, length: 3 }], wordPattern, }; const linkedCursors4 = { ranges: [{ start: test.markerByName("11").position - 1, length: 1 }, { start: test.markerByName("12").position, length: 1 }], wordPattern, }; verify.linkedEditing( { "0": linkedCursors1, "1": linkedCursors1, "2": linkedCursors1, "3": undefined, "4": undefined, "5": linkedCursors1, "6": linkedCursors1, "7": linkedCursors1, "8": undefined, "9": linkedCursors2, "10": linkedCursors3, "11": linkedCursors4, "12": linkedCursors4, "13": linkedCursors3, "14": linkedCursors2, "a": undefined, "b": undefined, "c": undefined, "d": undefined, });
{ "end_byte": 1678, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/linkedEditingJsxTag1.ts" }
TypeScript/tests/cases/fourslash/tsxFindAllReferences7.ts_0_642
/// <reference path='fourslash.ts' /> //@Filename: file.tsx // @jsx: preserve // @noLib: true //// declare module JSX { //// interface Element { } //// interface IntrinsicElements { //// } //// interface ElementAttributesProperty { props; } //// } //// interface OptionPropBag { //// /*1*/propx: number //// propString: string //// optional?: boolean //// } //// declare function Opt(attributes: OptionPropBag): JSX.Element; //// let opt = <Opt />; //// let opt1 = <Opt propx={100} propString />; //// let opt2 = <Opt propx={100} optional/>; //// let opt3 = <Opt wrong />; verify.baselineFindAllReferences('1')
{ "end_byte": 642, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxFindAllReferences7.ts" }
TypeScript/tests/cases/fourslash/codeFixMissingCallParentheses5.ts_0_548
/// <reference path='fourslash.ts'/> // @strictNullChecks: true ////class Foo { //// #test = () => 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 = () => true; run() { this.#test() ? console.log('test') : undefined; } }`, });
{ "end_byte": 548, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingCallParentheses5.ts" }
TypeScript/tests/cases/fourslash/unusedLocalsInFunction2.ts_0_198
/// <reference path='fourslash.ts' /> // @noUnusedLocals: true ////function greeter() { //// [| var x, y = 0; |] //// x+1; ////} verify.rangeAfterCodeFix("var x;", undefined, undefined, 0);
{ "end_byte": 198, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedLocalsInFunction2.ts" }
TypeScript/tests/cases/fourslash/smartSelection_complex.ts_0_263
/// <reference path="fourslash.ts" /> ////type X<T, P> = IsExactlyAny<P> extends true ? T : ({ [K in keyof P]: IsExactlyAny<P[K]> extends true ? K extends keyof T ? T[K] : P[/**/K] : P[K]; } & Pick<T, Exclude<keyof T, keyof P>>) verify.baselineSmartSelection();
{ "end_byte": 263, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartSelection_complex.ts" }
TypeScript/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts_3_161
/ <reference path="fourslash.ts"/> /////*1*/var /*2*/Base = class { }; ////class C extends /*3*/Base { } verify.baselineFindAllReferences('1', '2', '3');
{ "end_byte": 161, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts" }
TypeScript/tests/cases/fourslash/documentHighlightsInvalidModifierLocations.ts_0_244
/// <reference path="fourslash.ts" /> ////class C { //// m([|readonly|] p) {} ////} ////function f([|readonly|] p) {} //// ////class D { //// m([|public|] p) {} ////} ////function g([|public|] p) {} verify.baselineDocumentHighlights();
{ "end_byte": 244, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/documentHighlightsInvalidModifierLocations.ts" }
TypeScript/tests/cases/fourslash/getOccurrencesDeclare2.ts_0_1478
/// <reference path='fourslash.ts' /> ////module m { //// export class C1 { //// public pub1; //// public pub2; //// private priv1; //// private priv2; //// protected prot1; //// protected prot2; //// //// public public; //// private private; //// protected protected; //// //// public constructor(public a, private b, protected c, public d, private e, protected f) { //// this.public = 10; //// this.private = 10; //// this.protected = 10; //// } //// //// public get x() { return 10; } //// public set x(value) { } //// //// public static statPub; //// private static statPriv; //// protected static statProt; //// } //// //// export interface I1 { //// } //// //// export declare module ma.m1.m2.m3 { //// interface I2 { //// } //// } //// //// export module mb.m1.m2.m3 { //// [|declare|] var foo; //// //// export class C2 { //// public pub1; //// private priv1; //// protected prot1; //// //// protected constructor(public public, protected protected, private private) { //// public = private = protected; //// } //// } //// } //// //// declare var ambientThing: number; //// export var exportedThing = 10; //// declare function foo(): string; ////} verify.baselineDocumentHighlights();
{ "end_byte": 1478, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesDeclare2.ts" }
TypeScript/tests/cases/fourslash/moveToNewFile_variableDeclarationWithNoInitializer.ts_0_271
/// <reference path='fourslash.ts' /> // @Filename: /a.ts ////export {}; ////let x; ////[|const y = x;|] verify.moveToNewFile({ newFileContents: { "/a.ts": `export {}; export let x; `, "/y.ts": `import { x } from "./a"; const y = x; `, }, });
{ "end_byte": 271, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_variableDeclarationWithNoInitializer.ts" }
TypeScript/tests/cases/fourslash/semanticClassificationAlias.ts_0_721
/// <reference path="fourslash.ts"/> // @Filename: /a.ts ////export type x = number; ////export class y {}; // @Filename: /b.ts ////import { /*0*/x, /*1*/y } from "./a"; ////const v: /*2*/x = /*3*/y; goTo.file("/b.ts"); const [m0, m1, m2, m3] = test.markers(); const c = classification("original"); verify.semanticClassificationsAre("original", c.typeAliasName("x", m0.position), c.className("y", m1.position), c.typeAliasName("x", m2.position), c.className("y", m3.position), ); const c2 = classification("2020"); verify.semanticClassificationsAre("2020", c2.semanticToken("variable.declaration.readonly", "v"), c2.semanticToken("type", "x"), c2.semanticToken("class", "y"), );
{ "end_byte": 721, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/semanticClassificationAlias.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionOverriddenMember10.ts_0_289
/// <reference path="./fourslash.ts"/> // @allowJs: true // @checkJs: true // @noEmit: true // @noImplicitOverride: true // @filename: a.js ////class Foo {} ////class Bar extends Foo { //// /** [|@override{|"name": "1"|} |]*/ //// m() {} ////} verify.baselineGoToDefinition("1");
{ "end_byte": 289, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionOverriddenMember10.ts" }
TypeScript/tests/cases/fourslash/getEditsForFileRename_directory_up.ts_0_1761
/// <reference path='fourslash.ts' /> // @Filename: /a.ts /////// <reference path="./src/old/file.ts" /> ////import old from "./src/old"; ////import old2 from "./src/old/file"; ////export default 0; // @Filename: /src/b.ts /////// <reference path="./old/file.ts" /> ////import old from "./old"; ////import old2 from "./old/file"; ////export default 0; // @Filename: /src/foo/c.ts /////// <reference path="../old/file.ts" /> ////import old from "../old"; ////import old2 from "../old/file"; ////export default 0; // @Filename: /src/old/index.ts ////import a from "../../a"; ////import a2 from "../b"; ////import a3 from "../foo/c"; ////import f from "./file"; ////export default 0; // @Filename: /src/old/file.ts ////export default 0; // @Filename: /tsconfig.json ////{ "files": ["a.ts", "src/b.ts", "src/foo/c.ts", "src/old/index.ts", "src/old/file.ts"] } verify.getEditsForFileRename({ oldPath: "/src/old", newPath: "/newDir/new", newFileContents: { "/a.ts": `/// <reference path="./newDir/new/file.ts" /> import old from "./newDir/new"; import old2 from "./newDir/new/file"; export default 0;`, "/src/b.ts": `/// <reference path="../newDir/new/file.ts" /> import old from "../newDir/new"; import old2 from "../newDir/new/file"; export default 0;`, "/src/foo/c.ts": `/// <reference path="../../newDir/new/file.ts" /> import old from "../../newDir/new"; import old2 from "../../newDir/new/file"; export default 0;`, "/src/old/index.ts": `import a from "../../a"; import a2 from "../../src/b"; import a3 from "../../src/foo/c"; import f from "./file"; export default 0;`, "/tsconfig.json": `{ "files": ["a.ts", "src/b.ts", "src/foo/c.ts", "newDir/new/index.ts", "newDir/new/file.ts"] }`, }, });
{ "end_byte": 1761, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEditsForFileRename_directory_up.ts" }
TypeScript/tests/cases/fourslash/unusedClassInNamespace4.ts_0_379
/// <reference path='fourslash.ts' /> // @noUnusedLocals: true // @noUnusedParameters:true //// [| namespace Validation { //// class c1 { //// //// } //// //// export class c2 { //// //// } //// //// class c3 { //// public x: c1; //// } ////} |] verify.rangeAfterCodeFix(`namespace Validation { class c1 { } export class c2 { } }`);
{ "end_byte": 379, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedClassInNamespace4.ts" }
TypeScript/tests/cases/fourslash/goToTypeDefinitionUnionType.ts_0_328
/// <reference path='fourslash.ts' /> ////class /*definition0*/C { //// p; ////} //// ////interface /*definition1*/I { //// x; ////} //// ////module M { //// export interface /*definition2*/I { //// y; //// } ////} //// ////var x: C | I | M.I; //// /////*reference*/x; verify.baselineGoToType("reference");
{ "end_byte": 328, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToTypeDefinitionUnionType.ts" }
TypeScript/tests/cases/fourslash/completionsWithOptionalPropertiesGenericConstructor.ts_0_537
/// <reference path="fourslash.ts" /> // @strict: true //// interface Options { //// someFunction?: () => string //// anotherFunction?: () => string //// } //// //// export class Clazz<T extends Options> { //// constructor(public a: T) {} //// } //// //// new Clazz({ /*1*/ }) verify.completions({ marker: '1', includes: [ { sortText: completion.SortText.OptionalMember, name: 'someFunction' }, { sortText: completion.SortText.OptionalMember, name: 'anotherFunction' }, ] })
{ "end_byte": 537, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsWithOptionalPropertiesGenericConstructor.ts" }
TypeScript/tests/cases/fourslash/preparePasteEdits_returnFalse.ts_0_306
/// <reference path='./fourslash.ts' /> // @Filename: /file1.ts //// [|const a = 1;|] //// [|function foo() { //// console.log("testing");}|] //// [|//This is a comment|] verify.preparePasteEdits({ copiedFromFile: "/file1.ts", copiedTextRange: test.ranges(), providePasteEdits: false, })
{ "end_byte": 306, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/preparePasteEdits_returnFalse.ts" }
TypeScript/tests/cases/fourslash/quickInfoForDecorators.ts_0_227
/// <reference path='fourslash.ts' /> ////@/*1*/decorator ////class C { ////} /////** decorator documentation*/ ////var decorator = t=> t; verify.quickInfoAt("1", "var decorator: (t: any) => any", "decorator documentation");
{ "end_byte": 227, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForDecorators.ts" }
TypeScript/tests/cases/fourslash/jsxTagNameCompletionWithExistingJsxInitializer.ts_0_634
/// <reference path="fourslash.ts" /> // @filename: /foo.tsx ////declare namespace JSX { //// interface Element { } //// interface IntrinsicElements { //// foo: { //// className: string; //// } //// } ////} ////<foo cl/**/={""} /> verify.completions({ marker: "", includes: { name: "className", text: "(property) className: string", insertText: undefined, isSnippet: undefined, }, preferences: { jsxAttributeCompletionStyle: "braces", includeCompletionsWithSnippetText: true, includeCompletionsWithInsertText: true, }, })
{ "end_byte": 634, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsxTagNameCompletionWithExistingJsxInitializer.ts" }
TypeScript/tests/cases/fourslash/javaScriptPrototype3.ts_0_795
///<reference path="fourslash.ts" /> // Inside an inferred method body, the type of 'this' is the class type // @noLib: true // @allowNonTsExtensions: true // @Filename: myMod.js //// function myCtor(x) { //// this.qua = 10; //// } //// myCtor.prototype.foo = function() { return this./**/; }; //// myCtor.prototype.bar = function() { return '' }; //// goTo.marker(); edit.insert('.'); // Check members of the function verify.completions({ marker: "", unsorted: [ { name: "bar", kind: "method" }, { name: "qua", kind: "property" }, ...["myCtor", "x", "prototype"].map(name => ({ name, kind: "warning", sortText: completion.SortText.JavascriptIdentifiers })), { name: "foo", kind: "method" }, ], });
{ "end_byte": 795, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/javaScriptPrototype3.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionIndexSignature2.ts_0_230
/// <reference path='fourslash.ts'/> // Tests that we don't crash for an index signature with no declaration. // @allowJs: true // @Filename: /a.js ////const o = {}; ////o.[|/*use*/foo|]; verify.baselineGoToDefinition("use");
{ "end_byte": 230, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionIndexSignature2.ts" }
TypeScript/tests/cases/fourslash/pathCompletionsPackageJsonExportsCustomConditions.ts_0_617
/// <reference path="fourslash.ts" /> // @module: nodenext // @customConditions: custom-condition // @Filename: /node_modules/foo/package.json //// { //// "name": "foo", //// "exports": { //// "./only-with-custom-conditions": { //// "custom-condition": "./something.js" //// }, //// } //// } // @Filename: /node_modules/foo/something.d.ts //// export const index = 0; // @Filename: /index.ts //// import { } from "foo//**/"; verify.completions({ marker: "", isNewIdentifierLocation: true, exact: [ { name: "only-with-custom-conditions", kind: "script", kindModifiers: "" }, ] });
{ "end_byte": 617, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/pathCompletionsPackageJsonExportsCustomConditions.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionAwait4.ts_0_225
/// <reference path="fourslash.ts" /> //// async function outerAsyncFun() { //// let /*end*/af = async () => { //// [|/*start*/await|] Promise.resolve(0); //// } //// } verify.baselineGoToDefinition("start");
{ "end_byte": 225, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionAwait4.ts" }
TypeScript/tests/cases/fourslash/completionForStringLiteralNonrelativeImport16.ts_0_997
/// <reference path='fourslash.ts' /> // Should give completions for modules referenced via baseUrl and paths compiler options with explicit name mappings // @Filename: tsconfig.json //// { //// "compilerOptions": { //// "baseUrl": "./", //// "paths": { //// "module1/path1": ["some/path/whatever.ts"], //// } //// } //// } // @Filename: test0.ts //// import * as foo1 from "m/*first*/ //// import * as foo1 from "module1/pa/*second*/ // @Filename: some/path/whatever.ts //// export var x = 9; verify.completions({ marker: ["first"], exact: ["test0", "some", { name: "module1/path1", replacementSpan: { fileName: "foo", pos: 23, end: 24 } }], isNewIdentifierLocation: true }); verify.completions({ marker: ["second"], exact: [{ name: "module1/path1", replacementSpan: { fileName: "foo", pos: 48, end: 58 } }], isNewIdentifierLocation: true });
{ "end_byte": 997, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteralNonrelativeImport16.ts" }
TypeScript/tests/cases/fourslash/importFixesWithSymlinkInSiblingRushYarn.ts_0_1434
/// <reference path="fourslash.ts" /> // @experimentalDecorators: true // @Filename: /project/libraries/dtos/tsconfig.json // { } // @Filename: /project/libraries/dtos/src/book.entity.ts ////@Entity() ////export class BookEntity { //// id: number ////} // @Filename: /project/libraries/dtos/src/user.entity.ts ////import { Entity } from "mikro-orm" ////@Entity() ////export class UserEntity { //// id: number ////} // @Filename: /project/common/temp/node_modules/mikro-orm/package.json ////{ "name": "mikro-orm", "version": "3.4.1", "typings": "dist/index.d.ts" } // @Filename: /project/common/temp/node_modules/mikro-orm/dist/index.d.ts ////export * from "./decorators"; // @Filename: /project/common/temp/node_modules/mikro-orm/dist/decorators/index.d.ts ////export * from "./entity"; // @Filename: /project/common/temp/node_modules/mikro-orm/dist/decorators/entity.d.ts ////export declare function Entity(): Function; // @link: /project/common/temp/node_modules/mikro-orm -> /project/libraries/dtos/node_modules/mikro-orm goTo.file("/project/libraries/dtos/src/book.entity.ts"); verify.importFixAtPosition([ getImportFixContent("mikro-orm"), getImportFixContent("mikro-orm/dist/decorators"), getImportFixContent("mikro-orm/dist/decorators/entity"), ]); function getImportFixContent(from: string) { return `import { Entity } from "${from}"; @Entity() export class BookEntity { id: number }`; }
{ "end_byte": 1434, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importFixesWithSymlinkInSiblingRushYarn.ts" }
TypeScript/tests/cases/fourslash/codeFixClassPropertyInitialization12.ts_0_393
/// <reference path='fourslash.ts' /> // @strict: true //// abstract class A { abstract a (); } //// //// class AT extends A { a () {} } //// //// class T { //// a: AT; //// } verify.codeFix({ description: `Add initializer to property 'a'`, newFileContent: `abstract class A { abstract a (); } class AT extends A { a () {} } class T { a: AT = new AT; }`, index: 2 })
{ "end_byte": 393, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassPropertyInitialization12.ts" }
TypeScript/tests/cases/fourslash/findReferencesBindingPatternInJsdocNoCrash2.ts_0_807
/// <reference path='fourslash.ts' /> // @moduleResolution: node // @Filename: node_modules/use-query/package.json ////{ //// "name": "use-query", //// "types": "index.d.ts" ////} // @Filename: node_modules/use-query/index.d.ts ////declare function useQuery(): { //// data: string[]; ////}; // @Filename: node_modules/use-query/package.json ////{ //// "name": "other", //// "types": "index.d.ts" ////} // @Filename: node_modules/other/index.d.ts ////interface BottomSheetModalProps { //// /** //// * A scrollable node or normal view. //// * @type null | (({ data: any }?) => any) //// */ //// children: null | (({ data: any }?) => any); ////} // @Filename: src/index.ts ////import { useQuery } from "use-query"; ////const { /*1*/data } = useQuery(); verify.baselineFindAllReferences('1');
{ "end_byte": 807, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findReferencesBindingPatternInJsdocNoCrash2.ts" }
TypeScript/tests/cases/fourslash/completionListInClosedFunction03.ts_3_326
/ <reference path="fourslash.ts" /> ////function foo(x: string, y: number, z: boolean) { //// function bar(a: number, b: string, c: typeof x = /*1*/) { //// //// } ////} verify.completions({ marker: "1", // Note: `c = c` would be a compile error includes: ["foo", "x", "y", "z", "bar", "a", "b"], });
{ "end_byte": 326, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInClosedFunction03.ts" }
TypeScript/tests/cases/fourslash/completionsClassMembers1.ts_0_201
/// <reference path="fourslash.ts" /> ////interface I { //// method(): void; ////} //// ////export class C implements I { //// property = "foo" //// /**/ ////} verify.baselineCompletions();
{ "end_byte": 201, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsClassMembers1.ts" }
TypeScript/tests/cases/fourslash/importStatementCompletions_semicolons.ts_0_691
/// <reference path="fourslash.ts" /> // @Filename: /mod.ts //// export const foo = 0; // @Filename: /noSemicolons.ts //// import * as fs from "fs" //// [|import f/**/|] verify.completions({ isNewIdentifierLocation: true, marker: "", exact: [{ name: "foo", source: "./mod", insertText: `import { foo$1 } from "./mod"`, // <-- no semicolon isSnippet: true, replacementSpan: test.ranges()[0], sourceDisplay: "./mod", }, { name: "type", sortText: completion.SortText.GlobalsOrKeywords, }], preferences: { includeCompletionsForImportStatements: true, includeInsertTextCompletions: true, includeCompletionsWithSnippetText: true, } });
{ "end_byte": 691, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importStatementCompletions_semicolons.ts" }
TypeScript/tests/cases/fourslash/formatIfTryCatchBlocks.ts_0_276
/// <reference path="fourslash.ts"/> ////try { ////} ////catch { ////} //// ////try { ////} ////catch (e) { ////} format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", true); format.document(); verify.currentFileContentIs( `try { } catch { } try { } catch (e) { }`);
{ "end_byte": 276, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatIfTryCatchBlocks.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingEnumMember10.ts_0_328
/// <reference path='fourslash.ts' /> ////enum E { //// a, //// b = 1, //// c = "123" ////} ////enum A { //// a = E.c ////} ////A.b verify.codeFix({ description: "Add missing enum member 'b'", newFileContent: `enum E { a, b = 1, c = "123" } enum A { a = E.c, b = "b" } A.b` });
{ "end_byte": 328, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingEnumMember10.ts" }