_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction33.ts_0_411
/// <reference path='fourslash.ts' /> ////const a = /*a*/()/*b*/ => ( //// // comment //// 1 ////); goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Add or remove braces in an arrow function", actionName: "Add braces to arrow function", actionDescription: "Add braces to arrow function", newContent: `const a = () => { return ( // comment 1 ); };`, });
{ "end_byte": 411, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction33.ts" }
TypeScript/tests/cases/fourslash/codeFixTopLevelForAwait_module_noTsConfig.ts_0_188
/// <reference path="fourslash.ts" /> // @filename: /dir/a.ts ////declare const p: number[]; ////for await (const _ of p); ////export {}; verify.not.codeFixAvailable("fixModuleOption");
{ "end_byte": 188, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixTopLevelForAwait_module_noTsConfig.ts" }
TypeScript/tests/cases/fourslash/unusedVariableInNamespace1.ts_0_231
/// <reference path='fourslash.ts' /> // @noUnusedLocals: true ////namespace greeter { //// [|let a = "dummy entry";|] ////} verify.codeFix({ description: "Remove unused declaration for: 'a'", newRangeContent: "", });
{ "end_byte": 231, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedVariableInNamespace1.ts" }
TypeScript/tests/cases/fourslash/inlineVariableTemplateString3.ts_0_438
/// <reference path="fourslash.ts" /> ////const /*a*/pizza/*b*/ = "🍕"; ////export const prompt = `Hello, would you like some ${ //// pizza //// }?`; goTo.select("a", "b"); verify.refactorAvailable("Inline variable"); edit.applyRefactor({ refactorName: "Inline variable", actionName: "Inline variable", actionDescription: "Inline variable", newContent: "export const prompt = `Hello, would you like some 🍕?`;" });
{ "end_byte": 438, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlineVariableTemplateString3.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType_js_TypeLiteral_CommentBeforeProperty.ts_0_457
/// <reference path='fourslash.ts' /> // @allowJs: true // @Filename: a.js ////type Foo = /*a*/[|{ //// /** //// * //// */ //// oops: string; ////}|]/*b*/; goTo.file('a.js') goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to typedef", actionDescription: "Extract to typedef", newContent: `/** * @typedef {{ oops: string; }} /*RENAME*/NewType */ type Foo = NewType;`, });
{ "end_byte": 457, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType_js_TypeLiteral_CommentBeforeProperty.ts" }
TypeScript/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace.ts_0_144
/// <reference path="fourslash.ts"/> ////foo(1, /* comment */ ); format.document(); verify.currentFileContentIs(`foo(1, /* comment */);`);
{ "end_byte": 144, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace.ts" }
TypeScript/tests/cases/fourslash/genericsFormattingMultiline.ts_0_2136
/// <reference path='fourslash.ts' /> //// //// class Foo < //// T1 extends unknown, //// T2 //// > { //// public method < //// T3, //// > (a: T1, b: Array < //// string //// > ): Map < //// T1 , //// Array < T3 > //// > { throw new Error(); } //// } //// //// interface IFoo< //// T, //// > { //// new < T //// > ( a: T); //// op?< //// T, //// M //// > (a: T, b : M ); //// < //// T, //// >(x: T): T; //// } //// //// type foo< //// T //// > = Foo < //// number, Array < number > > ; //// //// function bar < //// T, U extends T //// > () { //// return class < //// T2, //// > { //// } //// } //// //// bar< //// string, //// "s" //// > (); //// //// declare const func: < //// T extends number[], //// > (x: T) => new < //// U //// > () => U; //// //// class A < T > extends bar < //// T,number //// >( ) < T //// > { //// } //// //// function s<T, U>(x: TemplateStringsArray, ...args: any[]) { return x.join(); } //// //// const t = s< //// number , //// string[] & ArrayLike<any> //// >`abc${1}def` ; //// format.document(); verify.currentFileContentIs(` class Foo< T1 extends unknown, T2 > { public method< T3, >(a: T1, b: Array< string >): Map< T1, Array<T3> > { throw new Error(); } } interface IFoo< T, > { new <T >(a: T); op?< T, M >(a: T, b: M); < T, >(x: T): T; } type foo< T > = Foo< number, Array<number>>; function bar< T, U extends T >() { return class < T2, > { } } bar< string, "s" >(); declare const func: < T extends number[], > (x: T) => new < U > () => U; class A<T> extends bar< T, number >()<T > { } function s<T, U>(x: TemplateStringsArray, ...args: any[]) { return x.join(); } const t = s< number, string[] & ArrayLike<any> >\`abc\${1}def\`; `);
{ "end_byte": 2136, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/genericsFormattingMultiline.ts" }
TypeScript/tests/cases/fourslash/quickInfoLink9.ts_0_201
/// <reference path="fourslash.ts" /> //// type Foo = { //// /** //// * Text before {@link /**/a} text after //// */ //// c: (a: number) => void; //// } verify.baselineQuickInfo();
{ "end_byte": 201, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoLink9.ts" }
TypeScript/tests/cases/fourslash/indentation.ts_0_3448
/// <reference path="fourslash.ts"/> //// ////module classes { ////{| "indent": 4 |} //// class Bar { ////{| "indent": 8 |} //// //// constructor() { ////{| "indent": 12 |} //// } //// //// private foo: string = ""; ////{| "indent": 8 |} //// //// private f() { //// var a: any[] = [[1, 2], [3, 4], 5]; ////{| "indent": 12 |} //// return ((1 + 1)); //// } //// ////{| "indent": 8 |} //// private f2() { //// if (true) { } { }; //// } //// } ////} //// //// ////module interfaces { ////{| "indent": 4 |} //// interface Foo { ////{| "indent": 8 |} //// //// x: number; ////{| "indent": 8 |} //// //// foo(): number; ////{| "indent": 8 |} //// } ////} //// //// ////module nestedModules { //// module Foo2 { ////{| "indent": 8 |} //// function f() { //// } ////{| "indent": 8 |} //// var x: number; ////{| "indent": 8 |} //// } ////} //// //// ////module Enums { //// enum Foo3 { ////{| "indent": 8 |} //// val1, ////{| "indent": 8 |} //// val2, ////{| "indent": 8 |} //// } ////{| "indent": 4 |} ////} //// //// ////function controlStatements() { //// for (var i = 0; i < 10; i++) { ////{| "indent": 8 |} //// } //// //// for (var e in foo.bar) { ////{| "indent": 8 |} //// } //// //// with (foo.bar) { ////{| "indent": 8 |} //// } //// //// while (false) { ////{| "indent": 8 |} //// } //// //// do { ////{| "indent": 8 |} //// } while (false); //// //// switch (foo.bar) { ////{| "indent": 8 |} //// } //// //// switch (foo.bar) { ////{| "indent": 8 |} //// case 1: ////{| "indent": 12 |} //// break; //// default: ////{| "indent": 12 |} //// break; //// } ////} //// //// ////function tryCatch() { ////{| "indent": 4 |} //// try { ////{| "indent": 8 |} //// } ////{| "indent": 4 |} //// catch (err) { ////{| "indent": 8 |} //// } ////{| "indent": 4 |} ////} //// //// ////function tryFinally() { ////{| "indent": 4 |} //// try { ////{| "indent": 8 |} //// } ////{| "indent": 4 |} //// finally { ////{| "indent": 8 |} //// } ////{| "indent": 4 |} ////} //// //// ////function tryCatchFinally() { ////{| "indent": 4 |} //// try { ////{| "indent": 8 |} //// } ////{| "indent": 4 |} //// catch (err) { ////{| "indent": 8 |} //// } ////{| "indent": 4 |} //// finally { ////{| "indent": 8 |} //// } ////{| "indent": 4 |} ////} //// //// ////class indentBeforeCurly ////{| "indent": 0 |} ////{| "indent": 0 |}{ ////{| "indent": 4 |} ////} //// //// ////function argumentsListIndentation(bar, //// blah, //// {| "indent": 13 |} ////); //// //// ////function blockIndentAfterIndentedParameter1(bar, //// blah) { ////{| "indent": 4 |} ////} //// //// ////function blockIndentAfterIndentedParameter2(bar, //// blah) { //// if (foo) { ////{| "indent": 8 |} //// } ////} //// //// ////// Note: Do not add more tests at the end of this file, as ////// the purpose of this test is to verity smart indent ////// works for unterminated function arguments at the end of a file. ////function unterminatedListIndentation(a, ////{| "indent": 4 |} test.markers().forEach(marker => { verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent); });
{ "end_byte": 3448, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/indentation.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingNew_all.ts_0_360
/// <reference path='fourslash.ts' /> ////class C { //// constructor(num?: number) {} ////} ////var a = C(); ////var b = C(3); verify.codeFixAll({ fixId: "addMissingNewOperator", fixAllDescription: "Add missing 'new' operator to all calls", newFileContent: `class C { constructor(num?: number) {} } var a = new C(); var b = new C(3);` });
{ "end_byte": 360, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingNew_all.ts" }
TypeScript/tests/cases/fourslash/getEmitOutputOnlyOneFile.ts_0_363
/// <reference path="fourslash.ts" /> // @BaselineFile: getEmitOutputOnlyOneFile.baseline // @Filename: inputFile1.ts //// var x: any; //// class Bar { //// x : string; //// y : number //// } // @Filename: inputFile2.ts // @emitThisFile: true //// var x: any; //// class Foo{ //// x : string; //// y : number //// } verify.baselineGetEmitOutput();
{ "end_byte": 363, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEmitOutputOnlyOneFile.ts" }
TypeScript/tests/cases/fourslash/autoImportNodeNextJSRequire.ts_0_494
/// <reference path='fourslash.ts' /> // @module: nodenext // @allowJs: true // @checkJs: true // @noEmit: true // @Filename: /matrix.js //// exports.variants = []; // @Filename: /main.js //// exports.dedupeLines = data => { //// variants/**/ //// } // @Filename: /totally-irrelevant-no-way-this-changes-things-right.js //// export default 0; goTo.file("/main.js"); verify.importFixAtPosition([ `const { variants } = require("./matrix") exports.dedupeLines = data => { variants }`]);
{ "end_byte": 494, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportNodeNextJSRequire.ts" }
TypeScript/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts_0_2302
/// <reference path='fourslash.ts'/> ////var strOrNum: string | number; ////module m { //// var nonExportedStrOrNum: string | number; //// export var exportedStrOrNum: string | number; //// var num: number; //// var str: string; //// if (typeof /*1*/nonExportedStrOrNum === "number") { //// num = /*2*/nonExportedStrOrNum; //// } //// else { //// str = /*3*/nonExportedStrOrNum.length; //// } //// if (typeof /*4*/exportedStrOrNum === "number") { //// strOrNum = /*5*/exportedStrOrNum; //// } //// else { //// strOrNum = /*6*/exportedStrOrNum; //// } ////} ////if (typeof m./*7*/exportedStrOrNum === "number") { //// strOrNum = m./*8*/exportedStrOrNum; ////} ////else { //// strOrNum = m./*9*/exportedStrOrNum; ////} verify.quickInfos({ 1: "var nonExportedStrOrNum: string | number", 2: "var nonExportedStrOrNum: number", 3: "var nonExportedStrOrNum: string", 4: "var m.exportedStrOrNum: string | number", 5: "var m.exportedStrOrNum: number", 6: "var m.exportedStrOrNum: string", 7: "var m.exportedStrOrNum: string | number", 8: "var m.exportedStrOrNum: number", 9: "var m.exportedStrOrNum: string", }); verify.completions( { marker: "1", includes: { name: "nonExportedStrOrNum", text: "var nonExportedStrOrNum: string | number" } }, { marker: "2", includes: { name: "nonExportedStrOrNum", text: "var nonExportedStrOrNum: number" }, isNewIdentifierLocation: true }, { marker: "3", includes: { name: "nonExportedStrOrNum", text: "var nonExportedStrOrNum: string" }, isNewIdentifierLocation: true }, { marker: "4", includes: { name: "exportedStrOrNum", text: "var exportedStrOrNum: string | number" } }, { marker: "5", includes: { name: "exportedStrOrNum", text: "var exportedStrOrNum: number" }, isNewIdentifierLocation: true }, { marker: "6", includes: { name: "exportedStrOrNum", text: "var exportedStrOrNum: string" }, isNewIdentifierLocation: true }, { marker: "7", includes: { name: "exportedStrOrNum", text: "var m.exportedStrOrNum: string | number" } }, { marker: "8", includes: { name: "exportedStrOrNum", text: "var m.exportedStrOrNum: number" } }, { marker: "9", includes: { name: "exportedStrOrNum", text: "var m.exportedStrOrNum: string" } }, );
{ "end_byte": 2302, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts" }
TypeScript/tests/cases/fourslash/codeFixCalledES2015Import9.ts_0_425
/// <reference path='fourslash.ts' /> // @esModuleInterop: true // @module: amd // @Filename: foo.d.ts ////declare class foo(): void; ////declare namespace foo {} ////export = foo; // @Filename: index.ts ////[|import * as foo from "./foo";|] ////new foo(); goTo.file(1); verify.codeFix({ description: `Replace import with 'import foo from "./foo";'.`, newRangeContent: `import foo from "./foo";`, index: 0, });
{ "end_byte": 425, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCalledES2015Import9.ts" }
TypeScript/tests/cases/fourslash/completionsWithOverride1.ts_0_283
/// <reference path='fourslash.ts'/> //// class A { //// foo () {} //// bar () {} //// } //// class B extends A { //// override /*1*/ //// } verify.completions({ marker: "1", includes: [ "foo", "bar" ], isNewIdentifierLocation: true })
{ "end_byte": 283, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsWithOverride1.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType82.ts_0_454
/// <reference path='fourslash.ts' /> //// type A<T,S> = /*1*/{ a: string } | { b: T } | { c: string }/*2*/ | { d: string } | S; goTo.select("1", "2"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType<T> = { a: string; } | { b: T; } | { c: string; }; type A<T,S> = NewType<T> | { d: string } | S;`, });
{ "end_byte": 454, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType82.ts" }
TypeScript/tests/cases/fourslash/multiModuleClodule.ts_0_929
/// <reference path='fourslash.ts'/> ////class C { //// constructor(x: number) { } //// foo() { } //// bar() { } //// static boo() { } ////} //// ////module C { //// export var x = 1; //// var y = 2; ////} ////module C { //// export function foo() { } //// function baz() { return ''; } ////} //// ////var c = new C/*1*/(C./*2*/x); ////c./*3*/foo = C./*4*/foo; verify.completions( { marker: "1", includes: "C" }, { marker: ["2", "4"], exact: completion.functionMembersPlus([ { name: "boo", sortText: completion.SortText.LocalDeclarationPriority }, { name: "foo", sortText: completion.SortText.LocationPriority }, { name: "prototype", sortText: completion.SortText.LocationPriority }, { name: "x", sortText: completion.SortText.LocationPriority }, ]) }, { marker: "3", exact: ["bar", "foo"] }, ); verify.noErrors();
{ "end_byte": 929, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/multiModuleClodule.ts" }
TypeScript/tests/cases/fourslash/tsxCompletion4.ts_0_318
/// <reference path='fourslash.ts' /> //@Filename: file.tsx //// declare namespace JSX { //// interface Element { } //// interface IntrinsicElements { //// div: { one; two; } //// } //// } //// let bag = { x: 100, y: 200 }; //// <div {.../**/ verify.completions({ marker: "", includes: "bag" });
{ "end_byte": 318, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxCompletion4.ts" }
TypeScript/tests/cases/fourslash/goToImplementationLocal_05.ts_0_292
/// <reference path='fourslash.ts'/> // Should handle calls made the left hand side of a property access expression //// class Bar { //// public hello() {} //// } //// //// var [|someVar|] = new Bar(); //// someVa/*reference*/r.hello(); verify.baselineGoToImplementation("reference");
{ "end_byte": 292, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationLocal_05.ts" }
TypeScript/tests/cases/fourslash/completionsOverridingMethod5.ts_0_2740
/// <reference path="fourslash.ts" /> // @newline: LF // @Filename: a.ts // Case: abstract methods ////abstract class Ab { //// abstract met(n: string): void; //// met2(n: number): void { //// return; //// } ////} //// ////abstract class Abc extends Ab { //// /*a*/ //// abstract /*b*/ //// abstract m/*c*/ ////} verify.completions({ marker: "a", isNewIdentifierLocation: true, preferences: { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: false, includeCompletionsWithClassMemberSnippets: true, }, includes: [ { name: "met", sortText: completion.SortText.LocationPriority, insertText: "met(n: string): void {\n}", filterText: "met" }, { name: "met2", sortText: completion.SortText.LocationPriority, insertText: "met2(n: number): void {\n}", filterText: "met2" } ], }); verify.completions({ marker: "b", isNewIdentifierLocation: true, preferences: { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: false, includeCompletionsWithClassMemberSnippets: true, }, includes: [ { name: "met", sortText: completion.SortText.LocationPriority, insertText: "abstract met(n: string): void;", filterText: "met", hasAction: true, source: completion.CompletionSource.ClassMemberSnippet, }, { name: "met2", sortText: completion.SortText.LocationPriority, insertText: "abstract met2(n: number): void;", filterText: "met2", hasAction: true, source: completion.CompletionSource.ClassMemberSnippet, } ], }); verify.completions({ marker: "c", isNewIdentifierLocation: true, preferences: { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: false, includeCompletionsWithClassMemberSnippets: true, }, includes: [ { name: "met", sortText: completion.SortText.LocationPriority, insertText: "abstract met(n: string): void;", filterText: "met", hasAction: true, source: completion.CompletionSource.ClassMemberSnippet, }, { name: "met2", sortText: completion.SortText.LocationPriority, insertText: "abstract met2(n: number): void;", filterText: "met2", hasAction: true, source: completion.CompletionSource.ClassMemberSnippet, } ], });
{ "end_byte": 2740, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsOverridingMethod5.ts" }
TypeScript/tests/cases/fourslash/getJavaScriptQuickInfo4.ts_0_222
/// <reference path='fourslash.ts'/> // @allowNonTsExtensions: true // @Filename: Foo.js /////** @param {[number,string]} [a] */ ////function /**/f(a) { } verify.quickInfoAt("", "function f(a?: [number, string]): void");
{ "end_byte": 222, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptQuickInfo4.ts" }
TypeScript/tests/cases/fourslash/quickInfoDisplayPartsTypeAlias.ts_0_166
/// <reference path='fourslash.ts'/> ////class /*1*/c { ////} ////type /*2*/t1 = /*3*/c; ////var /*4*/cInstance: /*5*/t1 = new /*6*/c(); verify.baselineQuickInfo();
{ "end_byte": 166, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoDisplayPartsTypeAlias.ts" }
TypeScript/tests/cases/fourslash/extract-method29.ts_0_482
/// <reference path='fourslash.ts' /> /////*a*/console.log(0); // ////console.log(0);/*b*/ format.setFormatOptions({ ...format.copyFormatOptions(), semicolons: ts.SemicolonPreference.Remove }); goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "function_scope_0", actionDescription: "Extract to function in global scope", newContent: `/*RENAME*/newFunction() function newFunction() { console.log(0) // console.log(0) } ` });
{ "end_byte": 482, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method29.ts" }
TypeScript/tests/cases/fourslash/completionsOverridingMethod13.ts_0_713
/// <reference path="fourslash.ts" /> // @Filename: a.ts // @newline: LF ////class A { //// protected foo(): void { //// return; //// } ////} ////class B extends A { //// /**/ ////} verify.completions({ marker: "", isNewIdentifierLocation: true, preferences: { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: false, includeCompletionsWithClassMemberSnippets: true, }, exact: [ { name: "foo", sortText: completion.SortText.LocationPriority, insertText: "protected foo(): void {\n}", filterText: "foo", }, ...completion.classElementKeywords, ], });
{ "end_byte": 713, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsOverridingMethod13.ts" }
TypeScript/tests/cases/fourslash/genericFunctionSignatureHelp1.ts_0_164
/// <reference path='fourslash.ts'/> ////function f<T>(a: T): T { return null; } ////f(/**/ verify.signatureHelp({ marker: "", text: "f(a: unknown): unknown" });
{ "end_byte": 164, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/genericFunctionSignatureHelp1.ts" }
TypeScript/tests/cases/fourslash/breakpointValidationDestructuringForOfObjectBindingPatternDefaultValues.ts_0_3291
/// <reference path='fourslash.ts' /> ////declare var console: { //// log(msg: any): void; ////} ////interface Robot { //// name: string; //// skill: string; ////} ////interface MultiRobot { //// name: string; //// skills: { //// primary?: string; //// secondary?: string; //// }; ////} ////let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; ////let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, //// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; ////function getRobots() { //// return robots; ////} ////function getMultiRobots() { //// return multiRobots; ////} ////for (let {name: nameA = "noName" } of robots) { //// console.log(nameA); ////} ////for (let {name: nameA = "noName" } of getRobots()) { //// console.log(nameA); ////} ////for (let {name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { //// console.log(nameA); ////} ////for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = //// { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { //// console.log(primaryA); ////} ////for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = //// { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { //// console.log(primaryA); ////} ////for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = //// { primary: "nosKill", secondary: "noSkill" } } of //// <MultiRobot[]>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, //// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { //// console.log(primaryA); ////} ////for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { //// console.log(nameA); ////} ////for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { //// console.log(nameA); ////} ////for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { //// console.log(nameA); ////} ////for (let { //// name: nameA = "noName", //// skills: { //// primary: primaryA = "primary", //// secondary: secondaryA = "secondary" //// } = { primary: "noSkill", secondary: "noSkill" } ////} of multiRobots) { //// console.log(nameA); ////} ////for (let { //// name: nameA = "noName", //// skills: { //// primary: primaryA = "primary", //// secondary: secondaryA = "secondary" //// } = { primary: "noSkill", secondary: "noSkill" } ////} of getMultiRobots()) { //// console.log(nameA); ////} ////for (let { //// name: nameA = "noName", //// skills: { //// primary: primaryA = "primary", //// secondary: secondaryA = "secondary" //// } = { primary: "noSkill", secondary: "noSkill" } ////} of <MultiRobot[]>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, //// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { //// console.log(nameA); ////} verify.baselineCurrentFileBreakpointLocations();
{ "end_byte": 3291, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationDestructuringForOfObjectBindingPatternDefaultValues.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType71.ts_0_445
/// <reference path='fourslash.ts' /> ////const key = "key"; ////type Foo = /*a*/`${typeof key}Foo`/*b*/; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: [ "const key = \"key\";", "type /*RENAME*/NewType = `${typeof key}Foo`;", "", "type Foo = NewType;" ].join("\n"), });
{ "end_byte": 445, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType71.ts" }
TypeScript/tests/cases/fourslash/referencesForStringLiteralPropertyNames6.ts_0_188
/// <reference path='fourslash.ts'/> ////const x = function () { return 111111; } ////x./*1*/someProperty = 5; ////x["/*2*/someProperty"] = 3; verify.baselineFindAllReferences('1', '2')
{ "end_byte": 188, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForStringLiteralPropertyNames6.ts" }
TypeScript/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts_0_1925
/// <reference path='fourslash.ts'/> ////class A { //// x: any //// constructor([a]: any) { //// } ////} ////class B { //// x: any; //// constructor( {a} = { a: 1 }) { //// } ////} verify.navigationTree({ "text": "<global>", "kind": "script", "childItems": [ { "text": "A", "kind": "class", "childItems": [ { "text": "constructor", "kind": "constructor" }, { "text": "x", "kind": "property" } ] }, { "text": "B", "kind": "class", "childItems": [ { "text": "constructor", "kind": "constructor" }, { "text": "x", "kind": "property" } ] } ] }); verify.navigationBar([ { "text": "<global>", "kind": "script", "childItems": [ { "text": "A", "kind": "class" }, { "text": "B", "kind": "class" } ] }, { "text": "A", "kind": "class", "childItems": [ { "text": "constructor", "kind": "constructor" }, { "text": "x", "kind": "property" } ], "indent": 1 }, { "text": "B", "kind": "class", "childItems": [ { "text": "constructor", "kind": "constructor" }, { "text": "x", "kind": "property" } ], "indent": 1 } ]);
{ "end_byte": 1925, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts" }
TypeScript/tests/cases/fourslash/extract-const_jsxElement5.ts_0_525
/// <reference path="fourslash.ts" /> // @jsx: preserve // @filename: a.tsx ////function Foo() { //// const foo = [ //// /*a*/<div>'" <span></span></div>/*b*/ //// ]; ////} goTo.file("a.tsx"); goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "constant_scope_1", actionDescription: "Extract to constant in global scope", newContent: `const newLocal = <div>'" <span></span></div>; function Foo() { const foo = [ /*RENAME*/newLocal ]; }` });
{ "end_byte": 525, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const_jsxElement5.ts" }
TypeScript/tests/cases/fourslash/completionsInitializerCommitCharacter.ts_0_149
/// <reference path="fourslash.ts" /> // @Filename: file1.ts //// const mySpecialVar = 1; //// const foo = mySpec/**/ verify.baselineCompletions();
{ "end_byte": 149, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsInitializerCommitCharacter.ts" }
TypeScript/tests/cases/fourslash/moveToFile_namedImports.ts_1_924
/// <reference path='fourslash.ts' /> // @Filename: /bar.ts ////const q = 0; // @Filename: /a.ts ////// header comment //// ////import { } from './other'; ////import type { } from './other'; //// ////export const p = 0; ////export const b = 1; ////[|export const y = p + b; ////export const z = 1;|] // @Filename: /other.ts ////import { z, y } from './a'; ////export const t = 2; ////const u = z + t + y; verify.moveToFile({ newFileContents: { "/a.ts": `// header comment import { } from './other'; import type { } from './other'; export const p = 0; export const b = 1; `, "/bar.ts": `import { p, b } from './a'; const q = 0; export const y = p + b; export const z = 1; `, "/other.ts": `import { z, y } from './bar'; export const t = 2; const u = z + t + y;` }, interactiveRefactorArguments: { targetFile: "/bar.ts" }, preferences: { quotePreference: "single", } });
{ "end_byte": 924, "start_byte": 1, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_namedImports.ts" }
TypeScript/tests/cases/fourslash/findAllRefsClassStaticBlocks.ts_0_366
/// <reference path='fourslash.ts' /> ////class ClassStaticBocks { //// static x; //// [|[|/*classStaticBocks1*/static|] {}|] //// static y; //// [|[|/*classStaticBocks2*/static|] {}|] //// static y; //// [|[|/*classStaticBocks3*/static|] {}|] ////} verify.baselineFindAllReferences("classStaticBocks1", "classStaticBocks2", "classStaticBocks3");
{ "end_byte": 366, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsClassStaticBlocks.ts" }
TypeScript/tests/cases/fourslash/getOccurrencesClassExpressionPublic.ts_0_467
/// <reference path='fourslash.ts' /> ////let A = class Foo { //// [|public|] foo; //// [|public|] public; //// constructor([|public|] y: string, private x: string) { //// } //// [|public|] method() { } //// private method2() {} //// [|public|] static static() { } ////} //// ////let B = class D { //// constructor(private x: number) { //// } //// private test() {} //// public test2() {} ////} verify.baselineDocumentHighlights();
{ "end_byte": 467, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesClassExpressionPublic.ts" }
TypeScript/tests/cases/fourslash/completionListForRest.ts_0_391
/// <reference path='fourslash.ts'/> ////interface Gen { //// x: number; //// parent: Gen; //// millenial: string; ////} ////let t: Gen; ////var { x, ...rest } = t; ////rest./*1*/x; verify.completions({ marker: "1", exact: [ { name: "millenial", text: "(property) Gen.millenial: string" }, { name: "parent", text: "(property) Gen.parent: Gen" }, ], });
{ "end_byte": 391, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListForRest.ts" }
TypeScript/tests/cases/fourslash/indirectJsRequireRename.ts_0_470
/// <reference path="fourslash.ts" /> // @allowJs: true // @Filename: /bin/serverless.js //// require('../lib/classes/Error').log/**/Warning(`CLI triage crashed with: ${error.stack}`); // @Filename: /lib/plugins/aws/package/compile/events/httpApi/index.js //// const { logWarning } = require('../../../../../../classes/Error'); // @Filename: /lib/classes/Error.js //// module.exports.logWarning = message => { }; goTo.marker(); verify.baselineFindAllReferences("");
{ "end_byte": 470, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/indirectJsRequireRename.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType20.ts_0_406
/// <reference path='fourslash.ts' /> //// type A<T, U> = () => <T>(v: /*a*/T/*b*/) => (v: T) => <T>(v: T) => U; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType<T> = T; type A<T, U> = () => <T>(v: NewType<T>) => (v: T) => <T>(v: T) => U;`, });
{ "end_byte": 406, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType20.ts" }
TypeScript/tests/cases/fourslash/signatureHelpCommentsClassMembers.ts_0_3913
/// <reference path='fourslash.ts' /> /////** This is comment for c1*/ ////class c1 { //// /** p1 is property of c1*/ //// public p1: number; //// /** sum with property*/ //// public p2(/** number to add*/b: number) { //// return this.p1 + b; //// } //// /** getter property 1*/ //// public get p3() { //// return this.p2(/*8*/this.p1); //// } //// /** setter property 1*/ //// public set p3(/** this is value*/value: number) { //// this.p1 = this.p2(/*13*/value); //// } //// /** pp1 is property of c1*/ //// private pp1: number; //// /** sum with property*/ //// private pp2(/** number to add*/b: number) { //// return this.p1 + b; //// } //// /** getter property 2*/ //// private get pp3() { //// return this.pp2(/*20*/this.pp1); //// } //// /** setter property 2*/ //// private set pp3( /** this is value*/value: number) { //// this.pp1 = this.pp2(/*25*/value); //// } //// /** Constructor method*/ //// constructor() { //// } //// /** s1 is static property of c1*/ //// static s1: number; //// /** static sum with property*/ //// static s2(/** number to add*/b: number) { //// return c1.s1 + b; //// } //// /** static getter property*/ //// static get s3() { //// return c1.s2(/*35*/c1.s1); //// } //// /** setter property 3*/ //// static set s3( /** this is value*/value: number) { //// c1.s1 = c1.s2(/*42*/value); //// } //// public nc_p1: number; //// public nc_p2(b: number) { //// return this.nc_p1 + b; //// } //// public get nc_p3() { //// return this.nc_p2(/*47*/this.nc_p1); //// } //// public set nc_p3(value: number) { //// this.nc_p1 = this.nc_p2(/*49*/value); //// } //// private nc_pp1: number; //// private nc_pp2(b: number) { //// return this.nc_pp1 + b; //// } //// private get nc_pp3() { //// return this.nc_pp2(/*54*/this.nc_pp1); //// } //// private set nc_pp3(value: number) { //// this.nc_pp1 = this.nc_pp2(/*56*/value); //// } //// static nc_s1: number; //// static nc_s2(b: number) { //// return c1.nc_s1 + b; //// } //// static get nc_s3() { //// return c1.nc_s2(/*61*/c1.nc_s1); //// } //// static set nc_s3(value: number) { //// c1.nc_s1 = c1.nc_s2(/*63*/value); //// } ////} ////var i1 = new c1(/*65*/); ////var i1_p = i1.p1; ////var i1_f = i1.p2; ////var i1_r = i1.p2(/*71*/20); ////var i1_prop = i1.p3; ////i1.p3 = i1_prop; ////var i1_nc_p = i1.nc_p1; ////var i1_ncf = i1.nc_p2; ////var i1_ncr = i1.nc_p2(/*81*/20); ////var i1_ncprop = i1.nc_p3; ////i1.nc_p3 = i1_ncprop; ////var i1_s_p = c1.s1; ////var i1_s_f = c1.s2; ////var i1_s_r = c1.s2(/*92*/20); ////var i1_s_prop = c1.s3; ////c1.s3 = i1_s_prop; ////var i1_s_nc_p = c1.nc_s1; ////var i1_s_ncf = c1.nc_s2; ////var i1_s_ncr = c1.nc_s2(/*102*/20); ////var i1_s_ncprop = c1.nc_s3; ////c1.nc_s3 = i1_s_ncprop; ////var i1_c = c1; //// ////class cProperties { //// private val: number; //// /** getter only property*/ //// public get p1() { //// return this.val; //// } //// public get nc_p1() { //// return this.val; //// } //// /**setter only property*/ //// public set p2(value: number) { //// this.val = value; //// } //// public set nc_p2(value: number) { //// this.val = value; //// } ////} ////var cProperties_i = new cProperties(); ////cProperties_i.p2 = cProperties_i.p1; ////cProperties_i.nc_p2 = cProperties_i.nc_p1; ////class cWithConstructorProperty { //// /** //// * this is class cWithConstructorProperty's constructor //// * @param a this is first parameter a //// */ //// constructor(/**more info about a*/public a: number) { //// var bbbb = 10; //// this.a = a + 2 + bbbb; //// } ////} verify.baselineSignatureHelp()
{ "end_byte": 3913, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpCommentsClassMembers.ts" }
TypeScript/tests/cases/fourslash/jsDocPropertyDescription12.ts_0_277
///<reference path="fourslash.ts" /> //// type SymbolAlias = { //// /** Something generic */ //// [p: symbol]: string; //// } //// function symbolAlias(e: SymbolAlias) { //// console.log(e./*symbolAlias*/anything); //// } verify.quickInfoAt("symbolAlias", "any");
{ "end_byte": 277, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocPropertyDescription12.ts" }
TypeScript/tests/cases/fourslash/moveToFile_overloads1.ts_0_548
/// <reference path='fourslash.ts' /> // @Filename: /add.ts //// // @Filename: /a.ts ////[|function add(x: number, y: number): number;|] ////function add(x: string, y: string): string; ////function add(x: any, y: any) { //// return x + y; ////} verify.moveToFile({ newFileContents: { "/a.ts": "", "/add.ts": ` function add(x: number, y: number): number; function add(x: string, y: string): string; function add(x: any, y: any) { return x + y; } ` }, interactiveRefactorArguments: { targetFile: "/add.ts" } });
{ "end_byte": 548, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_overloads1.ts" }
TypeScript/tests/cases/fourslash/signatureHelpTaggedTemplates1.ts_0_561
/// <reference path='fourslash.ts' /> //// function f(templateStrings, x, y, z) { return 10; } //// function g(templateStrings, x, y, z) { return ""; } //// //// f `/*1*/ qwe/*2*/rty /*3*/$/*4*/{ 123 }/*5*/ as/*6*/df /*7*/$/*8*/{ 41234 }/*9*/ zxc/*10*/vb /*11*/$/*12*/{ g ` ` }/*13*/ /*14*/ /*15*/` verify.signatureHelp({ marker: test.markers(), text: "f(templateStrings: any, x: any, y: any, z: any): number", argumentCount: 4, parameterCount: 4, parameterName: "templateStrings", parameterSpan: "templateStrings: any", });
{ "end_byte": 561, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpTaggedTemplates1.ts" }
TypeScript/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_enumMembers2.ts_0_159
/// <reference path='fourslash.ts' /> ////var aa = 1; ////enum a { foo, /*enumValueName3*/ verify.completions({ marker: test.markers(), exact: undefined });
{ "end_byte": 159, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_enumMembers2.ts" }
TypeScript/tests/cases/fourslash/codeFixUndeclaredInStaticMethod.ts_0_2172
/// <reference path='fourslash.ts' /> //// class A { //// static foo0() { //// this.m1(1,2,3); //// A.m2(1,2); //// this.prop1 = 10; //// A.prop2 = "asdf"; //// } //// } verify.codeFix({ description: "Declare static method 'm1'", index: 0, newFileContent: `class A { static foo0() { this.m1(1,2,3); A.m2(1,2); this.prop1 = 10; A.prop2 = "asdf"; } static m1(arg0: number, arg1: number, arg2: number) { throw new Error("Method not implemented."); } }`, applyChanges: true, }); verify.codeFix({ description: "Declare static method 'm2'", index: 0, newFileContent: `class A { static foo0() { this.m1(1,2,3); A.m2(1,2); this.prop1 = 10; A.prop2 = "asdf"; } static m2(arg0: number, arg1: number) { throw new Error("Method not implemented."); } static m1(arg0: number, arg1: number, arg2: number) { throw new Error("Method not implemented."); } }`, applyChanges: true, }); verify.codeFix({ description: "Declare static property 'prop1'", index: 0, newFileContent: `class A { static prop1: number; static foo0() { this.m1(1,2,3); A.m2(1,2); this.prop1 = 10; A.prop2 = "asdf"; } static m2(arg0: number, arg1: number) { throw new Error("Method not implemented."); } static m1(arg0: number, arg1: number, arg2: number) { throw new Error("Method not implemented."); } }`, applyChanges: true, }); verify.codeFix({ description: "Declare static property 'prop2'", index: 1, // fix at index 0 is to change the spelling to 'prop1' newFileContent: `class A { static prop1: number; static prop2: string; static foo0() { this.m1(1,2,3); A.m2(1,2); this.prop1 = 10; A.prop2 = "asdf"; } static m2(arg0: number, arg1: number) { throw new Error("Method not implemented."); } static m1(arg0: number, arg1: number, arg2: number) { throw new Error("Method not implemented."); } }`, applyChanges: true, });
{ "end_byte": 2172, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUndeclaredInStaticMethod.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFix_jsxReact17.ts_0_671
/// <reference path="fourslash.ts" /> // @jsx: preserve // @module: commonjs // @Filename: /node_modules/@types/react/index.d.ts //// declare namespace React { //// function createElement(): any; //// } //// export = React; //// export as namespace React; //// //// declare global { //// namespace JSX { //// interface IntrinsicElements {} //// interface IntrinsicAttributes {} //// } //// } // @Filename: /component.tsx //// import "react"; //// export declare function Component(): any; // @Filename: /index.tsx //// (<Component/**/ />); goTo.marker(""); verify.importFixAtPosition([`import { Component } from "./component"; (<Component />);`]);
{ "end_byte": 671, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_jsxReact17.ts" }
TypeScript/tests/cases/fourslash/refactorConvertExport_namedToDefault2.ts_0_586
/// <reference path='fourslash.ts' /> // @Filename: /a.ts /////*a*/export const f = () => { //// return class C { //// constructor(@Foo() param: any) { } //// } ////}/*b*/ ////function Foo(...args: any[]): any {} goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Convert export", actionName: "Convert named export to default export", actionDescription: "Convert named export to default export", newContent: `export default () => { return class C { constructor(@Foo() param: any) { } } } function Foo(...args: any[]): any {}`, });
{ "end_byte": 586, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertExport_namedToDefault2.ts" }
TypeScript/tests/cases/fourslash/completionNoAutoInsertQuestionDotForThis.ts_0_598
/// <reference path="fourslash.ts" /> // @strict: true //// class Address { //// city: string = ""; //// "postal code": string = ""; //// method() { //// this[|./**/|] //// } //// } verify.completions({ marker: "", exact: [ { name: "city", text: "(property) Address.city: string", insertText: undefined }, { name: "method" }, { name: "postal code", text: "(property) Address[\"postal code\"]: string", insertText: "[\"postal code\"]", replacementSpan: test.ranges()[0] }, ], preferences: { includeInsertTextCompletions: true }, });
{ "end_byte": 598, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionNoAutoInsertQuestionDotForThis.ts" }
TypeScript/tests/cases/fourslash/quickInfoJSDocTags.ts_0_1533
///<reference path="fourslash.ts" /> //// /** //// * This is class Foo. //// * @mytag comment1 comment2 //// */ //// class Foo { //// /** //// * This is the constructor. //// * @myjsdoctag this is a comment //// */ //// constructor(value: number) {} //// /** //// * method1 documentation //// * @mytag comment1 comment2 //// */ //// static method1() {} //// /** //// * @mytag //// */ //// method2() {} //// /** //// * @mytag comment1 comment2 //// */ //// property1: string; //// /** //// * @mytag1 some comments //// * some more comments about mytag1 //// * @mytag2 //// * here all the comments are on a new line //// * @mytag3 //// * @mytag //// */ //// property2: number; //// /** //// * @returns {number} a value //// */ //// method3(): number { return 3; } //// /** //// * @param {string} foo A value. //// * @returns {number} Another value //// * @mytag //// */ //// method4(foo: string): number { return 3; } //// /** @mytag */ //// method5() {} //// /** method documentation //// * @mytag a JSDoc tag //// */ //// newMethod() {} //// } //// var foo = new /*1*/Foo(/*10*/4); //// /*2*/Foo./*3*/method1(/*11*/); //// foo./*4*/method2(/*12*/); //// foo./*5*/method3(/*13*/); //// foo./*6*/method4(); //// foo./*7*/property1; //// foo./*8*/property2; //// foo./*9*/method5(); //// foo.newMet/*14*/ verify.baselineQuickInfo();
{ "end_byte": 1533, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoJSDocTags.ts" }
TypeScript/tests/cases/fourslash/autoImportPackageJsonImportsPreference3.ts_0_416
/// <reference path="fourslash.ts" /> // @module: nodenext // @Filename: /package.json //// { //// "imports": { //// "#*": "./src/*.ts" //// } //// } // @Filename: /src/a/b/c/something.ts //// export function something(name: string): any; // @Filename: /src/a/b/c/d.ts //// something/**/ verify.importFixModuleSpecifiers("", ["#a/b/c/something"], { importModuleSpecifierPreference: "non-relative" });
{ "end_byte": 416, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportPackageJsonImportsPreference3.ts" }
TypeScript/tests/cases/fourslash/convertFunctionToEs6Class14.ts_0_350
/// <reference path="fourslash.ts" /> // @allowNonTsExtensions: true // @filename: foo.js ////const NS = {}; ////NS.Foo = function () {}; ////NS.Foo.prototype.m = function () {}; verify.codeFix({ description: "Convert function to an ES2015 class", newFileContent: `const NS = {}; NS.Foo = class { constructor() { } m() { } }; ` });
{ "end_byte": 350, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/convertFunctionToEs6Class14.ts" }
TypeScript/tests/cases/fourslash/jsdocThrowsTagCompletion.ts_0_184
///<reference path="fourslash.ts" /> /////** //// * @throws {/**/} description //// */ ////function fn() {} verify.completions( { marker: "", exact: completion.globalTypes }, );
{ "end_byte": 184, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocThrowsTagCompletion.ts" }
TypeScript/tests/cases/fourslash/codeFixSpelling13.ts_0_567
/// <reference path='fourslash.ts' /> // @noImplicitOverride: true ////type Foo = abstract new(...args: any) => any; ////declare function CreateMixin<C extends Foo, T extends Foo>(Context: C, Base: T): T & { //// new (...args: any[]): { context: InstanceType<C> } ////} ////class Context {} ////class A { //// foo() {} ////} ////class B extends CreateMixin(Context, A) { //// [|override doSomethang() {}|] ////} verify.codeFix({ index: 0, description: [ts.Diagnostics.Remove_override_modifier.message], newRangeContent: "doSomethang() {}" });
{ "end_byte": 567, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixSpelling13.ts" }
TypeScript/tests/cases/fourslash/moveToNewFile_namedExport2.ts_0_309
/// <reference path='fourslash.ts' /> // @Filename: /a.ts ////const a = 1, b = 2; ////[|const c = b + 1;|] ////export { a, b }; verify.moveToNewFile({ newFileContents: { "/a.ts": `const a = 1, b = 2; export { a, b };`, "/c.ts": `import { b } from "./a"; const c = b + 1; `, } });
{ "end_byte": 309, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_namedExport2.ts" }
TypeScript/tests/cases/fourslash/completionsImport_default_fromMergedDeclarations.ts_0_797
/// <reference path="fourslash.ts" /> // @module: esnext // @Filename: /a.ts ////declare module "m" { //// export default class M {} ////} // @Filename: /b.ts ////declare module "m" { //// export default interface M {} ////} // @Filename: /c.ts /////**/ verify.completions({ marker: "", includes: { name: "M", source: "m", sourceDisplay: "m", text: "class M", kind: "class", kindModifiers: "export,declare", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); verify.applyCodeActionFromCompletion("", { name: "M", source: "m", description: `Add import from "m"`, newFileContent: `import M from "m"; `, });
{ "end_byte": 797, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_default_fromMergedDeclarations.ts" }
TypeScript/tests/cases/fourslash/inlayHintsFunctionParameterTypes3.ts_0_468
/// <reference path="fourslash.ts" /> ////interface IFoo { //// bar(x?: boolean): void; ////} //// ////const a: IFoo = { //// bar: function (x?): void { //// throw new Error("Function not implemented."); //// } ////} ////class Foo { //// #value = 0; //// get foo(): number { return this.#value; } //// set foo(value) { this.#value = value; } ////} verify.baselineInlayHints(undefined, { includeInlayFunctionParameterTypeHints: true });
{ "end_byte": 468, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlayHintsFunctionParameterTypes3.ts" }
TypeScript/tests/cases/fourslash/extract-unterminated1.ts_0_387
/// <reference path="fourslash.ts" /> // Unterminated RegExp literal: //// /*1*/const foo = /asdfasf/*2*/ goTo.select("1", "2"); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "function_scope_0", actionDescription: "Extract to function in global scope", newContent: `const foo = /*RENAME*/newFunction() function newFunction() { return /asdfasf/; } ` });
{ "end_byte": 387, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-unterminated1.ts" }
TypeScript/tests/cases/fourslash/completionsPrivateProperties_Js.ts_0_408
/// <reference path="fourslash.ts" /> // @allowJs: true // @Filename: a.d.ts ////declare namespace A { //// class Foo { //// constructor(); //// //// private m1(): void; //// protected m2(): void; //// //// m3(): void; //// } ////} // @filename: b.js ////let foo = new A.Foo(); ////foo./**/ verify.completions({ marker: [""], includes: ["m3"], excludes: ["m1", "m2"] });
{ "end_byte": 408, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsPrivateProperties_Js.ts" }
TypeScript/tests/cases/fourslash/completionReturnConstAssertion.ts_3_333
/ <reference path="fourslash.ts" /> //// type T = { //// foo1: 1; //// foo2: 2; //// } //// function F(x: ()=>T) {} //// F(()=>({/*1*/} as const)) verify.completions({ marker: "1", exact: [ { name: "foo1", text: "(property) foo1: 1" }, { name: "foo2", text: "(property) foo2: 2" }, ], });
{ "end_byte": 333, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionReturnConstAssertion.ts" }
TypeScript/tests/cases/fourslash/completionClassMemberSnippetCrossFileNodeReuse1.ts_0_1267
/// <reference path="fourslash.ts" /> // @strict: true // @filename: KlassConstructor.ts //// type GenericConstructor<T> = new (...args: any[]) => T; //// export type KlassConstructor<Cls extends GenericConstructor<any>> = //// GenericConstructor<InstanceType<Cls>> & { [k in keyof Cls]: Cls[k] }; // @filename: ElementNode.ts //// import { KlassConstructor } from "./KlassConstructor"; //// //// export type NodeKey = string; //// //// export class ElementNode { //// ["constructor"]!: KlassConstructor<typeof ElementNode>; //// } // @filename: CollapsibleContainerNode.ts //// import { ElementNode, NodeKey } from "./ElementNode"; //// //// export class CollapsibleContainerNode extends ElementNode { //// __open: boolean; //// //// /*1*/ //// } format.setFormatOptions({ insertSpaceAfterConstructor: false, }); verify.completions({ marker: "1", preferences: { includeCompletionsWithClassMemberSnippets: true, includeCompletionsWithInsertText: true, }, includes: [{ name: `["constructor"]`, insertText: `["constructor"]: KlassConstructor<typeof ElementNode>;`, filterText: `["constructor"]`, hasAction: true, source: 'ClassMemberSnippet/' }], isNewIdentifierLocation: true, });
{ "end_byte": 1267, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionClassMemberSnippetCrossFileNodeReuse1.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType_js4.ts_0_636
/// <reference path='fourslash.ts' /> // @allowJs: true // @Filename: a.js //// /** //// * @template T //// * @template U //// * @param {T} b //// * @param {U} c //// * @returns {/*a*/T | U/*b*/} //// */ //// function a(b, c) {} goTo.file('a.js') goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to typedef", actionDescription: "Extract to typedef", newContent: `/** * @template T * @template U * @typedef {T | U} /*RENAME*/NewType */ /** * @template T * @template U * @param {T} b * @param {U} c * @returns {NewType<T, U>} */ function a(b, c) {}`, });
{ "end_byte": 636, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType_js4.ts" }
TypeScript/tests/cases/fourslash/completionWithDotFollowedByNamespaceKeyword.ts_0_295
/// <reference path='fourslash.ts'/> ////namespace A { //// function foo() { //// if (true) { //// B./**/ //// namespace B { //// export function baz() { } ////} verify.completions({ marker: "", exact: { name: "baz", text: "function B.baz(): void" } });
{ "end_byte": 295, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionWithDotFollowedByNamespaceKeyword.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingMember30.ts_0_2252
/// <reference path='fourslash.ts' /> ////class C { //// constructor() { //// this.foo({ //// 'foo.a': '', //// 'foo.b': '', //// 'foo.c': '', //// 'foo.d': '', //// 'foo.e': '', //// 'foo.f': '', //// 'foo.g': '', //// 'foo.h': '', //// 'foo.i': '', //// 'foo.j': '', //// 'foo.k': '', //// 'foo.l': '', //// 'foo.m': '', //// 'foo.n': '', //// 'foo.o': '', //// 'foo.p': '', //// 'foo.q': '', //// 'foo.r': '', //// 'foo.s': '', //// 'foo.t': '', //// 'foo.u': '', //// 'foo.v': '', //// 'foo.w': '', //// 'foo.x': '', //// 'foo.y': '', //// 'foo.z': '', //// }); //// } ////} verify.codeFix({ description: [ts.Diagnostics.Declare_method_0.message, "foo"], index: 0, newFileContent: `class C { constructor() { this.foo({ 'foo.a': '', 'foo.b': '', 'foo.c': '', 'foo.d': '', 'foo.e': '', 'foo.f': '', 'foo.g': '', 'foo.h': '', 'foo.i': '', 'foo.j': '', 'foo.k': '', 'foo.l': '', 'foo.m': '', 'foo.n': '', 'foo.o': '', 'foo.p': '', 'foo.q': '', 'foo.r': '', 'foo.s': '', 'foo.t': '', 'foo.u': '', 'foo.v': '', 'foo.w': '', 'foo.x': '', 'foo.y': '', 'foo.z': '', }); } foo(arg0: { 'foo.a': string; 'foo.b': string; 'foo.c': string; 'foo.d': string; 'foo.e': string; 'foo.f': string; 'foo.g': string; 'foo.h': string; 'foo.i': string; 'foo.j': string; 'foo.k': string; 'foo.l': string; 'foo.m': string; 'foo.n': string; 'foo.o': string; 'foo.p': string; 'foo.q': string; 'foo.r': string; 'foo.s': string; 'foo.t': string; 'foo.u': string; 'foo.v': string; 'foo.w': string; 'foo.x': string; 'foo.y': string; 'foo.z': string; }) { throw new Error("Method not implemented."); } }`, });
{ "end_byte": 2252, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingMember30.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesBoth.ts_0_356
/// <reference path='fourslash.ts' /> ////interface I { //// [x: number]: I; //// [y: string]: I; ////} //// ////class C implements I {} verify.codeFix({ description: "Implement interface 'I'", newFileContent: `interface I { [x: number]: I; [y: string]: I; } class C implements I { [x: number]: I; [y: string]: I; }`, });
{ "end_byte": 356, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesBoth.ts" }
TypeScript/tests/cases/fourslash/getOccurrencesLoopBreakContinue2.ts_0_1863
/// <reference path='fourslash.ts' /> ////var arr = [1, 2, 3, 4]; ////label1: for (var n in arr) { //// break; //// continue; //// break label1; //// continue label1; //// //// label2: [|f/**/or|] (var i = 0; i < arr[n]; i++) { //// break label1; //// continue label1; //// //// [|break|]; //// [|continue|]; //// [|break|] label2; //// [|continue|] label2; //// //// function foo() { //// label3: while (true) { //// break; //// continue; //// break label3; //// continue label3; //// //// // these cross function boundaries //// break label1; //// continue label1; //// break label2; //// continue label2; //// //// label4: do { //// break; //// continue; //// break label4; //// continue label4; //// //// break label3; //// continue label3; //// //// switch (10) { //// case 1: //// case 2: //// break; //// break label4; //// default: //// continue; //// } //// //// // these cross function boundaries //// break label1; //// continue label1; //// break label2; //// continue label2; //// () => { break; //// } while (true) //// } //// } //// } ////} //// ////label5: while (true) break label5; //// ////label7: while (true) continue label5; verify.baselineDocumentHighlights();
{ "end_byte": 1863, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesLoopBreakContinue2.ts" }
TypeScript/tests/cases/fourslash/formattingComma.ts_0_873
///<reference path="fourslash.ts"/> ////var x = [1 , 2];/*x*/ ////var y = ( 1 , 2 );/*y*/ ////var z1 = 1 , zz = 2;/*z1*/ ////var z2 = { //// x: 1 ,/*z2*/ //// y: 2 ////}; ////var z3 = ( //// () => { } ,/*z3*/ //// () => { } //// ); ////var z4 = [ //// () => { } ,/*z4*/ //// () => { } ////]; ////var z5 = { //// x: () => { } ,/*z5*/ //// y: () => { } ////}; format.document(); goTo.marker('x'); verify.currentLineContentIs("var x = [1, 2];"); goTo.marker('y'); verify.currentLineContentIs("var y = (1, 2);"); goTo.marker('z1'); verify.currentLineContentIs("var z1 = 1, zz = 2;"); goTo.marker('z2'); verify.currentLineContentIs(" x: 1,"); goTo.marker('z3'); verify.currentLineContentIs(" () => { },"); goTo.marker('z4'); verify.currentLineContentIs(" () => { },"); goTo.marker('z5'); verify.currentLineContentIs(" x: () => { },");
{ "end_byte": 873, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingComma.ts" }
TypeScript/tests/cases/fourslash/signatureHelpOnTypePredicates.ts_0_430
/// <reference path="fourslash.ts" /> //// function f1(a: any): a is number {} //// function f2<T>(a: any): a is T {} //// function f3(a: any, ...b): a is number {} //// f1(/*1*/) //// f2(/*2*/) //// f3(/*3*/) verify.signatureHelp( { marker: "1", text: "f1(a: any): a is number" }, { marker: "2", text: "f2(a: any): a is unknown" }, { marker: "3", text: "f3(a: any, ...b: any[]): a is number", isVariadic: true }, )
{ "end_byte": 430, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpOnTypePredicates.ts" }
TypeScript/tests/cases/fourslash/goToImplementationTypeAlias_00.ts_0_338
/// <reference path='fourslash.ts'/> // Should go to object literals within cast expressions when invoked on interface // @Filename: def.d.ts //// export type TypeAlias = { P: number } // @Filename: ref.ts //// import { TypeAlias } from "./def"; //// const c: T/*ref*/ypeAlias = [|{ P: 2 }|]; verify.baselineGoToImplementation("ref");
{ "end_byte": 338, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationTypeAlias_00.ts" }
TypeScript/tests/cases/fourslash/completionListInUnclosedFunction09.ts_3_330
/ <reference path="fourslash.ts" /> ////function foo(x: string, y: number, z: boolean) { //// function bar(a: number, b: string = "hello", c: typeof x = "hello") { //// var v = /*1*/ ////} verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"], isNewIdentifierLocation: true });
{ "end_byte": 330, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedFunction09.ts" }
TypeScript/tests/cases/fourslash/formatParameter.ts_0_459
/// <reference path='fourslash.ts' /> ////function foo( //// first: //// number,/*first*/ //// second: ( //// string/*second*/ //// ), //// third: //// ( //// boolean/*third*/ //// ) ////) { ////} format.document(); goTo.marker("first"); verify.currentLineContentIs(" number,"); goTo.marker("second"); verify.currentLineContentIs(" string"); goTo.marker("third"); verify.currentLineContentIs(" boolean");
{ "end_byte": 459, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatParameter.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType_js_Union_CommentAfterMember.ts_0_428
/// <reference path='fourslash.ts' /> // @allowJs: true // @Filename: a.js ////type Bar = /*a*/[|string | boolean /* oops */ |]/*b*/; goTo.file('a.js') goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to typedef", actionDescription: "Extract to typedef", newContent: `/** * @typedef {string | boolean} /*RENAME*/NewType */ type Bar = NewType /* oops */ ;`, });
{ "end_byte": 428, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType_js_Union_CommentAfterMember.ts" }
TypeScript/tests/cases/fourslash/completionListInvalidMemberNames2.ts_0_523
/// <reference path='fourslash.ts' /> // TODO: we should probably support this like we do in completionListInvalidMemberNames.ts ////declare var Symbol: SymbolConstructor; ////interface SymbolConstructor { //// readonly hasInstance: symbol; ////} ////interface Function { //// [Symbol.hasInstance](value: any): boolean; ////} ////interface SomeInterface { //// (value: number): any; ////} ////var _ : SomeInterface; ////_./**/ verify.completions({ marker: "", exact: completion.functionMembersWithPrototype });
{ "end_byte": 523, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInvalidMemberNames2.ts" }
TypeScript/tests/cases/fourslash/inlineVariableNotAVariableStatement.ts_0_184
/// <reference path="fourslash.ts" /> ////for (let /*a*/i/*b*/ = 0; i < 5; i++) { //// console.log(i) ////} goTo.select("a", "b"); verify.not.refactorAvailable("Inline variable");
{ "end_byte": 184, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlineVariableNotAVariableStatement.ts" }
TypeScript/tests/cases/fourslash/completionsSelfDeclaring3.ts_0_464
/// <reference path="fourslash.ts" /> ////function f<T extends { x: number }>(p: T & (T extends { hello: string } ? { goodbye: number } : {})) {} ////f({ x/*x*/: 0, hello/*hello*/: "", goodbye/*goodbye*/: 0, abc/*abc*/: "" }) verify.completions({ marker: "x", exact: ["x"] }); verify.completions({ marker: "hello", exact: [] }); verify.completions({ marker: "goodbye", exact: ["goodbye"] }); verify.completions({ marker: "abc", exact: [] });
{ "end_byte": 464, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsSelfDeclaring3.ts" }
TypeScript/tests/cases/fourslash/codeFixTopLevelForAwait_target_existingCompilerOptionsInTsConfig.ts_0_517
/// <reference path="fourslash.ts" /> // @filename: /dir/a.ts ////declare const p: number[]; ////for await (const _ of p); ////export {}; // @filename: /dir/tsconfig.json ////{ //// "compilerOptions": { //// "target": "es2015" //// } ////} verify.codeFix({ description: [ts.Diagnostics.Set_the_target_option_in_your_configuration_file_to_0.message, "es2017"], index: 1, newFileContent: { "/dir/tsconfig.json": `{ "compilerOptions": { "target": "es2017" } }` } });
{ "end_byte": 517, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixTopLevelForAwait_target_existingCompilerOptionsInTsConfig.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceDuplicateMember1.ts_0_305
/// <reference path='fourslash.ts' /> //// interface I1 { //// x: number; //// } //// interface I2 { //// x: number; //// } //// //// class C implements I1,I2 {[| |]} verify.codeFixAvailable([ { description: "Implement interface 'I1'" }, { description: "Implement interface 'I2'" }, ]);
{ "end_byte": 305, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceDuplicateMember1.ts" }
TypeScript/tests/cases/fourslash/completionEntryForClassMembers2.ts_0_7614
///<reference path="fourslash.ts" /> ////interface I { //// methodOfInterface(): number; ////} ////interface I2 { //// methodOfInterface2(): number; ////} ////interface I3 { //// getValue(): string; //// method(): string; ////} ////interface I4 { //// staticMethod(): void; //// method(): string; ////} ////class B0 { //// private privateMethod() { } //// protected protectedMethod() { } //// static staticMethod() { } //// getValue(): string | boolean { return "hello"; } //// private privateMethod1() { } //// protected protectedMethod1() { } //// static staticMethod1() { } //// getValue1(): string | boolean { return "hello"; } ////} ////interface I5 extends B0 { //// methodOfInterface5(): number; ////} ////interface I6 extends B0 { //// methodOfInterface6(): number; //// staticMethod(): void; ////} ////interface I7 extends I { //// methodOfInterface7(): number; ////} ////class B { //// private privateMethod() { } //// protected protectedMethod() { } //// static staticMethod() { } //// getValue(): string | boolean { return "hello"; } ////} ////class C0 implements I, I2 { //// /*implementsIAndI2*/ ////} ////class C00 implements I, I2 { //// static /*implementsIAndI2AndWritingStatic*/ ////} ////class C001 implements I, I2 { //// methodOfInterface/*implementsIAndI2AndWritingMethodNameOfI*/ ////} ////class C extends B implements I, I2 { //// /*extendsBAndImplementsIAndI2*/ ////} ////class C1 extends B implements I, I2 { //// static /*extendsBAndImplementsIAndI2AndWritingStatic*/ ////} ////class D extends B implements I, I2 { //// /*extendsBAndImplementsIAndI2WithMethodFromB*/ //// protected protectedMethod() { //// return "protected"; //// } ////} ////class E extends B implements I, I2 { //// /*extendsBAndImplementsIAndI2WithMethodFromI*/ //// methodOfInterface() { //// return 1; //// } ////} ////class F extends B implements I, I2 { //// /*extendsBAndImplementsIAndI2WithMethodFromBAndI*/ //// protected protectedMethod() { //// return "protected" //// } //// methodOfInterface() { //// return 1; //// } ////} ////class F2 extends B implements I, I2 { //// protected protectedMethod() { //// return "protected" //// } //// methodOfInterface() { //// return 1; //// } //// static /*extendsBAndImplementsIAndI2WithMethodFromBAndIAndTypesStatic*/ ////} ////class G extends B implements I3 { //// /*extendsBAndImplementsI3WithSameNameMembers*/ ////} ////class H extends B implements I3 { //// /*extendsBAndImplementsI3WithSameNameMembersAndHasImplementedTheMember*/ //// getValue() { //// return "hello"; //// } ////} ////class J extends B0 implements I4 { //// /*extendsB0ThatExtendsAndImplementsI4WithStaticMethod*/ ////} ////class L extends B0 implements I4 { //// /*extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedAnotherMethod*/ //// staticMethod2() { //// return "hello"; //// } ////} ////class K extends B0 implements I4 { //// /*extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedThatMethod*/ //// staticMethod() { //// return "hello"; //// } ////} ////class M extends B0 implements I4 { //// /*extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedThatMethodAsStatic*/ //// static staticMethod() { //// return "hello"; //// } ////} ////class N extends B0 implements I4 { //// /*extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedThatMethodAsBoth*/ //// staticMethod() { //// return "hello"; //// } //// static staticMethod() { //// return "hello"; //// } ////} ////class J1 extends B0 implements I4 { //// static /*extendsB0ThatExtendsAndImplementsI4WithStaticMethodWritingStatic*/ ////} ////class L1 extends B0 implements I4 { //// staticMethod2() { //// return "hello"; //// } //// static /*extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedAnotherMethodWritingStatic*/ ////} ////class K1 extends B0 implements I4 { //// staticMethod() { //// return "hello"; //// } //// static /*extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedThatMethodWritingStatic*/ ////} ////class M1 extends B0 implements I4 { //// static staticMethod() { //// return "hello"; //// } //// static /*extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedThatMethodAsStaticWritingStatic*/ ////} ////class N1 extends B0 implements I4 { //// staticMethod() { //// return "hello"; //// } //// static staticMethod() { //// return "hello"; //// } //// static /*extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedThatMethodAsBothWritingStatic*/ ////} ////class O implements I7 { //// /*implementsI7whichExtendsI*/ ////} ////class P implements I7, I { //// /*implementsI7whichExtendsIAndAlsoImplementsI*/ ////} ////class Q implements I, I7 { //// /*implementsIAndAlsoImplementsI7whichExtendsI*/ ////} ////class R implements I5 { //// /*implementsI5ThatExtendsB0*/ ////} ////class S implements I6 { //// /*implementsI6ThatExtendsB0AndHasStaticMethodOfB0*/ ////} ////class T extends B0 implements I5 { //// /*extendsB0AndImplementsI5ThatExtendsB0*/ ////} ////class U extends B0 implements I6 { //// /*extendsB0AndImplementsI6ThatExtendsB0AndHasStaticMethodOfB0*/ ////} ////class R1 implements I5 { //// static /*implementsI5ThatExtendsB0TypesStatic*/ ////} ////class S1 implements I6 { //// static /*implementsI6ThatExtendsB0AndHasStaticMethodOfB0TypesStatic*/ ////} ////class T1 extends B0 implements I5 { //// static /*extendsB0AndImplementsI5ThatExtendsB0TypesStatic*/ ////} ////class U1 extends B0 implements I6 { //// static /*extendsB0AndImplementsI6ThatExtendsB0AndHasStaticMethodOfB0TypesStatic*/ ////} const validInstanceMembersOfBaseClassB: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ { name: "protectedMethod", text: "(method) B.protectedMethod(): void", kindModifiers: "protected" }, { name: "getValue", text: "(method) B.getValue(): string | boolean" }, ]; const validStaticMembersOfBaseClassB: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ { name: "staticMethod", text: "(method) B.staticMethod(): void", kindModifiers: "static" }, ]; const privateMembersOfBaseClassB: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ { name: "privateMethod", text: "(method) B.privateMethod(): void" }, ]; const protectedPropertiesOfBaseClassB0: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ { name: "protectedMethod", text: "(method) B0.protectedMethod(): void", kindModifiers: "protected" }, { name: "protectedMethod1", text: "(method) B0.protectedMethod1(): void", kindModifiers: "protected" }, ]; const publicPropertiesOfBaseClassB0: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ { name: "getValue", text: "(method) B0.getValue(): string | boolean" }, { name: "getValue1", text: "(method) B0.getValue1(): string | boolean" }, ]; const validInstanceMembersOfBaseClassB0: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = protectedPropertiesOfBaseClassB0.concat(publicPropertiesOfBaseClassB0); const validInstanceMembersOfBaseClassB0_2 : ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ protectedPropertiesOfBaseClassB0[0], publicPropertiesOfBaseClassB0[0], protectedPropertiesOfBaseClassB0[1], publicPropertiesOfBaseClassB0[1], ];
{ "end_byte": 7614, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionEntryForClassMembers2.ts" }
TypeScript/tests/cases/fourslash/completionEntryForClassMembers2.ts_7615_10757
const validStaticMembersOfBaseClassB0: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ { name: "staticMethod", text: "(method) B0.staticMethod(): void", kindModifiers: "static" }, { name: "staticMethod1", text: "(method) B0.staticMethod1(): void", kindModifiers: "static" }, ]; const privateMembersOfBaseClassB0: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ { name: "privateMethod", text: "(method) B0.privateMethod(): void", kindModifiers: "private" }, { name: "privateMethod1", text: "(method) B0.privateMethod1(): void", kindModifiers: "private" }, ]; const membersOfI: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ { name: "methodOfInterface", text: "(method) I.methodOfInterface(): number" }, ]; const membersOfI2: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ { name: "methodOfInterface2", text: "(method) I2.methodOfInterface2(): number" }, ]; const membersOfI3: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ { name: "getValue", text: "(method) I3.getValue(): string" }, { name: "method", text: "(method) I3.method(): string" }, ]; const membersOfI4: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ { name: "staticMethod", text: "(method) I4.staticMethod(): void" }, { name: "method", text: "(method) I4.method(): string" }, ]; const membersOfI5: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = publicPropertiesOfBaseClassB0.concat([ { name: "methodOfInterface5", text: "(method) I5.methodOfInterface5(): number" }, ]); const membersOfJustI5: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ { name: "methodOfInterface5", text: "(method) I5.methodOfInterface5(): number" }, ]; const membersOfI6: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = publicPropertiesOfBaseClassB0.concat([ { name: "staticMethod", text: "(method) I6.staticMethod(): void" }, { name: "methodOfInterface6", text: "(method) I6.methodOfInterface6(): number" }, ]); const membersOfI7: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ { name: "methodOfInterface7", text: "(method) I7.methodOfInterface7(): number" }, ...membersOfI, ]; const membersOfI7_2: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [ ...membersOfI, { name: "methodOfInterface7", text: "(method) I7.methodOfInterface7(): number" }, ]; const noMembers: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = []; const membersOfIAndI2 = [...membersOfI, ...membersOfI2]; const invalidMembersOfBAtInstanceLocation = privateMembersOfBaseClassB.concat(validStaticMembersOfBaseClassB); const allInstanceBAndIAndI2 = [...validInstanceMembersOfBaseClassB, ...membersOfIAndI2]; const invalidMembersOfB0AtInstanceSide = [...privateMembersOfBaseClassB0, ...validStaticMembersOfBaseClassB0]; const invalidMembersOfB0AtStaticSide = [...privateMembersOfBaseClassB0, validInstanceMembersOfBaseClassB0]; const invalidMembersOfB0AtInstanceSideFromInterfaceExtendingB0 = invalidMembersOfB0AtInstanceSide;
{ "end_byte": 10757, "start_byte": 7615, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionEntryForClassMembers2.ts" }
TypeScript/tests/cases/fourslash/completionEntryForClassMembers2.ts_10759_16830
const tests: ReadonlyArray<{ readonly marker: string | ReadonlyArray<string>, readonly members: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> }> = [ // members of I and I2 { marker: ["implementsIAndI2", "implementsIAndI2AndWritingMethodNameOfI"], members: membersOfIAndI2 }, // Static location so no members of I and I2 { marker: "implementsIAndI2AndWritingStatic", members: [] }, // members of instance B, I and I2 { marker: "extendsBAndImplementsIAndI2", members: allInstanceBAndIAndI2 }, // static location so only static members of B and no members of instance B, I and I2 { marker: [ "extendsBAndImplementsIAndI2AndWritingStatic", "extendsBAndImplementsIAndI2WithMethodFromBAndIAndTypesStatic" ], members: validStaticMembersOfBaseClassB, }, // instance members of B without protectedMethod, I and I2 { marker: "extendsBAndImplementsIAndI2WithMethodFromB",members: [validInstanceMembersOfBaseClassB[1], ...membersOfIAndI2] }, //TODO:NEATER // instance members of B, members of T without methodOfInterface and I2 { marker: "extendsBAndImplementsIAndI2WithMethodFromI", members: [...validInstanceMembersOfBaseClassB, ...membersOfI2] }, // instance members of B without protectedMethod, members of T without methodOfInterface and I2 { marker: "extendsBAndImplementsIAndI2WithMethodFromBAndI", members: [validInstanceMembersOfBaseClassB[1], ...membersOfI2] }, // members of B and members of I3 that are not same as name of method in B { marker: "extendsBAndImplementsI3WithSameNameMembers", members: [...validInstanceMembersOfBaseClassB, membersOfI3[1]] }, //TODO:NEATER // members of B (without getValue since its implemented) and members of I3 that are not same as name of method in B { marker: "extendsBAndImplementsI3WithSameNameMembersAndHasImplementedTheMember", members: [validInstanceMembersOfBaseClassB[0], membersOfI3[1]] }, //TODO:NEATER // members of B0 and members of I4 { marker: [ "extendsB0ThatExtendsAndImplementsI4WithStaticMethod", "extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedAnotherMethod", "extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedThatMethodAsStatic", ], members: [...validInstanceMembersOfBaseClassB0_2, ...membersOfI4], }, // members of B0 and members of I4 that are not staticMethod { marker: [ "extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedThatMethod", "extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedThatMethodAsBoth", ], members: [...validInstanceMembersOfBaseClassB0_2, membersOfI4[1]], //TODO:NEATER }, // static members of B0 { marker: [ "extendsB0ThatExtendsAndImplementsI4WithStaticMethodWritingStatic", "extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedAnotherMethodWritingStatic", "extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedThatMethodWritingStatic", ], members: validStaticMembersOfBaseClassB0, }, // static members of B0 without staticMethod { marker: [ "extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedThatMethodAsStaticWritingStatic", "extendsB0ThatExtendsAndImplementsI4WithStaticMethodAndImplementedThatMethodAsBothWritingStatic", ], members: [validStaticMembersOfBaseClassB0[1]] // TODO:NEATER }, // members of I7 extends I { marker: [ "implementsI7whichExtendsI", "implementsI7whichExtendsIAndAlsoImplementsI", ], members: membersOfI7, }, { marker: "implementsIAndAlsoImplementsI7whichExtendsI", members: membersOfI7_2, }, // members of I5 extends B0 { marker: "implementsI5ThatExtendsB0", members: [...membersOfJustI5, protectedPropertiesOfBaseClassB0[0], publicPropertiesOfBaseClassB0[0], protectedPropertiesOfBaseClassB0[1], publicPropertiesOfBaseClassB0[1]], //TODO:NEATER }, // members of I6 extends B0 { marker: "implementsI6ThatExtendsB0AndHasStaticMethodOfB0", //TODO:NEATER members:[ membersOfI6[3], membersOfI6[2], protectedPropertiesOfBaseClassB0[0], membersOfI6[0], protectedPropertiesOfBaseClassB0[1], membersOfI6[1], ], }, // members of B0 and I5 that extends B0 { marker: "extendsB0AndImplementsI5ThatExtendsB0", members: [ protectedPropertiesOfBaseClassB0[0], membersOfI5[0], protectedPropertiesOfBaseClassB0[1], membersOfI5[1], membersOfI5[2], ], }, // members of B0 and I6 that extends B0 { marker: "extendsB0AndImplementsI6ThatExtendsB0AndHasStaticMethodOfB0", members: [ protectedPropertiesOfBaseClassB0[0], membersOfI6[0], protectedPropertiesOfBaseClassB0[1], membersOfI6[1], membersOfI6[3], membersOfI6[2], ], }, // nothing on static side as these do not extend any other class { marker: [ "implementsI5ThatExtendsB0TypesStatic", "implementsI6ThatExtendsB0AndHasStaticMethodOfB0TypesStatic", ], members: [], }, { marker: [ "extendsB0AndImplementsI5ThatExtendsB0TypesStatic", "extendsB0AndImplementsI6ThatExtendsB0AndHasStaticMethodOfB0TypesStatic", ], // statics of base B but nothing from instance side members: validStaticMembersOfBaseClassB0, }, ]; verify.completions(...tests.map(({ marker, members }): FourSlashInterface.CompletionsOptions => ({ marker, unsorted: [...members.map(m => ({ ...m, kind: "method" })), ...completion.classElementKeywords], isNewIdentifierLocation: true, })));
{ "end_byte": 16830, "start_byte": 10759, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionEntryForClassMembers2.ts" }
TypeScript/tests/cases/fourslash/noErrorsAfterCompletionsRequestWithinGenericFunction3.ts_0_693
///<reference path="fourslash.ts"/> // @strict: true //// //// // repro from #52580#issuecomment-1416131055 //// //// type Funcs<A, B extends Record<string, unknown>> = { //// [K in keyof B]: { //// fn: (a: A, b: B) => void; //// thing: B[K]; //// } //// } //// //// function foo<A, B extends Record<string, unknown>>(fns: Funcs<A, B>) {} //// //// foo({ //// bar: { fn: (a: string, b) => {}, thing: "asd" }, //// /*1*/ //// }); goTo.marker("1"); const markerPosition = test.markers()[0].position; edit.paste(`bar: { fn: (a: string, b) => {}, thing: "asd" },`) edit.replace(markerPosition + 4, 1, 'z') verify.completions({ isNewIdentifierLocation: true }); verify.noErrors();
{ "end_byte": 693, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/noErrorsAfterCompletionsRequestWithinGenericFunction3.ts" }
TypeScript/tests/cases/fourslash/completionsWithStringReplacementMode.ts_0_453
/// <reference path="fourslash.ts" /> ////interface Foo { foo: string; bar: string; } ////type T = Pick<Foo, "[|/*1*/|]">; ////type TT = Pick<Foo, "[|fo/*2*/|]">; ////type TTT = Pick<Foo, "[|b/*3*/|]">; for (let i = 0 ; i < 3; ++i) { verify.completions({ marker: `${i + 1}`, exact: [ { name: "foo", replacementSpan: test.ranges()[i] }, { name: "bar", replacementSpan: test.ranges()[i] }, ] }); }
{ "end_byte": 453, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsWithStringReplacementMode.ts" }
TypeScript/tests/cases/fourslash/navigationBarItemsClass4.ts_0_812
/// <reference path="fourslash.ts" /> // @allowJs: true // @filename: /foo.js ////class Foo {} ////function Foo() {} verify.navigationTree({ text: "<global>", kind: "script", childItems: [ { text: "Foo", kind: "function" }, { text: "Foo", kind: "class" } ] }); verify.navigationBar([ { text: "<global>", kind: "script", childItems: [ { text: "Foo", kind: "function" }, { text: "Foo", kind: "class" } ] }, { text: "Foo", kind: "function", indent: 1 }, { text: "Foo", kind: "class", indent: 1 } ]);
{ "end_byte": 812, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsClass4.ts" }
TypeScript/tests/cases/fourslash/codeFixOverrideModifier1.ts_0_380
/// <reference path='fourslash.ts' /> // @noImplicitOverride: true //// class B { //// foo (v: string) {} //// fooo (v: string) {} //// } //// class D extends B { //// override foo (v: string) {} //// [|fooo (v: string) {}|] //// } verify.codeFix({ description: "Add 'override' modifier", newRangeContent: "override fooo (v: string) {}", index: 0 })
{ "end_byte": 380, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixOverrideModifier1.ts" }
TypeScript/tests/cases/fourslash/codeFixDisableJsDiagnosticsInFile5.ts_0_335
/// <reference path='fourslash.ts' /> // @allowjs: true // @noEmit: true // @checkJs: true // @Filename: a.js ////var x = ""; //// ////[|/** comment */ ////x = 1;|] // Disable checking for next line verify.rangeAfterCodeFix(`/** comment */ // @ts-ignore x = 1;`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
{ "end_byte": 335, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixDisableJsDiagnosticsInFile5.ts" }
TypeScript/tests/cases/fourslash/quickInfoForArgumentsPropertyNameInJsMode2.ts_0_176
/// <reference path="fourslash.ts" /> // @allowJs: true // @filename: a.js ////function /*1*/f(x) { //// arguments; ////} //// /////*2*/f(''); verify.baselineQuickInfo();
{ "end_byte": 176, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForArgumentsPropertyNameInJsMode2.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType14.ts_0_366
/// <reference path='fourslash.ts' /> //// type A<T = /*a*/boolean/*b*/> = string | number | T; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = boolean; type A<T = NewType> = string | number | T;`, });
{ "end_byte": 366, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType14.ts" }
TypeScript/tests/cases/fourslash/stringLiteralCompletionsInJsxAttributeInitializer.ts_0_620
/// <reference path="fourslash.ts" /> // @jsx: preserve // @filename: /a.tsx ////type Props = { a: number } | { b: "somethingelse", c: 0 | 1 }; ////declare function Foo(args: Props): any //// ////const a1 = <Foo b={"/*1*/"} /> ////const a2 = <Foo b="/*2*/" /> ////const a3 = <Foo b="somethingelse"/*3*/ /> ////const a4 = <Foo b={"somethingelse"} /*4*/ /> ////const a5 = <Foo b={"somethingelse"} c={0} /*5*/ /> verify.completions({ marker: ["1", "2"], exact: ["somethingelse"] }); verify.completions({ marker: ["3", "4"], excludes: ['"somethingelse"'], }); verify.completions({ marker: ["5"], excludes: ["0", "1"], });
{ "end_byte": 620, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/stringLiteralCompletionsInJsxAttributeInitializer.ts" }
TypeScript/tests/cases/fourslash/isDefinitionSingleImport.ts_0_188
/// <reference path='fourslash.ts'/> // @filename: a.ts ////export function /*1*/f() {} // @filename: b.ts ////import { /*2*/f } from "./a"; verify.baselineFindAllReferences('1', '2');
{ "end_byte": 188, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/isDefinitionSingleImport.ts" }
TypeScript/tests/cases/fourslash/autoImportPaths.ts_0_568
/// <reference path="fourslash.ts" /> // @Filename: /package1/jsconfig.json //// { //// "compilerOptions": { //// checkJs: true, //// "paths": { //// "package1/*": ["./*"], //// "package2/*": ["../package2/*"] //// }, //// "baseUrl": "." //// }, //// "include": [ //// ".", //// "../package2" //// ] //// } // @Filename: /package1/file1.js //// bar/**/ // @Filename: /package2/file1.js //// export const bar = 0; verify.importFixModuleSpecifiers("", ["package2/file1"], { importModuleSpecifierPreference: "shortest" });
{ "end_byte": 568, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportPaths.ts" }
TypeScript/tests/cases/fourslash/quickInfoDisplayPartsInternalModuleAlias.ts_0_386
/// <reference path='fourslash.ts'/> ////module m.m1 { //// export class c { //// } ////} ////module m2 { //// import /*1*/a1 = m; //// new /*2*/a1.m1.c(); //// import /*3*/a2 = m.m1; //// new /*4*/a2.c(); //// export import /*5*/a3 = m; //// new /*6*/a3.m1.c(); //// export import /*7*/a4 = m.m1; //// new /*8*/a4.c(); ////} verify.baselineQuickInfo();
{ "end_byte": 386, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoDisplayPartsInternalModuleAlias.ts" }
TypeScript/tests/cases/fourslash/quickInfoOnUnResolvedBaseConstructorSignature.ts_0_487
/// <reference path='fourslash.ts'/> ////class baseClassWithConstructorParameterSpecifyingType { //// constructor(loading?: boolean) { //// } ////} ////class genericBaseClassInheritingConstructorFromBase<TValue> extends baseClassWithConstructorParameterSpecifyingType { ////} ////class classInheritingSpecializedClass extends genericBaseClassInheritingConstructorFromBase<string> { ////} ////new class/*1*/InheritingSpecializedClass(); goTo.marker('1'); verify.quickInfoExists();
{ "end_byte": 487, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnUnResolvedBaseConstructorSignature.ts" }
TypeScript/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace3.ts_0_156
/// <reference path="fourslash.ts"/> ////foo( //// 1, /* comment */ ); format.document(); verify.currentFileContentIs(`foo( 1, /* comment */);`);
{ "end_byte": 156, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace3.ts" }
TypeScript/tests/cases/fourslash/thisPredicateFunctionQuickInfo01.ts_0_1694
/// <reference path="fourslash.ts" /> //// class FileSystemObject { //// /*1*/isFile(): this is Item { //// return this instanceof Item; //// } //// /*2*/isDirectory(): this is Directory { //// return this instanceof Directory; //// } //// /*3*/isNetworked(): this is (Networked & this) { //// return !!(this as Networked).host; //// } //// constructor(public path: string) {} //// } //// //// class Item extends FileSystemObject { //// constructor(path: string, public content: string) { super(path); } //// } //// class Directory extends FileSystemObject { //// children: FileSystemObject[]; //// } //// interface Networked { //// host: string; //// } //// //// const obj: FileSystemObject = new Item("/foo", ""); //// if (obj.isFile/*4*/()) { //// obj.; //// if (obj.isNetworked/*5*/()) { //// obj.; //// } //// } //// if (obj.isDirectory/*6*/()) { //// obj.; //// if (obj.isNetworked/*7*/()) { //// obj.; //// } //// } //// if (obj.isNetworked/*8*/()) { //// obj.; //// } verify.quickInfos({ 1: "(method) FileSystemObject.isFile(): this is Item", 2: "(method) FileSystemObject.isDirectory(): this is Directory", 3: "(method) FileSystemObject.isNetworked(): this is (Networked & this)", 4: "(method) FileSystemObject.isFile(): this is Item", 5: "(method) FileSystemObject.isNetworked(): this is (Networked & Item)", 6: "(method) FileSystemObject.isDirectory(): this is Directory", 7: "(method) FileSystemObject.isNetworked(): this is (Networked & Directory)", 8: "(method) FileSystemObject.isNetworked(): this is (Networked & FileSystemObject)" });
{ "end_byte": 1694, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/thisPredicateFunctionQuickInfo01.ts" }
TypeScript/tests/cases/fourslash/completionsRecommended_union.ts_0_558
/// <reference path="fourslash.ts" /> // @strictNullChecks: true ////const enum E { A = "A", B = "B" } ////const enum E2 { X = "X", Y = "Y" } ////const e: E | undefined = /*a*/ ////const e2: E | E2 = /*b*/ verify.completions( { marker: "a", includes: { name: "E", isRecommended: true }, isNewIdentifierLocation: true, }, { marker: "b", // Arbitrarily chooses one to be recommended includes: [{ name: "E", isRecommended: true, }, { name: "E2" }], isNewIdentifierLocation: true, }, );
{ "end_byte": 558, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsRecommended_union.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType6.ts_0_316
/// <reference path='fourslash.ts' /> //// var x: 1 | /*a*/2/*b*/ = 1; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = 2; var x: 1 | NewType = 1;`, });
{ "end_byte": 316, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType6.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceCallSignature.ts_0_174
/// <reference path='fourslash.ts' /> //// interface I { //// (x: number, b: string): number; //// } //// class C implements I {[| |]} verify.not.codeFixAvailable();
{ "end_byte": 174, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceCallSignature.ts" }
TypeScript/tests/cases/fourslash/findAllRefsOfConstructor_multipleFiles.ts_0_498
/// <reference path="fourslash.ts" /> // @Filename: f.ts ////class A { //// /*aCtr*/constructor(s: string) {} ////} ////class B extends A { } ////export { A, B }; // @Filename: a.ts ////import { A as A1 } from "./f"; ////const a1 = new A1("a1"); ////export default class extends A1 { } ////export { B as B1 } from "./f"; // @Filename: b.ts ////import B, { B1 } from "./a"; ////const d = new B("b"); ////const d1 = new B1("b1"); verify.noErrors(); verify.baselineFindAllReferences('aCtr')
{ "end_byte": 498, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsOfConstructor_multipleFiles.ts" }
TypeScript/tests/cases/fourslash/quickInfoForConstDeclaration.ts_0_100
/// <reference path='fourslash.ts' /> ////const /**/c = 0 ; verify.quickInfoAt("", "const c: 0");
{ "end_byte": 100, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoForConstDeclaration.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFix_typeOnly.ts_0_277
/// <reference path="fourslash.ts" /> // @module: esnext // @verbatimModuleSyntax: true // @Filename: types.ts ////export class A {} // @Filename: index.ts ////const a: /**/A goTo.marker(""); verify.importFixAtPosition([ `import type { A } from "./types"; const a: A` ]);
{ "end_byte": 277, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_typeOnly.ts" }
TypeScript/tests/cases/fourslash/findAllRefsWriteAccess.ts_0_299
/// <reference path='fourslash.ts' /> ////interface Obj { //// [`/*1*/num`]: number; ////} //// ////let o: Obj = { //// [`num`]: 0 ////}; //// ////o = { //// ['num']: 1 ////}; //// ////o['num'] = 2; ////o[`num`] = 3; //// ////o['num']; ////o[`num`]; verify.baselineFindAllReferences('1')
{ "end_byte": 299, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsWriteAccess.ts" }
TypeScript/tests/cases/fourslash/interfaceIndent.ts_0_164
/// <reference path="fourslash.ts"/> //// goTo.bof(); edit.insert("interface Person {\n"); // indentation on newline after "interface {" verify.indentationIs(4);
{ "end_byte": 164, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/interfaceIndent.ts" }
TypeScript/tests/cases/fourslash/getImportsJSXFactory.ts_0_3326
///<reference path="fourslash.ts"/> // @strict: true // @jsx: react-jsx // @jsxImportSource: preact // @filename: /node_modules/preact/index.d.ts //// type Defaultize<Props, Defaults> = //// // Distribute over unions //// Props extends any // Make any properties included in Default optional //// ? Partial<Pick<Props, Extract<keyof Props, keyof Defaults>>> & //// // Include the remaining properties from Props //// Pick<Props, Exclude<keyof Props, keyof Defaults>> //// : never; //// export namespace JSXInternal { //// interface HTMLAttributes<T = {}> { } //// interface SVGAttributes<T = {}> { } //// type LibraryManagedAttributes<Component, Props> = Component extends { //// defaultProps: infer Defaults; //// } //// ? Defaultize<Props, Defaults> //// : Props; //// //// interface IntrinsicAttributes { //// key?: any; //// } //// //// interface Element extends VNode<any> { } //// //// interface ElementClass extends Component<any, any> { } //// //// interface ElementAttributesProperty { //// props: any; //// } //// //// interface ElementChildrenAttribute { //// children: any; //// } //// //// interface IntrinsicElements { //// div: HTMLAttributes; //// } //// } //// export const Fragment: unique symbol; //// export type ComponentType<T = {}> = {}; //// export type ComponentChild = {}; //// export type ComponentChildren = {}; //// export type VNode<T = {}> = {}; //// export type Attributes = {}; //// export type Component<T = {}, U = {}> = {}; // @filename: /node_modules/preact/jsx-runtime/index.d.ts //// export { Fragment } from '..'; //// import { //// ComponentType, //// ComponentChild, //// ComponentChildren, //// VNode, //// Attributes //// } from '..'; //// import { JSXInternal } from '..'; //// //// export function jsx( //// type: string, //// props: JSXInternal.HTMLAttributes & //// JSXInternal.SVGAttributes & //// Record<string, any> & { children?: ComponentChild }, //// key?: string //// ): VNode<any>; //// export function jsx<P>( //// type: ComponentType<P>, //// props: Attributes & P & { children?: ComponentChild }, //// key?: string //// ): VNode<any>; //// //// //// export function jsxs( //// type: string, //// props: JSXInternal.HTMLAttributes & //// JSXInternal.SVGAttributes & //// Record<string, any> & { children?: ComponentChild[] }, //// key?: string //// ): VNode<any>; //// export function jsxs<P>( //// type: ComponentType<P>, //// props: Attributes & P & { children?: ComponentChild[] }, //// key?: string //// ): VNode<any>; //// //// //// export function jsxDEV( //// type: string, //// props: JSXInternal.HTMLAttributes & //// JSXInternal.SVGAttributes & //// Record<string, any> & { children?: ComponentChildren }, //// key?: string //// ): VNode<any>; //// export function jsxDEV<P>( //// type: ComponentType<P>, //// props: Attributes & P & { children?: ComponentChildren }, //// key?: string //// ): VNode<any>; //// //// export import JSX = JSXInternal; //// // @filename: /index.tsx //// export const Comp = () => <div></div>; verify.noErrors() verify.getImports('/index.tsx', [])
{ "end_byte": 3326, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getImportsJSXFactory.ts" }