_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/fourslash/completionImportModuleSpecifierEndingJs.ts_0_465 | /// <reference path='fourslash.ts'/>
//@allowJs: true
//@Filename:test.js
////export function f(){
//// return 1
////}
//@Filename:module.js
////import { f } from ".//**/"
verify.completions({ marker: "", includes:{name:"test.js"}, preferences: {importModuleSpecifierEnding: "js" }, isNewIdentifierLocation: true});
verify.completions({ marker: "", includes:{name:"test"}, preferences: {importModuleSpecifierEnding: "index" }, isNewIdentifierLocation: true});
| {
"end_byte": 465,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionImportModuleSpecifierEndingJs.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingConstInForLoopWithArrayDestructuring2.ts_0_305 | /// <reference path='fourslash.ts' />
////for ([x, y] of [[1,2]]) {}
////for ([x] of [[1,2]]) {}
verify.codeFixAll({
fixId: "addMissingConst",
fixAllDescription: "Add 'const' to all unresolved variables",
newFileContent:
`for (const [x, y] of [[1,2]]) {}
for (const [x] of [[1,2]]) {}`
});
| {
"end_byte": 305,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingConstInForLoopWithArrayDestructuring2.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixExistingImport3.ts_0_425 | /// <reference path="fourslash.ts" />
//// [|import d, * as ns from "./module" ;
//// f1/*0*/();|]
// @Filename: module.ts
//// export function f1() {}
//// export var v1 = 5;
//// export default var d1 = 6;
// Test with some extra spaces before the semicolon
verify.importFixAtPosition([
`import d, * as ns from "./module" ;
ns.f1();`,
`import d, * as ns from "./module" ;
import { f1 } from "./module";
f1();`
]);
| {
"end_byte": 425,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixExistingImport3.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpTrailingRestTuple.ts_0_1010 | /// <reference path='fourslash.ts' />
////export function leading(allCaps: boolean, ...names: string[]): void {
////}
////
////leading(/*1*/);
////leading(false, /*2*/);
////leading(false, "ok", /*3*/);
verify.signatureHelp(
{
marker: "1",
text: "leading(allCaps: boolean, ...names: string[]): void",
overloadsCount: 1,
parameterCount: 2,
parameterName: "allCaps",
parameterSpan: "allCaps: boolean",
isVariadic: true,
},
{
marker: "2",
text: "leading(allCaps: boolean, ...names: string[]): void",
overloadsCount: 1,
parameterCount: 2,
parameterName: "names",
parameterSpan: "...names: string[]",
isVariadic: true,
},
{
marker: "3",
text: "leading(allCaps: boolean, ...names: string[]): void",
overloadsCount: 1,
parameterCount: 2,
parameterName: "names",
parameterSpan: "...names: string[]",
isVariadic: true,
},
);
| {
"end_byte": 1010,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpTrailingRestTuple.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionUnionTypeProperty1.ts_0_433 | /// <reference path='fourslash.ts' />
////interface One {
//// /*propertyDefinition1*/commonProperty: number;
//// commonFunction(): number;
////}
////
////interface Two {
//// /*propertyDefinition2*/commonProperty: string
//// commonFunction(): number;
////}
////
////var x : One | Two;
////
////x.[|/*propertyReference*/commonProperty|];
////x./*3*/commonFunction;
verify.baselineGoToDefinition("propertyReference");
| {
"end_byte": 433,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionUnionTypeProperty1.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFix_jsx4.ts_0_742 | /// <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
////import { Text } from "react-native";
////<Text></Text>;
goTo.file("/a.tsx");
verify.codeFix({
index: 0,
description: [ts.Diagnostics.Import_0_from_1.message, "React", "react"],
newFileContent:
`import React from "react";
import { Text } from "react-native";
<Text></Text>;`
});
| {
"end_byte": 742,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_jsx4.ts"
} |
TypeScript/tests/cases/fourslash/navigationItemsSubStringMatch.ts_0_1040 | /// <reference path="fourslash.ts"/>
/////// Module
////[|{| "name": "MyShapes", "kind": "module" |}module MyShapes {
////
//// // Class
//// [|{| "name": "MyPoint", "kind": "class", "kindModifiers": "export", "containerName": "MyShapes", "containerKind": "module" |}export class MyPoint {
//// // Instance member
//// [|{| "name": "MyoriginAttheHorizon", "kind": "property", "kindModifiers": "private", "containerName": "MyPoint", "containerKind": "class" |}private MyoriginAttheHorizon = 0.0;|]
////
//// // Getter
//// [|{| "name": "MydistanceFromOrigin", "kind": "getter", "containerName": "MyPoint", "containerKind": "class" |}get MydistanceFromOrigin(): number { return 0; }|]
//// }|]
////}|]
////
////// Local variables
////var [|{| "name": "MyXyz", "kind": "var" |}MyXyz = new Shapes.Point()|];
for (const range of test.ranges()) {
verify.navigateTo({
pattern: range.marker.data.name.slice(2),
expected: [{ ...range.marker.data, range, matchKind: "substring" }],
})
}
| {
"end_byte": 1040,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationItemsSubStringMatch.ts"
} |
TypeScript/tests/cases/fourslash/importStatementCompletions3.ts_0_350 | /// <reference path="fourslash.ts" />
// @Filename: ./$foo.ts
////export function foo() {}
// @Filename: ./bar.ts
////import f/**/
verify.baselineCompletions({
includeCompletionsForImportStatements: true,
includeCompletionsForModuleExports: true,
includeCompletionsWithSnippetText: true,
includeCompletionsWithInsertText: true
});
| {
"end_byte": 350,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importStatementCompletions3.ts"
} |
TypeScript/tests/cases/fourslash/completionsJSDocImportTagAttributesErrorModuleSpecifier1.ts_0_357 | /// <reference path='fourslash.ts' />
// @strict: true
// @checkJs: true
// @allowJs: true
// @filename: global.d.ts
//// interface ImportAttributes {
//// type: "json";
//// }
// @filename: index.js
//// /** @import * as ns from () with { type: "/**/" } */
verify.completions({
marker: "",
exact: ["json"],
isNewIdentifierLocation: false,
});
| {
"end_byte": 357,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsJSDocImportTagAttributesErrorModuleSpecifier1.ts"
} |
TypeScript/tests/cases/fourslash/unclosedStringLiteralErrorRecovery.ts_0_252 | /// <reference path="fourslash.ts" />
////"an unclosed string is a terrible thing!
////
////class foo { public x() { } }
////var f = new foo();
////f./**/
// Error recovery for unclosed string literals
verify.completions({ marker: "", exact: "x" });
| {
"end_byte": 252,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unclosedStringLiteralErrorRecovery.ts"
} |
TypeScript/tests/cases/fourslash/navigateToSingleFileResults.ts_0_1112 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////class Greeter {
//// [|public hello(name: string) { }|]
////}
////var x = new Greeter();
// @Filename: /b.ts
////class MyGreeter {
//// [|{| "containerName": "MyGreeter" |}public hello(name: string) { }|]
////}
////class MyOtherGreeter {
//// [|{| "containerName": "MyOtherGreeter" |}public hello(name: string) { }|]
////}
const [r0, r1, r2] = test.ranges();
const aTs: ReadonlyArray<FourSlashInterface.ExpectedNavigateToItem> = [
{ name: "hello", kind: "method", kindModifiers: "public", range: r0, containerName: "Greeter", containerKind: "class" },
];
const bTs: ReadonlyArray<FourSlashInterface.ExpectedNavigateToItem> = [r1, r2].map((range): FourSlashInterface.ExpectedNavigateToItem =>
({ name: "hello", kind: "method", kindModifiers: "public", range, containerName: range.marker.data.containerName, containerKind: "class" }));
verify.navigateTo(
{ pattern: "hello", expected: [...aTs, ...bTs] },
{ pattern: "hello", fileName: "/a.ts", expected: aTs },
{ pattern: "hello", fileName: "/b.ts", expected: bTs },
);
| {
"end_byte": 1112,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigateToSingleFileResults.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertImport_namedToNamespace8.ts_0_271 | /// <reference path='fourslash.ts' />
/////*a*/import { join } from "path";
////import * as fs from "fs";/*b*/
////
////fs.readFileSync(join('a', 'b'));
goTo.select("a", "b");
verify.not.refactorAvailable("Convert import", "Convert named imports to namespace import");
| {
"end_byte": 271,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertImport_namedToNamespace8.ts"
} |
TypeScript/tests/cases/fourslash/syntacticClassificationsTripleSlash16.ts_0_450 | /// <reference path="fourslash.ts"/>
//// /// <reference path="./module.ts" />
//// 1
const c = classification("original");
verify.syntacticClassificationsAre(
c.comment("/// "),
c.punctuation("<"),
c.jsxSelfClosingTagName("reference"),
c.comment(" "),
c.jsxAttribute("path"),
c.operator("="),
c.jsxAttributeStringLiteralValue("\"./module.ts\""),
c.comment(" "),
c.punctuation("/>"),
c.numericLiteral("1"));
| {
"end_byte": 450,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/syntacticClassificationsTripleSlash16.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration14.ts_0_480 | /// <reference path='fourslash.ts' />
// @filename: /test.ts
////export const x = 1;
// @filename: /foo.ts
////import * as test from "./test";
////const foo: string = test.foo();
goTo.file("/foo.ts");
verify.codeFix({
index: 0,
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"],
newFileContent: {
"/test.ts":
`export const x = 1;
export function foo(): string {
throw new Error("Function not implemented.");
}
`
}
});
| {
"end_byte": 480,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration14.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsMappedType.ts_0_251 | /// <reference path='fourslash.ts'/>
////interface T { /*1*/a: number; }
////type U = { readonly [K in keyof T]?: string };
////declare const t: T;
////t./*2*/a;
////declare const u: U;
////u./*3*/a;
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 251,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsMappedType.ts"
} |
TypeScript/tests/cases/fourslash/incompleteFunctionCallCodefixTypeParameterVariable.ts_0_850 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
////function e<T extends "phone" | "home">() {
//// let et: T = 'phone'
//// added1/*1*/(et)
//// et = 'home'
//// added2/*2*/(et)
////}
goTo.marker("1");
verify.codeFix({
description: "Add missing function declaration 'added1'",
index: 0,
newFileContent: `function e<T extends "phone" | "home">() {
let et: T = 'phone'
added1(et)
et = 'home'
added2(et)
}
function added1(et: string) {
throw new Error("Function not implemented.")
}
`,
});
goTo.marker("2");
verify.codeFix({
description: "Add missing function declaration 'added1'",
index: 0,
newFileContent: `function e<T extends "phone" | "home">() {
let et: T = 'phone'
added1(et)
et = 'home'
added2(et)
}
function added1(et: string) {
throw new Error("Function not implemented.")
}
`,
});
| {
"end_byte": 850,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/incompleteFunctionCallCodefixTypeParameterVariable.ts"
} |
TypeScript/tests/cases/fourslash/tsxFindAllReferences9.ts_0_1141 | /// <reference path='fourslash.ts' />
//@Filename: file.tsx
// @jsx: preserve
// @noLib: true
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// }
//// interface ElementAttributesProperty { props; }
//// }
//// interface ClickableProps {
//// children?: string;
//// className?: string;
//// }
//// interface ButtonProps extends ClickableProps {
//// onClick(event?: React.MouseEvent<HTMLButtonElement>): void;
//// }
//// interface LinkProps extends ClickableProps {
//// /*1*/goTo: string;
//// }
//// declare function MainButton(buttonProps: ButtonProps): JSX.Element;
//// declare function MainButton(linkProps: LinkProps): JSX.Element;
//// declare function MainButton(props: ButtonProps | LinkProps): JSX.Element;
//// let opt = <MainButton />;
//// let opt = <MainButton children="chidlren" />;
//// let opt = <MainButton onClick={()=>{}} />;
//// let opt = <MainButton onClick={()=>{}} ignore-prop />;
//// let opt = <MainButton goTo="goTo" />;
//// let opt = <MainButton goTo />;
//// let opt = <MainButton wrong />;
verify.baselineFindAllReferences('1')
| {
"end_byte": 1141,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxFindAllReferences9.ts"
} |
TypeScript/tests/cases/fourslash/codeFixCorrectReturnValue_all2.ts_0_2067 | /// <reference path='fourslash.ts' />
//// interface A {
//// bar: string
//// }
////
//// function foo1 (_a: () => number ) { }
//// foo1(() => {
//// 1
//// })
//// function foo2 (_a: () => A) { }
//// foo2(() => {
//// { bar: '1' }
//// })
//// foo2(() => {
//// bar: '1'
//// })
//// function foo3 (_a: () => A | number) { }
//// foo3(() => {
//// 1
//// })
//// foo3(() => {
//// bar: '1'
//// })
////
//// function bar1 (): number {
//// 1
//// }
//// function bar2 (): A {
//// { bar: '1' }
//// }
//// function bar3 (): A {
//// bar: '1'
//// }
//// function bar4 (): A | number {
//// 1
//// }
//// function bar5(): A | number {
//// bar: '1'
//// }
//
//// const baz1: () => number = () => {
//// 1
//// }
//// const baz2: () => A = () => {
//// { bar: '1' }
//// }
//// const baz3: () => A = () => {
//// bar: '1'
//// }
//// const baz4: ((() => number) | (() => A)) = () => {
//// 1
//// }
//// const baz5: ((() => number) | (() => A)) = () => {
//// bar: '1'
//// }
////
//// const test: { a: () => A } = { a: () => { bar: '1' } }
verify.codeFixAll({
fixId: "fixRemoveBracesFromArrowFunctionBody",
fixAllDescription: ts.Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues.message,
newFileContent:
`interface A {
bar: string
}
function foo1 (_a: () => number ) { }
foo1(() => 1)
function foo2 (_a: () => A) { }
foo2(() => ({ bar: '1' }))
foo2(() => ({ bar: '1' }))
function foo3 (_a: () => A | number) { }
foo3(() => 1)
foo3(() => ({ bar: '1' }))
function bar1 (): number {
1
}
function bar2 (): A {
{ bar: '1' }
}
function bar3 (): A {
bar: '1'
}
function bar4 (): A | number {
1
}
function bar5(): A | number {
bar: '1'
}
const baz1: () => number = () => 1
const baz2: () => A = () => ({ bar: '1' })
const baz3: () => A = () => ({ bar: '1' })
const baz4: ((() => number) | (() => A)) = () => 1
const baz5: ((() => number) | (() => A)) = () => ({ bar: '1' })
const test: { a: () => A } = { a: () => ({ bar: '1' }) }`,
});
| {
"end_byte": 2067,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCorrectReturnValue_all2.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesThrow7.ts_0_341 | /// <reference path='fourslash.ts' />
////try {
//// [|throw|] 10;
////
//// try {
//// throw 10;
//// }
//// catch (x) {
//// [|throw|] 10;
//// }
//// finally {
//// [|throw|] 10;
//// }
////}
////finally {
//// [|throw|] 10;
////}
////
////[|throw|] 10;
verify.baselineDocumentHighlights();
| {
"end_byte": 341,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesThrow7.ts"
} |
TypeScript/tests/cases/fourslash/referencesForGlobals.ts_0_581 | /// <reference path='fourslash.ts'/>
// Global variable reference.
// @Filename: referencesForGlobals_1.ts
/////*1*/var /*2*/global = 2;
////
////class foo {
//// constructor (public global) { }
//// public f(global) { }
//// public f2(global) { }
////}
////
////class bar {
//// constructor () {
//// var n = /*3*/global;
////
//// var f = new foo('');
//// f.global = '';
//// }
////}
////
////var k = /*4*/global;
// @Filename: referencesForGlobals_2.ts
////var m = /*5*/global;
verify.baselineFindAllReferences('1', '2', '3', '4', '5');
| {
"end_byte": 581,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForGlobals.ts"
} |
TypeScript/tests/cases/fourslash/derivedTypeIndexerWithGenericConstraints.ts_0_741 | /// <reference path='fourslash.ts'/>
////class CollectionItem {
//// x: number;
////}
////class Entity extends CollectionItem {
//// y: number;
////}
////class BaseCollection<TItem extends CollectionItem> {
//// _itemsByKey: { [key: string]: TItem; };
////}
////class DbSet<TEntity extends Entity> extends BaseCollection<TEntity> { // error
//// _itemsByKey: { [key: string]: TEntity; } = {};
////}
////var a: BaseCollection<CollectionItem>;
////var /**/r = a._itemsByKey['x']; // should just say CollectionItem not TItem extends CollectionItem
////var result = r.x;
////a = new DbSet<Entity>();
////var r2 = a._itemsByKey['x'];
////var result2 = r2.x;
verify.quickInfoAt("", "var r: CollectionItem");
verify.noErrors();
| {
"end_byte": 741,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/derivedTypeIndexerWithGenericConstraints.ts"
} |
TypeScript/tests/cases/fourslash/mapCodeRangeReplacement.ts_0_500 | ///<reference path="fourslash.ts"/>
// @Filename: /index.ts
//// function foo() {
//// return 1;
//// }
//// if (foo == bar) {
//// console.log("hello");
//// console.log("you");
//// }
//// [||]
//// function bar() {
//// return 2;
//// }
//// function baz() {
//// return 3;
//// }
//// while (false) {
//// console.log("weee");
//// }
////
verify.baselineMapCode([test.ranges()], [
`
if (foo == bar) {
console.log("huh");
}
function baz() {
return 'baz';
}
`
]); | {
"end_byte": 500,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/mapCodeRangeReplacement.ts"
} |
TypeScript/tests/cases/fourslash/extract-method-generics-inside-extraction2.ts_0_474 | /// <reference path='fourslash.ts' />
////function satisfies<A>() {
//// return /*start*/<T extends A>(x: T) => x/*end*/;
////}
goTo.select('start', 'end');
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to function in global scope",
newContent:
`function satisfies<A>() {
return /*RENAME*/newFunction<A>();
}
function newFunction<A>() {
return <T extends A>(x: T) => x;
}
`});
| {
"end_byte": 474,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method-generics-inside-extraction2.ts"
} |
TypeScript/tests/cases/fourslash/extract-method48.ts_0_746 | /// <reference path="fourslash.ts" />
////export function fn(x: number, y: number) {
//// /*a*/switch (x) {
//// case 1:
//// if (y) {
//// break;
//// }
//// x--;
//// break;
//// }/*b*/
////}
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to function in module scope",
newContent:
`export function fn(x: number, y: number) {
x = /*RENAME*/newFunction(x, y);
}
function newFunction(x: number, y: number) {
switch (x) {
case 1:
if (y) {
break;
}
x--;
break;
}
return x;
}
`
});
| {
"end_byte": 746,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method48.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddVoidToPromiseJS.4.ts_0_510 | /// <reference path='fourslash.ts' />
// @target: esnext
// @lib: es2015
// @strict: true
// @allowJS: true
// @checkJS: true
// @filename: main.js
////const p4 = /** @type {Promise<{ x: number } & { y: string }>} */(new Promise(resolve => resolve()));
verify.codeFix({
errorCode: 2810,
description: "Add 'void' to Promise resolved without a value",
index: 2,
newFileContent: `const p4 = /** @type {Promise<({ x: number } & { y: string }) | void>} */(new Promise(resolve => resolve()));`
});
| {
"end_byte": 510,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddVoidToPromiseJS.4.ts"
} |
TypeScript/tests/cases/fourslash/jsxAttributeSnippetCompletionClosed.ts_0_4954 | /// <reference path="fourslash.ts" />
//@Filename: file.tsx
////interface NestedInterface {
//// Foo: NestedInterface;
//// (props: {className?: string, onClick?: () => void}): any;
////}
////
////declare const Foo: NestedInterface;
////
////function fn1() {
//// return <Foo>
//// <Foo /*1*/ />
//// </Foo>
////}
////function fn2() {
//// return <Foo>
//// <Foo.Foo /*2*/ />
//// </Foo>
////}
////function fn3() {
//// return <Foo>
//// <Foo.Foo cla/*3*/ />
//// </Foo>
////}
////function fn4() {
//// return <Foo>
//// <Foo.Foo cla/*4*/ something />
//// </Foo>
////}
////function fn5() {
//// return <Foo>
//// <Foo.Foo something /*5*/ />
//// </Foo>
////}
////function fn6() {
//// return <Foo>
//// <Foo.Foo something cla/*6*/ />
//// </Foo>
////}
////function fn7() {
//// return <Foo /*7*/ />
////}
////function fn8() {
//// return <Foo cla/*8*/ />
////}
////function fn9() {
//// return <Foo cla/*9*/ something />
////}
////function fn10() {
//// return <Foo something /*10*/ />
////}
////function fn11() {
//// return <Foo something cla/*11*/ />
////}
////function fn12() {
//// return <Foo something={false} cla/*12*/ />
////}
////function fn13() {
//// return <Foo something={false} /*13*/ foo />
////}
////function fn14() {
//// return <Foo something={false} cla/*14*/ foo />
////}
////function fn15() {
//// return <Foo onC/*15*/="" />
////}
////function fn16() {
//// return <Foo something={false} onC/*16*/="" foo />
////}
var preferences: FourSlashInterface.UserPreferences = {
jsxAttributeCompletionStyle: "braces",
includeCompletionsWithSnippetText: true,
includeCompletionsWithInsertText: true,
};
verify.completions(
{ marker: "1", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "2", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "3", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "4", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "5", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "6", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "7", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "8", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "9", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "10", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "11", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "12", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "13", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "14", preferences, includes: { name: "className", insertText: "className={$1}", text: "(property) className?: string", isSnippet: true, sortText: completion.SortText.OptionalMember } },
{ marker: "15", preferences, includes: { name: "onClick", insertText: undefined, text: "(property) onClick?: () => void", isSnippet: undefined, sortText: completion.SortText.OptionalMember } },
{ marker: "16", preferences, includes: { name: "onClick", insertText: undefined, text: "(property) onClick?: () => void", isSnippet: undefined, sortText: completion.SortText.OptionalMember } },
)
| {
"end_byte": 4954,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsxAttributeSnippetCompletionClosed.ts"
} |
TypeScript/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion2.ts_0_1617 | /// <reference path="fourslash.ts"/>
// @allowNonTsExtensions: true
// @Filename: jsFileJsdocTypedefTagTypeExpressionCompletion2_typedef.js
//// class Foo {
//// constructor(value: number) { this.property1 = "hello"; }
//// static method1() {}
//// method3() { return 3; }
//// /**
//// * @param {string} foo A value.
//// * @returns {number} Another value
//// * @mytag
//// */
//// method4(foo) { return 3; }
//// }
//// /**
//// * @type { /*type*/Foo }
//// */
////var x;
/////*globalValue*/
////x./*valueMember*/
function getCompletions(nonWarnings: ReadonlyArray<string>): ReadonlyArray<FourSlashInterface.ExpectedCompletionEntry> {
const withKinds: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [
{ name: "Foo", kind: "class" },
{ name: "x", kind: "var" },
{ name: "property1", kind: "property" },
{ name: "method3", kind: "method" },
{ name: "method4", kind: "method" },
{ name: "foo", kind: "warning", sortText: completion.SortText.JavascriptIdentifiers },
];
for (const name of nonWarnings) ts.Debug.assert(withKinds.some(entry => entry.name === name));
return withKinds.map(entry => nonWarnings.includes(entry.name) ? entry : ({ name: entry.name, kind: "warning", sortText: completion.SortText.JavascriptIdentifiers }));
}
verify.completions(
{ marker: "type", includes: getCompletions(["Foo"]) },
{ marker: "globalValue", includes: getCompletions(["Foo", "x"]) },
{ marker: "valueMember", includes: getCompletions(["property1", "method3", "method4", "foo"]) },
);
| {
"end_byte": 1617,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesNumber.ts_0_285 | /// <reference path='fourslash.ts' />
////interface I {
//// [x: number]: I;
////}
////class C implements I {}
verify.codeFix({
description: "Implement interface 'I'",
newFileContent:
`interface I {
[x: number]: I;
}
class C implements I {
[x: number]: I;
}`,
});
| {
"end_byte": 285,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesNumber.ts"
} |
TypeScript/tests/cases/fourslash/unusedVariableInModule2.ts_0_294 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @noUnusedParameters: true
//// export {}
//// [|var x: string, z: number;|]
//// z;
//// export var y: string;
verify.codeFix({
description: "Remove unused declaration for: 'x'",
newRangeContent: "var z: number;",
});
| {
"end_byte": 294,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedVariableInModule2.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarPrivateName.ts_0_1360 | /// <reference path="fourslash.ts"/>
//// class A {
//// #foo: () => {
//// class B {
//// #bar: () => {
//// function baz () {
//// }
//// }
//// }
//// }
//// }
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "A",
"kind": "class",
"childItems": [
{
"text": "#foo",
"kind": "property"
}
]
},
{
"text": "B",
"kind": "class",
"childItems": [
{
"text": "#bar",
"kind": "property"
}
]
},
{
"text": "baz",
"kind": "function"
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "A",
"kind": "class"
},
{
"text": "B",
"kind": "class"
},
{
"text": "baz",
"kind": "function"
}
]
},
{
"text": "A",
"kind": "class",
"childItems": [
{
"text": "#foo",
"kind": "property"
}
],
"indent": 1
},
{
"text": "B",
"kind": "class",
"childItems": [
{
"text": "#bar",
"kind": "property"
}
],
"indent": 1
},
{
"text": "baz",
"kind": "function",
"indent": 1
}
]);
| {
"end_byte": 1360,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarPrivateName.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesLoopBreakContinue6.ts_0_1906 | /// <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
//// br/*1*/eak label1;
//// cont/*2*/inue label1;
//// bre/*3*/ak label2;
//// c/*4*/ontinue 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
//// br/*5*/eak label1;
//// co/*6*/ntinue label1;
//// br/*7*/eak label2;
//// con/*8*/tinue label2;
//// () => { b/*9*/reak; }
//// } while (true)
//// }
//// }
//// }
////}
////
////label5: while (true) break label5;
////
////label7: while (true) co/*10*/ntinue label5;
verify.baselineDocumentHighlights(test.markers());
| {
"end_byte": 1906,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesLoopBreakContinue6.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts_0_1331 | /// <reference path='fourslash.ts' />
////declare var console: {
//// log(msg: string): void;
////}
////interface Robot {
//// name: string;
//// skills: {
//// primary?: string;
//// secondary?: string;
//// };
////}
////var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } };
////var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } };
////
////var {
//// skills: {
//// primary: primaryA = "noSkill",
//// secondary: secondaryA = "noSkill"
//// } = { primary: "noSkill", secondary: "noSkill" }
////} = robotA;
////var {
//// name: nameB = "noNameSpecified",
//// skills: {
//// primary: primaryB = "noSkill",
//// secondary: secondaryB = "noSkill"
//// } = { primary: "noSkill", secondary: "noSkill" }
////} = robotB;
////var {
//// name: nameC = "noNameSpecified",
//// skills: {
//// primary: primaryB = "noSkill",
//// secondary: secondaryB = "noSkill"
//// } = { primary: "noSkill", secondary: "noSkill" }
////} = <Robot>{ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } };
////
////if (nameB == nameB) {
//// console.log(nameC);
////}
////else {
//// console.log(nameC);
////}
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 1331,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts"
} |
TypeScript/tests/cases/fourslash/extract-method19.ts_0_548 | /// <reference path='fourslash.ts' />
// New function names should be totally new to the file
//// function fn() {
//// /*a*/console.log("hi");/*b*/
//// }
////
//// function newFunction() { }
goTo.select('a', 'b')
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_0",
actionDescription: "Extract to inner function in function 'fn'",
newContent:
`function fn() {
/*RENAME*/newFunction_1();
function newFunction_1() {
console.log("hi");
}
}
function newFunction() { }`
});
| {
"end_byte": 548,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method19.ts"
} |
TypeScript/tests/cases/fourslash/extract-unterminated5.ts_0_406 | /// <reference path="fourslash.ts" />
// Unterminated template literal:
//// /*1*/const foo = "endsinbackslash\/*2*/
goTo.select("1", "2");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_0",
actionDescription: "Extract to function in global scope",
newContent: `const foo = /*RENAME*/newFunction()
function newFunction() {
return "endsinbackslash";
}
`
});
| {
"end_byte": 406,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-unterminated5.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionBuiltInTypes.ts_0_207 | /// <reference path='fourslash.ts'/>
////var n: /*number*/number;
////var s: /*string*/string;
////var b: /*boolean*/boolean;
////var v: /*void*/void;
verify.baselineGoToDefinition(...test.markerNames());
| {
"end_byte": 207,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionBuiltInTypes.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionMetaProperty.ts_0_371 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////im/*1*/port.met/*2*/a;
////function /*functionDefinition*/f() { n/*3*/ew.[|t/*4*/arget|]; }
// @Filename: /b.ts
////im/*5*/port.m;
////class /*classDefinition*/c { constructor() { n/*6*/ew.[|t/*7*/arget|]; } }
verify.baselineGoToDefinition(
"1",
"2",
"3",
"4",
"5",
"6",
"7",
); | {
"end_byte": 371,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionMetaProperty.ts"
} |
TypeScript/tests/cases/fourslash/commentsImportDeclaration.ts_0_1902 | /// <reference path='fourslash.ts' />
// @Filename: commentsImportDeclaration_file0.ts
/////** NamespaceComment*/
////export namespace m/*2*/1 {
//// /** b's comment*/
//// export var b: number;
//// /** m2 comments*/
//// export namespace m2 {
//// /** class comment;*/
//// export class c {
//// };
//// /** i*/
//// export var i: c;;
//// }
//// /** exported function*/
//// export function fooExport(): number;
////}
// @Filename: commentsImportDeclaration_file1.ts
///////<reference path='commentsImportDeclaration_file0.ts'/>
/////** Import declaration*/
////import /*3*/extMod = require("./commentsImportDeclaration_file0/*4*/");
////extMod./*6*/m1./*7*/fooEx/*8q*/port(/*8*/);
////var new/*9*/Var = new extMod.m1.m2./*10*/c();
verify.quickInfos({
2: ["namespace m1", "NamespaceComment"],
3: ['import extMod = require("./commentsImportDeclaration_file0")', "Import declaration"]
});
verify.completions({ marker: "6", exact: [{ name: "m1", text: "namespace extMod.m1", documentation: "NamespaceComment" }] });
verify.completions({
marker: "7",
exact: [
{ name: "b", text: "var extMod.m1.b: number", documentation: "b's comment" },
{ name: "fooExport", text: "function extMod.m1.fooExport(): number", documentation: "exported function" },
{ name: "m2", text: "namespace extMod.m1.m2", documentation: "m2 comments" },
]
})
verify.signatureHelp({ marker: "8", docComment: "exported function" });
verify.quickInfos({
"8q": ["function extMod.m1.fooExport(): number", "exported function"],
9: "var newVar: extMod.m1.m2.c"
});
verify.completions({
marker: "10",
exact: [
{ name: "c", text: "constructor extMod.m1.m2.c(): extMod.m1.m2.c", documentation: "class comment;" },
{ name: "i", text: "var extMod.m1.m2.i: extMod.m1.m2.c", documentation: "i" },
],
});
| {
"end_byte": 1902,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/commentsImportDeclaration.ts"
} |
TypeScript/tests/cases/fourslash/commentSelection2.ts_0_746 | // Common jsx insert comment.
//@Filename: file.tsx
//// const a = <MyContainer>
//// [|<MyFirstComponent />
//// <MySecondComponent />|]
//// </MyContainer>;
//// const b = <MyContainer>
//// {/*<MyF[|irstComponent />*/}
//// {/*<MySec|]ondComponent />*/}
//// </MyContainer>;
//// const c = <MyContainer>[|
//// <MyFirstComponent />
//// <MySecondCompo|]nent />
//// </MyContainer>;
verify.commentSelection(
`const a = <MyContainer>
{/*<MyFirstComponent />*/}
{/*<MySecondComponent />*/}
</MyContainer>;
const b = <MyContainer>
{/*<MyFirstComponent />*/}
{/*<MySecondComponent />*/}
</MyContainer>;
//const c = <MyContainer>
// <MyFirstComponent />
// <MySecondComponent />
</MyContainer>;`); | {
"end_byte": 746,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/commentSelection2.ts"
} |
TypeScript/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties.ts_0_965 | /// <reference path='fourslash.ts'/>
////interface A {
//// a: number;
//// /*1*/common: string;
////}
////
////interface B {
//// b: number;
//// /*2*/common: number;
////}
////
////// Assignment
////var v1: A | B = { a: 0, /*3*/common: "" };
////var v2: A | B = { b: 0, /*4*/common: 3 };
////
////// Function call
////function consumer(f: A | B) { }
////consumer({ a: 0, b: 0, /*5*/common: 1 });
////
////// Type cast
////var c = <A | B> { /*6*/common: 0, b: 0 };
////
////// Array literal
////var ar: Array<A|B> = [{ a: 0, /*7*/common: "" }, { b: 0, /*8*/common: 0 }];
////
////// Nested object literal
////var ob: { aorb: A|B } = { aorb: { b: 0, /*9*/common: 0 } };
////
////// Widened type
////var w: A|B = { a:0, /*10*/common: undefined };
////
////// Untped -- should not be included
////var u1 = { a: 0, b: 0, common: "" };
////var u2 = { b: 0, common: 0 };
verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10')
| {
"end_byte": 965,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties.ts"
} |
TypeScript/tests/cases/fourslash/completionsNonExistentImport.ts_0_192 | /// <reference path="fourslash.ts" />
////import { NonExistentType } from "non-existent-module";
////let foo: /**/
verify.completions({
marker: "",
includes: ["NonExistentType"]
});
| {
"end_byte": 192,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsNonExistentImport.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoDisplayPartsVarWithStringTypes01.ts_0_200 | /// <reference path='fourslash.ts'/>
////let /*1*/hello: "hello" | 'hello' = "hello";
////let /*2*/world: 'world' = "world";
////let /*3*/helloOrWorld: "hello" | 'world';
verify.baselineQuickInfo(); | {
"end_byte": 200,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoDisplayPartsVarWithStringTypes01.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_importedFunction4.ts_0_683 | /// <reference path='fourslash.ts' />
// @Filename: f.ts
////export { foo as default };
////function /*a*/foo/*b*/(a: number, b: number) {
//// return a + b;
////}
// @Filename: a.ts
////import bar from "./f";
////bar(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: `export { foo as default };
function foo({ a, b }: { a: number; b: number; }) {
return a + b;
}`
});
goTo.file("a.ts");
verify.currentFileContentIs(`import bar from "./f";
bar({ a: 1, b: 2 });`) | {
"end_byte": 683,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_importedFunction4.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType2.ts_0_320 | /// <reference path='fourslash.ts' />
//// var x: /*a*/string/*b*/ = '';
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType = string;
var x: NewType = '';`,
});
| {
"end_byte": 320,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType2.ts"
} |
TypeScript/tests/cases/fourslash/contextuallyTypedParameters.ts_0_1431 | /// <reference path='fourslash.ts' />
////declare function foo(cb: (this: any, x: number, y: string, z: boolean) => void): void;
////
////foo(function(this, a, ...args) {
//// a/*10*/;
//// args/*11*/;
////});
////
////foo(function(this, a, b, ...args) {
//// a/*20*/;
//// b/*21*/;
//// args/*22*/;
////});
////
////foo(function(this, a, b, c, ...args) {
//// a/*30*/;
//// b/*31*/;
//// c/*32*/;
//// args/*33*/;
////});
////
////foo(function(a, ...args) {
//// a/*40*/;
//// args/*41*/;
////});
////
////foo(function(a, b, ...args) {
//// a/*50*/;
//// b/*51*/;
//// args/*52*/;
////});
////
////foo(function(a, b, c, ...args) {
//// a/*60*/;
//// b/*61*/;
//// c/*62*/;
//// args/*63*/;
////});
verify.quickInfos({
10: "(parameter) a: number",
11: "(parameter) args: [y: string, z: boolean]",
20: "(parameter) a: number",
21: "(parameter) b: string",
22: "(parameter) args: [z: boolean]",
30: "(parameter) a: number",
31: "(parameter) b: string",
32: "(parameter) c: boolean",
33: "(parameter) args: []",
40: "(parameter) a: number",
41: "(parameter) args: [y: string, z: boolean]",
50: "(parameter) a: number",
51: "(parameter) b: string",
52: "(parameter) args: [z: boolean]",
60: "(parameter) a: number",
61: "(parameter) b: string",
62: "(parameter) c: boolean",
63: "(parameter) args: []",
});
| {
"end_byte": 1431,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/contextuallyTypedParameters.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoJsDocTagsFunctionOverload01.ts_0_305 | /// <reference path='fourslash.ts'/>
// @Filename: quickInfoJsDocTagsFunctionOverload01.ts
/////**
//// * Doc foo
//// */
////declare function /*1*/foo(): void;
////
/////**
//// * Doc foo overloaded
//// * @tag Tag text
//// */
////declare function /*2*/foo(x: number): void
verify.baselineQuickInfo()
| {
"end_byte": 305,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoJsDocTagsFunctionOverload01.ts"
} |
TypeScript/tests/cases/fourslash/outliningSpansForImportsAndExports.ts_0_765 | /// <reference path="fourslash.ts"/>
//// import { a1, a2 } from "a";
//// ;
//// import {
//// } from "a";
//// ;
//// import [|{
//// b1,
//// b2,
//// }|] from "b";
//// ;
//// import j1 from "./j" assert { type: "json" };
//// ;
//// import j2 from "./j" assert {
//// };
//// ;
//// import j3 from "./j" assert [|{
//// type: "json"
//// }|];
//// ;
//// [|import { a5, a6 } from "a";
//// import [|{
//// a7,
//// a8,
//// }|] from "a";|]
//// export { a1, a2 };
//// ;
//// export { a3, a4 } from "a";
//// ;
//// export {
//// };
//// ;
//// export [|{
//// b1,
//// b2,
//// }|];
//// ;
//// export {
//// } from "b";
//// ;
//// export [|{
//// b3,
//// b4,
//// }|] from "b";
//// ;
verify.outliningSpansInCurrentFile(test.ranges());
| {
"end_byte": 765,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/outliningSpansForImportsAndExports.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageCallbackParameter2.ts_0_416 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @noImplicitAny: false
// @filename: /foo.js
////function foo(names) {
//// return names.filter(name => name === "foo");
////}
verify.codeFix({
description: "Infer parameter types from usage",
index: 1,
newFileContent:
`function foo(names) {
return names.filter((/** @type {string} */ name) => name === "foo");
}`
});
| {
"end_byte": 416,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageCallbackParameter2.ts"
} |
TypeScript/tests/cases/fourslash/consistenceOnIndentionsOfChainedFunctionCalls.ts_0_402 | /// <reference path='fourslash.ts' />
////interface ig {
//// module(data): ig;
//// requires(data): ig;
//// defines(data): ig;
////}
////
////var ig: ig;
////ig.module(
//// 'mything'
////).requires(
//// 'otherstuff'
////).defines(/*0*//*1*/
////});
goTo.marker("1");
edit.insert("\n");
goTo.marker("0");
// Won't-fixed: Smart indent during chained function calls
verify.indentationIs(4); | {
"end_byte": 402,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/consistenceOnIndentionsOfChainedFunctionCalls.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType41.ts_0_365 | /// <reference path='fourslash.ts' />
//// type A = /*a*/(v: string | number) => typeof v/*b*/
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType = (v: string | number) => typeof v;
type A = NewType`,
});
| {
"end_byte": 365,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType41.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess33.ts_0_1164 | /// <reference path='fourslash.ts' />
//// class A {
//// public readonly /*a*/a/*b*/: number;
//// public b: number;
//// constructor () {
//// this.a = 1; // convert
//// this["a"]++; // convert
//// ++this.a; // convert
//// if (Math.random()) {
//// this.a = 2; // convert
//// }
//// console.log(this.a); // preserve
//// this.b = this.a; // preserve
//// }
//// foo () { this.a = 2; }
//// }
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 readonly /*RENAME*/_a: number;
public get a(): number {
return this._a;
}
public b: number;
constructor () {
this._a = 1; // convert
this["_a"]++; // convert
++this._a; // convert
if (Math.random()) {
this._a = 2; // convert
}
console.log(this.a); // preserve
this.b = this.a; // preserve
}
foo () { this.a = 2; }
}`,
});
| {
"end_byte": 1164,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess33.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarItemsModules2.ts_0_1167 | /// <reference path="fourslash.ts"/>
////namespace Test.A { }
////
////namespace Test.B {
//// class Foo { }
////}
verify.navigationTree({
text: "<global>",
kind: "script",
childItems: [
{
text: "Test.A",
kind: "module"
},
{
text: "Test.B",
kind: "module",
childItems: [
{
text: "Foo",
kind: "class"
}
]
}
]
});
verify.navigationBar([
{
text: "<global>",
kind: "script",
childItems: [
{
text: "Test.A",
kind: "module"
},
{
text: "Test.B",
kind: "module"
}
]
},
{
text: "Test.A",
kind: "module",
indent: 1
},
{
text: "Test.B",
kind: "module",
childItems: [
{
text: "Foo",
kind: "class"
}
],
indent: 1
},
{
text: "Foo",
kind: "class",
indent: 2
}
]);
| {
"end_byte": 1167,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsModules2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixConvertToMappedObjectType12.ts_0_337 | /// <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;
//// readonly [prop: K]?: any;
//// }
verify.codeFixAvailable([
{ "description": "Infer type of 'any' from usage" }
])
| {
"end_byte": 337,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixConvertToMappedObjectType12.ts"
} |
TypeScript/tests/cases/fourslash/missingMethodAfterEditAfterImport.ts_0_422 | /// <reference path='fourslash.ts' />
//// namespace foo {
//// export namespace bar { namespace baz { export class boo { } } }
//// }
////
//// import f = /*foo*/foo;
////
//// /*delete*/var x;
// Sanity check\
verify.quickInfoAt("foo", "namespace foo");
// Delete some code
goTo.marker('delete');
edit.deleteAtCaret('var x;'.length);
// Pull on the RHS of an import
verify.quickInfoAt("foo", "namespace foo");
| {
"end_byte": 422,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/missingMethodAfterEditAfterImport.ts"
} |
TypeScript/tests/cases/fourslash/semanticClassificationUninstantiatedModuleWithVariableOfSameName2.ts_0_1083 | /// <reference path="fourslash.ts"/>
////module /*0*/M {
//// export interface /*1*/I {
//// }
////}
////
////var /*2*/M = {
//// foo: 10,
//// bar: 20
////}
////
////var v: /*3*/M./*4*/I;
////
////var x = /*5*/M;
const c = classification("original");
verify.semanticClassificationsAre("original",
c.moduleName("M", test.marker("0").position),
c.interfaceName("I", test.marker("1").position),
c.moduleName("M", test.marker("3").position),
c.interfaceName("I", test.marker("4").position));
const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("variable", "M"),
c2.semanticToken("interface.declaration", "I"),
c2.semanticToken("variable.declaration", "M"),
c2.semanticToken("property.declaration", "foo"),
c2.semanticToken("property.declaration", "bar"),
c2.semanticToken("variable.declaration", "v"),
c2.semanticToken("variable", "M"),
c2.semanticToken("interface", "I"),
c2.semanticToken("variable.declaration", "x"),
c2.semanticToken("variable", "M"),
);
| {
"end_byte": 1083,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/semanticClassificationUninstantiatedModuleWithVariableOfSameName2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixOverrideModifier5.ts_0_254 | /// <reference path='fourslash.ts' />
// @noImplicitOverride: true
//// class C {
//// [|override foo(v: string) {}|]
//// }
verify.codeFix({
description: "Remove 'override' modifier",
newRangeContent: "foo(v: string) {}",
index: 0
})
| {
"end_byte": 254,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixOverrideModifier5.ts"
} |
TypeScript/tests/cases/fourslash/completionsClassPropertiesAssignment.ts_0_728 | /// <reference path='fourslash.ts'/>
////class Class1 {
//// public a = this./*0*/
//// protected b = /*1*/
//// private c = /*2*/
//// public d = /*3*/
////}
////
////class Class2 {
//// a = /*4*/
////}
////class Class3 {
//// a = /*5*/
////}
////
////const prop = 'prop';
////class Class4 {
//// [prop] = /*6*/
////}
const exact = completion.globalsPlus(["Class1", "Class2", "Class3", "Class4", "prop"]);
const markers = ["1", "2", "3", "4", "5", "6"];
verify.completions({ marker: "0", exact: ['a', 'b', 'c', 'd'], isGlobalCompletion: false });
verify.completions({ marker: markers, exact });
for (let marker of markers) {
goTo.marker(marker);
edit.insert("c");
verify.completions({ exact });
}
| {
"end_byte": 728,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsClassPropertiesAssignment.ts"
} |
TypeScript/tests/cases/fourslash/formatDocumentWithJSDoc.ts_0_416 | /// <reference path="fourslash.ts" />
/////**
//// * JSDoc for things
//// */
////function f() {
//// /** more
//// jsdoc */
//// var t;
//// /**
//// * multiline
//// */
//// var multiline;
////}
format.document();
verify.currentFileContentIs(`/**
* JSDoc for things
*/
function f() {
/** more
jsdoc */
var t;
/**
* multiline
*/
var multiline;
}`);
| {
"end_byte": 416,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatDocumentWithJSDoc.ts"
} |
TypeScript/tests/cases/fourslash/typeErrorAfterStringCompletionsInNestedCall.ts_0_1215 | ///<reference path="fourslash.ts"/>
// @strict: true
////
//// type GreetingEvent =
//// | { type: "MORNING" }
//// | { type: "LUNCH_TIME" }
//// | { type: "ALOHA" };
////
//// interface RaiseActionObject<TEvent extends { type: string }> {
//// type: "raise";
//// event: TEvent;
//// }
////
//// declare function raise<TEvent extends { type: string }>(
//// ev: TEvent
//// ): RaiseActionObject<TEvent>;
////
//// declare function createMachine<TEvent extends { type: string }>(config: {
//// actions: RaiseActionObject<TEvent>;
//// }): void;
////
//// createMachine<GreetingEvent>({
//// [|/*error*/actions|]: raise({ type: "ALOHA/*1*/" }),
//// });
goTo.marker("1");
edit.insert(`x`)
verify.completions({ exact: ["MORNING", "LUNCH_TIME", "ALOHA"] });
verify.getSemanticDiagnostics([{
code: 2322,
message: `Type 'RaiseActionObject<{ type: "ALOHAx"; }>' is not assignable to type 'RaiseActionObject<GreetingEvent>'.\n Type '{ type: "ALOHAx"; }' is not assignable to type 'GreetingEvent'.\n Type '{ type: "ALOHAx"; }' is not assignable to type '{ type: "ALOHA"; }'.\n Types of property 'type' are incompatible.\n Type '"ALOHAx"' is not assignable to type '"ALOHA"'.`,
}]);
| {
"end_byte": 1215,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/typeErrorAfterStringCompletionsInNestedCall.ts"
} |
TypeScript/tests/cases/fourslash/codeFixChangeExtendsToImplementsAbstractModifier.ts_0_295 | /// <reference path='fourslash.ts' />
//// interface I1 { }
//// interface I2 { }
//// [|abstract class A extends I1 implements I2|] { }
verify.codeFix({
description: "Change 'extends' to 'implements'",
// TODO: GH#18794
newRangeContent: "abstract class A implements I1, I2",
});
| {
"end_byte": 295,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixChangeExtendsToImplementsAbstractModifier.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarItemsFunctionProperties.ts_0_447 | /// <reference path="fourslash.ts"/>
//// (function(){
//// var A;
//// A/*1*/
//// .a = function() { };
//// })();
verify.navigationTree(
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "<function>",
"kind": "function",
"childItems": [
{
"text": "a",
"kind": "function"
},
{
"text": "A",
"kind": "var"
}
]
}
]
});
| {
"end_byte": 447,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsFunctionProperties.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsThisKeywordMultipleFiles.ts_0_367 | /// <reference path='fourslash.ts' />
// @Filename: file1.ts
/////*1*/this; /*2*/this;
// @Filename: file2.ts
/////*3*/this;
/////*4*/this;
// @Filename: file3.ts
//// ((x = /*5*/this, y) => /*6*/this)(/*7*/this, /*8*/this);
//// // different 'this'
//// function f(this) { return this; }
verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8');
| {
"end_byte": 367,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsThisKeywordMultipleFiles.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_destructure_allUnused_all.ts_0_576 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @noUnusedParameters: true
//// const { x, y } = o;
//// const { a, b } = o;
//// a;
//// export function f({ fa, fb }, { fx, fy }) {
//// fb;
//// }
//// export function g([ ga, gb ], [ gary, gygax ]) {
//// ga;
//// }
verify.codeFixAll({
fixId: "unusedIdentifier_delete",
fixAllDescription: ts.Diagnostics.Delete_all_unused_declarations.message,
newFileContent:
`const { x, y } = o;
const { a } = o;
a;
export function f({ fb }) {
fb;
}
export function g([ ga ],) {
ga;
}`,
});
| {
"end_byte": 576,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUnusedIdentifier_destructure_allUnused_all.ts"
} |
TypeScript/tests/cases/fourslash/getOutliningSpansDepthChainedCalls.ts_0_2961 | /// <reference path="fourslash.ts"/>
// Tests that each 'else if' does not count towards a higher nesting depth.
////declare var router: any;
////router
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
//// .get[|("/", async(ctx) =>[|{
//// ctx.body = "base";
//// }|])|]
//// .post[|("/a", async(ctx) =>[|{
//// //a
//// }|])|]
verify.outliningSpansInCurrentFile(test.ranges());
| {
"end_byte": 2961,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOutliningSpansDepthChainedCalls.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType10.ts_0_476 | /// <reference path='fourslash.ts' />
//// function foo(a: number, b?: number, ...c: number[]): /*a*/boolean/*b*/ {
//// return false as boolean
//// }
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType = boolean;
function foo(a: number, b?: number, ...c: number[]): NewType {
return false as boolean
}`,
});
| {
"end_byte": 476,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType10.ts"
} |
TypeScript/tests/cases/fourslash/docCommentTemplateEmptyFile.ts_0_113 | /// <reference path='fourslash.ts' />
// @Filename: emptyFile.ts
/////*0*/
verify.noDocCommentTemplateAt("0");
| {
"end_byte": 113,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateEmptyFile.ts"
} |
TypeScript/tests/cases/fourslash/completionsOverridingMethod1.ts_0_747 | /// <reference path="fourslash.ts" />
// @newline: LF
// @Filename: h.ts
// @noImplicitOverride: true
// Case: Suggested method needs `override` modifier
////class HBase {
//// foo(a: string): void {}
////}
////
////class HSub extends HBase {
//// f/*h*/
////}
verify.completions({
marker: "h",
isNewIdentifierLocation: true,
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: false,
includeCompletionsWithClassMemberSnippets: true,
},
includes: [
{
name: "foo",
sortText: completion.SortText.LocationPriority,
insertText: "override foo(a: string): void {\n}",
filterText: "foo"
}
],
}); | {
"end_byte": 747,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsOverridingMethod1.ts"
} |
TypeScript/tests/cases/fourslash/tsxQuickInfo4.ts_3_1877 | / <reference path='fourslash.ts' />
//@Filename: file.tsx
// @jsx: preserve
// @noLib: true
//// export interface ClickableProps {
//// children?: string;
//// className?: string;
//// }
//// export interface ButtonProps extends ClickableProps {
//// onClick(event?: React.MouseEvent<HTMLButtonElement>): void;
//// }
//// export interface LinkProps extends ClickableProps {
//// to: string;
//// }
//// export function MainButton(buttonProps: ButtonProps): JSX.Element;
//// export function MainButton(linkProps: LinkProps): JSX.Element;
//// export function MainButton(props: ButtonProps | LinkProps): JSX.Element {
//// const linkProps = props as LinkProps;
//// if(linkProps.to) {
//// return this._buildMainLink(props);
//// }
//// return this._buildMainButton(props);
//// }
//// function _buildMainButton({ onClick, children, className }: ButtonProps): JSX.Element {
//// return(<button className={className} onClick={onClick}>{ children || 'MAIN BUTTON'}</button>);
//// }
//// declare function buildMainLink({ to, children, className }: LinkProps): JSX.Element;
//// function buildSomeElement1(): JSX.Element {
//// return (
//// <MainB/*1*/utton t/*2*/o='/some/path'>GO</MainButton>
//// );
//// }
//// function buildSomeElement2(): JSX.Element {
//// return (
//// <MainB/*3*/utton onC/*4*/lick={()=>{}}>GO</MainButton>;
//// );
//// }
//// let componenet = <MainButton onClick={()=>{}} ext/*5*/ra-prop>GO</MainButton>;
verify.quickInfos({
1: "function MainButton(linkProps: LinkProps): JSX.Element (+1 overload)",
2: "(property) LinkProps.to: string",
3: "function MainButton(buttonProps: ButtonProps): JSX.Element (+1 overload)",
4: "(method) ButtonProps.onClick(event?: React.MouseEvent<HTMLButtonElement>): void",
5: "(property) extra-prop: true"
});
| {
"end_byte": 1877,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxQuickInfo4.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType86.ts_0_408 | /// <reference path='fourslash.ts' />
//// type A = {/*1*/ a: string } | { b: string } | { /*2*/c: string };
goTo.select("1", "2");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent:
`type /*RENAME*/NewType = {
a: string;
} | {
b: string;
} | {
c: string;
};
type A = NewType;`,
});
| {
"end_byte": 408,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType86.ts"
} |
TypeScript/tests/cases/fourslash/preserveSpace.ts_0_1909 | /// <reference path="fourslash.ts" />
////function foo() {
//// /*1*/if (true) console.log(1);
//// else console.log(1);
//// if (true)
//// console.log(1);
//// else
//// console.log(1);
////
//// do console.log(1);
//// while (false);
//// do
//// console.log(1);
//// while (false);
////
//// while (true) console.log(1);
//// while (true)
//// console.log(1);
////
//// for (let i = 1; i < 4; i++) console.log(1); // 1,2,3
//// for (let i = 1; i < 4; i++)
//// console.log(1); // 1,2,3
////
//// for (let i in [1, 2, 3]) console.log(1);
//// for (let i in [1, 2, 3])
//// console.log(1);
////
//// for (let i of [1, 2, 3]) console.log(1);
//// for (let i of [1, 2, 3])
//// console.log(1);
////
//// with ([1, 2, 3]) console.log(toString());
//// with ([1, 2, 3])
//// console.log(toString());/*2*/
////}
goTo.select("1", "2");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to function in global scope",
newContent:
`function foo() {
/*RENAME*/newFunction();
}
function newFunction() {
if (true) console.log(1);
else console.log(1);
if (true)
console.log(1);
else
console.log(1);
do console.log(1);
while (false);
do
console.log(1);
while (false);
while (true) console.log(1);
while (true)
console.log(1);
for (let i = 1; i < 4; i++) console.log(1); // 1,2,3
for (let i = 1; i < 4; i++)
console.log(1); // 1,2,3
for (let i in [1, 2, 3]) console.log(1);
for (let i in [1, 2, 3])
console.log(1);
for (let i of [1, 2, 3]) console.log(1);
for (let i of [1, 2, 3])
console.log(1);
with ([1, 2, 3]) console.log(toString());
with ([1, 2, 3])
console.log(toString());
}
`
});
| {
"end_byte": 1909,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/preserveSpace.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationLocal_01.ts_0_221 | /// <reference path='fourslash.ts'/>
// Should return the defintion of locally defined variables
//// const [|hello|] = function() {};
//// he/*function_call*/llo();
verify.baselineGoToImplementation("function_call");
| {
"end_byte": 221,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationLocal_01.ts"
} |
TypeScript/tests/cases/fourslash/inlayHintsNoParameterHints.ts_0_186 | /// <reference path="fourslash.ts" />
//// function foo (a: number, b: number) {}
//// foo(1, 2);
verify.baselineInlayHints(undefined, {
includeInlayParameterNameHints: "none"
});
| {
"end_byte": 186,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlayHintsNoParameterHints.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingAwait_forAwaitOf.ts_0_354 | /// <reference path="fourslash.ts" />
// @lib: es2020
// @target: es2020
////async function* g() {}
////async function fn() {
//// for (const { } of g()) { }
////}
verify.codeFix({
description: ts.Diagnostics.Add_await.message,
index: 0,
newFileContent:
`async function* g() {}
async function fn() {
for await (const { } of g()) { }
}`
});
| {
"end_byte": 354,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingAwait_forAwaitOf.ts"
} |
TypeScript/tests/cases/fourslash/completionsOverridingMethod17.ts_0_769 | /// <reference path="fourslash.ts" />
// @Filename: a.ts
// @newline: LF
// Issue #52211
//// interface Interface {
//// method(): void;
//// }
////
//// export class Class implements Interface {
//// property = "yadda";
////
//// /**/
//// }
verify.completions({
marker: "",
isNewIdentifierLocation: true,
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: false,
includeCompletionsWithClassMemberSnippets: true,
},
includes: [
{
name: "method",
sortText: completion.SortText.LocationPriority,
insertText: "method(): void {\n}",
replacementSpan: undefined,
filterText: "method",
},
],
});
| {
"end_byte": 769,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsOverridingMethod17.ts"
} |
TypeScript/tests/cases/fourslash/autoImportAllowImportingTsExtensionsPackageJsonImports1.ts_0_917 | /// <reference path="fourslash.ts" />
// @module: nodenext
// @allowImportingTsExtensions: true
// @Filename: /node_modules/pkg/package.json
//// {
//// "name": "pkg",
//// "type": "module",
//// "exports": {
//// "./*": {
//// "types": "./types/*",
//// "default": "./dist/*"
//// }
//// }
//// }
// @Filename: /node_modules/pkg/types/external.d.ts
//// export declare function external(name: string): any;
// @Filename: /package.json
//// {
//// "name": "self",
//// "type": "module",
//// "imports": {
//// "#*": "./src/*"
//// },
//// "dependencies": {
//// "pkg": "*"
//// }
//// }
// @Filename: /src/add.ts
//// export function add(a: number, b: number) {}
// @Filename: /src/index.ts
//// add/*imports*/;
//// external/*exports*/;
verify.importFixModuleSpecifiers("imports", ["#add.ts"]);
verify.importFixModuleSpecifiers("exports", ["pkg/external.js"]);
| {
"end_byte": 917,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportAllowImportingTsExtensionsPackageJsonImports1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports.ts_0_326 | /// <reference path='fourslash.ts'/>
// @isolatedDeclarations: true
// @declaration: true
////function foo() { return 42; }
////export const g = foo();
verify.codeFix({
description: "Add annotation of type 'number'",
index: 0,
newFileContent:
`function foo() { return 42; }
export const g: number = foo();`,
});
| {
"end_byte": 326,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingParam8.ts_0_326 | /// <reference path="fourslash.ts" />
////[|function f(a: number) {}|]
////
////const a = 1;
////const b = 1;
////const c = 1;
////f(a, b, c);
verify.codeFix({
description: [ts.Diagnostics.Add_missing_parameters_to_0.message, "f"],
index: 0,
newRangeContent: "function f(a: number, b: number, c: number) {}"
});
| {
"end_byte": 326,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingParam8.ts"
} |
TypeScript/tests/cases/fourslash/mispeltVariableForInLoopErrorRecovery.ts_0_167 | /// <reference path="fourslash.ts" />
////var alpha = [1, 2, 3];
////for (var beta in alpha) {
//// alpha[beat/**/]++;
////}
verify.not.errorExistsAfterMarker();
| {
"end_byte": 167,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/mispeltVariableForInLoopErrorRecovery.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefs_importType_typeofImport.ts_0_271 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////export const x = 0;
// @Filename: /b.ts
/////*1*/const x: typeof import("/*2*/./a") = { x: 0 };
/////*3*/const y: typeof import("/*4*/./a") = { x: 0 };
verify.baselineFindAllReferences('1', '2', '3', '4');
| {
"end_byte": 271,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefs_importType_typeofImport.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportExportEqualsPrimitive.ts_0_225 | /// <reference path="fourslash.ts" />
////[|valueOf/*0*/();|]
// @Filename: foo.ts
////declare var x: number;
////export = x;
verify.codeFixAvailable([
{ description: "Add missing function declaration 'valueOf'" }
]);
| {
"end_byte": 225,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportExportEqualsPrimitive.ts"
} |
TypeScript/tests/cases/fourslash/outliningSpansForImportAndExportAttributes.ts_0_759 | /// <reference path="fourslash.ts"/>
//// import { a1, a2 } from "a";
//// ;
//// import {
//// } from "a";
//// ;
//// import [|{
//// b1,
//// b2,
//// }|] from "b";
//// ;
//// import j1 from "./j" with { type: "json" };
//// ;
//// import j2 from "./j" with {
//// };
//// ;
//// import j3 from "./j" with [|{
//// type: "json"
//// }|];
//// ;
//// [|import { a5, a6 } from "a";
//// import [|{
//// a7,
//// a8,
//// }|] from "a";|]
//// export { a1, a2 };
//// ;
//// export { a3, a4 } from "a";
//// ;
//// export {
//// };
//// ;
//// export [|{
//// b1,
//// b2,
//// }|];
//// ;
//// export {
//// } from "b";
//// ;
//// export [|{
//// b3,
//// b4,
//// }|] from "b";
//// ;
verify.outliningSpansInCurrentFile(test.ranges());
| {
"end_byte": 759,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/outliningSpansForImportAndExportAttributes.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageRestParamJS.ts_0_580 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @noImplicitAny: true
// @Filename: important.js
/////** @param {number} a */
////function f(a: number, [|...rest|]){
//// a; rest;
////}
////f(1);
////f(2, "s1");
////f(3, "s1", "s2");
////f(3, "s1", "s2", "s3", "s4");
verify.codeFix({
description: "Infer parameter types from usage",
index: 2,
newFileContent:
`/**
* @param {number} a
* @param {string[]} rest
*/
function f(a: number, ...rest){
a; rest;
}
f(1);
f(2, "s1");
f(3, "s1", "s2");
f(3, "s1", "s2", "s3", "s4");`,
});
| {
"end_byte": 580,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageRestParamJS.ts"
} |
TypeScript/tests/cases/fourslash/unusedImports12FS.ts_0_323 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @Filename: file2.ts
//// [| import f1, * as s from "./file1"; |]
//// f1(42);
// @Filename: file1.ts
//// export function f1(n: number){}
//// export function f2(s: string){};
//// export default f1;
verify.rangeAfterCodeFix('import f1 from "./file1";'); | {
"end_byte": 323,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedImports12FS.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesAfterEdit.ts_0_261 | /// <reference path='fourslash.ts'/>
/////*0*/
////interface A {
//// foo: string;
////}
////function foo(x: A) {
//// x.f/*1*/oo
////}
verify.baselineDocumentHighlights("1");
goTo.marker("0");
edit.insert("\n");
verify.baselineDocumentHighlights("1");
| {
"end_byte": 261,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesAfterEdit.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertImport_namespaceToNamedWithTypes.ts_0_440 | /// <reference path='fourslash.ts' />
/////*a*/import * as m from "m";/*b*/
////declare const a: m.aa;
////declare const b: m.b;
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert import",
actionName: "Convert namespace import to named imports",
actionDescription: "Convert namespace import to named imports",
newContent:
`import { aa, b as b_1 } from "m";
declare const a: aa;
declare const b: b_1;`,
});
| {
"end_byte": 440,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertImport_namespaceToNamedWithTypes.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionInMemberDeclaration.ts_0_1047 | /// <reference path='fourslash.ts' />
////interface /*interfaceDefinition*/IFoo { method1(): number; }
////
////class /*classDefinition*/Foo implements IFoo {
//// public method1(): number { return 0; }
////}
////
////enum /*enumDefinition*/Enum { value1, value2 };
////
////class /*selfDefinition*/Bar {
//// public _interface: [|IFo/*interfaceReference*/o|] = new [|Fo/*classReferenceInInitializer*/o|]();
//// public _class: [|Fo/*classReference*/o|] = new Foo();
//// public _list: [|IF/*interfaceReferenceInList*/oo|][]=[];
//// public _enum: [|E/*enumReference*/num|] = [|En/*enumReferenceInInitializer*/um|].value1;
//// public _self: [|Ba/*selfReference*/r|];
////
//// constructor(public _inConstructor: [|IFo/*interfaceReferenceInConstructor*/o|]) {
//// }
////}
verify.baselineGoToDefinition(
"interfaceReference", "interfaceReferenceInList", "interfaceReferenceInConstructor",
"classReference", "classReferenceInInitializer",
"enumReference", "enumReferenceInInitializer",
"selfReference",
);
| {
"end_byte": 1047,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionInMemberDeclaration.ts"
} |
TypeScript/tests/cases/fourslash/inlineVariableTemplateString7.ts_0_346 | /// <reference path="fourslash.ts" />
////const /*a*/x/*b*/ = "`";
////export const y = `${x}`;
goTo.select("a", "b");
verify.refactorAvailable("Inline variable");
edit.applyRefactor({
refactorName: "Inline variable",
actionName: "Inline variable",
actionDescription: "Inline variable",
newContent: "export const y = `\\``;"
}); | {
"end_byte": 346,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlineVariableTemplateString7.ts"
} |
TypeScript/tests/cases/fourslash/renameModuleExportsProperties1.ts_3_243 | / <reference path='fourslash.ts' />
////[|class [|{| "contextRangeIndex": 0 |}A|] {}|]
////module.exports = { [|A|] }
const [r0Def, r0, r1] = test.ranges();
verify.baselineRename([r0, r1], { providePrefixAndSuffixTextForRename: true }); | {
"end_byte": 243,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameModuleExportsProperties1.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionImportMeta.ts_0_312 | /// <reference path='fourslash.ts' />
// @module: esnext
// @Filename: foo.ts
/////// <reference no-default-lib="true"/>
/////// <reference path='./bar.d.ts' />
////import.me/*reference*/ta;
//@Filename: bar.d.ts
////interface ImportMeta {
////}
verify.baselineGoToDefinition("reference");
verify.noErrors(); | {
"end_byte": 312,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionImportMeta.ts"
} |
TypeScript/tests/cases/fourslash/formattingSpaceBetweenParent.ts_0_403 | /// <reference path='fourslash.ts' />
/////*1*/foo(() => 1);
/////*2*/foo(1);
/////*3*/if((true)){}
format.setOption("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", true);
format.document();
goTo.marker("1");
verify.currentLineContentIs("foo( () => 1 );");
goTo.marker("2");
verify.currentLineContentIs("foo( 1 );");
goTo.marker("3");
verify.currentLineContentIs("if ( ( true ) ) { }");
| {
"end_byte": 403,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingSpaceBetweenParent.ts"
} |
TypeScript/tests/cases/fourslash/recursiveWrappedTypeParameters1.ts_0_551 | /// <reference path='fourslash.ts'/>
////interface I<T> {
//// a: T;
//// b: I<T>;
//// c: I<I<T>>;
////}
////var x: I<number>;
////var y/*1*/y = x.c.c.c.c.c.b;
////var a/*2*/a = x.a;
////var b/*3*/b = x.b;
////var c/*4*/c = x.c;
////var d/*5*/d = x.c.a;
////var e/*6*/e = x.c.b;
////var f/*7*/f = x.c.c;
verify.quickInfos({
1: "var yy: I<I<I<I<I<I<number>>>>>>",
2: "var aa: number",
3: "var bb: I<number>",
4: "var cc: I<I<number>>",
5: "var dd: I<number>",
6: "var ee: I<I<number>>",
7: "var ff: I<I<I<number>>>"
});
| {
"end_byte": 551,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/recursiveWrappedTypeParameters1.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFix_order2.ts_0_1006 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////export const _aB: number;
////export const _Ab: number;
////export const aB: number;
////export const Ab: number;
// @Filename: /b.ts
////[|import {
//// _aB,
//// _Ab,
//// Ab,
////} from "./a";
////aB;|]
// @Filename: /c.ts
////[|import {
//// _aB,
//// _Ab,
//// Ab,
////} from "./a";
////aB;|]
// the import in 'b.ts' isn't sorted per ordinal comparison, so the import is added to the end of the list
goTo.file("/b.ts");
verify.importFixAtPosition([
`import {
_aB,
_Ab,
Ab,
aB,
} from "./a";
aB;`,
], undefined, {
organizeImportsIgnoreCase: false,
organizeImportsCollation: "ordinal"
});
// the import in 'c.ts' *is* sorted per natural collation, so the import is added before `Ab`
goTo.file("/c.ts");
verify.importFixAtPosition([
`import {
_aB,
_Ab,
aB,
Ab,
} from "./a";
aB;`,
], undefined, {
organizeImportsIgnoreCase: false,
organizeImportsCollation: "unicode"
});
| {
"end_byte": 1006,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_order2.ts"
} |
TypeScript/tests/cases/fourslash/smartSelection_JSDocTags9.ts_0_156 | /// <reference path="fourslash.ts" />
/////** @enum {/**/number} */
////const Foo = {
//// x: 0,
//// y: 1,
////};
verify.baselineSmartSelection();
| {
"end_byte": 156,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartSelection_JSDocTags9.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType24.ts_0_406 | /// <reference path='fourslash.ts' />
//// type A<T, U> = () => <T>(v: T) => (v: T) => /*a*/<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) => U;
type A<T, U> = () => <T>(v: T) => (v: T) => NewType<U>;`,
});
| {
"end_byte": 406,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType24.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_overloads5.ts_0_651 | /// <reference path='fourslash.ts' />
// @Filename: /add.ts
////
// @Filename: /a.ts
////function add(x: number, y: number): number;
////[|function add(x: string, y: string): string;
////function add(x: any, y: any) {
//// return x + y;
////}|]
////export const a = add();
verify.moveToFile({
newFileContents: {
"/a.ts":
`import { add } from "./add";
export const a = add();`,
"/add.ts":
`
export function add(x: number, y: number): number;
export function add(x: string, y: string): string;
export function add(x: any, y: any) {
return x + y;
}
`
},
interactiveRefactorArguments: { targetFile: "/add.ts" },
});
| {
"end_byte": 651,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_overloads5.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpTaggedTemplates5.ts_0_482 | /// <reference path='fourslash.ts' />
//// function f(templateStrings, x, y, z) { return 10; }
//// function g(templateStrings, x, y, z) { return ""; }
////
//// f ` qwerty ${ 123 } asdf ${ 41234 } zxcvb ${/*1*/ /*2*/g/*3*/ /*4*/` `/*5*/ /*6*/} `
verify.signatureHelp({
marker: test.markers(),
text: "f(templateStrings: any, x: any, y: any, z: any): number",
argumentCount: 4,
parameterCount: 4,
parameterName: "z",
parameterSpan: "z: any",
});
| {
"end_byte": 482,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpTaggedTemplates5.ts"
} |
TypeScript/tests/cases/fourslash/unusedImports1FS.ts_0_240 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @Filename: file2.ts
//// [|import { Calculator } from "./file1" |]
// @Filename: file1.ts
//// export class Calculator {
////
//// }
verify.rangeAfterCodeFix('');
| {
"end_byte": 240,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedImports1FS.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_arrowFunctionWithType.ts_0_246 | /// <reference path='fourslash.ts' />
////const foo: (a: number, b: number) => number = /*a*/(a: number, b: number)/*b*/ => a + b;
////foo(1, 2);
goTo.select("a", "b");
verify.not.refactorAvailable("Convert parameters to destructured object");
| {
"end_byte": 246,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_arrowFunctionWithType.ts"
} |
TypeScript/tests/cases/fourslash/convertFunctionToEs6Class10.ts_0_367 | /// <reference path='fourslash.ts' />
// @allowNonTsExtensions: true
// @Filename: foo.js
////function Foo() {
//// this.a = 0;
////}
////Foo["a b c"] = function () {
////}
verify.codeFix({
description: "Convert function to an ES2015 class",
newFileContent:
`class Foo {
constructor() {
this.a = 0;
}
static "a b c"() {
}
}
`
});
| {
"end_byte": 367,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/convertFunctionToEs6Class10.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddOptionalParam9.ts_0_311 | /// <reference path="fourslash.ts" />
////[|function f() {}|]
////f("", { x: 1 }, [ "" ], true);
verify.codeFix({
description: [ts.Diagnostics.Add_optional_parameters_to_0.message, "f"],
index: 1,
newRangeContent: "function f(p0?: string, p1?: { x: number; }, p2?: string[], p3?: boolean) {}"
});
| {
"end_byte": 311,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddOptionalParam9.ts"
} |
TypeScript/tests/cases/fourslash/codeFixWrapJsxInFragment4.ts_0_217 | /// <reference path='fourslash.ts' />
// @jsx: react-jsxdev
// @Filename: /a.tsx
////[|<a></a><a />|]
verify.rangeAfterCodeFix(`<><a></a><a /></>`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 0);
| {
"end_byte": 217,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixWrapJsxInFragment4.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.