_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
TypeScript/tests/cases/fourslash/completionOfAwaitPromise2.ts_0_405
/// <reference path='fourslash.ts'/> //// interface Foo { foo: string } //// async function foo(x: Promise<Foo>) { //// [|x./**/|] //// } const replacementSpan = test.ranges()[0] verify.completions({ marker: "", includes: [ "then", { name: "foo", insertText: '(await x).foo', replacementSpan }, ], preferences: { includeInsertTextCompletions: true, }, });
{ "end_byte": 405, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionOfAwaitPromise2.ts" }
TypeScript/tests/cases/fourslash/codeFixMissingCallParentheses9.ts_0_656
/// <reference path='fourslash.ts'/> // @strictNullChecks: true ////function foo() { //// const x = { //// foo: { //// bar() { return true; } //// } //// } //// if (x.foo.bar/**/) { //// console.log('test') //// } ////} verify.codeFixAvailable([ { description: ts.Diagnostics.Add_missing_call_parentheses.message } ]); verify.codeFix({ description: ts.Diagnostics.Add_missing_call_parentheses.message, index: 0, newFileContent: `function foo() { const x = { foo: { bar() { return true; } } } if (x.foo.bar()) { console.log('test') } }`, });
{ "end_byte": 656, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingCallParentheses9.ts" }
TypeScript/tests/cases/fourslash/goToImplementationInterface_07.ts_0_1380
/// <reference path='fourslash.ts'/> // Should handle all the various type references //// interface Fo/*interface_definition*/o { //// hello (): void; //// } //// //// interface Bar { //// hello (): void; //// } //// //// let x1: Foo = [|{ hello () { /**typeReference*/ } }|]; //// let x2: () => Foo = [|(() => { hello () { /**functionType*/} })|]; //// let x3: Foo | Bar = [|{ hello () { /**unionType*/} }|]; //// let x4: Foo & (Foo & Bar) = [|{ hello () { /**intersectionType*/} }|]; //// let x5: [Foo] = [|[{ hello () { /**tupleType*/} }]|]; //// let x6: (Foo) = [|{ hello () { /**parenthesizedType*/} }|]; //// let x7: (new() => Foo) = [|class { hello () { /**constructorType*/} }|]; //// let x8: Foo[] = [|[{ hello () { /**arrayType*/} }]|]; //// let x9: { y: Foo } = [|{ y: { hello () { /**typeLiteral*/} } }|]; //// let x10 = [|{|"parts": ["(","anonymous local class",")"], "kind": "local class"|}class implements Foo { hello() {} }|] //// let x11 = class [|{|"parts": ["(","local class",")"," ","C"], "kind": "local class"|}C|] implements Foo { hello() {} } //// //// // Should not do anything for type predicates //// function isFoo(a: any): a is Foo { //// return true; //// } verify.baselineGoToImplementation("interface_definition");
{ "end_byte": 1380, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationInterface_07.ts" }
TypeScript/tests/cases/fourslash/semanticModernClassificationFunctions.ts_0_761
//// function foo(p1) { //// return foo(Math.abs(p1)) //// } //// `/${window.location}`.split("/").forEach(s => foo(s)); const c2 = classification("2020"); verify.semanticClassificationsAre("2020", c2.semanticToken("function.declaration", "foo"), c2.semanticToken("parameter.declaration", "p1"), c2.semanticToken("function", "foo"), c2.semanticToken("variable.defaultLibrary", "Math"), c2.semanticToken("member.defaultLibrary", "abs"), c2.semanticToken("parameter", "p1"), c2.semanticToken("member.defaultLibrary", "split"), c2.semanticToken("member.defaultLibrary", "forEach"), c2.semanticToken("parameter.declaration", "s"), c2.semanticToken("function", "foo"), c2.semanticToken("parameter", "s"), );;
{ "end_byte": 761, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/semanticModernClassificationFunctions.ts" }
TypeScript/tests/cases/fourslash/quickInfoJsdocEnum.ts_0_384
/// <reference path="./fourslash.ts"/> // @allowJs: true // @noLib: true // @Filename: /a.js /////** //// * Doc //// * @enum {number} //// */ ////const E = { //// A: 0, ////} //// /////** @type {/*type*/E} */ ////const x = /*value*/E.A; verify.noErrors(); verify.quickInfoAt("type", `type E = number`, "Doc"); verify.quickInfoAt("value", `const E: { A: number; }`, "Doc");
{ "end_byte": 384, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoJsdocEnum.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFix_jsCJSvsESM1.ts_0_383
/// <reference path="fourslash.ts" /> // @allowJs: true // @checkJs: true // @Filename: types/dep.d.ts //// export declare class Dep {} // @Filename: index.js //// Dep/**/ // @Filename: util.js //// import fs from 'fs'; // When current file has no imports/requires, look at other JS files goTo.marker(""); verify.importFixAtPosition([`import { Dep } from "./types/dep"; Dep`]);
{ "end_byte": 383, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_jsCJSvsESM1.ts" }
TypeScript/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateBinaryExprSingleQuote.ts_0_388
/// <reference path='fourslash.ts' /> //// const foo = '/*x*/f/*y*/oobar is ' + (42 + 6) + ' years old' goTo.select("x", "y"); edit.applyRefactor({ refactorName: "Convert to template string", actionName: "Convert to template string", actionDescription: ts.Diagnostics.Convert_to_template_string.message, newContent: `const foo = \`foobar is \${42 + 6} years old\``, });
{ "end_byte": 388, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateBinaryExprSingleQuote.ts" }
TypeScript/tests/cases/fourslash/importStatementCompletions1.ts_0_2593
/// <reference path="fourslash.ts" /> // @Filename: /mod.ts //// export const foo = 0; //// export type Foo = number; // @Filename: /index0.ts //// [|import f/*0*/|] // @Filename: /index1.ts //// [|import { f/*1*/}|] // @Filename: /index2.ts //// [|import * as f/*2*/|] // @Filename: /index3.ts //// [|import f/*3*/ from|] // @Filename: /index4.ts //// [|import f/*4*/ =|] // @Filename: /index5.ts //// [|import f/*5*/ from "";|] ([[0, true], [1, true], [2, false], [3, true], [4, true], [5, true]] as const).forEach(([marker, typeKeywordValid]) => { verify.completions({ isNewIdentifierLocation: true, marker: "" + marker, exact: [{ name: "foo", source: "./mod", insertText: `import { foo$1 } from "./mod";`, isSnippet: true, replacementSpan: test.ranges()[marker], sourceDisplay: "./mod", }, { name: "Foo", source: "./mod", insertText: `import { Foo$1 } from "./mod";`, isSnippet: true, replacementSpan: test.ranges()[marker], sourceDisplay: "./mod", }, ...typeKeywordValid ? [{ name: "type", sortText: completion.SortText.GlobalsOrKeywords, }] : []], preferences: { includeCompletionsForImportStatements: true, includeInsertTextCompletions: true, includeCompletionsWithSnippetText: true, } }); }); // @Filename: /index6.ts //// import f/*6*/ from "nope"; // @Filename: /index7.ts //// import { f/*7*/, bar } // @Filename: /index8.ts //// import foo, { f/*8*/ } // @Filename: /index9.ts //// import g/*9*/ // @Filename: /index10.ts //// import f/*10*/ from "./mod"; // @Filename: /index11.ts //// import oo/*11*/ // @Filename: /index12.ts //// import { //// /*12*/ //// } [6, 7, 8, 9, 10, 11, 12].forEach(marker => { verify.completions({ isNewIdentifierLocation: true, marker: "" + marker, exact: [{ name: "type", sortText: completion.SortText.GlobalsOrKeywords }], preferences: { includeCompletionsForImportStatements: true, includeInsertTextCompletions: true, } }); }); // @Filename: /index13.ts //// import {} /*13*/ // @Filename: /index14.ts //// import {} f/*14*/ // @Filename: /index15.ts //// import * as foo /*15*/ // @Filename: /index16.ts //// import * as foo f/*16*/ [13, 14, 15, 16].forEach(marker => { verify.completions({ marker: "" + marker, exact: { name: "from", sortText: completion.SortText.GlobalsOrKeywords, }, preferences: { includeCompletionsForImportStatements: true, includeInsertTextCompletions: true, } }); });
{ "end_byte": 2593, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importStatementCompletions1.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFix_jsx6.ts_0_900
/// <reference path="fourslash.ts" /> // @jsx: react // @module: esnext // @esModuleInterop: true // @moduleResolution: node // @Filename: /node_modules/react/index.d.ts ////export = React; ////export as namespace React; ////declare namespace React { //// class Component {} ////} // @Filename: /node_modules/react-native/index.d.ts ////import * as React from "react"; ////export class Text extends React.Component {}; // @Filename: /a.tsx ////<[|Text|]></Text>; goTo.file("/a.tsx"); verify.codeFix({ index: 0, description: [ts.Diagnostics.Add_import_from_0.message, "react-native"], applyChanges: false, newFileContent: `import { Text } from "react-native"; <Text></Text>;` }); verify.codeFix({ index: 1, description: [ts.Diagnostics.Import_0_from_1.message, "React", "react"], applyChanges: false, newFileContent: `import React from "react"; <Text></Text>;` });
{ "end_byte": 900, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_jsx6.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionUnionTypeProperty3.ts_0_272
/// <reference path='fourslash.ts' /> ////interface Array<T> { //// /*definition*/specialPop(): T ////} //// ////var strings: string[]; ////var numbers: number[]; //// ////var x = (strings || numbers).[|/*usage*/specialPop|]() verify.baselineGoToDefinition("usage");
{ "end_byte": 272, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionUnionTypeProperty3.ts" }
TypeScript/tests/cases/fourslash/formattingOnObjectLiteral.ts_0_2627
/// <reference path='fourslash.ts' /> ////var x = /*1*/{foo:/*2*/ 1, ////bar: "tt",/*3*/ ////boo: /*4*/1 + 5}/*5*/; //// ////var x2 = /*6*/{foo/*7*/: 1, ////bar: /*8*/"tt",boo:1+5}/*9*/; //// ////function Foo() {/*10*/ ////var typeICalc = {/*11*/ ////clear: {/*12*/ ////"()": [1, 2, 3]/*13*/ ////}/*14*/ ////}/*15*/ ////}/*16*/ //// ////// Rule for object literal members for the "value" of the memebr to follow the indent/*17*/ ////// of the member, i.e. the relative position of the value is maintained when the member/*18*/ ////// is indented./*19*/ ////var x2 = {/*20*/ //// foo:/*21*/ ////3,/*22*/ //// 'bar':/*23*/ //// { a: 1, b : 2}/*24*/ ////};/*25*/ //// ////var x={ };/*26*/ ////var y = {};/*27*/ format.document(); goTo.marker("1"); verify.currentLineContentIs("var x = {"); goTo.marker("2"); verify.currentLineContentIs(" foo: 1,"); goTo.marker("3"); verify.currentLineContentIs(" bar: \"tt\","); goTo.marker("4"); verify.currentLineContentIs(" boo: 1 + 5"); goTo.marker("5"); verify.currentLineContentIs("};"); goTo.marker("6"); verify.currentLineContentIs("var x2 = {"); goTo.marker("7"); verify.currentLineContentIs(" foo: 1,"); goTo.marker("8"); verify.currentLineContentIs(" bar: \"tt\", boo: 1 + 5"); goTo.marker("9"); verify.currentLineContentIs("};"); goTo.marker("10"); verify.currentLineContentIs("function Foo() {"); goTo.marker("11"); verify.currentLineContentIs(" var typeICalc = {"); goTo.marker("12"); verify.currentLineContentIs(" clear: {"); goTo.marker("13"); verify.currentLineContentIs(" \"()\": [1, 2, 3]"); goTo.marker("14"); verify.currentLineContentIs(" }"); goTo.marker("15"); verify.currentLineContentIs(" }"); goTo.marker("16"); verify.currentLineContentIs("}"); goTo.marker("17"); verify.currentLineContentIs("// Rule for object literal members for the \"value\" of the memebr to follow the indent"); goTo.marker("18"); verify.currentLineContentIs("// of the member, i.e. the relative position of the value is maintained when the member"); goTo.marker("19"); verify.currentLineContentIs("// is indented."); goTo.marker("20"); verify.currentLineContentIs("var x2 = {"); goTo.marker("21"); verify.currentLineContentIs(" foo:"); goTo.marker("22"); verify.currentLineContentIs(" 3,"); goTo.marker("23"); verify.currentLineContentIs(" 'bar':"); goTo.marker("24"); verify.currentLineContentIs(" { a: 1, b: 2 }"); goTo.marker("25"); verify.currentLineContentIs("};"); goTo.marker("26"); verify.currentLineContentIs("var x = {};"); goTo.marker("27"); verify.currentLineContentIs("var y = {};");
{ "end_byte": 2627, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingOnObjectLiteral.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFix_trailingComma.ts_0_412
/// <reference path="fourslash.ts" /> // Bug #40219 only happens when existing import specifiers are unsorted. // @Filename: index.ts //// import { //// T2, //// T1, //// } from "./types"; //// //// const x: T3/**/ // @Filename: types.ts //// export type T1 = 0; //// export type T2 = 0; //// export type T3 = 0; verify.importFixAtPosition([`import { T2, T1, T3, } from "./types"; const x: T3`]);
{ "end_byte": 412, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_trailingComma.ts" }
TypeScript/tests/cases/fourslash/importNameCodeFixExistingImport1.ts_0_253
/// <reference path="fourslash.ts" /> //// import d, [|{ v1 }|] from "./module"; //// f1/*0*/(); // @Filename: module.ts //// export function f1() {} //// export var v1 = 5; //// export default var d1 = 6; verify.importFixAtPosition([`{ f1, v1 }`]);
{ "end_byte": 253, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixExistingImport1.ts" }
TypeScript/tests/cases/fourslash/codeFixConvertToTypeOnlyImport2.ts_0_1011
/// <reference path="fourslash.ts" /> // @module: esnext // @verbatimModuleSyntax: true // @Filename: exports.ts ////export default class A {} ////export class B {} ////export class C {} // @Filename: imports.ts ////import A, { B, C } from './exports'; //// ////declare const a: A; ////declare const b: B; ////declare const c: C; ////console.log(a, b, c); goTo.file("imports.ts"); // This test previously showed that a codefix could be applied to turn // these imports, only used in type positions, into type-only imports. // The code fix was triggered by the error issued by // `--importsNotUsedAsValues error`, for which there is no analog in // the compiler after its removal. `verbatimModuleSyntax` does not // error here since the imported names are values, and so will not // crash at runtime. Users have replaced this error and codefix with // an eslint rule. We could consider bringing it back as a suggestion // diagnostic, a refactor, or an organizeImports feature. verify.not.codeFixAvailable();
{ "end_byte": 1011, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixConvertToTypeOnlyImport2.ts" }
TypeScript/tests/cases/fourslash/quickInfoOnMethodOfImportEquals.ts_0_356
/// <reference path="fourslash.ts" /> // Test for https://github.com/Microsoft/TypeScript/issues/15931 // @Filename: /a.d.ts ////declare class C<T> { //// m(): void; ////} ////export = C; // @Filename: /b.ts ////import C = require("./a"); ////declare var x: C<number>; ////x./**/m; verify.quickInfoAt("", "(method) C<number>.m(): void", undefined);
{ "end_byte": 356, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnMethodOfImportEquals.ts" }
TypeScript/tests/cases/fourslash/navigationItemsComputedProperties.ts_0_522
/// <reference path="fourslash.ts"/> // @noLib: true ////[|{| "name": "C", "kind": "class" |}class C { //// [|{| "name": "foo", "kind": "method", "containerName": "C", "containerKind": "class" |}foo() { }|] //// ["hi" + "bye"]() { } //// [|{| "name": "bar", "kind": "method", "containerName": "C", "containerKind": "class" |}bar() { }|] ////}|] for (const range of test.ranges()) { verify.navigateTo({ pattern: range.marker.data.name, expected: [{ ...range.marker.data, range }], }); }
{ "end_byte": 522, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationItemsComputedProperties.ts" }
TypeScript/tests/cases/fourslash/codeFixTopLevelAwait_module_targetES2017CompilerOptionsInTsConfig.ts_0_667
/// <reference path="fourslash.ts" /> // @filename: /dir/a.ts ////declare const p: Promise<number>; ////await p; ////export {}; // @filename: /dir/tsconfig.json ////{ //// "compilerOptions": { //// "target": "es2017" //// } ////} verify.not.codeFixAvailable("fixTargetOption"); verify.codeFixAvailable("fixModuleOption"); // verify.codeFix({ // description: [ts.Diagnostics.Set_the_module_option_in_your_configuration_file_to_0.message, "esnext"], // index: 0, // newFileContent: { // "/dir/tsconfig.json": // `{ // "compilerOptions": { // "target": "es2017", // "module": "esnext", // } // }` // } // });
{ "end_byte": 667, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixTopLevelAwait_module_targetES2017CompilerOptionsInTsConfig.ts" }
TypeScript/tests/cases/fourslash/renameInfoForFunctionExpression01.ts_0_158
/// <reference path='fourslash.ts'/> ////var x = function /**/[|f|](g: any, h: any) { //// f(f, g); ////} goTo.marker(); verify.renameInfoSucceeded("f");
{ "end_byte": 158, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameInfoForFunctionExpression01.ts" }
TypeScript/tests/cases/fourslash/commentsInheritanceFourslash.ts_0_4741
/// <reference path='fourslash.ts' /> /////** i1 is interface with properties*/ ////interface i1 { //// /** i1_p1*/ //// i1_p1: number; //// /** i1_f1*/ //// i1_f1(): void; //// /** i1_l1*/ //// i1_l1: () => void; //// i1_nc_p1: number; //// i1_nc_f1(): void; //// i1_nc_l1: () => void; //// p1: number; //// f1(): void; //// l1: () => void; //// nc_p1: number; //// nc_f1(): void; //// nc_l1: () => void; ////} ////class c1 implements i1 { //// public i1_p1: number; //// public i1_f1() { //// } //// public i1_l1: () => void; //// public i1_nc_p1: number; //// public i1_nc_f1() { //// } //// public i1_nc_l1: () => void; //// /** c1_p1*/ //// public p1: number; //// /** c1_f1*/ //// public f1() { //// } //// /** c1_l1*/ //// public l1: () => void; //// /** c1_nc_p1*/ //// public nc_p1: number; //// /** c1_nc_f1*/ //// public nc_f1() { //// } //// /** c1_nc_l1*/ //// public nc_l1: () => void; ////} ////var i1/*1iq*/_i: /*16i*/i1; ////i1_i./*1*/i/*2q*/1_f1(/*2*/); ////i1_i.i1_n/*3q*/c_f1(/*3*/); ////i1_i.f/*4q*/1(/*4*/); ////i1_i.nc/*5q*/_f1(/*5*/); ////i1_i.i1/*l2q*/_l1(/*l2*/); ////i1_i.i1_/*l3q*/nc_l1(/*l3*/); ////i1_i.l/*l4q*/1(/*l4*/); ////i1_i.nc/*l5q*/_l1(/*l5*/); ////var c1/*6iq*/_i = new c1(); ////c1_i./*6*/i1/*7q*/_f1(/*7*/); ////c1_i.i1_nc/*8q*/_f1(/*8*/); ////c1_i.f/*9q*/1(/*9*/); ////c1_i.nc/*10q*/_f1(/*10*/); ////c1_i.i1/*l7q*/_l1(/*l7*/); ////c1_i.i1_n/*l8q*/c_l1(/*l8*/); ////c1_i.l/*l9q*/1(/*l9*/); ////c1_i.nc/*l10q*/_l1(/*l10*/); ////// assign to interface ////i1_i = c1_i; ////i1_i./*11*/i1/*12q*/_f1(/*12*/); ////i1_i.i1_nc/*13q*/_f1(/*13*/); ////i1_i.f/*14q*/1(/*14*/); ////i1_i.nc/*15q*/_f1(/*15*/); ////i1_i.i1/*l12q*/_l1(/*l12*/); ////i1_i.i1/*l13q*/_nc_l1(/*l13*/); ////i1_i.l/*l14q*/1(/*l14*/); ////i1_i.nc/*l15q*/_l1(/*l15*/); /////*16*/ ////class c2 { //// /** c2 c2_p1*/ //// public c2_p1: number; //// /** c2 c2_f1*/ //// public c2_f1() { //// } //// /** c2 c2_prop*/ //// public get c2_prop() { //// return 10; //// } //// public c2_nc_p1: number; //// public c2_nc_f1() { //// } //// public get c2_nc_prop() { //// return 10; //// } //// /** c2 p1*/ //// public p1: number; //// /** c2 f1*/ //// public f1() { //// } //// /** c2 prop*/ //// public get prop() { //// return 10; //// } //// public nc_p1: number; //// public nc_f1() { //// } //// public get nc_prop() { //// return 10; //// } //// /** c2 constructor*/ //// constr/*55*/uctor(a: number) { //// this.c2_p1 = a; //// } ////} ////class c3 extends c2 { //// cons/*56*/tructor() { //// su/*18sq*/per(10); //// this.p1 = s/*18spropq*/uper./*18spropProp*/c2_p1; //// } //// /** c3 p1*/ //// public p1: number; //// /** c3 f1*/ //// public f1() { //// } //// /** c3 prop*/ //// public get prop() { //// return 10; //// } //// public nc_p1: number; //// public nc_f1() { //// } //// public get nc_prop() { //// return 10; //// } ////} ////var c/*17iq*/2_i = new c/*17q*/2(/*17*/10); ////var c/*18iq*/3_i = new c/*18q*/3(/*18*/); ////c2_i./*19*/c2/*20q*/_f1(/*20*/); ////c2_i.c2_nc/*21q*/_f1(/*21*/); ////c2_i.f/*22q*/1(/*22*/); ////c2_i.nc/*23q*/_f1(/*23*/); ////c3_i./*24*/c2/*25q*/_f1(/*25*/); ////c3_i.c2_nc/*26q*/_f1(/*26*/); ////c3_i.f/*27q*/1(/*27*/); ////c3_i.nc/*28q*/_f1(/*28*/); ////// assign ////c2_i = c3_i; ////c2_i./*29*/c2/*30q*/_f1(/*30*/); ////c2_i.c2_nc_/*31q*/f1(/*31*/); ////c2_i.f/*32q*/1(/*32*/); ////c2_i.nc/*33q*/_f1(/*33*/); ////class c4 extends c2 { ////} ////var c4/*34iq*/_i = new c/*34q*/4(/*34*/10); /////*35*/ ////interface i2 { //// /** i2_p1*/ //// i2_p1: number; //// /** i2_f1*/ //// i2_f1(): void; //// /** i2_l1*/ //// i2_l1: () => void; //// i2_nc_p1: number; //// i2_nc_f1(): void; //// i2_nc_l1: () => void; //// /** i2 p1*/ //// p1: number; //// /** i2 f1*/ //// f1(): void; //// /** i2 l1*/ //// l1: () => void; //// nc_p1: number; //// nc_f1(): void; //// nc_l1: () => void; ////} ////interface i3 extends i2 { //// /** i3 p1*/ //// p1: number; //// /** i3 f1*/ //// f1(): void; //// /** i3 l1*/ //// l1: () => void; //// nc_p1: number; //// nc_f1(): void; //// nc_l1: () => void; ////} ////var i2/*36iq*/_i: /*51i*/i2; ////var i3/*37iq*/_i: i3; ////i2_i./*36*/i2/*37q*/_f1(/*37*/); ////i2_i.i2_n/*38q*/c_f1(/*38*/); ////i2_i.f/*39q*/1(/*39*/); ////i2_i.nc/*40q*/_f1(/*40*/); ////i2_i.i2_/*l37q*/l1(/*l37*/); ////i2_i.i2_nc/*l38q*/_l1(/*l38*/); ////i2_i.l/*l39q*/1(/*l39*/); ////i2_i.nc_/*l40q*/l1(/*l40*/);
{ "end_byte": 4741, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/commentsInheritanceFourslash.ts" }
TypeScript/tests/cases/fourslash/commentsInheritanceFourslash.ts_4742_8832
////i3_i./*41*/i2_/*42q*/f1(/*42*/); ////i3_i.i2_nc/*43q*/_f1(/*43*/); ////i3_i.f/*44q*/1(/*44*/); ////i3_i.nc_/*45q*/f1(/*45*/); ////i3_i.i2_/*l42q*/l1(/*l42*/); ////i3_i.i2_nc/*l43q*/_l1(/*l43*/); ////i3_i.l/*l44q*/1(/*l44*/); ////i3_i.nc_/*l45q*/l1(/*l45*/); ////// assign to interface ////i2_i = i3_i; ////i2_i./*46*/i2/*47q*/_f1(/*47*/); ////i2_i.i2_nc_/*48q*/f1(/*48*/); ////i2_i.f/*49q*/1(/*49*/); ////i2_i.nc/*50q*/_f1(/*50*/); ////i2_i.i2_/*l47q*/l1(/*l47*/); ////i2_i.i2_nc/*l48q*/_l1(/*l48*/); ////i2_i.l/*l49q*/1(/*l49*/); ////i2_i.nc_/*l50q*/l1(/*l50*/); /////*51*/ /////**c5 class*/ ////class c5 { //// public b: number; ////} ////class c6 extends c5 { //// public d; //// const/*57*/ructor() { //// /*52*/super(); //// this.d = /*53*/super./*54*/b; //// } ////} verify.completions({ marker: ["1", "11"], includes: [ { name: "i1_p1", text: "(property) i1.i1_p1: number", documentation: "i1_p1" }, { name: "i1_f1", text: "(method) i1.i1_f1(): void", documentation: "i1_f1" }, { name: "i1_l1", text: "(property) i1.i1_l1: () => void", documentation: "i1_l1" }, { name: "i1_nc_p1", text: "(property) i1.i1_nc_p1: number" }, { name: "i1_nc_f1", text: "(method) i1.i1_nc_f1(): void" }, { name: "i1_nc_l1", text: "(property) i1.i1_nc_l1: () => void" }, { name: "p1", text: "(property) i1.p1: number" }, { name: "f1", text: "(method) i1.f1(): void" }, { name: "l1", text: "(property) i1.l1: () => void" }, { name: "nc_p1", text: "(property) i1.nc_p1: number" }, { name: "nc_f1", text: "(method) i1.nc_f1(): void" }, { name: "nc_l1", text: "(property) i1.nc_l1: () => void" }, ], }); verify.signatureHelp( { marker: "2", docComment: "i1_f1" }, { marker: ["3", "4", "5", "l2", "l3", "l4", "l5"], docComment: "" }, ); verify.quickInfos({ "1iq": "var i1_i: i1", "2q": ["(method) i1.i1_f1(): void", "i1_f1"], "3q": "(method) i1.i1_nc_f1(): void", "4q": "(method) i1.f1(): void", "5q": "(method) i1.nc_f1(): void", l2q: ["(property) i1.i1_l1: () => void", "i1_l1"], l3q: "(property) i1.i1_nc_l1: () => void", l4q: "(property) i1.l1: () => void", l5q: "(property) i1.nc_l1: () => void" }); verify.completions({ marker: "6", includes: [ { name: "i1_p1", text: "(property) c1.i1_p1: number", documentation: "i1_p1" }, { name: "i1_f1", text: "(method) c1.i1_f1(): void", documentation: "i1_f1" }, { name: "i1_l1", text: "(property) c1.i1_l1: () => void", documentation: "i1_l1" }, { name: "i1_nc_p1", text: "(property) c1.i1_nc_p1: number" }, { name: "i1_nc_f1", text: "(method) c1.i1_nc_f1(): void" }, { name: "i1_nc_l1", text: "(property) c1.i1_nc_l1: () => void" }, { name: "p1", text: "(property) c1.p1: number", documentation: "c1_p1" }, { name: "f1", text: "(method) c1.f1(): void", documentation: "c1_f1" }, { name: "l1", text: "(property) c1.l1: () => void", documentation: "c1_l1" }, { name: "nc_p1", text: "(property) c1.nc_p1: number", documentation: "c1_nc_p1" }, { name: "nc_f1", text: "(method) c1.nc_f1(): void", documentation: "c1_nc_f1" }, { name: "nc_l1", text: "(property) c1.nc_l1: () => void", documentation: "c1_nc_l1" }, ], }); verify.signatureHelp( { marker: "7", docComment: "i1_f1" }, { marker: "9", docComment: "c1_f1" }, { marker: "10", docComment: "c1_nc_f1" }, { marker: "l9", docComment: "c1_l1" }, { marker: "l10", docComment: "c1_nc_l1" }, { marker: ["8", "l7", "l8"], docComment: "" }, ); verify.quickInfos({ "6iq": "var c1_i: c1", "7q": ["(method) c1.i1_f1(): void", "i1_f1"], "8q": "(method) c1.i1_nc_f1(): void", "9q": ["(method) c1.f1(): void", "c1_f1"], "10q": ["(method) c1.nc_f1(): void", "c1_nc_f1"], l7q: ["(property) c1.i1_l1: () => void", "i1_l1"], l8q: "(property) c1.i1_nc_l1: () => void", l9q: ["(property) c1.l1: () => void", "c1_l1"], l10q: ["(property) c1.nc_l1: () => void", "c1_nc_l1"], });
{ "end_byte": 8832, "start_byte": 4742, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/commentsInheritanceFourslash.ts" }
TypeScript/tests/cases/fourslash/commentsInheritanceFourslash.ts_8834_14073
verify.completions({ marker: "11", includes: [ { name: "i1_p1", text: "(property) i1.i1_p1: number", documentation: "i1_p1" }, { name: "i1_f1", text: "(method) i1.i1_f1(): void", documentation: "i1_f1" }, { name: "i1_l1", text: "(property) i1.i1_l1: () => void", documentation: "i1_l1" }, { name: "i1_nc_p1", text: "(property) i1.i1_nc_p1: number" }, { name: "i1_nc_f1", text: "(method) i1.i1_nc_f1(): void" }, { name: "i1_nc_l1", text: "(property) i1.i1_nc_l1: () => void" }, { name: "p1", text: "(property) i1.p1: number" }, { name: "f1", text: "(method) i1.f1(): void" }, { name: "l1", text: "(property) i1.l1: () => void" }, { name: "nc_p1", text: "(property) i1.nc_p1: number" }, { name: "nc_f1", text: "(method) i1.nc_f1(): void" }, { name: "nc_l1", text: "(property) i1.nc_l1: () => void" }, ], }); verify.signatureHelp( { marker: "12", docComment: "i1_f1" }, { marker: ["13", "14", "15", "l12", "l13", "l14", "l15"], docComment: "" }, ); verify.quickInfos({ "12q": ["(method) i1.i1_f1(): void", "i1_f1"], "13q": "(method) i1.i1_nc_f1(): void", "14q": "(method) i1.f1(): void", "15q": "(method) i1.nc_f1(): void", l12q: ["(property) i1.i1_l1: () => void", "i1_l1"], l13q: "(property) i1.i1_nc_l1: () => void", l14q: "(property) i1.l1: () => void", l15q: "(property) i1.nc_l1: () => void", }); verify.completions( { marker: "16", includes: [ { name: "i1_i", text: "var i1_i: i1" }, { name: "c1", text: "class c1" }, { name: "c1_i", text: "var c1_i: c1" }, ], excludes: "i1", }, { marker: "16i", includes: { name: "i1", text: "interface i1", documentation: "i1 is interface with properties" }, }, ); verify.quickInfos({ "17iq": "var c2_i: c2", "18iq": "var c3_i: c3" }); verify.signatureHelp( { marker: "17", docComment: "c2 constructor" }, { marker: "18", docComment: "" }, ); verify.quickInfos({ "18sq": ["constructor c2(a: number): c2", "c2 constructor"], "18spropq": "class c2", "18spropProp": ["(property) c2.c2_p1: number", "c2 c2_p1"], "17q": ["constructor c2(a: number): c2", "c2 constructor"], "18q": "constructor c3(): c3" }); verify.completions({ marker: ["19", "29"], includes: [ { name: "c2_p1", text: "(property) c2.c2_p1: number", documentation: "c2 c2_p1" }, { name: "c2_f1", text: "(method) c2.c2_f1(): void", documentation: "c2 c2_f1" }, { name: "c2_prop", text: "(property) c2.c2_prop: number", documentation: "c2 c2_prop" }, { name: "c2_nc_p1", text: "(property) c2.c2_nc_p1: number" }, { name: "c2_nc_f1", text: "(method) c2.c2_nc_f1(): void" }, { name: "c2_nc_prop", text: "(property) c2.c2_nc_prop: number" }, { name: "p1", text: "(property) c2.p1: number", documentation: "c2 p1" }, { name: "f1", text: "(method) c2.f1(): void", documentation: "c2 f1" }, { name: "prop", text: "(property) c2.prop: number", documentation: "c2 prop" }, { name: "nc_p1", text: "(property) c2.nc_p1: number" }, { name: "nc_f1", text: "(method) c2.nc_f1(): void" }, { name: "nc_prop", text: "(property) c2.nc_prop: number" }, ], }); verify.signatureHelp( { marker: "20", docComment: "c2 c2_f1" }, { marker: "22", docComment: "c2 f1" }, { marker: ["21", "23"], docComment: "" }, ); verify.quickInfos({ "20q": ["(method) c2.c2_f1(): void", "c2 c2_f1"], "21q": "(method) c2.c2_nc_f1(): void", "22q": ["(method) c2.f1(): void", "c2 f1"], "23q": "(method) c2.nc_f1(): void" }); verify.completions({ marker: "24", includes: [ { name: "c2_p1", text: "(property) c2.c2_p1: number", documentation: "c2 c2_p1" }, { name: "c2_f1", text: "(method) c2.c2_f1(): void", documentation: "c2 c2_f1" }, { name: "c2_prop", text: "(property) c2.c2_prop: number", documentation: "c2 c2_prop" }, { name: "c2_nc_p1", text: "(property) c2.c2_nc_p1: number" }, { name: "c2_nc_f1", text: "(method) c2.c2_nc_f1(): void" }, { name: "c2_nc_prop", text: "(property) c2.c2_nc_prop: number" }, { name: "p1", text: "(property) c3.p1: number", documentation: "c3 p1" }, { name: "f1", text: "(method) c3.f1(): void", documentation: "c3 f1" }, { name: "prop", text: "(property) c3.prop: number", documentation: "c3 prop" }, { name: "nc_p1", text: "(property) c3.nc_p1: number" }, { name: "nc_f1", text: "(method) c3.nc_f1(): void" }, { name: "nc_prop", text: "(property) c3.nc_prop: number" }, ], }); verify.signatureHelp( { marker: "25", docComment: "c2 c2_f1" }, { marker: "27", docComment: "c3 f1" }, { marker: ["26", "28"], docComment: "" }, ); verify.quickInfos({ "25q": ["(method) c2.c2_f1(): void", "c2 c2_f1"], "26q": "(method) c2.c2_nc_f1(): void", "27q": ["(method) c3.f1(): void", "c3 f1"], "28q": "(method) c3.nc_f1(): void" }); verify.signatureHelp( { marker: "30", docComment: "c2 c2_f1" }, { marker: "32", docComment: "c2 f1" }, { marker: ["31", "33"], docComment: "" }, );
{ "end_byte": 14073, "start_byte": 8834, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/commentsInheritanceFourslash.ts" }
TypeScript/tests/cases/fourslash/commentsInheritanceFourslash.ts_14075_19298
verify.quickInfos({ "30q": ["(method) c2.c2_f1(): void", "c2 c2_f1"], "31q": "(method) c2.c2_nc_f1(): void", "32q": ["(method) c2.f1(): void", "c2 f1"], "33q": "(method) c2.nc_f1(): void" }); verify.signatureHelp({ marker: "34", docComment: "c2 constructor" }); verify.quickInfos({ "34iq": "var c4_i: c4", "34q": ["constructor c4(a: number): c4", "c2 constructor"] }); verify.completions( { marker: "35", includes: [ { name: "c2", text: "class c2" }, { name: "c2_i", text: "var c2_i: c2" }, { name: "c3", text: "class c3" }, { name: "c3_i", text: "var c3_i: c3" }, { name: "c4", text: "class c4" }, { name: "c4_i", text: "var c4_i: c4" }, ], }, { marker: ["36", "46"], includes: [ { name: "i2_p1", text: "(property) i2.i2_p1: number", documentation: "i2_p1" }, { name: "i2_f1", text: "(method) i2.i2_f1(): void", documentation: "i2_f1" }, { name: "i2_l1", text: "(property) i2.i2_l1: () => void", documentation: "i2_l1" }, { name: "i2_nc_p1", text: "(property) i2.i2_nc_p1: number" }, { name: "i2_nc_f1", text: "(method) i2.i2_nc_f1(): void" }, { name: "i2_nc_l1", text: "(property) i2.i2_nc_l1: () => void" }, { name: "p1", text: "(property) i2.p1: number", documentation: "i2 p1" }, { name: "f1", text: "(method) i2.f1(): void", documentation: "i2 f1" }, { name: "l1", text: "(property) i2.l1: () => void", documentation: "i2 l1" }, { name: "nc_p1", text: "(property) i2.nc_p1: number" }, { name: "nc_f1", text: "(method) i2.nc_f1(): void" }, { name: "nc_l1", text: "(property) i2.nc_l1: () => void" }, ], }, ); verify.signatureHelp( { marker: "37", docComment: "i2_f1" }, { marker: "39", docComment: "i2 f1" }, { marker: ["38", "40", "l37", "l37", "l39", "l40"], docComment: "" }, ); verify.quickInfos({ "36iq": "var i2_i: i2", "37iq": "var i3_i: i3", "37q": ["(method) i2.i2_f1(): void", "i2_f1"], "38q": "(method) i2.i2_nc_f1(): void", "39q": ["(method) i2.f1(): void", "i2 f1"], "40q": "(method) i2.nc_f1(): void", "l37q": ["(property) i2.i2_l1: () => void", "i2_l1"], "l38q": "(property) i2.i2_nc_l1: () => void", "l39q": ["(property) i2.l1: () => void", "i2 l1"], "l40q": "(property) i2.nc_l1: () => void", }); verify.completions({ marker: "41", includes: [ { name: "i2_p1", text: "(property) i2.i2_p1: number", documentation: "i2_p1" }, { name: "i2_f1", text: "(method) i2.i2_f1(): void", documentation: "i2_f1" }, { name: "i2_l1", text: "(property) i2.i2_l1: () => void", documentation: "i2_l1" }, { name: "i2_nc_p1", text: "(property) i2.i2_nc_p1: number" }, { name: "i2_nc_f1", text: "(method) i2.i2_nc_f1(): void" }, { name: "i2_nc_l1", text: "(property) i2.i2_nc_l1: () => void" }, { name: "p1", text: "(property) i3.p1: number", documentation: "i3 p1" }, { name: "f1", text: "(method) i3.f1(): void", documentation: "i3 f1" }, { name: "l1", text: "(property) i3.l1: () => void", documentation: "i3 l1" }, { name: "nc_p1", text: "(property) i3.nc_p1: number" }, { name: "nc_f1", text: "(method) i3.nc_f1(): void" }, { name: "nc_l1", text: "(property) i3.nc_l1: () => void" }, ], }); verify.signatureHelp( { marker: "42", docComment: "i2_f1" }, { marker: "44", docComment: "i3 f1" }, { marker: ["43", "45", "l42", "l43", "l44", "l45"], docComment: "" }, ); verify.quickInfos({ "42q": ["(method) i2.i2_f1(): void", "i2_f1"], "43q": "(method) i2.i2_nc_f1(): void", "44q": ["(method) i3.f1(): void", "i3 f1"], "45q": "(method) i3.nc_f1(): void", l42q: ["(property) i2.i2_l1: () => void", "i2_l1"], l43q: "(property) i2.i2_nc_l1: () => void", l44q: ["(property) i3.l1: () => void", "i3 l1"], l45q: "(property) i3.nc_l1: () => void" }); verify.completions({ marker: "46", includes: [ { name: "i2_p1", text: "(property) i2.i2_p1: number", documentation: "i2_p1" }, { name: "i2_f1", text: "(method) i2.i2_f1(): void", documentation: "i2_f1" }, { name: "i2_l1", text: "(property) i2.i2_l1: () => void", documentation: "i2_l1" }, { name: "i2_nc_p1", text: "(property) i2.i2_nc_p1: number" }, { name: "i2_nc_f1", text: "(method) i2.i2_nc_f1(): void" }, { name: "i2_nc_l1", text: "(property) i2.i2_nc_l1: () => void" }, { name: "p1", text: "(property) i2.p1: number", documentation: "i2 p1" }, { name: "f1", text: "(method) i2.f1(): void", documentation: "i2 f1" }, { name: "l1", text: "(property) i2.l1: () => void", documentation: "i2 l1" }, { name: "nc_p1", text: "(property) i2.nc_p1: number" }, { name: "nc_f1", text: "(method) i2.nc_f1(): void" }, { name: "nc_l1", text: "(property) i2.nc_l1: () => void" }, ], }); verify.signatureHelp( { marker: "47", docComment: "i2_f1" }, { marker: "49", docComment: "i2 f1" }, { marker: ["48", "l47", "l48", "l49", "l50"], docComment: "" }, );
{ "end_byte": 19298, "start_byte": 14075, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/commentsInheritanceFourslash.ts" }
TypeScript/tests/cases/fourslash/commentsInheritanceFourslash.ts_19300_20363
verify.quickInfos({ "47q": ["(method) i2.i2_f1(): void", "i2_f1"], "48q": "(method) i2.i2_nc_f1(): void", "49q": ["(method) i2.f1(): void", "i2 f1"], "50q": "(method) i2.nc_f1(): void", l47q: ["(property) i2.i2_l1: () => void", "i2_l1"], l48q: "(property) i2.i2_nc_l1: () => void", l49q: ["(property) i2.l1: () => void", "i2 l1"], l40q: "(property) i2.nc_l1: () => void" }); verify.completions( { marker: "51", includes: [ { name: "i2_i", text: "var i2_i: i2" }, { name: "i3_i", text: "var i3_i: i3" }, ], excludes: ["i2", "i3"], }, { marker: "51i", includes: [ { name: "i2", text: "interface i2" }, { name: "i3", text: "interface i3" }, ], }, ); verify.quickInfos({ 52: ["constructor c5(): c5", "c5 class"], 53: ["class c5", "c5 class"], 54: "(property) c5.b: number", 55: ["constructor c2(a: number): c2", "c2 constructor"], 56: "constructor c3(): c3", 57: "constructor c6(): c6" });
{ "end_byte": 20363, "start_byte": 19300, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/commentsInheritanceFourslash.ts" }
TypeScript/tests/cases/fourslash/navigationBarItemsSymbols3.ts_0_591
/// <reference path="fourslash.ts"/> ////enum E { //// // No nav bar entry for this //// [Symbol.isRegExp] = 0 ////} verify.navigationTree({ "text": "<global>", "kind": "script", "childItems": [ { "text": "E", "kind": "enum" } ] }); verify.navigationBar([ { "text": "<global>", "kind": "script", "childItems": [ { "text": "E", "kind": "enum" } ] }, { "text": "E", "kind": "enum", "indent": 1 } ]);
{ "end_byte": 591, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsSymbols3.ts" }
TypeScript/tests/cases/fourslash/smartIndentEnum.ts_0_341
/// <reference path='fourslash.ts'/> ////enum Foo3 { //// {| "indentation": 4|} //// val1, //// {| "indentation": 4|} //// val2, //// {| "indentation": 4|} ////} ////{| "indentation": 0|} test.markers().forEach((marker) => { verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); });
{ "end_byte": 341, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentEnum.ts" }
TypeScript/tests/cases/fourslash/findAllRefsWithShorthandPropertyAssignment.ts_0_222
/// <reference path='fourslash.ts'/> //// var /*0*/name = "Foo"; //// //// var obj = { /*1*/name }; //// var obj1 = { /*2*/name: /*3*/name }; //// obj./*4*/name; verify.baselineFindAllReferences('0', '3', '1', '2', '4')
{ "end_byte": 222, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsWithShorthandPropertyAssignment.ts" }
TypeScript/tests/cases/fourslash/navigationItemsOverloads2.ts_0_533
/// <reference path="fourslash.ts"/> ////interface I { //// [|interfaceMethodSignature(a: string): boolean;|] //// interfaceMethodSignature(b: number): boolean; //// interfaceMethodSignature(f: I): boolean; ////} ////interface I { //// [|interfaceMethodSignature(b: boolean): boolean;|] ////} verify.navigateTo({ pattern: "interfaceMethodSignature", expected: test.ranges().map(range => ({ name: "interfaceMethodSignature", kind: "method", range, containerName: "I", containerKind: "interface" })), });
{ "end_byte": 533, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationItemsOverloads2.ts" }
TypeScript/tests/cases/fourslash/semanticModernClassificationCallableVariables2.ts_0_1156
//// import "node"; //// var fs = require("fs") //// require.resolve('react'); //// require.resolve.paths; //// interface LanguageMode { getFoldingRanges?: (d: string) => number[]; }; //// function (mode: LanguageMode | undefined) { if (mode && mode.getFoldingRanges) { return mode.getFoldingRanges('a'); }}; //// function b(a: () => void) { a(); }; const c2 = classification("2020"); verify.semanticClassificationsAre("2020", c2.semanticToken("variable.declaration", "fs"), c2.semanticToken("interface.declaration", "LanguageMode"), c2.semanticToken("member.declaration", "getFoldingRanges"), c2.semanticToken("parameter.declaration", "d"), c2.semanticToken("parameter.declaration", "mode"), c2.semanticToken("interface", "LanguageMode"), c2.semanticToken("parameter", "mode"), c2.semanticToken("parameter", "mode"), c2.semanticToken("member", "getFoldingRanges"), c2.semanticToken("parameter", "mode"), c2.semanticToken("member", "getFoldingRanges"), c2.semanticToken("function.declaration", "b"), c2.semanticToken("function.declaration", "a"), c2.semanticToken("function", "a"), );;
{ "end_byte": 1156, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/semanticModernClassificationCallableVariables2.ts" }
TypeScript/tests/cases/fourslash/codeFixClassImplementDeepInheritance.ts_0_1795
/// <reference path='fourslash.ts' /> ////// Referenced throughout the inheritance chain. ////interface I0 { a: number } //// ////class C1 implements I0 { a: number } ////interface I1 { b: number } ////interface I2 extends C1, I1 {} //// ////class C2 { c: number } ////interface I3 {d: number} ////class C3 extends C2 implements I0, I2, I3 { //// a: number; //// b: number; //// d: number; ////} //// ////interface I4 { e: number } ////interface I5 { f: number } ////class C4 extends C3 implements I0, I4, I5 { //// e: number; //// f: number; ////} //// ////interface I6 extends C4 {} ////class C5 implements I6 {} /** * We want to check whether the search for member to replace actually searches through * the various possible paths of the inheritance chain correctly, and that We * don't issue duplicates for the same member. * * Our class DAG: * * C5 * |-I6 * |-C4 * |-I4 * |-I5 * |------------------------ I0 * |-C3 * |-I2 * |-I1 * |-C1 * |-------------------I0 * |-I3 * |-----------------------I0 * |-C2 */ verify.codeFix({ description: "Implement interface 'I6'", newFileContent: `// Referenced throughout the inheritance chain. interface I0 { a: number } class C1 implements I0 { a: number } interface I1 { b: number } interface I2 extends C1, I1 {} class C2 { c: number } interface I3 {d: number} class C3 extends C2 implements I0, I2, I3 { a: number; b: number; d: number; } interface I4 { e: number } interface I5 { f: number } class C4 extends C3 implements I0, I4, I5 { e: number; f: number; } interface I6 extends C4 {} class C5 implements I6 { e: number; f: number; a: number; b: number; d: number; c: number; }`, });
{ "end_byte": 1795, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementDeepInheritance.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingParam10.ts_0_306
/// <reference path="fourslash.ts" /> ////[|function f() {}|] //// ////const a = 1; ////const b = ""; ////f(a, b, true); verify.codeFix({ description: [ts.Diagnostics.Add_missing_parameters_to_0.message, "f"], index: 0, newRangeContent: "function f(a: number, b: string, p0: boolean) {}" });
{ "end_byte": 306, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingParam10.ts" }
TypeScript/tests/cases/fourslash/docCommentTemplateObjectLiteralMethods01.ts_0_776
/// <reference path='fourslash.ts' /> const multiLineOffset = 11; ////var x = { //// /*0*/ //// foo() { //// return undefined; //// } //// //// /*1*/ //// [1 + 2 + 3 + Math.rand()](x: number, y: string, z = true) { } //// //// /*2*/ //// m1: function(a) {} //// //// /*3*/ //// m2: (a: string, b: string) => {} ////} verify.docCommentTemplateAt("0", multiLineOffset, `/** * * @returns */`); verify.docCommentTemplateAt("1", multiLineOffset, `/** * * @param x * @param y * @param z */`); verify.docCommentTemplateAt("2", multiLineOffset, `/** * * @param a */`); verify.docCommentTemplateAt("3", multiLineOffset, `/** * * @param a * @param b */`);
{ "end_byte": 776, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateObjectLiteralMethods01.ts" }
TypeScript/tests/cases/fourslash/navigationBarItemsItems2.ts_0_1033
/// <reference path="fourslash.ts"/> /////**/ goTo.marker(); edit.insertLine("module A"); edit.insert("export class "); verify.navigationTree({ "text": "\"navigationBarItemsItems2\"", "kind": "module", "childItems": [ { "text": "<class>", "kind": "class", "kindModifiers": "export" }, { "text": "A", "kind": "module" } ] }); // should not crash verify.navigationBar([ { "text": "\"navigationBarItemsItems2\"", "kind": "module", "childItems": [ { "text": "<class>", "kind": "class", "kindModifiers": "export" }, { "text": "A", "kind": "module" } ] }, { "text": "<class>", "kind": "class", "kindModifiers": "export", "indent": 1 }, { "text": "A", "kind": "module", "indent": 1 } ]);
{ "end_byte": 1033, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsItems2.ts" }
TypeScript/tests/cases/fourslash/autoImportBundlerBlockRelativeNodeModulesPaths.ts_0_701
/// <reference path="fourslash.ts" /> // @module: esnext // @moduleResolution: bundler // @Filename: /node_modules/dep/package.json //// { //// "name": "dep", //// "version": "1.0.0", //// "exports": "./dist/index.js" //// } // @Filename: /node_modules/dep/dist/utils.d.ts //// export const util: () => void; // @Filename: /node_modules/dep/dist/index.d.ts //// export * from "./utils"; // @Filename: /index.ts //// util/**/ // Ensures we filter out the relative path through node_modules // for the non-reexport source, which can only be accessed // directly with the relative path since it's blocked by the // package.json "exports" field. verify.importFixModuleSpecifiers("", ["dep"]);
{ "end_byte": 701, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportBundlerBlockRelativeNodeModulesPaths.ts" }
TypeScript/tests/cases/fourslash/outliningSpansForParenthesizedExpression.ts_0_460
/// <reference path="fourslash.ts"/> ////const a = [|( //// true //// ? true //// : false //// ? true //// : false ////)|]; //// ////const b = ( 1 ); //// ////const c = [|( //// 1 ////)|]; //// ////( 1 ); //// ////[|( //// [|( //// [|( //// 1 //// )|] //// )|] ////)|]; //// ////[|( //// [|( //// ( 1 ) //// )|] ////)|]; verify.outliningSpansInCurrentFile(test.ranges());
{ "end_byte": 460, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/outliningSpansForParenthesizedExpression.ts" }
TypeScript/tests/cases/fourslash/codeFixPropertyOverrideAccess.ts_0_452
/// <reference path='fourslash.ts' /> // @strict: true //// class A { //// get x() { return 1 } //// } //// class B extends A { //// x = 2 //// } verify.codeFix({ description: `Generate 'get' and 'set' accessors`, newFileContent: `class A { get x() { return 1 } } class B extends A { private _x = 2 public get x() { return this._x } public set x(value) { this._x = value } }`, index: 0 })
{ "end_byte": 452, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixPropertyOverrideAccess.ts" }
TypeScript/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules3.ts_0_3827
/// <reference path="fourslash.ts" /> // @module: commonjs // @Filename: /node_modules/@types/node/index.d.ts //// declare module "path" { function join(...segments: readonly string[]): string; } //// declare module "node:path" { export * from "path"; } //// declare module "fs" { function writeFile(): void } //// declare module "fs/promises" { function writeFile(): Promise<void> } //// declare module "node:fs" { export * from "fs"; } //// declare module "node:fs/promises" { export * from "fs/promises"; } // @Filename: /other.ts //// import "node:fs/promises"; // @Filename: /noPrefix.ts //// import "path"; //// write/*noPrefix*/ // @Filename: /prefix.ts //// import "node:path"; //// write/*prefix*/ // @Filename: /mixed1.ts //// import "path"; //// import "node:path"; //// write/*mixed1*/ // @Filename: /mixed2.ts //// import "node:path"; //// import "path"; //// write/*mixed2*/ // @Filename: /test1.ts //// import "node:test"; //// import "path"; //// writeFile/*test1*/ // @Filename: /test2.ts //// import "node:test"; //// writeFile/*test2*/ verify.completions({ marker: "noPrefix", exact: completion.globalsPlus([{ name: "writeFile", source: "fs", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, { name: "writeFile", source: "fs/promises", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }]), preferences: { includeCompletionsForModuleExports: true, }, }); verify.completions({ marker: "prefix", exact: completion.globalsPlus([{ name: "writeFile", source: "node:fs", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, { name: "writeFile", source: "node:fs/promises", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }]), preferences: { includeCompletionsForModuleExports: true, }, }); // Prefixed imports take precedence over non-prefixed imports when mixed verify.completions({ marker: "mixed1", exact: completion.globalsPlus([{ name: "writeFile", source: "node:fs", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, { name: "writeFile", source: "node:fs/promises", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }]), preferences: { includeCompletionsForModuleExports: true, }, }); verify.completions({ marker: "mixed2", exact: completion.globalsPlus([{ name: "writeFile", source: "node:fs", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, { name: "writeFile", source: "node:fs/promises", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }]), preferences: { includeCompletionsForModuleExports: true, }, }); // Unless the prefixed import is not available unprefixed verify.importFixModuleSpecifiers("test1", ["fs", "fs/promises"]); verify.importFixModuleSpecifiers("test2", ["node:fs", "node:fs/promises"]); verify.completions({ marker: "test1", exact: completion.globalsPlus([{ name: "writeFile", source: "fs", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, { name: "writeFile", source: "fs/promises", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }]), preferences: { includeCompletionsForModuleExports: true, }, }); verify.completions({ marker: "test2", exact: completion.globalsPlus([{ name: "writeFile", source: "node:fs", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, { name: "writeFile", source: "node:fs/promises", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }]), preferences: { includeCompletionsForModuleExports: true, }, });
{ "end_byte": 3827, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules3.ts" }
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ReturnStatementValidSpans.ts_0_764
/// <reference path='fourslash.ts' /> ////let a = { b: { c: 0 } }; ////function f()1{ //// /*1a*/return a && a.b && a.b.c;/*1b*/ ////} ////function f()2{ //// return /*2a*/a && a.b && a.b.c;/*2b*/ ////} ////function f()3{ //// return /*3a*/a && a.b && a.b.c/*3b*/; ////} ////function f()4{ //// return /*4a*/a.b ? a.b.c : "whenFalse";/*4b*/ ////} // valid spans for return statement goTo.select("1a", "1b"); verify.refactorAvailable("Convert to optional chain expression"); goTo.select("2a", "2b"); verify.refactorAvailable("Convert to optional chain expression"); goTo.select("3a", "3b"); verify.refactorAvailable("Convert to optional chain expression"); goTo.select("4a", "4b"); verify.refactorAvailable("Convert to optional chain expression");
{ "end_byte": 764, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ReturnStatementValidSpans.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingMember_all_js.ts_0_566
/// <reference path='fourslash.ts' /> // @allowJs: true // @checkJs: true // @Filename: /a.js ////class C { //// constructor() {} //// method() { //// this.x; //// this.y(); //// this.x; //// } ////} verify.codeFixAll({ fixId: "fixMissingMember", fixAllDescription: "Add all missing members", newFileContent: `class C { constructor() { this.x = undefined; } method() { this.x; this.y(); this.x; } y() { throw new Error("Method not implemented."); } }`, });
{ "end_byte": 566, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingMember_all_js.ts" }
TypeScript/tests/cases/fourslash/organizeImportsPathsUnicode1.ts_0_778
/// <reference path="fourslash.ts" /> //// import * as Ab from "./Ab"; //// import * as _aB from "./_aB"; //// import * as aB from "./aB"; //// import * as _Ab from "./_Ab"; //// //// console.log(_aB, _Ab, aB, Ab); verify.organizeImports( `import * as Ab from "./Ab"; import * as _Ab from "./_Ab"; import * as _aB from "./_aB"; import * as aB from "./aB"; console.log(_aB, _Ab, aB, Ab);`, /*mode*/ undefined, { organizeImportsIgnoreCase: false, organizeImportsCollation: "ordinal", }); verify.organizeImports( `import * as _aB from "./_aB"; import * as _Ab from "./_Ab"; import * as aB from "./aB"; import * as Ab from "./Ab"; console.log(_aB, _Ab, aB, Ab);`, /*mode*/ undefined, { organizeImportsIgnoreCase: false, organizeImportsCollation: "unicode", });
{ "end_byte": 778, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImportsPathsUnicode1.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties27.ts_0_466
/// <reference path="fourslash.ts" /> ////interface Foo { //// a?: boolean; //// b: boolean; ////} ////type A = { [K in keyof Foo]-?: { name: K, value: `Foo ${Uppercase<K>}` }} ////[|const a: A = {};|] verify.codeFix({ index: 0, description: ts.Diagnostics.Add_missing_properties.message, newRangeContent: `const a: A = { a: { name: "a", value: "Foo A" }, b: { name: "b", value: "Foo B" } };`, });
{ "end_byte": 466, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties27.ts" }
TypeScript/tests/cases/fourslash/breakpointValidationClassAmbient.ts_0_411
/// <reference path='fourslash.ts' /> // @BaselineFile: bpSpan_classAmbient.baseline // @Filename: bpSpan_classAmbient.ts ////declare class Greeter { //// public greeting: string; //// constructor(greeting: string, ...b: string[]); //// greet(): string; //// private val; //// static x: number; //// static fn(a: number, ...b:string[]); ////} verify.baselineCurrentFileBreakpointLocations();
{ "end_byte": 411, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationClassAmbient.ts" }
TypeScript/tests/cases/fourslash/unusedVariableInForLoop7FS.ts_0_364
/// <reference path='fourslash.ts' /> // @noUnusedLocals: true ////function f1 () [|{ //// for (const elem of ["a", "b", "c"]) { //// elem; //// var x = 20; //// } ////}|] //// verify.codeFix({ description: "Remove unused declaration for: 'x'", newRangeContent: `{ for (const elem of ["a", "b", "c"]) { elem; } }` });
{ "end_byte": 364, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedVariableInForLoop7FS.ts" }
TypeScript/tests/cases/fourslash/autoImportFileExcludePatterns4.ts_0_866
/// <reference path="fourslash.ts" /> // @Filename: /src/vs/workbench/test.ts //// import { Parts } from './parts'; //// export class /**/EditorParts implements Parts { } // @Filename: /src/vs/event/event.ts //// export interface Event { //// (): string; //// } // @Filename: /src/vs/workbench/parts.ts //// import { Event } from '../event/event'; //// export interface Parts { //// readonly options: Event; //// } // @Filename: /src/vs/workbench/workbench.ts //// import { Event } from '../event/event'; //// export { Event }; verify.codeFix({ description: "Implement interface 'Parts'", newFileContent: `import { Event } from '../event/event'; import { Parts } from './parts'; export class EditorParts implements Parts { options: Event; }`, preferences: { autoImportFileExcludePatterns: ["src/vs/workbench/workbench.ts"], } });
{ "end_byte": 866, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportFileExcludePatterns4.ts" }
TypeScript/tests/cases/fourslash/javascriptModulesTypeImport.ts_0_399
/// <reference path='fourslash.ts'/> // @allowJs: true // @Filename: types.js //// /** //// * @typedef {Object} Pet //// * @prop {string} name //// */ //// module.exports = { a: 1 }; // @Filename: app.js //// /** //// * @param { import("./types")./**/ } p //// */ //// function walk(p) { //// console.log(`Walking ${p.name}...`); //// } verify.completions({ marker: "", includes: "Pet" });
{ "end_byte": 399, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/javascriptModulesTypeImport.ts" }
TypeScript/tests/cases/fourslash/jsdocDeprecated_suggestion3.ts_0_2708
///<reference path="fourslash.ts" /> //// // merges //// /** @deprecated */ //// interface a { a: number } //// declare function a(): void //// declare const ta: [|a|] //// a; //// a(); //// interface b { a: number; } //// /** @deprecated */ //// declare function b(): void //// declare const tb: b; //// [|b|] //// [|b|](); //// interface c { } //// /** @deprecated */ //// declare function c(): void //// declare function c(a: number): void //// declare const tc: c; //// c; //// [|c|](); //// c(1); //// /** @deprecated */ //// interface d { } //// declare function d(): void //// declare function d(a: number): void //// declare const td: [|d|]; //// d; //// d(); //// d(1); //// /** @deprecated */ //// declare function e(): void //// /** @deprecated */ //// declare function e(a: number): void //// [|e|]; //// [|e|](); //// [|e|](1); //// /** @deprecated */ //// interface f { a: number } //// declare const tf: [|f|] //// /** @deprecated */ //// type g = number //// declare const tg: [|g|] //// /** @deprecated */ //// class H { } //// declare const th: [|H|] const ranges = test.ranges(); verify.getSuggestionDiagnostics([ { message: "'a' is deprecated.", code: 6385, range: ranges[0], reportsDeprecated: true, }, { message: "'b' is deprecated.", code: 6385, range: ranges[1], reportsDeprecated: true, }, { message: "The signature '(): void' of 'b' is deprecated.", code: 6387, range: ranges[2], reportsDeprecated: true, }, { message: "The signature '(): void' of 'c' is deprecated.", code: 6387, range: ranges[3], reportsDeprecated: true, }, { message: "'d' is deprecated.", code: 6385, range: ranges[4], reportsDeprecated: true, }, { message: "'e' is deprecated.", code: 6385, range: ranges[5], reportsDeprecated: true, }, { message: "The signature '(): void' of 'e' is deprecated.", code: 6387, range: ranges[6], reportsDeprecated: true, }, { message: "The signature '(a: number): void' of 'e' is deprecated.", code: 6387, range: ranges[7], reportsDeprecated: true, }, { message: "'f' is deprecated.", code: 6385, range: ranges[8], reportsDeprecated: true, }, { message: "'g' is deprecated.", code: 6385, range: ranges[9], reportsDeprecated: true, }, { message: "'H' is deprecated.", code: 6385, range: ranges[10], reportsDeprecated: true, }, ])
{ "end_byte": 2708, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocDeprecated_suggestion3.ts" }
TypeScript/tests/cases/fourslash/jsdocReturnsTag.ts_0_311
///<reference path="fourslash.ts" /> // @allowJs: true // @Filename: dummy.js /////** //// * Find an item //// * @template T //// * @param {T[]} l //// * @param {T} x //// * @returns {?T} The names of the found item(s). //// */ ////function find(l, x) { ////} ////find(''/**/); verify.baselineSignatureHelp()
{ "end_byte": 311, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocReturnsTag.ts" }
TypeScript/tests/cases/fourslash/quickInfoDisplayPartsLiteralLikeNames01.ts_0_451
/// <reference path='fourslash.ts'/> ////class C { //// public /*1*/1() { } //// private /*2*/Infinity() { } //// protected /*3*/NaN() { } //// static /*4*/"stringLiteralName"() { } //// method() { //// this[/*5*/1](); //// this[/*6*/"1"](); //// this./*7*/Infinity(); //// this[/*8*/"Infinity"](); //// this./*9*/NaN(); //// C./*10*/stringLiteralName(); //// } verify.baselineQuickInfo();
{ "end_byte": 451, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoDisplayPartsLiteralLikeNames01.ts" }
TypeScript/tests/cases/fourslash/mapCodeMultipleChangesAndRanges.ts_0_577
///<reference path="fourslash.ts"/> // @Filename: /index.ts //// //// [|function foo() { //// const x: number = 1; //// const y: number = 2; //// if (x === y) [||]{ //// console.log("hello"); //// console.log("you"); //// } //// return 1; //// }|] //// //// function bar() { //// [|return 2|]; //// } //// const [r0, r1, r2] = test.ranges(); verify.baselineMapCode([[r0], [r2, r1]], [ ` if (x === y) { console.log("goodbye"); console.log("world"); } `, ` function bar() { return 3; } `, ` method() { return 'nope'; } ` ]);
{ "end_byte": 577, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/mapCodeMultipleChangesAndRanges.ts" }
TypeScript/tests/cases/fourslash/moveToFile_multipleStatements.ts_0_639
/// <reference path='fourslash.ts' /> //@Filename: /bar.ts ////import { } from './somefile'; ////const a = 12; // @Filename: /a.ts ////[|const q = 0; ////const t = 2; ////function f() {} ////class C {} ////enum E {} ////namespace N { export const h = 0; } ////type T = number; ////interface I {}|] verify.moveToFile({ newFileContents: { "/a.ts": ``, "/bar.ts": `import { } from './somefile'; const a = 12; const q = 0; const t = 2; function f() { } class C { } enum E { } namespace N { export const h = 0; } type T = number; interface I { } `, }, interactiveRefactorArguments: { targetFile: "/bar.ts" } });
{ "end_byte": 639, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_multipleStatements.ts" }
TypeScript/tests/cases/fourslash/codeFixOverrideModifier7.ts_0_351
/// <reference path='fourslash.ts' /> // @noImplicitOverride: true //// class E extends (class { //// foo () {} //// bar () {} //// }) { //// override foo () { } //// baz() {} //// [|override bazz () {}|] //// } verify.codeFix({ description: "Remove 'override' modifier", newRangeContent: "bazz () {}", index: 0 })
{ "end_byte": 351, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixOverrideModifier7.ts" }
TypeScript/tests/cases/fourslash/navigationBarItemsClass2.ts_0_772
/// <reference path="fourslash.ts" /> ////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": 772, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsClass2.ts" }
TypeScript/tests/cases/fourslash/addAllMissingImportsNoCrash.ts_0_679
/// <reference path="fourslash.ts" /> // @Filename: file1.ts //// export interface Test1 {} //// export interface Test2 {} //// export interface Test3 {} //// export interface Test4 {} // @Filename: file2.ts //// import { Test1, Test4 } from './file1'; //// interface Testing { //// test1: Test1; //// test2: Test2; //// test3: Test3; //// test4: Test4; //// } goTo.file("file2.ts"); verify.codeFixAll({ fixId: "fixMissingImport", fixAllDescription: "Add all missing imports", newFileContent: `import { Test1, Test2, Test3, Test4 } from './file1'; interface Testing { test1: Test1; test2: Test2; test3: Test3; test4: Test4; }` });
{ "end_byte": 679, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/addAllMissingImportsNoCrash.ts" }
TypeScript/tests/cases/fourslash/codeFixDisableJsDiagnosticsInFile3.ts_0_307
/// <reference path='fourslash.ts' /> // @allowjs: true // @noEmit: true // @checkJs: true // @Filename: a.js ////[|var x = ""; ////x = 1;|] // Disable checking for next line verify.rangeAfterCodeFix(`var x = ""; // @ts-ignore x = 1;`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
{ "end_byte": 307, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixDisableJsDiagnosticsInFile3.ts" }
TypeScript/tests/cases/fourslash/signatureHelpInferenceJsDocImportTag.ts_0_342
///<reference path="fourslash.ts" /> // @allowJS: true // @checkJs: true // @module: esnext // @filename: a.ts ////export interface Foo {} // @filename: b.js /////** //// * @import { //// * Foo //// * } from './a' //// */ //// /////** //// * @param {Foo} a //// */ ////function foo(a) {} ////foo(/**/) verify.baselineSignatureHelp();
{ "end_byte": 342, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpInferenceJsDocImportTag.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType12.ts_0_431
/// <reference path='fourslash.ts' /> //// interface A<T = /*a*/string/*b*/> { //// a: boolean //// b: number //// c: T //// } goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = string interface A<T = NewType> { a: boolean b: number c: T }`, });
{ "end_byte": 431, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType12.ts" }
TypeScript/tests/cases/fourslash/docCommentTemplateReturnsTag2.ts_0_364
/// <reference path='fourslash.ts' /> /////*0*/ ////function f1(x: number, y: number) { //// return 1; ////} verify.docCommentTemplateAt("0", 7, `/** * * @param x * @param y * @returns */`, { generateReturnInDocTemplate: true }); verify.docCommentTemplateAt("0", 7, `/** * * @param x * @param y */`, { generateReturnInDocTemplate: false });
{ "end_byte": 364, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateReturnsTag2.ts" }
TypeScript/tests/cases/fourslash/codeFixInferFromUsageMember2.ts_0_169
/// <reference path='fourslash.ts' /> // @noImplicitAny: true ////interface I { //// [|p;|] ////} ////var i: I; ////i.p = 0; verify.rangeAfterCodeFix("p: number;");
{ "end_byte": 169, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageMember2.ts" }
TypeScript/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace5.ts_0_165
/// <reference path="fourslash.ts"/> ////new Foo(1, //// /* comment */ ); format.document(); verify.currentFileContentIs(`new Foo(1, /* comment */);`);
{ "end_byte": 165, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace5.ts" }
TypeScript/tests/cases/fourslash/findAllRefsDeclareClass.ts_0_148
/// <reference path="fourslash.ts" /> /////*1*/declare class /*2*/C { //// static m(): void; ////} verify.baselineFindAllReferences('1', '2');
{ "end_byte": 148, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsDeclareClass.ts" }
TypeScript/tests/cases/fourslash/getJavaScriptCompletions18.ts_0_504
/// <reference path="fourslash.ts" /> // @allowNonTsExtensions: true // @Filename: file.js //// /** //// * @param {number} a //// * @param {string} b //// */ //// exports.foo = function(a, b) { //// a/*a*/; //// b/*b*/ //// }; goTo.marker('a'); edit.insert('.'); verify.completions({ includes: { name: "toFixed", kind: "method", kindModifiers: "declare" } }); goTo.marker('b'); edit.insert('.'); verify.completions({ includes: { name: "substring", kind: "method", kindModifiers: "declare" } });
{ "end_byte": 504, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptCompletions18.ts" }
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_importedFunction6.ts_0_613
/// <reference path='fourslash.ts' /> // @Filename: f.ts ////export function /*a*/foo/*b*/(a: string, b: string) { } // @Filename: a.ts ////import * as f from "./f"; ////f.foo("a", "b"); goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Convert parameters to destructured object", actionName: "Convert parameters to destructured object", actionDescription: "Convert parameters to destructured object", newContent: `export function foo({ a, b }: { a: string; b: string; }) { }` }); goTo.file("a.ts"); verify.currentFileContentIs(`import * as f from "./f"; f.foo({ a: "a", b: "b" });`)
{ "end_byte": 613, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_importedFunction6.ts" }
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess31.ts_0_483
/// <reference path='fourslash.ts' /> //// class A { //// public /*a*/a/*b*/ = 1; //// } goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Generate 'get' and 'set' accessors", actionName: "Generate 'get' and 'set' accessors", actionDescription: "Generate 'get' and 'set' accessors", newContent: `class A { private /*RENAME*/_a = 1; public get a() { return this._a; } public set a(value) { this._a = value; } }`, });
{ "end_byte": 483, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess31.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType43.ts_0_174
/// <reference path='fourslash.ts' /> //// type A = (v: string | number) => /*a*/number | typeof v/*b*/ goTo.select("a", "b"); verify.not.refactorAvailable("Extract type")
{ "end_byte": 174, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType43.ts" }
TypeScript/tests/cases/fourslash/codeFixConvertToMappedObjectType10.ts_0_508
/// <reference path='fourslash.ts' /> //// type K = "foo" | "bar"; //// interface Foo { } //// interface Bar<T> { bar: T; } //// interface SomeType<T> extends Foo, Bar<T> { //// a: number; //// b: T; //// [prop: K]: any; //// } verify.codeFix({ description: `Convert 'SomeType' to mapped object type`, newFileContent: `type K = "foo" | "bar"; interface Foo { } interface Bar<T> { bar: T; } type SomeType<T> = Foo & Bar<T> & { [prop in K]: any; } & { a: number; b: T; };` })
{ "end_byte": 508, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixConvertToMappedObjectType10.ts" }
TypeScript/tests/cases/fourslash/semanticModernClassificationInterfaces.ts_0_892
//// interface Pos { x: number, y: number }; //// const p = { x: 1, y: 2 } as Pos; //// const foo = (o: Pos) => o.x + o.y; const c2 = classification("2020"); verify.semanticClassificationsAre("2020", c2.semanticToken("interface.declaration", "Pos"), c2.semanticToken("property.declaration", "x"), c2.semanticToken("property.declaration", "y"), c2.semanticToken("variable.declaration.readonly", "p"), c2.semanticToken("property.declaration", "x"), c2.semanticToken("property.declaration", "y"), c2.semanticToken("interface", "Pos"), c2.semanticToken("function.declaration.readonly", "foo"), c2.semanticToken("parameter.declaration", "o"), c2.semanticToken("interface", "Pos"), c2.semanticToken("parameter", "o"), c2.semanticToken("property", "x"), c2.semanticToken("parameter", "o"), c2.semanticToken("property", "y"), );;
{ "end_byte": 892, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/semanticModernClassificationInterfaces.ts" }
TypeScript/tests/cases/fourslash/quickInfoJsDocTagsFunctionOverload03.ts_0_274
/// <reference path='fourslash.ts'/> // @Filename: quickInfoJsDocTagsFunctionOverload03.ts ////declare function /*1*/foo(): void; //// /////** //// * Doc foo overloaded //// * @tag Tag text //// */ ////declare function /*2*/foo(x: number): void verify.baselineQuickInfo()
{ "end_byte": 274, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoJsDocTagsFunctionOverload03.ts" }
TypeScript/tests/cases/fourslash/nameOrDottedNameStatements.ts_0_1746
/// <reference path='fourslash.ts' /> // @BaselineFile: nameOrDottedSpan_stmts.baseline // @Filename: nameOrDottedSpan_stmts.ts ////function f() { //// var y; //// var x = 0; //// for (var i = 0; i < 10; i++) { //// x += i; //// x *= 0; //// } //// if (x > 17) { //// x /= 9; //// } else { //// x += 10; //// x++; //// } //// var a = [ //// 1, //// 2, //// 3 //// ]; //// var obj = { //// z: 1, //// q: "hello" //// }; //// for (var j in a) { //// obj.z = a[j]; //// var v = 10; //// } //// try { //// obj.q = "ohhh"; //// } catch (e) { //// if (obj.z < 10) { //// obj.z = 12; //// } else { //// obj.q = "hmm"; //// } //// } //// try { //// throw new Error(); //// } catch (e1) { //// var b = e1; //// } finally { //// y = 70; //// } //// with (obj) { //// i = 2; //// z = 10; //// } //// switch (obj.z) { //// case 0: { //// x++; //// break; //// //// } //// case 1: { //// x--; //// break; //// //// } //// default: { //// x *= 2; //// x = 50; //// break; //// //// } //// } //// while (x < 10) { //// x++; //// } //// do { //// x--; //// } while (x > 4) //// x = y; //// var z = (x == 1) ? x + 1 : x - 1; //// (x == 1) ? x + 1 : x - 1; //// x === 1; //// x = z = 40; //// eval("y"); //// return; ////} ////var b = function () { //// var x = 10; //// x = x + 1; ////}; ////f(); verify.baselineCurrentFileNameOrDottedNameSpans();
{ "end_byte": 1746, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/nameOrDottedNameStatements.ts" }
TypeScript/tests/cases/fourslash/formattingJsxTexts4.ts_0_383
/// <reference path='fourslash.ts' /> // Github issue #55293 //@Filename: file.tsx //// function foo() { //// const a = <ns: foobar x : test1 x :test2="string" x:test3={true?1:0} />; //// //// return a; //// } format.document(); verify.currentFileContentIs( `function foo() { const a = <ns:foobar x:test1 x:test2="string" x:test3={true ? 1 : 0} />; return a; }`);
{ "end_byte": 383, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingJsxTexts4.ts" }
TypeScript/tests/cases/fourslash/completionsDotInObjectLiteral.ts_0_308
/// <reference path="fourslash.ts" /> ////const o = { //// a: 1, //// [|.|]/**/ ////[|}|]; verify.getSyntacticDiagnostics(test.ranges().map((range): FourSlashInterface.Diagnostic => ({ code: 1003, message: "Identifier expected.", range }))); verify.completions({ marker: "", exact: undefined });
{ "end_byte": 308, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsDotInObjectLiteral.ts" }
TypeScript/tests/cases/fourslash/findAllRefsForDefaultExportAnonymous.ts_0_527
/// <reference path='fourslash.ts' /> // @Filename: /a.ts ////[|export /*0*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}default|] function() {}|] // @Filename: /b.ts ////[|import /*1*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}f|] from "./a";|] const [r0Def, r0, r1Def, r1] = test.ranges(); // Verify that it doesn't try to rename "default" goTo.rangeStart(r0); verify.renameInfoFailed(); verify.baselineFindAllReferences('0', '1'); verify.baselineRename(r1);
{ "end_byte": 527, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsForDefaultExportAnonymous.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType_js2.ts_0_428
/// <reference path='fourslash.ts' /> // @allowJs: true // @Filename: a.js //// /** @type { /*a*/string/*b*/ | number } */ //// var x; goTo.file('a.js') goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to typedef", actionDescription: "Extract to typedef", newContent: `/** * @typedef {string} /*RENAME*/NewType */ /** @type { NewType | number } */ var x;`, });
{ "end_byte": 428, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType_js2.ts" }
TypeScript/tests/cases/fourslash/getOccurrencesLoopBreakContinue4.ts_0_1877
/// <reference path='fourslash.ts' /> ////var arr = [1, 2, 3, 4]; ////label1: for (var n in arr) { //// break; //// continue; //// break label1; //// continue label1; //// //// label2: for (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; } //// } [|wh/**/ile|] (true) //// } //// } //// } ////} //// ////label5: while (true) break label5; //// ////label7: while (true) continue label5; verify.baselineDocumentHighlights();
{ "end_byte": 1877, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesLoopBreakContinue4.ts" }
TypeScript/tests/cases/fourslash/completionsOverridingMethod21.ts_0_1280
/// <reference path="fourslash.ts" /> // @Filename: a.ts // @newline: LF //// abstract class AFoo { //// abstract bar(): Promise<void>; //// } //// class BFoo extends AFoo { //// async /*b*/ //// } verify.completions({ marker: "b", isNewIdentifierLocation: true, preferences: { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: false, includeCompletionsWithClassMemberSnippets: true, }, includes: [ { name: "bar", sortText: completion.SortText.LocationPriority, insertText: "async bar(): Promise<void> {\n}", filterText: "bar", replacementSpan: undefined, hasAction: true, source: completion.CompletionSource.ClassMemberSnippet, }, ] }); verify.applyCodeActionFromCompletion("b", { preferences: { includeCompletionsWithInsertText: true, includeCompletionsWithSnippetText: false, includeCompletionsWithClassMemberSnippets: true, }, name: "bar", source: completion.CompletionSource.ClassMemberSnippet, description: "Update modifiers of 'bar'", newFileContent: `abstract class AFoo { abstract bar(): Promise<void>; } class BFoo extends AFoo { }` });
{ "end_byte": 1280, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsOverridingMethod21.ts" }
TypeScript/tests/cases/fourslash/memberListInFunctionCall2.ts_0_302
/// <reference path='fourslash.ts' /> ////type T = { //// a: 1; //// b: 2; ////} ////function F(x: T) { ////} ////F({/*1*/} as const) verify.completions({ marker: "1", exact: [ { name: "a", text: "(property) a: 1" }, { name: "b", text: "(property) b: 2" }, ], });
{ "end_byte": 302, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberListInFunctionCall2.ts" }
TypeScript/tests/cases/fourslash/codeFixAddMissingAwait_notAvailableWithoutPromise.ts_0_148
/// <reference path="fourslash.ts" /> ////async function fn(a: {}, b: number) { //// a + b; ////} verify.not.codeFixAvailable("addMissingAwait");
{ "end_byte": 148, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingAwait_notAvailableWithoutPromise.ts" }
TypeScript/tests/cases/fourslash/codeFixAmbientClassImplementClassAbstractGettersAndSetters.ts_0_662
/// <reference path='fourslash.ts' /> ////abstract class A { //// abstract get a(): string; //// abstract set a(newName: string); //// //// abstract get b(): number; //// //// abstract set c(arg: number | string); ////} //// ////declare class C implements A {} verify.codeFix({ description: "Implement interface 'A'", newFileContent: `abstract class A { abstract get a(): string; abstract set a(newName: string); abstract get b(): number; abstract set c(arg: number | string); } declare class C implements A { get a(): string; set a(newName: string); get b(): number; set c(arg: string | number); }`, });
{ "end_byte": 662, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAmbientClassImplementClassAbstractGettersAndSetters.ts" }
TypeScript/tests/cases/fourslash/formattingInMultilineComments.ts_0_304
/// <reference path='fourslash.ts' /> ////var x = function() { //// if (true) { //// /*1*/} else {/*2*/ ////} //// ////// newline at the end of the file goTo.marker("2"); edit.insertLine(""); goTo.marker("1"); // else formating should not be affected verify.currentLineContentIs(' } else {');
{ "end_byte": 304, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingInMultilineComments.ts" }
TypeScript/tests/cases/fourslash/navigationBarJsDocCommentWithNoTags.ts_0_622
/// <reference path="fourslash.ts"/> /////** Test */ ////export const Test = {} verify.navigationTree({ "text": "\"navigationBarJsDocCommentWithNoTags\"", "kind": "module", "childItems": [ { "text": "Test", "kind": "const", "kindModifiers": "export" } ] }); verify.navigationBar([ { "text": "\"navigationBarJsDocCommentWithNoTags\"", "kind": "module", "childItems": [ { "text": "Test", "kind": "const", "kindModifiers": "export" } ] } ]);
{ "end_byte": 622, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarJsDocCommentWithNoTags.ts" }
TypeScript/tests/cases/fourslash/completionExportFrom.ts_0_236
/// <reference path="fourslash.ts" /> //// export * /*1*/; //// export {} /*2*/; verify.completions({ marker: ["1", "2"], includes: [{ name: "from", sortText: completion.SortText.GlobalsOrKeywords, }], });
{ "end_byte": 236, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionExportFrom.ts" }
TypeScript/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics18.ts_0_342
/// <reference path="fourslash.ts" /> // @allowJs: true // @Filename: a.js ////class C { //// x; // Regular property declaration allowed //// static y; // static allowed //// public z; // public not allowed ////} // @Filename: b.js ////class C { //// x: number; // Types not allowed ////} verify.baselineSyntacticDiagnostics()
{ "end_byte": 342, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics18.ts" }
TypeScript/tests/cases/fourslash/codeFixInferFromUsageOptionalParam2.ts_0_161
/// <reference path='fourslash.ts' /> // @noImplicitAny: true ////function f([|a? |]){ //// if (a < 9) return; ////} verify.rangeAfterCodeFix("a?: number");
{ "end_byte": 161, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageOptionalParam2.ts" }
TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_infer.ts_0_283
/// <reference path='fourslash.ts' /> ////type Length<T> = T extends ArrayLike<infer U> ? number : never; verify.codeFix({ description: "Replace 'infer U' with 'unknown'", index: 0, newFileContent: "type Length<T> = T extends ArrayLike<unknown> ? number : never;", });
{ "end_byte": 283, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUnusedIdentifier_infer.ts" }
TypeScript/tests/cases/fourslash/removeDeclareInModule.ts_0_255
/// <reference path="fourslash.ts" /> //// /**/export module Foo { //// function a(): void {} //// } //// //// Foo.a(); goTo.marker(); edit.deleteAtCaret('export '.length); verify.numberOfErrorsInCurrentFile(1); // Expected 1: 'a' is not exported
{ "end_byte": 255, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/removeDeclareInModule.ts" }
TypeScript/tests/cases/fourslash/documentHighlightInTypeExport.ts_3_770
/ <reference path='fourslash.ts'/> // @Filename: /1.ts //// type [|A|] = 1; //// export { [|A|] as [|B|] }; // @Filename: /2.ts //// type [|A|] = 1; //// let [|A|]: [|A|] = 1; //// export { [|A|] as [|B|] }; // a little strange, but the the type/value namespaces work too // @Filename: /3.ts //// type [|A|] = 1; //// let [|A|]: [|A|] = 1; //// export type { [|A|] as [|B|] }; // type-only exports may still export values to be imported and used in type contexts // would be nice if this could work the same for imports too, but getSymbolAtLocation() // of the imported symbol (when aliased) returns undefined // // @Filename: /4.ts // //// import type { [|Tee|] as [|T|] } from "whatEveh"; // //// let [|T|]: [|T|]; // verify.baselineDocumentHighlights();
{ "end_byte": 770, "start_byte": 3, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/documentHighlightInTypeExport.ts" }
TypeScript/tests/cases/fourslash/quickInfoTypeError.ts_0_302
/// <reference path='fourslash.ts' /> ////foo({ //// /**/f: function() {}, //// f() {} ////}); // The symbol indicates that this is a function, but the type is `any`. // Regression test that we don't crash (by trying to get signatures from `any`). verify.quickInfoAt("", "(method) f(): void");
{ "end_byte": 302, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoTypeError.ts" }
TypeScript/tests/cases/fourslash/inlineVariableNullCoalescing.ts_0_525
/// <reference path="fourslash.ts" /> ////function foo(): number | undefined { return Math.random() > 0.5 ? 1 : undefined; } ////const /*a*/x/*b*/ = foo(); ////const y = x?.toString(); goTo.select("a", "b"); verify.refactorAvailable("Inline variable"); edit.applyRefactor({ refactorName: "Inline variable", actionName: "Inline variable", actionDescription: "Inline variable", newContent: `function foo(): number | undefined { return Math.random() > 0.5 ? 1 : undefined; } const y = (foo())?.toString();` });
{ "end_byte": 525, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlineVariableNullCoalescing.ts" }
TypeScript/tests/cases/fourslash/insertSecondTryCatchBlock.ts_0_126
/// <reference path="fourslash.ts" /> //// try {} catch(e) { } //// /**/ goTo.marker(); edit.insert('try {} catch(e) { }');
{ "end_byte": 126, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/insertSecondTryCatchBlock.ts" }
TypeScript/tests/cases/fourslash/goToDefinitionUndefinedSymbols.ts_0_271
/// <reference path='fourslash.ts' /> ////some/*undefinedValue*/Variable; ////var a: some/*undefinedType*/Type; ////var x = {}; x.some/*undefinedProperty*/Property; ////var a: any; a.some/*unkownProperty*/Property; verify.baselineGoToDefinition(...test.markerNames());
{ "end_byte": 271, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionUndefinedSymbols.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType77.ts_0_483
/// <reference path='fourslash.ts' /> // @Filename: a.ts ////type Expand<T> = T extends any //// ? /*a*/{ [K in keyof T]: Expand<T[K]> }/*b*/ //// : never; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType<T> = { [K in keyof T]: Expand<T[K]>; }; type Expand<T> = T extends any ? NewType<T> : never;`, });
{ "end_byte": 483, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType77.ts" }
TypeScript/tests/cases/fourslash/extract-const_jsxElement3.ts_0_791
/// <reference path='fourslash.ts' /> // @jsx: preserve // @filename: a.tsx ////declare var React: any; ////class Foo extends React.Component<{}, {}> { //// render() { //// return ( //// <div> //// /*a*/<span></span>/*b*/ //// </div> //// ); //// } ////} goTo.file("a.tsx"); goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "constant_scope_1", actionDescription: "Extract to readonly field in class 'Foo'", newContent: `declare var React: any; class Foo extends React.Component<{}, {}> { private readonly newProperty = <span></span>; render() { return ( <div> {this./*RENAME*/newProperty} </div> ); } }` });
{ "end_byte": 791, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const_jsxElement3.ts" }
TypeScript/tests/cases/fourslash/completionListPrivateMembers.ts_0_243
/// <reference path="fourslash.ts"/> ////class Foo { //// private x; ////} //// ////class Bar extends Foo { //// private y; //// foo() { //// this./**/ //// } ////} verify.completions({ marker: "", exact: ["foo", "y"] });
{ "end_byte": 243, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListPrivateMembers.ts" }
TypeScript/tests/cases/fourslash/genericParameterHelp.ts_0_912
/// <reference path="fourslash.ts"/> ////interface IFoo { } //// ////function testFunction<T extends IFoo, U, M extends IFoo>(a: T, b: U, c: M): M { //// return null; ////} //// ////// Function calls ////testFunction</*1*/ ////testFunction<any, /*2*/ ////testFunction<any, any, any>(/*3*/ ////testFunction<any, any,/*4*/ any>(null, null, null); ////testFunction<, ,/*5*/>(null, null, null); verify.signatureHelp( { marker: "1", text: "testFunction<T extends IFoo, U, M extends IFoo>(a: T, b: U, c: M): M", parameterCount: 3, parameterName: "T", parameterSpan: "T extends IFoo", }, { marker: "2", parameterName: "U", parameterSpan: "U" }, { marker: "3", parameterName: "a", parameterSpan: "a: any" }, { marker: "4", parameterName: "M", parameterSpan: "M extends IFoo" }, { marker: "5", parameterName: "M", parameterSpan: "M extends IFoo" }, );
{ "end_byte": 912, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/genericParameterHelp.ts" }
TypeScript/tests/cases/fourslash/invertedCloduleAfterQuickInfo.ts_0_234
/// <reference path="fourslash.ts" /> ////module M { //// module A { //// var o; //// } //// class A { //// /**/c //// } ////} goTo.marker(); verify.quickInfoExists(); verify.numberOfErrorsInCurrentFile(1);
{ "end_byte": 234, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/invertedCloduleAfterQuickInfo.ts" }
TypeScript/tests/cases/fourslash/renameLabel1.ts_0_111
/// <reference path="fourslash.ts" /> ////foo: { //// break /**/foo; ////} verify.baselineRename("", {});
{ "end_byte": 111, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameLabel1.ts" }
TypeScript/tests/cases/fourslash/completionListWithAmbientDeclaration.ts_0_264
/// <reference path="fourslash.ts"/> //// declare module "http" { //// var x; //// /*1*/ //// } //// declare module 'https' { //// } //// /*2*/ verify.completions( { marker: "1", excludes: "http" }, { marker: "2", excludes: ["http", "https"] }, );
{ "end_byte": 264, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListWithAmbientDeclaration.ts" }
TypeScript/tests/cases/fourslash/semanticModernClassificationClassProperties.ts_0_805
//// class A { //// private y: number; //// constructor(public x : number, _y : number) { this.y = _y; } //// get z() : number { return this.x + this.y; } //// set a(v: number) { } //// } const c2 = classification("2020"); verify.semanticClassificationsAre("2020", c2.semanticToken("class.declaration", "A"), c2.semanticToken("property.declaration", "y"), c2.semanticToken("parameter.declaration", "x"), c2.semanticToken("parameter.declaration", "_y"), c2.semanticToken("property", "y"), c2.semanticToken("parameter", "_y"), c2.semanticToken("property.declaration", "z"), c2.semanticToken("property", "x"), c2.semanticToken("property", "y"), c2.semanticToken("property.declaration", "a"), c2.semanticToken("parameter.declaration", "v"), );;
{ "end_byte": 805, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/semanticModernClassificationClassProperties.ts" }
TypeScript/tests/cases/fourslash/completionEntryForUnionMethod.ts_0_515
///<reference path="fourslash.ts" /> ////var y: Array<string>|Array<number>; ////y.map/**/( const text = "(method) Array<T>.map<unknown>(callbackfn: ((value: string, index: number, array: string[]) => unknown) & ((value: number, index: number, array: number[]) => unknown), thisArg?: any): unknown[]"; const documentation = "Calls a defined callback function on each element of an array, and returns an array that contains the results."; verify.quickInfoAt("", text, documentation); verify.baselineCompletions()
{ "end_byte": 515, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionEntryForUnionMethod.ts" }
TypeScript/tests/cases/fourslash/completionsCommitCharactersGlobal.ts_0_822
/// <reference path='fourslash.ts' /> //// declare function func(a: string, b: number): { a: string, b: number }; //// const x1 = func(/*1*/) //// const x2 = func //// (a/*2*/) //// (a/*22*/) //// ; //// const x3 = func("a", /*3*/) //// const x4 = func //// (a, b/*4*/) //// const x5 = func((a, /*5*/)); //// const x6 = (a/*6*/) //// const x7 = (a, x/*7*/) //// function x8(/*8*/) {} //// function x9(a: number, /*9*/) //// const x10: [/*10*/] //// const x11: [ ] //// let x12; //// x12 = /*12*/ //// const x13 = `hello, ${/*13*/}` //// interface I<T> { //// [/*14*/]: T; //// } //// class C { //// [/*16*/]: string; //// [str/*17*/: string]: number; //// } //// type T = { //// [x/*18*/yz: number]: boolean; //// [/*19*/ //// } //// function F(pred: (x/*20*/) verify.baselineCompletions();
{ "end_byte": 822, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsCommitCharactersGlobal.ts" }
TypeScript/tests/cases/fourslash/refactorExtractType26.ts_0_406
/// <reference path='fourslash.ts' /> //// type A<T, U> = () => /*a*/<T>(v: T) => (v: T) => <T>(v: T) => U/*b*/; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType<U> = <T>(v: T) => (v: T) => <T>(v: T) => U; type A<T, U> = () => NewType<U>;`, });
{ "end_byte": 406, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType26.ts" }
TypeScript/tests/cases/fourslash/signatureHelpTaggedTemplates7.ts_0_432
/// <reference path='fourslash.ts' /> //// function f(templateStrings, x, y, z) { return 10; } //// function g(templateStrings, x, y, z) { return ""; } //// //// f `/*1*/ /*2*/ verify.signatureHelp({ marker: test.markers(), text: "f(templateStrings: any, x: any, y: any, z: any): number", argumentCount: 1, parameterCount: 4, parameterName: "templateStrings", parameterSpan: "templateStrings: any", });
{ "end_byte": 432, "start_byte": 0, "url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpTaggedTemplates7.ts" }