_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction13.ts_0_356 | /// <reference path='fourslash.ts' />
//// const foo = /*a*/a/*b*/ => { return null; };
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Add or remove braces in an arrow function",
actionName: "Remove braces from arrow function",
actionDescription: "Remove braces from arrow function",
newContent: `const foo = a => null;`,
});
| {
"end_byte": 356,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction13.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToNamed_MultiDecl_VarSelection.ts_0_361 | /// <reference path='fourslash.ts' />
//// let foo, /*x*/b/*y*/ar = a => 1 + a;
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert arrow function or function expression",
actionName: "Convert to named function",
actionDescription: "Convert to named function",
newContent: `let foo;
function bar(a) {
return 1 + a;
}
`,
});
| {
"end_byte": 361,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToNamed_MultiDecl_VarSelection.ts"
} |
TypeScript/tests/cases/fourslash/extendsTArray.ts_0_298 | /// <reference path='fourslash.ts'/>
////interface I1<T> {
//// (a: T): T;
////}
////interface I2<T> extends I1<T[]> {
//// b: T;
////}
////var x: I2<Date>;
////var /**/y = x(undefined); // Typeof y should be Date[]
////y.length;
verify.quickInfoAt("", "var y: Date[]");
verify.noErrors();
| {
"end_byte": 298,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extendsTArray.ts"
} |
TypeScript/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_classes.ts_0_175 | /// <reference path='fourslash.ts' />
////var aa = 1;
////class /*className1*/
////class a/*className2*/
verify.completions({ marker: test.markers(), exact: undefined });
| {
"end_byte": 175,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_classes.ts"
} |
TypeScript/tests/cases/fourslash/findReferencesJSXTagName2.ts_0_208 | /// <reference path='fourslash.ts'/>
// @Filename: index.tsx
/////*1*/const /*2*/obj = {Component: () => <div/>};
////const element = </*3*/obj.Component/>;
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 208,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findReferencesJSXTagName2.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_FnArgument.ts_0_424 | /// <reference path='fourslash.ts' />
//// function foo(lambda){}
//// foo(function /*x*/is/*y*/Even(n) {
//// return n % 2 === 0;
//// });
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert arrow function or function expression",
actionName: "Convert to arrow function",
actionDescription: "Convert to arrow function",
newContent: `function foo(lambda){}
foo((n) => n % 2 === 0);`,
});
| {
"end_byte": 424,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_FnArgument.ts"
} |
TypeScript/tests/cases/fourslash/jsxSpreadReference.ts_0_559 | /// <reference path='fourslash.ts' />
//@Filename: file.tsx
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// }
//// interface ElementAttributesProperty { props }
//// }
//// class MyClass {
//// props: {
//// name?: string;
//// size?: number;
//// }
//// }
////
//// [|var [|/*dst*/{| "contextRangeIndex": 0 |}nn|]: {name?: string; size?: number};|]
//// var x = <MyClass {...[|n/*src*/n|]}></MyClass>;
verify.baselineRenameAtRangesWithText("nn")
verify.baselineGoToDefinition("src"); | {
"end_byte": 559,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsxSpreadReference.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInvalidJsxCharacters3.ts_0_487 | /// <reference path='fourslash.ts' />
// @jsx: react
// @filename: main.tsx
//// let foo = <div>{"foo"}}</div>;
verify.codeFix({
description: ts.Diagnostics.Wrap_invalid_character_in_an_expression_container.message,
newFileContent: `let foo = <div>{"foo"}{"}"}</div>;`,
index: 0,
});
verify.codeFix({
description: ts.Diagnostics.Convert_invalid_character_to_its_html_entity_code.message,
newFileContent: `let foo = <div>{"foo"}}</div>;`,
index: 1,
});
| {
"end_byte": 487,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInvalidJsxCharacters3.ts"
} |
TypeScript/tests/cases/fourslash/incrementalParsingDynamicImport4.ts_3_307 | / <reference path="fourslash.ts"/>
// @lib: es2015
// @Filename: ./foo.ts
//// export function bar() { return 1; }
// @Filename: ./0.ts
//// /*1*/
//// import { bar } from "./foo"
verify.numberOfErrorsInCurrentFile(0);
goTo.marker("1");
edit.insert("import");
verify.numberOfErrorsInCurrentFile(1); | {
"end_byte": 307,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/incrementalParsingDynamicImport4.ts"
} |
TypeScript/tests/cases/fourslash/formattingInComment.ts_0_347 | /// <reference path='fourslash.ts'/>
////class A {
////foo( ); // /*1*/
////}
////function foo() { var x; } // /*2*/
goTo.marker("1");
edit.insert(";");
verify.currentLineContentIs("foo( ); // ;")
goTo.marker("2");
edit.insert("}");
verify.currentLineContentIs("function foo() { var x; } // }"); | {
"end_byte": 347,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingInComment.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesIfElse.ts_0_462 | /// <reference path='fourslash.ts' />
////[|if|] (true) {
//// if (false) {
//// }
//// else {
//// }
//// if (true) {
//// }
//// else {
//// if (false)
//// if (true)
//// var x = undefined;
//// }
////}
////[|else i/**/f|] (null) {
////}
////[|else|] /* whar garbl */ [|if|] (undefined) {
////}
////[|else|]
////[|if|] (false) {
////}
////[|else|] { }
verify.baselineDocumentHighlights();
| {
"end_byte": 462,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesIfElse.ts"
} |
TypeScript/tests/cases/fourslash/classExtendsInterfaceSigHelp1.ts_0_353 | /// <reference path='fourslash.ts'/>
////class C {
//// public foo(x: string);
//// public foo(x: number);
//// public foo(x: any) { return x; }
////}
////interface I extends C {
//// other(x: any): any;
////}
////var i: I;
////i.foo(/**/
verify.signatureHelp({
marker: "",
overloadsCount: 2,
parameterSpan: "x: string",
});
| {
"end_byte": 353,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/classExtendsInterfaceSigHelp1.ts"
} |
TypeScript/tests/cases/fourslash/completionsImportDefaultExportCrash1.ts_0_846 | /// <reference path="fourslash.ts" />
// @module: nodenext
// @allowJs: true
// @Filename: /node_modules/dom7/index.d.ts
//// export interface Dom7Array {
//// length: number;
//// prop(propName: string): any;
//// }
////
//// export interface Dom7 {
//// (): Dom7Array;
//// fn: any;
//// }
////
//// declare const Dom7: Dom7;
////
//// export {
//// Dom7 as $,
//// };
// @Filename: /dom7.js
//// import * as methods from 'dom7';
//// Object.keys(methods).forEach((methodName) => {
//// if (methodName === '$') return;
//// methods.$.fn[methodName] = methods[methodName];
//// });
////
//// export default methods.$;
// @Filename: /swipe-back.js
//// import $ from './dom7.js';
//// /*1*/
verify.completions({
marker: "1",
includes: [{ name: "$" }],
preferences: {
includeCompletionsForModuleExports: true,
}
});
| {
"end_byte": 846,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImportDefaultExportCrash1.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionReturn6.ts_0_189 | /// <reference path="fourslash.ts" />
////function foo() {
//// return /*end*/function () {
//// [|/*start*/return|] 10;
//// }
////}
verify.baselineGoToDefinition("start");
| {
"end_byte": 189,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionReturn6.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarFunctionPrototype2.ts_0_1026 | /// <reference path="fourslash.ts"/>
// @Filename: foo.js
////A.prototype.a = function() { };
////A.prototype.b = function() { };
////function A() {}
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "A",
"kind": "class",
"childItems": [
{
"text": "a",
"kind": "function"
},
{
"text": "b",
"kind": "function"
},
{
"text": "constructor",
"kind": "constructor"
}
]
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "A",
"kind": "class"
}
]
},
{
"text": "A",
"kind": "class",
"childItems": [
{
"text": "a",
"kind": "function"
},
{
"text": "b",
"kind": "function"
},
{
"text": "constructor",
"kind": "constructor"
}
],
"indent": 1
}
]);
| {
"end_byte": 1026,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarFunctionPrototype2.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentArrayBindingPattern02.ts_3_450 | / <reference path="fourslash.ts"/>
////var /*1*/[/*2*/a,/*3*/b/*4*/]/*5*/
function verifyIndentationAfterNewLine(marker: string, indentation: number): void {
goTo.marker(marker);
edit.insert("\n");
verify.indentationIs(indentation);
}
verifyIndentationAfterNewLine("1", 4);
verifyIndentationAfterNewLine("2", 8);
verifyIndentationAfterNewLine("3", 8);
verifyIndentationAfterNewLine("4", 8);
verifyIndentationAfterNewLine("5", 0); | {
"end_byte": 450,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentArrayBindingPattern02.ts"
} |
TypeScript/tests/cases/fourslash/goToTypeDefinition_typedef.ts_0_246 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @Filename: /a.js
/////**
//// * /*def*/@typedef {object} I
//// * @property {number} x
//// */
////
/////** @type {I} */
////const /*ref*/i = { x: 0 };
verify.baselineGoToType("ref");
| {
"end_byte": 246,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToTypeDefinition_typedef.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromFunctionThisUsageObjectPropertyParameter.ts_0_488 | /// <reference path='fourslash.ts' />
// @noImplicitThis: true
////function returnThisMember([| |]suffix: string) {
//// return this.member + suffix;
//// }
////
//// interface Container {
//// member: string;
//// returnThisMember(suffix: string): string;
//// }
////
//// const container: Container = {
//// member: "sample",
//// returnThisMember: returnThisMember,
//// };
////
//// container.returnThisMember("");
verify.rangeAfterCodeFix("this: Container, ");
| {
"end_byte": 488,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromFunctionThisUsageObjectPropertyParameter.ts"
} |
TypeScript/tests/cases/fourslash/getImportsDuplicate.ts_0_347 | ///<reference path="fourslash.ts"/>
// @Filename: /first.ts
//// export function foo() {
//// return 1;
//// }
//// export function bar() {
//// return 2;
//// }
// @Filename: /index.ts
//// import { foo } from "./first";
//// import { bar } from './first';
//// console.log(foo() + bar())
verify.getImports('/index.ts', ['/first.ts'])
| {
"end_byte": 347,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getImportsDuplicate.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentInParenthesizedExpression01.ts_3_363 | / <reference path="fourslash.ts"/>
////var x = (/*1*/1/*2*/)/*3*/
function verifyIndentationAfterNewLine(marker: string, indentation: number): void {
goTo.marker(marker);
edit.insert("\n");
verify.indentationIs(indentation);
}
verifyIndentationAfterNewLine("1", 4);
verifyIndentationAfterNewLine("2", 4);
verifyIndentationAfterNewLine("3", 0); | {
"end_byte": 363,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentInParenthesizedExpression01.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_typeParameter2.ts_0_335 | /// <reference path="fourslash.ts" />
// @noUnusedLocals: true
// @noUnusedParameters: true
////function f<
//// T1, T2,
////
////
//// T3,
////>(a: T1, b: T3) {}
verify.codeFix({
index: 0,
description: "Remove unused declaration for: 'T2'",
newFileContent:
`function f<
T1,
T3,
>(a: T1, b: T3) {}`
});
| {
"end_byte": 335,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUnusedIdentifier_typeParameter2.ts"
} |
TypeScript/tests/cases/fourslash/formatDocumentPreserveTrailingWhitespace.ts_0_382 | /// <reference path="fourslash.ts" />
////
////var a;
////var b
////
//////
////function b(){
//// while(true){
//// }
////}
////
format.setOption("trimTrailingWhitespace", false);
format.document();
verify.currentFileContentIs(`
var a;
var b
//
function b() {
while (true) {
}
}
`);
| {
"end_byte": 382,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatDocumentPreserveTrailingWhitespace.ts"
} |
TypeScript/tests/cases/fourslash/renameDefaultImport.ts_0_546 | /// <reference path='fourslash.ts' />
// @Filename: B.ts
////[|export default class /*1*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}B|] {
//// test() {
//// }
////}|]
// @Filename: A.ts
////[|import /*2*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}B|] from "./B";|]
////let b = new [|B|]();
////b.test();
const [CDef, C, B0Def, B0, B1] = test.ranges();;
verify.baselineFindAllReferences('1', '2');
verify.baselineRename([C, B0, B1]);
verify.baselineDocumentHighlights("1"); | {
"end_byte": 546,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameDefaultImport.ts"
} |
TypeScript/tests/cases/fourslash/getEditsForFileRename_ambientModule.ts_0_486 | /// <reference path='fourslash.ts' />
// @Filename: /tsconfig.json
////{}
// @Filename: /sub/types.d.ts
// @Symlink: /node_modules/sub/types.d.ts
////declare module "sub" {
//// declare export const abc: number
////}
// @Filename: /sub/package.json
// @Symlink: /node_modules/sub/package.json
////{ "types": "types.d.ts" }
// @Filename: /a.ts
////import { abc } from "sub";
verify.getEditsForFileRename({
oldPath: "/a.ts",
newPath: "/b.ts",
newFileContents: {},
});
| {
"end_byte": 486,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEditsForFileRename_ambientModule.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingEnumMember4.ts_0_218 | /// <reference path='fourslash.ts' />
////enum E {
//// a = "a",
////}
////E.b
verify.codeFix({
description: "Add missing enum member 'b'",
newFileContent: `enum E {
a = "a",
b = "b",
}
E.b`
});
| {
"end_byte": 218,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingEnumMember4.ts"
} |
TypeScript/tests/cases/fourslash/duplicatePackageServices.ts_0_1008 | /// <reference path='fourslash.ts'/>
// @noImplicitReferences: true
// @Filename: /node_modules/a/index.d.ts
////import [|X/*useAX*/|] from "x";
////export function a(x: X): void;
// @Filename: /node_modules/a/node_modules/x/index.d.ts
////export default class /*defAX*/X {
//// private x: number;
////}
// @Filename: /node_modules/a/node_modules/x/package.json
////{ "name": "x", "version": "1.2.3" }
// @Filename: /node_modules/b/index.d.ts
////import [|X/*useBX*/|] from "x";
////export const b: X;
// @Filename: /node_modules/b/node_modules/x/index.d.ts
////export default class /*defBX*/X {
//// private x: number;
////}
// @Filename: /node_modules/b/node_modules/x/package.json
////{ "name": "x", "version": "1.2.3" }
// @Filename: /src/a.ts
////import { a } from "a";
////import { b } from "b";
////a(/*error*/b);
goTo.file("/src/a.ts");
verify.numberOfErrorsInCurrentFile(0);
verify.baselineFindAllReferences('useAX', 'defAX', 'useBX');
verify.baselineGoToDefinition("useAX", "useBX");
| {
"end_byte": 1008,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/duplicatePackageServices.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionDestructuredRequire2.ts_0_368 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: util.js
//// class /*2*/Util {}
//// module.exports = { Util };
// @Filename: reexport.js
//// const { Util } = require('./util');
//// module.exports = { Util };
// @Filename: index.js
//// const { Util } = require('./reexport');
//// new [|Util/*1*/|]()
verify.baselineGoToDefinition("1");
| {
"end_byte": 368,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionDestructuredRequire2.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationImports.ts_0_327 | /// <reference path='fourslash.ts' />
// @BaselineFile: bpSpan_imports.baseline
// @Filename: bpSpan_imports.ts
////import * as NS from "a";
////import {a as A} from "a";
//// import d from "a";
////import d2, {c, d as D} from "a";
////import "a";
////import e = require("a");
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 327,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationImports.ts"
} |
TypeScript/tests/cases/fourslash/codeFixForgottenThisPropertyAccess_all.ts_0_400 | /// <reference path='fourslash.ts' />
////class C {
//// foo: number;
//// m() {
//// foo;
//// foo;
//// }
////}
verify.codeFixAll({
fixId: "forgottenThisPropertyAccess",
fixAllDescription: "Add qualifier to all unresolved variables matching a member name",
newFileContent:
`class C {
foo: number;
m() {
this.foo;
this.foo;
}
}`,
});
| {
"end_byte": 400,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixForgottenThisPropertyAccess_all.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_interfaceAssignability.ts_0_635 | /// <reference path='fourslash.ts' />
////interface IFoo {
//// method(x: string, y: string): void;
////}
////const x: IFoo = {
//// method(/*a*/x: string, y: string, z?: string/*b*/): void {},
////};
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: `interface IFoo {
method({ x, y }: { x: string; y: string; }): void;
}
const x: IFoo = {
method({ x, y, z }: { x: string; y: string; z?: string; }): void {},
};`
});
| {
"end_byte": 635,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_interfaceAssignability.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpTaggedTemplatesWithOverloadedTags5.ts_0_671 | /// <reference path='fourslash.ts' />
//// function f(templateStrings: string[], p1_o1: string): number;
//// function f(templateStrings: string[], p1_o2: number, p2_o2: number, p3_o2: number): string;
//// function f(templateStrings: string[], p1_o3: string, p2_o3: boolean, p3_o3: number): boolean;
//// function f(...foo[]: any) { return ""; }
////
//// f `${ } ${/*1*/ /*2*/ /*3*/
verify.signatureHelp({
marker: test.markers(),
overloadsCount: 3,
text: "f(templateStrings: string[], p1_o2: number, p2_o2: number, p3_o2: number): string",
argumentCount: 3,
parameterCount: 4,
parameterName: "p2_o2",
parameterSpan: "p2_o2: number",
});
| {
"end_byte": 671,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpTaggedTemplatesWithOverloadedTags5.ts"
} |
TypeScript/tests/cases/fourslash/inlayHintsInteractiveFunctionParameterTypes2.ts_0_664 | /// <reference path="fourslash.ts" />
////class C {}
////namespace N { export class Foo {} }
////interface Foo {}
////function f1(a = 1) {}
////function f2(a = "a") {}
////function f3(a = true) {}
////function f4(a = { } as Foo) {}
////function f5(a = <Foo>{}) {}
////function f6(a = {} as const) {}
////function f7(a = (({} as const))) {}
////function f8(a = new C()) {}
////function f9(a = new N.C()) {}
////function f10(a = ((((new C()))))) {}
////function f11(a = { a: 1, b: 1 }) {}
////function f12(a = ((({ a: 1, b: 1 })))) {}
verify.baselineInlayHints(undefined, {
includeInlayFunctionParameterTypeHints: true,
interactiveInlayHints: true
});
| {
"end_byte": 664,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlayHintsInteractiveFunctionParameterTypes2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixWrapDecoratorInParentheses_all.ts_0_403 | /// <reference path='fourslash.ts' />
////declare var x: any;
////class C {
//// @x?.y
//// bar() {}
////
//// @x?.()
//// baz() {}
////}
verify.codeFixAll({
fixId: "wrapDecoratorInParentheses",
fixAllDescription: "Wrap all invalid decorator expressions in parentheses",
newFileContent:
`declare var x: any;
class C {
@(x?.y)
bar() {}
@(x?.())
baz() {}
}`
});
| {
"end_byte": 403,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixWrapDecoratorInParentheses_all.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageEmptyTypePriority.ts_0_441 | /// <reference path='fourslash.ts' />
// @strict: true
// based on acorn, translated to TS
////function TokenType([|label, conf |]) {
//// if ( conf === void 0 ) conf = {};
////
//// var l = label;
//// var keyword = conf.keyword;
//// var beforeExpr = !!conf.beforeExpr;
////};
verify.rangeAfterCodeFix("label: any, conf: { keyword?: any; beforeExpr?: any; } | undefined",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0);
| {
"end_byte": 441,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageEmptyTypePriority.ts"
} |
TypeScript/tests/cases/fourslash/completionsCommentsClassMembers.ts_0_4042 | /// <reference path='fourslash.ts' />
/////** This is comment for c1*/
////class c1 {
//// /** p1 is property of c1*/
//// public p1: number;
//// /** sum with property*/
//// public p2(/** number to add*/b: number) {
//// return this./*4*/p1 + /*5*/b;
//// }
//// /** getter property 1*/
//// public get p3() {
//// return this./*7*/p2(this./*9*/p1);
//// }
//// /** setter property 1*/
//// public set p3(/** this is value*/value: number) {
//// this./*11*/p1 = this./*12*/p2(/*13*/value);
//// }
//// /** pp1 is property of c1*/
//// private pp1: number;
//// /** sum with property*/
//// private pp2(/** number to add*/b: number) {
//// return this./*16*/p1 + /*17*/b;
//// }
//// /** getter property 2*/
//// private get pp3() {
//// return this./*19*/pp2(this./*21*/pp1);
//// }
//// /** setter property 2*/
//// private set pp3( /** this is value*/value: number) {
//// this./*23*/pp1 = this./*24*/pp2(/*25*/value);
//// }
//// /** Constructor method*/
//// constructor() {
//// }
//// /** s1 is static property of c1*/
//// static s1: number;
//// /** static sum with property*/
//// static s2(/** number to add*/b: number) {
//// return /*29*/c1./*30*/s1 + /*31*/b;
//// }
//// /** static getter property*/
//// static get s3() {
//// return /*33*/c1./*34*/s2(/*35*/c1./*36*/s1);
//// }
//// /** setter property 3*/
//// static set s3( /** this is value*/value: number) {
//// /*38*/c1./*39*/s1 = /*40*/c1./*41*/s2(/*42*/value);
//// }
//// public nc_p1: number;
//// public nc_p2(b: number) {
//// return this.nc_p1 + /*45*/b;
//// }
//// public get nc_p3() {
//// return this.nc_p2(this.nc_p1);
//// }
//// public set nc_p3(value: number) {
//// this.nc_p1 = this.nc_p2(/*49*/value);
//// }
//// private nc_pp1: number;
//// private nc_pp2(b: number) {
//// return this.nc_pp1 + /*52*/b;
//// }
//// private get nc_pp3() {
//// return this.nc_pp2(this.nc_pp1);
//// }
//// private set nc_pp3(value: number) {
//// this.nc_pp1 = this.nc_pp2(/*56*/value);
//// }
//// static nc_s1: number;
//// static nc_s2(b: number) {
//// return c1.nc_s1 + /*59*/b;
//// }
//// static get nc_s3() {
//// return c1.nc_s2(c1.nc_s1);
//// }
//// static set nc_s3(value: number) {
//// c1.nc_s1 = c1.nc_s2(/*63*/value);
//// }
////}
////var i1 = new c1();
////var i1_p = i1./*67*/p1;
////var i1_f = i1.p2;
////var i1_r = i1.p2(20);
////var i1_prop = i1.p3;
////i1.p3 = i1_prop;
////var i1_nc_p = i1.nc_p1;
////var i1_ncf = i1.nc_p2;
////var i1_ncr = i1.nc_p2(20);
////var i1_ncprop = i1.nc_p3;
////i1.nc_p3 = i1_ncprop;
////var i1_s_p = /*87*/c1./*88*/s1;
////var i1_s_f = c1.s2;
////var i1_s_r = c1.s2(20);
////var i1_s_prop = c1.s3;
////c1.s3 = i1_s_prop;
////var i1_s_nc_p = c1.nc_s1;
////var i1_s_ncf = c1.nc_s2;
////var i1_s_ncr = c1.nc_s2(20);
////var i1_s_ncprop = c1.nc_s3;
////c1.nc_s3 = i1_s_ncprop;
////var i1_c = c1;
/////*109*/
////class cProperties {
//// private val: number;
//// /** getter only property*/
//// public get p1() {
//// return this.val;
//// }
//// public get nc_p1() {
//// return this.val;
//// }
//// /**setter only property*/
//// public set p2(value: number) {
//// this.val = value;
//// }
//// public set nc_p2(value: number) {
//// this.val = value;
//// }
////}
////var cProperties_i = new cProperties();
////cProperties_i./*110*/p2 = cProperties_i.p1;
////cProperties_i.nc_p2 = cProperties_i.nc_p1;
////class cWithConstructorProperty {
//// /**
//// * this is class cWithConstructorProperty's constructor
//// * @param a this is first parameter a
//// */
//// constructor(/**more info about a*/public a: number) {
//// var bbbb = 10;
//// this./*114*/a = /*115*/a + 2 + bbbb;
//// }
////}
verify.baselineCompletions()
| {
"end_byte": 4042,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsCommentsClassMembers.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageVariableLiteral.ts_0_261 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
//// let [|text! |];
//// text.length;
//// text.indexOf("z");
//// text.charAt(0);
verify.rangeAfterCodeFix("text!: string", /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, /*index*/0);
| {
"end_byte": 261,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageVariableLiteral.ts"
} |
TypeScript/tests/cases/fourslash/typeExtractionDoesNotDuplicateTrailingComment.ts_0_1606 | /// <reference path='fourslash.ts' />
/// Doesn't duplicate comments - #31629
//// type a = /*a*/{ x: string } /* foo */ | string /* bar *//*b*/;
//// type b = /*c*//* leading */{ x: string } /* trailing *//*d*/;
//// type c = /*e*/{ x: string } /* inner */ | string// trailing/*f*/
////
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType = {
x: string;
} /* foo */ | string /* bar */;
type a = NewType;
type b = /* leading */{ x: string } /* trailing */;
type c = { x: string } /* inner */ | string// trailing
`,
});
// Extract to interface
goTo.select("c", "d");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to interface",
actionDescription: "Extract to interface",
newContent: `type NewType = {
x: string;
} /* foo */ | string /* bar */;
type a = NewType;
interface /*RENAME*/NewType_1 {
x: string;
} /* trailing */
type b = /* leading */NewType_1;
type c = { x: string } /* inner */ | string// trailing
`,
});
// Trailing comment using '//'
goTo.select("e", "f");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `type NewType = {
x: string;
} /* foo */ | string /* bar */;
type a = NewType;
interface NewType_1 {
x: string;
} /* trailing */
type b = /* leading */NewType_1;
type /*RENAME*/NewType_2 = {
x: string;
} /* inner */ | string // trailing
;
type c = NewType_2
`,
});
| {
"end_byte": 1606,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/typeExtractionDoesNotDuplicateTrailingComment.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_filteredByInvalidPackageJson_direct.ts_0_1134 | /// <reference path="fourslash.ts" />
//@noEmit: true
//@Filename: /package.json
////{
//// "mod"
//// "dependencies": {
//// "react": "*"
//// }
////}
//@Filename: /node_modules/react/index.d.ts
////export declare var React: any;
//@Filename: /node_modules/react/package.json
////{
//// "name": "react",
//// "types": "./index.d.ts"
////}
//@Filename: /node_modules/fake-react/index.d.ts
////export declare var ReactFake: any;
//@Filename: /node_modules/fake-react/package.json
////{
//// "name": "fake-react",
//// "types": "./index.d.ts"
////}
//@Filename: /src/index.ts
////const x = Re/**/
verify.completions({
marker: test.marker(""),
isNewIdentifierLocation: true,
includes: [{
name: "React",
hasAction: true,
source: "/node_modules/react/index",
sortText: completion.SortText.AutoImportSuggestions
},
{
name: "ReactFake",
hasAction: true,
source: "/node_modules/fake-react/index",
sortText: completion.SortText.AutoImportSuggestions
}
],
preferences: {
includeCompletionsForModuleExports: true
}
});
| {
"end_byte": 1134,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_filteredByInvalidPackageJson_direct.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassImplementClassMultipleSignatures2.ts_0_907 | /// <reference path='fourslash.ts' />
////class A {
//// method(a: any, b: string): boolean;
//// method(a: string, b: number): Function;
//// method(a: string): Function;
//// method(a: string | number, b?: string | number): boolean | Function { return a + b as any; }
////}
////class C implements A { }
verify.codeFix({
description: "Implement interface 'A'",
newFileContent:
`class A {
method(a: any, b: string): boolean;
method(a: string, b: number): Function;
method(a: string): Function;
method(a: string | number, b?: string | number): boolean | Function { return a + b as any; }
}
class C implements A {
method(a: any, b: string): boolean;
method(a: string, b: number): Function;
method(a: string): Function;
method(a: string | number, b?: string | number): boolean | Function {
throw new Error("Method not implemented.");
}
}`,
});
| {
"end_byte": 907,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementClassMultipleSignatures2.ts"
} |
TypeScript/tests/cases/fourslash/completionListInObjectLiteralThatIsParameterOfFunctionCall.ts_0_180 | /// <reference path='fourslash.ts'/>
////function f(a: { xa: number; xb: number; }) { }
////var xc;
////f({
//// /**/
verify.completions({ marker: "", exact: ["xa", "xb"] });
| {
"end_byte": 180,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInObjectLiteralThatIsParameterOfFunctionCall.ts"
} |
TypeScript/tests/cases/fourslash/singleLineTypeLiteralFormatting.ts_0_180 | /// <reference path='fourslash.ts' />
//// function of1(b: { r: { c: number/**/
goTo.marker();
edit.insert(';');
verify.currentLineContentIs('function of1(b: { r: { c: number;'); | {
"end_byte": 180,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/singleLineTypeLiteralFormatting.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoJsDocTags5.ts_0_599 | /// <reference path="fourslash.ts" />
// @noEmit: true
// @allowJs: true
// @Filename: quickInfoJsDocTags5.js
////class Foo {
//// /**
//// * comment
//// * @author Me <me@domain.tld>
//// * @see x (the parameter)
//// * @param {number} x - x comment
//// * @param {number} y - y comment
//// * @returns The result
//// */
//// method(x, y) {
//// return x + y;
//// }
////}
////
////class Bar extends Foo {
//// /**/method(x, y) {
//// const res = super.method(x, y) + 100;
//// return res;
//// }
////}
verify.baselineQuickInfo();
| {
"end_byte": 599,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoJsDocTags5.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsPrimitive.ts_0_868 | // @noLib: true
/// <reference path='fourslash.ts'/>
// @Filename: a.ts
////const x: /*1*/[|any|] = 0;
////const any = 2;
////const y: /*2*/[|any|] = any;
////function f(b: /*3*/[|boolean|]): /*4*/[|boolean|];
////type T = /*5*/[|never|]; type U = /*6*/[|never|];
////function n(x: /*7*/[|number|]): /*8*/[|number|];
////function o(x: /*9*/[|object|]): /*10*/[|object|];
////function s(x: /*11*/[|string|]): /*12*/[|string|];
////function sy(s: /*13*/[|symbol|]): /*14*/[|symbol|];
////function v(v: /*15*/[|void|]): /*16*/[|void|];
// @Filename: b.ts
//// const z: /*17*/[|any|] = 0;
verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17');
verify.baselineDocumentHighlights(undefined, { filesToSearch: ["a.ts", "b.ts"] });
goTo.rangeStart(test.ranges()[0]);
verify.renameInfoFailed();
| {
"end_byte": 868,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsPrimitive.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToEsModule_export_named.ts_0_739 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @target: esnext
// @Filename: /a.js
////[|exports.f|] = function() {};
////exports.C = class {};
////exports.x = 0;
////exports.a1 = () => {};
////exports.a2 = () => 0;
////exports.a3 = x => { x; };
////exports.a4 = x => x;
const [r0, r1, r2] = test.ranges();
verify.getSuggestionDiagnostics([
{ message: "File is a CommonJS module; it may be converted to an ES module.", code: 80001, range: r0 },
]);
verify.codeFix({
description: "Convert to ES module",
newFileContent:
`export function f() {}
export class C {}
export const x = 0;
export function a1() {}
export function a2() { return 0; }
export function a3(x) { x; }
export function a4(x) { return x; }`,
});
| {
"end_byte": 739,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToEsModule_export_named.ts"
} |
TypeScript/tests/cases/fourslash/codeFixChangeJSDocSyntax7.ts_0_170 | /// <reference path='fourslash.ts' />
//// var x: [|!number|] = 12;
verify.codeFix({
description: "Change '!number' to 'number'",
newRangeContent: "number",
});
| {
"end_byte": 170,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixChangeJSDocSyntax7.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsForStringLiteral.ts_0_257 | /// <reference path="fourslash.ts" />
// @filename: /a.ts
////interface Foo {
//// property: /**/"foo";
////}
/////**
//// * @type {{ property: "foo"}}
//// */
////const obj: Foo = {
//// property: "foo",
////}
verify.baselineFindAllReferences("");
| {
"end_byte": 257,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsForStringLiteral.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageVariable3.ts_0_250 | /// <reference path='fourslash.ts' />
// @noImplicitAny: false
////[|var x;
////function f() {
//// x++;
////}|]
verify.rangeAfterCodeFix(`var x: number;
function f() {
x++;
}
`, /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0);
| {
"end_byte": 250,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageVariable3.ts"
} |
TypeScript/tests/cases/fourslash/completionListFunctionMembers.ts_0_218 | /// <reference path='fourslash.ts'/>
////function fnc1() {
//// var bar = 1;
//// function foob(){ }
////}
////
////fnc1./**/
verify.completions({ marker: "", exact: completion.functionMembersWithPrototype });
| {
"end_byte": 218,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListFunctionMembers.ts"
} |
TypeScript/tests/cases/fourslash/referencesForIllegalAssignment.ts_0_172 | /// <reference path='fourslash.ts'/>
////f/*1*/oo = fo/*2*/o;
////var /*bar*/bar = function () { };
////bar = bar + 1;
verify.baselineFindAllReferences('1', '2', 'bar')
| {
"end_byte": 172,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForIllegalAssignment.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddParameterNames1.ts_0_141 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
////var x: ([|number |]) => string;
verify.rangeAfterCodeFix("arg0: number");
| {
"end_byte": 141,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddParameterNames1.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateParenthFromOpening.ts_0_388 | /// <reference path='fourslash.ts' />
//// const foo = "foobar is " + /*x*/(/*y*/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_ToTemplateParenthFromOpening.ts"
} |
TypeScript/tests/cases/fourslash/completionListAtEndOfWordInArrowFunction02.ts_0_364 | /// <reference path='fourslash.ts' />
////(d, defaultIsAnInvalidParameterName) => d/*1*/
verify.completions({
marker: "1",
// TODO: should not include 'default' keyword at an expression location
includes: [
"d",
"defaultIsAnInvalidParameterName",
{ name: "default", sortText: completion.SortText.GlobalsOrKeywords }
]
});
| {
"end_byte": 364,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListAtEndOfWordInArrowFunction02.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_inferQuoteStyle2.ts_0_371 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////export const x = 0;
////x;
// @Filename: /b.ts
////import { x } from './a'
////
////[|x|];
verify.moveToNewFile({
newFileContents: {
"/newFile.ts": // module specifier should have the same quotes as import in the original file
`import { x } from './a';
x;
`,
"/b.ts":
`
`
},
});
| {
"end_byte": 371,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_inferQuoteStyle2.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoShowsGenericSpecialization.ts_0_139 | /// <reference path='fourslash.ts'/>
////class A<T> { }
////var /**/foo = new A<number>();
verify.quickInfoAt("", "var foo: A<number>");
| {
"end_byte": 139,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoShowsGenericSpecialization.ts"
} |
TypeScript/tests/cases/fourslash/codeFixDeleteUnmatchedParameter5.ts_0_345 | /// <reference path='fourslash.ts' />
// @filename: a.ts
/////**
//// * @param {number} n
//// * @returns
//// */
////export const foo = (z: number) => 0;
verify.codeFix({
description: [ts.Diagnostics.Delete_unused_param_tag_0.message, "n"],
index: 0,
newFileContent:
`/**
* @returns
*/
export const foo = (z: number) => 0;`
});
| {
"end_byte": 345,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixDeleteUnmatchedParameter5.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationDestructuringForArrayBindingPattern.ts_0_3357 | /// <reference path='fourslash.ts' />
////declare var console: {
//// log(msg: any): void;
////}
////type Robot = [number, string, string];
////type MultiSkilledRobot = [string, [string, string]];
////
////let robotA: Robot = [1, "mower", "mowing"];
////function getRobot() {
//// return robotA;
////}
////
////let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
////let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
////function getMultiRobot() {
//// return multiRobotA;
////}
////
////for (let [, nameA] = robotA, i = 0; i < 1; i++) {
//// console.log(nameA);
////}
////for (let [, nameA] = getRobot(), i = 0; i < 1; i++) {
//// console.log(nameA);
////}
////for (let [, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
//// console.log(nameA);
////}
////for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) {
//// console.log(primarySkillA);
////}
////for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) {
//// console.log(primarySkillA);
////}
////for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) {
//// console.log(primarySkillA);
////}
////
////for (let [numberB] = robotA, i = 0; i < 1; i++) {
//// console.log(numberB);
////}
////for (let [numberB] = getRobot(), i = 0; i < 1; i++) {
//// console.log(numberB);
////}
////for (let [numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
//// console.log(numberB);
////}
////for (let [nameB] = multiRobotA, i = 0; i < 1; i++) {
//// console.log(nameB);
////}
////for (let [nameB] = getMultiRobot(), i = 0; i < 1; i++) {
//// console.log(nameB);
////}
////for (let [nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) {
//// console.log(nameB);
////}
////
////for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) {
//// console.log(nameA2);
////}
////for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) {
//// console.log(nameA2);
////}
////for (let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
//// console.log(nameA2);
////}
////for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) {
//// console.log(nameMA);
////}
////for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) {
//// console.log(nameMA);
////}
////for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) {
//// console.log(nameMA);
////}
////
////for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) {
//// console.log(numberA3);
////}
////for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) {
//// console.log(numberA3);
////}
////for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
//// console.log(numberA3);
////}
////for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) {
//// console.log(multiRobotAInfo);
////}
////for (let [...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) {
//// console.log(multiRobotAInfo);
////}
////for (let [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) {
//// console.log(multiRobotAInfo);
////}
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 3357,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationDestructuringForArrayBindingPattern.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesReturn2.ts_0_487 | /// <reference path='fourslash.ts' />
////function f(a: number) {
//// if (a > 0) {
//// return (function () {
//// [|return|];
//// [|ret/**/urn|];
//// [|return|];
////
//// while (false) {
//// [|return|] true;
//// }
//// })() || true;
//// }
////
//// var unusued = [1, 2, 3, 4].map(x => { return 4 })
////
//// return;
//// return true;
////}
verify.baselineDocumentHighlights();
| {
"end_byte": 487,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesReturn2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports14.ts_0_533 | /// <reference path='fourslash.ts'/>
// @isolatedDeclarations: true
// @declaration: true
//// function foo() {
//// return { x: 1, y: 1};
//// }
//// export const { x, y = 0} = foo(), z= 42;
verify.codeFix({
description: ts.Diagnostics.Extract_binding_expressions_to_variable.message,
index: 0,
newFileContent:
`function foo() {
return { x: 1, y: 1};
}
const dest = foo();
export const x: number = dest.x;
const temp = dest.y;
export const y: number = temp === undefined ? 0 : dest.y;
export const z = 42;`});
| {
"end_byte": 533,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports14.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesProtected1.ts_0_1498 | /// <reference path='fourslash.ts' />
////module m {
//// export class C1 {
//// public pub1;
//// public pub2;
//// private priv1;
//// private priv2;
//// [|protected|] prot1;
//// [|protected|] prot2;
////
//// public public;
//// private private;
//// [|protected|] protected;
////
//// public constructor(public a, private b, [|protected|] c, public d, private e, [|protected|] f) {
//// this.public = 10;
//// this.private = 10;
//// this.protected = 10;
//// }
////
//// public get x() { return 10; }
//// public set x(value) { }
////
//// public static statPub;
//// private static statPriv;
//// [|protected|] static statProt;
//// }
////
//// export interface I1 {
//// }
////
//// export declare module ma.m1.m2.m3 {
//// interface I2 {
//// }
//// }
////
//// export module mb.m1.m2.m3 {
//// declare var foo;
////
//// export class C2 {
//// public pub1;
//// private priv1;
//// protected prot1;
////
//// protected constructor(public public, protected protected, private private) {
//// public = private = protected;
//// }
//// }
//// }
////
//// declare var ambientThing: number;
//// export var exportedThing = 10;
//// declare function foo(): string;
////}
verify.baselineDocumentHighlights();
| {
"end_byte": 1498,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesProtected1.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationNamespace_04.ts_0_631 | /// <reference path='fourslash.ts'/>
// Should handle types that are members of a module in type references and heritage clauses
//// module Foo {
//// export interface Bar {
//// hello(): void;
//// }
////
//// class [|BarImpl|] implements Bar {
//// hello() {}
//// }
//// }
////
//// class [|Baz|] implements Foo.Bar {
//// hello() {}
//// }
////
//// var someVar1 : Foo.Bar = [|{ hello: () => {/**1*/} }|];
////
//// var someVar2 = <Foo.Bar> [|{ hello: () => {/**2*/} }|];
////
//// function whatever(x: Foo.Ba/*reference*/r) {
////
//// }
verify.baselineGoToImplementation("reference");
| {
"end_byte": 631,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationNamespace_04.ts"
} |
TypeScript/tests/cases/fourslash/extractTypeUnresolvedAlias.ts_0_259 | /// <reference path="fourslash.ts" />
//// import {Renderer} from '';
////
//// export class X {
//// constructor(renderer: /**/[|Renderer|]) {}
//// }
goTo.selectRange(test.ranges()[0]);
verify.refactorAvailable("Extract type", "Extract to type alias"); | {
"end_byte": 259,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extractTypeUnresolvedAlias.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_parameter_modifier_and_arg.ts_0_339 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @noUnusedParameters: true
////export class Example {
//// constructor(private readonly arg: any) {
//// }
////}
verify.codeFix({
description: "Remove unused declaration for: 'arg'",
newFileContent:
`export class Example {
constructor() {
}
}`,
});
| {
"end_byte": 339,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUnusedIdentifier_parameter_modifier_and_arg.ts"
} |
TypeScript/tests/cases/fourslash/inlineVariableOnlyDeclaration.ts_0_159 | /// <reference path="fourslash.ts" />
////const /*a*/x/*b*/ = 0;
////const y = 1 + 2;
goTo.select("a", "b");
verify.not.refactorAvailable("Inline variable"); | {
"end_byte": 159,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlineVariableOnlyDeclaration.ts"
} |
TypeScript/tests/cases/fourslash/autoCloseTag.ts_0_1078 | /// <reference path='fourslash.ts' />
// Using separate files for each example to avoid unclosed JSX tags affecting other tests.
// @Filename: /0.tsx
////const x = <div>/*0*/;
// @Filename: /1.tsx
////const x = <div> foo/*1*/ </div>;
// @Filename: /2.tsx
////const x = <div></div>/*2*/;
// @Filename: /3.tsx
////const x = <div/>/*3*/;
// @Filename: /4.tsx
////const x = <div>
//// <p>/*4*/
//// </div>
////</p>;
// @Filename: /5.tsx
////const x = <div> text /*5*/;
// @Filename: /6.tsx
////const x = <div>
//// <div>/*6*/
////</div>;
// @Filename: /7.tsx
////const x = <div>
//// <p>/*7*/
////</div>;
// @Filename: /8.tsx
////const x = <div>
//// <div>/*8*/</div>
////</div>;
// @Filename: /9.tsx
////const x = <p>
//// <div>
//// <div>/*9*/
//// </div>
////</p>
verify.jsxClosingTag({
0: { newText: "</div>" },
1: undefined,
2: undefined,
3: undefined,
4: { newText: "</p>" },
5: { newText: "</div>" },
6: { newText: "</div>" },
7: { newText: "</p>" },
8: undefined,
9: { newText: "</div>" },
});
| {
"end_byte": 1078,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoCloseTag.ts"
} |
TypeScript/tests/cases/fourslash/deleteExtensionInReopenedInterface.ts_0_494 | /// <reference path="fourslash.ts" />
//// interface A { a: number; }
//// interface B { b: number; }
////
//// interface I /*del*/extends A { }
//// interface I extends B { }
////
//// var i: I;
//// class C /*delImplements*/implements A { }
//// var c: C;
//// c.a;
goTo.marker('del');
edit.deleteAtCaret('extends A'.length);
goTo.eof();
edit.insert("var a = i.a;");
goTo.marker('delImplements');
edit.deleteAtCaret('implements A'.length);
goTo.marker('del');
edit.insert('extends A'); | {
"end_byte": 494,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/deleteExtensionInReopenedInterface.ts"
} |
TypeScript/tests/cases/fourslash/codeFixReturnTypeInAsyncFunction5.ts_0_271 | /// <reference path='fourslash.ts' />
// @target: es2015
////async function fn(): null {}
verify.codeFix({
index: 0,
description: [ts.Diagnostics.Replace_0_with_Promise_1.message, "null", "null"],
newFileContent: `async function fn(): Promise<null> {}`
});
| {
"end_byte": 271,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixReturnTypeInAsyncFunction5.ts"
} |
TypeScript/tests/cases/fourslash/assertContextualType.ts_0_145 | /// <reference path='fourslash.ts' />
////<(aa: number) =>void >(function myFn(b/**/b) { });
verify.quickInfoAt("", "(parameter) bb: number");
| {
"end_byte": 145,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/assertContextualType.ts"
} |
TypeScript/tests/cases/fourslash/completionListOnParamInClass.ts_0_205 | /// <reference path='fourslash.ts' />
////export class encoder {
//// static getEncoding(buffer: buffer/**/Pointer
////}
verify.completions({ marker: "", includes: "encoder", excludes: "parseInt" });
| {
"end_byte": 205,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListOnParamInClass.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddOptionalParam12.ts_0_258 | /// <reference path="fourslash.ts" />
////function f([|cb = () => {}|]) {
//// cb("");
////}
verify.codeFix({
description: [ts.Diagnostics.Add_optional_parameter_to_0.message, "cb"],
index: 1,
newRangeContent: "cb = (p0?: string) => {}"
});
| {
"end_byte": 258,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddOptionalParam12.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_arrowFunction.ts_0_448 | /// <reference path='fourslash.ts' />
////const foo = /*a*/(a: number, b: number)/*b*/ => { };
////foo(1, 2);
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: `const foo = ({ a, b }: { a: number; b: number; }) => { };
foo({ a: 1, b: 2 });`
}); | {
"end_byte": 448,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_arrowFunction.ts"
} |
TypeScript/tests/cases/fourslash/codeFixCannotFindModule_notIfMissing.ts_0_246 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////import {} from "abs";
test.setTypesRegistry({
"abs": undefined,
});
// We only give the fix for an implicit-any module, not for a missing module.
verify.not.codeFixAvailable();
| {
"end_byte": 246,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCannotFindModule_notIfMissing.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_default_addToNamespaceImport.ts_0_725 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////export default function foo() {}
// @Filename: /b.ts
////import * as a from "./a";
////f/**/;
verify.completions({
marker: "",
includes: {
name: "foo",
source: "/a",
sourceDisplay: "./a",
text: "function foo(): void",
kind: "function",
kindModifiers: "export",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
preferences: { includeCompletionsForModuleExports: true },
});
verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/a",
description: `Update import from "./a"`,
newFileContent: `import foo, * as a from "./a";
f;`,
});
| {
"end_byte": 725,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_default_addToNamespaceImport.ts"
} |
TypeScript/tests/cases/fourslash/getEditsForFileRename_tsconfig_include_noChange.ts_0_267 | /// <reference path='fourslash.ts' />
// @Filename: /src/tsconfig.json
////{
//// "include": ["dir"],
////}
// @Filename: /src/dir/a.ts
////
verify.getEditsForFileRename({
oldPath: "/src/dir/a.ts",
newPath: "/src/dir/b.ts",
newFileContents: {},
});
| {
"end_byte": 267,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEditsForFileRename_tsconfig_include_noChange.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportTypeRoots0.ts_0_487 | /// <reference path="fourslash.ts" />
// @Filename: a/f1.ts
//// [|foo/*0*/();|]
// @Filename: types/random/index.ts
//// export function foo() {};
// @Filename: tsconfig.json
//// {
//// "compilerOptions": {
//// "typeRoots": [
//// "./types"
//// ]
//// }
//// }
// "typeRoots" does not affect module resolution. Importing from "random" would be a compile error.
verify.importFixAtPosition([
`import { foo } from "../types/random";
foo();`
]);
| {
"end_byte": 487,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportTypeRoots0.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports41-no-computed-enum-members.ts_0_202 | /// <reference path='fourslash.ts'/>
// @isolatedDeclarations: true
// @declaration: true
// @lib: es2019
// @Filename: /code.ts
////enum E {
//// A = "foo".length
////}
verify.codeFixAvailable([]) | {
"end_byte": 202,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports41-no-computed-enum-members.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarWellKnownSymbolExpando.ts_0_865 | /// <reference path="fourslash.ts"/>
////function f() {}
////f[Symbol.iterator] = function() {}
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "f",
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
},
{
"text": "[Symbol.iterator]",
"kind": "function"
}
]
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "f",
"kind": "class"
}
]
},
{
"text": "f",
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
},
{
"text": "[Symbol.iterator]",
"kind": "function"
}
],
"indent": 1
}
]);
| {
"end_byte": 865,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarWellKnownSymbolExpando.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsDefaultImport.ts_0_203 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////export default function /*0*/a() {}
// @Filename: /b.ts
////import /*1*/a, * as ns from "./a";
verify.baselineFindAllReferences('0', '1')
| {
"end_byte": 203,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsDefaultImport.ts"
} |
TypeScript/tests/cases/fourslash/extract-method_jsxIntrinsicTagSymbol.ts_0_435 | /// <reference path='fourslash.ts' />
// @Filename: /a.tsx
// Test that we don't get `unknownSymbol`, which causes a crash when we try getting its declarations.
/////*a*/<div></div>/*b*/
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "constant_scope_0",
actionDescription: "Extract to constant in enclosing scope",
newContent: "const /*RENAME*/newLocal = <div></div>;",
});
| {
"end_byte": 435,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method_jsxIntrinsicTagSymbol.ts"
} |
TypeScript/tests/cases/fourslash/getEditsForFileRename_amd.ts_0_353 | /// <reference path='fourslash.ts' />
// @moduleResolution: classic
// @Filename: /src/user.ts
////import { x } from "old";
// @Filename: /src/old.ts
////export const x = 0;
verify.getEditsForFileRename({
oldPath: "/src/old.ts",
newPath: "/src/new.ts",
newFileContents: {
"/src/user.ts":
`import { x } from "./new";`,
},
});
| {
"end_byte": 353,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEditsForFileRename_amd.ts"
} |
TypeScript/tests/cases/fourslash/quickfixAddMissingConstraint2.ts_0_398 | /// <reference path="fourslash.ts" />
// @Filename: file.ts
////interface Fn<T extends string> {
////}
////
////function m<T>(x: Fn<T/**/>) {
////}
goTo.marker("");
verify.codeFix({
index: 0,
description: "Add `extends` constraint.",
newFileContent: {
"/tests/cases/fourslash/file.ts":
`interface Fn<T extends string> {
}
function m<T extends string>(x: Fn<T>) {
}`
}
});
| {
"end_byte": 398,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickfixAddMissingConstraint2.ts"
} |
TypeScript/tests/cases/fourslash/completionListInUnclosedIndexSignature03.ts_0_163 | /// <reference path='fourslash.ts' />
////class C {
//// [foo: string]: { x: typeof /*1*/
////}
verify.completions({ marker: "1", includes: ["foo", "C"] });
| {
"end_byte": 163,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedIndexSignature03.ts"
} |
TypeScript/tests/cases/fourslash/constructorFindAllReferences3.ts_0_184 | /// <reference path="fourslash.ts" />
////export class C {
//// /**/constructor() { }
//// public foo() { }
////}
////
////new C().foo();
verify.baselineFindAllReferences("");
| {
"end_byte": 184,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/constructorFindAllReferences3.ts"
} |
TypeScript/tests/cases/fourslash/exhaustiveCaseCompletions5.ts_0_695 | /// <reference path="fourslash.ts" />
// Filter existing values.
// @newline: LF
//// enum P {
//// " Space",
//// Bar,
//// }
////
//// declare const p: P;
////
//// switch (p) {
//// /*1*/
//// }
verify.completions(
{
marker: "1",
isNewIdentifierLocation: false,
includes: [
{
name: `case P[" Space"]: ...`,
source: completion.CompletionSource.SwitchCases,
sortText: completion.SortText.GlobalsOrKeywords,
insertText:
`case P[" Space"]:
case P.Bar:`,
},
],
preferences: {
includeCompletionsWithInsertText: true,
},
},
); | {
"end_byte": 695,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/exhaustiveCaseCompletions5.ts"
} |
TypeScript/tests/cases/fourslash/getEmitOutputWithDeclarationFile2.ts_0_392 | /// <reference path="fourslash.ts" />
// @BaselineFile: getEmitOutputWithDeclarationFile2.baseline
// @module: CommonJS
// @Filename: decl.d.ts
// @emitThisFile: true
//// interface I { a: string; }
// @Filename: inputFile2.ts
// @emitThisFile: true
//// export class Foo { }
// @Filename: inputFile3.ts
// @emitThisFile: true
//// var x:string = "hello";
verify.baselineGetEmitOutput(); | {
"end_byte": 392,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEmitOutputWithDeclarationFile2.ts"
} |
TypeScript/tests/cases/fourslash/completionListStaticProtectedMembers3.ts_0_1044 | /// <reference path='fourslash.ts'/>
////class Base {
//// private static privateMethod() { }
//// private static privateProperty;
////
//// protected static protectedMethod() { }
//// protected static protectedProperty;
////
//// public static publicMethod() { }
//// public static publicProperty;
////
//// protected static protectedOverriddenMethod() { }
//// protected static protectedOverriddenProperty;
////}
////
////class C3 extends Base {
//// protected static protectedOverriddenMethod() { }
//// protected static protectedOverriddenProperty;
////}
////
////Base./*1*/;
////C3./*2*/;
// Only public properties are visible outside the class
verify.completions({
marker: ["1", "2"],
exact: completion.functionMembersPlus([
{ name: "publicMethod", sortText: completion.SortText.LocalDeclarationPriority },
{ name: "publicProperty", sortText: completion.SortText.LocalDeclarationPriority },
{ name: "prototype", sortText: completion.SortText.LocationPriority },
]),
});
| {
"end_byte": 1044,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListStaticProtectedMembers3.ts"
} |
TypeScript/tests/cases/fourslash/externalModuleWithExportAssignment.ts_0_2909 | /// <reference path='fourslash.ts' />
// @Filename: externalModuleWithExportAssignment_file0.ts
////module m2 {
//// export interface connectModule {
//// (res, req, next): void;
//// }
//// export interface connectExport {
//// use: (mod: connectModule) => connectExport;
//// listen: (port: number) => void;
//// }
////}
////var m2: {
//// (): m2.connectExport;
//// test1: m2.connectModule;
//// test2(): m2.connectModule;
////};
////export = m2;
// @Filename: externalModuleWithExportAssignment_file1.ts
////import /*1*/a1 = require("./externalModuleWithExportAssignment_file0");
////export var /*2*/a = a1;
////a./*3*/test1(/*4*/null, null, null);
////var /*6*/r1 = a.test2(/*5*/);
////var /*8*/r2 = a(/*7*/);
////a1./*9*/test1(/*10*/null, null, null);
////var /*12*/r3 = a1.test2(/*11*/);
////var /*14*/r4 = a1(/*13*/);
////var v1: a1./*15*/connectExport;
goTo.file("externalModuleWithExportAssignment_file1.ts");
verify.quickInfoAt("1", [
"(alias) namespace a1",
"(alias) var a1: {",
" (): a1.connectExport;",
" test1: a1.connectModule;",
" test2(): a1.connectModule;",
"}",
'import a1 = require("./externalModuleWithExportAssignment_file0")'
].join("\n"));
verify.quickInfoAt("2", [
"var a: {",
" (): a1.connectExport;",
" test1: a1.connectModule;",
" test2(): a1.connectModule;",
"}"
].join("\n"), undefined);
goTo.marker('3');
verify.quickInfoIs("(property) test1: a1.connectModule\n(res: any, req: any, next: any) => void", undefined);
verify.completions({
marker: ["3", "9"],
exact: completion.functionMembersWithPrototypePlus([
{ name: "test1", text: "(property) test1: a1.connectModule\n(res: any, req: any, next: any) => void" },
{ name: "test2", text: "(method) test2(): a1.connectModule" },
]),
});
verify.signatureHelp(
{ marker: "4", text: "test1(res: any, req: any, next: any): void" },
{ marker: "5", text: "test2(): a1.connectModule" },
);
verify.quickInfoAt("6", "var r1: a1.connectModule", undefined);
verify.signatureHelp({ marker: "7", text: "a(): a1.connectExport" });
verify.quickInfoAt("8", "var r2: a1.connectExport", undefined);
goTo.marker('9');
verify.quickInfoIs("(property) test1: a1.connectModule\n(res: any, req: any, next: any) => void", undefined);
verify.signatureHelp(
{ marker: "10", text: "test1(res: any, req: any, next: any): void" },
{ marker: "11", text: "test2(): a1.connectModule" },
);
verify.quickInfoAt("12", "var r3: a1.connectModule", undefined);
verify.signatureHelp({ marker: "13", text: "a1(): a1.connectExport" });
verify.quickInfoAt("14", "var r4: a1.connectExport", undefined);
verify.completions({
marker: "15",
exact: [
{ name: "connectExport", text: "interface a1.connectExport" },
{ name: "connectModule", text: "interface a1.connectModule" },
],
});
| {
"end_byte": 2909,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/externalModuleWithExportAssignment.ts"
} |
TypeScript/tests/cases/fourslash/moduleDeclarationDeprecated_suggestion2.ts_0_142 | ///<reference path="fourslash.ts" />
// @Filename: a.ts
////declare module
const ranges = test.ranges();
verify.getSuggestionDiagnostics([])
| {
"end_byte": 142,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moduleDeclarationDeprecated_suggestion2.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFix_all_promoteType.ts_0_882 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
//// export class A {}
//// export class B {}
//// export class C {}
//// export class D {}
//// export class E {}
//// export class F {}
//// export class G {}
// @Filename: /b.ts
//// import type { A, C, D, E, G } from './a';
//// type Z = B | A;
//// new F;
// @Filename: /c.ts
//// import type { A, C, D, E, G } from './a';
//// type Z = B | A;
//// type Y = F;
goTo.file('/b.ts');
verify.codeFixAll({
fixId: "fixMissingImport",
fixAllDescription: "Add all missing imports",
newFileContent:
`import { B, F, type A, type C, type D, type E, type G } from './a';
type Z = B | A;
new F;`
});
goTo.file('/c.ts');
verify.codeFixAll({
fixId: "fixMissingImport",
fixAllDescription: "Add all missing imports",
newFileContent:
`import type { A, B, C, D, E, F, G } from './a';
type Z = B | A;
type Y = F;`
});
| {
"end_byte": 882,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_all_promoteType.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ConditionalForAny.ts_0_483 | /// <reference path='fourslash.ts' />
// @strict: true
////interface Foo {
//// bar?:{
//// baz?: any;
//// }
////}
////declare let foo: Foo;
/////*a*/foo.bar ? foo.bar.baz : "whenFalse";/*b*/
// It is reasonable to offer a refactor when baz is of type any since implicit any in strict mode
// produces an error and those with strict mode off aren't getting null checks anyway.
goTo.select("a", "b");
verify.refactorAvailable("Convert to optional chain expression");
| {
"end_byte": 483,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ConditionalForAny.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess_js_8.ts_0_584 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @Filename: a.js
//// /** Class comment */
//// class A {
//// // Field comment
//// /*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 comment */
class A {
// Field comment
/*RENAME*/_a = 1;
get a() {
return this._a;
}
set a(value) {
this._a = value;
}
}`,
});
| {
"end_byte": 584,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess_js_8.ts"
} |
TypeScript/tests/cases/fourslash/formattingBlockInCaseClauses.ts_0_212 | /// <reference path='fourslash.ts' />
////switch (1) {
//// case 1:
//// {
//// /*1*/
//// break;
////}
goTo.marker("1");
edit.insert("}");
verify.currentLineContentIs(" }");
| {
"end_byte": 212,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingBlockInCaseClauses.ts"
} |
TypeScript/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts_0_240 | /// <reference path="fourslash.ts" />
//// class B {}
//// function foo() {
//// return {/*1*/B: B};
//// }
//// class C extends (foo())./*2*/B {}
//// class C1 extends foo()./*3*/B {}
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 240,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_default_didNotExistBefore.ts_0_705 | /// <reference path="fourslash.ts" />
// @module: esnext
// @Filename: /a.ts
////export default function foo() {}
// @Filename: /b.ts
////f/**/;
verify.completions({
marker: "",
includes: {
name: "foo",
source: "/a",
sourceDisplay: "./a",
text: "function foo(): void",
kind: "function",
kindModifiers: "export",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
preferences: { includeCompletionsForModuleExports: true },
});
verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/a",
description: `Add import from "./a"`,
newFileContent: `import foo from "./a";
f;`,
});
| {
"end_byte": 705,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_default_didNotExistBefore.ts"
} |
TypeScript/tests/cases/fourslash/formatWithTabs.ts_0_304 | /// <reference path="fourslash.ts"/>
////const foo = [
//// 1
////];
const options = format.copyFormatOptions();
options.IndentSize = 2;
options.TabSize = 2;
options.ConvertTabsToSpaces = false;
format.setFormatOptions(options);
format.document();
verify.currentFileContentIs(
`const foo = [
1
];`);
| {
"end_byte": 304,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatWithTabs.ts"
} |
TypeScript/tests/cases/fourslash/codeFixForgottenThisPropertyAccess03.ts_0_299 | /// <reference path='fourslash.ts' />
////class C {
//// foo: number;
//// constructor() {[|
//// /* a comment */foo = 10;
//// |]}
////}
verify.codeFix({
description: "Add 'this.' to unresolved variable",
newRangeContent: `
/* a comment */this.foo = 10;
`
});
| {
"end_byte": 299,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixForgottenThisPropertyAccess03.ts"
} |
TypeScript/tests/cases/fourslash/unusedParameterInLambda2.ts_0_305 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @noUnusedParameters: true
////[|/*~a*/x/*~b*/ /*~c*/=>/*~d*/ {/*~e*/}/*~f*/|]
verify.codeFix({
description: "Remove unused declaration for: 'x'",
index: 0,
newRangeContent: "/*~a*/()/*~b*/ /*~c*/=>/*~d*/ {/*~e*/}/*~f*/",
});
| {
"end_byte": 305,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedParameterInLambda2.ts"
} |
TypeScript/tests/cases/fourslash/syntheticImportFromBabelGeneratedFile1.ts_0_418 | /// <reference path='fourslash.ts'/>
// @allowJs: true
// @allowSyntheticDefaultImports: true
// @Filename: /a.js
////exports.__esModule = true;
////exports.default = f;
/////**
//// * Run this function
//// * @param {string} t
//// */
////function f(t) {}
// @Filename: /b.js
////import f from "./a"
/////**/f
verify.quickInfoAt("", `(alias) function f(t: string): void
import f`, "Run this function"); // Passes
| {
"end_byte": 418,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/syntheticImportFromBabelGeneratedFile1.ts"
} |
TypeScript/tests/cases/fourslash/completionInTypeOf1.ts_0_250 | /// <reference path='fourslash.ts'/>
////module m1c {
//// export interface I { foo(): void; }
////}
////var x: typeof m1c./*1*/;
// No completion because m1c is not an instantiated module.
verify.completions({ marker: "1", exact: undefined });
| {
"end_byte": 250,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionInTypeOf1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports20.ts_0_408 | /// <reference path='fourslash.ts'/>
// @isolatedDeclarations: true
// @declaration: true
// @lib: es2019
//// export function foo () {
//// return Symbol();
//// }
verify.codeFixAvailable([
{ description: "Add return type 'symbol'" }
]);
verify.codeFix({
description: "Add return type 'symbol'",
index: 0,
newFileContent:
`export function foo (): symbol {
return Symbol();
}`
});
| {
"end_byte": 408,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports20.ts"
} |
TypeScript/tests/cases/fourslash/codeFixOverrideModifier10.ts_0_401 | /// <reference path='fourslash.ts' />
// @noImplicitOverride: true
//// class B {
//// b: string
//// }
//// class D extends B {
//// c = 10;
//// constructor(public a: string, [|public readonly b: string|]) {
//// super();
//// }
//// }
verify.codeFix({
description: "Add 'override' modifier",
newRangeContent: "public override readonly b: string",
index: 0
})
| {
"end_byte": 401,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixOverrideModifier10.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.